feat(cli): Add command to open the GTK debugger

This commit is contained in:
elkowar 2021-10-01 13:34:14 +02:00
parent e49d39e108
commit 1b2df75453
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
3 changed files with 13 additions and 8 deletions

View file

@ -28,6 +28,7 @@ pub enum DaemonCommand {
ReloadConfigAndCss(DaemonResponseSender), ReloadConfigAndCss(DaemonResponseSender),
UpdateConfig(config::EwwConfig), UpdateConfig(config::EwwConfig),
UpdateCss(String), UpdateCss(String),
OpenInspector,
OpenMany { OpenMany {
windows: Vec<String>, windows: Vec<String>,
should_toggle: bool, should_toggle: bool,
@ -94,6 +95,9 @@ impl App {
let result: Result<_> = try { let result: Result<_> = try {
match event { match event {
DaemonCommand::NoOp => {} DaemonCommand::NoOp => {}
DaemonCommand::OpenInspector => {
gtk::Window::set_interactive_debugging(true);
}
DaemonCommand::UpdateVars(mappings) => { DaemonCommand::UpdateVars(mappings) => {
for (var_name, new_value) in mappings { for (var_name, new_value) in mappings {
self.update_state(var_name, new_value); self.update_state(var_name, new_value);

View file

@ -76,6 +76,10 @@ pub enum ActionWithServer {
mappings: Vec<(VarName, DynVal)>, mappings: Vec<(VarName, DynVal)>,
}, },
// Open the GTK debugger
#[structopt(name = "inspector", alias = "debugger")]
OpenInspector,
/// open a window /// open a window
#[structopt(name = "open", alias = "o")] #[structopt(name = "open", alias = "o")]
OpenWindow { OpenWindow {
@ -179,6 +183,7 @@ impl ActionWithServer {
pub fn into_daemon_command(self) -> (app::DaemonCommand, Option<daemon_response::DaemonResponseReceiver>) { pub fn into_daemon_command(self) -> (app::DaemonCommand, Option<daemon_response::DaemonResponseReceiver>) {
let command = match self { let command = match self {
ActionWithServer::Update { mappings } => app::DaemonCommand::UpdateVars(mappings), ActionWithServer::Update { mappings } => app::DaemonCommand::UpdateVars(mappings),
ActionWithServer::OpenInspector => app::DaemonCommand::OpenInspector,
ActionWithServer::KillServer => app::DaemonCommand::KillServer, ActionWithServer::KillServer => app::DaemonCommand::KillServer,
ActionWithServer::CloseAll => app::DaemonCommand::CloseAll, ActionWithServer::CloseAll => app::DaemonCommand::CloseAll,

View file

@ -14,16 +14,12 @@ SCSS is _very_ close to CSS so if you know CSS you'll have no problem learning S
## GTK-Debugger ## 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 ```bash
GTK_DEBUG=interactive eww daemon eww inspector
```
or in fish
```bash
env GTK_DEBUG=interactive eww daemon
``` ```
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. 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.