-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathutil.h
More file actions
170 lines (160 loc) · 7.53 KB
/
Copy pathutil.h
File metadata and controls
170 lines (160 loc) · 7.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/* See LICENSE file for copyright and license details. */
#include <stdint.h>
#ifndef MAX
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#endif
#ifndef MIN
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
#define NVL(A, B) ((A) == NULL ? (B) : (A))
#define CLAMP(A, MIN, MAX) ((A) < (MIN) ? (MIN) : ((A) > (MAX) ? (MAX) : (A)))
#define WRAP(A, MIN, MAX) ((A) < (MIN) ? (MAX) : ((A) > (MAX) ? (MIN) : (A)))
#ifdef _DEBUG
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#else
#define DEBUG(...)
#endif
#ifndef USE_KEYCODES
#define USE_KEYCODES 0
#endif
static const uint64_t
SmartGaps = 0x1, // enables no gaps if there is only one visible window
SmartGapsMonocle = 0x2, // enforces no (outer) gaps in monocle layout
Swallow = 0x4, // enables swallowing of clients
SwallowFloating = 0x8, // allow floating windows to swallow the terminal by default
CenteredWindowName = 0x10,
BarActiveGroupBorderColor = 0x20, // use border color of active group, otherwise normal scheme is used
BarMasterGroupBorderColor = 0x40, // use border color of master group, otherwise normal scheme is used
ColorEmoji = 0x80,
Status2DNoAlpha = 0x100, // option to not use alpha when drawing status2d status
Systray = 0x200, // enables systray
BarBorder = 0x400, // draw a border around the bar
NoBorders = 0x800, // as per the noborder patch, show no border when only one client in tiled mode
Warp = 0x1000, // warp patch
FocusedOnTop = 0x2000,
DecorationHints = 0x4000,
FocusOnNetActive = 0x8000,
AllowNoModifierButtons = 0x10000,
CenterSizeHintsClients = 0x20000, // center tiled clients subject to size hints within their tiled area
ResizeHints = 0x40000, // if enabled then dusk will respect size hints in tiled resizals
SortScreens = 0x80000, // only applies on startup
ViewOnWs = 0x100000, // follow a window to the workspace it is being moved to
Xresources = 0x200000, // xrdb patch
SnapToWindows = 0x400000, // snap to windows when moving floating clients
SnapToGaps = 0x800000, // snap to outer gaps when moving floating clients
AltWorkspaceIcons = 0x1000000, // show the workspace name instead of the icons
GreedyMonitor = 0x2000000, // when viewing a workspace the monitor is greedy and gives nothing in return (i.e. disables swap of workspaces)
SmartLayoutConversion = 0x4000000, // when moving a workspace from one monitor to another, automatically adjust layout based on monitor orientation (i.e. vertical vs horizontal)
SmartLayoutConvertion = 0x4000000, // typo correction alias for the above
AutoHideScratchpads = 0x8000000, // automatically hide open scratchpads when moving to another workspace
RioDrawIncludeBorders = 0x10000000, // indicates whether the area drawn using slop includes the window borders
RioDrawSpawnAsync = 0x20000000, // indicates whether to spawn the application alongside or after drawing area using slop
BarPadding = 0x40000000, // enables bar padding
RestrictFocusstackToMonitor = 0x80000000, // option to restrict focusstack to only operate within the monitor
AutoReduceNmaster = 0x100000000, // automatically reduce nmaster if there are multiple master clients and one is killed
WinTitleIcons = 0x200000000, // adds application icons to window titles in the bar
WorkspacePreview = 0x400000000, // adds preview images when hovering workspace icons in the bar
SpawnCwd = 0x800000000, // spawn applications in the currently selected client's working directory
SystrayNoAlpha = 0x1000000000, // option to not use alpha (transparency) for the systray
WorkspaceLabels = 0x2000000000, // adds the class of the master client next to the workspace icon
FlexWinBorders = 0x4000000000, // option to use the SchemeFlex* colour schemes, if disabled then SchemeTitle* is used instead
FocusOnClick = 0x8000000000, // only allow focus change when the user clicks on windows (disables sloppy focus)
FocusedOnTopTiled = 0x10000000000, // additional toggle to also allow focused tiled clients to display on top of floating windows
BanishMouseCursor = 0x20000000000, // like xbanish, hides mouse cursor when using the keyboard
FocusFollowMouse = 0x40000000000, // window that rests under the mouse cursor will get focus when changing workspace or killing clients
BanishMouseCursorToCorner = 0x80000000000, // makes BanishMouseCursor also move the cursor to top right corner of the screen
StackerIcons = 0x100000000000, // adds a stacker icon hints in window titles
AltWindowTitles = 0x200000000000, // show alternate window titles, if present
BarBorderColBg = 0x400000000000, // optionally use the background colour of the bar for the border as well, rather than border colur
FuncPlaceholder140737488355328 = 0x800000000000,
FuncPlaceholder281474976710656 = 0x1000000000000,
FuncPlaceholder562949953421312 = 0x2000000000000,
FuncPlaceholder1125899906842624 = 0x4000000000000,
FuncPlaceholder2251799813685248 = 0x8000000000000,
FuncPlaceholder4503599627370496 = 0x10000000000000,
FuncPlaceholder9007199254740992 = 0x20000000000000,
FuncPlaceholder18014398509481984 = 0x40000000000000,
FuncPlaceholder36028797018963968 = 0x80000000000000,
Debug = 0x100000000000000, // same name and value used for client flags, see flags.h
FuncPlaceholder144115188075855872 = 0x200000000000000,
FuncPlaceholder288230376151711744 = 0x400000000000000,
FuncPlaceholder576460752303423488 = 0x800000000000000,
FuncPlaceholder1152921504606846976 = 0x1000000000000000,
FuncPlaceholder2305843009213693952 = 0x2000000000000000,
FuncPlaceholder4611686018427387904 = 0x4000000000000000,
FuncPlaceholder9223372036854775808 = 0x8000000000000000;
struct nv {
const char *name;
uint64_t value;
};
#define map(F) { #F, F }
static const struct nv functionality_names[] = {
map(AllowNoModifierButtons),
map(AltWindowTitles),
map(AltWorkspaceIcons),
map(AutoHideScratchpads),
map(AutoReduceNmaster),
map(BanishMouseCursor),
map(BanishMouseCursorToCorner),
map(BarActiveGroupBorderColor),
map(BarBorder),
map(BarBorderColBg),
map(BarMasterGroupBorderColor),
map(BarPadding),
map(CenteredWindowName),
map(CenterSizeHintsClients),
map(ColorEmoji),
map(Debug),
map(DecorationHints),
map(FlexWinBorders),
map(FocusedOnTop),
map(FocusedOnTopTiled),
map(FocusFollowMouse),
map(FocusOnClick),
map(FocusOnNetActive),
map(GreedyMonitor),
map(NoBorders),
map(ResizeHints),
map(RestrictFocusstackToMonitor),
map(RioDrawIncludeBorders),
map(RioDrawSpawnAsync),
map(SmartGaps),
map(SmartGapsMonocle),
map(SmartLayoutConversion),
map(SnapToGaps),
map(SnapToWindows),
map(SortScreens),
map(SpawnCwd),
map(StackerIcons),
map(Status2DNoAlpha),
map(Swallow),
map(SwallowFloating),
map(Systray),
map(SystrayNoAlpha),
map(ViewOnWs),
map(Warp),
map(WinTitleIcons),
map(WorkspaceLabels),
map(WorkspacePreview),
map(Xresources),
{ NULL, 0 }
};
#undef map
void die(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size);
int enabled(const uint64_t functionality);
int disabled(const uint64_t functionality);
void enablefunc(const uint64_t functionality);
void disablefunc(const uint64_t functionality);
void togglefunc(const uint64_t functionality);
void setenabled(const uint64_t functionality, int enabled);
void freestrdup(char **dest, const char *src);
int freesprintf(char **dest, const char *format, ...);
int startswith(const char *needle, const char *haystack);
char *xasprintf(const char *fmt, ...);
char *path_dirname(const char *path);
#ifdef __linux__
size_t strlcpy(char * __restrict dst, const char * __restrict src, size_t dsize);
size_t strlcat(char *dst, const char *src, size_t siz);
#endif /* __linux__ */