Skip to content

dwm msg Run Command

Mihir Lad edited this page Jul 31, 2020 · 1 revision

The run_command command for dwm-msg is useful for sending arbitrary commands to dwm. The supported commands are the ones defined in your config.h in the ipccommands array. The array also defines the acceptable arguments for the command. Each command is associated with a function in dwm.c which can be looked at to get an idea of what the command does.

View Command

The following command can be run to set dwm's current view. <tags> should be replaced by OR of bit mask values of the tags you want in view.

$ dwm-msg run_command view <tags>

For example, dwm-msg run_command view 5 is the OR of the tag with a bit mask of 4 and the tag with a bit mask of 1 which when added/OR together gives 5. This command would bring the 1st tag (bit mask: 1) and the 3rd tag (bit mask: 4) into view.

Toggle View Command

This command works very similar to the view command except the tags given will be toggled. For example, dwm-msg run_command toggleview 5 would toggle the 1st tag and the 3rd tag.

Tag Command

The following command can be run to assign the selected window to the specified tags. <tags> should be specified as described in View Command above.

$ dwm-msg run_command tag <tags>

For example, dwm-msg run_command tag 5 would assign the focused window to the 1st and 3rd tag. This would untag the window from any of its prior assigned tags.

Toggle Tag Command

This command works very similar to the tag command except the tags given will be toggled for the focused window. For example, dwm-msg run_command toggletag 5 would toggle the 1st and 3rd tag on the focused window.

Tag Monitor Command

The following command cycles the monitor of the focused window. The <direction> should be replaced by a positive number to assign the focused window to the next monitor and a negative number to assign the focused window to the previous monitor

$ dwm_msg run_command tagmon <direction>

For example, dwm-msg run_command tagmon 1 will assign the currently focused window to the next monitor.

Focus Monitor Command

The following command can be run to change the currently focused monitor. The <direction> should be replaced by a positive number to put the next monitor in view and a negative number to change focus to the previous monitor.

$ dwm_msg run_command focusmon <direction>

For example dwm-msg run_command focusmon -1 will put the previous monitor in view.

Focus Stack Command

The following command can be run to change the currently focused window. The <direction> should be replaced by a positive number to put the next visible window in the stack in focus and a negative number to put the previous visible window in the stack in focus.

$ dwm_msg run_command focusstack <direction>

For example, dwm-msg run_command focusstack 1 will put the next visible window in the stack in focus.

Change Number of Masters Command

The following command can be run to change the number of master windows. The <delta> should be replaced by the change in number of monitors.

$ dwm_msg run_command incnmaster <delta>

For example, dwm-msg run_command incnmaster 2 will increase the number of master windows by 2.

Set Layout Command

The following command can be run to set the layout. The <address> should be replaced by the address of the layout as specified by the get_layouts command.

$ dwm_msg run_command setlayoutsafe <address>

For example, dwm-msg run_command setlayoutsafe 29424924024 would set the layout represented by the address 29424924024. The address associated with each address will change every dwm session and these numbers should not be considered to persist after restarts or re-logins.