From a26a903a196625bd812e900a51d57edfb8af4f85 Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Tue, 25 Nov 2025 02:44:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=90=AF=E5=92=8C?= =?UTF-8?q?=E9=80=80=E5=87=BA=E5=BF=AB=E6=8D=B7=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/action.c | 9 +++++++++ src/action.h | 1 + src/default_config.h | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/action.c b/src/action.c index eb4f92d..fa2da2b 100644 --- a/src/action.c +++ b/src/action.c @@ -16,3 +16,12 @@ void spawn(const user_action_arg_t *arg) { g_spawn_command_line_async((const char *)arg->ptr, nullptr); } + +void quit(const user_action_arg_t *arg) { + const bool restart = arg->b; + if (restart) { + wm_restart(); + } else { + wm_quit(); + } +} diff --git a/src/action.h b/src/action.h index f0f472a..374a30e 100644 --- a/src/action.h +++ b/src/action.h @@ -50,3 +50,4 @@ typedef struct keyboard_t { void select_tag_of_current_monitor(const user_action_arg_t *arg); void spawn(const user_action_arg_t *arg); +void quit(const user_action_arg_t *arg); diff --git a/src/default_config.h b/src/default_config.h index 9b25158..0533e5e 100644 --- a/src/default_config.h +++ b/src/default_config.h @@ -28,5 +28,7 @@ static const button_t button_list[] = { static const char launcher[] = "rofi -show combi -modes window,drun,run,ssh,combi,windowcd"; static const keyboard_t key_list[] = { - {modifier_super, XK_p, spawn, {.ptr = launcher}}, + {modifier_alt, XK_p, spawn, {.ptr = launcher}}, + {modifier_alt, XK_q, quit, {.b = false}}, + {modifier_alt, XK_r, quit, {.b = true}}, };