This is the list of patches for the dwm window manager from suckless.org, with description for each patch in one page.
This patch changes the rectangle indicating if a tag is used by a client into a bar above the tag name. Be sure to use a font which leaves enough space between the text of the tag name and the top of the bar.
Actually toggle fullscreen for a window, instead of toggling the status bar and the monocle layout.
Allow dwm to have translucent bars, while keeping all the text on it opaque, just like the alpha-patch for st.
By default dwm might make windows' borders transparent when using composit window manager (e.g. xcompmgr, picom). Alpha patch allows to make borders opaque. If all you want is to make borders opaque, you don't care about statusbar opacity and/or have problems applying alpha patch, then you might use fixborders patch instead.
Having icons as tags sure makes dwm look awesome, but having tags number simplifies tags related operations. This patch introduces alternative tags which can be switched on the fly for the sole purpose of providing visual aid. Primary tags
Alternative tags
This patches provides the ability to use an alternative text for tags which contain at least one window. This patch replaces the standard behavious of drawing a little box on the top left edge of the tag box.
All floating windows are centered, like the center patch, but without a rule.
Do not allow the focus to drift from the active fullscreen client when using focusstack().
Make new clients attach above the selected client, instead of always becoming the new master. This behaviour is known from Xmonad.
Make new clients get attached and focused in the stacking area instead of always becoming the new master. It's basically an attachabove modification.
+-----------------+-------+
| | |
| | P |
| | |
| N +-------+
| | |
| | |
| | |
+-----------------+-------+
New Behaviour :
+-----------------+-------+
| | |
| | N |
| | |
| P +-------+
| | |
| | |
| | |
+-----------------+-------+
+-----------------+-------+
| | |
| | P |
| | |
| +-------+
| | |
| | N |
| | |
+-----------------+-------+
Make new clients attach below the selected client, instead of always becoming the new master. Inspired heavily from the atttachabove patch. A new version of the patch also allows this behaviour to be toggled. I have this bound to mod+tab, over-riding the default behaviour of mod+tab. This change is not included in the patch.
Add the following to your keys array to bind mod+tab to toggle attach below.
{ MODKEY, XK_Tab, toggleAttachBelow, {0} },
New clients attach at the bottom of the stack instead of the top. I find this to be the least obtrusive attachment behavior, since no existing clients are ever moved, only resized.
Attachdirection is a merge of 1)attachabove, 2)attachaside, 3)attachbelow, 4)attachbottom and 5)attachtop
To switch between the behaviors change the value of attachdirection in config.
For default behavior leave it at 0
.
New client attaches below the last master/on top of the stack.
Behavior feels very intuitive as it doesn't disrupt existing masters
no matter the amount of them, it only pushes the clients in stack
down. In case of nmaster = 1
feels like attachaside
Is included in attachdirection
By default, windows that are not visible when requesting a resize/move won't get resized/moved. With this patch, they will.
This patch will make dwm run "/.dwm/autostart_blocking.sh" and
"/.dwm/autostart.sh &" before entering the handler loop. One or both of these
files can be ommited.
Be aware that dwm will not startup as long as autostart_blocking.sh is running
and will stay completely unresponsive. For obvious reasons it is generally a
bad idea to start X-applications here :)
This patch changes the taskbar to be more like awesome. To be specific, it:
- shows all tasks in the current tag in the taskbar at all times
- clicking on an unfocused window's title in the taskbar focuses that window
- clicking on a focused window's title in the taskbar hides that window
- clicking on a hidden window's title in the taskbar unhides and focuses that windowSince this patch relies on knowing how big everything is in the taskbar, make sure to adjust the buttonpress()/drawbar() functions to account for any space in the taskbar used by other patches (such as systray).
This patch allows user to change dwm's default bar height.
Change user_bh
variable in you're config.h If user_bh
is equal to 0 dwm will calculate bar height like it did before.
static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */
This patch adds variables for verticle and horizontal space between the statusbar and the edge of the screen; unlike statuspadding, which adds padding between the bar's content and the edge of the bar. This patch adds two new variables (both default to 10) to config.def.h:
vertpad
(amount of vertical padding)sidepad
(amount of padding either side of the bar)
Compatible with both top and bottom bars as well as the togglebar function. Please note the following:
- Modifies config.def.h, not config.h. You may need to add
rm config.h
to the 'clean' targets in the Makefile. - Does not add padding between the statusbar and the window clients. This is so that if you apply the fullgaps patch or similar, there will be equal space between the windows/screen edge and windows/bar.
- May need
resizehints
to be set to 0 to make the patch look proper, especially if your bar is on the bottom. Modify the 'resizehints' variable in config.def.h.
Screenshots:
This patch turns the titlebar area into a mfact-respecting tabbar showing each client's title. In tiling mode, the tabs are split into two groups (based on nmaster) at the mfact location. This maybe reminiscent of i3's tabbed layout or using the multiple instance of the tabbed program with the caveat that this patch reserves left and right hand space in the bar for dwm's tags and status area respectivly (so ideally minimize the amount of space you use for each). When you are not in tiling mode (float/monocole), a single tab bar just occupies the entire horizontal space available. Custom layouts are assumed to respect mfact and be similar to the tiling mode (and this works well with the deck patch for example), but if you need to add an exception refer to the provided config.def.h. Clicking on each tab in the bar will focus that window. This patch also incorporates a few optional niceties configurable in your config.h such as drawing a 1px border between tabs, adding an indicator to show which tags each client is on, and an option to add a bottom border to the bar.
Bartabgroups patch shown used in conjunction with the taggrid and gaps patches in tile mode:
bstack
and bstackhoriz
are two stack layouts for dwm.
+-----------------+ +-----------------+
| | | |
| | | |
| | | |
+-----+-----+-----+ +-----------------+
| | | | +-----------------+
| | | | +-----------------+
+-----+-----+-----+ +-----------------+
bstack
can be selected with [Alt]+[u], bstackhoriz
with [Alt]+[o].
Add canfocus
rule to remove the opportunity to focus certain windows. May be useful for tray applications.
centeredmaster
and centeredfloatingmaster
are two stack layouts for dwm.
centeredmaster
centers the nmaster area on screen, using mfact * monitor width & height
, with the stacked windows distributed to the left and right. It
can be selected with [Alt]+[u].
With one and two clients in master respectively this results in:
|+--------++--------++--------+| |+--------++--------++--------+|
|| || || || || || || ||
|| || || || || || M1 || ||
|| || || || || || || ||
|| S2 || M || S1 || || |+--------+| ||
|| || || || || |+--------+| ||
|| || || || || || || ||
|| || || || || || M2 || ||
|| || || || || || || ||
|+--------++--------++--------+| |+--------++--------++--------+|
+------------------------------+ +------------------------------+
centeredfloatingmaster
centers the nmaster area on screen, using mfact * monitor width & height
over a horizontally tiled stack
area, comparable to a
scratchpad. It can be selected with [Alt]+[o].
With one and two clients in master respectively this results in:
|+--------++--------++--------+| |+--------++--------++--------+|
|| || || || || || || ||
|| +------------------+ || || +--------++--------+ ||
|| | | || || | || | ||
|| | | || || | || | ||
|| | M | || || | M1 || M2 | ||
|| | | || || | || | ||
|| +------------------+ || || +--------++--------+ ||
|| || || || || || || ||
|+--------++--------++--------+| |+--------++--------++--------+|
+------------------------------+ +------------------------------+
These stack layouts can be useful on large screens, where monocle
or htile
might be either too large or forcing the user to type in a corner of the
screen. They allow for instance to center the editor while being able to keep
an eye on background processes (logs, tests,...)
A little patch to center the WM_NAME of the currently selected window on the status bar.
Add an iscentered
rule to automatically center clients on the current
monitor.
This patch provides the ability to assign different weights to clients in their respective stack in tiled layout. It implements a new function setcfact which will modify the cfact-value for the currently selected client. It accepts the following values:
- A positive float to increase a clients weight, thus increasing the space the client is allocated in its current stack.
- A negative float to decrease a clients weight, thus decreasing the space the client is allocated in its current stack.
- A zero-value float to reset a clients weight to default.
Default cfact-value for each client is 1.0. If a client is assigned a cfact value of 0.5 it will be allocated half of the space other clients would be allocated. If a client is assigned a cfact value of 2.0 it will be allocated twice the space other clients would be allocated. The following illustrates the behavior. The clients cfact-values are represented by floats inside the clients rectangles.
| | 0.5 |
| 1.0 +----------+
+----------+ |
| | 1.0 |
| +----------+
| 2.0 | |
| | 1.0 |
+----------+----------+
-----------------------------------
Mod-H +0.25 Increase cfact
Mod-L -0.25 Decrease cfact
Mod-O 0.00 Reset cfact
This patch modifies the tile() layout to limit the maximum number of visible clients per tag. Out-of-limit windows are arranged behind the visible ones in the slave area.
| -1/3 | | 2/3 |
+-----------+-----------+ +-----------+-----------+
| | | | | |
| | 2 | | | |
| | | | | |
| 1 +-----------+ | 1 | 2 |
| | | | | |
| | 3 | | | |
| | | | | |
+-----------+-----------+ +-----------+-----------+
cpt=-1 cpt=2
Rebuilding dwm to change font or color can become annoying. This patch solves this problem allowing to set these parameters through command line New command line options look like the same in dmenu:
- -fn dwm font
- -df dmenu font
- -nb normal background color
- -nf normal foreground color
- -sb selected background color
- -sf selected foreground color
- -dnb normal background color in dmenu
- -dnf normal foreground color in dmenu
- -dsb selected background color in dmenu
- -dsf selected foreground color in dmenu
This patch lets you change the foreground and background color of every statusbar element. Simply change the RGB values in the config.def.h.
This patch adds an extra layout to dwm called col
in which the windows in the
master area are arranged in colums of equal size. The number of columns is
always nmaster + 1, and the last column is a stack of leftover windows just
like the normal tile layout. It effectively acts like the default tiling mode,
except provides for vertical instead of horizontal master windows.
This patch tweaks the tagging interface so that you can select multiple tags for tag or view by pressing all the right keys as a combo. For example to view tags 1 and 3, hold MOD and then press and hold 1 and 3 together. This makes selecting multiple tags very easy and fluid.
The patch adds two functions that you have to know about: combotag and comboview. Replace the tag and view functions with these in TAGKEYS and any other places you want. combotag and comboview are totally compatible with tag and view so you could replace all usages if you wanted.
Allow dwm to execute commands from autostart
array in your config.h file.
And when you exit dwm all processes from autostart
array will be killed.
"mpd-notification", NULL,
"hsetroot", "-center", "/usr/home/bit6tream/pic/wallapper.png", NULL,
"xrdb", "/usr/home/bit6tream/.config/X/Xresources", NULL,
"sh", "-c", "while :; do dwmstatus.sh -; sleep 60; done", NULL,
"dunst", NULL,
"picom", NULL,
NULL
};
Commands from array are executed using execvp().
So if you need to execute shell command you need to prefix it with
"sh", "-c"
(change sh
to any shell you like).
Create cropped views of existing windows to display only part of them,
typically to reclaim screen space from badly framed videos or programs and
websites with terrible designs.
Look at the changes made to config.def.h
: pass 1
to resizemouse
to create
a cropped window and to movemouse
to move the underlying window in the crop.
{ ClkClientWin, MODKEY|ShiftMask, Button3, resizemouse, {.i = 1} },
Cropped windows are always in the floating state, use togglefloating
(mod-shift-space
by default) to uncrop and restore the underlying window to
its original size and state.
Sets _NET_NUMBER_OF_DESKTOPS and _NET_CURRENT_DESKTOP on root to appropriate values. Note that 'appropriate' for these values don't make sense as xprop -root output, since dwm uses them at bitwise but xprop displays them in base ten. In other words, if you have 4 desktops, _NET_NUMBER_OF_DESKTOPS is actualy 0b1111 but xprop displays this as 15. I'm ok with this, because the end-user (program, script, w/e) can always parse this appropriately. The same goes for _NET_CURRENT_DESKTOP: if you have desktops 1 and 3 selected, the value is 0b1010, but xprop shows this as 10. This isn't a problem. I should note that in this case, _NET_NUMBER_OF_DESKTOPS does not exactly conform to EWMH specifications: in reality, there are many more 'desktops' than 15 (in the above example), as any combination of 1, 2, 3 or 4 of the availables tags can be considered one desktop. _CURRENT_DESKTOP will, however, always be less that _NET_NUMBER_OF_DESKTOPS, so I'm happy with that. I wrote this patch mainly for myself, as I have a script for tabbed that uses it (I will upload this later). I am open to feedback/contstructive criticism. Email is at the bottom.
Cycles through all avaiable layouts using MOD-CTRL-, and MOD-CTRL-. This adds a "NULL, NULL" layout at the end of the list, which should always be the last layout in your list. This is probably only "useful" if you are using a lot of layouts. Inspired by this post. Hopefully whoever wanted this sees it and no longer has to duplicate functions.
deck
is a dwm-layout which is inspired by the TTWM window manager.
It applies the monocle-layout to the clients in the stack.
The master-client is still visible. The stacked clients are like
a deck of cards, hence the name.
The vanilla patch doesn't respect the master-area which is defined by the rmaster-patch. To make it work with the rmaster-patch apply the dwm-deck-rmaster patch on top of the dwm-deck patch.
The vanilla patch doesn't work properly with patches which add gaps. This means that when the deck-layout is activated gaps are omitted. To make it work with the tilegap-patch apply the dwm-deck-tilegap patch on top of the dwm-deck patch.
+-----------------+--------+
| | |
| | S1 |
| | |
| M +--------+
| | |
| | S2 |
| | |
+-----------------+--------+
Deck :
+-----------------+--------+
| | |
| | |
| | |
| M | S1 |
| | |
| | |
| | |
+-----------------+--------+
Make dwm respect _MOTIF_WM_HINTS property, and not draw borders around windows requesting for it. Some applications use this property to notify window managers to not draw window decorations. Not respecting this property leads to issues with applications that draw their own borders, like chromium (with "Use system title bar and borders" turned off) or vlc in fullscreen mode.
This patch adds a default transparency parameter to config.h, which specifies the transparency, all windows are started with. Additionally it adds some shortcuts:
- MOD + Shift + s -> decrease transparency of current focused window
- MOD + Shift + d -> increase transparency of current focused window
- MOD + Shift + f -> set window to default opacity (.75)
It is based on the transparency patch of Stefan Mark.
Updates the position of dmenu to match that of topbar
. If topbar
is 0
,
then dmenu will appear at the bottom, and if topbar
is 1
, dmenu will appear
at the top.
The patch modifies config.def.h
. Make sure to update config.h
accordingly,
if the file exists.
This patch lets you resize the split in the tile layout (e.g. modify mfact) by holding the modkey and dragging the mouse. This behavior is similar to the way i3 handles resizing tiling splits.
This patch will enable an extra status bar in dwm. The extra bar can be toggled
along with the standard bar or independently.
The status bar text can be set as follows:
xsetroot -name "top text;bottom text"
Simple dwmc client using a fork of fsignal to communicate with dwm.
See
here
for an example of usage with sxhkd.
dwmc setmfact +0.05
This patch adds support for using a command/control FIFO for dwm. I've added commands that map 1-1 with the existing keybind actions. You can use this patch to script dwm. As an example the following sequence of commands starts 2 terminals on each of the 2 monitors.
sleep 0.5
echo term > /tmp/dwm.fifo
sleep 0.5
echo focusmon+ > /tmp/dwm.fifo
sleep 0.5
echo term > /tmp/dwm.fifo
sleep 0.5
echo term > /tmp/dwm.fifo
The sleep in between is currently needed to avoid buffering up more than a single command. You may experiment with the actual sleep value. Similarly you can modify your config.h and add more commands that you may want to execute (like tabbed-surf or similar).
I like my wallpapers. Also i found it kind of unintuitive that you can not
toggle the last tag out of view. So i created a patch to allow no tag at all to
be selected.
With this patch, dwm will start with no tag selected. When you start a client
with no tag rule and no tag selected, it gets opened in the first tag.
Version 6.2 has a startontag
option(default 1) which tells dwm to bring
the first tag in view on launch as usual. 0 means no tag active at start.
a 6.1 update and extension to current desktop. adds EWMH support for _NET_NUMBER_OF_DESKTOPS, _NET_CURRENT_DESKTOP, _NET_DESKTOP_NAMES, and _NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs that request workspace information. for example, polybar's xworkspaces module
This allows the user to change size and placement of floating windows using only the keyboard. It also allows for temporary vertical and horizontal extension of windows similar to other WMs fill command. This patch is inspired by maximize and moveresize but fixes a lot of problems I had with those patches. It also includes the functionality of save floats judging by it's description.
This patch will enable an extra status bar in dwm in a similar manner to the
dualstatus patch. If the primary status is at the top via topbar
then the
extra status bar will be placed at the bottom and vice versa.
The status bar text can be set as follows:
xsetroot -name "top text;bottom text"
Support for an alternative delimiter is available and the delimiter can be
changed by editing the statussep
variable.
Only allow clients to "fullscreen" into space currently given to them. As an example, this will allow you to view a fullscreen video in your browser on one half of the screen, while having the other half available for other tasks.
This patch provides a status bar that shows the titles of all visible windows (as opposed to showing just the selected one). When the titles don't completely fit, they're cropped. The title of the selected window is inverted.
This patch adds two new layouts (spiral
and dwindle
) that arranges all
windows in Fibonacci tiles: The first window uses half the screen, the second
the half of the remainder, etc. ASCII art and a real screenshot of the spiral
arrangement can be seen below.
| | | | | |
| | 2 | | | 2 |
| | | | | |
| 1 +--+--+-----+ | 1 +-----+-----+
| | 5|-.| | | | | 4 |
| +--+--+ 3 | | | 3 +--+--+
| | 4 | | | | | 5|-.|
+-----------+-----+-----+ +-----------+-----+-----+
spiral dwindle
This patch replaces the tile
layout with a more flexible version. The
features include the following:
- tile like the original version (left single master, right stack)
- left/right/top/bottom n-master, right/left/bottom/top/no stack/deck (deck is
like
monocle
in the stack area) - per-tag configuration
It therefore provides the following additional possibilities:
tile
for left-handed people- compare multiple files with one other each at a time without switching between views
The patch incorporates and expands the following patches:
- bottom stack (
bstack
andbstackhoriz
) - nmaster
- pertag
This patch allows you to specify a different border color for floating windows.
Inspired by smartborders.
This patch adds 5 extra variables to the 'rules' array in config.def.h
. These are:
floatx
,floaty
,floatw
,floath
(if the window has the ruleisfloating
, the window will spawn with the geometry specified by these vairables)floatborderpx
(border width when window is floating)
Please note that this patch needs rm config.h
to be added to the Makefile
.
Screenshots:
This patch provides the ability to focus the tag on the immediate left or right of the currently focused tag. It also allows to send the focused window either on the left or the right tag.
--------------------------------------------------------------------
Mod-Left Focus tag on the left, if any.
Mod-Right Focus tag on the right, if any.
Mod-Shift-Left Send focused window to tag on the left, if any.
Mod-Shift-Right Send focused window to tag on the right, if any.
By default, dwm response to client requests to _NET_ACTIVE_WINDOW client
messages by setting the urgency bit on the named window.
This patch activates the window instead.
Both behaviours are legitimate according to the
cursed spec
One should decide which of these one should perform based on the message
senders' untestable claims that it represents the end-user. Setting the urgency
bit is the conservative decision. This patch implements the more trusting
alternative.
It also allows dwm to work with wmctrl -a
and other external window
management utilities.
- Selects the next window having the urgent flag regardless of the tag it is on
- The urgent flag can be artificially set with the following xdotool command on
any window:
xdotool selectwindow -- set_window --urgency 1
New variable panel[4] saves space at the borders of the screen for the external panel.
| | panel[0] | |
+-+--------------+-+
| | | |
|2| |3|
| | | |
+-+--------------+-+
| | panel[1] | |
+----------------+-+
In tiled and monocle layouts this space becomes borders of the windows; in floating layout windows attach to these borders
When there is only one master window in tiled layout with panel[2] set not to zero its right border gets out of the screen
Send "fake signals" to dwm for handling, using xsetroot. This will not conflict
with the status bar, which also is managed using xsetroot.
Usage areas can for example be setting layout through dmenu, or other external
applications.
A signal can be sent for example in this way xsetroot -name "fsignal:1"
to
send the signal '1'.
Signal handlers are defined in config.h as:
/* signum function argument*/
{ 1, setlayout, {.v = 0} },
...
};
This can then be triggered through dmenu with this script:
layouts="echo -e tiled\ncolumns\n..."
layout=$($layouts | dmenu "$@")
if [[ "$layout" == "tiled" ]];then xsetroot -name "fsignal:1"; fi
...
...or however you want to use it :)
This patch adds gaps between client windows. It is similar to gaps, but contains additional functionality:
- it also adds outer gaps (between the clients and the screen frame), as well as a gap between the master and stack area,
- it adds keybindings to change the gap size at runtime: [Alt]+[-]/[Alt]+[=] to decrease/increase the gap size and [Alt]+[Shift]+[=] to set it to zero.
The configuration variable gappx
contains the default gap size.
Applies the monocle layout with the focused client on top and hides the bar. When pressed again, shows the bar and restores the layout that was active before going fullscreen.
This patch is an altered gridmode layout for dwm, which arranges the windows in a grid. Instead of using a regular grid, which might leave empty cells when there are not enough windows to fill the grid, it adjusts the number of windows in the first few columns to avoid empty cells.
This patch modifies the tile layout to add a gap between clients that helps to
visually differentiate between selected borders and normal borders and so
provides an additional visual hint to identify the currently selected client.
OTOH, there's no gap between a client and the screen frame in order to reduce
the waste of screen space.
To configure the gap size just set the configuration variable gappx
.
There is a variation of the patch for the xtile layout also.
gestures
adds support for simple mouse gestures to dwm. The patch assumes
make has been run and adds a gestures array to config.h. A gesture can call any
dwm function. I usually call spawn.
This patch adds an extra layout mode to dwm called grid
in which the windows
are arranged in a grid of equal sizes. It comes in very handy, especially with
tools that operate on multiple windows at once; e.g. Cluster SSH.
This patch prevents dwm from drawing tags with no clients (i.e. vacant) on the bar. It also makes sure that pressing a tag on the bar behaves accordingly by not reserving reactive regions on the bar for vacant tags. It also stops drawing empty rectangles on the bar for non-vacant tags as there is no need anymore to distinguish vacant tags and it offers a more visible contrast than if there were filled/empty rectangles.
Dwm's built-in status bar is now only shown when HOLDKEY is pressed. In addition the bar will now overlay the display. This will work regardless of the topbar setting. This is meant to be used with the bar off my default
None of the togglebar code has been removed, although you might want to remove the togglebar binding in your config.def.h.
This patch is a variant of gaplessgrid. It arranges windows in a grid pattern in which every window is roughly the same size, adjusted such that there are no gaps. However, this layout arranges the windows in a horizontal grid, rather than a vertical grid.
+--------+--------+
| | |
| | |
+-----+--+--+-----+
| | | |
| | | |
+-----+-----+-----+
gapless_grid
+--------+--------+
| | |
| +--------+
+--------+ |
| +--------+
| | |
+--------+--------+
This patch provides keybindings to perform 'in place' rotations (in that
clients are rotated but the focus position in the stack is unchanged).
The argument for the inplacerotate
function affects the behavior of
the rotation as follows:
-1/+1 -> CCW/CW inplace master OR stack rotation (based on focus position)
Shifts the ordering of clients in the master / stack area without worrying
clients will transfer between the master / stack (nmaster) boundry. If
your current focus is in the master area, clients in the master rotate and
stack clients are left alone. And inversely, if you're focused on a client
in the stack, stack clients are rotated but master clients are left alone.
-2/+2 -> CCW/CW inplace all clients rotation.
This simple patch lets you define custom insets from each edge of the screen. It could be used to put DWM out of the way for a bar, for example.
Property for clients to avoid accidental termination by killclient
for sticky
windows.
With this patch, handling key input is done with keycodes instead of keysyms. This way, input is independent from keyboard layout (you can get keycodes using xev to adapt config.h)
This patch provides key modes (like in Vim). There are two key modes:
-
- `COMMANDMODE`: In this mode any key is grabbed and only the registered
command keys have any effect.
- `INSERTMODE`: This is the normal key mode, in which the original key
bindings of dwm and applications are effective and text can be entered.
- keymodes: the minimal patch
- vim-keymodes: This patch tries to emulate the key bindings of Vim. Therefor it includes additional functions, which depend on the flextile patch.
This patch lets you specify whether a key binding should be executed at the
KeyPress or KeyRelease event. Executing on KeyRelease fixes bugs such as
scrot -s
failing to execute from a key binding
due to keys not being released in time.
Note that the new parameter must be added to all non-standard key bindings
manually after patching.
A working scrot -s
key binding:
{ KeyRelease, 0, XK_Print, spawn, SHCMD("scrot -s") },
Or to only display the bar while the toggle key is held down (requires that it
is hidden to start with), add:
{ KeyRelease, MODKEY, XK_b, togglebar, {0} },
An alternative is to put a tiny sleep right before executing scrot.
{ ControlMask, XK_Print, spawn, SHCMD("sleep 0.2; scrot -s") },
Kills all visible clients that are unselected. That is, after running
killunsel
, only the selected client will remain. The rest will not only be
not visible, but they will have been killed.
This is essentially equivalent in idea to :tabonly (albeit per-client, not
per-"tab") in vim.
The bar at the top will have buttons that you can click to launch programs and commands. In config.h make a command:
static const char* surf[] = { "surf", "duckduckgo.com", NULL };
Then add it to the launchers array:
/* command name to display */
{ surf, "surf" },
};
The result will be a little button that says "surf" at the top bar. When you click it, it launches surf. Have fun :D
Moves the layout symbol in the status bar to the left hand side.
This patch provides an mechanism to easily jump between any 2 clients, or to swap any 2 clients through shortcuts by introcuding mark. The mark is global, and only one mark is allowed at the same time. The marked client is distinguished from other clients by having a different border color. This patch adds 3 functions to dwm:
- togglemark - mark/unmark current focused client.
- swapclient - swap focused client with marked client
- swapfocus - swap focus with mark.
static const char selmarkcolor[] = "#775577"; /*border color for marked client on focus*/
{ MODKEY, XK_semicolon,togglemark, {0} },
{ MODKEY, XK_o, swapfocus, {0} },
{ MODKEY, XK_u, swapclient, {0} },
Some ideas for combinations of key mappings:
- togglemark x2 clear the mark
- swapclient, swapfocus shift the client to another client frame without losing focus
- swapclient, togglemark x2 swap 2 clients and clear the mark
- swapfocus, togglemark x2 jump to mark and clear the mark
These patch provide helper functions for maximizing, horizontally and vertically, floating windows using keybindings. Insert the bindings into the keys list. Here is an example:
{ MODKEY|ControlMask|ShiftMask, XK_l, togglehorizontalmax, NULL },
{ MODKEY|ControlMask|ShiftMask, XK_j, toggleverticalmax, NULL },
{ MODKEY|ControlMask|ShiftMask, XK_k, toggleverticalmax, NULL },
{ MODKEY|ControlMask, XK_m, togglemaximize, {0} },
monocle_count
prints the total number of clients and the number of the
currently activated client beside the symbol of the monocle layout, while the
current release prints only the number of total clients within the symbol.
Always display the the monocle-symbol as defined in config.h if the monocle-layout is activated. Do not display the number of open clients in the current tag.
This patch moves floating windows if their monitor gets changed.
This patch was culled from 'exresize' which in turn is based on 'maximize', 'moveresize', and 'savefloats' This patch separates out the 'explace' (rename here 'moveplace') functionality in case that is all you need, or if you want to use this with other patches. Makes a window floating and 1/3rd the height and 1/3rd the width of the screen. The window is then positioned in either the center, or one of 8 cardinal directions depending on which key is pressed. MOD+
asd
zxc
with s
being the center.
This changes allows you to move and resize dwm's clients using keyboard bindings.
-
- Put the following `moveresize()` function somewhere in your `dwm.c`,
after the line which includes the config.h file:
-
- Add a moveresize() function definition in dwm.c below the line:
`static void movemouse(const Arg *arg);`
-
- Insert the bindings into the keys list. Here is an example which uses the
arrow keys to move (mod+arrow) or resize (mod+shift+arrow) the selected
client:
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.
Control Music Player Daemon via keybinds.
By default MODKEY + Escape
stops/pauses the current song or plays it
depending on the state of the player. If the song is a file on disk it pauses
it, if it's a stream it stops it since pause on a stream doesn't make sense.
MODKEY + F1
goes to previous song.
MODKEY + F2
goes to next song.
libmpdclient
is needed for this patch to work.
This patch allows you to use a single key combination to trigger different
functions based on the number of times you press the key combination
consecutively within a short period of time. This is accomplished by modifying
the Key
struct to add a new int field npresses
which can be:
1 = Trigger keybinding on 1 keypress
2 = Trigger keybinding on 2 successive keypresess
3 = Trigger keybinding on 3 successive keypresess
...n = Trigger keybinding on n successive keypresses
The maximum / last value set for the key combination can also be triggered by holding the key down. In the example added to the config.def.h, the tiling layout is set when Mod+w is tapped once, float layout is set when Mod+w is tapped twice, and monocole layout is set when Mod+w is tapped three times (or held down).
Allows for the creation of multiple scratchpad windows, each assigned to different keybinds. On pressing the keybind the window will either:
- Spawn based on the given command, if it's not already running
- Toggle visibility of the window
A new field in the rules array is added to associate the command with the corresponding rule. Works well with floatrules for window positioning.
This patch allows you to change the names of dwm's tags while it's running. By
default there is a 16 byte limit on tag names, and it uses dmenu to prompt for
tag names. The 6.1 patch is for the current tip
(cdec9782a1789bd5c3a84772fd59abb9da288597). It works with 6.0 but you should
add -D_POSIX_C_SOURCE=2 to CPPFLAGS or you will get implicit delcaration
warnings for popen and pclose.
The prepend
version prepends the tag name with a short string which is used
as a format string for sprintf
which gets the tag number as the argument. By
default a tag name "foo" given to tag 5 will become tag "5:foo".
- Increment or decrement the selected tag
- shiftview.c is a better implementation of this, allowing you to rotate the selected tags
This patch restores the ability to have multiple clients in the master area of the tiled layout. This feature was dropped from vanilla dwm in version 4.4. The ntile mode from below is included in dwm as of version 6.0. The figures show how tiling will work when the patch is applied.
+----------+------+
| | |
| +------+
|----------| |
| +------+
| | |
+----------+------+
nbstack (-|-)
+--------+--------+
| | |
| | |
|-----+--+--+-----+
| | | |
| | | |
+-----+-----+-----+
Remove the border when there is only one window visible.
Enable modifying dmenu in config.def.h which resulted previously in a compilation error because two lines of code hardcode dmenu into dwm. This includes:
- renaming dmenucmd-variable
- removing dmenumon-variable
- removing dmenu completly
Doesn't show the title.
This grid layout gives you the option of determining the row count, which is
set by nmaster + 1
. So except for giving you a customizable grid, you also
get the ability to show everything in one row, or in one column (row = 1
and
row = client count
, respectively). When calculating the cell dimensions
utilization trackers are used to make sure all pixels are utilized. The effect
is that no overlays or no gaps are present, but on the other side all cells are
not always of equal size.
Example: splitting 2560 pixels into 6 cells gives you 2 cells with a width of
426 pixels and 4 cells with a width of 427 pixels. No gaps, but not equal size,
an off trade I believe many would be comfortable with.
I personally want the presence of only 2 clients to always result in a vertical
split. If you don't like this feature set the FORCE_VSPLIT to 0 in config.h
.
On the default keybinding of Alt-Shift-Q, it is possible to press it by
accident, closing all your work. This patch makes it so dwm will only exit via
quit() if no windows are open.
Because people may have different daemons, etc. open, you can configure the
count considered to be 'empty' via EMPTY_WINDOW_COUNT
.
This relatively simple patch adds pango support for the status bar. This not only adds TrueType font support but also opens a couple of interesting possibilities that are not possible under barebone xft: Simple markup for status messages (optional in 6.0 patch, enable/disable it in your config.h) using pango markup. So you can format your status messages specifying fg/bg colors, sizes, sub/superscripts, underline, emphasis, bold, etc. You can do dynamic font switching, also! To play safe with the rest of the status bar, markup support is restricted to the status message area over which you have direct control. Fallback fonts, so you can use -for example- some set of iconic fonts as your second family: "DejaVu Sans, Icons 8" (see below). There are tons of monochromatic nice looking TTF icons around the web these days as webfonts are becoming more and more popular. Notice that you can also use the more powerful font switching enabled by pango markup to achieve the same goal. Also don't be mislead by the fact that fontconfig understands descriptors like "DejaVu Sans, Icons-8" or even font sequences defined as alias in your fonts.conf. xft will pick one font once and for all, not on a char-by-char basis. The Icons family is a non-overlapping merge of Awesome and Ionicons fonts I've made for my statusbar. In the latest patch (which is after version 6.2) there are a lot of changes to drw.c/h code base (maybe there is a better way of doing things, but it works as it is).
More general approach to taglayouts patch. This patch keeps layout, mwfact, barpos and nmaster per tag.
Restrict system operations on OpenBSD using pledge(2).
pushup
and pushdown
provide a way to move clients inside the clients list.
#include "push.c"
...
{ MODKEY|ControlMask, XK_j, pushdown, {0} },
{ MODKEY|ControlMask, XK_k, pushup, {0} },
push_no_master
is the same as the regular push
patch, but it does not push
up nor push down into the master area. We have zoom() for that.
Basically, this patch implements per-window keyboard layout support in dwm. It makes dwm remember current keyboard layout when a window is unfocused, and restore it back when that window is focused again.
Andreas Amann pointed out that "you cannot switch between tags per mouse if an alternate layout is activated". He kindly created a patch that fixes this: see ml.
Remove the border when there is only one window visible. Simpler reimplimentation of noborder. Heavily inspired by uselessgap. As this patch basically adds the borderless functionality of uselessgaps, there is no point in using both patches.
Resets the layout and mfact if there is only one client visible. This applies cleanly to vanilla dwm, but is mostly only useful alongside the pertag patch, since otherwise all layouts and mfacts will be reset. You can also set a binding to trigger this on demand, see the new call to resetlayout in config.def.h.
By default, windows can only be resized from the bottom right corner. With this Patch, the mouse is warped to the nearest corner and you resize it from there.
dwm can now be restarted via MOD+CTRL+SHIFT+Q or by kill -HUP dwmpid
In addition, a signal handler was added so that dwm cleanly quits by kill -TERM
dwmpid.
Also see selfrestart.
An alternative might be to put something like this in ~/.xinitrc
:
ssh-agent dwm
done
And then just quit/kill dwm
.
Enables swapping the master- and stack area such that the master-client appears on the right and the stack-clients appear on the left.
A variable and a toggle-function are introduced to achieve this behaviour which are set in the config.h:
- The rmaster-variable can be set to 1 to make the right area the default master-area
- The togglemaster-function can be used to swap the master- and stack-areas dynamically.
Stack rotation moves a client from the bottom to the top of the stack (or the other way round). This effectively rotates the clients by one position clockwise (or CCW, respectively). It should play well with arbitrary stack layouts and nmaster values. One may think of it as moving the zoom through the list of clients, very much in the same way as scrolling moves the view port around a pane.
Runtime useless gaps This patch adds gaps like tilegap that are resizeable at runtime like fullgaps, but like uselessgap it removes gaps and borders when in monocle mode. This patch also incorporates the noborder patch, but without the check for 'is not fullscreen', to make it work properly with fakefullscreen.
You might want to set resizehints in config.h to zero to get smooth animations when increasing or decreasing gaps.
This patch saves size and position of every floating window before it is forced into tiled mode. If the window is made floating again, the old dimensions will be restored.
Solarized is a color scheme by Ethan Schoonover which exists in a dark and a light variant. This patch allows you defining more then one color-Scheme in the colors array in config.def.h (or config.h) and cycle through the schemes by schemeCycle() function (bound to Mod+Shift+z) and toggle between corresponding light and dark schemes with schemeToggle() function (bound to Mod+Shift+t). In the example config.def.h there are first defined the colors for the dark variant of solarized theme, after that the colors for the light variant, and then the original dwm colorscheme, wich has no corresponding light scheme. If the last one is selected shemeToggle() will do nothing, but one can cycle to the dark scheme (or the light one) and then toggle between light and dark. If there where colors defined after the original scheme, then schemeToggle() would toggle between original and the consecutive.
The scratchpad patch allows you to spawn or restore a floating terminal window.
It is usually useful to have one to do some short typing.
A tool like detach (http://detach.sourceforge.net) turns it into a launchpad
for X applications.
By default your terminal (st) is used, and the default key binding is
MODKEY+XK_grave
. A config.def.h
change is included in the patch.
This patch enables multiple scratchpads, each with one asigned window. This enables the same scratchpad workflow that you have in i3. Scratchpads are implemented as special tags, whose mask does not apply to new spawned windows. To assign a window to a scratchpad you have to set up a rule, as you do with regular tags. Windows tagged with scratchpad tags can be set floating or not in the rules array. Most users would probably want them floating (i3 style), but having them tiled does also perfectly work and might fit better the DWM approach. In case they are set floating, the patch moves them to the center of the screen whenever they are shown. The patch can easily be modified to make this last feature configurable in the rules array (see the center patch). The togglescratch function, borrowed from the previous scratchpad patch and slightly modified, can be used to spawn a registered scratchpad process or toggle its view. This function looks for a window tagged with the selected scratchpad tag. If it is found its view is toggled. If it is not found the corresponding registered command is spawned. The config.def.h shows three examples of its use to spawn a terminal in the first scratchpad tag, a second terminal running ranger on the second scratchpad tag and the keepassxc application to manage passwords on a third scratchpad tag. If you prefer to spawn your scratchpad applications from the startup script, you might opt for binding keys to toggleview instead, as scratchpads are just special tags (you may even extend the TAGKEYS macro to generalize the key bindings).
This patch does two things:
- It removes the code that generates the bar, but still leaves a "toggleable" area.
- On X events, it writes all the tag and layout information to a user defined file.
This allows any bar that reads stdin to be used in conjuction with dwm.
The patch introduces 3 variables:
barheight: sets the size of the top gap in pixels(this gap remains toggleable with the togglebar function).
sepchar: sets the character used to delimitate different workspaces(see below).
tagfile: sets the path of the file to wich the tag and layout information is written to.
The tagfile uses an easy syntax.
Each tagname is prefixed with a character describing the state of that tag.
There are 4 different states:
state 'e': tag is empty and not focused
state 'E': tag is empty and focused
state 'o': tag is occupied and not focused
state 'O': tag is occupied and focused
The different tags with respective tag information are separated by the sepchar variable defined in config.h.
A simple example would be:
echo /tmp/dwm_tags| entr cat /tmp/dwm_tags | lemonbar </code>
Allows a specific application to fake a full screen while the rest behave as usual,
it's based on Jan Hendrik Farr's patch, fakefullscreen.
Includes a modification to config.def.h in order to add a new member to Rules struct,
called "isfakefullscreen", set it to one for all the applications you want to
fake a full screen.
Restart dwm without the unnecessary dependency of an external script.
Also see restartsig.
An alternative might be to put something like this in ~/.xinitrc
:
ssh-agent dwm
done
And then just quit/kill dwm
.
This patch allows you to change border pixels at runtime.
----------------------------------------------------
Mod-Shift-minus +0.25 Increase borderpx
Mod-Shift-plus -0.25 Decrease borderpx
Mod-Shift-numbersign 0.00 Reset borderpx
You might want to set resizehints in config.h to zero to get smooth animations
when increasing or decreasing border pixels.
This patch addresses the multi-monitor setup. Instead of having separate tags
for every monitor there is just one list of tags for all monitors. Instead of
moving windows from one monitor to the other, the desired tag from the other
monitor can just be selected and all windows will be drawn on the current
monitor.
Several deep changes needed to be made:
- Macro ISVISIBLE expects a second parameter, the monitor
- Monitor->clients and Monitor->stack were moved to the global variable
Clientlist cl. All monitors refer to this one list.
- A new method attachclients was added. When changing between tags this
function ensures that all clients are pointing to the right monitor.
singular borders
changes the way DWM handles the borders. Firsty, borders
against the left, bottom and right screen edges are removed (they are placed
off-screen) and secondly, borders between clients now overlap eachother.
+-----------------+--------+
| || |
| || S1 |
| || |
| M |+=======|
| || |
| || S2 |
| || |
+-----------------+--------+
New Behaviour :
+-----------------+--------+
|
| S1
|
M +--------+
|
| S2
|
+ + +
- In a multi-monitor setup, you will see monitor one's borders on monitor two
and vice-versa. This is because the borders on screen edges are simply placed
off-screen.
This patch makes dwm obey even "soft" sizehints for new clients. Any window
that requests a specific initial size will be floated and set to that size.
Unlike with "fixed size" windows, you are able to resize and/or unfloat these
windows freely - only the initial state is affected.
This version adds isfreesize
rule to config which if set to 1 will enable
the functionality of the patch. If rules for the given client aren't set in
config dwm will set it to 1
and the client will benefit from isfreesize
rule if it has specific initial size requirements.
isfreesize
rule overrides isfloating
rule in config.
This version of the patch is honestly of limited utility since there are many
clients that will abuse it.
There is no configuration for this version of the patch.
Inspired by the xmonad feature of the same name.
Borders are only drawn when:
- client window is floating
- >1 tiled clients are visible
- floating layout
Spawns programs from currently focused client's working directory. See this
blog post for more information.
Currently the patch does not spawn into the cwd when the path
to the working directory is 15 characters of length. For example
spawning a new shell from a directory called ~/abcdefghijklm will
open the shell in the home directory instead. This happens because
the cwd to open is taken from the dwm status which gets truncated at a
certain depth using ellipses (.../path/to/long/dir/name).
This patch provides comprehensive utilities for managing the client stack. It
implements two new commands: focusstack
(which is a replacement for the
original focusstack
command) and pushstack
. The first one is for focusing
clients while the second one moves clients around the stack. Both commands take
the same kind of argument:
- Pass
PREVSEL
to focus/push the previously selected client in the current
tagset.
- Pass
INC(+/-inc)
to focus/push relatively to the selected client. This will
wrap around the stack limits.
- Pass a positive number to focus/push relatively to the beginning of the
stack. Out of limit values will be truncated to the position of the last
visible client and won't wrap
around.
- Pass a negative number to focus/push relatively to the last visible client in
the stack. Here -1 means the last client, -2 the previous to last client, etc.
Out of limit values will be truncated to the position of the first visible
client (0) and won't wrap around.
There are two parallel sets of bindings: one for the focus*
family and the
other for the push*
family. The keys are the same for both sets but they do
differ in the modifiers: simply MODKEY
for the focus*
family and
MODKEY|ShiftMask
for the push*
family.
---------------------------------------
\ PREVSEL Previously selected
j INC(+1) Next to selected
k INC(-1) Previous to selected
q 0 First position
a 1 Second position
z 2 Third position
x -1 Last position
The q
, a
, z
keys are aligned more or less vertically in the us keyboard
layout. They are intended to be used as quick positional shortcuts to specific
applications. So if you have 9 tags you get 9*3=27 shortcuts in a two-level
hierarchy of clients. The key is above the
Tabkey and it's intended to complement the "move to previously selected tag" function of dwm at the intra-tag level. Finally, the
xkey is like "I don't care so much about you just right now but you can still live in this tag". Notice that
MODKEY|ShiftMask+qcollides with the default binding for quitting dwm, which stacker changes to
MODKEY|ShiftMask+BackSpace`.
stackmfact
enables you to vertically resize clients in the stack, like the
regular mfact enables you to horizontally resize the master client(s).
+-----------------+-------+
| | |
| | S1 |
| | |
| M +=======|
| | |
| | S2 |
| | |
+-----------------+-------+
smfact > 0.00 (new behaviour):
+-----------------+-------+
| | S1 |
| +=======+
| | |
| M | |
| | |
| | S2 |
| | |
+-----------------+-------+
This patch forces your status bar to stay put on a single monitor in a multi-monitor setup, no matter where your focus is. You can set which monitor you want the status bar to stay in with the statmonval value (in config.h), whose values are from 0 to (the number of monitors you have)-1. Monitors are enumerated in the order that they're picked up by dwm. Make sure to define the value in your config.h before compiling.
static const int statmonval = 0;
Status2d allows colors and rectangle drawing in your DWM status bar. See below
an example of my status bar with multi-cpu and battery.
This patch draws and updates the statusbar on all monitors.
Adds a clickable button to the left hand side of the statusbar.
The appearance of this button can be configured by modifying buttonbar in
config.def.h
ClkButton is added as the target for clicking this button.
It has been configured for now in config.def.h to spawn dmenucmd when clicked
with Button1.
This patch adds the ability to execute shell commands based on the mouse
button and position when clicking the status bar.
Fill 'statuscmds' with commands. Choose which command to run by prefixing
the status text with a raw byte of the command's index in 'statuscmds',
offset by +1 since '\0' terminates strings. statuscmds[0] runs by default
if there is no index to the left of the mouse position. The mouse button
clicked is exported as $BUTTON.
With these commands:
static const char *statuscmds[] = { "volume", "cpu", "battery" };
And root name set like this:
xsetroot -name "$(echo -e 'volume |\x02 cpu |\x03 battery')"
Clicking on 'volume |' would run volume
, clicking on ' cpu |'
would run cpu
and clicking on ' battery' would run battery
.
The cpu
script could look like this:
#!/bin/sh
1) notify-send "CPU usage" "$(ps axch -o cmd,%cpu --sort=-%cpu | head)";;
3) st -e htop;;
esac
If you have 10 or more commands, make sure to be careful when adding or
removing newline characters since '\n' is equal to '\x0a'. The problem
where having certain unprintable characters such as '\n' in the status
string can make dwm laggy is "fixed", since they are not copied to the
string that is actually drawn.
A program that sets the status for dwm such as
dwmblocks can be patched to manage
the commands while dwm only finds the location clicked in the status bar.
This way, no changes are needed in dwm when adding or reordering modules.
Instead of running a command from within dwm using the control character
as an index, the dwm-statuscmd-signal patch sends a SIGUSR1 signal to
dwmblocks with the button and control character encoded into the signal value.
The dwmblocks-statuscmd patch makes dwmblocks put each block's signal in
front of its output text and handles the SIGUSR1 signal by running the
block's command with $BUTTON exported.
This patch enables colored text in the status bar. It changes the way colors
are defined in config.h, allowing the user to define multiple color
combinations for use in their status script.
This makes the amount of horizontal and vertical padding in the status bar
into configurable options.
This padding is also applied to StatusText in an equal manner, as opposed t
just right padding.
The configurable options in config.def.h are:
horizpadbar
vertpadbar
The defaults in config.def.h leave dwm with the same appearance as pre-patch
except StatusText now has left padding in addition to right padding.
dwm releases before 5.3 read the status text from stdin. This patch is mainly a
workaround for the freezing issue caused by XSelectInput
with the previous
version of the warp patch. Some people might like to write their
status to a pipe, though.
Press MODKEY+s
(default) to make a client 'sticky'. A sticky client is visible
on all tags. This is similar to setting the client's tags
to all 1's, but with
the ability to easily return it to its original tag by toggling it off by
pressing MODKEY+s
again.
This patch adds "window swallowing" to dwm as known from Plan 9's windowing
system rio
.
Clients marked with isterminal
in config.h swallow a window opened by any
child process, e.g. running xclock
in a terminal. Closing the xclock
window
restores the terminal window in the current position.
This patch helps users spawning a lot of graphical programs from their command
line by avoiding cluttering the screen with many unusable terminals. Being deep
down in a directory hierarchy just does not make the use of dmenu feasible.
- libxcb
- Xlib-libxcb
- xcb-res
These dependencies are needed due to the use of the latest revision of the X
Resource Extension which is unsupported in vanilla Xlib.
This patch makes it possible to switch focus with one single shortcut (alt-s)
instead of having to think if you should use alt-j or alt-k for reaching the
last used window.
- Remember the previous tag and previous clients on each tag.
- If there is no previous client on the current tag (because it was moved or killed),
the next client on the current tag is focused.
Allow swapping the contents of the currently selected tag with tag N by
selecting Mod4+Shift+N.
Switch focus between the 2 columns (master or stack) easily. This patch only
has one function, it remembers the most recently focused client in the 2
columns for each tag (it is implemented by searching the stack list to find
the most recent client in the other column).
{ MODKEY, XK_n, switchcol, {0} },
Adds a rule option to switch to the configured tag when a window opens, then
switch back when it closes.
The patch modifies config.def.h
. Make sure to update config.h
accordingly,
if the file exists.
/* class instance title tags mask switchtotag isfloating monitor */
{ "Gimp", NULL, NULL, 0, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 1, 0, -1 },
};
In this example, since Firefox is configured to start with tag 9 and switchtotag
is enabled, as soon as the application starts, dwm will switch to tag 9. When
Firefox closes, dwm will switch back to the tags which were active before the
application started.
A simple system tray implementation. Multi-monitor is also supported. The tray
follows the selected monitor.
In case icons disappear when toggling the bar, try a different font size
in dwm. This has helped at least in one case with pidgin.
Transforms the monocle layout into a ''tabbed'' layout if more than one window
is present on the monocle view. Navigating from window to window is done by
clicking on the window tabs or using the usual Mod1-j, Mod1-k keys. The tabs
are arranged in a bar on top or at bottom of the screen, which can also be
displayed in the other layouts than monocle. Three display modes can be
selected at run time, auto display, permanent display and no display. In
permanent mode the tab bar is always display independently of the layout, while
in the auto mode it is displayed only with the monocle layout and in presence
of several windows.
This patch can be used as an alternative to the
tabbed tool. It differs in two ways: the
''tab'' feature is limited to the monocle mode; it works with any application
without requiring to support the XEmbed protocol nor to define in advance the
set of applications to be supported.
With the default configuration, use the key combination Mod1-w to toggle the
tab bar display. Switch focus to a window with a mouse left-click on its tab or
by using the usual Mod1-j, Mod1-k commands. Usage is also documented in the dwm
man page once the patch is applied.
The selected view (''tag'') is reminded at the right corner of the tab bar.
This feature is mainly meant to be used when the standard status bar is
disabled. In case of a multi-tag view three dots are displayed without
additional details.
- Make sure the directory where you build dwm does not contain a config.h file;
- Apply the patch;
- Run make and make install.
The bar is displayed only with monocle layout when the view contains more than
one window. The section "More Options" explains how to add more display
options.
- Apply the patch;
- Add the following lines to your config.h dwm configuration file:
/* monocle mode in presence of several windows. */
/* A mode can be disabled by moving it after the showtab_nmodes end marker */
enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always};
static const int showtab = showtab_auto; /* Default tab bar show mode */
static const Bool toptab = True; /* False means bottom tab bar */
If you use the combined pertag+tab patch, include also (adapt the number of '0'
to your tags
array configuration):
/* The first element is for all-tag view, following i-th element corresponds to */
/* tags[i]. Layout is referred using the layouts array index.*/
static int def_layouts[1 + LENGTH(tags)] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- Run make and make install.
The tab bar is displayed only with the monocle layout when the view contains
more than one window. The Mod1-w key and the mouse support are not included in
this configuration. Activation of these options is explained in the next
section.
Pressing the key Mod1-w will cycle over the display modes of the tab bar
described below with the following element added to the keys
array:
{ MODKEY, XK_w, tabmode, {-1} }
Selection of a window by a mouse left-click on its tab is enabled by adding the
following element to the buttons
array:
{ ClkTabBar, 0, Button1, focuswin, {0} },
An example on how to insert these lines can be found in the default config file
template, config.def.h.
The tab bar includes three display options: always, never, auto. In auto mode,
the tab bar is displayed only with the monocle layout and when the view
contains more than one window. The modes available at run time can be selected
by changing the order of the elements in the showtab_mode
enum of the
config.h configuration file: the modes before showtab_nmodes
are enabled, the
ones after are disabled. The default mode is specified in the showtab
variable, it must be one of the enabled modes.
Note: keyboard shortcuts to switch to a given display mode can be defined by
using the tabmode
function like in the definition of the Mod1-w
key
provided above and passing as argument the display mode (showtab_never
,
showtab_always
, showtab_auto
) instead of -1.
The tab bar can be displayed on top or at bottom of the screen, which is
controlled by the 'toptab' variable. If the tab bar is displayed at bottom,
then it is recommended to set the variable resizehints
of the config.h file
to False. This setting prevents possible gap between the windows and the tab
bar. You can find more details about this variable and gap between windows in
the dwm FAQ.
Shortcut to move all (floating) windows from one tag to another.
This patch adds an ability to place tags in rows like in many other
window managers like xfce ore OpenBox.
Patch uses drawtagmask flagset to show tags. Two flags can be applied to it:
#define DRAWCLASSICTAGS 1 << 0
this will make patch to draw classic tags row;
#define DRAWTAGGRID 1 << 1`
this will make patch to draw the grid of tags like this:
The patch defines switchtag
function which handle global shortcuts to
navigate in grid. This function accept unsigned int argument which represents
flagset of next flags:
#define SWITCHTAGUP 1 << 0
#define SWITCHTAGDOWN 1 << 1
#define SWITCHTAGLEFT 1 << 2
#define SWITCHTAGRIGHT 1 << 3
this four defines the direction of moving current tags;
#define SWITCHTAGTOGGLETAG 1 << 4
#define SWITCHTAGTAG 1 << 5
#define SWITCHTAGVIEW 1 << 6
#define SWITCHTAGTOGGLEVIEW 1 << 7
this four defines the behaviour of switching. They will make switchtag
work
like according functions.
Default config file defines nest:
{ MODKEY|ControlMask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } },
{ MODKEY|ControlMask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_VIEW } },
{ MODKEY|ControlMask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_VIEW } },
this will simply move set of active tags in specified (UP
, DOWN
, RIGHT
or LEFT
) direction by pressing ctrl+alt+ARROW
;
{ MODKEY|Mod4Mask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod4Mask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod4Mask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
this will move active window in specified direction and perform the action, described above.
tagintostack
new clients attach into the stack area when you toggle a new tag
into view. This means your master area will remain unchanged when toggling
views.
- the
allmaster
patch will cause all clients in the master area to be left
alone
- the
onemaster
patch will cause the first client in the master area to be left
alone (this is a much simpler piece of code)
Add functions and keybindings to tag a window to a desired tag on the next (right) or previous (left) monitor from the currently selected monitor.
Three Column Layout is a new layout with a wide master panel centered on
the screen.
| | | |
|-----+ +-----+
| | M | |
|-----+ +-----+
| | | |
+-----+-------------+-----+
- Include the `tcl.c` source file and add `tcl` to the `Layout` section of
your `config.h` file. Example from `config.default.h`:
```#include "tcl.c"
static Layout layout[] = {
/* symbol function */
{ "[]=", tile }, /* first entry is default */
{ "><>", floating },
{ "|||", tcl },
};
```
Window gaps for the tile layout done right (in my humble opinion). The same
size gap between master and stack, window and window, and window and screen
edge. Size configurable in config.h.
Adds a new color scheme used by the window title in the bar, so that its colors
(foreground and background) can be changed independently.
These two patches, transfer and transferall, let you transfer clients
between the master and stack while automatically adjusting nmaster.
These are two independent patches which can be used separately.
The transfer patch adds a function that lets you transfer the currently
focused client between the master and the stack boundry and auto
increments or decrements nmaster accordingly. For example, if you're
focused on a stack client, using the transfer function moves the client
to the master area and increments nmaster by 1. Conversely if you're
focused on a master client and call transfer, the client is moved to
the stack and nmaster is decremented by 1.
The transferall patch adds a function that lets you transfer all
clients in the master into the stack and stack clients into the master;
effectively swapping the master and the stack. The new nmaster is adjusted
to be the old number of clients in the stack.
unfloatvisible
resets isfloating on any visible windows that have it set.
Optionally also applies a layout.
static Key keys[] = {
...
{ MODKEY|ShiftMask, XK_space, unfloatvisible, {0} },
{ MODKEY|ShiftMask, XK_t, unfloatvisible, {.v = &layouts[0]} },
This patch makes borders of "urgent" windows a different color. By default it
is bright red. Use config.h item "urgbordercolor" to change it.
An alternative patch which provides a minimal urgent border utilizing the
existing features to provide a feature parity to the urgent tags, using the
same foreground color as the urgent tags which they inverted.
For aesthetic purposes, this patch:
- adds "useless gaps" around windows
- removes everything (gaps and borders) when in monocle mode for aesthetic purpose.
The size of the gap is configured in config.h
:
static const unsigned int gappx = 6; /* gap pixel between windows */
No gaps:
| | |
| | |
| | |
| +-------|
| | |
| | |
| | |
+-----------------+-------+
With gaps around windows:
|+----------------++-------+|
|| || ||
|| || ||
|| || ||
|| |+-------+|
|| |+-------+|
|| || ||
|| || ||
|| || ||
|+----------------++-------+|
+---------------------------+
NB: there are some alternatives in the patches section, adding gaps between
windows, but not between windows and the screen borders, only in the default
tile mode...
Inspired by some of the functionality of i3-gaps this patch adds (inner) gaps between
client windows and (outer) gaps between windows and the screen edge in a flexible manner.
Named vanitygaps as it does not provide any real functionality as such and is purely a visual eyecandy that is perhaps
best suited for people looking for that certain look and feel. That said this might look great on a monitor (for
monitoring purposes).
The patch provides:
- option to control all gaps in unison (like fullgaps)
- option to control inner gaps in unison (like gaps)
- option to control inner and outer gaps separately
- option to control the inner horizontal and vertical gaps separately
- option to control the outer horizontal and vertical gaps separately
- option to toggle gaps on and off
- option to reset gaps back to default
- option to show no outer gaps when there is only one window (smart gaps)
- example keyboard shortcuts to change the gaps on the fly
The example keyboard shortcuts included are:
Alt+Super+0
― toggle gaps on and off
Alt+Super+Shift+0
― reset gaps back to default
Alt+Super+h
― increase all gaps
Alt+Super+l
― decrease all gaps
Alt+Super+Shift+h
― increase outer gaps
Alt+Super+Shift+l
― decrease outer gaps
Alt+Super+Ctrl+h
― increase inner gaps
Alt+Super+Ctrl+l
― decrease inner gaps
Alt+y
― increase inner horizontal gaps
Alt+o
― decrease inner horizontal gaps
Alt+Ctrl+y
― increase inner vertical gaps
Alt+Ctrl+o
― decrease outer vertical gaps
Alt+Super+y
― increase outer horizontal gaps
Alt+Super+o
― decrease outer horizontal gaps
Alt+Shift+y
― increase outer vertical gaps
Alt+Shift+o
― decrease outer vertical gaps
Nobody should need all of these, but they are included for demo purposes and for experimentation. Consider trimming
these down to what you actually use.
NB: You may also want to disable resizehints
to get even gaps.
Follow a window to the tag it is being moved to
This patch adds the ability for dwm to read colors from the linux virtual
console: /sys/module/vt/parameters/default_{red,grn,blu}. In this way the
colors you use in your regular tty is "mirrored" to dwm.
Color mappings (16 colors) are handled in config.h using color_ptrs:
/* fg bg border */
[SchemeNorm] = { -1, -1, 5 },
[SchemeSel] = { -1, -1, 11 },
[SchemeTagsNorm] = { 2, 0, 0 },
[SchemeTagsSel] = { 6, 5, 5 },
[SchemeTitleNorm] = { 6, -1, -1 },
[SchemeTitleSel] = { 6, -1, -1 },
[SchemeStatus] = { 2, 0, 0 },
};
Extra color specifications for tags, title and status are also added.
This patch warps the mouse cursor to the center of the currently focused window
or screen when the mouse cursor is (a) on a different screen or (b) on top of a
different window.
Dwm tags are a powerfull feature that allows organizing windows in workspaces.
Sometime it can be difficult to remember the tag to activate to unhide a
window. With the winview patch the window to unhide can be selected from the
all-window view. The user switches to the all-window view (Mod1-0
), selects
the window (Mod1-j
/k
or using the mouse) and press Mod1-o
. The key
Mod1-o
switches the view to the selected window tag.
The grid layout is well adapted to display many windows in a
limited space. Using both grid and pertag patches
you will be able to select this layout for the all-window view while keeping
your preferred layout for the other views.
- Make sure the directory where you build dwm does not contain a config.h file;
- Apply the patch;
- Run make and make install.
Apply the patch; Add the following element in the keys array:
{ MODKEY, XK_o, winview, {0} },
Run make and make install.
An example of how to insert this line can be found in the default config file
template, config.def.h.
This patch replaces main functionality of xxkb. It will remember the client's
xkb status and restores it when client became focused.
Firstly you have to configure xkb as you need as described
here.
The patch depends on two variables:
-
showxkb
flag defines, should patch show current xkb group on the bar or
not;
-
xkb_layouts
array defines the text, which will appear on the bar according
to current group if showxkb
set to TRUE
.
There is new field in Rule struckture, by witch you can specify default xkb
layout for window (see config.def.h for details). This could be useful with
dmenu_run, but unfortunately for some reasons rules can't be applied to dmenu.
Allows dwm to read colors from xrdb (.Xresources)
at run time.
X resources used:
dwm.normbgcolor
dwm.normfgcolor
dwm.selbordercolor
dwm.selbgcolor
dwm.selfgcolor
Example Xresource string: dwm.normbgcolor: #002b36
.
Default key to reload is Mod+F5
.
This patch allows to handle settings from Xresources. It differs from xrdb patch in that it can handle any kind of setting as opposed to only color settings.
In resources
struct is written the name, the type, and the address of the setting.
--------------------------------------------------------
"nmaster" INTEGER &nmaster
"mfact" FLOAT &mfact
"color1" STRING &color1
In Xresources file setting names shoud be prefixed with "dwm."
dwm.mfact:
dwm.color1:
This patch is a port of the st patch of the same name, it also borrows some code from dwm's xrdb patch, so a thank is in order for the authors of those patches.
This patch implements a generalization of the tile layout which adds two
attributes (direction and fact) to three areas (global, master, stack). The
global area is the entire allocatable visual space and it's subdivided into the
master and stack subareas.
The direction of the global area controls the position of the master area
relatively to the stack area and it can be one of DirHor
(traditional right
stack), DirVer
(bottom stack), DirRotHor
(left stack) and DirRotVer
(top
stack). The direction of the master and of the stack areas are independently
set and can be one of DirHor
and DirVer
. This combines to a total of
422=16 layouts.
The fact numbers indicate the relative size of the first subarea/client along
the direction of the considered area (i.e. width for DirHor
and DirRotHor
and height for DirVer
and DirRotVer
). A fact of 1 means that the first
subarea/client is on par the rest, while a fact of 2 means that its size must
double the size of each of the remaining subareas/clients, etc. So the fact for
the global area is similar to the traditional mfact in the sense that it
manages the relative allocation of visual space between the master and stack
subareas, while the fact for the master area stands for the relative importance
of the first master client against the rest of masters and, similarly, the fact
for the stack area stands for the importance of the first slave client in
relation to the rest of slaves.
xtile adds two new commands to dwm: setdir
and setfact
(which supersedes
setmfact
). Both commands take an array of three values (of type int
for
setdir
and float
for setfact
), one value for each area (the first one for
the global area, the second one for the master area and the third one for the
stack area). If you pass the value v
as INC(v)
it will be taken as a
relative increment to be added to the current value, otherwise it will be taken
as an absolute value. Usually the resulting value will be truncated to the
valid range of values for each area/attribute combination, but relative
increments for directions wrap around the limits of the valid range. Notice
that INC(0) means "do nothing here", so it gives you a way to easily modify the
value for some area while leaving the rest untouched.
The areas are selected by modifiers as follows:
--------------------------------------------------------
MODKEY Global
MODKEY+Shift Master
MODKEY+Control Stack
MODKEY+Shift+Control All three areas simultaneously
Each of the modifiers then combines with each of the following keys up to a
total of 4*3=12 key bindings:
------------------------------
r Rotate direction
h Decrement fact by 10%.
l Increment fact by 10%.
There are two provided default "presets" or "schemas" also:
--------------------------------------:
MODKEY+Shift t Right stack
MODKEY+Control t Bottom stack
These presets allow to quickly switch between different no-nonsense tilings
avoiding the need to rotate through all the nonsense combinations in-between.
But notice that MODKEY+Shift+Control+r
(i.e. simultaneously rotate all three
areas) usually produces sensible layouts (due to the way directions were
designed to rotate).
You can also easily define your own presets by calling setdir
and setfact
as needed. For example, here is the configuration code for the default presets
described above:
{ MODKEY|ControlMask, XK_t, setdirs, {.v = (int[]){ DirVer, DirHor, DirHor } } },
The layout symbol will probably look cryptic at first sight but it's very
easily decoded. It consists of three characters, one for the direction of each
area:
- Global area: '<', '>', 'v', '^', just think of it as an arrow that points in the
direction of the master area.
- Master area: '|' for vertically tiled masters and '-' for horizontally tiled masters.
- Stack area: same as for the master area.
For example, '<||' stands for the default right stack tile provided by dwm and
'^--' stands for bstack (as defined by the bottom stack patch).
There is some arbitrariness in the way facts are defined by xtile: why facts
for the first master and the first slave and not, say, for the first two
clients instead? Considering that most real life layouts will have one or two
masters and a variable number of slaves, the road xtile took will enable the
user to effectively control the relative size of the three/four most important
clients in a very intuitive way that built on his previous understanding of the
mfact and the master and stack area concepts. OTOH it's not clear to me how to
allow the specification of facts for the first two clients in an intuitive way:
- If there is only one master this alternative approach is equivalent to
xtile's one.
- If there are two masters, only one fact will be required to specify the share
of the master area that belongs to each one, so what to do with the second
fact?
- If this second fact is taken as the share of the second master vs the share
of the rest (the slaves), it's not clear how to define these inter-area shares.
One obvious additional generalization would have been to extrapolate the
nmaster idea to all three areas, or at least to the stack area. So if you
allowed only m masters and n slaves you would end up with m+n tiled windows and
with the rest of the clients in the current tagset stacked or decked "below"
the last tiled client. flextile, clients-per-tag and deck patches provide
variations on this kind of layout. I've also implemented a version of xtile
that supports it and even subsumes monocle, but I think this promotes a bad
pattern of usage. Coupled with stack manipulation operations as the ones
provided by the stacker or push patches, there is the temptation to manage
visibility by moving the desired clients in the current tagset to the first n+m
visible positions of the focus stack (not to be confused with the stack area).
There are a number of problems with this approach:
-
The stack is global to dwm, so pushing around clients in one tag will
rearrange them in other tags also. This could become a problem if you rely too
much on explicit stack management.
-
The deck area badly violates the principle of least surprise. If you only
change focus sequentially by using mod-j
/mod-k
there is no way to exit the
deck at a client different to the last/first decked one. If you use the mouse
or the focusstack
command provided by the stacker patch to jump directly from
the deck to a non-decked client, each time you reach the deck again by using
mod-j
/mod-k
the visible decked client will be replaced by the first/last
decked one. In general, there is a devilish interplay of the focus stack and
the z-stack that makes the deck unusable as a tabbed view of the decked
clients, at least for more than one or two decked clients.
Fortunately, dwm provides a much better mechanism to restrict visibility: tags.
IMO there is no need to provide a half-assed alternative to one of dwm's
strongest selling points.
Mandatory dependencies:
- pertag: we all know this one.
This patch swaps the current window (C) with the previous master (P) when
zooming.
+-----------------+-------+
| | |
| | |
| | |
| P +-------|
| | |
| | C |
| | |
+-----------------+-------+
+-----------------+-------+
| | |
| | P |
| | |
| C +-------|
| | |
| | |
| | |
+-----------------+-------+
New Behaviour :
+-----------------+-------+
| | |
| | |
| | |
| C +-------+
| | |
| | P |
| | |
+-----------------+-------+