retab
This commit is contained in:
parent
fbb6a9ac3c
commit
c0c0adc645
7 changed files with 1283 additions and 1279 deletions
680
config.h
680
config.h
|
@ -1,351 +1,355 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#define BROWSER "librewolf"
|
#define BROWSER "librewolf"
|
||||||
#define TERMINAL "kitty"
|
#define TERMINAL "kitty"
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
/* Settings */
|
/* Settings */
|
||||||
#if !PERTAG_PATCH
|
#if !PERTAG_PATCH
|
||||||
static int enablegaps = 0;
|
static int enablegaps = 0;
|
||||||
#endif
|
#endif
|
||||||
static unsigned int borderpx = 2; /* border pixel of windows */
|
static unsigned int borderpx = 2; /* border pixel of windows */
|
||||||
static unsigned int snap = 20; /* snap pixel */
|
static unsigned int snap = 20; /* snap pixel */
|
||||||
static unsigned int gappih = 10; /* horiz inner gap between windows */
|
static unsigned int gappih = 10; /* horiz inner gap between windows */
|
||||||
static unsigned int gappiv = 10; /* vert inner gap between windows */
|
static unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||||
static unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
static unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||||
static unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
static unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
||||||
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||||
static int showbar = 1; /* 0 means no bar */
|
static int showbar = 1; /* 0 means no bar */
|
||||||
static int topbar = 1; /* 0 means bottom bar */
|
static int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char *fonts[] = { "monospace:pixelsize=14", "monospace:pixelsize=20", "monospace:pixelsize=30", "Noto Color Emoji:pixelsize=14:antialias=true:autohint=true" };
|
static const char *fonts[] = { "monospace:pixelsize=14", "monospace:pixelsize=20", "monospace:pixelsize=30", "Noto Color Emoji:pixelsize=14:antialias=true:autohint=true" };
|
||||||
|
|
||||||
static char color0[] = "#000000";
|
static char color0[] = "#000000";
|
||||||
static char color1[] = "#7f0000";
|
static char color1[] = "#7f0000";
|
||||||
static char color2[] = "#007f00";
|
static char color2[] = "#007f00";
|
||||||
static char color3[] = "#7f7f00";
|
static char color3[] = "#7f7f00";
|
||||||
static char color4[] = "#00007f";
|
static char color4[] = "#00007f";
|
||||||
static char color5[] = "#7f007f";
|
static char color5[] = "#7f007f";
|
||||||
static char color6[] = "#007f7f";
|
static char color6[] = "#007f7f";
|
||||||
static char color7[] = "#cccccc";
|
static char color7[] = "#cccccc";
|
||||||
static char color8[] = "#333333";
|
static char color8[] = "#333333";
|
||||||
static char color9[] = "#ff0000";
|
static char color9[] = "#ff0000";
|
||||||
static char color10[] = "#00ff00";
|
static char color10[] = "#00ff00";
|
||||||
static char color11[] = "#ffff00";
|
static char color11[] = "#ffff00";
|
||||||
static char color12[] = "#0000ff";
|
static char color12[] = "#0000ff";
|
||||||
static char color13[] = "#ff00ff";
|
static char color13[] = "#ff00ff";
|
||||||
static char color14[] = "#00ffff";
|
static char color14[] = "#00ffff";
|
||||||
static char color15[] = "#ffffff";
|
static char color15[] = "#ffffff";
|
||||||
static char bordernorm[] = "#222222";
|
static char bordernorm[] = "#222222";
|
||||||
static char bordersel[] = "#444444";
|
static char bordersel[] = "#444444";
|
||||||
static char *colors[][3] = {
|
static char *colors[][3] = {
|
||||||
/* fg bg border */
|
/* fg bg border */
|
||||||
[SchemeNorm] = { color15, color0, bordernorm },
|
[SchemeNorm] = { color15, color0, bordernorm },
|
||||||
[SchemeSel] = { color15, color4, bordersel },
|
[SchemeSel] = { color15, color4, bordersel },
|
||||||
[SchemeStatus] = { color7, color0, "#000000" }, // Statusbar right
|
[SchemeStatus] = { color7, color0, "#000000" }, // Statusbar right
|
||||||
[SchemeTagsSel] = { color0, color4, "#000000" }, // Tagbar left selected
|
[SchemeTagsSel] = { color0, color4, "#000000" }, // Tagbar left selected
|
||||||
[SchemeTagsNorm] = { color7, color0, "#000000" }, // Tagbar left unselected
|
[SchemeTagsNorm] = { color7, color0, "#000000" }, // Tagbar left unselected
|
||||||
[SchemeInfoSel] = { color7, color0, "#000000" }, // infobar middle selected
|
[SchemeInfoSel] = { color7, color0, "#000000" }, // infobar middle selected
|
||||||
[SchemeInfoNorm] = { color7, color0, "#000000" }, // infobar middle unselected
|
[SchemeInfoNorm] = { color7, color0, "#000000" }, // infobar middle unselected
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Colors for SGR escapes */
|
/* Colors for SGR escapes */
|
||||||
static const char *barcolors[] = {
|
static const char *barcolors[] = {
|
||||||
color0,
|
color0,
|
||||||
color1,
|
color1,
|
||||||
color2,
|
color2,
|
||||||
color3,
|
color3,
|
||||||
color4,
|
color4,
|
||||||
color5,
|
color5,
|
||||||
color6,
|
color6,
|
||||||
color7,
|
color7,
|
||||||
color8,
|
color8,
|
||||||
color9,
|
color9,
|
||||||
color10,
|
color10,
|
||||||
color11,
|
color11,
|
||||||
color12,
|
color12,
|
||||||
color13,
|
color13,
|
||||||
color14,
|
color14,
|
||||||
color15,
|
color15,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
/* xprop(1):
|
/* xprop(1):
|
||||||
* WM_CLASS(STRING) = instance, class
|
* WM_CLASS(STRING) = instance, class
|
||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
* If X, Y, W or H are between 0 and 1 (inclusive), their values interpreted as percentages of the current monitor resolution.
|
* If X, Y, W or H are between 0 and 1 (inclusive), their values interpreted as percentages of the current monitor resolution.
|
||||||
* If X or Y are negative, they are subtracted from the current monitor resolution and then that value is interpreted.
|
* If X or Y are negative, they are subtracted from the current monitor resolution and then that value is interpreted.
|
||||||
class instance title scratch key tags mask isfloating isterminal noswallow x, y, w, h borderpx */
|
class instance title scratch key tags mask isfloating isterminal noswallow x, y, w, h borderpx */
|
||||||
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, 0, 0, 0, 0, -1 },
|
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, 0, 0, 0, 0, -1 },
|
||||||
{ "kitty", "kitty", NULL, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1 },
|
{ "Xournalpp", "xournalpp", NULL, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1 },
|
||||||
{ "Qalculate-gtk", NULL, NULL, 'q', 0, 1, 0, 0, .5, .5, 722, 512, -1 },
|
{ "Zathura", "org.pwmt.zathura", NULL, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1 },
|
||||||
{ NULL, "spterm", NULL, 't', 0, 1, 1, 0, .5, .5, 1, 1, 0 },
|
{ NULL, "kitty", NULL, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1 },
|
||||||
{ NULL, "splf", NULL, 'l', 0, 1, 0, 0, .5, .5, .8, .8, -1 },
|
{ "Qalculate-gtk", NULL, NULL, 'q', 0, 1, 0, 0, .5, .5, 722, 512, -1 },
|
||||||
{ NULL, "sphtop", NULL, 'h', 0, 1, 0, 0, .5, .5, .8, .8, -1 },
|
{ NULL, "spterm", NULL, 't', 0, 1, 1, 0, .5, .5, 1, 1, 0 },
|
||||||
{ NULL, "spmix", NULL, 'm', 0, 1, 0, 0, -4, -4, 900, 600, -1 },
|
{ NULL, "splf", NULL, 'l', 0, 1, 0, 0, .5, .5, .8, .8, -1 },
|
||||||
|
{ NULL, "sphtop", NULL, 'h', 0, 1, 0, 0, .5, .5, .8, .8, -1 },
|
||||||
};
|
{ NULL, "spmix", NULL, 'm', 0, 1, 0, 0, -4, -4, 900, 600, -1 },
|
||||||
|
};
|
||||||
/* layout(s) */
|
|
||||||
static float mfact = 0.50; /* factor of master area size [0.05..0.95] */
|
/* layout(s) */
|
||||||
static int nmaster = 1; /* number of clients in master area */
|
static float mfact = 0.50; /* factor of master area size [0.05..0.95] */
|
||||||
static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
static int nmaster = 1; /* number of clients in master area */
|
||||||
static int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
|
static int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
#define FORCE_VSPLIT 1 /* nrowgrid layout: force two clients to always split vertically */
|
|
||||||
#include "vanitygaps.c"
|
#define FORCE_VSPLIT 1 /* nrowgrid layout: force two clients to always split vertically */
|
||||||
|
#include "vanitygaps.c"
|
||||||
static const Layout layouts[] = {
|
|
||||||
/* symbol arrange function */
|
static const Layout layouts[] = {
|
||||||
{ "[]=", tile }, /* first entry is default */
|
/* symbol arrange function */
|
||||||
{ "[M]", monocle },
|
{ "[]=", tile }, /* first entry is default */
|
||||||
{ "[@]", spiral },
|
{ "[M]", monocle },
|
||||||
{ "[\\]", dwindle },
|
{ "[@]", spiral },
|
||||||
{ "H[]", deck },
|
{ "[\\]", dwindle },
|
||||||
{ "TTT", bstack },
|
{ "H[]", deck },
|
||||||
{ "===", bstackhoriz },
|
{ "TTT", bstack },
|
||||||
{ "HHH", grid },
|
{ "===", bstackhoriz },
|
||||||
{ "###", nrowgrid },
|
{ "HHH", grid },
|
||||||
{ "---", horizgrid },
|
{ "###", nrowgrid },
|
||||||
{ ":::", gaplessgrid },
|
{ "---", horizgrid },
|
||||||
{ "|M|", centeredmaster },
|
{ ":::", gaplessgrid },
|
||||||
{ ">M>", centeredfloatingmaster },
|
{ "|M|", centeredmaster },
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ ">M>", centeredfloatingmaster },
|
||||||
{ NULL, NULL },
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
};
|
{ NULL, NULL },
|
||||||
|
};
|
||||||
/* key definitions */
|
|
||||||
#define MODKEY Mod4Mask
|
/* key definitions */
|
||||||
#define TAGKEYS(KEY,TAG) \
|
#define MODKEY Mod4Mask
|
||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
#define TAGKEYS(KEY,TAG) \
|
||||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||||
#define STACKKEYS(MOD,ACTION) \
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||||
{MOD, XK_j, ACTION##stack, {.i = INC(+1)}}, \
|
#define STACKKEYS(MOD,ACTION) \
|
||||||
{MOD, XK_k, ACTION##stack, {.i = INC(-1)}}, \
|
{MOD, XK_j, ACTION##stack, {.i = INC(+1)}}, \
|
||||||
{MOD, XK_v, ACTION##stack, {.i = 0}}, \
|
{MOD, XK_k, ACTION##stack, {.i = INC(-1)}}, \
|
||||||
/*{MOD, XK_grave, ACTION##stack, {.i = PREVSEL}}, \ */
|
{MOD, XK_v, ACTION##stack, {.i = 0}}, \
|
||||||
/*{MOD, XK_a, ACTION##stack, {.i = 1}}, \ */
|
/*{MOD, XK_grave, ACTION##stack, {.i = PREVSEL}}, \ */
|
||||||
/*{MOD, XK_z, ACTION##stack, {.i = 2}}, \ */
|
/*{MOD, XK_a, ACTION##stack, {.i = 1}}, \ */
|
||||||
/*{MOD, XK_x, ACTION##stack, {.i = -1}}, */
|
/*{MOD, XK_z, ACTION##stack, {.i = 2}}, \ */
|
||||||
|
/*{MOD, XK_x, ACTION##stack, {.i = -1}}, */
|
||||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
|
||||||
#define SHCMD(cmd) { .v = (const char*[]){"/bin/sh", "-c", cmd, NULL} }
|
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||||
|
#define SHCMD(cmd) { .v = (const char*[]){"/bin/sh", "-c", cmd, NULL} }
|
||||||
/* commands */
|
|
||||||
|
/* commands */
|
||||||
static const char *spterm[] = { "t", "/bin/sh", "-c", "$TERMINAL --name spterm --config ~/.config/kitty/kitty.conf --config ~/.config/kitty/kittyfullscreen.conf" };
|
static const char *spterm[] = { "t", "/bin/sh", "-c", "$TERMINAL --name spterm --config ~/.config/kitty/kitty.conf --config ~/.config/kitty/kittyfullscreen.conf" };
|
||||||
static const char *spqalc[] = { "q", "qalculate-gtk", NULL };
|
static const char *spqalc[] = { "q", "qalculate-gtk", NULL };
|
||||||
static const char *splf[] = { "l", TERMINAL, "--name", "splf", "-d", "~", "-e", "lf", NULL };
|
static const char *splf[] = { "l", TERMINAL, "--name", "splf", "-d", "~", "-e", "lf", NULL };
|
||||||
static const char *sphtop[] = { "h", TERMINAL, "--name", "sphtop", "-e", "htop", NULL };
|
static const char *sphtop[] = { "h", TERMINAL, "--name", "sphtop", "-e", "htop", NULL };
|
||||||
static const char *spmix[] = { "m", "/bin/sh", "-c", "$TERMINAL --name spmix -e pulsemixer; pkill -RTMIN+10 dwmblocks" };
|
static const char *spmix[] = { "m", "/bin/sh", "-c", "$TERMINAL --name spmix -e pulsemixer; pkill -RTMIN+10 dwmblocks" };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Xresources preferences to load at startup
|
* Xresources preferences to load at startup
|
||||||
*/
|
*/
|
||||||
ResourcePref resources[] = {
|
ResourcePref resources[] = {
|
||||||
{ "color0", STRING, &color0 },
|
{ "color0", STRING, &color0 },
|
||||||
{ "color1", STRING, &color1 },
|
{ "color1", STRING, &color1 },
|
||||||
{ "color2", STRING, &color2 },
|
{ "color2", STRING, &color2 },
|
||||||
{ "color3", STRING, &color3 },
|
{ "color3", STRING, &color3 },
|
||||||
{ "color4", STRING, &color4 },
|
{ "color4", STRING, &color4 },
|
||||||
{ "color5", STRING, &color5 },
|
{ "color5", STRING, &color5 },
|
||||||
{ "color6", STRING, &color6 },
|
{ "color6", STRING, &color6 },
|
||||||
{ "color7", STRING, &color7 },
|
{ "color7", STRING, &color7 },
|
||||||
{ "color8", STRING, &color8 },
|
{ "color8", STRING, &color8 },
|
||||||
{ "color9", STRING, &color9 },
|
{ "color9", STRING, &color9 },
|
||||||
{ "color10", STRING, &color10 },
|
{ "color10", STRING, &color10 },
|
||||||
{ "color11", STRING, &color11 },
|
{ "color11", STRING, &color11 },
|
||||||
{ "color12", STRING, &color12 },
|
{ "color12", STRING, &color12 },
|
||||||
{ "color13", STRING, &color13 },
|
{ "color13", STRING, &color13 },
|
||||||
{ "color14", STRING, &color14 },
|
{ "color14", STRING, &color14 },
|
||||||
{ "color15", STRING, &color15 },
|
{ "color15", STRING, &color15 },
|
||||||
{ "bordernorm", STRING, &bordernorm },
|
{ "bordernorm", STRING, &bordernorm },
|
||||||
{ "bordersel", STRING, &bordersel },
|
{ "bordersel", STRING, &bordersel },
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <X11/XF86keysym.h>
|
#include <X11/XF86keysym.h>
|
||||||
|
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
STACKKEYS(MODKEY, focus) STACKKEYS(MODKEY | ShiftMask, push)
|
STACKKEYS(MODKEY, focus) STACKKEYS(MODKEY | ShiftMask, push)
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/keybinds.mom -Tpdf | zathura -") },
|
{ MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/keybinds.mom -Tpdf | zathura -") },
|
||||||
{ MODKEY, XK_F2, spawn, {.v = (const char *[]){TERMINAL, "-e", "deluge-console", NULL}} },
|
{ MODKEY, XK_F2, spawn, {.v = (const char *[]){TERMINAL, "-e", "deluge-console", NULL}} },
|
||||||
{ MODKEY, XK_F3, togglescratch, {.v = spmix} },
|
{ MODKEY, XK_F3, togglescratch, {.v = spmix} },
|
||||||
/*{ MODKEY, XK_F4, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_F4, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_F5, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_F5, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_F6, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_F6, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_F7, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_F7, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_F8, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_F8, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_F9, spawn, {.v = (const char *[]){"dmenumount", NULL}} },
|
{ MODKEY, XK_F9, spawn, {.v = (const char *[]){"dmenumount", NULL}} },
|
||||||
{ MODKEY, XK_F10, spawn, {.v = (const char *[]){"dmenuumount", NULL}} },
|
{ MODKEY, XK_F10, spawn, {.v = (const char *[]){"dmenuumount", NULL}} },
|
||||||
/*{ MODKEY, XK_F11, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_F11, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_F12, spawn, {.v = (const char *[]){"xkb-switch", "-n", NULL}} },
|
{ MODKEY, XK_F12, spawn, {.v = (const char *[]){"remaps", NULL}} },
|
||||||
{ MODKEY, XK_asciicircum, spawn, {.v = (const char *[]){"dmenuunicode", NULL}} },
|
{ MODKEY, XK_asciicircum, spawn, {.v = (const char *[]){"dmenuunicode", NULL}} },
|
||||||
/*{ MODKEY | ShiftMask, XK_asciicircum, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_asciicircum, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
TAGKEYS( XK_3, 2)
|
TAGKEYS( XK_3, 2)
|
||||||
TAGKEYS( XK_4, 3)
|
TAGKEYS( XK_4, 3)
|
||||||
TAGKEYS( XK_5, 4)
|
TAGKEYS( XK_5, 4)
|
||||||
TAGKEYS( XK_6, 5)
|
TAGKEYS( XK_6, 5)
|
||||||
TAGKEYS( XK_7, 6)
|
TAGKEYS( XK_7, 6)
|
||||||
TAGKEYS( XK_8, 7)
|
TAGKEYS( XK_8, 7)
|
||||||
TAGKEYS( XK_9, 8)
|
TAGKEYS( XK_9, 8)
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0} },
|
{ MODKEY, XK_0, view, {.ui = ~0} },
|
||||||
{ MODKEY | ShiftMask, XK_0, tag, {.ui = ~0} },
|
{ MODKEY | ShiftMask, XK_0, tag, {.ui = ~0} },
|
||||||
{ MODKEY, XK_ssharp, spawn, SHCMD("pamixer --allow-boost -d 5; pkill -RTMIN+10 dwmblocks)") },
|
{ MODKEY, XK_ssharp, spawn, SHCMD("pamixer --allow-boost -d 5; pkill -RTMIN+10 dwmblocks)") },
|
||||||
{ MODKEY | ShiftMask, XK_ssharp, spawn, SHCMD("pamixer --allow-boost -d 15; pkill -RTMIN+10 dwmblocks)") },
|
{ MODKEY | ShiftMask, XK_ssharp, spawn, SHCMD("pamixer --allow-boost -d 15; pkill -RTMIN+10 dwmblocks)") },
|
||||||
{ MODKEY, XK_acute, spawn, SHCMD("pamixer --allow-boost -i 5; pkill -RTMIN+10 dwmblocks)") },
|
{ MODKEY, XK_acute, spawn, SHCMD("pamixer --allow-boost -i 5; pkill -RTMIN+10 dwmblocks)") },
|
||||||
{ MODKEY | ShiftMask, XK_acute, spawn, SHCMD("pamixer --allow-boost -i 15; pkill -RTMIN+10 dwmblocks)") },
|
{ MODKEY | ShiftMask, XK_acute, spawn, SHCMD("pamixer --allow-boost -i 15; pkill -RTMIN+10 dwmblocks)") },
|
||||||
{ MODKEY, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
{ MODKEY, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
{ MODKEY | ShiftMask, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
/*{ MODKEY|ShiftMask, XK_Tab, spawn, {.v = (const char *[]){NULL}}},*/
|
/*{ MODKEY|ShiftMask, XK_Tab, spawn, {.v = (const char *[]){NULL}}},*/
|
||||||
{ MODKEY, XK_q, killclient, {0} },
|
{ MODKEY, XK_q, killclient, {0} },
|
||||||
{ MODKEY | ShiftMask, XK_q, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
{ MODKEY | ShiftMask, XK_q, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
||||||
{ MODKEY, XK_w, spawn, {.v = (const char *[]){BROWSER, NULL}} },
|
{ MODKEY, XK_w, spawn, {.v = (const char *[]){BROWSER, NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_w, spawn, {.v = (const char *[]){TERMINAL, "-e", "sudo", "nmtui", NULL}} },
|
{ MODKEY | ShiftMask, XK_w, spawn, {.v = (const char *[]){TERMINAL, "-e", "sudo", "nmtui", NULL}} },
|
||||||
{ MODKEY, XK_e, togglescratch, {.v = splf} },
|
{ MODKEY, XK_e, togglescratch, {.v = splf} },
|
||||||
/*{ MODKEY | ShiftMask, XK_e, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_e, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_r, togglescratch, {.v = sphtop} },
|
{ MODKEY, XK_r, togglescratch, {.v = sphtop} },
|
||||||
{ MODKEY | ShiftMask, XK_r, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
|
{ MODKEY | ShiftMask, XK_r, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
|
||||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tile */
|
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tile */
|
||||||
{ MODKEY | ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, /* bstack */
|
{ MODKEY | ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, /* bstack */
|
||||||
{ MODKEY, XK_z, setlayout, {.v = &layouts[2]} }, /* spiral */
|
{ MODKEY, XK_z, setlayout, {.v = &layouts[2]} }, /* spiral */
|
||||||
{ MODKEY | ShiftMask, XK_z, setlayout, {.v = &layouts[3]} }, /* dwindle */
|
{ MODKEY | ShiftMask, XK_z, setlayout, {.v = &layouts[3]} }, /* dwindle */
|
||||||
{ MODKEY, XK_u, setlayout, {.v = &layouts[4]} }, /* deck */
|
{ MODKEY, XK_u, setlayout, {.v = &layouts[4]} }, /* deck */
|
||||||
{ MODKEY | ShiftMask, XK_u, setlayout, {.v = &layouts[5]} }, /* monocle */
|
{ MODKEY | ShiftMask, XK_u, setlayout, {.v = &layouts[5]} }, /* monocle */
|
||||||
{ MODKEY, XK_i, setlayout, {.v = &layouts[6]} }, /* centeredmaster */
|
{ MODKEY, XK_i, setlayout, {.v = &layouts[6]} }, /* centeredmaster */
|
||||||
{ MODKEY | ShiftMask, XK_i, setlayout, {.v = &layouts[7]} }, /* centeredfloatingmaster */
|
{ MODKEY | ShiftMask, XK_i, setlayout, {.v = &layouts[7]} }, /* centeredfloatingmaster */
|
||||||
{ MODKEY, XK_o, incnmaster, {.i = +1} },
|
{ MODKEY, XK_o, incnmaster, {.i = +1} },
|
||||||
{ MODKEY | ShiftMask, XK_o, incnmaster, {.i = -1} },
|
{ MODKEY | ShiftMask, XK_o, incnmaster, {.i = -1} },
|
||||||
{ MODKEY, XK_p, spawn, {.v = (const char *[]){"mpc", "toggle", NULL}} },
|
{ MODKEY, XK_p, spawn, {.v = (const char *[]){"mpc", "toggle", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_p, spawn, SHCMD("mpc pause ; pauseallmpv") },
|
{ MODKEY | ShiftMask, XK_p, spawn, SHCMD("mpc pause ; pauseallmpv") },
|
||||||
{ MODKEY, XK_udiaeresis, spawn, {.v = (const char *[]){"mpc", "seek", "-10", NULL}} },
|
{ MODKEY, XK_udiaeresis, spawn, {.v = (const char *[]){"mpc", "seek", "-10", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_udiaeresis, spawn, {.v = (const char *[]){"mpc", "seek", "-60", NULL}} },
|
{ MODKEY | ShiftMask, XK_udiaeresis, spawn, {.v = (const char *[]){"mpc", "seek", "-60", NULL}} },
|
||||||
{ MODKEY, XK_plus, spawn, {.v = (const char *[]){"mpc", "seek", "+10", NULL}} },
|
{ MODKEY, XK_plus, spawn, {.v = (const char *[]){"mpc", "seek", "+10", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_plus, spawn, {.v = (const char *[]){"mpc", "seek", "+60", NULL}} },
|
{ MODKEY | ShiftMask, XK_plus, spawn, {.v = (const char *[]){"mpc", "seek", "+60", NULL}} },
|
||||||
{ MODKEY, XK_a, togglegaps, {0} },
|
{ MODKEY, XK_a, togglegaps, {0} },
|
||||||
{ MODKEY | ShiftMask, XK_a, defaultgaps, {0} },
|
{ MODKEY | ShiftMask, XK_a, defaultgaps, {0} },
|
||||||
/*{ MODKEY, XK_s, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_s, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_s, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_s, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_d, spawn, {.v = (const char *[]){"dmenu_run", NULL}} },
|
{ MODKEY, XK_d, spawn, {.v = (const char *[]){"dmenu_run", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_d, spawn, {.v = (const char *[]){"passmenu", NULL}} },
|
{ MODKEY | ShiftMask, XK_d, spawn, {.v = (const char *[]){"passmenu", NULL}} },
|
||||||
{ MODKEY, XK_f, togglefullscr, {0} },
|
{ MODKEY, XK_f, togglefullscr, {0} },
|
||||||
{ MODKEY | ShiftMask, XK_f, setlayout, {.v = &layouts[8]} }, /* floating */
|
{ MODKEY | ShiftMask, XK_f, setlayout, {.v = &layouts[8]} }, /* floating */
|
||||||
/*{ MODKEY, XK_g, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_g, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_g, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_g, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
/*{ MODKEY | ShiftMask, XK_h, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_h, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/* J and K are automatically bound above in STACKKEYS */
|
/* J and K are automatically bound above in STACKKEYS */
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
/*{ MODKEY | ShiftMask, XK_l, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_l, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_numbersign, togglescratch, {.v = spqalc} },
|
{ MODKEY, XK_numbersign, togglescratch, {.v = spqalc} },
|
||||||
/*{ MODKEY | ShiftMask, XK_numbersign, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_numbersign, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_Return, spawn, {.v = (const char *[]){TERMINAL, "-d", "~", NULL}} },
|
{ MODKEY, XK_backslash, togglescratch, {.v = spqalc} },
|
||||||
{ MODKEY | ShiftMask, XK_Return, togglescratch, {.v = spterm} },
|
/*{ MODKEY | ShiftMask, XK_backslash, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_y, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY, XK_Return, spawn, {.v = (const char *[]){TERMINAL, "-d", "~", NULL}} },
|
||||||
/*{ MODKEY | ShiftMask, XK_y, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY | ShiftMask, XK_Return, togglescratch, {.v = spterm} },
|
||||||
/*{ MODKEY, XK_x, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_y, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_x, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_y, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_c, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_x, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_c, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_x, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/* V is automatically bound above in STACKKEYS */
|
/*{ MODKEY, XK_c, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_b, togglebar, {0} },
|
/*{ MODKEY | ShiftMask, XK_c, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_b, spawn, {.v = (const char *[]){NULL}} },*/
|
/* V is automatically bound above in STACKKEYS */
|
||||||
{ MODKEY, XK_n, spawn, {.v = (const char *[]){TERMINAL, "-e", "nvim", "-c", "VimwikiIndex", NULL}} },
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
/*{ MODKEY | ShiftMask, XK_n, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_b, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_m, spawn, {.v = (const char *[]){TERMINAL, "-e", "ncmpcpp", NULL}} },
|
{ MODKEY, XK_n, spawn, {.v = (const char *[]){TERMINAL, "-e", "nvim", "-c", "VimwikiIndex", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_m, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") },
|
/*{ MODKEY | ShiftMask, XK_n, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_comma, spawn, {.v = (const char *[]){"mpc", "prev", NULL}} },
|
{ MODKEY, XK_m, spawn, {.v = (const char *[]){TERMINAL, "-e", "ncmpcpp", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_comma, spawn, {.v = (const char *[]){"mpc", "seek", "0%", NULL}} },
|
{ MODKEY | ShiftMask, XK_m, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") },
|
||||||
{ MODKEY, XK_period, spawn, {.v = (const char *[]){"mpc", "next", NULL}} },
|
{ MODKEY, XK_comma, spawn, {.v = (const char *[]){"mpc", "prev", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_period, spawn, {.v = (const char *[]){"mpc", "repeat", NULL}} },
|
{ MODKEY | ShiftMask, XK_comma, spawn, {.v = (const char *[]){"mpc", "seek", "0%", NULL}} },
|
||||||
/*{ MODKEY, XK_minus, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY, XK_period, spawn, {.v = (const char *[]){"mpc", "next", NULL}} },
|
||||||
/*{ MODKEY | ShiftMask, XK_minus, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY | ShiftMask, XK_period, spawn, {.v = (const char *[]){"mpc", "repeat", NULL}} },
|
||||||
{ MODKEY, XK_space, zoom, {0} },
|
/*{ MODKEY, XK_minus, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY | ShiftMask, XK_space, togglefloating, {0} },
|
/*{ MODKEY | ShiftMask, XK_minus, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ 0, XK_Print, spawn, SHCMD("maim ~/Photos/Screenshots/pic-full-$(date '+%y%m%d-%H%M-%S').png") },
|
{ MODKEY, XK_space, zoom, {0} },
|
||||||
{ ShiftMask, XK_Print, spawn, {.v = (const char *[]){"maimpick", NULL}} },
|
{ MODKEY | ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY, XK_Print, spawn, {.v = (const char *[]){"dmenurecord", NULL}} },
|
{ 0, XK_Print, spawn, SHCMD("maim ~/Photos/Screenshots/pic-full-$(date '+%y%m%d-%H%M-%S').png") },
|
||||||
{ MODKEY | ShiftMask, XK_Print, spawn, {.v = (const char *[]){"dmenurecord", "kill", NULL}} },
|
{ ShiftMask, XK_Print, spawn, {.v = (const char *[]){"maimpick", NULL}} },
|
||||||
/*{ MODKEY, XK_Scroll_Lock, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY, XK_Print, spawn, {.v = (const char *[]){"dmenurecord", NULL}} },
|
||||||
/*{ MODKEY | ShiftMask, XK_Scroll_Lock, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY | ShiftMask, XK_Print, spawn, {.v = (const char *[]){"dmenurecord", "kill", NULL}} },
|
||||||
/*{ MODKEY, XK_Pause, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_Scroll_Lock, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_Pause, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_Scroll_Lock, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_Insert, spawn, SHCMD("xdotool type $(grep -v '^#' ~/.local/share/snippets | dmenu -i -l " "50 | cut -d' ' -f1)") },
|
/*{ MODKEY, XK_Pause, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_Insert, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_Pause, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_Home, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY, XK_Insert, spawn, SHCMD("xdotool type $(grep -v '^#' ~/.local/share/snippets | dmenu -i -l " "50 | cut -d' ' -f1)") },
|
||||||
/*{ MODKEY | ShiftMask, XK_Home, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_Insert, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_Delete, spawn, {.v = (const char *[]){"dmenurecord", "kill", NULL}} },
|
/*{ MODKEY, XK_Home, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_Delete, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_Home, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_End, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY, XK_Delete, spawn, {.v = (const char *[]){"dmenurecord", "kill", NULL}} },
|
||||||
{ MODKEY | ShiftMask, XK_End, quit, {0} },
|
/*{ MODKEY | ShiftMask, XK_Delete, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_End, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY | ShiftMask, XK_End, quit, {0} },
|
||||||
/*{ MODKEY, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_Left, focusmon, {.i = -1} },
|
/*{ MODKEY, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY | ShiftMask, XK_Left, tagmon, {.i = -1} },
|
/*{ MODKEY | ShiftMask, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ MODKEY, XK_Right, focusmon, {.i = +1} },
|
{ MODKEY, XK_Left, focusmon, {.i = -1} },
|
||||||
{ MODKEY | ShiftMask, XK_Right, tagmon, {.i = +1} },
|
{ MODKEY | ShiftMask, XK_Left, tagmon, {.i = -1} },
|
||||||
/*{ MODKEY, XK_Up, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY, XK_Right, focusmon, {.i = +1} },
|
||||||
/*{ MODKEY | ShiftMask, XK_Up, spawn, {.v = (const char *[]){NULL}} },*/
|
{ MODKEY | ShiftMask, XK_Right, tagmon, {.i = +1} },
|
||||||
/*{ MODKEY, XK_Down, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY, XK_Up, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
/*{ MODKEY | ShiftMask, XK_Down, spawn, {.v = (const char *[]){NULL}} },*/
|
/*{ MODKEY | ShiftMask, XK_Up, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
|
/*{ MODKEY, XK_Down, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ 0, XF86XK_AudioMute, spawn, SHCMD("pamixer -t; pkill -RTMIN+10 dwmblocks") },
|
/*{ MODKEY | ShiftMask, XK_Down, spawn, {.v = (const char *[]){NULL}} },*/
|
||||||
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 3; pkill -RTMIN+10 dwmblocks") },
|
|
||||||
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 3; pkill -RTMIN+10 dwmblocks") },
|
{ 0, XF86XK_AudioMute, spawn, SHCMD("pamixer -t; pkill -RTMIN+10 dwmblocks") },
|
||||||
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char *[]){"mpc", "prev", NULL}} },
|
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 5; pkill -RTMIN+10 dwmblocks") },
|
||||||
{ 0, XF86XK_AudioNext, spawn, {.v = (const char *[]){"mpc", "next", NULL}} },
|
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 5; pkill -RTMIN+10 dwmblocks") },
|
||||||
{ 0, XF86XK_AudioPause, spawn, {.v = (const char *[]){"mpc", "pause", NULL}} },
|
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char *[]){"mpc", "prev", NULL}} },
|
||||||
{ 0, XF86XK_AudioPlay, spawn, {.v = (const char *[]){"mpc", "play", NULL}} },
|
{ 0, XF86XK_AudioNext, spawn, {.v = (const char *[]){"mpc", "next", NULL}} },
|
||||||
{ 0, XF86XK_AudioStop, spawn, {.v = (const char *[]){"mpc", "stop", NULL}} },
|
{ 0, XF86XK_AudioPause, spawn, {.v = (const char *[]){"mpc", "pause", NULL}} },
|
||||||
{ 0, XF86XK_AudioRewind, spawn, {.v = (const char *[]){"mpc", "seek", "-10", NULL}} },
|
{ 0, XF86XK_AudioPlay, spawn, {.v = (const char *[]){"mpc", "play", NULL}} },
|
||||||
{ 0, XF86XK_AudioForward, spawn, {.v = (const char *[]){"mpc", "seek", "+10", NULL}} },
|
{ 0, XF86XK_AudioStop, spawn, {.v = (const char *[]){"mpc", "stop", NULL}} },
|
||||||
{ 0, XF86XK_AudioMedia, spawn, {.v = (const char *[]){TERMINAL, "-e", "ncmpcpp", NULL}} },
|
{ 0, XF86XK_AudioRewind, spawn, {.v = (const char *[]){"mpc", "seek", "-10", NULL}} },
|
||||||
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute @DEFAULT_SOURCE@ toggle") },
|
{ 0, XF86XK_AudioForward, spawn, {.v = (const char *[]){"mpc", "seek", "+10", NULL}} },
|
||||||
{ 0, XF86XK_PowerOff, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
{ 0, XF86XK_AudioMedia, spawn, {.v = (const char *[]){TERMINAL, "-e", "ncmpcpp", NULL}} },
|
||||||
{ 0, XF86XK_Calculator, spawn, {.v = (const char *[]){TERMINAL, "-e", "bc", "-l", NULL}} },
|
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute @DEFAULT_SOURCE@ toggle") },
|
||||||
{ 0, XF86XK_Sleep, spawn, {.v = (const char *[]){"sudo", "-A", "zzz", NULL}} },
|
{ 0, XF86XK_PowerOff, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
||||||
{ 0, XF86XK_WWW, spawn, {.v = (const char *[]){BROWSER, NULL}} },
|
{ 0, XF86XK_Calculator, spawn, {.v = (const char *[]){TERMINAL, "-e", "bc", "-l", NULL}} },
|
||||||
{ 0, XF86XK_WLAN, spawn, SHCMD("sleep 0.1; pkill -RTMIN+4 dwmblocks") },
|
{ 0, XF86XK_Sleep, spawn, {.v = (const char *[]){"sudo", "-A", "zzz", NULL}} },
|
||||||
{ 0, XF86XK_DOS, spawn, {.v = (const char *[]){TERMINAL, NULL}} },
|
{ 0, XF86XK_WWW, spawn, {.v = (const char *[]){BROWSER, NULL}} },
|
||||||
{ 0, XF86XK_ScreenSaver, spawn, SHCMD("xset s activate & mpc pause & pauseallmpv") },
|
{ 0, XF86XK_WLAN, spawn, SHCMD("sleep 0.1; pkill -RTMIN+4 dwmblocks") },
|
||||||
{ 0, XF86XK_TaskPane, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
|
{ 0, XF86XK_DOS, spawn, {.v = (const char *[]){TERMINAL, NULL}} },
|
||||||
{ 0, XF86XK_Mail, spawn, SHCMD("$TERMINAL -e neomutt; pkill -RTMIN+12 dwmblocks") },
|
{ 0, XF86XK_ScreenSaver, spawn, SHCMD("xset s activate & mpc pause & pauseallmpv") },
|
||||||
{ 0, XF86XK_MyComputer, spawn, {.v = (const char *[]){TERMINAL, "-e", "lfub", "/", NULL}} },
|
{ 0, XF86XK_TaskPane, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
|
||||||
/*{ 0, XF86XK_Battery, spawn, {.v = (const char *[]){NULL}} }, */
|
{ 0, XF86XK_Mail, spawn, SHCMD("$TERMINAL -e neomutt; pkill -RTMIN+12 dwmblocks") },
|
||||||
{ 0, XF86XK_Launch1, spawn, {.v = (const char *[]){"xset", "dpms", "force", "off", NULL}} },
|
{ 0, XF86XK_MyComputer, spawn, {.v = (const char *[]){TERMINAL, "-e", "lfub", "/", NULL}} },
|
||||||
{ 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || " "synclient TouchpadOff=1") },
|
/*{ 0, XF86XK_Battery, spawn, {.v = (const char *[]){NULL}} }, */
|
||||||
{ 0, XF86XK_TouchpadOff, spawn, {.v = (const char *[]){"synclient", "TouchpadOff=1", NULL}} },
|
{ 0, XF86XK_Launch1, spawn, {.v = (const char *[]){"xset", "dpms", "force", "off", NULL}} },
|
||||||
{ 0, XF86XK_TouchpadOn, spawn, {.v = (const char *[]){"synclient", "TouchpadOff=0", NULL}} },
|
{ 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || " "synclient TouchpadOff=1") },
|
||||||
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = (const char *[]){"xbacklight", "-inc", "5", NULL}} },
|
{ 0, XF86XK_TouchpadOff, spawn, {.v = (const char *[]){"synclient", "TouchpadOff=1", NULL}} },
|
||||||
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = (const char *[]){"xbacklight", "-dec", "5", NULL}} },
|
{ 0, XF86XK_TouchpadOn, spawn, {.v = (const char *[]){"synclient", "TouchpadOff=0", NULL}} },
|
||||||
};
|
// WARN: If you have multiple backlight controllers this will fail
|
||||||
|
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("echo $(($(cat /sys/class/backlight/*/brightness) + 5)) | tee /sys/class/backlight/*/brightness") },
|
||||||
/* button definitions */
|
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("echo $(($(cat /sys/class/backlight/*/brightness) - 5)) | tee /sys/class/backlight/*/brightness") },
|
||||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
};
|
||||||
static Button buttons[] = {
|
|
||||||
/* click event mask button function argument */
|
/* button definitions */
|
||||||
// { ClkLtSymbol, 0, Button1, setlayout, {0} },
|
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||||
// { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
static Button buttons[] = {
|
||||||
// { ClkWinTitle, 0, Button2, zoom, {0} },
|
/* click event mask button function argument */
|
||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
// { ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
// { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
// { ClkWinTitle, 0, Button2, zoom, {0} },
|
||||||
{ ClkTagBar, 0, Button1, view, {0} },
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
// { ClkTagBar, 0, Button3, toggleview, {0} },
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
// { ClkTagBar, MODKEY, Button1, tag, {0} },
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
// { ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
{ ClkTagBar, 0, Button1, view, {0} },
|
||||||
};
|
// { ClkTagBar, 0, Button3, toggleview, {0} },
|
||||||
|
// { ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
// { ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
548
drw.c
548
drw.c
|
@ -19,84 +19,84 @@ static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF
|
||||||
static long
|
static long
|
||||||
utf8decodebyte(const char c, size_t *i)
|
utf8decodebyte(const char c, size_t *i)
|
||||||
{
|
{
|
||||||
for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
|
for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
|
||||||
if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
|
if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
|
||||||
return (unsigned char)c & ~utfmask[*i];
|
return (unsigned char)c & ~utfmask[*i];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
utf8validate(long *u, size_t i)
|
utf8validate(long *u, size_t i)
|
||||||
{
|
{
|
||||||
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
|
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
|
||||||
*u = UTF_INVALID;
|
*u = UTF_INVALID;
|
||||||
for (i = 1; *u > utfmax[i]; ++i)
|
for (i = 1; *u > utfmax[i]; ++i)
|
||||||
;
|
;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
utf8decode(const char *c, long *u, size_t clen)
|
utf8decode(const char *c, long *u, size_t clen)
|
||||||
{
|
{
|
||||||
size_t i, j, len, type;
|
size_t i, j, len, type;
|
||||||
long udecoded;
|
long udecoded;
|
||||||
|
|
||||||
*u = UTF_INVALID;
|
*u = UTF_INVALID;
|
||||||
if (!clen)
|
if (!clen)
|
||||||
return 0;
|
return 0;
|
||||||
udecoded = utf8decodebyte(c[0], &len);
|
udecoded = utf8decodebyte(c[0], &len);
|
||||||
if (!BETWEEN(len, 1, UTF_SIZ))
|
if (!BETWEEN(len, 1, UTF_SIZ))
|
||||||
return 1;
|
return 1;
|
||||||
for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
|
for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
|
||||||
udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
|
udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
|
||||||
if (type)
|
if (type)
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
if (j < len)
|
if (j < len)
|
||||||
return 0;
|
return 0;
|
||||||
*u = udecoded;
|
*u = udecoded;
|
||||||
utf8validate(u, len);
|
utf8validate(u, len);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
Drw *
|
Drw *
|
||||||
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
|
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
|
||||||
{
|
{
|
||||||
Drw *drw = ecalloc(1, sizeof(Drw));
|
Drw *drw = ecalloc(1, sizeof(Drw));
|
||||||
|
|
||||||
drw->dpy = dpy;
|
drw->dpy = dpy;
|
||||||
drw->screen = screen;
|
drw->screen = screen;
|
||||||
drw->root = root;
|
drw->root = root;
|
||||||
drw->w = w;
|
drw->w = w;
|
||||||
drw->h = h;
|
drw->h = h;
|
||||||
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
||||||
drw->gc = XCreateGC(dpy, root, 0, NULL);
|
drw->gc = XCreateGC(dpy, root, 0, NULL);
|
||||||
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
|
||||||
return drw;
|
return drw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
||||||
{
|
{
|
||||||
if (!drw)
|
if (!drw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drw->w = w;
|
drw->w = w;
|
||||||
drw->h = h;
|
drw->h = h;
|
||||||
if (drw->drawable)
|
if (drw->drawable)
|
||||||
XFreePixmap(drw->dpy, drw->drawable);
|
XFreePixmap(drw->dpy, drw->drawable);
|
||||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_free(Drw *drw)
|
drw_free(Drw *drw)
|
||||||
{
|
{
|
||||||
XFreePixmap(drw->dpy, drw->drawable);
|
XFreePixmap(drw->dpy, drw->drawable);
|
||||||
XFreeGC(drw->dpy, drw->gc);
|
XFreeGC(drw->dpy, drw->gc);
|
||||||
drw_fontset_free(drw->fonts);
|
drw_fontset_free(drw->fonts);
|
||||||
free(drw);
|
free(drw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is an implementation detail. Library users should use
|
/* This function is an implementation detail. Library users should use
|
||||||
|
@ -105,106 +105,106 @@ drw_free(Drw *drw)
|
||||||
static Fnt *
|
static Fnt *
|
||||||
xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
||||||
{
|
{
|
||||||
Fnt *font;
|
Fnt *font;
|
||||||
XftFont *xfont = NULL;
|
XftFont *xfont = NULL;
|
||||||
FcPattern *pattern = NULL;
|
FcPattern *pattern = NULL;
|
||||||
|
|
||||||
if (fontname) {
|
if (fontname) {
|
||||||
/* Using the pattern found at font->xfont->pattern does not yield the
|
/* Using the pattern found at font->xfont->pattern does not yield the
|
||||||
* same substitution results as using the pattern returned by
|
* same substitution results as using the pattern returned by
|
||||||
* FcNameParse; using the latter results in the desired fallback
|
* FcNameParse; using the latter results in the desired fallback
|
||||||
* behaviour whereas the former just results in missing-character
|
* behaviour whereas the former just results in missing-character
|
||||||
* rectangles being drawn, at least with some fonts. */
|
* rectangles being drawn, at least with some fonts. */
|
||||||
if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) {
|
if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) {
|
||||||
fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname);
|
fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
|
if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
|
||||||
fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname);
|
fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname);
|
||||||
XftFontClose(drw->dpy, xfont);
|
XftFontClose(drw->dpy, xfont);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else if (fontpattern) {
|
} else if (fontpattern) {
|
||||||
if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) {
|
if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) {
|
||||||
fprintf(stderr, "error, cannot load font from pattern.\n");
|
fprintf(stderr, "error, cannot load font from pattern.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
die("no font specified.");
|
die("no font specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not allow using color fonts. This is a workaround for a BadLength
|
/* Do not allow using color fonts. This is a workaround for a BadLength
|
||||||
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
||||||
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
||||||
* https://lists.suckless.org/dev/1701/30932.html
|
* https://lists.suckless.org/dev/1701/30932.html
|
||||||
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
||||||
* and lots more all over the internet.
|
* and lots more all over the internet.
|
||||||
*/
|
*/
|
||||||
FcBool iscol;
|
FcBool iscol;
|
||||||
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
||||||
XftFontClose(drw->dpy, xfont);
|
XftFontClose(drw->dpy, xfont);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
font = ecalloc(1, sizeof(Fnt));
|
font = ecalloc(1, sizeof(Fnt));
|
||||||
font->xfont = xfont;
|
font->xfont = xfont;
|
||||||
font->pattern = pattern;
|
font->pattern = pattern;
|
||||||
font->h = xfont->ascent + xfont->descent;
|
font->h = xfont->ascent + xfont->descent;
|
||||||
font->dpy = drw->dpy;
|
font->dpy = drw->dpy;
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xfont_free(Fnt *font)
|
xfont_free(Fnt *font)
|
||||||
{
|
{
|
||||||
if (!font)
|
if (!font)
|
||||||
return;
|
return;
|
||||||
if (font->pattern)
|
if (font->pattern)
|
||||||
FcPatternDestroy(font->pattern);
|
FcPatternDestroy(font->pattern);
|
||||||
XftFontClose(font->dpy, font->xfont);
|
XftFontClose(font->dpy, font->xfont);
|
||||||
free(font);
|
free(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
Fnt*
|
Fnt*
|
||||||
drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
|
drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
|
||||||
{
|
{
|
||||||
Fnt *cur, *ret = NULL;
|
Fnt *cur, *ret = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!drw || !fonts)
|
if (!drw || !fonts)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 1; i <= fontcount; i++) {
|
for (i = 1; i <= fontcount; i++) {
|
||||||
if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) {
|
if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) {
|
||||||
cur->next = ret;
|
cur->next = ret;
|
||||||
ret = cur;
|
ret = cur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (drw->fonts = ret);
|
return (drw->fonts = ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_fontset_free(Fnt *font)
|
drw_fontset_free(Fnt *font)
|
||||||
{
|
{
|
||||||
if (font) {
|
if (font) {
|
||||||
drw_fontset_free(font->next);
|
drw_fontset_free(font->next);
|
||||||
xfont_free(font);
|
xfont_free(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
||||||
{
|
{
|
||||||
if (!drw || !dest || !clrname)
|
if (!drw || !dest || !clrname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
||||||
DefaultColormap(drw->dpy, drw->screen),
|
DefaultColormap(drw->dpy, drw->screen),
|
||||||
clrname, dest))
|
clrname, dest))
|
||||||
die("error, cannot allocate color '%s'", clrname);
|
die("error, cannot allocate color '%s'", clrname);
|
||||||
|
|
||||||
dest->pixel |= 0xff << 24;
|
dest->pixel |= 0xff << 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||||
|
@ -212,227 +212,227 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
||||||
Clr *
|
Clr *
|
||||||
drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
|
drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
Clr *ret;
|
Clr *ret;
|
||||||
|
|
||||||
/* need at least two colors for a scheme */
|
/* need at least two colors for a scheme */
|
||||||
if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor))))
|
if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor))))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < clrcount; i++)
|
for (i = 0; i < clrcount; i++)
|
||||||
drw_clr_create(drw, &ret[i], clrnames[i]);
|
drw_clr_create(drw, &ret[i], clrnames[i]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_setfontset(Drw *drw, Fnt *set)
|
drw_setfontset(Drw *drw, Fnt *set)
|
||||||
{
|
{
|
||||||
if (drw)
|
if (drw)
|
||||||
drw->fonts = set;
|
drw->fonts = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_setscheme(Drw *drw, Clr *scm)
|
drw_setscheme(Drw *drw, Clr *scm)
|
||||||
{
|
{
|
||||||
if (drw)
|
if (drw)
|
||||||
drw->scheme = scm;
|
drw->scheme = scm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
|
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
|
||||||
{
|
{
|
||||||
if (!drw || !drw->scheme)
|
if (!drw || !drw->scheme)
|
||||||
return;
|
return;
|
||||||
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
|
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
|
||||||
if (filled)
|
if (filled)
|
||||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||||
else
|
else
|
||||||
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
|
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int ty;
|
int ty;
|
||||||
unsigned int ew;
|
unsigned int ew;
|
||||||
XftDraw *d = NULL;
|
XftDraw *d = NULL;
|
||||||
Fnt *usedfont, *curfont, *nextfont;
|
Fnt *usedfont, *curfont, *nextfont;
|
||||||
size_t i, len;
|
size_t i, len;
|
||||||
int utf8strlen, utf8charlen, render = x || y || w || h;
|
int utf8strlen, utf8charlen, render = x || y || w || h;
|
||||||
long utf8codepoint = 0;
|
long utf8codepoint = 0;
|
||||||
const char *utf8str;
|
const char *utf8str;
|
||||||
FcCharSet *fccharset;
|
FcCharSet *fccharset;
|
||||||
FcPattern *fcpattern;
|
FcPattern *fcpattern;
|
||||||
FcPattern *match;
|
FcPattern *match;
|
||||||
XftResult result;
|
XftResult result;
|
||||||
int charexists = 0;
|
int charexists = 0;
|
||||||
|
|
||||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!render) {
|
if (!render) {
|
||||||
w = ~w;
|
w = ~w;
|
||||||
} else {
|
} else {
|
||||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||||
d = XftDrawCreate(drw->dpy, drw->drawable,
|
d = XftDrawCreate(drw->dpy, drw->drawable,
|
||||||
DefaultVisual(drw->dpy, drw->screen),
|
DefaultVisual(drw->dpy, drw->screen),
|
||||||
DefaultColormap(drw->dpy, drw->screen));
|
DefaultColormap(drw->dpy, drw->screen));
|
||||||
x += lpad;
|
x += lpad;
|
||||||
w -= lpad;
|
w -= lpad;
|
||||||
}
|
}
|
||||||
|
|
||||||
usedfont = drw->fonts;
|
usedfont = drw->fonts;
|
||||||
while (1) {
|
while (1) {
|
||||||
utf8strlen = 0;
|
utf8strlen = 0;
|
||||||
utf8str = text;
|
utf8str = text;
|
||||||
nextfont = NULL;
|
nextfont = NULL;
|
||||||
while (*text) {
|
while (*text) {
|
||||||
utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
|
utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
|
||||||
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
|
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
|
||||||
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
||||||
if (charexists) {
|
if (charexists) {
|
||||||
if (curfont == usedfont) {
|
if (curfont == usedfont) {
|
||||||
utf8strlen += utf8charlen;
|
utf8strlen += utf8charlen;
|
||||||
text += utf8charlen;
|
text += utf8charlen;
|
||||||
} else {
|
} else {
|
||||||
nextfont = curfont;
|
nextfont = curfont;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!charexists || nextfont)
|
if (!charexists || nextfont)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
charexists = 0;
|
charexists = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utf8strlen) {
|
if (utf8strlen) {
|
||||||
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
||||||
/* shorten text if necessary */
|
/* shorten text if necessary */
|
||||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
|
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
|
||||||
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
|
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
memcpy(buf, utf8str, len);
|
memcpy(buf, utf8str, len);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
if (len < utf8strlen)
|
if (len < utf8strlen)
|
||||||
for (i = len; i && i > len - 3; buf[--i] = '.')
|
for (i = len; i && i > len - 3; buf[--i] = '.')
|
||||||
; /* NOP */
|
; /* NOP */
|
||||||
|
|
||||||
if (render) {
|
if (render) {
|
||||||
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
||||||
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
||||||
usedfont->xfont, x, ty, (XftChar8 *)buf, len);
|
usedfont->xfont, x, ty, (XftChar8 *)buf, len);
|
||||||
}
|
}
|
||||||
x += ew;
|
x += ew;
|
||||||
w -= ew;
|
w -= ew;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*text) {
|
if (!*text) {
|
||||||
break;
|
break;
|
||||||
} else if (nextfont) {
|
} else if (nextfont) {
|
||||||
charexists = 0;
|
charexists = 0;
|
||||||
usedfont = nextfont;
|
usedfont = nextfont;
|
||||||
} else {
|
} else {
|
||||||
/* Regardless of whether or not a fallback font is found, the
|
/* Regardless of whether or not a fallback font is found, the
|
||||||
* character must be drawn. */
|
* character must be drawn. */
|
||||||
charexists = 1;
|
charexists = 1;
|
||||||
|
|
||||||
fccharset = FcCharSetCreate();
|
fccharset = FcCharSetCreate();
|
||||||
FcCharSetAddChar(fccharset, utf8codepoint);
|
FcCharSetAddChar(fccharset, utf8codepoint);
|
||||||
|
|
||||||
if (!drw->fonts->pattern) {
|
if (!drw->fonts->pattern) {
|
||||||
/* Refer to the comment in xfont_create for more information. */
|
/* Refer to the comment in xfont_create for more information. */
|
||||||
die("the first font in the cache must be loaded from a font string.");
|
die("the first font in the cache must be loaded from a font string.");
|
||||||
}
|
}
|
||||||
|
|
||||||
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
||||||
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
||||||
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
||||||
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
||||||
|
|
||||||
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
||||||
FcDefaultSubstitute(fcpattern);
|
FcDefaultSubstitute(fcpattern);
|
||||||
match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result);
|
match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result);
|
||||||
|
|
||||||
FcCharSetDestroy(fccharset);
|
FcCharSetDestroy(fccharset);
|
||||||
FcPatternDestroy(fcpattern);
|
FcPatternDestroy(fcpattern);
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
usedfont = xfont_create(drw, NULL, match);
|
usedfont = xfont_create(drw, NULL, match);
|
||||||
if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) {
|
if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) {
|
||||||
for (curfont = drw->fonts; curfont->next; curfont = curfont->next)
|
for (curfont = drw->fonts; curfont->next; curfont = curfont->next)
|
||||||
; /* NOP */
|
; /* NOP */
|
||||||
curfont->next = usedfont;
|
curfont->next = usedfont;
|
||||||
} else {
|
} else {
|
||||||
xfont_free(usedfont);
|
xfont_free(usedfont);
|
||||||
usedfont = drw->fonts;
|
usedfont = drw->fonts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (d)
|
if (d)
|
||||||
XftDrawDestroy(d);
|
XftDrawDestroy(d);
|
||||||
|
|
||||||
return x + (render ? w : 0);
|
return x + (render ? w : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
|
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
|
||||||
{
|
{
|
||||||
if (!drw)
|
if (!drw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
|
XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
|
||||||
XSync(drw->dpy, False);
|
XSync(drw->dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
drw_fontset_getwidth(Drw *drw, const char *text)
|
drw_fontset_getwidth(Drw *drw, const char *text)
|
||||||
{
|
{
|
||||||
if (!drw || !drw->fonts || !text)
|
if (!drw || !drw->fonts || !text)
|
||||||
return 0;
|
return 0;
|
||||||
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
|
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
||||||
{
|
{
|
||||||
XGlyphInfo ext;
|
XGlyphInfo ext;
|
||||||
|
|
||||||
if (!font || !text)
|
if (!font || !text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
|
XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
|
||||||
if (w)
|
if (w)
|
||||||
*w = ext.xOff;
|
*w = ext.xOff;
|
||||||
if (h)
|
if (h)
|
||||||
*h = font->h;
|
*h = font->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cur *
|
Cur *
|
||||||
drw_cur_create(Drw *drw, int shape)
|
drw_cur_create(Drw *drw, int shape)
|
||||||
{
|
{
|
||||||
Cur *cur;
|
Cur *cur;
|
||||||
|
|
||||||
if (!drw || !(cur = ecalloc(1, sizeof(Cur))))
|
if (!drw || !(cur = ecalloc(1, sizeof(Cur))))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cur->cursor = XCreateFontCursor(drw->dpy, shape);
|
cur->cursor = XCreateFontCursor(drw->dpy, shape);
|
||||||
|
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_cur_free(Drw *drw, Cur *cursor)
|
drw_cur_free(Drw *drw, Cur *cursor)
|
||||||
{
|
{
|
||||||
if (!cursor)
|
if (!cursor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XFreeCursor(drw->dpy, cursor->cursor);
|
XFreeCursor(drw->dpy, cursor->cursor);
|
||||||
free(cursor);
|
free(cursor);
|
||||||
}
|
}
|
||||||
|
|
28
drw.h
28
drw.h
|
@ -1,29 +1,29 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
} Cur;
|
} Cur;
|
||||||
|
|
||||||
typedef struct Fnt {
|
typedef struct Fnt {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
unsigned int h;
|
unsigned int h;
|
||||||
XftFont *xfont;
|
XftFont *xfont;
|
||||||
FcPattern *pattern;
|
FcPattern *pattern;
|
||||||
struct Fnt *next;
|
struct Fnt *next;
|
||||||
} Fnt;
|
} Fnt;
|
||||||
|
|
||||||
enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */
|
enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */
|
||||||
typedef XftColor Clr;
|
typedef XftColor Clr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned int w, h;
|
unsigned int w, h;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
int screen;
|
int screen;
|
||||||
Window root;
|
Window root;
|
||||||
Drawable drawable;
|
Drawable drawable;
|
||||||
GC gc;
|
GC gc;
|
||||||
Clr *scheme;
|
Clr *scheme;
|
||||||
Fnt *fonts;
|
Fnt *fonts;
|
||||||
} Drw;
|
} Drw;
|
||||||
|
|
||||||
/* Drawable abstraction */
|
/* Drawable abstraction */
|
||||||
|
|
124
dwm.c
124
dwm.c
|
@ -2674,34 +2674,34 @@ pid_t
|
||||||
winpid(Window w)
|
winpid(Window w)
|
||||||
{
|
{
|
||||||
|
|
||||||
pid_t result = 0;
|
pid_t result = 0;
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
xcb_res_client_id_spec_t spec = {0};
|
xcb_res_client_id_spec_t spec = {0};
|
||||||
spec.client = w;
|
spec.client = w;
|
||||||
spec.mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID;
|
spec.mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID;
|
||||||
|
|
||||||
xcb_generic_error_t *e = NULL;
|
xcb_generic_error_t *e = NULL;
|
||||||
xcb_res_query_client_ids_cookie_t c = xcb_res_query_client_ids(xcon, 1, &spec);
|
xcb_res_query_client_ids_cookie_t c = xcb_res_query_client_ids(xcon, 1, &spec);
|
||||||
xcb_res_query_client_ids_reply_t *r = xcb_res_query_client_ids_reply(xcon, c, &e);
|
xcb_res_query_client_ids_reply_t *r = xcb_res_query_client_ids_reply(xcon, c, &e);
|
||||||
|
|
||||||
if (!r)
|
if (!r)
|
||||||
return (pid_t)0;
|
return (pid_t)0;
|
||||||
|
|
||||||
xcb_res_client_id_value_iterator_t i = xcb_res_query_client_ids_ids_iterator(r);
|
xcb_res_client_id_value_iterator_t i = xcb_res_query_client_ids_ids_iterator(r);
|
||||||
for (; i.rem; xcb_res_client_id_value_next(&i)) {
|
for (; i.rem; xcb_res_client_id_value_next(&i)) {
|
||||||
spec = i.data->spec;
|
spec = i.data->spec;
|
||||||
if (spec.mask & XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID) {
|
if (spec.mask & XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID) {
|
||||||
uint32_t *t = xcb_res_client_id_value_value(i.data);
|
uint32_t *t = xcb_res_client_id_value_value(i.data);
|
||||||
result = *t;
|
result = *t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(r);
|
free(r);
|
||||||
|
|
||||||
if (result == (pid_t)-1)
|
if (result == (pid_t)-1)
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
|
||||||
|
@ -2720,84 +2720,84 @@ winpid(Window w)
|
||||||
result = ret;
|
result = ret;
|
||||||
|
|
||||||
#endif /* __OpenBSD__ */
|
#endif /* __OpenBSD__ */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
getparentprocess(pid_t p)
|
getparentprocess(pid_t p)
|
||||||
{
|
{
|
||||||
unsigned int v = 0;
|
unsigned int v = 0;
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
|
snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
|
||||||
|
|
||||||
if (!(f = fopen(buf, "r")))
|
if (!(f = fopen(buf, "r")))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fscanf(f, "%*u %*s %*c %u", &v);
|
fscanf(f, "%*u %*s %*c %u", &v);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
#endif /* __linux__*/
|
#endif /* __linux__*/
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
int n;
|
int n;
|
||||||
kvm_t *kd;
|
kvm_t *kd;
|
||||||
struct kinfo_proc *kp;
|
struct kinfo_proc *kp;
|
||||||
|
|
||||||
kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, NULL);
|
kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, NULL);
|
||||||
if (!kd)
|
if (!kd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
kp = kvm_getprocs(kd, KERN_PROC_PID, p, sizeof(*kp), &n);
|
kp = kvm_getprocs(kd, KERN_PROC_PID, p, sizeof(*kp), &n);
|
||||||
v = kp->p_ppid;
|
v = kp->p_ppid;
|
||||||
#endif /* __OpenBSD__ */
|
#endif /* __OpenBSD__ */
|
||||||
|
|
||||||
return (pid_t)v;
|
return (pid_t)v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
isdescprocess(pid_t p, pid_t c)
|
isdescprocess(pid_t p, pid_t c)
|
||||||
{
|
{
|
||||||
while (p != c && c != 0)
|
while (p != c && c != 0)
|
||||||
c = getparentprocess(c);
|
c = getparentprocess(c);
|
||||||
|
|
||||||
return (int)c;
|
return (int)c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
termforwin(const Client *w)
|
termforwin(const Client *w)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
|
||||||
if (!w->pid || w->isterminal)
|
if (!w->pid || w->isterminal)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (m = mons; m; m = m->next) {
|
for (m = mons; m; m = m->next) {
|
||||||
for (c = m->clients; c; c = c->next) {
|
for (c = m->clients; c; c = c->next) {
|
||||||
if (c->isterminal && !c->swallowing && c->pid && isdescprocess(c->pid, w->pid))
|
if (c->isterminal && !c->swallowing && c->pid && isdescprocess(c->pid, w->pid))
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
swallowingclient(Window w)
|
swallowingclient(Window w)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
|
||||||
for (m = mons; m; m = m->next) {
|
for (m = mons; m; m = m->next) {
|
||||||
for (c = m->clients; c; c = c->next) {
|
for (c = m->clients; c; c = c->next) {
|
||||||
if (c->swallowing && c->swallowing->win == w)
|
if (c->swallowing && c->swallowing->win == w)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There's no way to check accesses to destroyed windows, thus those cases are
|
/* There's no way to check accesses to destroyed windows, thus those cases are
|
||||||
|
|
56
transient.c
56
transient.c
|
@ -6,37 +6,37 @@
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
Display *d;
|
Display *d;
|
||||||
Window r, f, t = None;
|
Window r, f, t = None;
|
||||||
XSizeHints h;
|
XSizeHints h;
|
||||||
XEvent e;
|
XEvent e;
|
||||||
|
|
||||||
d = XOpenDisplay(NULL);
|
d = XOpenDisplay(NULL);
|
||||||
if (!d)
|
if (!d)
|
||||||
exit(1);
|
exit(1);
|
||||||
r = DefaultRootWindow(d);
|
r = DefaultRootWindow(d);
|
||||||
|
|
||||||
f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
|
f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
|
||||||
h.min_width = h.max_width = h.min_height = h.max_height = 400;
|
h.min_width = h.max_width = h.min_height = h.max_height = 400;
|
||||||
h.flags = PMinSize | PMaxSize;
|
h.flags = PMinSize | PMaxSize;
|
||||||
XSetWMNormalHints(d, f, &h);
|
XSetWMNormalHints(d, f, &h);
|
||||||
XStoreName(d, f, "floating");
|
XStoreName(d, f, "floating");
|
||||||
XMapWindow(d, f);
|
XMapWindow(d, f);
|
||||||
|
|
||||||
XSelectInput(d, f, ExposureMask);
|
XSelectInput(d, f, ExposureMask);
|
||||||
while (1) {
|
while (1) {
|
||||||
XNextEvent(d, &e);
|
XNextEvent(d, &e);
|
||||||
|
|
||||||
if (t == None) {
|
if (t == None) {
|
||||||
sleep(5);
|
sleep(5);
|
||||||
t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
|
t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
|
||||||
XSetTransientForHint(d, t, f);
|
XSetTransientForHint(d, t, f);
|
||||||
XStoreName(d, t, "transient");
|
XStoreName(d, t, "transient");
|
||||||
XMapWindow(d, t);
|
XMapWindow(d, t);
|
||||||
XSelectInput(d, t, ExposureMask);
|
XSelectInput(d, t, ExposureMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCloseDisplay(d);
|
XCloseDisplay(d);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
30
util.c
30
util.c
|
@ -9,27 +9,27 @@
|
||||||
void *
|
void *
|
||||||
ecalloc(size_t nmemb, size_t size)
|
ecalloc(size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
if (!(p = calloc(nmemb, size)))
|
if (!(p = calloc(nmemb, size)))
|
||||||
die("calloc:");
|
die("calloc:");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
die(const char *fmt, ...) {
|
die(const char *fmt, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
||||||
fputc(' ', stderr);
|
fputc(' ', stderr);
|
||||||
perror(NULL);
|
perror(NULL);
|
||||||
} else {
|
} else {
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
1096
vanitygaps.c
1096
vanitygaps.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue