Skip to content

seanh/dwm

Repository files navigation

seanh's dwm

This is my "fork" of dwm that contains my dwm configuration, config files for other programs that I use with dwm, etc (I haven't actually made any changes to the dwm code).

This custom seanh branch is currently branched off the 6.1 tag (dwm version 6.1). You can see a comparison of my custom branch to dwm 6.1.

Features

  • Terminus font

  • Keyboard shortcuts and the status area are bound to scripts that you can modify the without having to restart dwm.

  • The media keys on your keyboard are bound to scripts.

    For example the volume up key will call dwm_volume_up, which calls PulseAudio to increase the volume.

    Volume down, toggle mute and open calculator, file browser and email also work.

    See config.h for the full list of media keys that I bound, and how to bind more of them, and see /usr/include/X11/XF86keysym.h for the full list of media key names.

    I only bound the media keys that my keyboard has, and some of the scripts they're bound to don't exist because I don't have a good command to use for the key.

  • Left Super launches a custom dmenu script that shows the commands from your ~/.dmenu-path file.

    ~/.dmenu-path should be a file containing one command per line, like this:

      gedit
      gnome-terminal
      google-chrome
      google-chrome 'https://www.fastmail.com/calendar/'
      nautilus --no-desktop
      nautilus --no-desktop ~/Desktop
      gnome-terminal -e ipython
    

    This dmenu also appears from the bottom of the screen and uses dmenu's vertical layout. When some of the menu items are long this fits more items on screen at once and makes it easier to see where one item ends and the next begins.

    Most of the time I find it faster and easier to use a dmenu that contains only the commands that I use often, and this custom dmenu can also contain commands with arguments not just executables.

    When I need it, dwm's default dmenu that shows all executables on your path still works as well, although the keyboard shortcut has changed from Alt+p to Left Super+p.

    The cost of using dmenu like this is that you have to maintain the /.dmenu-path file yourself. If I find myself going to the default dmenu for a particular item frequently then I'll add it to the custom dmenu with a quick echo something >> ~/.dmenu-path.

    Tip: if a command is too long to read easily, or it's not obvious enough from the command itself what it does, then I write a one-line script that just calls this command, give the script a nice short filename, add it to my PATH, and append it to ~/.dmenu-path. You can now use the script from the command line as well as from dmenu.

  • Date and time, volume, and dropbox status in dwm's status text area.

    This is done by a dwm_status script. The dwm_status_loop script is called at startup (by dwm_start) and it calls dwm_status once per minute.

    The reason for using a separate script to contain the loop is that you can edit dwm_status and the status area will begin using the new version without restarting dwm. You can also test your changes by running dwm_status manually to update the status area immediately instead of waiting until the minute is over.

    Even though dwm_status_loop only updates the status once per minute, other scripts can call dwm_status to update it immediately. For example dwm_volume_up does this to reflect volume changes in the status area immediately when you use it to change the volume.

  • System notifications in dwm's status bar, using dunst, configured to match dwm's style.

  • 12 tags instead of the default 9.

    F1 - F12 are used to change tags instead of the default Alt+1 - Alt+9.

    The keyboard shortcut to select all tags at once (Alt+0) is removed (you can still do it by pressing Alt+F1 - Alt+F12 in sequence).

  • Keyboard shortcuts use the Left Super (Windows) key instead of Alt.

    This prevents some keyboard shortcuts from clashing with application shortcuts. For example Alt+b opens the bookmarks menu in Firefox, Alt+f opens the file menu in many apps.

  • Ignore size hints from windows - no gaps around tiled terminal windows.

  • dwm_start is called on login and launches Dropbox etc.

Installation

These instructions have been tested on Ubuntu 16.04.1.

Enable Software Sources

Enable the "Community-maintained free and open-source software (universe)" and "Source code" software sources. There are checkboxes for these in Ubuntu Software Center, for example. Or edit your /etc/apt/sources.list file.

Install Packages

This installs the packages that are needed to compile dwm from source and the fonts and helper programs that are used with dwm:

sudo apt-get install git dmenu dunst xfonts-terminus libxft-dev
sudo apt-get build-dep dwm

Install My dwm Fork

git clone 'https://github.com/seanh/dwm.git' ~/Projects/dwm
cd ~/Projects/dwm
sudo make clean install

Link to the Dunst Config

mkdir -p ~/.config
ln -s ~/Projects/dwm/dunst ~/.config/dunst

Add my dwm Executables to your PATH

Add ~/Projects/dwm/bin to your PATH:

echo 'PATH="$HOME/Projects/dwm/bin:$PATH"' >> ~/.profile

I do mean edit ~/.profile and not your bash, zsh or whatever startup file. My scripts use sh.

Add the Desktop Entry Specification

~/Projects/dwm/dwm.desktop is a Desktop Entry Specification file, it's a copy of the /usr/share/xsessions/dwm.desktop file that ships with the dwm Debian package. This is what adds the dwm option to your login screen. You need to make a symlink to it:

sudo ln -s ~/Projects/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop

Login to dwm

Logout, choose the dwm session from the login screen, login, and everything should be working :)

Keyboard Shortcuts

Right Super launch the custom dmenu.

To add items to this menu add commands to ~/.dmenu-path, one command per line.

This can also be launched with Left Super+o (the key next to the default dmenu keyboard shortcut) because not all keyboards have a Right Super key.

Left Super+p launch the default dmenu

F1-F12 go to tag 1-12

Alt+F1-F12 toggle tag 1-12 into/out of view

Left Super+F1-F12 move the focused window to tag 1-12

Left Super+Alt+F1-F12 toggle tag 1-12 onto/off of the focused window

Left Super+b hide/show dwm's status bar

Left Super+t change to tiled layout

Left Super+f change to floating layout

Left Super+m change to monocle layout

Left Super+Space toggle between the current and previous layout

Left Super+Shift+Space toggle the focused window into and out of floating mode

Left Super+n run the dwm_terminal script (by default: launches gnome-terminal).

Left Super+Shift+Enter launch dwm's default terminal (st, note that you need to install st separately for this to work)

Left Super+j and Left Super+k move the focus to the next/prev window

Left Super+i and Left Super+d increment and decrement the number of windows in the master area

Left Super+h and Left Super+l increase and decrease the width of the master area

Left Super+Enter move the focused window into or out of the master area

Left Super+Tab toggle between the current and previous views

Left Super+Shift+c close the focused window

Left Super+Shift+q quit dwm (logout)

Left Super+, focus the previous screen

Left Super+. focus the next screen

Left Super+Shift+, send the focused window to the previous screen

Left Super+Shift+. send the focused window to the next screen