feat(action): 绑定 toggle_fullscreen/maximize/floating 快捷键

This commit is contained in:
2026-05-07 03:54:30 +08:00
parent 56f8380028
commit 8fcf46979a
4 changed files with 52 additions and 8 deletions

View File

@@ -3,7 +3,6 @@
#include <zdwm/action.h>
#include <zdwm/types.h>
#include "base/log.h"
#include "base/macros.h"
static constexpr char launcher[] =
@@ -32,7 +31,6 @@ static void quit(
const zdwm_action_api_t *api,
const zdwm_action_arg_t *arg
) {
logger("quit: restart: %s\n", arg->b ? "true" : "false");
api->quit(runtime, arg->b);
}
@@ -45,6 +43,30 @@ static void raise_or_run(
api->raise_or_run(runtime, args->class_name, args->command);
}
static void toggle_fullscreen(
zdwm_runtime_t *runtime,
const zdwm_action_api_t *api,
const zdwm_action_arg_t *arg
) {
api->toggle_fullscreen(runtime);
}
static void toggle_maximize(
zdwm_runtime_t *runtime,
const zdwm_action_api_t *api,
const zdwm_action_arg_t *arg
) {
api->toggle_maximize(runtime);
}
static void toggle_floating(
zdwm_runtime_t *runtime,
const zdwm_action_api_t *api,
const zdwm_action_arg_t *arg
) {
api->toggle_floating(runtime);
}
bool config_defaults_build(
const zdwm_api_t *api,
zdwm_config_builder_t *builder,
@@ -118,6 +140,9 @@ bool config_defaults_build(
BIND(default_mode, Super "+e", raise_or_run, {.ptr = &editor});
BIND(default_mode, Super "+q", raise_or_run, {.ptr = &browser});
BIND(default_mode, Super "+a", raise_or_run, {.ptr = &chrome});
BIND(default_mode, Super "+f", toggle_fullscreen, {0});
BIND(default_mode, Super "+m", toggle_maximize, {0});
BIND(default_mode, Super "+Control+space", toggle_floating, {0});
#undef BIND