diff --git a/README.md b/README.md index dddaecc..cc3c621 100644 --- a/README.md +++ b/README.md @@ -476,7 +476,7 @@ Below is a list of all .Xresources values you can define. - speedwm.layout.monocle.clientcount: 0 - speedwm.layout.monocle.count: 0 - speedwm.layout.monocle.format: [%d/%d] -- speedwm.layout.custom.cmd: printf '' | spmenu -i -l 10 -p 'Enter S expression:' +- speedwm.layout.custom.cmd: speedwm-sxp - speedwm.mfact: 0.50 - speedwm.mfact.lowest: 0.05 - speedwm.mouse.clicktofocus: 0 diff --git a/bar.h b/bar.h index 85e11e8..90b041b 100755 --- a/bar.h +++ b/bar.h @@ -70,9 +70,9 @@ */ static const BarRule barrules[] = { /* Monitor Bar Alignment Width Draw Click Value Module name */ - { -1, 0, bar_align_left, width_ltsymbol, draw_ltsymbol, click_ltsymbol, 0, "layout" }, - { -1, 0, bar_align_left, width_tags_pwl, draw_tags_pwl, click_tags_pwl, 0, "powerline tags" }, - { 'A', 0, bar_align_right, width_systray, draw_systray, click_systray, 0, "systray" }, - { -1, 0, bar_align_right, width_status_pwl, draw_status_pwl, click_status_pwl, 0, "powerline status" }, + { -1, 1, bar_align_left, width_ltsymbol, draw_ltsymbol, click_ltsymbol, 0, "layout" }, + { -1, 1, bar_align_left, width_tags_pwl, draw_tags_pwl, click_tags_pwl, 0, "powerline tags" }, + { 'A', 1, bar_align_right, width_systray, draw_systray, click_systray, 0, "systray" }, + { -1, 1, bar_align_right, width_status_pwl, draw_status_pwl, click_status_pwl, 0, "powerline status" }, { -1, 0, bar_align_none, width_title, draw_title, click_title, 0, "title" }, }; diff --git a/docs/example.Xresources b/docs/example.Xresources index c0caf30..e5ff19d 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -40,6 +40,7 @@ speedwm.border.size: 1 ! Size of the border around windows in !! Client options speedwm.client.map: 1 ! Map and unmap windows through X11 (0/1) +speedwm.client.allowkill: 1 ! Allow killing clients by default (0/1) speedwm.client.allowurgent: 1 ! Allow windows to have the 'urgent' status (0/1) speedwm.client.automove: 1 ! Allow windows to move themselves on demand. This may be annoying depending on what software you use and is disabled by default for this reason (0/1) speedwm.client.autofocus: 1 ! Allow windows to focus themselves on demand. This may be annoying depending on what software you use and is disabled by default for this reason (0/1) diff --git a/docs/example.signal b/docs/example.signal index 039ad62..64f1c94 100644 --- a/docs/example.signal +++ b/docs/example.signal @@ -21,23 +21,23 @@ - 21 - Toggle the bar - 22 - Toggle fullscreen - 23 - Toggle floating -- 24 - Swap the current window with the next +- 24 - Swap the current client with the next - 25 - Reorganize tags (Reorder them) - 26 - Shutdown speedwm - 27 - Restart speedwm -- 28 - Show the focused window -- 29 - Hide the focused window -- 30 - Kill the focused window +- 28 - Show the focused client +- 29 - Hide the focused client +- 30 - Kill the focused client - 31 - Rotate the stack up - 32 - Rotate the stack down -- 33 - Increase number of windows in the master stack -- 34 - Decrease number of windows in the master stack -- 35 - Focus the Master window -- 36 - Switch focus between windows +1 -- 37 - Switch focus between windows -1 -- 38 - Switch focus between hidden windows +1 -- 39 - Switch focus between hidden windows -1 -- 40 - Toggle opacity for windows +- 33 - Increase number of clients in the master stack +- 34 - Decrease number of clients in the master stack +- 35 - Focus the Master client +- 36 - Switch focus between clients +1 +- 37 - Switch focus between clients -1 +- 38 - Switch focus between hidden clients +1 +- 39 - Switch focus between hidden clients -1 +- 40 - Toggle opacity for clients - 41 - Increase cfact by 0.05 - 42 - Decrease cfact by 0.05 - 43 - Switch to the previous tag @@ -50,7 +50,7 @@ - 50 - Decrease inner gaps by 1 - 51 - Increase outer gaps by 1 - 52 - Decrease outer gaps by 1 -- 53 - Kill all windows except focused +- 53 - Kill all clients except focused - 54 - Focus the next monitor - 55 - Focus the previous monitor - 56 - Show the scratchpad @@ -59,15 +59,15 @@ - 59 - Reset layout/mfact - 60 - Reset mastercount - 61 - Toggle systray -- 62 - Hide all windows -- 63 - Show all windows +- 62 - Hide all clients +- 63 - Show all clients - 64 - Reset mfact - 65 - Reload .Xresources on the fly - 66 - Switch to the previous tag, skipping empty tags - 67 - Switch to the next tag, skipping empty tags - 68 - Toggle the tag area in the bar - 69 - Toggle the empty tags in the bar -- 70 - Unused +- 70 - Toggle allowing killing of the selected client - 71 - Unused - 72 - Unused - 73 - Unused @@ -80,7 +80,7 @@ - 80 - Toggle the status area in the bar - 81 - Toggle the floating indicator area in the bar - 82 - Toggle the sticky indicator area in the bar -- 83 - Toggle the icon in the window title +- 83 - Toggle the icon in the client title - 84 - Unused - 85 - Unused - 86 - Unused @@ -110,13 +110,13 @@ - 110 - Rotate backwards in the stack axis - 111 - Rotate backwards in the secondary stack axis - 112 - Mirror the layout -- 113 - Enter an empty layout where all windows are hidden +- 113 - Enter an empty layout where all clients are hidden - 114 - Increase barpadding and gaps by 1 - 115 - Decrease barpadding and gaps by 1 -- 116 - Toggle mark on a window. -- 117 - Swap focus with the marked window. -- 118 - Swap the focused window with the marked window. -- 119 - Center the focused window -- 120 - Toggle border for the focused window +- 116 - Toggle mark on a client. +- 117 - Swap focus with the marked client. +- 118 - Swap the focused client with the marked client. +- 119 - Center the focused client +- 120 - Toggle border for the focused client - 121 - Reset bar padding and gaps diff --git a/keybinds.h b/keybinds.h index 7392403..e82c1bc 100755 --- a/keybinds.h +++ b/keybinds.h @@ -35,8 +35,8 @@ * Mod4Mask | Super (Windows/command) key * Mod1Mask | Alt key */ -#define MODIFIER1 Mod4Mask -#define MODIFIER2 Mod1Mask +#define MODIFIER1 Mod4Mask +#define MODIFIER2 Mod1Mask /* Tag related keybinds */ #define TAGKEYS(CHAIN,KEY,TAG) { KeyPress, MODIFIER1, CHAIN, KEY, view, {.ui = 1 << TAG } }, \ @@ -47,21 +47,57 @@ /* Keybinds */ static Key keys[] = { /* type modifier chain key key function argument */ - { KeyPress, MODIFIER1|SHIFT, -1, XK_semicolon, spawn, cmd( "spmenu_run -l 0 -p 'Run:' -na" ) }, - { KeyPress, MODIFIER1|SHIFT, -1, XK_Return, spawn, cmd( TERMINAL ) }, - { KeyPress, MODIFIER1|SHIFT, -1, XK_w, spawn, cmd( "chromium || chromium-bin" ) }, - { KeyPress, MODIFIER1|CONTROL, -1, XK_Tab, spawn, cmd( "speedwm-utils layout" ) }, + /* Run keybinds */ + { KeyPress, MODIFIER1, -1, XK_semicolon, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='spmenu -l 20 -p Open:'" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_semicolon, spawn, cmd( "spmenu_run -l 0 -p 'Run:' -na" ) }, + + /* Application keybinds */ + { KeyPress, MODIFIER1|SHIFT, -1, XK_Return, spawn, cmd( TERMINAL ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_s, spawn, cmd( "speedwm-screenshotutil -s" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_f, spawn, cmd( TERMINAL "lfrun || lf" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_w, spawn, cmd( "chromium || chromium-bin" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_o, spawn, cmd( "speedwm-dfmpeg" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_t, spawn, cmd( TERMINAL "nvim" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_a, spawn, cmd( TERMINAL "speedwm-audioctrl -runmixer" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_m, spawn, cmd( TERMINAL "tmux new-session -A -D -s cmus $(which --skip-alias cmus)" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_Tab, spawn, cmd( "speedwm-winnav" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_x, spawn, cmd( TERMINAL "htop" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_c, spawn, cmd( TERMINAL "tmux new-session -A -D -s weechat $(which --skip-alias weechat)" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_Escape, spawn, cmd( "speedwm-shutdown" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_u, spawn, cmd( TERMINAL "newsboat" ) }, + { KeyPress, MODIFIER1|SHIFT, -1, XK_r, spawn, cmd( TERMINAL "neomutt" ) }, + { KeyPress, MODIFIER1|CONTROL, -1, XK_Tab, spawn, cmd( "speedwm-utils layout" ) }, + { KeyPress, MODIFIER1|CONTROL, -1, XK_s, spawn, cmd( "speedwm-screenshotutil -f" ) }, + { KeyPress, MODIFIER1|CONTROL, -1, XK_m, spawn, cmd( "pkill cmus" ) }, + { KeyPress, MODIFIER1|CONTROL, -1, XK_q, spawn, cmd( "speedwm-audioctrl -mute" ) }, + { KeyPress, MODIFIER1|CONTROL, -1, XK_w, spawn, cmd( "speedwm-audioctrl -lower" ) }, + { KeyPress, MODIFIER1|CONTROL, -1, XK_e, spawn, cmd( "speedwm-audioctrl -raise" ) }, + { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_q, spawn, cmd( "cmus-remote --pause" ) }, + { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_w, spawn, cmd( "cmus-remote --volume -3000" ) }, + { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_e, spawn, cmd( "cmus-remote --volume +3000" ) }, + { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_Escape, spawn, cmd( "speedwm-utils" ) }, + { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_s, spawn, cmd( "speedwm-swal" ) }, + { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_n, spawn, cmd( "speedwm-netctrl" ) }, + { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_b, spawn, cmd( "speedwm-btctrl" ) }, + { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_r, spawn, cmd( "libspeedwm --perform core_wm_restart" ) }, + + /* Switcher */ { KeyPress, MODIFIER1, -1, XK_Tab, switcherstart, {0} }, + /* Systray */ { KeyPress, MODIFIER1, -1, XK_s, togglesystray, {0} }, + /* Layout keybinds */ { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_a, cyclelayout, {.i = -1 } }, { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_d, cyclelayout, {.i = +1 } }, + /* Scratchpad keybinds */ { KeyPress, MODIFIER1, -1, XK_minus, scratchpad_show, {0} }, { KeyPress, MODIFIER1|SHIFT, -1, XK_minus, scratchpad_hide, {0} }, { KeyPress, MODIFIER1, -1, XK_equal, scratchpad_remove, {0} }, + + /* speedwm general binds */ { KeyPress, MODIFIER1, -1, XK_f, togglefullscr, {0} }, { KeyPress, MODIFIER1, -1, XK_b, togglebar, {0} }, { KeyPress, MODIFIER1, -1, XK_r, resetmastercount, {0} }, @@ -153,6 +189,7 @@ static Key keys[] = { { KeyPress, MODIFIER1|CONTROL|SHIFT, -1, XK_p, hideall, {0} }, /* Chained keybinds */ + { KeyPress, MODIFIER1, XK_r, XK_s, spawn, cmd( "pgrep -x screenkey && pkill screenkey || screenkey" ) }, { KeyPress, MODIFIER1, XK_t, XK_r, reorganizetags, {0} }, { KeyPress, MODIFIER1, XK_p, XK_t, togglebarpadding, {0} }, { KeyPress, MODIFIER1, XK_p, XK_u, setbarpadding, {.i = +5 } }, @@ -192,10 +229,28 @@ static Key keys[] = { /* Misc */ { KeyPress, MODIFIER1|SHIFT, -1, XK_backslash, killunsel, {0} }, + { KeyPress, MODIFIER1|SHIFT, XK_e, XK_p, spawn, cmd( "speedwm-swal --previous" ) }, + { KeyPress, MODIFIER1|SHIFT, XK_e, XK_r, spawn, cmd( "speedwm-swal --randomize" ) }, + { KeyPress, MODIFIER1|SHIFT, XK_e, XK_a, spawn, cmd( "speedwm-virtualkeyboard" ) }, + { KeyPress, MODIFIER1|SHIFT, XK_e, XK_e, spawn, cmd( "speedwm-virtualkeyboard -e" ) }, + /* Gap keybinds */ { KeyPress, MODIFIER1|CONTROL, -1, XK_z, incrgaps, {.i = +5 } }, { KeyPress, MODIFIER1|CONTROL, -1, XK_x, incrgaps, {.i = -5 } }, /* Media buttons */ - { KeyPress, 0, -1, XF86XK_WWW, spawn, cmd( "chromium || chromium-bin" ) }, + { KeyPress, 0, -1, XF86XK_AudioMute, spawn, cmd( "speedwm-audioctrl -mute" ) }, + { KeyPress, 0, -1, XF86XK_AudioRaiseVolume, spawn, cmd( "speedwm-audioctrl -raise" ) }, + { KeyPress, 0, -1, XF86XK_AudioLowerVolume, spawn, cmd( "speedwm-audioctrl -lower" ) }, + { KeyPress, 0, -1, XF86XK_AudioPrev, spawn, cmd( "cmus-remote --prev" ) }, + { KeyPress, 0, -1, XF86XK_AudioNext, spawn, cmd( "cmus-remote --next" ) }, + { KeyPress, 0, -1, XF86XK_AudioStop, spawn, cmd( "pkill cmus" ) }, + { KeyPress, 0, -1, XF86XK_AudioPause, spawn, cmd( "cmus-remote --pause" ) }, + { KeyPress, 0, -1, XF86XK_WWW, spawn, cmd( "qutebrowser" ) }, + { KeyPress, 0, -1, XF86XK_PowerOff, spawn, cmd( "speedwm-shutdown" ) }, + { KeyPress, 0, -1, XF86XK_Sleep, spawn, cmd( "slock" ) }, + { KeyPress, 0, -1, XF86XK_Mail, spawn, cmd( TERMINAL "neomutt" ) }, + { KeyPress, 0, -1, XF86XK_TaskPane, spawn, cmd( TERMINAL "htop" ) }, + { KeyPress, 0, -1, XF86XK_WLAN, spawn, cmd( "speedwm-netctrl disconnect" ) }, + { KeyPress, 0, -1, XF86XK_Music, spawn, cmd( TERMINAL "tmux new-session -A -D -s cmus $(which --skip-alias cmus)" ) }, }; diff --git a/mouse.h b/mouse.h index ee715cc..c651e32 100755 --- a/mouse.h +++ b/mouse.h @@ -36,9 +36,11 @@ static const Button buttons[] = { { clickstatusbar, 0, Button1, spawn, {.v = clickstatus } }, { clickstatusbar, 0, Button2, spawn, {.v = clickstatus } }, { clickstatusbar, 0, Button3, spawn, {.v = clickstatus } }, + { clicktitle, 0, Button3, spawn, cmd( "speedwm-utils" ) }, { clicktitle, 0, Button1, togglewin, {0} }, { clicktitle, 0, Button4, inplacerotate, {.i = +2} }, { clicktitle, 0, Button5, inplacerotate, {.i = -2} }, + { clickroot, 0, Button3, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='spmenu -l 20 -p Open:'" ) }, { clicktags, 0, Button1, view, {0} }, { clicktags, 0, Button4, viewtoleft, {0} }, { clicktags, 0, Button5, viewtoright, {0} }, diff --git a/options.h b/options.h index 0b58f03..0e0461e 100755 --- a/options.h +++ b/options.h @@ -53,6 +53,7 @@ static int startontag = 1; /* Start on a tag or not? */ static int floatscratchpad = 0; /* Float the scratchpad window on hide (0/1) */ /* Client properties */ +static int allowkill = 1; /* Allow killing clients by default (0/1) */ static int autofocus = 1; /* Allow clients to automatically be focused when they request it. This comes with the side effect of potentially being annoying */ static int automove = 1; /* Allow clients to automatically move when they request it */ static int autoresize = 1; /* Allow resizing clients automatically when they request it. */ diff --git a/signal.h b/signal.h index aa2c643..18ec0c8 100644 --- a/signal.h +++ b/signal.h @@ -78,8 +78,8 @@ static Signal signals[] = { { 67, viewtoright_vacant, {0} }, { 68, togglebartags, {0} }, { 69, togglebaremptytags, {0} }, + { 70, toggleakill, {0} }, /* - { 70, Unused, {0} }, { 71, Unused, {0} }, { 72, Unused, {0} }, { 73, Unused, {0} }, diff --git a/speedwm.1 b/speedwm.1 index d7c4a71..c4ff59f 100644 --- a/speedwm.1 +++ b/speedwm.1 @@ -919,8 +919,7 @@ speedwm.layout.monocle.count: 0 .IP \[bu] 2 speedwm.layout.monocle.format: [%d/%d] .IP \[bu] 2 -speedwm.layout.custom.cmd: printf \[cq]\[cq] | spmenu -i -l 10 -p `Enter -S expression:' +speedwm.layout.custom.cmd: speedwm-sxp .IP \[bu] 2 speedwm.mfact: 0.50 .IP \[bu] 2 diff --git a/speedwm.c b/speedwm.c index 288ab60..0546eb9 100644 --- a/speedwm.c +++ b/speedwm.c @@ -240,6 +240,7 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh; int hintsvalid; /* https://git.suckless.org/dwm/commit/8806b6e2379372900e3d9e0bf6604bc7f727350b.html */ int bw, oldbw; + int cankill; unsigned int tags; /* tags */ #if USEWINICON unsigned int icw, ich; Picture icon; @@ -624,6 +625,8 @@ static void setcfact(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); +static void toggleakill(const Arg *arg); + /* ipc */ #if USEIPC static void setlayoutsafe(const Arg *arg); @@ -3254,7 +3257,7 @@ incrogaps(const Arg *arg) void killclient(const Arg *arg) { - if (!selmon->sel || selmon->sel->ispermanent) + if (!selmon->sel || selmon->sel->ispermanent || !selmon->sel->cankill) return; #if USESYSTRAY if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0, 0, 0)) { @@ -3323,6 +3326,7 @@ manage(Window w, XWindowAttributes *wa) c->h = c->oldh = wa->height; c->oldbw = wa->border_width; c->cfact = 1.0; + c->cankill = allowkill; /* we can kill by default */ #if USEWINICON updateicon(c); @@ -5600,6 +5604,15 @@ togglefloating(const Arg *arg) arrange(selmon); } +void +toggleakill(const Arg *arg) +{ + if (!selmon->sel) + return; + + selmon->sel->cankill = !selmon->sel->cankill; +} + void setsticky(Client *c, int sticky) { diff --git a/status.h b/status.h old mode 100644 new mode 100755 diff --git a/xresources.h b/xresources.h index 07763ce..0d70810 100644 --- a/xresources.h +++ b/xresources.h @@ -165,6 +165,7 @@ ResourcePref resources[] = { { "mouse.warpcursor", INTEGER, &warpcursor }, { "mouse.clicktofocus", INTEGER, &clicktofocus }, { "client.floatscratchpad", INTEGER, &floatscratchpad }, + { "client.allow.kill", INTEGER, &allowkill }, { "client.autofocus", INTEGER, &autofocus }, { "client.automove", INTEGER, &automove }, { "client.autoresize", INTEGER, &autoresize },