aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2025-12-26 22:38:41 +0100
committerPřemysl Eric Janouch <p@janouch.name>2025-12-26 22:38:41 +0100
commitcdc896f1c260f4cdb47e9e911c8cfcccca5143ff (patch)
tree5777a5ae2b89e4cae05f6a50b96f1b2a814dc1b1
parent0419303daa616d42ea222d002f1aea2f9ba7f26f (diff)
downloaddesktop-tools-cdc896f1c260f4cdb47e9e911c8cfcccca5143ff.tar.gz
desktop-tools-cdc896f1c260f4cdb47e9e911c8cfcccca5143ff.tar.xz
desktop-tools-cdc896f1c260f4cdb47e9e911c8cfcccca5143ff.zip
wmstatus: add an option to not binding any keys
This mainly makes for simpler debugging.
-rw-r--r--wmstatus.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/wmstatus.c b/wmstatus.c
index fc7cedf..d8a2568 100644
--- a/wmstatus.c
+++ b/wmstatus.c
@@ -2823,7 +2823,7 @@ init_bindings (struct app_context *ctx)
}
static void
-init_xlib_events (struct app_context *ctx)
+init_xlib_events (struct app_context *ctx, bool bind)
{
const int64_t *sleep_timer =
get_config_integer (ctx->config.root, "general.sleep_timer");
@@ -2836,7 +2836,9 @@ init_xlib_events (struct app_context *ctx)
XSyncPositiveComparison, ctx->idle_timeout);
}
- init_bindings (ctx);
+ if (bind)
+ init_bindings (ctx);
+
XSync (ctx->dpy, False);
ctx->x_event.dispatcher = on_x_ready;
@@ -3253,6 +3255,7 @@ main (int argc, char *argv[])
{ 'h', "help", NULL, 0, "display this help and exit" },
{ 'V', "version", NULL, 0, "output version information and exit" },
{ '3', "i3bar", NULL, 0, "print output for i3-bar/swaybar instead" },
+ { 'n', "no-bind", NULL, 0, "do not bind keys" },
{ 's', "bind-sway", NULL, 0, "import bindings over swaymsg" },
{ 'w', "write-default-cfg", "FILENAME",
OPT_OPTIONAL_ARG | OPT_LONG_ONLY,
@@ -3262,7 +3265,7 @@ main (int argc, char *argv[])
struct opt_handler oh = opt_handler_make (argc, argv, opts, "[ACTION...]",
"Set root window name.");
- bool i3bar = false;
+ bool bind = true, i3bar = false;
int c;
while ((c = opt_handler_get (&oh)) != -1)
@@ -3277,6 +3280,9 @@ main (int argc, char *argv[])
case 'V':
printf (PROGRAM_NAME " " PROGRAM_VERSION "\n");
exit (EXIT_SUCCESS);
+ case 'n':
+ bind = false;
+ break;
case '3':
i3bar = true;
break;
@@ -3324,7 +3330,7 @@ main (int argc, char *argv[])
poller_timer_init_and_set (&ctx.noise_timer, &ctx.poller,
on_noise_timer, &ctx);
- init_xlib_events (&ctx);
+ init_xlib_events (&ctx, bind);
if (i3bar)
ctx.backend = backend_i3_new ();