Compare commits
35 Commits
267a2bdf6b
...
049d59cb62
| Author | SHA1 | Date | |
|---|---|---|---|
| 049d59cb62 | |||
| c53b9adb0b | |||
| bd32ae7251 | |||
| 2b79eebe56 | |||
| 2be742a10a | |||
| ff84964004 | |||
| 8b5a2450b0 | |||
| 7870806dee | |||
| 15c551aeac | |||
| 7000a285ac | |||
| c4c5c2f629 | |||
| aa2e57b45c | |||
| 2f534f3c72 | |||
| 1d76082949 | |||
| d5974cfd68 | |||
| 48176963e1 | |||
| 2e3b858e90 | |||
| eaf51e9509 | |||
| c6404b0bd5 | |||
| 8917f73a90 | |||
| 6eebc90a68 | |||
| 0a2c925e7f | |||
| a96e1620b6 | |||
| 2d6f8885aa | |||
| 0f418b662f | |||
| bbfa3173a5 | |||
| 43499f4084 | |||
| bb1a1e099f | |||
| cc5663b239 | |||
| 1865b2e608 | |||
| b3cd617256 | |||
| 92c3f398a6 | |||
| ce10409f36 | |||
| cb6069c7e9 | |||
| 9024a63920 |
2
Makefile
2
Makefile
@ -20,7 +20,7 @@ dwm: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz config.h
|
||||
|
||||
dist: clean
|
||||
mkdir -p dwm-${VERSION}
|
||||
|
||||
285
config.def.h
285
config.def.h
@ -1,117 +1,218 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int gappx = 6; /* gaps between windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
|
||||
static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
|
||||
static const unsigned int systrayspacing = 4; /* systray spacing */
|
||||
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
|
||||
static const int showsystray = 1; /* 0 means no systray */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = {"FiraCode Nerd Font:size=10:antialias=true:hinting=true"};
|
||||
static const char dmenufont[] = "FiraCode Nerd Font:size=10:antialias=true:hinting=true";
|
||||
|
||||
static const char norm_fg[] = "#D5C4A1";
|
||||
static const char norm_bg[] = "#262626";
|
||||
static const char norm_border[] = "#665c54";
|
||||
|
||||
static const char sel_fg[] = "#262626";
|
||||
static const char sel_bg[] = "#FE8019";
|
||||
static const char sel_border[] = "#fbf1c7";
|
||||
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = {norm_fg, norm_bg, norm_border}, // unfocused wins
|
||||
[SchemeSel] = {sel_fg, sel_bg, sel_border}, // the focused win
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
static const unsigned int baralpha = 0xd0;
|
||||
static const unsigned int borderalpha = 0xd0;
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
/* tagging */
|
||||
static const char *tags[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{"firefox", NULL, NULL, 1 << 0, 0, -1},
|
||||
{"thunderbird", NULL, NULL, 1 << 6, 0, -1},
|
||||
{"org.mozilla.Thunderbird", NULL, NULL, 1 << 6, 0, -1},
|
||||
{"ManagerDesktop", NULL, NULL, 1 << 7, 0, -1},
|
||||
{"Manager", NULL, NULL, 1 << 7, 0, -1},
|
||||
{"InputLeap", NULL, NULL, 1 << 8, 1, -1},
|
||||
{"Nextcloud", NULL, NULL, 1 << 8, 0, -1},
|
||||
{"feishin", NULL, NULL, 1 << 2, 0, -1},
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
|
||||
static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
|
||||
static const int lockfullscreen =1; /* 1 will force focus on the fullscreen window */
|
||||
static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
/* symbol arrange function */
|
||||
{"[]=", tile}, /* first entry is default */
|
||||
{"[M]", monocle},
|
||||
{"><>", NULL}, /* no layout function means floating behavior */
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
&((Keychord){1, {{MODKEY, KEY}}, view, {.ui = 1 << TAG} }), \
|
||||
&((Keychord){1, {{MODKEY|ControlMask, KEY}}, toggleview, {.ui = 1 << TAG} }), \
|
||||
&((Keychord){1, {{MODKEY|ShiftMask, KEY}}, tag, {.ui = 1 << TAG} }), \
|
||||
&((Keychord){1, {{MODKEY|ControlMask|ShiftMask, KEY}}, toggletag, {.ui = 1 << TAG} }),
|
||||
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
#define SHCMD(cmd) { .v = (const char *[]) { "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
/* some defaults */
|
||||
#define TERMINAL "st"
|
||||
#define STATUSBAR "dwmblocks"
|
||||
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = {"dmenu_run", NULL};
|
||||
static const char *slockcmd[] = {"slock", NULL};
|
||||
static const char *termcmd[] = {TERMINAL, "-e", "tmux-worker", NULL};
|
||||
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
TAGKEYS( XK_4, 3)
|
||||
TAGKEYS( XK_5, 4)
|
||||
TAGKEYS( XK_6, 5)
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
#include "movestack.c"
|
||||
#include "shift-tools.c"
|
||||
#include <X11/XF86keysym.h>
|
||||
|
||||
static const Keychord *keychords[] = {
|
||||
/* modifier key chord function argument */
|
||||
// &((Keychord){1, {{MODKEY, XK_}}, spawn, {} }),
|
||||
&((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_apostrophe}}, quit, {0} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_apostrophe}}, quit, {1} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY, XK_apostrophe}}, killclient, {0} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY, XK_a}}, spawn, {.v = dmenucmd} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_Return}}, spawn, {.v = termcmd} }),
|
||||
&((Keychord){1, {{MODKEY, XK_Escape}}, spawn, {.v = slockcmd} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY, XK_l}}, shiftviewclients, {.i = +1} }),
|
||||
&((Keychord){1, {{MODKEY, XK_h}}, shiftviewclients, {.i = -1} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_l}}, shiftview, {.i = +1} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_h}}, shiftview, {.i = -1} }),
|
||||
&((Keychord){1, {{MODKEY | ControlMask, XK_l}}, shiftboth, {.i = +1} }),
|
||||
&((Keychord){1, {{MODKEY | ControlMask, XK_h}}, shiftboth, {.i = -1} }),
|
||||
&((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_l}}, shiftswaptags, {.i = +1} }),
|
||||
&((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_h}}, shiftswaptags, {.i = -1} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY, XK_j}}, focusstack, {.i = +1} }),
|
||||
&((Keychord){1, {{MODKEY, XK_k}}, focusstack, {.i = -1} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_v}}, incnmaster, {.i = +1} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_w}}, incnmaster, {.i = -1} }),
|
||||
&((Keychord){1, {{MODKEY, XK_equal}}, setmfact, {.f = +0.05} }),
|
||||
&((Keychord){1, {{MODKEY, XK_minus}}, setmfact, {.f = -0.05} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_j}}, movestack, {.i = +1} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_k}}, movestack, {.i = -1} }),
|
||||
&((Keychord){1, {{MODKEY, XK_Return}}, zoom, {0} }),
|
||||
&((Keychord){1, {{MODKEY, XK_Tab}}, view, {0} }),
|
||||
|
||||
&((Keychord){2, {{MODKEY, XK_w}, {MODKEY, XK_t}}, setlayout, {.v = &layouts[0]} }),
|
||||
&((Keychord){2, {{MODKEY, XK_w}, {MODKEY, XK_m}}, setlayout, {.v = &layouts[1]} }),
|
||||
&((Keychord){2, {{MODKEY, XK_w}, {MODKEY, XK_f}}, setlayout, {.v = &layouts[2]} }),
|
||||
&((Keychord){1, {{MODKEY, XK_F11}}, fullscreen, {0} }),
|
||||
&((Keychord){1, {{MODKEY, XK_space}}, setlayout, {0} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_space}}, togglefloating, {0} }),
|
||||
&((Keychord){1, {{MODKEY, XK_b}}, togglebar, {0} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY, XK_0}}, view, {.ui = ~0} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_0}}, tag, {.ui = ~0} }),
|
||||
&((Keychord){1, {{MODKEY, XK_comma}}, focusmon, {.i = -1} }),
|
||||
&((Keychord){1, {{MODKEY, XK_period}}, focusmon, {.i = +1} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_comma}}, tagmon, {.i = -1} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_period}}, tagmon, {.i = +1} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_s}}, spawn, {.v = (const char *[]){"sysact", NULL}} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_o}}, spawn, {.v = (const char *[]){"set-default-sink", NULL}} }),
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_i}}, spawn, {.v = (const char *[]){"set-default-source", NULL}} }),
|
||||
|
||||
&((Keychord){2, {{MODKEY, XK_m}, {MODKEY, XK_a}}, spawn, {.v = (const char *[]){"dmenumusic", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_m}, {MODKEY, XK_p}}, spawn, {.v = (const char *[]){"mpc", "toggle", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_m}, {MODKEY, XK_l}}, spawn, {.v = (const char *[]){"mpc", "next", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_m}, {MODKEY, XK_h}}, spawn, {.v = (const char *[]){"mpc", "prev", NULL}} }),
|
||||
&((Keychord){1, {{MODKEY, XF86XK_AudioPlay}}, spawn, {.v = (const char *[]){"mpc", "toggle", NULL}} }),
|
||||
&((Keychord){1, {{MODKEY, XF86XK_AudioNext}}, spawn, {.v = (const char *[]){"mpc", "next", NULL}} }),
|
||||
&((Keychord){1, {{MODKEY, XF86XK_AudioPrev}}, spawn, {.v = (const char *[]){"mpc", "prev", NULL}} }),
|
||||
|
||||
&((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_l}}, spawn, {.v = (const char *[]){TERMINAL, "-e", "lf", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_f}}, spawn, {.v = (const char *[]){"firefox", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_n}}, spawn, {.v = (const char *[]){TERMINAL, "-e", "ncmpcpp", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_m}}, spawn, {.v = (const char *[]){TERMINAL, "-e", "gotop", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_t}}, spawn, {.v = (const char *[]){"thunar", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_c}}, spawn, {.v = (const char *[]){"calcurse-select", NULL}} }),
|
||||
|
||||
&((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_h}}, spawn, {.v = (const char *[]){"dmenuhandler", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_m}}, spawn, {.v = (const char *[]){"mounter", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_c}}, spawn, {.v = (const char *[]){"dmenumountcifs", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_u}}, spawn, {.v = (const char *[]){"unmounter", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_s}}, spawn, {.v = (const char *[]){"dmenusearch", "duckduckgo", NULL}} }),
|
||||
&((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_l}}, spawn, {.v = (const char *[]){"linkhandler", NULL}} }),
|
||||
|
||||
&((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_b}}, spawn, SHCMD("dmenu-bluetooth -i -l 25") }),
|
||||
|
||||
&((Keychord){1, {{MODKEY | ShiftMask, XK_t}}, spawn, SHCMD("trayer-toggle trayer --edge top --align center --widthtype request " "--padding 6 --SetDockType true --SetPartialStrut true --expand " "true --transparent true --alpha 0 --tint 0x262626 --height 18 &") }),
|
||||
|
||||
&((Keychord){1, {{MODKEY | ControlMask, XK_period}}, spawn, {.v = (const char *[]){"sd", NULL}} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY, XK_f}}, spawn, {.v = (const char *[]){"screenlayout", NULL}} }),
|
||||
|
||||
&((Keychord){1, {{MODKEY, XK_F1}}, spawn, {.v = (const char *[]){"kbswitcher", NULL}} }),
|
||||
|
||||
&((Keychord){1, {{0, XF86XK_AudioMute}}, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -37 $(pidof " "dwmblocks)") }),
|
||||
&((Keychord){1, {{0, XF86XK_AudioRaiseVolume}}, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; kill -37 $(pidof " "dwmblocks)") }),
|
||||
&((Keychord){1, {{0, XF86XK_AudioLowerVolume}}, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; kill -37 $(pidof " "dwmblocks)") }),
|
||||
&((Keychord){1, {{0, XF86XK_AudioMicMute}}, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle; kill -37 $(pidof " "dwmblocks)") }),
|
||||
&((Keychord){1, {{MODKEY, XK_v}}, spawn, {.v = (const char *[]){"setvol", NULL}} }),
|
||||
|
||||
&((Keychord){1, {{0, XF86XK_MonBrightnessUp}}, spawn, {.v = (const char *[]){"mod_backlight", "up", NULL}} }),
|
||||
&((Keychord){1, {{0, XF86XK_MonBrightnessDown}}, spawn, {.v = (const char *[]){"mod_backlight", "down", NULL}} }),
|
||||
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
TAGKEYS( XK_4, 3)
|
||||
TAGKEYS( XK_5, 4)
|
||||
TAGKEYS( XK_6, 5)
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||
static const Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||
* ClkClientWin, or ClkRootWin */
|
||||
static Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ClkLtSymbol, 0, Button1, setlayout, {0}},
|
||||
{ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]}},
|
||||
{ClkWinTitle, 0, Button2, zoom, {0}},
|
||||
{ClkStatusText, 0, Button1, sigstatusbar, {.i = 1}},
|
||||
{ClkStatusText, 0, Button2, sigstatusbar, {.i = 2}},
|
||||
{ClkStatusText, 0, Button3, sigstatusbar, {.i = 3}},
|
||||
{ClkStatusText, 0, Button4, sigstatusbar, {.i = 4}},
|
||||
{ClkStatusText, 0, Button5, sigstatusbar, {.i = 5}},
|
||||
{ClkStatusText, ShiftMask, Button1, sigstatusbar, {.i = 6}},
|
||||
{ClkClientWin, MODKEY, Button1, movemouse, {0}},
|
||||
{ClkClientWin, MODKEY, Button2, togglefloating, {0}},
|
||||
{ClkClientWin, MODKEY, Button3, resizemouse, {0}},
|
||||
{ClkTagBar, 0, Button1, view, {0}},
|
||||
{ClkTagBar, 0, Button3, toggleview, {0}},
|
||||
{ClkTagBar, MODKEY, Button1, tag, {0}},
|
||||
{ClkTagBar, MODKEY, Button3, toggletag, {0}},
|
||||
};
|
||||
|
||||
|
||||
1
drw.c
1
drw.c
@ -469,3 +469,4 @@ drw_cur_free(Drw *drw, Cur *cursor)
|
||||
XFreeCursor(drw->dpy, cursor->cursor);
|
||||
free(cursor);
|
||||
}
|
||||
|
||||
|
||||
88
dwm-attachtop-6.2.diff
Normal file
88
dwm-attachtop-6.2.diff
Normal file
@ -0,0 +1,88 @@
|
||||
From 17acbdcb56d0d2f39507a3f67ef329c14a213ef6 Mon Sep 17 00:00:00 2001
|
||||
From: MLquest8 <miskuzius@gmail.com>
|
||||
Date: Thu, 18 Jun 2020 15:34:18 +0400
|
||||
Subject: [PATCH] attachtop. Attaches new client below the last master/on top
|
||||
of the stack. In case of nmaster = 1 behaves like attachaside.
|
||||
|
||||
---
|
||||
dwm.c | 29 +++++++++++++++++++++++++----
|
||||
1 file changed, 25 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 9fd0286..7ced982 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -49,7 +49,8 @@
|
||||
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
||||
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
||||
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
||||
-#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
||||
+#define ISVISIBLEONTAG(C, T) ((C->tags & T))
|
||||
+#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
|
||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||
@@ -147,6 +148,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
|
||||
static void arrange(Monitor *m);
|
||||
static void arrangemon(Monitor *m);
|
||||
static void attach(Client *c);
|
||||
+static void attachtop(Client *c);
|
||||
static void attachstack(Client *c);
|
||||
static void buttonpress(XEvent *e);
|
||||
static void checkotherwm(void);
|
||||
@@ -407,6 +409,25 @@ attach(Client *c)
|
||||
c->mon->clients = c;
|
||||
}
|
||||
|
||||
+void
|
||||
+attachtop(Client *c)
|
||||
+{
|
||||
+ int n;
|
||||
+ Monitor *m = selmon;
|
||||
+ Client *below;
|
||||
+
|
||||
+ for (n = 1, below = c->mon->clients;
|
||||
+ below && below->next && (below->isfloating || !ISVISIBLEONTAG(below, c->tags) || n != m->nmaster);
|
||||
+ n = below->isfloating || !ISVISIBLEONTAG(below, c->tags) ? n + 0 : n + 1, below = below->next);
|
||||
+ c->next = NULL;
|
||||
+ if (below) {
|
||||
+ c->next = below->next;
|
||||
+ below->next = c;
|
||||
+ }
|
||||
+ else
|
||||
+ c->mon->clients = c;
|
||||
+}
|
||||
+
|
||||
void
|
||||
attachstack(Client *c)
|
||||
{
|
||||
@@ -1063,7 +1084,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
||||
if (c->isfloating)
|
||||
XRaiseWindow(dpy, c->win);
|
||||
- attach(c);
|
||||
+ attachtop(c);
|
||||
attachstack(c);
|
||||
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
||||
(unsigned char *) &(c->win), 1);
|
||||
@@ -1418,7 +1439,7 @@ sendmon(Client *c, Monitor *m)
|
||||
detachstack(c);
|
||||
c->mon = m;
|
||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||
- attach(c);
|
||||
+ attachtop(c);
|
||||
attachstack(c);
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
@@ -1900,7 +1921,7 @@ updategeom(void)
|
||||
m->clients = c->next;
|
||||
detachstack(c);
|
||||
c->mon = mons;
|
||||
- attach(c);
|
||||
+ attachtop(c);
|
||||
attachstack(c);
|
||||
}
|
||||
if (m == selmon)
|
||||
--
|
||||
2.26.2
|
||||
|
||||
56
dwm-fullscreen-6.2.diff
Normal file
56
dwm-fullscreen-6.2.diff
Normal file
@ -0,0 +1,56 @@
|
||||
From 54719285bd1a984e2efce6e8a8eab184fec11abf Mon Sep 17 00:00:00 2001
|
||||
From: Sermak <sermak@jarvis.com>
|
||||
Date: Mon, 8 Jul 2019 01:06:44 +0200
|
||||
Subject: [PATCH] Simulate toggleable fullscreen mode
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwm.c | 14 ++++++++++++++
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..f774cc5 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -76,6 +76,7 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
+ { MODKEY|ShiftMask, XK_f, fullscreen, {0} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..04b1e06 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -199,6 +199,7 @@ static void sendmon(Client *c, Monitor *m);
|
||||
static void setclientstate(Client *c, long state);
|
||||
static void setfocus(Client *c);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
+static void fullscreen(const Arg *arg);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
static void setup(void);
|
||||
@@ -1497,6 +1498,19 @@ setfullscreen(Client *c, int fullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
+Layout *last_layout;
|
||||
+void
|
||||
+fullscreen(const Arg *arg)
|
||||
+{
|
||||
+ if (selmon->showbar) {
|
||||
+ for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
|
||||
+ setlayout(&((Arg) { .v = &layouts[2] }));
|
||||
+ } else {
|
||||
+ setlayout(&((Arg) { .v = last_layout }));
|
||||
+ }
|
||||
+ togglebar(arg);
|
||||
+}
|
||||
+
|
||||
void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.22.0
|
||||
234
dwm-keychord-6.4.diff
Normal file
234
dwm-keychord-6.4.diff
Normal file
@ -0,0 +1,234 @@
|
||||
From cb7ea178ac8e60cf123b333af64df8228762f669 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Aaron=20Z=C3=BCger?= <contact@azureorange.xyz>
|
||||
Date: Wed, 19 Jul 2023 14:17:39 +0200
|
||||
Subject: [PATCH] Update dwm-keychord patch to comply with the changes in dwm
|
||||
from version 6.2 to version 6.4. Namely changes in the grabkey function to
|
||||
match the newer implementation of said function.
|
||||
|
||||
---
|
||||
config.def.h | 81 ++++++++++++++++++++++++++--------------------------
|
||||
dwm.c | 72 +++++++++++++++++++++++++++++++++++++---------
|
||||
2 files changed, 99 insertions(+), 54 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9efa774..49f0558 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -46,11 +46,11 @@ static const Layout layouts[] = {
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
-#define TAGKEYS(KEY,TAG) \
|
||||
- { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
- { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
- { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
- { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
+#define TAGKEYS(KEY,TAG) \
|
||||
+ &((Keychord){1, {{MODKEY, KEY}}, view, {.ui = 1 << TAG} }), \
|
||||
+ &((Keychord){1, {{MODKEY|ControlMask, KEY}}, toggleview, {.ui = 1 << TAG} }), \
|
||||
+ &((Keychord){1, {{MODKEY|ShiftMask, KEY}}, tag, {.ui = 1 << TAG} }), \
|
||||
+ &((Keychord){1, {{MODKEY|ControlMask|ShiftMask, KEY}}, toggletag, {.ui = 1 << TAG} }),
|
||||
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
@@ -60,41 +60,42 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
|
||||
-static const Key keys[] = {
|
||||
- /* modifier key function argument */
|
||||
- { MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
- { MODKEY, XK_b, togglebar, {0} },
|
||||
- { MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
- { MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
- { MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
- { MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
- { MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
- { MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
- { MODKEY, XK_Return, zoom, {0} },
|
||||
- { MODKEY, XK_Tab, view, {0} },
|
||||
- { MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
- { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
- { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
- { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
- { MODKEY, XK_space, setlayout, {0} },
|
||||
- { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
- { MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
- { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
- { MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
- { MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
- { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
- { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
- TAGKEYS( XK_1, 0)
|
||||
- TAGKEYS( XK_2, 1)
|
||||
- TAGKEYS( XK_3, 2)
|
||||
- TAGKEYS( XK_4, 3)
|
||||
- TAGKEYS( XK_5, 4)
|
||||
- TAGKEYS( XK_6, 5)
|
||||
- TAGKEYS( XK_7, 6)
|
||||
- TAGKEYS( XK_8, 7)
|
||||
- TAGKEYS( XK_9, 8)
|
||||
- { MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
+static Keychord *keychords[] = {
|
||||
+ /* Keys function argument */
|
||||
+ &((Keychord){1, {{MODKEY, XK_p}}, spawn, {.v = dmenucmd } }),
|
||||
+ &((Keychord){1, {{MODKEY|ShiftMask, XK_Return}}, spawn, {.v = termcmd } }),
|
||||
+ &((Keychord){2, {{MODKEY, XK_e}, {MODKEY, XK_e}}, spawn, {.v = termcmd } }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_b}}, togglebar, {0} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_j}}, focusstack, {.i = +1 } }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_k}}, focusstack, {.i = -1 } }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_i}}, incnmaster, {.i = +1 } }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_d}}, incnmaster, {.i = -1 } }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_h}}, setmfact, {.f = -0.05} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_l}}, setmfact, {.f = +0.05} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_Return}}, zoom, {0} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_Tab}}, view, {0} }),
|
||||
+ &((Keychord){1, {{MODKEY|ShiftMask, XK_c}}, killclient, {0} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_t}}, setlayout, {.v = &layouts[0]} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_f}}, setlayout, {.v = &layouts[1]} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_m}}, setlayout, {.v = &layouts[2]} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_space}}, setlayout, {0} }),
|
||||
+ &((Keychord){1, {{MODKEY|ShiftMask, XK_space}}, togglefloating, {0} }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_0}}, view, {.ui = ~0 } }),
|
||||
+ &((Keychord){1, {{MODKEY|ShiftMask, XK_0}}, tag, {.ui = ~0 } }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_comma}}, focusmon, {.i = -1 } }),
|
||||
+ &((Keychord){1, {{MODKEY, XK_period}}, focusmon, {.i = +1 } }),
|
||||
+ &((Keychord){1, {{MODKEY|ShiftMask, XK_comma}}, tagmon, {.i = -1 } }),
|
||||
+ &((Keychord){1, {{MODKEY|ShiftMask, XK_period}}, tagmon, {.i = +1 } }),
|
||||
+ &((Keychord){1, {{MODKEY|ShiftMask, XK_q}}, quit, {0} }),
|
||||
+ TAGKEYS( XK_1, 0)
|
||||
+ TAGKEYS( XK_2, 1)
|
||||
+ TAGKEYS( XK_3, 2)
|
||||
+ TAGKEYS( XK_4, 3)
|
||||
+ TAGKEYS( XK_5, 4)
|
||||
+ TAGKEYS( XK_6, 5)
|
||||
+ TAGKEYS( XK_7, 6)
|
||||
+ TAGKEYS( XK_8, 7)
|
||||
+ TAGKEYS( XK_9, 8)
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index f1d86b2..e4885a4 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -102,9 +102,14 @@ struct Client {
|
||||
typedef struct {
|
||||
unsigned int mod;
|
||||
KeySym keysym;
|
||||
+} Key;
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned int n;
|
||||
+ const Key keys[5];
|
||||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
-} Key;
|
||||
+} Keychord;
|
||||
|
||||
typedef struct {
|
||||
const char *symbol;
|
||||
@@ -267,6 +272,7 @@ static Display *dpy;
|
||||
static Drw *drw;
|
||||
static Monitor *mons, *selmon;
|
||||
static Window root, wmcheckwin;
|
||||
+unsigned int currentkey = 0;
|
||||
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
@@ -954,7 +960,8 @@ grabkeys(void)
|
||||
{
|
||||
updatenumlockmask();
|
||||
{
|
||||
- unsigned int i, j, k;
|
||||
+ /* unsigned int i, j, k; */
|
||||
+ unsigned int i, c, k;
|
||||
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
||||
int start, end, skip;
|
||||
KeySym *syms;
|
||||
@@ -964,15 +971,18 @@ grabkeys(void)
|
||||
syms = XGetKeyboardMapping(dpy, start, end - start + 1, &skip);
|
||||
if (!syms)
|
||||
return;
|
||||
+
|
||||
for (k = start; k <= end; k++)
|
||||
- for (i = 0; i < LENGTH(keys); i++)
|
||||
+ for (i = 0; i < LENGTH(keychords); i++)
|
||||
/* skip modifier codes, we do that ourselves */
|
||||
- if (keys[i].keysym == syms[(k - start) * skip])
|
||||
- for (j = 0; j < LENGTH(modifiers); j++)
|
||||
+ if (keychords[i]->keys[currentkey].keysym == syms[(k - start) * skip])
|
||||
+ for (c = 0; c < LENGTH(modifiers); c++)
|
||||
XGrabKey(dpy, k,
|
||||
- keys[i].mod | modifiers[j],
|
||||
+ keychords[i]->keys[currentkey].mod | modifiers[c],
|
||||
root, True,
|
||||
GrabModeAsync, GrabModeAsync);
|
||||
+ if(currentkey > 0)
|
||||
+ XGrabKey(dpy, XKeysymToKeycode(dpy, XK_Escape), AnyModifier, root, True, GrabModeAsync, GrabModeAsync);
|
||||
XFree(syms);
|
||||
}
|
||||
}
|
||||
@@ -999,17 +1009,51 @@ isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
|
||||
void
|
||||
keypress(XEvent *e)
|
||||
{
|
||||
- unsigned int i;
|
||||
+ /* unsigned int i; */
|
||||
+ XEvent event = *e;
|
||||
+ unsigned int ran = 0;
|
||||
KeySym keysym;
|
||||
XKeyEvent *ev;
|
||||
|
||||
- ev = &e->xkey;
|
||||
- keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
|
||||
- for (i = 0; i < LENGTH(keys); i++)
|
||||
- if (keysym == keys[i].keysym
|
||||
- && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
|
||||
- && keys[i].func)
|
||||
- keys[i].func(&(keys[i].arg));
|
||||
+ Keychord *arr1[sizeof(keychords) / sizeof(Keychord*)];
|
||||
+ Keychord *arr2[sizeof(keychords) / sizeof(Keychord*)];
|
||||
+ memcpy(arr1, keychords, sizeof(keychords));
|
||||
+ Keychord **rpointer = arr1;
|
||||
+ Keychord **wpointer = arr2;
|
||||
+
|
||||
+ size_t r = sizeof(keychords)/ sizeof(Keychord*);
|
||||
+
|
||||
+ while(1){
|
||||
+ ev = &event.xkey;
|
||||
+ keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
|
||||
+ size_t w = 0;
|
||||
+ for (int i = 0; i < r; i++){
|
||||
+ if(keysym == (*(rpointer + i))->keys[currentkey].keysym
|
||||
+ && CLEANMASK((*(rpointer + i))->keys[currentkey].mod) == CLEANMASK(ev->state)
|
||||
+ && (*(rpointer + i))->func){
|
||||
+ if((*(rpointer + i))->n == currentkey +1){
|
||||
+ (*(rpointer + i))->func(&((*(rpointer + i))->arg));
|
||||
+ ran = 1;
|
||||
+ }else{
|
||||
+ *(wpointer + w) = *(rpointer + i);
|
||||
+ w++;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ currentkey++;
|
||||
+ if(w == 0 || ran == 1)
|
||||
+ break;
|
||||
+ grabkeys();
|
||||
+ while (running && !XNextEvent(dpy, &event) && !ran)
|
||||
+ if(event.type == KeyPress)
|
||||
+ break;
|
||||
+ r = w;
|
||||
+ Keychord **holder = rpointer;
|
||||
+ rpointer = wpointer;
|
||||
+ wpointer = holder;
|
||||
+ }
|
||||
+ currentkey = 0;
|
||||
+ grabkeys();
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.41.0
|
||||
95
dwm-movestack-20211115-a786211.diff
Normal file
95
dwm-movestack-20211115-a786211.diff
Normal file
@ -0,0 +1,95 @@
|
||||
From 9a4037dc0ef56f91c009317e78e9e3790dafbb58 Mon Sep 17 00:00:00 2001
|
||||
From: BrunoCooper17 <BrunoCooper17@outlook.com>
|
||||
Date: Mon, 15 Nov 2021 14:04:53 -0600
|
||||
Subject: [PATCH] MoveStack patch
|
||||
|
||||
This plugin allows you to move clients around in the stack and swap them
|
||||
with the master. It emulates the behavior off mod+shift+j and mod+shift+k
|
||||
in Xmonad. movestack(+1) will swap the client with the current focus with
|
||||
the next client. movestack(-1) will swap the client with the current focus
|
||||
with the previous client.
|
||||
---
|
||||
config.def.h | 3 +++
|
||||
movestack.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 51 insertions(+)
|
||||
create mode 100644 movestack.c
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a2ac963..33efa5b 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -60,6 +60,7 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
|
||||
+#include "movestack.c"
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
@@ -71,6 +72,8 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
+ { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } },
|
||||
+ { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
diff --git a/movestack.c b/movestack.c
|
||||
new file mode 100644
|
||||
index 0000000..520f4ae
|
||||
--- /dev/null
|
||||
+++ b/movestack.c
|
||||
@@ -0,0 +1,48 @@
|
||||
+void
|
||||
+movestack(const Arg *arg) {
|
||||
+ Client *c = NULL, *p = NULL, *pc = NULL, *i;
|
||||
+
|
||||
+ if(arg->i > 0) {
|
||||
+ /* find the client after selmon->sel */
|
||||
+ for(c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
||||
+ if(!c)
|
||||
+ for(c = selmon->clients; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
||||
+
|
||||
+ }
|
||||
+ else {
|
||||
+ /* find the client before selmon->sel */
|
||||
+ for(i = selmon->clients; i != selmon->sel; i = i->next)
|
||||
+ if(ISVISIBLE(i) && !i->isfloating)
|
||||
+ c = i;
|
||||
+ if(!c)
|
||||
+ for(; i; i = i->next)
|
||||
+ if(ISVISIBLE(i) && !i->isfloating)
|
||||
+ c = i;
|
||||
+ }
|
||||
+ /* find the client before selmon->sel and c */
|
||||
+ for(i = selmon->clients; i && (!p || !pc); i = i->next) {
|
||||
+ if(i->next == selmon->sel)
|
||||
+ p = i;
|
||||
+ if(i->next == c)
|
||||
+ pc = i;
|
||||
+ }
|
||||
+
|
||||
+ /* swap c and selmon->sel selmon->clients in the selmon->clients list */
|
||||
+ if(c && c != selmon->sel) {
|
||||
+ Client *temp = selmon->sel->next==c?selmon->sel:selmon->sel->next;
|
||||
+ selmon->sel->next = c->next==selmon->sel?c:c->next;
|
||||
+ c->next = temp;
|
||||
+
|
||||
+ if(p && p != c)
|
||||
+ p->next = c;
|
||||
+ if(pc && pc != selmon->sel)
|
||||
+ pc->next = selmon->sel;
|
||||
+
|
||||
+ if(selmon->sel == selmon->clients)
|
||||
+ selmon->clients = c;
|
||||
+ else if(c == selmon->clients)
|
||||
+ selmon->clients = selmon->sel;
|
||||
+
|
||||
+ arrange(selmon);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.33.1
|
||||
|
||||
177
dwm-pertag-20200914-61bb8b2.diff
Normal file
177
dwm-pertag-20200914-61bb8b2.diff
Normal file
@ -0,0 +1,177 @@
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 664c527..ac8e4ec 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -111,6 +111,7 @@ typedef struct {
|
||||
void (*arrange)(Monitor *);
|
||||
} Layout;
|
||||
|
||||
+typedef struct Pertag Pertag;
|
||||
struct Monitor {
|
||||
char ltsymbol[16];
|
||||
float mfact;
|
||||
@@ -130,6 +131,7 @@ struct Monitor {
|
||||
Monitor *next;
|
||||
Window barwin;
|
||||
const Layout *lt[2];
|
||||
+ Pertag *pertag;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -272,6 +274,15 @@ static Window root, wmcheckwin;
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
+struct Pertag {
|
||||
+ unsigned int curtag, prevtag; /* current and previous tag */
|
||||
+ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
|
||||
+ float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
|
||||
+ unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
|
||||
+ const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
|
||||
+ int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
||||
+};
|
||||
+
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||
|
||||
@@ -632,6 +643,7 @@ Monitor *
|
||||
createmon(void)
|
||||
{
|
||||
Monitor *m;
|
||||
+ unsigned int i;
|
||||
|
||||
m = ecalloc(1, sizeof(Monitor));
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
@@ -642,6 +654,20 @@ createmon(void)
|
||||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||
+ m->pertag = ecalloc(1, sizeof(Pertag));
|
||||
+ m->pertag->curtag = m->pertag->prevtag = 1;
|
||||
+
|
||||
+ for (i = 0; i <= LENGTH(tags); i++) {
|
||||
+ m->pertag->nmasters[i] = m->nmaster;
|
||||
+ m->pertag->mfacts[i] = m->mfact;
|
||||
+
|
||||
+ m->pertag->ltidxs[i][0] = m->lt[0];
|
||||
+ m->pertag->ltidxs[i][1] = m->lt[1];
|
||||
+ m->pertag->sellts[i] = m->sellt;
|
||||
+
|
||||
+ m->pertag->showbars[i] = m->showbar;
|
||||
+ }
|
||||
+
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -967,7 +993,7 @@ grabkeys(void)
|
||||
void
|
||||
incnmaster(const Arg *arg)
|
||||
{
|
||||
- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -1502,9 +1528,9 @@ void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||
- selmon->sellt ^= 1;
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
|
||||
if (arg && arg->v)
|
||||
- selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
|
||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
|
||||
if (selmon->sel)
|
||||
arrange(selmon);
|
||||
@@ -1523,7 +1549,7 @@ setmfact(const Arg *arg)
|
||||
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
|
||||
if (f < 0.05 || f > 0.95)
|
||||
return;
|
||||
- selmon->mfact = f;
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -1702,7 +1728,7 @@ tile(Monitor *m)
|
||||
void
|
||||
togglebar(const Arg *arg)
|
||||
{
|
||||
- selmon->showbar = !selmon->showbar;
|
||||
+ selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||
arrange(selmon);
|
||||
@@ -1741,9 +1767,33 @@ void
|
||||
toggleview(const Arg *arg)
|
||||
{
|
||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
|
||||
+ int i;
|
||||
|
||||
if (newtagset) {
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
+
|
||||
+ if (newtagset == ~0) {
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ selmon->pertag->curtag = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* test if the user did not select the same tag */
|
||||
+ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ for (i = 0; !(newtagset & 1 << i); i++) ;
|
||||
+ selmon->pertag->curtag = i + 1;
|
||||
+ }
|
||||
+
|
||||
+ /* apply settings for this view */
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
+
|
||||
+ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
+ togglebar(NULL);
|
||||
+
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
@@ -2038,11 +2088,37 @@ updatewmhints(Client *c)
|
||||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
+ int i;
|
||||
+ unsigned int tmptag;
|
||||
+
|
||||
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
- if (arg->ui & TAGMASK)
|
||||
+ if (arg->ui & TAGMASK) {
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+
|
||||
+ if (arg->ui == ~0)
|
||||
+ selmon->pertag->curtag = 0;
|
||||
+ else {
|
||||
+ for (i = 0; !(arg->ui & 1 << i); i++) ;
|
||||
+ selmon->pertag->curtag = i + 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ tmptag = selmon->pertag->prevtag;
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ selmon->pertag->curtag = tmptag;
|
||||
+ }
|
||||
+
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
+
|
||||
+ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
+ togglebar(NULL);
|
||||
+
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
139
dwm-restartsig-20180523-6.2.diff
Normal file
139
dwm-restartsig-20180523-6.2.diff
Normal file
@ -0,0 +1,139 @@
|
||||
From 2991f37f0aaf44b9f9b11e7893ff0af8eb88f649 Mon Sep 17 00:00:00 2001
|
||||
From: Christopher Drelich <cd@cdrakka.com>
|
||||
Date: Wed, 23 May 2018 22:50:38 -0400
|
||||
Subject: [PATCH] Modifies quit to handle restarts and adds SIGHUP and SIGTERM
|
||||
handlers.
|
||||
|
||||
Modified quit() to restart if it receives arg .i = 1
|
||||
MOD+CTRL+SHIFT+Q was added to confid.def.h to do just that.
|
||||
|
||||
Signal handlers were handled for SIGHUP and SIGTERM.
|
||||
If dwm receives these signals it calls quit() with
|
||||
arg .i = to 1 or 0, respectively.
|
||||
|
||||
To restart dwm:
|
||||
MOD+CTRL+SHIFT+Q
|
||||
or
|
||||
kill -HUP dwmpid
|
||||
|
||||
To quit dwm cleanly:
|
||||
MOD+SHIFT+Q
|
||||
or
|
||||
kill -TERM dwmpid
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwm.1 | 10 ++++++++++
|
||||
dwm.c | 22 ++++++++++++++++++++++
|
||||
3 files changed, 33 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a9ac303..e559429 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -94,6 +94,7 @@ static Key keys[] = {
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
+ { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} },
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
diff --git a/dwm.1 b/dwm.1
|
||||
index 13b3729..36a331c 100644
|
||||
--- a/dwm.1
|
||||
+++ b/dwm.1
|
||||
@@ -142,6 +142,9 @@ Add/remove all windows with nth tag to/from the view.
|
||||
.TP
|
||||
.B Mod1\-Shift\-q
|
||||
Quit dwm.
|
||||
+.TP
|
||||
+.B Mod1\-Control\-Shift\-q
|
||||
+Restart dwm.
|
||||
.SS Mouse commands
|
||||
.TP
|
||||
.B Mod1\-Button1
|
||||
@@ -155,6 +158,13 @@ Resize focused window while dragging. Tiled windows will be toggled to the float
|
||||
.SH CUSTOMIZATION
|
||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||
code. This keeps it fast, secure and simple.
|
||||
+.SH SIGNALS
|
||||
+.TP
|
||||
+.B SIGHUP - 1
|
||||
+Restart the dwm process.
|
||||
+.TP
|
||||
+.B SIGTERM - 15
|
||||
+Cleanly terminate the dwm process.
|
||||
.SH SEE ALSO
|
||||
.BR dmenu (1),
|
||||
.BR st (1)
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index bb95e26..286eecd 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -205,6 +205,8 @@ static void setup(void);
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
+static void sighup(int unused);
|
||||
+static void sigterm(int unused);
|
||||
static void spawn(const Arg *arg);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
@@ -260,6 +262,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
[UnmapNotify] = unmapnotify
|
||||
};
|
||||
static Atom wmatom[WMLast], netatom[NetLast];
|
||||
+static int restart = 0;
|
||||
static int running = 1;
|
||||
static Cur *cursor[CurLast];
|
||||
static Clr **scheme;
|
||||
@@ -1248,6 +1251,7 @@ propertynotify(XEvent *e)
|
||||
void
|
||||
quit(const Arg *arg)
|
||||
{
|
||||
+ if(arg->i) restart = 1;
|
||||
running = 0;
|
||||
}
|
||||
|
||||
@@ -1536,6 +1540,9 @@ setup(void)
|
||||
/* clean up any zombies immediately */
|
||||
sigchld(0);
|
||||
|
||||
+ signal(SIGHUP, sighup);
|
||||
+ signal(SIGTERM, sigterm);
|
||||
+
|
||||
/* init screen */
|
||||
screen = DefaultScreen(dpy);
|
||||
sw = DisplayWidth(dpy, screen);
|
||||
@@ -1637,6 +1644,20 @@ sigchld(int unused)
|
||||
}
|
||||
|
||||
void
|
||||
+sighup(int unused)
|
||||
+{
|
||||
+ Arg a = {.i = 1};
|
||||
+ quit(&a);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+sigterm(int unused)
|
||||
+{
|
||||
+ Arg a = {.i = 0};
|
||||
+ quit(&a);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
spawn(const Arg *arg)
|
||||
{
|
||||
if (arg->v == dmenucmd)
|
||||
@@ -2139,6 +2160,7 @@ main(int argc, char *argv[])
|
||||
setup();
|
||||
scan();
|
||||
run();
|
||||
+ if(restart) execvp(argv[0], argv);
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
||||
return EXIT_SUCCESS;
|
||||
--
|
||||
2.7.4
|
||||
|
||||
198
dwm-shif-tools-6.2.diff
Normal file
198
dwm-shif-tools-6.2.diff
Normal file
@ -0,0 +1,198 @@
|
||||
From d57c8508c9f26be40667d402a2daaa2b27ae759f Mon Sep 17 00:00:00 2001
|
||||
From: explosion-mental <explosion0mental@gmail.com>
|
||||
Date: Wed, 11 Aug 2021 21:05:44 -0500
|
||||
Subject: [PATCH] shift-tools - shifttag, moves the current selected client to
|
||||
the adjacent tag - shifttagclients, moves the current selected client to the
|
||||
adjacent tag that has at least one client else acts as shifttag -
|
||||
shiftview, view adjacent tag - shiftviewclients, view the closes tag that has
|
||||
a client. If none acts as shiftview - shiftboth, shifttag and shiftview.
|
||||
Basically moves the window to the next/prev tag and follows it. -
|
||||
shiftswaptags, its a shift implementation on the swaptags function (see
|
||||
https://github.com/moizifty/DWM-Build/blob/65379c62640788881486401a0d8c79333751b02f/config.h#L48
|
||||
for more details), which in short 'swaps tags' (swaps all clients with
|
||||
the clients on the adjacent tag). A pretty useful example of this is
|
||||
chosing a tag empty and sending all your clients to that tag. - swapfunction
|
||||
is the 'helper' function for the shiftswaptags. remember that these functions
|
||||
**shift**, which means you can go from tag 1 to 9 or 9 to 1. Also remember
|
||||
that the default argument is 1 and you can change it.
|
||||
|
||||
---
|
||||
config.def.h | 9 ++++
|
||||
shift-tools.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 144 insertions(+)
|
||||
create mode 100644 shift-tools.c
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..1390d17 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -58,9 +58,14 @@ static const Layout layouts[] = {
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
+#include "shift-tools.c"
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
+ { MODKEY, XK_o, shiftviewclients, { .i = +1 } },
|
||||
+ { MODKEY|ShiftMask, XK_o, shiftview, { .i = +1 } },
|
||||
+ { MODKEY|ShiftMask, XK_i, shiftview, { .i = -1 } },
|
||||
+ { MODKEY, XK_i, shiftviewclients, { .i = -1 } },
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
@@ -69,6 +74,10 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
+ { MODKEY|ShiftMask, XK_h, shiftboth, { .i = -1 } },
|
||||
+ { MODKEY|ControlMask, XK_h, shiftswaptags, { .i = -1 } },
|
||||
+ { MODKEY|ControlMask, XK_l, shiftswaptags, { .i = +1 } },
|
||||
+ { MODKEY|ShiftMask, XK_l, shiftboth, { .i = +1 } },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
diff --git a/shift-tools.c b/shift-tools.c
|
||||
new file mode 100644
|
||||
index 0000000..cf130c8
|
||||
--- /dev/null
|
||||
+++ b/shift-tools.c
|
||||
@@ -0,0 +1,135 @@
|
||||
+/* Sends a window to the next/prev tag */
|
||||
+void
|
||||
+shifttag(const Arg *arg)
|
||||
+{
|
||||
+ Arg shifted;
|
||||
+ shifted.ui = selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+
|
||||
+ if (arg->i > 0) /* left circular shift */
|
||||
+ shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i)));
|
||||
+ else /* right circular shift */
|
||||
+ shifted.ui = (shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i));
|
||||
+ tag(&shifted);
|
||||
+}
|
||||
+/* Sends a window to the next/prev tag that has a client, else it moves it to the next/prev one. */
|
||||
+void
|
||||
+shifttagclients(const Arg *arg)
|
||||
+{
|
||||
+
|
||||
+ Arg shifted;
|
||||
+ Client *c;
|
||||
+ unsigned int tagmask = 0;
|
||||
+ shifted.ui = selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+ for (c = selmon->clients; c; c = c->next)
|
||||
+ if (!(c->tags))
|
||||
+ tagmask = tagmask | c->tags;
|
||||
+
|
||||
+
|
||||
+ if (arg->i > 0) /* left circular shift */
|
||||
+ do {
|
||||
+ shifted.ui = (shifted.ui << arg->i)
|
||||
+ | (shifted.ui >> (LENGTH(tags) - arg->i));
|
||||
+ } while (tagmask && !(shifted.ui & tagmask));
|
||||
+ else /* right circular shift */
|
||||
+ do {
|
||||
+ shifted.ui = (shifted.ui >> (- arg->i)
|
||||
+ | shifted.ui << (LENGTH(tags) + arg->i));
|
||||
+ } while (tagmask && !(shifted.ui & tagmask));
|
||||
+ tag(&shifted);
|
||||
+}
|
||||
+/* Navigate to the next/prev tag */
|
||||
+void
|
||||
+shiftview(const Arg *arg)
|
||||
+{
|
||||
+ Arg shifted;
|
||||
+ shifted.ui = selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+ if (arg->i > 0) /* left circular shift */
|
||||
+ shifted.ui = (shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i));
|
||||
+ else /* right circular shift */
|
||||
+ shifted.ui = (shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i));
|
||||
+ view(&shifted);
|
||||
+}
|
||||
+/* Navigate to the next/prev tag that has a client, else moves it to the next/prev tag */
|
||||
+void
|
||||
+shiftviewclients(const Arg *arg)
|
||||
+{
|
||||
+ Arg shifted;
|
||||
+ Client *c;
|
||||
+ unsigned int tagmask = 0;
|
||||
+ shifted.ui = selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+ for (c = selmon->clients; c; c = c->next)
|
||||
+ if (!(c->tags))
|
||||
+ tagmask = tagmask | c->tags;
|
||||
+
|
||||
+
|
||||
+ if (arg->i > 0) /* left circular shift */
|
||||
+ do {
|
||||
+ shifted.ui = (shifted.ui << arg->i)
|
||||
+ | (shifted.ui >> (LENGTH(tags) - arg->i));
|
||||
+ } while (tagmask && !(shifted.ui & tagmask));
|
||||
+ else /* right circular shift */
|
||||
+ do {
|
||||
+ shifted.ui = (shifted.ui >> (- arg->i)
|
||||
+ | shifted.ui << (LENGTH(tags) + arg->i));
|
||||
+ } while (tagmask && !(shifted.ui & tagmask));
|
||||
+ view(&shifted);
|
||||
+}
|
||||
+/* move the current active window to the next/prev tag and view it. More like following the window */
|
||||
+void
|
||||
+shiftboth(const Arg *arg)
|
||||
+{
|
||||
+ Arg shifted;
|
||||
+ shifted.ui = selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+ if (arg->i > 0) /* left circular shift */
|
||||
+ shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i)));
|
||||
+ else /* right circular shift */
|
||||
+ shifted.ui = ((shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i)));
|
||||
+ tag(&shifted);
|
||||
+ view(&shifted);
|
||||
+}
|
||||
+//helper function for shiftswaptags.
|
||||
+//see: https://github.com/moizifty/DWM-Build/blob/65379c62640788881486401a0d8c79333751b02f/config.h#L48
|
||||
+void
|
||||
+swaptags(const Arg *arg)
|
||||
+{
|
||||
+ Client *c;
|
||||
+ unsigned int newtag = arg->ui & TAGMASK;
|
||||
+ unsigned int curtag = selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+ if (newtag == curtag || !curtag || (curtag & (curtag-1)))
|
||||
+ return;
|
||||
+
|
||||
+ for (c = selmon->clients; c != NULL; c = c->next) {
|
||||
+ if ((c->tags & newtag) || (c->tags & curtag))
|
||||
+ c->tags ^= curtag ^ newtag;
|
||||
+
|
||||
+ if (!c->tags)
|
||||
+ c->tags = newtag;
|
||||
+ }
|
||||
+
|
||||
+ //move to the swaped tag
|
||||
+ //selmon->tagset[selmon->seltags] = newtag;
|
||||
+
|
||||
+ focus(NULL);
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+/* swaps "tags" (all the clients) with the next/prev tag. */
|
||||
+void
|
||||
+shiftswaptags(const Arg *arg)
|
||||
+{
|
||||
+ Arg shifted;
|
||||
+ shifted.ui = selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+ if (arg->i > 0) /* left circular shift */
|
||||
+ shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i)));
|
||||
+ else /* right circular shift */
|
||||
+ shifted.ui = ((shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i)));
|
||||
+ swaptags(&shifted);
|
||||
+ // uncomment if you also want to "go" (view) the tag where the the clients are going
|
||||
+ //view(&shifted);
|
||||
+}
|
||||
--
|
||||
2.32.0
|
||||
|
||||
220
dwm-statuscmd-20241009-8933ebc.diff
Normal file
220
dwm-statuscmd-20241009-8933ebc.diff
Normal file
@ -0,0 +1,220 @@
|
||||
From ca2a2e6386a746ebfc3480787e5d99da11e7abee Mon Sep 17 00:00:00 2001
|
||||
From: Justinas Grigas <dev@jstnas.com>
|
||||
Date: Wed, 9 Oct 2024 01:00:20 +0100
|
||||
Subject: [PATCH] [dwm][statuscmd] better click regions
|
||||
|
||||
The main improvement of this patch over the previous version 20210405 is that
|
||||
the click region now ends on a matching signal raw byte.
|
||||
|
||||
The matching byte is optional, and without it dwm will behave as before.
|
||||
|
||||
To take advantage of this feature, scripts need to be modified to print the raw
|
||||
byte at the end as well.
|
||||
|
||||
In addition, this patch cleanly applies onto master branch.
|
||||
---
|
||||
config.def.h | 6 ++-
|
||||
dwm.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
2 files changed, 104 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9efa774..d008275 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -55,6 +55,8 @@ static const Layout layouts[] = {
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
+#define STATUSBAR "dwmblocks"
|
||||
+
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
@@ -104,7 +106,9 @@ static const Button buttons[] = {
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
- { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
+ { ClkStatusText, 0, Button1, sigstatusbar, {.i = 1} },
|
||||
+ { ClkStatusText, 0, Button2, sigstatusbar, {.i = 2} },
|
||||
+ { ClkStatusText, 0, Button3, sigstatusbar, {.i = 3} },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 1443802..94ee0c7 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -171,6 +171,7 @@ static void focusstack(const Arg *arg);
|
||||
static Atom getatomprop(Client *c, Atom prop);
|
||||
static int getrootptr(int *x, int *y);
|
||||
static long getstate(Window w);
|
||||
+static pid_t getstatusbarpid();
|
||||
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||
static void grabbuttons(Client *c, int focused);
|
||||
static void grabkeys(void);
|
||||
@@ -204,6 +205,7 @@ static void setmfact(const Arg *arg);
|
||||
static void setup(void);
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
+static void sigstatusbar(const Arg *arg);
|
||||
static void spawn(const Arg *arg);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
@@ -236,6 +238,9 @@ static void zoom(const Arg *arg);
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
+static int statusw;
|
||||
+static int statussig;
|
||||
+static pid_t statuspid = -1;
|
||||
static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
static int bh; /* bar height */
|
||||
@@ -422,6 +427,7 @@ buttonpress(XEvent *e)
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XButtonPressedEvent *ev = &e->xbutton;
|
||||
+ char *text, *s, ch;
|
||||
|
||||
click = ClkRootWin;
|
||||
/* focus monitor if necessary */
|
||||
@@ -440,9 +446,27 @@ buttonpress(XEvent *e)
|
||||
arg.ui = 1 << i;
|
||||
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
||||
click = ClkLtSymbol;
|
||||
- else if (ev->x > selmon->ww - (int)TEXTW(stext))
|
||||
+ else if (ev->x > selmon->ww - statusw) {
|
||||
+ x = selmon->ww - statusw;
|
||||
click = ClkStatusText;
|
||||
- else
|
||||
+ statussig = 0;
|
||||
+ for (text = s = stext; *s && x <= ev->x; s++) {
|
||||
+ if ((unsigned char)(*s) < ' ') {
|
||||
+ ch = *s;
|
||||
+ *s = '\0';
|
||||
+ x += TEXTW(text) - lrpad;
|
||||
+ *s = ch;
|
||||
+ text = s + 1;
|
||||
+ if (x >= ev->x)
|
||||
+ break;
|
||||
+ /* reset on matching signal raw byte */
|
||||
+ if (ch == statussig)
|
||||
+ statussig = 0;
|
||||
+ else
|
||||
+ statussig = ch;
|
||||
+ }
|
||||
+ }
|
||||
+ } else
|
||||
click = ClkWinTitle;
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
focus(c);
|
||||
@@ -708,9 +732,24 @@ drawbar(Monitor *m)
|
||||
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
+ char *text, *s, ch;
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
- tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
||||
+
|
||||
+ x = 0;
|
||||
+ for (text = s = stext; *s; s++) {
|
||||
+ if ((unsigned char)(*s) < ' ') {
|
||||
+ ch = *s;
|
||||
+ *s = '\0';
|
||||
+ tw = TEXTW(text) - lrpad;
|
||||
+ drw_text(drw, m->ww - statusw + x, 0, tw, bh, 0, text, 0);
|
||||
+ x += tw;
|
||||
+ *s = ch;
|
||||
+ text = s + 1;
|
||||
+ }
|
||||
+ }
|
||||
+ tw = TEXTW(text) - lrpad + 2;
|
||||
+ drw_text(drw, m->ww - statusw + x, 0, tw, bh, 0, text, 0);
|
||||
+ tw = statusw;
|
||||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
@@ -876,6 +915,30 @@ getatomprop(Client *c, Atom prop)
|
||||
return atom;
|
||||
}
|
||||
|
||||
+pid_t
|
||||
+getstatusbarpid()
|
||||
+{
|
||||
+ char buf[32], *str = buf, *c;
|
||||
+ FILE *fp;
|
||||
+
|
||||
+ if (statuspid > 0) {
|
||||
+ snprintf(buf, sizeof(buf), "/proc/%u/cmdline", statuspid);
|
||||
+ if ((fp = fopen(buf, "r"))) {
|
||||
+ fgets(buf, sizeof(buf), fp);
|
||||
+ while ((c = strchr(str, '/')))
|
||||
+ str = c + 1;
|
||||
+ fclose(fp);
|
||||
+ if (!strcmp(str, STATUSBAR))
|
||||
+ return statuspid;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!(fp = popen("pidof -s "STATUSBAR, "r")))
|
||||
+ return -1;
|
||||
+ fgets(buf, sizeof(buf), fp);
|
||||
+ pclose(fp);
|
||||
+ return strtol(buf, NULL, 10);
|
||||
+}
|
||||
+
|
||||
int
|
||||
getrootptr(int *x, int *y)
|
||||
{
|
||||
@@ -1643,6 +1706,20 @@ showhide(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+sigstatusbar(const Arg *arg)
|
||||
+{
|
||||
+ union sigval sv;
|
||||
+
|
||||
+ if (!statussig)
|
||||
+ return;
|
||||
+ sv.sival_int = arg->i;
|
||||
+ if ((statuspid = getstatusbarpid()) <= 0)
|
||||
+ return;
|
||||
+
|
||||
+ sigqueue(statuspid, SIGRTMIN+statussig, sv);
|
||||
+}
|
||||
+
|
||||
void
|
||||
spawn(const Arg *arg)
|
||||
{
|
||||
@@ -2004,8 +2081,25 @@ updatesizehints(Client *c)
|
||||
void
|
||||
updatestatus(void)
|
||||
{
|
||||
- if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||
+ if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) {
|
||||
strcpy(stext, "dwm-"VERSION);
|
||||
+ statusw = TEXTW(stext) - lrpad + 2;
|
||||
+ } else {
|
||||
+ char *text, *s, ch;
|
||||
+
|
||||
+ statusw = 0;
|
||||
+ for (text = s = stext; *s; s++) {
|
||||
+ if ((unsigned char)(*s) < ' ') {
|
||||
+ ch = *s;
|
||||
+ *s = '\0';
|
||||
+ statusw += TEXTW(text) - lrpad;
|
||||
+ *s = ch;
|
||||
+ text = s + 1;
|
||||
+ }
|
||||
+ }
|
||||
+ statusw += TEXTW(text) - lrpad + 2;
|
||||
+
|
||||
+ }
|
||||
drawbar(selmon);
|
||||
}
|
||||
|
||||
--
|
||||
2.46.2
|
||||
|
||||
748
dwm-systray-6.7.diff
Normal file
748
dwm-systray-6.7.diff
Normal file
@ -0,0 +1,748 @@
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 81c3fc0..364b394 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -3,6 +3,11 @@
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
+static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
|
||||
+static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
|
||||
+static const unsigned int systrayspacing = 2; /* systray spacing */
|
||||
+static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
|
||||
+static const int showsystray = 1; /* 0 means no systray */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
@@ -102,8 +107,8 @@ static const Key keys[] = {
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||
static const Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
- { ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
- { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
+ { ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
+ { ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 8f4fa75..4b4fbb2 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -56,12 +56,27 @@
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
|
||||
+#define SYSTEM_TRAY_REQUEST_DOCK 0
|
||||
+/* XEMBED messages */
|
||||
+#define XEMBED_EMBEDDED_NOTIFY 0
|
||||
+#define XEMBED_WINDOW_ACTIVATE 1
|
||||
+#define XEMBED_FOCUS_IN 4
|
||||
+#define XEMBED_MODALITY_ON 10
|
||||
+#define XEMBED_MAPPED (1 << 0)
|
||||
+#define XEMBED_WINDOW_ACTIVATE 1
|
||||
+#define XEMBED_WINDOW_DEACTIVATE 2
|
||||
+#define VERSION_MAJOR 0
|
||||
+#define VERSION_MINOR 0
|
||||
+#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
|
||||
+
|
||||
/* enums */
|
||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
+ NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||
+enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
|
||||
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
||||
@@ -140,6 +155,12 @@ typedef struct {
|
||||
int monitor;
|
||||
} Rule;
|
||||
|
||||
+typedef struct Systray Systray;
|
||||
+struct Systray {
|
||||
+ Window win;
|
||||
+ Client *icons;
|
||||
+};
|
||||
+
|
||||
/* function declarations */
|
||||
static void applyrules(Client *c);
|
||||
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
|
||||
@@ -171,6 +192,7 @@ static void focusstack(const Arg *arg);
|
||||
static Atom getatomprop(Client *c, Atom prop);
|
||||
static int getrootptr(int *x, int *y);
|
||||
static long getstate(Window w);
|
||||
+static unsigned int getsystraywidth();
|
||||
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||
static void grabbuttons(Client *c, int focused);
|
||||
static void grabkeys(void);
|
||||
@@ -188,13 +210,16 @@ static void pop(Client *c);
|
||||
static void propertynotify(XEvent *e);
|
||||
static void quit(const Arg *arg);
|
||||
static Monitor *recttomon(int x, int y, int w, int h);
|
||||
+static void removesystrayicon(Client *i);
|
||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||
+static void resizebarwin(Monitor *m);
|
||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||
static void resizemouse(const Arg *arg);
|
||||
+static void resizerequest(XEvent *e);
|
||||
static void restack(Monitor *m);
|
||||
static void run(void);
|
||||
static void scan(void);
|
||||
-static int sendevent(Client *c, Atom proto);
|
||||
+static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4);
|
||||
static void sendmon(Client *c, Monitor *m);
|
||||
static void setclientstate(Client *c, long state);
|
||||
static void setfocus(Client *c);
|
||||
@@ -205,6 +230,7 @@ static void setup(void);
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void spawn(const Arg *arg);
|
||||
+static Monitor *systraytomon(Monitor *m);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
@@ -222,18 +248,23 @@ static int updategeom(void);
|
||||
static void updatenumlockmask(void);
|
||||
static void updatesizehints(Client *c);
|
||||
static void updatestatus(void);
|
||||
+static void updatesystray(void);
|
||||
+static void updatesystrayicongeom(Client *i, int w, int h);
|
||||
+static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
|
||||
static void updatetitle(Client *c);
|
||||
static void updatewindowtype(Client *c);
|
||||
static void updatewmhints(Client *c);
|
||||
static void view(const Arg *arg);
|
||||
static Client *wintoclient(Window w);
|
||||
static Monitor *wintomon(Window w);
|
||||
+static Client *wintosystrayicon(Window w);
|
||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
+static Systray *systray = NULL;
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
static int screen;
|
||||
@@ -256,9 +287,10 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
[MapRequest] = maprequest,
|
||||
[MotionNotify] = motionnotify,
|
||||
[PropertyNotify] = propertynotify,
|
||||
+ [ResizeRequest] = resizerequest,
|
||||
[UnmapNotify] = unmapnotify
|
||||
};
|
||||
-static Atom wmatom[WMLast], netatom[NetLast];
|
||||
+static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast];
|
||||
static int running = 1;
|
||||
static Cur *cursor[CurLast];
|
||||
static Clr **scheme;
|
||||
@@ -440,7 +472,7 @@ buttonpress(XEvent *e)
|
||||
arg.ui = 1 << i;
|
||||
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
||||
click = ClkLtSymbol;
|
||||
- else if (ev->x > selmon->ww - (int)TEXTW(stext))
|
||||
+ else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth())
|
||||
click = ClkStatusText;
|
||||
else
|
||||
click = ClkWinTitle;
|
||||
@@ -483,6 +515,13 @@ cleanup(void)
|
||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||
while (mons)
|
||||
cleanupmon(mons);
|
||||
+
|
||||
+ if (showsystray) {
|
||||
+ XUnmapWindow(dpy, systray->win);
|
||||
+ XDestroyWindow(dpy, systray->win);
|
||||
+ free(systray);
|
||||
+ }
|
||||
+
|
||||
for (i = 0; i < CurLast; i++)
|
||||
drw_cur_free(drw, cursor[i]);
|
||||
for (i = 0; i < LENGTH(colors); i++)
|
||||
@@ -514,9 +553,58 @@ cleanupmon(Monitor *mon)
|
||||
void
|
||||
clientmessage(XEvent *e)
|
||||
{
|
||||
+ XWindowAttributes wa;
|
||||
+ XSetWindowAttributes swa;
|
||||
XClientMessageEvent *cme = &e->xclient;
|
||||
Client *c = wintoclient(cme->window);
|
||||
|
||||
+ if (showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
|
||||
+ /* add systray icons */
|
||||
+ if (cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) {
|
||||
+ if (!(c = (Client *)calloc(1, sizeof(Client))))
|
||||
+ die("fatal: could not malloc() %u bytes\n", sizeof(Client));
|
||||
+ if (!(c->win = cme->data.l[2])) {
|
||||
+ free(c);
|
||||
+ return;
|
||||
+ }
|
||||
+ c->mon = selmon;
|
||||
+ c->next = systray->icons;
|
||||
+ systray->icons = c;
|
||||
+ if (!XGetWindowAttributes(dpy, c->win, &wa)) {
|
||||
+ /* use sane defaults */
|
||||
+ wa.width = bh;
|
||||
+ wa.height = bh;
|
||||
+ wa.border_width = 0;
|
||||
+ }
|
||||
+ c->x = c->oldx = c->y = c->oldy = 0;
|
||||
+ c->w = c->oldw = wa.width;
|
||||
+ c->h = c->oldh = wa.height;
|
||||
+ c->oldbw = wa.border_width;
|
||||
+ c->bw = 0;
|
||||
+ c->isfloating = True;
|
||||
+ /* reuse tags field as mapped status */
|
||||
+ c->tags = 1;
|
||||
+ updatesizehints(c);
|
||||
+ updatesystrayicongeom(c, wa.width, wa.height);
|
||||
+ XAddToSaveSet(dpy, c->win);
|
||||
+ XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
|
||||
+ XReparentWindow(dpy, c->win, systray->win, 0, 0);
|
||||
+ /* use parents background color */
|
||||
+ swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
||||
+ XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa);
|
||||
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
|
||||
+ /* FIXME not sure if I have to send these events, too */
|
||||
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_FOCUS_IN, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
|
||||
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
|
||||
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_MODALITY_ON, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
|
||||
+ XSync(dpy, False);
|
||||
+ resizebarwin(selmon);
|
||||
+ updatesystray();
|
||||
+ setclientstate(c, NormalState);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (!c)
|
||||
return;
|
||||
if (cme->message_type == netatom[NetWMState]) {
|
||||
@@ -569,7 +657,7 @@ configurenotify(XEvent *e)
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (c->isfullscreen)
|
||||
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||
- XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
|
||||
+ resizebarwin(m);
|
||||
}
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
@@ -654,6 +742,11 @@ destroynotify(XEvent *e)
|
||||
|
||||
if ((c = wintoclient(ev->window)))
|
||||
unmanage(c, 1);
|
||||
+ else if ((c = wintosystrayicon(ev->window))) {
|
||||
+ removesystrayicon(c);
|
||||
+ resizebarwin(selmon);
|
||||
+ updatesystray();
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -697,7 +790,7 @@ dirtomon(int dir)
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
- int x, w, tw = 0;
|
||||
+ int x, w, tw = 0, stw = 0;
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
@@ -706,13 +799,17 @@ drawbar(Monitor *m)
|
||||
if (!m->showbar)
|
||||
return;
|
||||
|
||||
+ if(showsystray && m == systraytomon(m) && !systrayonleft)
|
||||
+ stw = getsystraywidth();
|
||||
+
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
- tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
||||
+ tw = TEXTW(stext) - lrpad / 2 + 2; /* 2px extra right padding */
|
||||
+ drw_text(drw, m->ww - tw - stw, 0, tw, bh, lrpad / 2 - 2, stext, 0);
|
||||
}
|
||||
|
||||
+ resizebarwin(m);
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags;
|
||||
if (c->isurgent)
|
||||
@@ -733,7 +830,7 @@ drawbar(Monitor *m)
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
- if ((w = m->ww - tw - x) > bh) {
|
||||
+ if ((w = m->ww - tw - stw - x) > bh) {
|
||||
if (m->sel) {
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
@@ -744,7 +841,7 @@ drawbar(Monitor *m)
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
}
|
||||
}
|
||||
- drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
+ drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -781,8 +878,11 @@ expose(XEvent *e)
|
||||
Monitor *m;
|
||||
XExposeEvent *ev = &e->xexpose;
|
||||
|
||||
- if (ev->count == 0 && (m = wintomon(ev->window)))
|
||||
+ if (ev->count == 0 && (m = wintomon(ev->window))) {
|
||||
drawbar(m);
|
||||
+ if (m == selmon)
|
||||
+ updatesystray();
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -868,15 +968,32 @@ getatomprop(Client *c, Atom prop)
|
||||
unsigned char *p = NULL;
|
||||
Atom da, atom = None;
|
||||
|
||||
- if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
||||
+ /* FIXME getatomprop should return the number of items and a pointer to
|
||||
+ * the stored data instead of this workaround */
|
||||
+ Atom req = XA_ATOM;
|
||||
+ if (prop == xatom[XembedInfo])
|
||||
+ req = xatom[XembedInfo];
|
||||
+
|
||||
+ if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, req,
|
||||
&da, &di, &nitems, &dl, &p) == Success && p) {
|
||||
- if (nitems > 0)
|
||||
- atom = *(Atom *)p;
|
||||
+ atom = *(Atom *)p;
|
||||
+ if (da == xatom[XembedInfo] && nitems == 2)
|
||||
+ atom = ((Atom *)p)[1];
|
||||
XFree(p);
|
||||
}
|
||||
return atom;
|
||||
}
|
||||
|
||||
+unsigned int
|
||||
+getsystraywidth()
|
||||
+{
|
||||
+ unsigned int w = 0;
|
||||
+ Client *i;
|
||||
+ if(showsystray)
|
||||
+ for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ;
|
||||
+ return w ? w + systrayspacing : 1;
|
||||
+}
|
||||
+
|
||||
int
|
||||
getrootptr(int *x, int *y)
|
||||
{
|
||||
@@ -1017,7 +1134,8 @@ killclient(const Arg *arg)
|
||||
{
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
- if (!sendevent(selmon->sel, wmatom[WMDelete])) {
|
||||
+
|
||||
+ if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0 , 0, 0)) {
|
||||
XGrabServer(dpy);
|
||||
XSetErrorHandler(xerrordummy);
|
||||
XSetCloseDownMode(dpy, DestroyAll);
|
||||
@@ -1104,6 +1222,13 @@ maprequest(XEvent *e)
|
||||
static XWindowAttributes wa;
|
||||
XMapRequestEvent *ev = &e->xmaprequest;
|
||||
|
||||
+ Client *i;
|
||||
+ if ((i = wintosystrayicon(ev->window))) {
|
||||
+ sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
|
||||
+ resizebarwin(selmon);
|
||||
+ updatesystray();
|
||||
+ }
|
||||
+
|
||||
if (!XGetWindowAttributes(dpy, ev->window, &wa) || wa.override_redirect)
|
||||
return;
|
||||
if (!wintoclient(ev->window))
|
||||
@@ -1225,6 +1350,17 @@ propertynotify(XEvent *e)
|
||||
Window trans;
|
||||
XPropertyEvent *ev = &e->xproperty;
|
||||
|
||||
+ if ((c = wintosystrayicon(ev->window))) {
|
||||
+ if (ev->atom == XA_WM_NORMAL_HINTS) {
|
||||
+ updatesizehints(c);
|
||||
+ updatesystrayicongeom(c, c->w, c->h);
|
||||
+ }
|
||||
+ else
|
||||
+ updatesystrayiconstate(c, ev);
|
||||
+ resizebarwin(selmon);
|
||||
+ updatesystray();
|
||||
+ }
|
||||
+
|
||||
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
|
||||
updatestatus();
|
||||
else if (ev->state == PropertyDelete)
|
||||
@@ -1275,6 +1411,19 @@ recttomon(int x, int y, int w, int h)
|
||||
return r;
|
||||
}
|
||||
|
||||
+void
|
||||
+removesystrayicon(Client *i)
|
||||
+{
|
||||
+ Client **ii;
|
||||
+
|
||||
+ if (!showsystray || !i)
|
||||
+ return;
|
||||
+ for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
|
||||
+ if (ii)
|
||||
+ *ii = i->next;
|
||||
+ free(i);
|
||||
+}
|
||||
+
|
||||
void
|
||||
resize(Client *c, int x, int y, int w, int h, int interact)
|
||||
{
|
||||
@@ -1282,6 +1431,14 @@ resize(Client *c, int x, int y, int w, int h, int interact)
|
||||
resizeclient(c, x, y, w, h);
|
||||
}
|
||||
|
||||
+void
|
||||
+resizebarwin(Monitor *m) {
|
||||
+ unsigned int w = m->ww;
|
||||
+ if (showsystray && m == systraytomon(m) && !systrayonleft)
|
||||
+ w -= getsystraywidth();
|
||||
+ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
|
||||
+}
|
||||
+
|
||||
void
|
||||
resizeclient(Client *c, int x, int y, int w, int h)
|
||||
{
|
||||
@@ -1297,6 +1454,19 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
+void
|
||||
+resizerequest(XEvent *e)
|
||||
+{
|
||||
+ XResizeRequestEvent *ev = &e->xresizerequest;
|
||||
+ Client *i;
|
||||
+
|
||||
+ if ((i = wintosystrayicon(ev->window))) {
|
||||
+ updatesystrayicongeom(i, ev->width, ev->height);
|
||||
+ resizebarwin(selmon);
|
||||
+ updatesystray();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
resizemouse(const Arg *arg)
|
||||
{
|
||||
@@ -1443,26 +1613,37 @@ setclientstate(Client *c, long state)
|
||||
}
|
||||
|
||||
int
|
||||
-sendevent(Client *c, Atom proto)
|
||||
+sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4)
|
||||
{
|
||||
int n;
|
||||
- Atom *protocols;
|
||||
+ Atom *protocols, mt;
|
||||
int exists = 0;
|
||||
XEvent ev;
|
||||
|
||||
- if (XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
||||
- while (!exists && n--)
|
||||
- exists = protocols[n] == proto;
|
||||
- XFree(protocols);
|
||||
+ if (proto == wmatom[WMTakeFocus] || proto == wmatom[WMDelete]) {
|
||||
+ mt = wmatom[WMProtocols];
|
||||
+ if (XGetWMProtocols(dpy, w, &protocols, &n)) {
|
||||
+ while (!exists && n--)
|
||||
+ exists = protocols[n] == proto;
|
||||
+ XFree(protocols);
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ exists = True;
|
||||
+ mt = proto;
|
||||
}
|
||||
+
|
||||
if (exists) {
|
||||
ev.type = ClientMessage;
|
||||
- ev.xclient.window = c->win;
|
||||
- ev.xclient.message_type = wmatom[WMProtocols];
|
||||
+ ev.xclient.window = w;
|
||||
+ ev.xclient.message_type = mt;
|
||||
ev.xclient.format = 32;
|
||||
- ev.xclient.data.l[0] = proto;
|
||||
- ev.xclient.data.l[1] = CurrentTime;
|
||||
- XSendEvent(dpy, c->win, False, NoEventMask, &ev);
|
||||
+ ev.xclient.data.l[0] = d0;
|
||||
+ ev.xclient.data.l[1] = d1;
|
||||
+ ev.xclient.data.l[2] = d2;
|
||||
+ ev.xclient.data.l[3] = d3;
|
||||
+ ev.xclient.data.l[4] = d4;
|
||||
+ XSendEvent(dpy, w, False, mask, &ev);
|
||||
}
|
||||
return exists;
|
||||
}
|
||||
@@ -1476,7 +1657,7 @@ setfocus(Client *c)
|
||||
XA_WINDOW, 32, PropModeReplace,
|
||||
(unsigned char *) &(c->win), 1);
|
||||
}
|
||||
- sendevent(c, wmatom[WMTakeFocus]);
|
||||
+ sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1572,6 +1753,10 @@ setup(void)
|
||||
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
|
||||
netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
|
||||
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
||||
+ netatom[NetSystemTray] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_S0", False);
|
||||
+ netatom[NetSystemTrayOP] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_OPCODE", False);
|
||||
+ netatom[NetSystemTrayOrientation] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION", False);
|
||||
+ netatom[NetSystemTrayOrientationHorz] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION_HORZ", False);
|
||||
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
|
||||
netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
|
||||
netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
@@ -1579,6 +1764,9 @@ setup(void)
|
||||
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
||||
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
|
||||
+ xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
|
||||
+ xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
|
||||
+ xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
|
||||
/* init cursors */
|
||||
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
|
||||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||
@@ -1587,6 +1775,8 @@ setup(void)
|
||||
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
||||
for (i = 0; i < LENGTH(colors); i++)
|
||||
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
||||
+ /* init system tray */
|
||||
+ updatesystray();
|
||||
/* init bars */
|
||||
updatebars();
|
||||
updatestatus();
|
||||
@@ -1717,7 +1907,18 @@ togglebar(const Arg *arg)
|
||||
{
|
||||
selmon->showbar = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||
+ resizebarwin(selmon);
|
||||
+ if (showsystray) {
|
||||
+ XWindowChanges wc;
|
||||
+ if (!selmon->showbar)
|
||||
+ wc.y = -bh;
|
||||
+ else if (selmon->showbar) {
|
||||
+ wc.y = 0;
|
||||
+ if (!selmon->topbar)
|
||||
+ wc.y = selmon->mh - bh;
|
||||
+ }
|
||||
+ XConfigureWindow(dpy, systray->win, CWY, &wc);
|
||||
+ }
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -1813,11 +2014,18 @@ unmapnotify(XEvent *e)
|
||||
else
|
||||
unmanage(c, 0);
|
||||
}
|
||||
+ else if ((c = wintosystrayicon(ev->window))) {
|
||||
+ /* KLUDGE! sometimes icons occasionally unmap their windows, but do
|
||||
+ * _not_ destroy them. We map those windows back */
|
||||
+ XMapRaised(dpy, c->win);
|
||||
+ updatesystray();
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
updatebars(void)
|
||||
{
|
||||
+ unsigned int w;
|
||||
Monitor *m;
|
||||
XSetWindowAttributes wa = {
|
||||
.override_redirect = True,
|
||||
@@ -1828,10 +2036,15 @@ updatebars(void)
|
||||
for (m = mons; m; m = m->next) {
|
||||
if (m->barwin)
|
||||
continue;
|
||||
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
|
||||
+ w = m->ww;
|
||||
+ if (showsystray && m == systraytomon(m))
|
||||
+ w -= getsystraywidth();
|
||||
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
|
||||
CopyFromParent, DefaultVisual(dpy, screen),
|
||||
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
||||
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||
+ if (showsystray && m == systraytomon(m))
|
||||
+ XMapRaised(dpy, systray->win);
|
||||
XMapRaised(dpy, m->barwin);
|
||||
XSetClassHint(dpy, m->barwin, &ch);
|
||||
}
|
||||
@@ -2008,6 +2221,125 @@ updatestatus(void)
|
||||
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||
strcpy(stext, "dwm-"VERSION);
|
||||
drawbar(selmon);
|
||||
+ updatesystray();
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void
|
||||
+updatesystrayicongeom(Client *i, int w, int h)
|
||||
+{
|
||||
+ if (i) {
|
||||
+ i->h = bh;
|
||||
+ if (w == h)
|
||||
+ i->w = bh;
|
||||
+ else if (h == bh)
|
||||
+ i->w = w;
|
||||
+ else
|
||||
+ i->w = (int) ((float)bh * ((float)w / (float)h));
|
||||
+ applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False);
|
||||
+ /* force icons into the systray dimensions if they don't want to */
|
||||
+ if (i->h > bh) {
|
||||
+ if (i->w == i->h)
|
||||
+ i->w = bh;
|
||||
+ else
|
||||
+ i->w = (int) ((float)bh * ((float)i->w / (float)i->h));
|
||||
+ i->h = bh;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+updatesystrayiconstate(Client *i, XPropertyEvent *ev)
|
||||
+{
|
||||
+ long flags;
|
||||
+ int code = 0;
|
||||
+
|
||||
+ if (!showsystray || !i || ev->atom != xatom[XembedInfo] ||
|
||||
+ !(flags = getatomprop(i, xatom[XembedInfo])))
|
||||
+ return;
|
||||
+
|
||||
+ if (flags & XEMBED_MAPPED && !i->tags) {
|
||||
+ i->tags = 1;
|
||||
+ code = XEMBED_WINDOW_ACTIVATE;
|
||||
+ XMapRaised(dpy, i->win);
|
||||
+ setclientstate(i, NormalState);
|
||||
+ }
|
||||
+ else if (!(flags & XEMBED_MAPPED) && i->tags) {
|
||||
+ i->tags = 0;
|
||||
+ code = XEMBED_WINDOW_DEACTIVATE;
|
||||
+ XUnmapWindow(dpy, i->win);
|
||||
+ setclientstate(i, WithdrawnState);
|
||||
+ }
|
||||
+ else
|
||||
+ return;
|
||||
+ sendevent(i->win, xatom[Xembed], StructureNotifyMask, CurrentTime, code, 0,
|
||||
+ systray->win, XEMBED_EMBEDDED_VERSION);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+updatesystray(void)
|
||||
+{
|
||||
+ XSetWindowAttributes wa;
|
||||
+ XWindowChanges wc;
|
||||
+ Client *i;
|
||||
+ Monitor *m = systraytomon(NULL);
|
||||
+ unsigned int x = m->mx + m->mw;
|
||||
+ unsigned int sw = TEXTW(stext) - lrpad + systrayspacing;
|
||||
+ unsigned int w = 1;
|
||||
+
|
||||
+ if (!showsystray)
|
||||
+ return;
|
||||
+ if (systrayonleft)
|
||||
+ x -= sw + lrpad / 2;
|
||||
+ if (!systray) {
|
||||
+ /* init systray */
|
||||
+ if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
|
||||
+ die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
|
||||
+ systray->win = XCreateSimpleWindow(dpy, root, x, m->by, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel);
|
||||
+ wa.event_mask = ButtonPressMask | ExposureMask;
|
||||
+ wa.override_redirect = True;
|
||||
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
||||
+ XSelectInput(dpy, systray->win, SubstructureNotifyMask);
|
||||
+ XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
|
||||
+ PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1);
|
||||
+ XChangeWindowAttributes(dpy, systray->win, CWEventMask|CWOverrideRedirect|CWBackPixel, &wa);
|
||||
+ XMapRaised(dpy, systray->win);
|
||||
+ XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime);
|
||||
+ if (XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) {
|
||||
+ sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0);
|
||||
+ XSync(dpy, False);
|
||||
+ }
|
||||
+ else {
|
||||
+ fprintf(stderr, "dwm: unable to obtain system tray.\n");
|
||||
+ free(systray);
|
||||
+ systray = NULL;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ for (w = 0, i = systray->icons; i; i = i->next) {
|
||||
+ /* make sure the background color stays the same */
|
||||
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
||||
+ XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
|
||||
+ XMapRaised(dpy, i->win);
|
||||
+ w += systrayspacing;
|
||||
+ i->x = w;
|
||||
+ XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
|
||||
+ w += i->w;
|
||||
+ if (i->mon != m)
|
||||
+ i->mon = m;
|
||||
+ }
|
||||
+ w = w ? w + systrayspacing : 1;
|
||||
+ x -= w;
|
||||
+ XMoveResizeWindow(dpy, systray->win, x, m->by, w, bh);
|
||||
+ wc.x = x; wc.y = m->by; wc.width = w; wc.height = bh;
|
||||
+ wc.stack_mode = Above; wc.sibling = m->barwin;
|
||||
+ XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);
|
||||
+ XMapWindow(dpy, systray->win);
|
||||
+ XMapSubwindows(dpy, systray->win);
|
||||
+ /* redraw background */
|
||||
+ XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
|
||||
+ XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
|
||||
+ XSync(dpy, False);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2075,6 +2407,16 @@ wintoclient(Window w)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+Client *
|
||||
+wintosystrayicon(Window w) {
|
||||
+ Client *i = NULL;
|
||||
+
|
||||
+ if (!showsystray || !w)
|
||||
+ return i;
|
||||
+ for (i = systray->icons; i && i->win != w; i = i->next) ;
|
||||
+ return i;
|
||||
+}
|
||||
+
|
||||
Monitor *
|
||||
wintomon(Window w)
|
||||
{
|
||||
@@ -2128,6 +2470,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+Monitor *
|
||||
+systraytomon(Monitor *m) {
|
||||
+ Monitor *t;
|
||||
+ int i, n;
|
||||
+ if(!systraypinning) {
|
||||
+ if(!m)
|
||||
+ return selmon;
|
||||
+ return m == selmon ? m : NULL;
|
||||
+ }
|
||||
+ for(n = 1, t = mons; t && t->next; n++, t = t->next) ;
|
||||
+ for(i = 1, t = mons; t && t->next && i < systraypinning; i++, t = t->next) ;
|
||||
+ if(systraypinningfailfirst && n < systraypinning)
|
||||
+ return mons;
|
||||
+ return t;
|
||||
+}
|
||||
+
|
||||
void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
101
dwm-uselessgap-20211119-58414bee958f2.diff
Normal file
101
dwm-uselessgap-20211119-58414bee958f2.diff
Normal file
@ -0,0 +1,101 @@
|
||||
From 58414bee958f2e7ed91d6fe31f503ec4a406981b Mon Sep 17 00:00:00 2001
|
||||
From: cirala <thim@cederlund.de>
|
||||
Date: Fri, 19 Nov 2021 18:14:07 +0100
|
||||
Subject: [PATCH] Fix for dwm-uselessgap
|
||||
Previous versions of the patch doubles the
|
||||
gap between the master and slave stacks.
|
||||
|
||||
---
|
||||
config.def.h | 3 ++-
|
||||
dwm.c | 38 +++++++++++++++++++++++++++++++-------
|
||||
2 files changed, 33 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a2ac963..17a205f 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const unsigned int gappx = 6; /* gaps between windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
@@ -34,7 +35,7 @@ static const Rule rules[] = {
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
-static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
+static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 5e4d494..b626e89 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -52,8 +52,8 @@
|
||||
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||
-#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||
-#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
||||
+#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
|
||||
+#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
|
||||
@@ -1277,12 +1277,36 @@ void
|
||||
resizeclient(Client *c, int x, int y, int w, int h)
|
||||
{
|
||||
XWindowChanges wc;
|
||||
+ unsigned int n;
|
||||
+ unsigned int gapoffset;
|
||||
+ unsigned int gapincr;
|
||||
+ Client *nbc;
|
||||
|
||||
- c->oldx = c->x; c->x = wc.x = x;
|
||||
- c->oldy = c->y; c->y = wc.y = y;
|
||||
- c->oldw = c->w; c->w = wc.width = w;
|
||||
- c->oldh = c->h; c->h = wc.height = h;
|
||||
wc.border_width = c->bw;
|
||||
+
|
||||
+ /* Get number of clients for the client's monitor */
|
||||
+ for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++);
|
||||
+
|
||||
+ /* Do nothing if layout is floating */
|
||||
+ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) {
|
||||
+ gapincr = gapoffset = 0;
|
||||
+ } else {
|
||||
+ /* Remove border and gap if layout is monocle or only one client */
|
||||
+ if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) {
|
||||
+ gapoffset = 0;
|
||||
+ gapincr = -2 * borderpx;
|
||||
+ wc.border_width = 0;
|
||||
+ } else {
|
||||
+ gapoffset = gappx;
|
||||
+ gapincr = 2 * gappx;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ c->oldx = c->x; c->x = wc.x = x + gapoffset;
|
||||
+ c->oldy = c->y; c->y = wc.y = y + gapoffset;
|
||||
+ c->oldw = c->w; c->w = wc.width = w - gapincr;
|
||||
+ c->oldh = c->h; c->h = wc.height = h - gapincr;
|
||||
+
|
||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||
configure(c);
|
||||
XSync(dpy, False);
|
||||
@@ -1688,7 +1712,7 @@ tile(Monitor *m)
|
||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
+ resize(c, m->wx, m->wy + my, mw - (2*c->bw) + (n > 1 ? gappx : 0), h - (2*c->bw), 0);
|
||||
if (my + HEIGHT(c) < m->wh)
|
||||
my += HEIGHT(c);
|
||||
} else {
|
||||
--
|
||||
2.33.1
|
||||
|
||||
10
dwm.1
10
dwm.1
@ -142,6 +142,9 @@ Add/remove all windows with nth tag to/from the view.
|
||||
.TP
|
||||
.B Mod1\-Shift\-q
|
||||
Quit dwm.
|
||||
.TP
|
||||
.B Mod1\-Control\-Shift\-q
|
||||
Restart dwm.
|
||||
.SS Mouse commands
|
||||
.TP
|
||||
.B Mod1\-Button1
|
||||
@ -155,6 +158,13 @@ Resize focused window while dragging. Tiled windows will be toggled to the float
|
||||
.SH CUSTOMIZATION
|
||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||
code. This keeps it fast, secure and simple.
|
||||
.SH SIGNALS
|
||||
.TP
|
||||
.B SIGHUP - 1
|
||||
Restart the dwm process.
|
||||
.TP
|
||||
.B SIGTERM - 15
|
||||
Cleanly terminate the dwm process.
|
||||
.SH SEE ALSO
|
||||
.BR dmenu (1),
|
||||
.BR st (1)
|
||||
|
||||
49
movestack.c
Normal file
49
movestack.c
Normal file
@ -0,0 +1,49 @@
|
||||
void
|
||||
movestack(const Arg *arg) {
|
||||
Client *c = NULL, *p = NULL, *pc = NULL, *i;
|
||||
|
||||
if(arg->i > 0) {
|
||||
/* find the client after selmon->sel */
|
||||
for(c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
||||
if(!c)
|
||||
for(c = selmon->clients; c && (!ISVISIBLE(c) || c->isfloating); c = c->next);
|
||||
|
||||
}
|
||||
else {
|
||||
/* find the client before selmon->sel */
|
||||
for(i = selmon->clients; i != selmon->sel; i = i->next)
|
||||
if(ISVISIBLE(i) && !i->isfloating)
|
||||
c = i;
|
||||
if(!c)
|
||||
for(; i; i = i->next)
|
||||
if(ISVISIBLE(i) && !i->isfloating)
|
||||
c = i;
|
||||
}
|
||||
/* find the client before selmon->sel and c */
|
||||
for(i = selmon->clients; i && (!p || !pc); i = i->next) {
|
||||
if(i->next == selmon->sel)
|
||||
p = i;
|
||||
if(i->next == c)
|
||||
pc = i;
|
||||
}
|
||||
|
||||
/* swap c and selmon->sel selmon->clients in the selmon->clients list */
|
||||
if(c && c != selmon->sel) {
|
||||
Client *temp = selmon->sel->next==c?selmon->sel:selmon->sel->next;
|
||||
selmon->sel->next = c->next==selmon->sel?c:c->next;
|
||||
c->next = temp;
|
||||
|
||||
if(p && p != c)
|
||||
p->next = c;
|
||||
if(pc && pc != selmon->sel)
|
||||
pc->next = selmon->sel;
|
||||
|
||||
if(selmon->sel == selmon->clients)
|
||||
selmon->clients = c;
|
||||
else if(c == selmon->clients)
|
||||
selmon->clients = selmon->sel;
|
||||
|
||||
arrange(selmon);
|
||||
}
|
||||
}
|
||||
|
||||
135
shift-tools.c
Normal file
135
shift-tools.c
Normal file
@ -0,0 +1,135 @@
|
||||
/* Sends a window to the next/prev tag */
|
||||
void
|
||||
shifttag(const Arg *arg)
|
||||
{
|
||||
Arg shifted;
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
|
||||
|
||||
if (arg->i > 0) /* left circular shift */
|
||||
shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i)));
|
||||
else /* right circular shift */
|
||||
shifted.ui = (shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i));
|
||||
tag(&shifted);
|
||||
}
|
||||
/* Sends a window to the next/prev tag that has a client, else it moves it to the next/prev one. */
|
||||
void
|
||||
shifttagclients(const Arg *arg)
|
||||
{
|
||||
|
||||
Arg shifted;
|
||||
Client *c;
|
||||
unsigned int tagmask = 0;
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
if (!(c->tags))
|
||||
tagmask = tagmask | c->tags;
|
||||
|
||||
|
||||
if (arg->i > 0) /* left circular shift */
|
||||
do {
|
||||
shifted.ui = (shifted.ui << arg->i)
|
||||
| (shifted.ui >> (LENGTH(tags) - arg->i));
|
||||
} while (tagmask && !(shifted.ui & tagmask));
|
||||
else /* right circular shift */
|
||||
do {
|
||||
shifted.ui = (shifted.ui >> (- arg->i)
|
||||
| shifted.ui << (LENGTH(tags) + arg->i));
|
||||
} while (tagmask && !(shifted.ui & tagmask));
|
||||
tag(&shifted);
|
||||
}
|
||||
/* Navigate to the next/prev tag */
|
||||
void
|
||||
shiftview(const Arg *arg)
|
||||
{
|
||||
Arg shifted;
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
|
||||
if (arg->i > 0) /* left circular shift */
|
||||
shifted.ui = (shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i));
|
||||
else /* right circular shift */
|
||||
shifted.ui = (shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i));
|
||||
view(&shifted);
|
||||
}
|
||||
/* Navigate to the next/prev tag that has a client, else moves it to the next/prev tag */
|
||||
void
|
||||
shiftviewclients(const Arg *arg)
|
||||
{
|
||||
Arg shifted;
|
||||
Client *c;
|
||||
unsigned int tagmask = 0;
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
if (!(c->tags))
|
||||
tagmask = tagmask | c->tags;
|
||||
|
||||
|
||||
if (arg->i > 0) /* left circular shift */
|
||||
do {
|
||||
shifted.ui = (shifted.ui << arg->i)
|
||||
| (shifted.ui >> (LENGTH(tags) - arg->i));
|
||||
} while (tagmask && !(shifted.ui & tagmask));
|
||||
else /* right circular shift */
|
||||
do {
|
||||
shifted.ui = (shifted.ui >> (- arg->i)
|
||||
| shifted.ui << (LENGTH(tags) + arg->i));
|
||||
} while (tagmask && !(shifted.ui & tagmask));
|
||||
view(&shifted);
|
||||
}
|
||||
/* move the current active window to the next/prev tag and view it. More like following the window */
|
||||
void
|
||||
shiftboth(const Arg *arg)
|
||||
{
|
||||
Arg shifted;
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
|
||||
if (arg->i > 0) /* left circular shift */
|
||||
shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i)));
|
||||
else /* right circular shift */
|
||||
shifted.ui = ((shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i)));
|
||||
tag(&shifted);
|
||||
view(&shifted);
|
||||
}
|
||||
//helper function for shiftswaptags.
|
||||
//see: https://github.com/moizifty/DWM-Build/blob/65379c62640788881486401a0d8c79333751b02f/config.h#L48
|
||||
void
|
||||
swaptags(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
unsigned int newtag = arg->ui & TAGMASK;
|
||||
unsigned int curtag = selmon->tagset[selmon->seltags];
|
||||
|
||||
if (newtag == curtag || !curtag || (curtag & (curtag-1)))
|
||||
return;
|
||||
|
||||
for (c = selmon->clients; c != NULL; c = c->next) {
|
||||
if ((c->tags & newtag) || (c->tags & curtag))
|
||||
c->tags ^= curtag ^ newtag;
|
||||
|
||||
if (!c->tags)
|
||||
c->tags = newtag;
|
||||
}
|
||||
|
||||
//move to the swaped tag
|
||||
//selmon->tagset[selmon->seltags] = newtag;
|
||||
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
/* swaps "tags" (all the clients) with the next/prev tag. */
|
||||
void
|
||||
shiftswaptags(const Arg *arg)
|
||||
{
|
||||
Arg shifted;
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
|
||||
if (arg->i > 0) /* left circular shift */
|
||||
shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i)));
|
||||
else /* right circular shift */
|
||||
shifted.ui = ((shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i)));
|
||||
swaptags(&shifted);
|
||||
// uncomment if you also want to "go" (view) the tag where the the clients are going
|
||||
//view(&shifted);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user