添加重启和退出快捷键

This commit is contained in:
2025-11-25 02:44:54 +08:00
parent b45eea11fa
commit a26a903a19
3 changed files with 13 additions and 1 deletions

View File

@@ -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();
}
}

View File

@@ -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);

View File

@@ -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}},
};