format code index to tab no space

This commit is contained in:
DreamMaoMao
2025-06-07 13:53:12 +08:00
parent 0af8799a2d
commit 5aaf8d7625
11 changed files with 8896 additions and 8749 deletions
+4
View File
@@ -0,0 +1,4 @@
BasedOnStyle: LLVM
UseTab: Always
TabWidth: 4
IndentWidth: 4
+264 -256
View File
File diff suppressed because it is too large Load Diff
+21 -21
View File
@@ -7,34 +7,34 @@
#include <string.h>
static void die_if_null(void *ptr) {
if (!ptr) {
perror("Failed to allocate memory");
exit(EXIT_FAILURE);
}
if (!ptr) {
perror("Failed to allocate memory");
exit(EXIT_FAILURE);
}
}
void *xzalloc(size_t size) {
if (!size) {
return NULL;
}
void *ptr = calloc(1, size);
die_if_null(ptr);
return ptr;
if (!size) {
return NULL;
}
void *ptr = calloc(1, size);
die_if_null(ptr);
return ptr;
}
void *xrealloc(void *ptr, size_t size) {
if (!size) {
free(ptr);
return NULL;
}
ptr = realloc(ptr, size);
die_if_null(ptr);
return ptr;
if (!size) {
free(ptr);
return NULL;
}
ptr = realloc(ptr, size);
die_if_null(ptr);
return ptr;
}
char *xstrdup(const char *str) {
assert(str);
char *copy = strdup(str);
die_if_null(copy);
return copy;
assert(str);
char *copy = strdup(str);
die_if_null(copy);
return copy;
}
+8 -9
View File
@@ -47,18 +47,17 @@ char *xstrdup(const char *str);
* <ptr> before assigning the result.
*/
#define xstrdup_replace(ptr, str) \
do { \
free(ptr); \
(ptr) = xstrdup(str); \
} while (0)
do { \
free(ptr); \
(ptr) = xstrdup(str); \
} while (0)
/*
* Frees memory pointed to by <ptr> and sets <ptr> to NULL.
* Does nothing if <ptr> is already NULL.
*/
#define zfree(ptr) \
do { \
free(ptr); \
(ptr) = NULL; \
} while (0)
do { \
free(ptr); \
(ptr) = NULL; \
} while (0)
+43 -51
View File
@@ -11,71 +11,63 @@
#include <pcre2.h>
void die(const char *fmt, ...) {
va_list ap;
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
if (fmt[0] && fmt[strlen(fmt) - 1] == ':') {
fputc(' ', stderr);
perror(NULL);
} else {
fputc('\n', stderr);
}
if (fmt[0] && fmt[strlen(fmt) - 1] == ':') {
fputc(' ', stderr);
perror(NULL);
} else {
fputc('\n', stderr);
}
exit(1);
exit(1);
}
void *ecalloc(size_t nmemb, size_t size) {
void *p;
void *p;
if (!(p = calloc(nmemb, size)))
die("calloc:");
return p;
if (!(p = calloc(nmemb, size)))
die("calloc:");
return p;
}
int fd_set_nonblock(int fd) {
int flags = fcntl(fd, F_GETFL);
if (flags < 0) {
perror("fcntl(F_GETFL):");
return -1;
}
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
perror("fcntl(F_SETFL):");
return -1;
}
int flags = fcntl(fd, F_GETFL);
if (flags < 0) {
perror("fcntl(F_GETFL):");
return -1;
}
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
perror("fcntl(F_SETFL):");
return -1;
}
return 0;
return 0;
}
int regex_match(const char *pattern, const char *str) {
int errnum;
PCRE2_SIZE erroffset;
pcre2_code *re = pcre2_compile(
(PCRE2_SPTR)pattern,
PCRE2_ZERO_TERMINATED,
PCRE2_UTF, // 启用 UTF-8 支持
&errnum, &erroffset, NULL
);
if (!re) {
PCRE2_UCHAR errbuf[256];
pcre2_get_error_message(errnum, errbuf, sizeof(errbuf));
fprintf(stderr, "PCRE2 error: %s at offset %zu\n", errbuf, erroffset);
return 0;
}
int errnum;
PCRE2_SIZE erroffset;
pcre2_code *re = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED,
PCRE2_UTF, // 启用 UTF-8 支持
&errnum, &erroffset, NULL);
if (!re) {
PCRE2_UCHAR errbuf[256];
pcre2_get_error_message(errnum, errbuf, sizeof(errbuf));
fprintf(stderr, "PCRE2 error: %s at offset %zu\n", errbuf, erroffset);
return 0;
}
pcre2_match_data *match_data = pcre2_match_data_create_from_pattern(re, NULL);
int ret = pcre2_match(
re,
(PCRE2_SPTR)str,
strlen(str),
0, 0,
match_data,
NULL
);
pcre2_match_data *match_data =
pcre2_match_data_create_from_pattern(re, NULL);
int ret =
pcre2_match(re, (PCRE2_SPTR)str, strlen(str), 0, 0, match_data, NULL);
pcre2_match_data_free(match_data);
pcre2_code_free(re);
return ret >= 0;
pcre2_match_data_free(match_data);
pcre2_code_free(re);
return ret >= 0;
}
-1
View File
@@ -1,6 +1,5 @@
/* See LICENSE.dwm file for copyright and license details. */
void die(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size);
int fd_set_nonblock(int fd);
+1882 -1854
View File
File diff suppressed because it is too large Load Diff
+39 -39
View File
@@ -4,22 +4,22 @@
/* speedie's maomao config */
#define COLOR(hex) \
{((hex >> 24) & 0xFF) / 255.0f, ((hex >> 16) & 0xFF) / 255.0f, \
((hex >> 8) & 0xFF) / 255.0f, (hex & 0xFF) / 255.0f}
{((hex >> 24) & 0xFF) / 255.0f, ((hex >> 16) & 0xFF) / 255.0f, \
((hex >> 8) & 0xFF) / 255.0f, (hex & 0xFF) / 255.0f}
/* animaion */
char *animation_type_open = "slide"; // 是否启用动画 //slide,zoom
char *animation_type_close = "slide"; // 是否启用动画 //slide,zoom
int animations = 1; // 是否启用动画
char *animation_type_open = "slide"; // 是否启用动画 //slide,zoom
char *animation_type_close = "slide"; // 是否启用动画 //slide,zoom
int animations = 1; // 是否启用动画
int tag_animation_direction = HORIZONTAL; // 标签动画方向
int animation_fade_in = 1; // Enable animation fade in
int animation_fade_out = 1; // Enable animation fade out
float zoom_initial_ratio = 0.5; // 动画起始窗口比例
int animation_fade_in = 1; // Enable animation fade in
int animation_fade_out = 1; // Enable animation fade out
float zoom_initial_ratio = 0.5; // 动画起始窗口比例
float fadein_begin_opacity = 0.5; // Begin opac window ratio for animations
float fadeout_begin_opacity = 0.5; // Begin opac window ratio for animations
uint32_t animation_duration_move = 500; // Animation move speed
uint32_t animation_duration_open = 400; // Animation open speed
uint32_t animation_duration_tag = 300; // Animation tag speed
uint32_t animation_duration_move = 500; // Animation move speed
uint32_t animation_duration_open = 400; // Animation open speed
uint32_t animation_duration_tag = 300; // Animation tag speed
uint32_t animation_duration_close = 300; // Animation close speed
double animation_curve_move[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
double animation_curve_open[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
@@ -28,20 +28,20 @@ double animation_curve_close[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
/* appearance */
unsigned int axis_bind_apply_timeout = 100; // 滚轮绑定动作的触发的时间间隔
unsigned int focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
unsigned int new_is_master = 1; // 新窗口是否插在头部
double default_mfact = 0.55f; // master 窗口比例
double default_smfact = 0.5f; // 第一个stack窗口比例
unsigned int default_nmaster = 1; // 默认master数量
unsigned int focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
unsigned int new_is_master = 1; // 新窗口是否插在头部
double default_mfact = 0.55f; // master 窗口比例
double default_smfact = 0.5f; // 第一个stack窗口比例
unsigned int default_nmaster = 1; // 默认master数量
/* logging */
int log_level = WLR_ERROR;
unsigned int numlockon = 1; // 是否打开右边小键盘
unsigned int capslock = 0; // 是否启用快捷键
unsigned int capslock = 0; // 是否启用快捷键
unsigned int ov_tab_mode = 0; // alt tab切换模式
unsigned int hotarea_size = 10; // 热区大小,10x10
unsigned int ov_tab_mode = 0; // alt tab切换模式
unsigned int hotarea_size = 10; // 热区大小,10x10
unsigned int enable_hotarea = 1; // 是否启用鼠标热区
int smartgaps = 0; /* 1 means no outer gap when there is only one window */
int smartgaps = 0; /* 1 means no outer gap when there is only one window */
int sloppyfocus = 1; /* focus follows mouse */
unsigned int gappih = 5; /* horiz inner gap between windows */
unsigned int gappiv = 5; /* vert inner gap between windows */
@@ -65,8 +65,8 @@ unsigned int cursor_hide_timeout = 0;
unsigned int swipe_min_threshold = 20;
int bypass_surface_visibility =
0; /* 1 means idle inhibitors will disable idle tracking even if it's
surface isn't visible */
0; /* 1 means idle inhibitors will disable idle tracking even if it's
surface isn't visible */
unsigned int borderpx = 4; /* border pixel of windows */
float rootcolor[] = COLOR(0x323232ff);
float bordercolor[] = COLOR(0x444444ff);
@@ -78,36 +78,36 @@ float globalcolor[] = COLOR(0xb153a7ff);
float overlaycolor[] = COLOR(0x14a57cff);
// char *cursor_theme = "Bibata-Modern-Ice";
int overviewgappi = 5; /* overview时 窗口与边缘 缝隙大小 */
int overviewgappi = 5; /* overview时 窗口与边缘 缝隙大小 */
int overviewgappo = 30; /* overview时 窗口与窗口 缝隙大小 */
/* To conform the xdg-protocol, set the alpha to zero to restore the old
* behavior */
float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
int warpcursor = 1; /* Warp cursor to focused client */
int warpcursor = 1; /* Warp cursor to focused client */
int xwayland_persistence = 1; /* xwayland persistence */
/* layout(s) */
Layout overviewlayout = {"󰃇", overview, "overview"};
Layout layouts[] = {
// 最少两个,不能删除少于两个
/* symbol arrange function name */
{"S", scroller, "scroller"}, // 滚动布局
{"T", tile, "tile"}, // 堆栈布局
{"G", grid, "grid"}, {"M", monocle, "monocle"},
{"D", dwindle, "dwindle"}, {"P", spiral, "spiral"},
{"K", deck, "deck"},
// 最少两个,不能删除少于两个
/* symbol arrange function name */
{"S", scroller, "scroller"}, // 滚动布局
{"T", tile, "tile"}, // 堆栈布局
{"G", grid, "grid"}, {"M", monocle, "monocle"},
{"D", dwindle, "dwindle"}, {"P", spiral, "spiral"},
{"K", deck, "deck"},
};
/* keyboard */
struct xkb_rule_names xkb_rules = {
/* can specify fields: rules, model, layout, variant, options */
/* example:
.options = "ctrl:nocaps",
*/
.options = NULL,
/* can specify fields: rules, model, layout, variant, options */
/* example:
.options = "ctrl:nocaps",
*/
.options = NULL,
};
int repeat_rate = 25;
@@ -138,7 +138,7 @@ LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
*/
enum libinput_config_click_method click_method =
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
/* You can choose between:
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
@@ -152,7 +152,7 @@ LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
*/
enum libinput_config_accel_profile accel_profile =
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
double accel_speed = 0.0;
/* You can choose between:
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
@@ -164,5 +164,5 @@ enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
#define MODKEY WLR_MODIFIER_ALT
static const char *tags[] = {
"1", "2", "3", "4", "5", "6", "7", "8", "9",
"1", "2", "3", "4", "5", "6", "7", "8", "9",
};
+427 -417
View File
File diff suppressed because it is too large Load Diff
+5716 -5620
View File
File diff suppressed because it is too large Load Diff
+492 -481
View File
File diff suppressed because it is too large Load Diff