添加快捷键设置

This commit is contained in:
2025-08-19 21:37:57 +08:00
parent bb61bfcd2e
commit 2a7ab324be
8 changed files with 113 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ typedef struct mapping_notify_event_t {
typedef struct key_press_event_t {
event_type_t type;
uint32_t key_symbols;
uint32_t key_symbol;
uint32_t modifiers;
} key_press_event_t;

View File

@@ -24,7 +24,7 @@ struct monitor_t {
/* 为了避免引入 cairo 相关头文件,这里用 void *
* 指针代替实际的指针类型,使用时强转为相应指针类型使用即可 */
void *cr; /* cairo_t */
void *cr; /* cairo_t */
const layout_t *layout;
monitor_t *next;
@@ -73,6 +73,21 @@ typedef struct rule_t {
bool floating;
} rule_t;
typedef union user_action_arg_t {
bool b;
int32_t i;
uint32_t ui;
float f;
const void *ptr;
} user_action_arg_t;
typedef struct keybinding_t {
uint32_t modifiers;
uint32_t key_symbol;
void (*func)(const user_action_arg_t *);
const user_action_arg_t arg;
} keybinding_t;
typedef struct color_t {
uint32_t rgba;
uint32_t argb;

View File

@@ -2,8 +2,10 @@
#include <X11/cursorfont.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <xcb/xproto.h>
#include "types.h"
bool has_other_wm_running(void);
int get_xcb_connection_fd(void);
@@ -56,6 +58,8 @@ window_list_t *scan_window_list(void);
void free_window_list(window_list_t *window_list);
void clean_xcb(void);
void grab_keybindings(const keybinding_t *keys, const size_t length);
bool get_xresource_uint32(const char *name, uint32_t *value);
void get_xresource_string(const char *name, char **value, const char *fallback);
void clean_xresource(void);