aboutsummaryrefslogtreecommitdiffstats
path: root/.config/herbstluftwm
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2014-10-25 22:26:54 +0200
committerGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2014-10-25 22:26:54 +0200
commit3e94a3e724c36267fa2e4039e3759473c59e8510 (patch)
tree379d0598c0d26d3b0c746604d80bb9e803371fb0 /.config/herbstluftwm
parent8ecace69cb3b35ac6b72859ebf0be70d11d2d71e (diff)
downloaddotfiles-3e94a3e724c36267fa2e4039e3759473c59e8510.tar.gz
dotfiles-3e94a3e724c36267fa2e4039e3759473c59e8510.tar.bz2
dotfiles-3e94a3e724c36267fa2e4039e3759473c59e8510.zip
Restructured dotfile repo to take advantage of GNU Stow
Diffstat (limited to '.config/herbstluftwm')
-rwxr-xr-x.config/herbstluftwm/autostart203
-rw-r--r--.config/herbstluftwm/dependencylist12
-rwxr-xr-x.config/herbstluftwm/lock.sh7
-rwxr-xr-x.config/herbstluftwm/notify.sh30
-rwxr-xr-x.config/herbstluftwm/panel.sh219
-rwxr-xr-x.config/herbstluftwm/popup.sh60
-rwxr-xr-x.config/herbstluftwm/start.sh13
7 files changed, 0 insertions, 544 deletions
diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart
deleted file mode 100755
index 109ea43..0000000
--- a/.config/herbstluftwm/autostart
+++ /dev/null
@@ -1,203 +0,0 @@
1#!/bin/bash
2
3# this is a simple config for herbstluftwm
4
5hc() {
6 herbstclient "$@"
7}
8
9get_x_color() {
10 xresources=$(cat ~/.Xresources)
11 color=$(echo $xresources | sed "s/.*\*color$1: \(#[0-9A-Fa-f]*\).*/\1/")
12 echo $color
13}
14
15hlwm_scripts="$HOME/.config/herbstluftwm"
16
17#wallpaper
18wallpaper=/home/tom/Pictures/fall1.jpg
19
20#Numix color palette
21export WM_LIGHT=$(get_x_color 15)
22export WM_LLIGHT=$(get_x_color 7)
23export WM_ACCENT=$(get_x_color 9)
24export WM_LDARK=$(get_x_color 8)
25export WM_DARK=$(get_x_color 0)
26
27#Panel and window_p
28window_p=20
29monitor_w=$(hc list_monitors | sed 's/^[0-9]: \([0-9]*\)x.*$/\1/')
30panel_h=24
31panel_w=$(echo "$monitor_w - (2 * $window_p)" | bc)
32dmenu_opts="-h $panel_h -w $panel_w -x $window_p -y $window_p -p Run: -nb $WM_DARK -nf $WM_LIGHT -sb $WM_ACCENT -sf $WM_DARK"
33
34hc emir_hook reload
35
36# remove all existing keybindings
37hc keyunbind --all
38
39# keybindings
40Mod=Mod4 # Use the super key as the main modifier
41
42hc keybind $Mod-Shift-q quit
43hc keybind $Mod-Shift-r reload
44hc keybind $Mod-Shift-c close
45hc keybind $Mod-Return spawn xterm
46hc keybind $Mod-grave spawn dmenu_run $dmenu_opts
47hc keybind XF86AudioLowerVolume spawn amixer set Master 5%-
48hc keybind XF86AudioRaiseVolume spawn amixer set Master 5%+
49
50# basic movement
51# focusing clients
52hc keybind $Mod-Left focus left
53hc keybind $Mod-Down focus down
54hc keybind $Mod-Up focus up
55hc keybind $Mod-Right focus right
56hc keybind $Mod-h focus left
57hc keybind $Mod-j focus down
58hc keybind $Mod-k focus up
59hc keybind $Mod-l focus right
60
61# moving clients
62hc keybind $Mod-Shift-Left shift left
63hc keybind $Mod-Shift-Down shift down
64hc keybind $Mod-Shift-Up shift up
65hc keybind $Mod-Shift-Right shift right
66hc keybind $Mod-Shift-h shift left
67hc keybind $Mod-Shift-j shift down
68hc keybind $Mod-Shift-k shift up
69hc keybind $Mod-Shift-l shift right
70
71# splitting frames
72# create an empty frame at the specified direction
73hc keybind $Mod-u split bottom 0.5
74hc keybind $Mod-o split right 0.5
75# let the current frame explode into subframes
76hc keybind $Mod-Control-space split explode
77
78# resizing frames
79resizestep=0.05
80hc keybind $Mod-Control-h resize left +$resizestep
81hc keybind $Mod-Control-j resize down +$resizestep
82hc keybind $Mod-Control-k resize up +$resizestep
83hc keybind $Mod-Control-l resize right +$resizestep
84hc keybind $Mod-Control-Left resize left +$resizestep
85hc keybind $Mod-Control-Down resize down +$resizestep
86hc keybind $Mod-Control-Up resize up +$resizestep
87hc keybind $Mod-Control-Right resize right +$resizestep
88
89# tags
90tag_names=( I II III IV V VI VII VIII IX X )
91tag_keys=( {1..9} 0 )
92
93# Selecting workspaces
94hc keybind Alt-Control-Left use_index -1
95hc keybind Alt-Control-Right use_index +1
96hc rename default "${tag_names[0]}" || true
97for i in ${!tag_names[@]} ; do
98 hc add "${tag_names[$i]}"
99 key="${tag_keys[$i]}"
100 if ! [ -z "$key" ] ; then
101 hc keybind "$Mod-$key" use_index "$i"
102 hc keybind "$Mod-Shift-$key" move_index "$i"
103 fi
104done
105
106# cycle through tags
107hc keybind $Mod-period use_index +1 --skip-visible
108hc keybind $Mod-comma use_index -1 --skip-visible
109
110# layouting
111hc keybind $Mod-r remove
112hc keybind $Mod-space cycle_layout 1
113hc keybind $Mod-s floating toggle
114hc keybind $Mod-f fullscreen toggle
115hc keybind $Mod-p pseudotile toggle
116
117# mouse
118hc mouseunbind --all
119hc mousebind $Mod-Button1 move
120hc mousebind $Mod-Button2 zoom
121hc mousebind $Mod-Button3 resize
122
123# focus
124hc keybind $Mod-BackSpace cycle_monitor
125hc keybind $Mod-Tab cycle_all +1
126hc keybind $Mod-Shift-Tab cycle_all -1
127hc keybind $Mod-c cycle
128hc keybind $Mod-i jumpto urgent
129hc set focus_follows_mouse 1
130
131# theme
132hc attr theme.tiling.reset 1
133hc attr theme.floating.reset 1
134hc set frame_border_active_color $WM_LDARK
135hc set frame_border_normal_color $WM_DARK
136hc set frame_bg_normal_color $WM_LDARK
137hc set frame_bg_active_color $WM_DARK
138hc set frame_border_width 0
139hc set always_show_frame 0
140hc set frame_bg_transparent 1
141hc set frame_transparent_width 0
142hc set frame_gap 0
143
144hc attr theme.active.color $WM_ACCENT
145hc attr theme.normal.color $WM_DARK
146hc attr theme.urgent.color orange
147hc attr theme.inner_width 1
148hc attr theme.inner_color $WM_DARK
149hc attr theme.border_width 3
150hc attr theme.floating.border_width 4
151hc attr theme.floating.outer_width 1
152hc attr theme.floating.outer_color $WM_DARK
153hc attr theme.active.inner_color $WM_DARK
154hc attr theme.active.outer_color $WM_DARK
155hc attr theme.background_color $WM_DARK
156
157hc set window_gap $window_p
158hc set frame_padding 0
159hc set smart_window_surroundings 0
160hc set smart_frame_surroundings 1
161hc set mouse_recenter_gap 1
162
163# rules
164hc unrule -F
165#hc rule class=XTerm tag=3 # move all xterms to tag 3
166hc rule focus=on # normally focus new clients
167#hc rule focus=off # normally do not focus new clients
168# give focus to most common terminals
169#hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
170hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
171hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
172hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
173
174# unlock, just to be sure
175hc unlock
176
177herbstclient set tree_style '╾│ ├└╼─┐'
178
179#Start panel in all monitors
180start_panel() {
181 for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
182 "$1" $monitor $panel_h $window_p &
183 done
184}
185
186# find the panel
187panel=$hlwm_scripts/panel.sh
188[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
189if pgrep panel.sh >> /dev/null
190then
191 kill $(pgrep panel.sh)
192 start_panel $panel
193else
194 start_panel $panel
195fi
196
197$hlwm_scripts/start.sh "xautolock -time 5 -locker $hlwm_scripts/lock.sh"
198$hlwm_scripts/start.sh "feh --bg-fill $wallpaper"
199$hlwm_scripts/start.sh "compton --config $HOME/.compton"
200$hlwm_scripts/start.sh "xrdb -load $HOME/.Xresources"
201$hlwm_scripts/start.sh "pulseaudio --start"
202$hlwm_scripts/start.sh "dropboxd"
203$hlwm_scripts/start.sh "$hlwm_scripts/notify.sh $monitor_w $window_p $panel_h $hlwm_scripts/popup.sh"
diff --git a/.config/herbstluftwm/dependencylist b/.config/herbstluftwm/dependencylist
deleted file mode 100644
index a18055d..0000000
--- a/.config/herbstluftwm/dependencylist
+++ /dev/null
@@ -1,12 +0,0 @@
1compton
2bar-aint-recursive
3bc
4wireless_tools
5dmenu2
6feh
7pulseaudio
8alsa-utils
9sed
10i3lock
11scrot
12xautolock
diff --git a/.config/herbstluftwm/lock.sh b/.config/herbstluftwm/lock.sh
deleted file mode 100755
index 04c4638..0000000
--- a/.config/herbstluftwm/lock.sh
+++ /dev/null
@@ -1,7 +0,0 @@
1#!/bin/bash
2
3SCREENCAP="/tmp/lock.png"
4scrot $SCREENCAP
5convert -gaussian-blur "12x3" $SCREENCAP $SCREENCAP
6i3lock -i $SCREENCAP
7rm $SCREENCAP
diff --git a/.config/herbstluftwm/notify.sh b/.config/herbstluftwm/notify.sh
deleted file mode 100755
index 190d496..0000000
--- a/.config/herbstluftwm/notify.sh
+++ /dev/null
@@ -1,30 +0,0 @@
1#!/bin/bash
2
3monitor_w=$1
4window_p=$2
5panel_h=$3
6
7popup_w=$(echo "$monitor_w - (2 * $window_p)" | bc)
8popup_h=$panel_h
9popup_x=$window_p
10popup_y=$window_p
11
12popup_opts="-w $popup_w -h $popup_h -x $popup_x -y $popup_y"
13
14while true; do
15
16 bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity)
17 bat_stat=$(cat /sys/class/power_supply/BAT1/status)
18
19 if [[ $bat_lvl -le 5 && $bat_stat == "Discharging" ]]; then
20 $4 -m "Battery level critical: $bat_lvl%%" -u "high" $popup_opts
21 elif [[ $bat_lvl -eq 10 && $bat_stat == "Discharging" ]]; then
22 $4 -m "Battery level low: $bat_lvl%%" $popup_opts
23 elif [[ $bat_lvl -eq 50 && $bat_stat == "Discharging" ]]; then
24 $4 -m "Battery level at $bat_lvl%%" $popup_opts
25 elif [[ $bat_lvl -eq 100 && $bat_stat == "Charging" ]]; then
26 $4 -m "Battery fully charged"
27 fi
28
29 sleep 60;
30done
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh
deleted file mode 100755
index 24d0e12..0000000
--- a/.config/herbstluftwm/panel.sh
+++ /dev/null
@@ -1,219 +0,0 @@
1#!/bin/bash
2
3hc() {
4 "${herbstclient_command[@]:-herbstclient}" "$@" ;
5}
6
7add_alpha_channel(){
8 echo "$1" | \
9 sed "s/.*#\([0-9a-fA-F]*\).*/#ff\1/"
10}
11
12monitor=${1:-0}
13panel_height=$2
14padding=$3
15
16light=$(add_alpha_channel $WM_LIGHT)
17llight=$(add_alpha_channel $WM_LLIGHT)
18accent=$(add_alpha_channel $WM_ACCENT)
19ldark=$(add_alpha_channel $WM_LDARK)
20dark=$(add_alpha_channel $WM_DARK)
21
22font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*"
23#font=""
24selected_bg=$accent
25normal_bg=$dark
26selected_txt=$dark
27normal_txt=$light
28inactive_txt=$llight
29
30geometry=( $(herbstclient monitor_rect "$monitor") )
31if [ -z "$geometry" ] ;then
32 echo "Invalid monitor $monitor"
33 exit 1
34fi
35# geometry has the format W H X Y
36x=$(echo "${geometry[0]} + $padding" | bc)
37y=$(echo "${geometry[1]} + $padding" | bc)
38panel_width=$(echo "${geometry[2]} - (2 * $padding)" | bc)
39bar_opts="-g ${panel_width}x${panel_height}+${x}+${y} -f ${font} -u 2 -B ${normal_bg} -F ${normal_txt}"
40
41hc pad $monitor $(echo "$panel_height + $padding" | bc)
42
43if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
44 # mawk needs "-W interactive" to line-buffer stdout correctly
45 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504
46 uniq_linebuffered() {
47 awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
48 }
49else
50 # other awk versions (e.g. gawk) issue a warning with "-W interactive", so
51 # we don't want to use it there.
52 uniq_linebuffered() {
53 awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
54 }
55fi
56
57{
58 ### Event generator ###
59 # <eventname>\t<data> [...]
60 # e.g.
61 # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29
62
63 while true ; do
64 # Volume
65 if pgrep pulseaudio > /dev/null ; then
66 volumes=$(\
67 amixer get Master | \
68 grep "Mono: Playback"\
69 )
70 vol=$(\
71 echo $volumes | \
72 sed "s/.*\[\([0-9]*\)%\].*/\1/"\
73 )
74 if [ -z $vol ] ; then
75 echo -e "volume\toff"
76 elif [ $vol -le 0 ] ; then
77 echo -e "volume\t%{F$normal_txt}Volume muted"
78 else
79 echo -e "volume\t%{F$normal_txt}Volume: $vol%%%{F-}"
80 fi
81 else
82 echo -e "volume\toff"
83 fi
84
85 # Network
86 iwconfig=$(iwconfig wlp3s0)
87 if [ -z $iwconfig ] ; then
88 echo -e "net\toff"
89 else
90 ssid=$(\
91 echo $iwconfig | \
92 sed "s/.*ESSID:\(\".*\"\).*/\1/" | \
93 sed "s/.*\(off\/any\).*/\"\1\"/" | \
94 sed "s/.*\"\(.*\)\".*/\1/"\
95 )
96 if [ $ssid = "off/any" ] ; then
97 ifconf=$
98 echo -e "net\t%{F$normal_txt}Net: No connection%{F-}"
99 else
100 echo -e "net\t%{F$normal_txt}Net: $ssid%{F-}"
101 fi
102 fi
103
104 # Battery
105 if $(test -e /sys/class/power_supply/BAT1) ; then
106 bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity)
107 if [ $bat_lvl -lt 15 ] ; then
108 bat_color=$accent
109 else
110 bat_color=$normal_txt
111 fi
112 state=$(cat /sys/class/power_supply/BAT1/status)
113 echo -e "battery\t%{F$normal_txt}$state: %{F$bat_color}$bat_lvl%{F$normal_txt}%%%{F-}"
114 else
115 echo -e "battery\toff"
116 fi
117
118 # Time
119 echo -e $(date +$"date\t%{F$normal_txt}%H:%M:%S %{F$inactive_txt}(%d-%m-%Y)%{F-}")
120 sleep 1 || break
121 done > >(uniq_linebuffered) &
122 childpid=$!
123 hc --idle
124 kill $childpid
125} 2> /dev/null | {
126
127 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
128 visible=true
129 date=""
130 volume=""
131 battery=""
132 net=""
133 windowtitle=""
134 while true ; do
135 separator="%{F$accent}|%{F-}"
136 # draw tags
137 for i in "${tags[@]}" ; do
138 case ${i:0:1} in
139 '#')
140 echo -n "%{U$accent+u}%{B-}%{F$normal_txt}"
141 ;;
142 '+')
143 echo -n "%{B$accent}%{F$normal_bg}"
144 ;;
145 ':')
146 echo -n "%{B-}%{F$normal_txt}"
147 ;;
148 '!')
149 echo -n "%{B$normal_txt}%{F$normal_bg}"
150 ;;
151 *)
152 echo -n "%{B-}%{F$inactive_txt}"
153 ;;
154 esac
155 echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{B-}%{U-u}"
156 done
157 echo -n "$separator"
158 echo -n "%{B-}%{F-} ${windowtitle//^/^^}"
159
160 #Right part of panel
161 right="$volume$net$battery$date "
162 echo -n "%{r}$right"
163 echo
164
165 # wait for next event
166 IFS=$'\t' read -ra cmd || break
167 case "${cmd[0]}" in
168 tag*)
169 #echo "resetting tags" >&2
170 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
171 ;;
172 volume)
173 volume="${cmd[@]:1}"
174 if [ $volume == "off" ] ; then
175 volume=""
176 else
177 volume="$volume $separator%{B-} "
178 fi
179 ;;
180 net)
181 net="${cmd[@]:1}"
182 if [ $net = "off" ] ; then
183 net=""
184 else
185 net="$net $separator%{B-} "
186 fi
187 ;;
188 battery)
189 battery="${cmd[@]:1}"
190 if [ $battery == "off" ] ; then
191 battery=""
192 else
193 battery="$battery $separator%{B-} "
194 fi
195 ;;
196 date)
197 #echo "resetting date" >&2
198 date="${cmd[@]:1}"
199 ;;
200 focus_changed|window_title_changed)
201 windowtitle="${cmd[@]:2}"
202 ;;
203 esac
204 done
205} 2> /dev/null | bar $bar_opts | {
206 #Handle clickable areas
207 while read line; do
208 IFS=',' read -a c <<< $(echo $line)
209 case "${c[0]}" in
210 tag)
211 herbstclient use "${c[1]}"
212 echo "herbstclient use \"${c[1]}\""
213 ;;
214 *)
215 echo "${c[0]}: not valid command"
216 ;;
217 esac
218 done
219}
diff --git a/.config/herbstluftwm/popup.sh b/.config/herbstluftwm/popup.sh
deleted file mode 100755
index 41c5e9c..0000000
--- a/.config/herbstluftwm/popup.sh
+++ /dev/null
@@ -1,60 +0,0 @@
1#!/bin/bash
2
3help () {
4 echo -e "Usage: popup.sh [OPTIONS]"
5 echo -e "Spawns a popup for a certain amount of time"
6 echo -e ""
7 echo -e "Options:"
8 echo -e " -m MESSAGE\t\tSpecifies message to be displayed"
9 echo -e " -t TIMEOUT\t\tAmount of time in seconds the popup is displayed"
10}
11
12add_alpha_channel(){
13 echo "$1" | \
14 sed "s/.*#\([0-9a-fA-F]*\).*/#ff\1/"
15}
16
17timeout=10
18message=""
19x=0
20y=0
21width=120
22height=90
23urgency="info"
24
25while getopts ":m:t:x:y:w:h:u:" opt; do
26 case $opt in
27 m) message=$OPTARG ;;
28 t) timeout=$OPTARG ;;
29 x) x=$OPTARG ;;
30 y) y=$OPTARG ;;
31 w) width=$OPTARG ;;
32 h) height=$OPTARG ;;
33 u) urgency=$OPTARG ;;
34 esac
35done
36
37if test ! $message; then
38 help
39else
40 light=$(add_alpha_channel $WM_LIGHT)
41 llight=$(add_alpha_channel $WM_LLIGHT)
42 accent=$(add_alpha_channel $WM_ACCENT)
43 ldark=$(add_alpha_channel $WM_LDARK)
44 dark=$(add_alpha_channel $WM_DARK)
45 font="-*-fixed-medium-*-*-*-$(echo "$height - 10" | bc)-*-*-*-*-*-*-*"
46 bar_opts="-f ${font} -B $dark -F $light -g ${width}x${height}+${x}+${y} -u 2"
47
48 t=$(date +%T)
49
50 if [ $urgency == "info" ]; then
51 prefix="Info:"
52 elif [ $urgency == "high" ]; then
53 prefix="!!WARNING:"
54 fi
55
56 {
57 echo "%{F$accent} $prefix %{F$light}$message %{F$llight}($t)%{F-}"
58 sleep $timeout
59 } | bar $bar_opts
60fi
diff --git a/.config/herbstluftwm/start.sh b/.config/herbstluftwm/start.sh
deleted file mode 100755
index f10fca6..0000000
--- a/.config/herbstluftwm/start.sh
+++ /dev/null
@@ -1,13 +0,0 @@
1#!/bin/bash
2
3opts=($@)
4
5program=$(echo ${opts[0]} | sed 's/^.*\/\(.*\)/\1/')
6
7if pgrep $program >> /dev/null
8then
9 killall $program
10 ${opts[@]} &
11else
12 ${opts[@]} &
13fi