From 1b2df75453b6288532099b56f396b4db141c79bf Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Fri, 1 Oct 2021 13:34:14 +0200 Subject: [PATCH] feat(cli): Add command to open the GTK debugger --- crates/eww/src/app.rs | 4 ++++ crates/eww/src/opts.rs | 5 +++++ docs/src/working_with_gtk.md | 12 ++++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/crates/eww/src/app.rs b/crates/eww/src/app.rs index b5b543f..ff81d79 100644 --- a/crates/eww/src/app.rs +++ b/crates/eww/src/app.rs @@ -28,6 +28,7 @@ pub enum DaemonCommand { ReloadConfigAndCss(DaemonResponseSender), UpdateConfig(config::EwwConfig), UpdateCss(String), + OpenInspector, OpenMany { windows: Vec, should_toggle: bool, @@ -94,6 +95,9 @@ impl App { let result: Result<_> = try { match event { DaemonCommand::NoOp => {} + DaemonCommand::OpenInspector => { + gtk::Window::set_interactive_debugging(true); + } DaemonCommand::UpdateVars(mappings) => { for (var_name, new_value) in mappings { self.update_state(var_name, new_value); diff --git a/crates/eww/src/opts.rs b/crates/eww/src/opts.rs index cc22f56..6debb78 100644 --- a/crates/eww/src/opts.rs +++ b/crates/eww/src/opts.rs @@ -76,6 +76,10 @@ pub enum ActionWithServer { mappings: Vec<(VarName, DynVal)>, }, + // Open the GTK debugger + #[structopt(name = "inspector", alias = "debugger")] + OpenInspector, + /// open a window #[structopt(name = "open", alias = "o")] OpenWindow { @@ -179,6 +183,7 @@ impl ActionWithServer { pub fn into_daemon_command(self) -> (app::DaemonCommand, Option) { let command = match self { ActionWithServer::Update { mappings } => app::DaemonCommand::UpdateVars(mappings), + ActionWithServer::OpenInspector => app::DaemonCommand::OpenInspector, ActionWithServer::KillServer => app::DaemonCommand::KillServer, ActionWithServer::CloseAll => app::DaemonCommand::CloseAll, diff --git a/docs/src/working_with_gtk.md b/docs/src/working_with_gtk.md index 8d8ae38..f960e96 100644 --- a/docs/src/working_with_gtk.md +++ b/docs/src/working_with_gtk.md @@ -14,16 +14,12 @@ SCSS is _very_ close to CSS so if you know CSS you'll have no problem learning S ## GTK-Debugger -The debugger can be used for **a lot** of things. Especially if something doesn't work or isn't styled right. to enable it launch your eww daemon with +The debugger can be used for **a lot** of things. Especially if something doesn't work or isn't styled right. + +To open the GTK debugger simply run ```bash -GTK_DEBUG=interactive eww daemon -``` - -or in fish - -```bash -env GTK_DEBUG=interactive eww daemon +eww inspector ``` If a style or something similar doesn't work you can click on the icon in the top left icon to select the thing that isn't being styled or isn't being styled correctly.