From 289d0f4d9da2b5f5f2b85f55e24074d19319fd6b Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 24 Jul 2016 01:11:17 +0200 Subject: [PATCH] Update herbstluftwm config --- herbstluftwm/.config/herbstluftwm/autostart | 127 +++++++++++--------- 1 file changed, 72 insertions(+), 55 deletions(-) diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index 8c1b69f..e79d3c9 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart @@ -36,82 +36,78 @@ hc emit_hook reload # Set a random image as the desktop wallpaper. feh --bg-tile "$(random-wallpaper)" -# remove all existing keybindings +## Keybindings: +# Remove all existing keybindings so that when herbstluftwm is +# restarted, no keybindings get accidentally left active if they've +# been removed. hc keyunbind --all -## Keybindings: # Use the super key as the main modifier, Alt (Mod1) is used by too # many other applications (Emacs and Zsh for example) to really be # useful. Mod=Mod4 +# These are dangerous keybindings, they could be very annoying if +# they're accidentally pressed, so using Shift here to make it a +# little less easy to do this is a good idea. hc keybind $Mod-Shift-q quit hc keybind $Mod-Shift-r reload -hc keybind $Mod-Shift-c close -hc keybind $Mod-Return spawn ${TERMINAL:-xterm} # use your $TERMINAL with xterm as fallback -# basic movement -# focusing clients -hc keybind $Mod-Left focus left -hc keybind $Mod-Down focus down -hc keybind $Mod-Up focus up -hc keybind $Mod-Right focus right -hc keybind $Mod-h focus left -hc keybind $Mod-j focus down -hc keybind $Mod-k focus up -hc keybind $Mod-l focus right +# Usually I close the applications I use through a menu or keybinding +# inside the application, but not all applications offer +# this. Sometimes need to tell the window manager to do so. +hc keybind $Mod-k close -# moving clients -hc keybind $Mod-Shift-Left shift left -hc keybind $Mod-Shift-Down shift down -hc keybind $Mod-Shift-Up shift up -hc keybind $Mod-Shift-Right shift right -hc keybind $Mod-Shift-h shift left -hc keybind $Mod-Shift-j shift down -hc keybind $Mod-Shift-k shift up -hc keybind $Mod-Shift-l shift right +# Normally I try to have frames set-up the way I like them +# programmatically, not manually, but sometimes I need to do it +# manually anyway and remove them afterwards. +hc keybind $Mod-Shift-k remove -# splitting frames -# create an empty frame at the specified direction -hc keybind $Mod-u split bottom 0.5 -hc keybind $Mod-o split right 0.5 -# let the current frame explode into subframes -hc keybind $Mod-Control-space split explode +# These are my most-used programs, having specific keybindings for +# them is a big productivity boost. +hc keybind $Mod-Return spawn ${TERMINAL:-urxvt} +hc keybind $Mod-t spawn ${EDITOR:-emacs} +hc keybind $Mod-b spawn ${BROWSER:-conkeror} -# resizing frames +# Since I use the colemak keyboard layout, hjkl doesn't make much +# sense. I use neio instead since that is almost in the same place +# (though one place to the right). I try to use my run-or-raise script +# as much as I can, and have the layouts set-up correctly already, but +# sometimes I still need to move around, resize and move clients. resizestep=0.05 -hc keybind $Mod-Control-h resize left +$resizestep -hc keybind $Mod-Control-j resize down +$resizestep -hc keybind $Mod-Control-k resize up +$resizestep -hc keybind $Mod-Control-l resize right +$resizestep -hc keybind $Mod-Control-Left resize left +$resizestep -hc keybind $Mod-Control-Down resize down +$resizestep -hc keybind $Mod-Control-Up resize up +$resizestep -hc keybind $Mod-Control-Right resize right +$resizestep +hc keybind $Mod-n focus left +hc keybind $Mod-e focus down +hc keybind $Mod-i focus up +hc keybind $Mod-o focus right +hc keybind $Mod-Shift-n shift left +hc keybind $Mod-Shift-e shift down +hc keybind $Mod-Shift-i shift up +hc keybind $Mod-Shift-o shift right +hc keybind $Mod-Control-n resize left +$resizestep +hc keybind $Mod-Control-e resize down +$resizestep +hc keybind $Mod-Control-i resize up +$resizestep +hc keybind $Mod-Control-o resize right +$resizestep -# tags -tag_names=( {1..9} ) -tag_keys=( {1..9} 0 ) +# I usually try to have my layouts set-up programmatically, but this +# isn't always possible or practical. +hc keybind $Mod-s split bottom 0.5 +hc keybind $Mod-Shift-s split right 0.5 -hc rename default "${tag_names[0]}" || true -for i in ${!tag_names[@]} ; do - hc add "${tag_names[$i]}" - key="${tag_keys[$i]}" - if ! [ -z "$key" ] ; then - hc keybind "$Mod-$key" use_index "$i" - hc keybind "$Mod-Shift-$key" move_index "$i" - fi -done - -# cycle through tags +# Switching tags by number (key) isn't always practical, sometimes +# switching to next/previous tag is easiest. hc keybind $Mod-period use_index +1 --skip-visible hc keybind $Mod-comma use_index -1 --skip-visible -# layouting -hc keybind $Mod-r remove +# Games and sometimes other applications don't always like being +# forced into a strangely sized box, floating mode helps. hc keybind $Mod-s floating toggle + +# Playing games in fullscreen mode can end badly by having the game +# spread across both monitors. Also watching a twitch stream with lots +# of text is best in fullscreen. hc keybind $Mod-f fullscreen toggle hc keybind $Mod-p pseudotile toggle + # The following cycles through the available layouts within a frame, but skips # layouts, if the layout change wouldn't affect the actual window positions. # I.e. if there are two windows within a frame, the grid layout is skipped. @@ -131,7 +127,28 @@ hc keybind $Mod-BackSpace cycle_monitor hc keybind $Mod-Tab cycle_all +1 hc keybind $Mod-Shift-Tab cycle_all -1 hc keybind $Mod-c cycle -hc keybind $Mod-i jumpto urgent + +# Use u because i is already used by by navigation commands. +hc keybind $Mod-u jumpto urgent + +## Tags: +tag_names=( dev web {3..10} ) +tag_keys=( bracketleft braceleft braceright parenleft equal + asterisk parenright plus bracketright exclam ) + +hc rename default "${tag_names[0]}" || true +for i in "${!tag_names[@]}"; do + hc add "${tag_names[$i]}" + key="${tag_keys[$i]}" + if ! [ -z "$key" ] ; then + # first check if the tag is locked to some monitor. + # if so, first focus the monitor + hc keybind "$Mod-$key" chain \ + , silent substitute M tags."$i".my-monitor focus_monitor M \ + , use_index "$i" + hc keybind "$Mod-Shift-$key" move_index "$i" + fi +done # theme hc attr theme.tiling.reset 1