Rewrote autosart in guile

This commit is contained in:
Tom Willemsen 2011-11-09 19:50:09 +01:00
parent 139c1e3ef3
commit 23b71afda0

View file

@ -1,90 +1,113 @@
#!/bin/bash #!/usr/bin/guile
!#
# this is a simple config for herbstluftwm (define (hc command)
(system (string-append "herbstclient " command)))
function hc() { (define (keybind modkey key command)
herbstclient "$@" (display (string-append "keybind " modkey "-" key " " command "\n"))
} (hc (string-append "keybind " modkey "-" key " " command)))
xsetroot -solid '#000000' (define (mousebind modkey button command)
(hc (string-append "mousebind " modkey "-" button " " command)))
# keybindings (define (add-tag name)
Mod=Mod4 (hc (string-append "add " name)))
hc keybind $Mod-Mod1-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close
hc keybind $Mod-Return spawn urxvt
hc keybind $Mod-d spawn dmenu_run
# tags (define (set variable value)
TAG_NAMES=( {1..9} ) (hc (string-append "set " variable " " value)))
TAG_KEYS=( {1..9} 0 )
hc rename default "${TAG_NAMES[0]}" || true (define (unrule)
for i in ${!TAG_NAMES[@]} ; do (hc "unrule -F"))
hc add "${TAG_NAMES[$i]}"
key="${TAG_KEYS[$i]}"
if ! [ -z "$key" ] ; then
hc keybind "$Mod-$key" use "${TAG_NAMES[$i]}"
hc keybind "$Mod-Shift-$key" move "${TAG_NAMES[$i]}"
fi
done
# layout (define (rule spec)
hc add_monitor 1280x1024+1680+0 2 (hc (string-append "rule " spec)))
hc move_monitor 0 1680x1050+0+0
# layouting (define modkey "Mod4")
hc keybind $Mod-r remove
hc keybind $Mod-space cycle_layout 1
hc keybind $Mod-u split vertical 0.5
hc keybind $Mod-o split horizontal 0.5
hc keybind $Mod-s floating toggle
hc keybind $Mod-f fullscreen toggle
hc keybind $Mod-p pseudotile toggle
# resizing (define (create-tag name)
RESIZESTEP=0.05 (add-tag name)
hc keybind $Mod-Control-h resize left +$RESIZESTEP (keybind modkey name (string-append "use " name))
hc keybind $Mod-Control-j resize down +$RESIZESTEP (keybind modkey
hc keybind $Mod-Control-k resize up +$RESIZESTEP (string-append "Shift-" name)
hc keybind $Mod-Control-l resize right +$RESIZESTEP (string-append "move " name)))
# mouse ;; keybindings
hc mousebind $Mod-Button1 move (keybind modkey "Mod1-q" "quit")
hc mousebind $Mod-Button2 resize (keybind modkey "Shift-r" "reload")
hc mousebind $Mod-Button3 zoom (keybind modkey "Shift-c" "close")
(keybind modkey "Return" "spawn urxvt")
(keybind modkey "d" "spawn dmenu_run")
# focus ;; tags
hc keybind $Mod-BackSpace cycle_monitor (hc "rename default 1")
hc keybind $Mod-Tab cycle_all +1 (for-each create-tag '("1" "2" "3" "4" "5" "6" "7" "8" "9"))
hc keybind $Mod-Shift-Tab cycle_all -1
hc keybind $Mod-c cycle
hc keybind $Mod-h focus left
hc keybind $Mod-j focus down
hc keybind $Mod-k focus up
hc keybind $Mod-l focus 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
# colors ;; layout
hc set frame_border_active_color '#49351D' (hc "move_monitor 0 1680x1050+0+0")
hc set frame_border_normal_color '#73532D' (hc "add_monitor 1280x1024+1680+0 2")
hc set frame_bg_normal_color '#BD9768'
hc set frame_bg_active_color '#BD8541'
hc set frame_border_width 2
hc set window_border_width 2
hc set window_border_normal_color '#AE8451'
hc set window_border_active_color '#F6FF00'
# rules ;; layouting
hc unrule -F (keybind modkey "r" "remove")
#hc rule class=XTerm tag=3 # move all xterms to tag 3 (keybind modkey "space" "cycle_layout 1")
hc rule focus=off # normally do not focus new clients (keybind modkey "u" "split vertical 0.5")
# give focus to most common terminals (keybind modkey "o" "split horizontal 0.5")
hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on (keybind modkey "s" "floating toggle")
(keybind modkey "f" "fullscreen toggle")
(keybind modkey "p" "pseudotile toggle")
# panel ;; resizing
/etc/xdg/herbstluftwm/panel.sh (define resizestep "0.05")
(keybind modkey "Control-h" (string-append "resize left +" resizestep))
(keybind modkey "Control-j" (string-append "resize down +" resizestep))
(keybind modkey "Control-k" (string-append "resize up +" resizestep))
(keybind modkey "Control-l" (string-append "resize right +" resizestep))
;; mouse
(mousebind modkey "Button1" "move")
(mousebind modkey "Button2" "resize")
(mousebind modkey "Button3" "zoom")
;; focus
(keybind modkey "BackSpace" "cycle_monitor")
(keybind modkey "Tab" "cycle_all +1")
(keybind modkey "Shift-Tab" "cycle_all -1")
(keybind modkey "c" "cycle")
(keybind modkey "h" "focus left")
(keybind modkey "j" "focus down")
(keybind modkey "k" "focus up")
(keybind modkey "l" "focus right")
(keybind modkey "Shift-h" "shift left")
(keybind modkey "Shift-j" "shift down")
(keybind modkey "Shift-k" "shift up")
(keybind modkey "Shift-l" "shift right")
;; colors
(display "set frame_border_active_color \\#49351D\n")
(set "frame_border_active_color" "\\#49351D")
(display "set frame_border_normal_color\n")
(set "frame_border_normal_color" "\\#73532D")
(display "set frame_bg_normal_color\n")
(set "frame_bg_normal_color" "\\#BD9768")
(display "set frame_bg_active_color\n")
(set "frame_bg_active_color" "\\#BD8541")
(display "set frame_border_width\n")
(set "frame_border_width" "2")
(display "set window_border_width\n")
(set "window_border_width" "2")
(display "set window_border_normal_color\n")
(set "window_border_normal_color" "\\#AE8451")
(display "set window_border_active_color\n")
(set "window_border_active_color" "\\#F6FF00")
;; rules
(display "unrule\n")
(unrule)
(display "rule focus=off\n")
(rule "focus=off") ; normally do not focus new clients
(display "rule focus terminal\n")
(rule "class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on")
;; Show panel
(system "/etc/xdg/herbstluftwm/panel.sh &")