]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
herbstluftwm: Add basic configuration file.
authorSimon Ruderich <simon@ruderich.org>
Sat, 11 Jan 2014 21:10:25 +0000 (22:10 +0100)
committerSimon Ruderich <simon@ruderich.org>
Sat, 11 Jan 2014 21:10:25 +0000 (22:10 +0100)
Doesn't contain all the features of my xmonad configuration yet.

herbstluftwm/autostart [new file with mode: 0755]
setup.sh

diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart
new file mode 100755 (executable)
index 0000000..7773911
--- /dev/null
@@ -0,0 +1,152 @@
+#!/bin/sh
+
+# Herbstluftm configuration file.
+
+# Copyright (C) 2014  Simon Ruderich
+#
+# This file is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this file.  If not, see <http://www.gnu.org/licenses/>.
+
+
+set -e
+
+# Log all output to catch errors in the configuration file.
+logfile="$HOME/.config/herbstluftwm/log"
+exec >"$logfile" 2>&1
+
+
+hc() {
+    herbstclient "$@"
+}
+
+# Tell all clients the configuration file was reloaded. Should be the first
+# command in the autostart file.
+hc emit_hook reload
+
+
+# KEY BINDINGS
+
+# Modifier used for all herbstluftwm key bindings.
+mod=Mod4
+
+# Remove all existing key bindings.
+hc keyunbind --all
+
+# Basic key bindings.
+hc keybind $mod-Shift-Return spawn urxvt
+hc keybind $mod-Shift-c close
+hc keybind $mod-Shift-r reload
+hc keybind $mod-Shift-q quit
+# Lock the screen. The sleep is necessary to allow xtrlock to grab the
+# keyboard input.
+hc keybind $mod-z spawn sh -c 'sleep 1 && exec xtrlock'
+
+# Tag key bindings. Create tags 1 to 9 with bindings to switch and move
+# windows to them.
+hc rename default 1 2>/dev/null || true
+for i in `seq 1 9`; do
+    hc add "$i"
+    hc keybind "$mod-$i" use "$i"
+    hc keybind "$mod-Shift-$i" move "$i"
+done
+# Switch to last active tag.
+hc keybind $mod-b use_previous
+
+# Layouting key bindings.
+hc keybind $mod-space cycle_layout 1 horizontal max # toggle these layouts
+hc keybind $mod-u split vertical   0.5
+hc keybind $mod-o split horizontal 0.5
+hc keybind $mod-r remove                            # remove a split
+# Change window state.
+hc keybind $mod-f fullscreen toggle
+
+# Focus key bindings.
+hc keybind $mod-h focus left
+hc keybind $mod-j focus down
+hc keybind $mod-k focus up
+hc keybind $mod-l focus right
+# Move windows.
+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
+
+
+# MOUSE BINDINGS
+
+# Remove all existing key bindings.
+hc mouseunbind --all
+
+
+# WINDOW and FRAME SETTINGS
+
+# No border for frames, only for windows.
+hc set frame_border_width  0
+hc set window_border_width 1
+# No gaps between frames or windows.
+hc set frame_gap  0
+hc set window_gap 0
+# Inactive window borders are black, almost invisible on my black screen.
+# Active window borders are dark red.
+hc set window_border_normal_color '#000000'
+hc set window_border_active_color '#990000'
+# Transparent background for empty frames.
+hc set frame_bg_transparent 1
+
+# Use vertical layout for windows in frames per default.
+hc set default_frame_layout 1 # vertical
+
+
+# LAYOUT
+
+# Run only on startup, not when reloading the config. Thanks to The-Compiler
+# in #herbstluftwm on Freenode (2014-01-10 16:26 CET) for the idea to use
+# environment variables.
+if ! hc getenv HLWMRC_LOADED >/dev/null; then
+    hc setenv HLWMRC_LOADED 1
+
+    # Setup my layout: Vertical split with my main terminal window in the top
+    # frame, secondary windows in the bottom frame.
+    hc split vertical 0.5
+fi
+
+
+# RULES
+
+# Remove all existing rules.
+hc unrule --all
+
+# * Do not focus new clients (default).
+# * Don't allow clients to toggle fullscreen via EWMH.
+# * Move new windows to the frame at the bottom of the screen.
+hc rule focus=off \
+        ewmhrequests=off \
+        index=1
+
+
+# After everything is done, allow redrawing of the windows.
+hc unlock
+
+
+# $1: timeout
+notify() {
+    sed 's/\^/^^/g' | dzen2 -fg blue -bg yellow -y 15 -h 30 -p "$@"
+}
+
+if test -s "$logfile"; then
+    echo "hlwm: errors in autostart, check log '$logfile'" | notify 3
+else
+    # To notify me if set -e has terminated the script.
+    echo 'hlwm restarted' | notify 1
+    rm "$logfile"
+fi
index df9b80e4c31fbbccbe297aa5cd47629f6b170fb0..45a469bc5ab12d8341d7b92a54e920d3ad67c6a6 100755 (executable)
--- a/setup.sh
+++ b/setup.sh
@@ -29,6 +29,9 @@ fi
 if installed xmonad; then
     link xmonad ~/.xmonad
 fi
 if installed xmonad; then
     link xmonad ~/.xmonad
 fi
+if installed herbstluftwm; then
+    link herbstluftwm ~/.config/herbstluftwm
+fi
 
 if installed X; then
     # Prevent code duplication. Term* rules are for all terminals; XTerm rules
 
 if installed X; then
     # Prevent code duplication. Term* rules are for all terminals; XTerm rules