From b07674dc03506126b26209689a0fff6efcdc3fcc Mon Sep 17 00:00:00 2001 From: ZachIR Date: Sun, 13 Sep 2020 22:37:45 -0500 Subject: Update repo to 09132020 --- config.def.h | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 87 insertions(+), 4 deletions(-) (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index 1c0b587..70c180b 100644 --- a/config.def.h +++ b/config.def.h @@ -2,7 +2,13 @@ /* 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 unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ +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 swallowfloating = 0; /* 1 means swallow floating windows by default */ 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" }; @@ -26,15 +32,18 @@ static const Rule rules[] = { * 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 }, + /* class instance title tags mask isfloating isterminal noswallow monitor */ + { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, + { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, + { "st", NULL, NULL, 0, 0, 1, -1, -1 }, + { NULL, NULL, "Event Tester", 0, 1, 0, 1, -1 }, /* xev */ }; /* 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 int attachbelow = 1; /* 1 means attach after the currently active window */ static const Layout layouts[] = { /* symbol arrange function */ @@ -78,6 +87,7 @@ static Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, @@ -94,6 +104,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 */ @@ -103,7 +114,9 @@ static 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, sigdwmblocks, {.i = 1} }, + { ClkStatusText, 0, Button2, sigdwmblocks, {.i = 2} }, + { ClkStatusText, 0, Button3, sigdwmblocks, {.i = 3} }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, @@ -113,3 +126,73 @@ static Button buttons[] = { { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; +void +setlayoutex(const Arg *arg) +{ + setlayout(&((Arg) { .v = &layouts[arg->i] })); +} + +void +viewex(const Arg *arg) +{ + view(&((Arg) { .ui = 1 << arg->ui })); +} + +void +viewall(const Arg *arg) +{ + view(&((Arg){.ui = ~0})); +} + +void +toggleviewex(const Arg *arg) +{ + toggleview(&((Arg) { .ui = 1 << arg->ui })); +} + +void +tagex(const Arg *arg) +{ + tag(&((Arg) { .ui = 1 << arg->ui })); +} + +void +toggletagex(const Arg *arg) +{ + toggletag(&((Arg) { .ui = 1 << arg->ui })); +} + +void +tagall(const Arg *arg) +{ + tag(&((Arg){.ui = ~0})); +} + +/* signal definitions */ +/* signum must be greater than 0 */ +/* trigger signals using `xsetroot -name "fsignal: [ ]"` */ +static Signal signals[] = { + /* signum function */ + { "focusstack", focusstack }, + { "setmfact", setmfact }, + { "togglebar", togglebar }, + { "incnmaster", incnmaster }, + { "togglefloating", togglefloating }, + { "focusmon", focusmon }, + { "tagmon", tagmon }, + { "zoom", zoom }, + { "view", view }, + { "viewall", viewall }, + { "viewex", viewex }, + { "toggleview", view }, + { "toggleviewex", toggleviewex }, + { "tag", tag }, + { "tagall", tagall }, + { "tagex", tagex }, + { "toggletag", tag }, + { "toggletagex", toggletagex }, + { "killclient", killclient }, + { "quit", quit }, + { "setlayout", setlayout }, + { "setlayoutex", setlayoutex }, +}; -- cgit v1.2.3 From 6b84649570e7cce23bbbe4436cdbbc8c39dc1cb2 Mon Sep 17 00:00:00 2001 From: zachir Date: Wed, 11 Nov 2020 19:11:36 -0600 Subject: Update to latest config --- Makefile | 4 +- config.def.h | 3 + config.h | 28 ++-- dwm.1 | 223 ++++++++++++++++++++++++------- dwm.c | 34 ++++- patches/dwm-cfacts-20200913-61bb8b2.diff | 117 ++++++++++++++++ volsv | 21 +++ 7 files changed, 373 insertions(+), 57 deletions(-) create mode 100644 patches/dwm-cfacts-20200913-61bb8b2.diff create mode 100755 volsv (limited to 'config.def.h') diff --git a/Makefile b/Makefile index f837f5c..1e95356 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ dist: clean install: all mkdir -p ${DESTDIR}${PREFIX}/bin - cp -f dwm dwmc ${DESTDIR}${PREFIX}/bin + cp -f dwm dwmc volsv ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/dwm mkdir -p ${DESTDIR}${MANPREFIX}/man1 sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 @@ -46,6 +46,8 @@ install: all uninstall: rm -f ${DESTDIR}${PREFIX}/bin/dwm\ + ${DESTDIR}${PREFIX}/bin/dwmc\ + ${DESTDIR}${PREFIX}/bin/volsv\ ${DESTDIR}${MANPREFIX}/man1/dwm.1 .PHONY: all options clean dist install uninstall diff --git a/config.def.h b/config.def.h index 70c180b..8bfef3e 100644 --- a/config.def.h +++ b/config.def.h @@ -79,6 +79,9 @@ 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_h, setcfact, {.f = +0.25} }, + { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} }, + { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} }, { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, { MODKEY|ShiftMask, XK_c, killclient, {0} }, diff --git a/config.h b/config.h index 252ab4d..026cadb 100644 --- a/config.h +++ b/config.h @@ -19,7 +19,7 @@ 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 col_cyan[] = "#750000"; static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, @@ -40,7 +40,10 @@ static const Rule rules[] = { { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, { "Firefox", NULL, NULL, 1 << 8, 0, 0, 1, -1 }, { "st-256color",NULL, NULL, 0, 0, 1, 1, -1 }, - { "tabbed", NULL, NULL, 0, 0, 1, 0, -1 }, + { "st", NULL, NULL, 0, 0, 1, 1, -1 }, + { "St", NULL, NULL, 0, 0, 1, 1, -1 }, + { "tabbed", NULL, NULL, 0, 0, 1, 0, -1 }, + { NULL, NULL, "abduco", 0, 0, 1, 0, -1 }, { "Alacritty", NULL, NULL, 0, 0, 1, 0, -1 }, { "Blueman", NULL, NULL, 0, 1, 0, 0, -1 }, { "QjackCtl", NULL, NULL, 0, 1, 0, 0, -1 }, @@ -50,6 +53,7 @@ static const Rule rules[] = { { NULL, NULL, "Event Tester", 0, 1, 0, 1, -1 }, /* xev */ { "Steam", NULL, NULL, 4, 0, 0, 0, -1 }, { "steam", NULL, NULL, 4, 0, 0, 0, -1 }, + { NULL, NULL, "steam", 4, 0, 0, 0, -1 }, { "Lutris", NULL, NULL, 2, 0, 0, 0, -1 }, { "lutris", NULL, NULL, 2, 0, 0, 0, -1 }, }; @@ -82,8 +86,8 @@ 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 *passmenu[] = { "passmenu", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -//static const char *termcmd[] = { "tabbed", "-c", "st", "-w", NULL }; static const char *termcmd[] = { "tabbed", "-c", "st", "-w", NULL }; +//static const char *termcmd[] = { "dmenuabduco", NULL }; static const char *mpdtoggle[] = { "playerctl", "--player=mpd,mpv,%any", "play-pause", NULL }; static const char *mpdnext[] = { "playerctl", "--player=mpd,mpv,%any", "next", NULL }; static const char *mpdprev[] = { "playerctl", "--player=mpd,mpv,%any", "previous", NULL }; @@ -96,14 +100,16 @@ static const char *audioup[] = { "volsv", "-i", NULL }; static const char *audiodown[] = { "volsv", "-d", NULL }; static const char *audiomute[] = { "volsv", "-t", NULL }; static const char *micmute[] = { "pamixer", "--source", "1", "-t", NULL }; -static const char *lockscr[] = { "i3lock-fancy", NULL }; +static const char *lockscr[] = { "xautolock", "-locknow", NULL }; static const char *xidletog[] = { "xidletog", NULL }; +static const char *xkillcmd[] = { "xkill", NULL }; static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_d, spawn, {.v = dmenucmd } }, { MODKEY, XK_p, spawn, {.v = passmenu } }, { MODKEY, XK_c, spawn, {.v = xidletog } }, + { MODKEY, XK_x, spawn, {.v = xkillcmd } }, { MODKEY, XK_Return, spawn, {.v = termcmd } }, { 0, XF86XK_AudioPlay, spawn, {.v = mpdtoggle } }, { 0, XF86XK_AudioNext, spawn, {.v = mpdnext } }, @@ -119,22 +125,28 @@ static Key keys[] = { { 0, XF86XK_AudioMicMute, spawn, {.v = micmute } }, { Mod4Mask, XK_l, spawn, {.v = lockscr } }, { MODKEY, XK_b, togglebar, {0} }, - { MODKEY|ShiftMask, XK_j, pushdown, {.i = +1 } }, - { MODKEY|ShiftMask, XK_k, pushup, {.i = -1 } }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY|ShiftMask, XK_j, pushdown, {.i = +1 } }, + { MODKEY|ShiftMask, XK_k, pushup, {.i = -1 } }, + { MODKEY|ControlMask, XK_j, setcfact, {.f = +0.25} }, + { MODKEY|ControlMask, XK_k, setcfact, {.f = -0.25} }, + { MODKEY|ControlMask, XK_o, setcfact, {.f = 0.00} }, { MODKEY, XK_comma, incnmaster, {.i = +1 } }, { MODKEY, XK_period, incnmaster, {.i = -1 } }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} }, + { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} }, + { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} }, { MODKEY|ShiftMask, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, { MODKEY|ShiftMask, XK_q, killclient, {0} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_s, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY|ShiftMask, XK_space, setlayout, {-1} }, + { MODKEY, XK_space, togglefloating, {0} }, { MODKEY, XK_f, togglefullscr, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, diff --git a/dwm.1 b/dwm.1 index bf742fd..a9f276c 100644 --- a/dwm.1 +++ b/dwm.1 @@ -12,10 +12,11 @@ environment for the application in use and the task performed. In tiled layouts windows are managed in a master and stacking area. The master area on the left contains one window by default, and the stacking area on the right contains all other windows. The number of master area windows can be -adjusted from zero to an arbitrary number. In monocle layout all windows are -maximised to the screen size. In floating layout windows can be resized and -moved freely. Dialog windows are always managed floating, regardless of the -layout applied. +adjusted from zero to an arbitrary number. Windows in both the master and stack +can be resized vertically, as well as resizing the master area. In monocle +layout all windows are maximised to the screen size. In floating layout windows +can be resized and moved freely. Dialog windows are always managed floating, +regardless of the layout applied. .P Windows are grouped by tags. Each window can be tagged with one or multiple tags. Selecting certain tags displays all windows with these tags. @@ -24,10 +25,10 @@ Each screen contains a small status bar which displays all available tags, the layout, the title of the focused window, and the text read from the root window name property, if the screen is focused. A floating window is indicated with an empty square and a maximised floating window is indicated with a filled square -before the windows title. The selected tags are indicated with a different -color. The tags of the focused window are indicated with a filled square in the -top left corner. The tags which are applied to one or more windows are -indicated with an empty square in the top left corner. +before the window's title. The selected tags are indicated with a different +color. The focused window is represented by a long line before the tags which +are applied to it, and all other windows are represented by dots for all their +corresponding tags. .P The attach below patch makes newly spawned windows attach after the currently selected window @@ -59,41 +60,107 @@ click on a tag label applies that tag to the focused window. click on a tag label adds/removes that tag to/from the focused window. .SS Keyboard commands .TP -.B Mod1\-Shift\-Return +.B Mod1\-Return Start +.BR tabbed(1) +Running .BR st(1). .TP .B Mod1\-p +Spawn passmenu. +.TP +.B Mod1\-d Spawn .BR dmenu(1) for launching other programs. .TP -.B Mod1\-, -Focus previous screen, if any. +.B Mod1\-c +Spawn xidletog to change caffeine/xautolock state. .TP -.B Mod1\-. -Focus next screen, if any. +.B Mod1\-x +Spawn +.BR xkill(1) +to kill any selected window. .TP -.B Mod1\-Shift\-, -Send focused window to previous screen, if any. +.B AudioPlay +Spawn +.BR playerctl(1) +to toggle (in order, if not found) +.BR mpd(1), +.BR mpv(1), +or any other MPRIS compatible media player .TP -.B Mod1\-Shift\-. -Send focused window to next screen, if any. +.B AudioNext +Spawn +.BR playerctl(1) +to go to next track of (in order, if not found) +.BR mpd(1), +.BR mpv(1), +or any other MPRIS compatible media player .TP -.B Mod1\-b -Toggles bar on and off. +.B AudioPrev +Spawn +.BR playerctl(1) +to go to previous track of (in order, if not found) +.BR mpd(1), +.BR mpv(1), +or any other MPRIS compatible media player .TP -.B Mod1\-t -Sets tiled layout. +.B Shift\-AudioPlay +Spawn +.BR playerctl(1) +to toggle (in order, if not found) any other MPRIS compatible media player, pr +.BR mpd(1). .TP -.B Mod1\-f -Sets floating layout. +.B Shift\-AudioNext +Spawn +.BR playerctl(1) +to skip forward in (in order, if not found) any other MPRIS compatible media player, pr +.BR mpd(1). .TP -.B Mod1\-m -Sets monocle layout. +.B Shift\-AudioPrev +Spawn +.BR playerctl(1) +to toggle (in order, if not found) any other MPRIS compatible media player, pr +.BR mpd(1). .TP -.B Mod1\-space -Toggles between current and previous layout. +.B MonBrightnessUp +Spawn +.BR light(1) +to turn the backlight brightness up +.TP +.B MonBrightnessDown +Spawn +.BR light(1) +to turn the backlight brightness down +.TP +.B AudioLowerVolume +Spawn volsv to turn the volume (pulseaudio first, alsa if not found) down +.TP +.B AudioRaiseVolume +Spawn volsv to turn the volume (pulseaudio first, alsa if not found) up +.TP +.B AudioMute +Spawn volsv to mute the volume (pulseaudio first, alsa if not found) +.TP +.B AudioMicMute +Spawn +.BR pamixer(1) +to mute the microphone. +.TP +.B Mod4\-l +Spawn +.BR i3lock-fancy(1) +to lock the screen. +.TP +.B Mod1\-b +Toggles bar on and off. +.TP +.B Mod1\-Shift\-j +Push the selected client window down the stack +.TP +.B Mod1\-Shift\-k +Push the selected client window up the stack .TP .B Mod1\-j Focus next window. @@ -101,53 +168,91 @@ Focus next window. .B Mod1\-k Focus previous window. .TP -.B Mod1\-i -Increase number of windows in master area. +.B Mod1\-, +Increase the number of master windows. .TP -.B Mod1\-d -Decrease number of windows in master area. +.B Mod1\-. +Decrease the number of master windows. +.TP +.B Mod1\-h +Decrease master area size. .TP .B Mod1\-l Increase master area size. .TP -.B Mod1\-h -Decrease master area size. +.B Mod1\-Shift\-h +Increase the size ratio of the selected client .TP -.B Mod1\-Return +.B Mod1\-Shift\-l +Decrease the size ratio of the selected client +.B Mod1\-Shift\-o +Reset the size ratio of the selected client +.TP +.B Mod1\-Shift\-Return Zooms/cycles focused window to/from master area (tiled layouts only). .TP -.B Mod1\-Shift\-c +.B Mod1\-Tab +Toggles to the previously selected tags. +.TP +.B Mod1\-Shift\-q Close focused window. .TP +.B Mod1\-t +Sets tiled layout. +.TP +.B Mod1\-s +Sets floating layout. +.TP +.B Mod1\-m +Sets monocle layout. +.TP .B Mod1\-Shift\-space -Toggle focused window between tiled and floating state. +Toggles between current and previous layout. .TP -.B Mod1\-Tab -Toggles to the previously selected tags. +.B Mod1\-space +Toggles the selected window into the floating state. .TP -.B Mod1\-Shift\-[1..n] -Apply nth tag to focused window. +.B Mod1\-f +Toggle the selected window into the fullscreen state. +.TP +.B Mod1\-0 +View all windows with any tag. .TP .B Mod1\-Shift\-0 Apply all tags to focused window. .TP +.B Mod1\-Shift\-, +Change focus to previous screen, if any. +.TP +.B Mod1\-Shift\-. +Change focus to next screen, if any. +.TP +.B Mod1\-Control\-Shift\-, +Send focused window to previous screen, if any. +.TP +.B Mod1\-Control\-Shift\-. +Send focused window to next screen, if any. +.TP +.B Mod1\-Shift\-[1..n] +Apply nth tag to focused window. +.TP .B Mod1\-Control\-Shift\-[1..n] Add/remove nth tag to/from focused window. .TP .B Mod1\-[1..n] View all windows with nth tag. .TP -.B Mod1\-0 -View all windows with any tag. -.TP .B Mod1\-Control\-[1..n] Add/remove all windows with nth tag to/from the view. .TP -.B Mod1\-Shift\-q +.B Mod1\-Shift\-e Quit dwm. .TP -.B Mod1\-Control\-Shift\-q +.B Mod1\-Shift\-r Restart dwm. +.TP +.B Mod1\-Shift\-Tab +Toggle AttachBelow patch .SS Mouse commands .TP .B Mod1\-Button1 @@ -168,6 +273,34 @@ Restart the dwm process. .TP .B SIGTERM - 15 Cleanly terminate the dwm process. +.SH PATCHES +This version of dwm was compiled using the: +.TP +.B dwm-actualfullscreen-20191112-cb3f58a.diff +.TP +.B dwm-attachbelow-toggleable-6.2.diff +.TP +.B dwm-autostart-20161205-bb3bd6f.diff +.TP +.B dwm-cfacts-20200913-61bb8b2.diff +.TP +.B dwm-clientindicators-6.2.diff +.TP +.B dwm-dwmc-6.2.diff +.TP +.B dwm-push_no_master-6.2.diff +.TP +.B dwm-restartsig-20180523-6.2.diff +.TP +.B dwm-statuscmd-signal-6.2.diff +.TP +.B dwm-swallow-20200522-7accbcf.diff +.TP +.B dwm-systray-6.2.diff +.TP +.B dwm-uselessgap-6.2.diff +.TP +.B dwm-zoomswap-6.2.diff .SH SEE ALSO .BR dmenu (1), .BR st (1) diff --git a/dwm.c b/dwm.c index 0848d2c..5c3859b 100644 --- a/dwm.c +++ b/dwm.c @@ -107,6 +107,7 @@ typedef struct Client Client; struct Client { char name[256]; float mina, maxa; + float cfact; int x, y, w, h; int oldx, oldy, oldw, oldh; int basew, baseh, incw, inch, maxw, maxh, minw, minh; @@ -250,6 +251,7 @@ static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); static void setlayout(const Arg *arg); +static void setcfact(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); static void seturgent(Client *c, int urg); @@ -1369,6 +1371,7 @@ manage(Window w, XWindowAttributes *wa) c->w = c->oldw = wa->width; c->h = c->oldh = wa->height; c->oldbw = wa->border_width; + c->cfact = 1.0; updatetitle(c); if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { @@ -2002,6 +2005,23 @@ setlayout(const Arg *arg) drawbar(selmon); } +void setcfact(const Arg *arg) { + float f; + Client *c; + + c = selmon->sel; + + if(!arg || !c || !selmon->lt[selmon->sellt]->arrange) + return; + f = arg->f + c->cfact; + if(arg->f == 0.0) + f = 1.0; + else if(f < 0.25 || f > 4.0) + return; + c->cfact = f; + arrange(selmon); +} + /* arg > 1.0 will set mfact absolutely */ void setmfact(const Arg *arg) @@ -2208,9 +2228,15 @@ void tile(Monitor *m) { unsigned int i, n, h, mw, my, ty; + float mfacts = 0, sfacts = 0; Client *c; - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) { + if (n < m->nmaster) + mfacts += c->cfact; + else + sfacts += c->cfact; + } if (n == 0) return; @@ -2220,13 +2246,15 @@ tile(Monitor *m) mw = m->ww; 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); + h = (m->wh - my) * (c->cfact / mfacts); resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); my += HEIGHT(c); + mfacts -= c->cfact; } else { - h = (m->wh - ty) / (n - i); + h = (m->wh - ty) * (c->cfact / sfacts); resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); ty += HEIGHT(c); + sfacts -= c->cfact; } } diff --git a/patches/dwm-cfacts-20200913-61bb8b2.diff b/patches/dwm-cfacts-20200913-61bb8b2.diff new file mode 100644 index 0000000..bb70e13 --- /dev/null +++ b/patches/dwm-cfacts-20200913-61bb8b2.diff @@ -0,0 +1,117 @@ +From c32a879432573d71dec7fcb4bf68927d2f4cdf10 Mon Sep 17 00:00:00 2001 +From: iofq +Date: Sat, 12 Sep 2020 22:28:09 -0500 +Subject: [PATCH] Fixed 'cfacts' patch failure due to upstream commit + 'f09418bbb...' + +--- + config.def.h | 3 +++ + dwm.c | 34 +++++++++++++++++++++++++++++++--- + 2 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..83910c1 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -70,6 +70,9 @@ 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_h, setcfact, {.f = +0.25} }, ++ { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} }, ++ { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, +diff --git a/dwm.c b/dwm.c +index 664c527..5233229 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -87,6 +87,7 @@ typedef struct Client Client; + struct Client { + char name[256]; + float mina, maxa; ++ float cfact; + int x, y, w, h; + int oldx, oldy, oldw, oldh; + int basew, baseh, incw, inch, maxw, maxh, minw, minh; +@@ -201,6 +202,7 @@ static void setclientstate(Client *c, long state); + static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); + static void setlayout(const Arg *arg); ++static void setcfact(const Arg *arg); + static void setmfact(const Arg *arg); + static void setup(void); + static void seturgent(Client *c, int urg); +@@ -1030,6 +1032,7 @@ manage(Window w, XWindowAttributes *wa) + c->w = c->oldw = wa->width; + c->h = c->oldh = wa->height; + c->oldbw = wa->border_width; ++ c->cfact = 1.0; + + updatetitle(c); + if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { +@@ -1512,6 +1515,23 @@ setlayout(const Arg *arg) + drawbar(selmon); + } + ++void setcfact(const Arg *arg) { ++ float f; ++ Client *c; ++ ++ c = selmon->sel; ++ ++ if(!arg || !c || !selmon->lt[selmon->sellt]->arrange) ++ return; ++ f = arg->f + c->cfact; ++ if(arg->f == 0.0) ++ f = 1.0; ++ else if(f < 0.25 || f > 4.0) ++ return; ++ c->cfact = f; ++ arrange(selmon); ++} ++ + /* arg > 1.0 will set mfact absolutely */ + void + setmfact(const Arg *arg) +@@ -1675,9 +1695,15 @@ void + tile(Monitor *m) + { + unsigned int i, n, h, mw, my, ty; ++ float mfacts = 0, sfacts = 0; + Client *c; + +- for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); ++ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) { ++ if (n < m->nmaster) ++ mfacts += c->cfact; ++ else ++ sfacts += c->cfact; ++ } + if (n == 0) + return; + +@@ -1687,15 +1713,17 @@ tile(Monitor *m) + mw = m->ww; + 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); ++ h = (m->wh - my) * (c->cfact / mfacts); + resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); + if (my + HEIGHT(c) < m->wh) + my += HEIGHT(c); ++ mfacts -= c->cfact; + } else { +- h = (m->wh - ty) / (n - i); ++ h = (m->wh - ty) * (c->cfact / sfacts); + resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); + if (ty + HEIGHT(c) < m->wh) + ty += HEIGHT(c); ++ sfacts -= c->cfact; + } + } + +-- +2.28.0 + diff --git a/volsv b/volsv new file mode 100755 index 0000000..2732a1c --- /dev/null +++ b/volsv @@ -0,0 +1,21 @@ +#!/bin/sh +# if pulseaudio +pulsesv () { + case "$1" in + "up" | "-i") pamixer -i 5 ;; + "down" | "-d") pamixer -d 5 ;; + "toggle" | "-t") pamixer -t ;; + "mic" | "-m") pamixer --source 1 -t ;; + esac +} +# if alsa +alsasv () { + case "$1" in + "up" | "-i") amixer sset Master 5%+ ;; + "down" | "-d") amixer sset Master 5%- ;; + "toggle" | "-t") amixer sset Master toggle ;; + "mic" | "-m") amixer set Capture toggle ;; + esac +} +# check which it is +[ ! -z "$(pgrep pulseaudio)" ] && pulsesv $1 || alsasv $1 ; pkill -RTMIN+10 dwmblocks ; touch /tmp/volsv.tmp -- cgit v1.2.3 From dad17ed7e8f24740110d4b64633d0193a84935e0 Mon Sep 17 00:00:00 2001 From: zachir Date: Sat, 20 Mar 2021 23:17:37 -0500 Subject: Add scratchpads (htop, term, pulsemixer, bluetoothctl, ncmpcpp) --- config.def.h | 30 +++++++++++--- config.h | 125 ++++++++++++++++++++++++++++++++++++----------------------- dwm.c | 43 +++++++++++++++++++- dwmc | 4 +- 4 files changed, 145 insertions(+), 57 deletions(-) (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index 8bfef3e..9b6eba9 100644 --- a/config.def.h +++ b/config.def.h @@ -24,6 +24,19 @@ static const char *colors[][3] = { [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; +typedef struct { + const char *name; + const void *cmd; +} Sp; +const char *spcmd1[] = {"st", "-n", "sphtop", "-g", "120x34", NULL }; +const char *spcmd2[] = {"st", "-n", "spst", "-g", "120x34", NULL }; +const char *spcmd3[] = {"st", "-n", "sppm", "-g", "120x34", NULL }; +static Sp scratchpads[] = { + {"sphtop", spcmd1}, + {"spst", spcmd2}, + {"sppm", spcmd3}, +}; + /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; @@ -33,10 +46,13 @@ static const Rule rules[] = { * WM_NAME(STRING) = title */ /* class instance title tags mask isfloating isterminal noswallow monitor */ - { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, - { "st", NULL, NULL, 0, 0, 1, -1, -1 }, - { NULL, NULL, "Event Tester", 0, 1, 0, 1, -1 }, /* xev */ + { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, + { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, + { "st", NULL, NULL, 0, 0, 1, -1, -1 }, + { NULL, NULL, "Event Tester", 0, 1, 0, 1, -1 }, /* xev */ + { NULL, "sphtop", NULL, SPTAG(0), 1, 1, 1, -1 }, + { NULL, "spst", NULL, SPTAG(1), 1, 1, 1, -1 }, + { NULL, "sppm", NULL, SPTAG(2), 1, 1, 1, -1 }, }; /* layout(s) */ @@ -68,6 +84,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 }; + static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, @@ -97,6 +114,9 @@ static Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { MODKEY, XK_y, togglescratch, {.ui = 0 } }, + { MODKEY, XK_u, togglescratch, {.ui = 1 } }, + { MODKEY, XK_x, togglescratch, {.ui = 2 } }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) @@ -122,7 +142,7 @@ static Button buttons[] = { { ClkStatusText, 0, Button3, sigdwmblocks, {.i = 3} }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkClientWin, MODKEY, Button1, resizemouse, {0} }, { ClkTagBar, 0, Button1, view, {0} }, { ClkTagBar, 0, Button3, toggleview, {0} }, { ClkTagBar, MODKEY, Button1, tag, {0} }, diff --git a/config.h b/config.h index 607e67f..a215a73 100644 --- a/config.h +++ b/config.h @@ -26,6 +26,23 @@ static const char *colors[][3] = { [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; +typedef struct { + const char *name; + const void *cmd; +} Sp; +const char *spcmd1[] = { "st", "-g", "150x50", "-n", "sphtop", "-e", "htop", NULL }; +const char *spcmd2[] = { "st", "-g", "150x50", "-n", "spterm", NULL }; +const char *spcmd3[] = { "st", "-g", "150x50", "-n", "sppm", "-e", "pulsemixer", NULL }; +const char *spcmd4[] = { "st", "-g", "150x50", "-n", "spbt", "-e", "bluetoothctl", NULL }; +const char *spcmd5[] = { "st", "-g", "150x50", "-n", "spncmp", "-e", "ncmpcpp", NULL }; +static Sp scratchpads[] = { + { "sphtop", spcmd1 }, + { "spterm", spcmd2 }, + { "sppm", spcmd3 }, + { "spbt", spcmd4 }, + { "spncmp", spcmd5 }, +}; + /* tagging */ static const char *tags[] = { " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9" }; @@ -59,6 +76,11 @@ static const Rule rules[] = { { NULL, NULL, "steam", 4, 0, 0, 0, -1 }, { "Lutris", NULL, NULL, 2, 0, 0, 0, -1 }, { "lutris", NULL, NULL, 2, 0, 0, 0, -1 }, + { NULL, "sphtop",NULL, SPTAG(0),1, 1, 1, -1 }, + { NULL, "spterm",NULL, SPTAG(1),1, 1, 1, -1 }, + { NULL, "sppm", NULL, SPTAG(2),1, 1, 1, -1 }, + { NULL, "spbt", NULL, SPTAG(3),1, 1, 1, -1 }, + { NULL, "spncmp",NULL, SPTAG(4),1, 1, 1, -1 }, }; /* layout(s) */ @@ -88,6 +110,7 @@ static const Layout layouts[] = { /* 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 *rmenucmd[] = { "/usr/sbin/j4-dmenu-desktop", NULL }; static const char *passmenu[] = { "passmenu", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *termcmd[] = { "tabbed", "-c", "st", "-w", NULL }; static const char *mpdtoggle[] = { "playerctl", "--player=mpd,mpv,%any", "play-pause", NULL }; @@ -108,51 +131,57 @@ static const char *xkillcmd[] = { "xkill", NULL }; static Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_d, spawn, {.v = dmenucmd } }, - { MODKEY, XK_p, spawn, {.v = passmenu } }, - { MODKEY, XK_c, spawn, {.v = xidletog } }, - { MODKEY, XK_x, spawn, {.v = xkillcmd } }, - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { 0, XF86XK_AudioPlay, spawn, {.v = mpdtoggle } }, - { 0, XF86XK_AudioNext, spawn, {.v = mpdnext } }, - { 0, XF86XK_AudioPrev, spawn, {.v = mpdprev } }, - { ShiftMask, XF86XK_AudioPlay, spawn, {.v = plytoggle } }, - { ShiftMask, XF86XK_AudioNext, spawn, {.v = plyfwd } }, - { ShiftMask, XF86XK_AudioPrev, spawn, {.v = plybck } }, - { 0, XF86XK_MonBrightnessUp, spawn, {.v = blightup } }, - { 0, XF86XK_MonBrightnessDown, spawn, {.v = blightdown } }, - { 0, XF86XK_AudioLowerVolume, spawn, {.v = audiodown } }, - { 0, XF86XK_AudioRaiseVolume, spawn, {.v = audioup } }, - { 0, XF86XK_AudioMute, spawn, {.v = audiomute } }, - { 0, XF86XK_AudioMicMute, spawn, {.v = micmute } }, - { Mod4Mask, XK_l, spawn, {.v = lockscr } }, - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY|ShiftMask, XK_j, pushdown, {.i = +1 } }, - { MODKEY|ShiftMask, XK_k, pushup, {.i = -1 } }, - { MODKEY|ControlMask, XK_k, setcfact, {.f = +0.25} }, - { MODKEY|ControlMask, XK_j, setcfact, {.f = -0.25} }, - { MODKEY|ControlMask, XK_o, setcfact, {.f = 0.00} }, - { MODKEY|ShiftMask, XK_h, incnmaster, {.i = +1 } }, - { MODKEY|ShiftMask, XK_l, incnmaster, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, - { MODKEY|ShiftMask, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_q, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_s, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY|ShiftMask, XK_space, setlayout, {-1} }, - { MODKEY, XK_space, togglefloating, {0} }, - { MODKEY, XK_f, togglefullscr, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY|ControlMask, XK_comma, focusmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ControlMask|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ControlMask|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { MODKEY, XK_d, spawn, {.v = dmenucmd } }, + { MODKEY, XK_r, spawn, {.v = rmenucmd } }, + { MODKEY, XK_p, spawn, {.v = passmenu } }, + { MODKEY, XK_c, spawn, {.v = xidletog } }, + { MODKEY, XK_x, spawn, {.v = xkillcmd } }, + { MODKEY, XK_Return, spawn, {.v = termcmd } }, + { MODKEY|ControlMask, XK_z, togglescratch, {.ui = 0 } }, + { MODKEY|ControlMask, XK_x, togglescratch, {.ui = 1 } }, + { MODKEY|ControlMask, XK_c, togglescratch, {.ui = 2 } }, + { MODKEY|ControlMask, XK_v, togglescratch, {.ui = 3 } }, + { MODKEY|ControlMask, XK_b, togglescratch, {.ui = 4 } }, + // { 0, XF86XK_AudioPlay, spawn, {.v = mpdtoggle } }, + // { 0, XF86XK_AudioNext, spawn, {.v = mpdnext } }, + // { 0, XF86XK_AudioPrev, spawn, {.v = mpdprev } }, + // { ShiftMask, XF86XK_AudioPlay, spawn, {.v = plytoggle } }, + // { ShiftMask, XF86XK_AudioNext, spawn, {.v = plyfwd } }, + // { ShiftMask, XF86XK_AudioPrev, spawn, {.v = plybck } }, + // { 0, XF86XK_MonBrightnessUp, spawn, {.v = blightup } }, + // { 0, XF86XK_MonBrightnessDown, spawn, {.v = blightdown } }, + // { 0, XF86XK_AudioLowerVolume, spawn, {.v = audiodown } }, + // { 0, XF86XK_AudioRaiseVolume, spawn, {.v = audioup } }, + // { 0, XF86XK_AudioMute, spawn, {.v = audiomute } }, + // { 0, XF86XK_AudioMicMute, spawn, {.v = micmute } }, + // { Mod4Mask, XK_l, spawn, {.v = lockscr } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY|ShiftMask, XK_j, pushdown, {.i = +1 } }, + { MODKEY|ShiftMask, XK_k, pushup, {.i = -1 } }, + { MODKEY|ControlMask, XK_k, setcfact, {.f = +0.25} }, + { MODKEY|ControlMask, XK_j, setcfact, {.f = -0.25} }, + { MODKEY|ControlMask, XK_o, setcfact, {.f = 0.00} }, + { MODKEY|ShiftMask, XK_h, incnmaster, {.i = +1 } }, + { MODKEY|ShiftMask, XK_l, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_q, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_s, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + /* { MODKEY|ShiftMask, XK_space, setlayout, {-1} }, */ + { MODKEY, XK_space, togglefloating, {0} }, + { MODKEY, XK_f, togglefullscr, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY|ControlMask, XK_comma, focusmon, {.i = -1 } }, + { MODKEY|ControlMask, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ControlMask|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ControlMask|ShiftMask, XK_period, tagmon, {.i = +1 } }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) @@ -162,9 +191,9 @@ static Key keys[] = { TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_e, quit, {0} }, - { MODKEY|ShiftMask, XK_r, quit, {1} }, - { MODKEY|ShiftMask, XK_Tab, toggleAttachBelow, {0} }, + { MODKEY|ShiftMask, XK_e, quit, {0} }, + { MODKEY|ShiftMask, XK_r, quit, {1} }, + { MODKEY|ShiftMask, XK_Tab, toggleAttachBelow, {0} }, }; /* button definitions */ diff --git a/dwm.c b/dwm.c index cecbe53..5fb86a6 100644 --- a/dwm.c +++ b/dwm.c @@ -56,7 +56,10 @@ #define MOUSEMASK (BUTTONMASK|PointerMotionMask) #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 NUMTAGS (LENGTH(tags) + LENGTH(scratchpads)) +#define TAGMASK ((1 << NUMTAGS) - 1) +#define SPTAG(i) ((1 << LENGTH(tags) << (i))) +#define SPTAGMASK (((1 << LENGTH(scratchpads))-1) << LENGTH(tags)) #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) #define SYSTEM_TRAY_REQUEST_DOCK 0 @@ -268,6 +271,7 @@ static void tile(Monitor *); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void togglefullscr(const Arg *arg); +static void togglescratch(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); static void unfocus(Client *c, int setfocus); @@ -379,6 +383,11 @@ applyrules(Client *c) c->noswallow = r->noswallow; c->isfloating = r->isfloating; c->tags |= r->tags; + if ((r->tags & SPTAGMASK) && r->isfloating) { + c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2); + c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2); + } + for (m = mons; m && m->num != r->monitor; m = m->next); if (m) c->mon = m; @@ -388,7 +397,7 @@ applyrules(Client *c) XFree(ch.res_class); if (ch.res_name) XFree(ch.res_name); - c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; + c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : (c->mon->tagset[c->mon->seltags] & ~SPTAGMASK); } int @@ -2139,6 +2148,10 @@ showhide(Client *c) if (!c) return; if (ISVISIBLE(c)) { + if ((c->tags & SPTAGMASK) && c->isfloating) { + c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2); + c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2); + } /* show clients top down */ XMoveWindow(dpy, c->win, c->x, c->y); if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) @@ -2303,6 +2316,32 @@ togglefullscr(const Arg *arg) setfullscreen(selmon->sel, !selmon->sel->isfullscreen); } +void +togglescratch(const Arg *arg) +{ + Client *c; + unsigned int found = 0; + unsigned int scratchtag = SPTAG(arg->ui); + Arg sparg = {.v = scratchpads[arg->ui].cmd}; + + for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next); + if (found) { + unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag; + if (newtagset) { + selmon->tagset[selmon->seltags] = newtagset; + focus(NULL); + arrange(selmon); + } + if (ISVISIBLE(c)) { + focus(c); + restack(selmon); + } + } else { + selmon->tagset[selmon->seltags] |= scratchtag; + spawn(&sparg); + } +} + void toggletag(const Arg *arg) { diff --git a/dwmc b/dwmc index 5ff8dbc..2725e5d 100755 --- a/dwmc +++ b/dwmc @@ -7,7 +7,7 @@ signal() { case $# in 1) case $1 in - setlayout | view | viewall | togglebar | togglefloating | zoom | killclient | quit) + setlayout | view | viewall | togglebar | togglefloating | zoom | killclient) signal $1 ;; *) @@ -21,7 +21,7 @@ case $# in view) signal $1 ui $2 ;; - viewex | toggleviewex | tagex | toggletagex | setlayoutex | focusstack | incnmaster | focusmon | tagmon) + viewex | toggleviewex | tagex | toggletagex | setlayoutex | focusstack | incnmaster | focusmon | tagmon | quit) signal $1 i $2 ;; setmfact) -- cgit v1.2.3 From 631bcee3d0ea470171f23c041b3babdaaadd0d0d Mon Sep 17 00:00:00 2001 From: zachir Date: Thu, 17 Jun 2021 21:24:59 -0500 Subject: Add triple column layout --- config.def.h | 3 +++ tcl.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 tcl.c (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index 9b6eba9..a66fbe2 100644 --- a/config.def.h +++ b/config.def.h @@ -61,11 +61,13 @@ 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 int attachbelow = 1; /* 1 means attach after the currently active window */ +#include "tcl.c" static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, + { "|||", tcl }, }; /* key definitions */ @@ -105,6 +107,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_t, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, diff --git a/tcl.c b/tcl.c new file mode 100644 index 0000000..4c94914 --- /dev/null +++ b/tcl.c @@ -0,0 +1,74 @@ +void +tcl(Monitor * m) +{ + int x, y, h, w, mw, sw, bdw; + unsigned int i, n; + Client * c; + + for (n = 0, c = nexttiled(m->clients); c; + c = nexttiled(c->next), n++); + + if (n == 0) + return; + + c = nexttiled(m->clients); + + mw = m->mfact * m->ww; + sw = (m->ww - mw) / 2; + bdw = (2 * c->bw); + resize(c, + n < 3 ? m->wx : m->wx + sw, + m->wy, + n == 1 ? m->ww - bdw : mw - bdw, + m->wh - bdw, + False); + + if (--n == 0) + return; + + w = (m->ww - mw) / ((n > 1) + 1); + c = nexttiled(c->next); + + if (n > 1) + { + x = m->wx + ((n > 1) ? mw + sw : mw); + y = m->wy; + h = m->wh / (n / 2); + + if (h < bh) + h = m->wh; + + for (i = 0; c && i < n / 2; c = nexttiled(c->next), i++) + { + resize(c, + x, + y, + w - bdw, + (i + 1 == n / 2) ? m->wy + m->wh - y - bdw : h - bdw, + False); + + if (h != m->wh) + y = c->y + HEIGHT(c); + } + } + + x = (n + 1 / 2) == 1 ? mw : m->wx; + y = m->wy; + h = m->wh / ((n + 1) / 2); + + if (h < bh) + h = m->wh; + + for (i = 0; c; c = nexttiled(c->next), i++) + { + resize(c, + x, + y, + (i + 1 == (n + 1) / 2) ? w - bdw : w - bdw, + (i + 1 == (n + 1) / 2) ? m->wy + m->wh - y - bdw : h - bdw, + False); + + if (h != m->wh) + y = c->y + HEIGHT(c); + } +} -- cgit v1.2.3