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),
UpdateConfig(config::EwwConfig),
UpdateCss(String),
OpenInspector,
OpenMany {
windows: Vec<String>,
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);

View file

@ -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<daemon_response::DaemonResponseReceiver>) {
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,

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
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.