aboutsummaryrefslogtreecommitdiffstats
path: root/herbstluftwm
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2015-08-31 22:27:10 +0200
committerGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2015-08-31 22:27:10 +0200
commit86271da691beb99cbb0b1448211da39e867385fc (patch)
treea428c12b7c5ec48185739497d04fe2d816ab5945 /herbstluftwm
parent434d648f01469fcd6ece9d4ca6f4a5630822b840 (diff)
parent3d1e91b881d292f840d459c4911022f30807b4ff (diff)
downloaddotfiles-86271da691beb99cbb0b1448211da39e867385fc.tar.gz
dotfiles-86271da691beb99cbb0b1448211da39e867385fc.tar.bz2
dotfiles-86271da691beb99cbb0b1448211da39e867385fc.zip
Merge branch 'hlwm_refactoring'
Diffstat (limited to 'herbstluftwm')
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/autostart202
-rw-r--r--herbstluftwm/.config/herbstluftwm/dependencylist5
-rw-r--r--herbstluftwm/.config/herbstluftwm/hlwm-keybindings80
-rw-r--r--herbstluftwm/.config/herbstluftwm/hlwm-rules13
-rw-r--r--herbstluftwm/.config/herbstluftwm/hlwm-theming31
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/panel_handler.sh17
-rwxr-xr-x[-rw-r--r--]herbstluftwm/.config/herbstluftwm/panel_indicators.sh71
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/populate_panel.sh (renamed from herbstluftwm/.config/herbstluftwm/panel.sh)147
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/start.sh2
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/start_panel.sh34
l---------herbstluftwm/.config/herbstluftwm/themes/current1
-rw-r--r--herbstluftwm/.config/herbstluftwm/themes/purpur (renamed from herbstluftwm/.config/herbstluftwm/theme.sh)9
12 files changed, 325 insertions, 287 deletions
diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart
index 683fbf1..78a81b4 100755
--- a/herbstluftwm/.config/herbstluftwm/autostart
+++ b/herbstluftwm/.config/herbstluftwm/autostart
@@ -1,14 +1,16 @@
1#!/bin/bash 1#!/usr/bin/env bash
2
3# this is a simple config for herbstluftwm
4 2
3# Herbstclient shortcut
5hc() { 4hc() {
6 herbstclient "$@" 5 herbstclient "$@"
7} 6}
7export -f hc
8
9# The current directory
10export HLWM_CONF_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
8 11
9#Include the theming script 12#Include the theming script
10dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 13source "$HLWM_CONF_DIR/themes/current"
11source "$dir/theme.sh"
12 14
13#Detect monitors 15#Detect monitors
14hc set auto_detect_monitors 1 16hc set auto_detect_monitors 1
@@ -19,175 +21,41 @@ monitor_w=($(hc list_monitors | sed 's/^[0-9]: \([0-9]*\)x.*$/\1/'))
19panel_w=$(echo "$monitor_w - (2 * $window_p)" | bc) 21panel_w=$(echo "$monitor_w - (2 * $window_p)" | bc)
20dmenu_opts="-h $panel_h -w $panel_w -x $window_p -y $window_p -p Run: -nb $color_bg -nf $color_fg -sb $color_accent -sf $color_bg" 22dmenu_opts="-h $panel_h -w $panel_w -x $window_p -y $window_p -p Run: -nb $color_bg -nf $color_fg -sb $color_accent -sf $color_bg"
21 23
22# remove all existing keybindings 24# Tags
23hc keyunbind --all 25tag_names=()
24 26tag_keys=({1..9} 0)
25# keybindings 27for key in ${tag_keys[@]}; do
26Mod=Mod4 # Use the super key as the main modifier 28 if [ $key -eq 0 ]; then key=10; fi
27 29 key=$(echo "$key - 1" | bc)
28hc keybind $Mod-Shift-q quit 30 name=$(echo "obase=2;$key" | bc | awk '{ printf "%04d", $0 }')
29hc keybind $Mod-Shift-r reload 31 tag_names+=($name)
30hc keybind $Mod-Shift-c close 32done;
31hc keybind $Mod-Return spawn xterm
32hc keybind $Mod-grave spawn dmenu_run $dmenu_opts
33hc keybind XF86AudioLowerVolume spawn amixer set Master 1%-
34hc keybind XF86AudioRaiseVolume spawn amixer set Master 1%+
35
36# basic movement
37# focusing clients
38#hc keybind $Mod-Left focus left
39#hc keybind $Mod-Down focus down
40#hc keybind $Mod-Up focus up
41#hc keybind $Mod-Right focus right
42hc keybind $Mod-h focus left
43hc keybind $Mod-j focus down
44hc keybind $Mod-k focus up
45hc keybind $Mod-l focus right
46
47# moving clients
48#hc keybind $Mod-Shift-Left shift left
49#hc keybind $Mod-Shift-Down shift down
50#hc keybind $Mod-Shift-Up shift up
51#hc keybind $Mod-Shift-Right shift right
52hc keybind $Mod-Shift-h shift left
53hc keybind $Mod-Shift-j shift down
54hc keybind $Mod-Shift-k shift up
55hc keybind $Mod-Shift-l shift right
56
57# splitting frames
58# create an empty frame at the specified direction
59hc keybind $Mod-u split bottom 0.5
60hc keybind $Mod-o split right 0.5
61# let the current frame explode into subframes
62hc keybind $Mod-Control-space split explode
63
64# resizing frames
65resizestep=0.05
66hc keybind $Mod-Control-h resize left +$resizestep
67hc keybind $Mod-Control-j resize down +$resizestep
68hc keybind $Mod-Control-k resize up +$resizestep
69hc keybind $Mod-Control-l resize right +$resizestep
70#hc keybind $Mod-Control-Left resize left +$resizestep
71#hc keybind $Mod-Control-Down resize down +$resizestep
72#hc keybind $Mod-Control-Up resize up +$resizestep
73#hc keybind $Mod-Control-Right resize right +$resizestep
74
75# tags
76tag_names=( I II III IV V VI VII VIII IX X )
77tag_keys=( {1..9} 0 )
78
79# Selecting workspaces
80#hc keybind Alt-Control-Left use_index -1
81#hc keybind Alt-Control-Right use_index +1
82hc keybind Alt-Control-h use_index -1
83hc keybind Alt-Control-l use_index +1
84hc rename default "${tag_names[0]}" || true
85for i in ${!tag_names[@]} ; do
86 hc add "${tag_names[$i]}"
87 key="${tag_keys[$i]}"
88 if ! [ -z "$key" ] ; then
89 hc keybind "$Mod-$key" use_index "$i"
90 hc keybind "$Mod-Shift-$key" move_index "$i"
91 fi
92done
93
94# cycle through tags
95hc keybind $Mod-period use_index +1 --skip-visible
96hc keybind $Mod-comma use_index -1 --skip-visible
97 33
98# layouting 34# Source hlwm-config-files
99hc keybind $Mod-r remove 35source "$HLWM_CONF_DIR/hlwm-keybindings"
100hc keybind $Mod-space cycle_layout 1 36source "$HLWM_CONF_DIR/hlwm-theming"
101hc keybind $Mod-s floating toggle 37source "$HLWM_CONF_DIR/hlwm-rules"
102hc keybind $Mod-f fullscreen toggle
103hc keybind $Mod-p pseudotile toggle
104 38
105# mouse 39# Unlock, just to be sure
106hc mouseunbind --all
107hc mousebind $Mod-Button1 move
108hc mousebind $Mod-Button2 zoom
109hc mousebind $Mod-Button3 resize
110
111# focus
112hc keybind $Mod-BackSpace cycle_monitor
113hc keybind $Mod-Tab cycle_all +1
114hc keybind $Mod-Shift-Tab cycle_all -1
115hc keybind $Mod-c cycle
116hc keybind $Mod-i jumpto urgent
117hc set focus_follows_mouse 1
118
119# theme
120hc attr theme.tiling.reset 1
121hc attr theme.floating.reset 1
122hc set frame_border_width 0
123hc set always_show_frame 0
124hc set frame_bg_transparent 1
125hc set frame_normal_opacity 0
126hc set frame_active_opacity 0
127hc set frame_transparent_width 0
128hc set frame_gap 0
129
130hc attr theme.active.color $color_accent
131hc attr theme.normal.color $color_bg
132hc attr theme.urgent.color orange
133hc attr theme.inner_width 1
134hc attr theme.inner_color $color_bg
135hc attr theme.border_width 3
136hc attr theme.floating.border_width 4
137hc attr theme.floating.outer_width 1
138hc attr theme.floating.outer_color $color_bg
139hc attr theme.active.inner_color $color_bg
140hc attr theme.active.outer_color $color_bg
141hc attr theme.background_color $color_bg
142
143hc set window_gap $window_p
144hc set frame_padding 0
145hc set smart_window_surroundings 0
146hc set smart_frame_surroundings 1
147hc set mouse_recenter_gap 1
148
149# rules
150hc unrule -F
151hc rule focus=on # normally focus new clients
152
153#hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
154hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
155hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
156
157hc rule --class~'(.*[Ss]team.*)' --tag=IX --focus=off
158hc rule --class~'(.*[Hh]exchat.*)' --tag=X --focus=off
159hc rule --class~'(.*[Ss]potify.*)' --tag=X --focus=off
160hc rule --class~'(.*[Ss]kype.*)' --tag=VIII --focus=off
161
162# unlock, just to be sure
163hc unlock 40hc unlock
164 41
165herbstclient set tree_style '╾│ ├└╼─┐' 42herbstclient set tree_style '╾│ ├└╼─┐'
166 43
167#Start panel in all monitors 44# Start panel in all monitors
168start_panel() { 45panel=$HLWM_CONF_DIR/start_panel.sh
169 for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
170 "$1" $monitor&
171 done
172}
173
174# find the panel
175panel=$dir/panel.sh
176[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh 46[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
177if pgrep panel.sh >> /dev/null 47for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
178then 48 $panel $monitor&
179 kill $(pgrep panel.sh) 49done
180 start_panel $panel
181else
182 start_panel $panel
183fi
184 50
185pulseaudio --start 51pulseaudio --start
186 52
187$dir/start.sh "xautolock -time 5 -locker $dir/lock.sh" 53$HLWM_CONF_DIR/start.sh "xautolock -time 5 -locker $HLWM_CONF_DIR/lock.sh"
188$dir/start.sh "feh --bg-fill $wallpaper" 54$HLWM_CONF_DIR/start.sh "feh --bg-fill $wallpaper"
189$dir/start.sh "compton --config $HOME/.compton" 55$HLWM_CONF_DIR/start.sh "compton --config $HOME/.compton"
190$dir/start.sh "xrdb -load $HOME/.Xresources" 56$HLWM_CONF_DIR/start.sh "xrdb -load $HOME/.Xresources"
191$dir/start.sh "xset +fp /usr/share/fonts/local" 57$HLWM_CONF_DIR/start.sh "xset +fp /usr/share/fonts/local"
192$dir/start.sh "xset fp rehash" 58$HLWM_CONF_DIR/start.sh "xset fp rehash"
193#$dir/start.sh "$dir/notify.sh $dir/popup.sh" 59#$HLWM_CONF_DIR/start.sh "$HLWM_CONF_DIR/notify.sh $HLWM_CONF_DIR/popup.sh"
60
61# vim: set ts=4 sw=4 tw=0 et :
diff --git a/herbstluftwm/.config/herbstluftwm/dependencylist b/herbstluftwm/.config/herbstluftwm/dependencylist
index e62c3af..84c61d7 100644
--- a/herbstluftwm/.config/herbstluftwm/dependencylist
+++ b/herbstluftwm/.config/herbstluftwm/dependencylist
@@ -4,12 +4,13 @@ compton
4dmenu2 4dmenu2
5feh 5feh
6i3lock 6i3lock
7lemonbar-git 7lemonbar-xft-git
8playerctl 8playerctl
9pulseaudio 9pulseaudio
10pulseaudio-alsa 10pulseaudio-alsa
11scrot 11scrot
12sed 12sed
13stlarch_font 13ttf-dejavu
14ttf-font-awesome
14wireless_tools 15wireless_tools
15xautolock 16xautolock
diff --git a/herbstluftwm/.config/herbstluftwm/hlwm-keybindings b/herbstluftwm/.config/herbstluftwm/hlwm-keybindings
new file mode 100644
index 0000000..4a6a614
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/hlwm-keybindings
@@ -0,0 +1,80 @@
1#!/usr/bin/env bash
2
3# Remove all existing keybindings
4hc keyunbind --all
5
6# Keybindings
7Mod=Mod4 # Use the super key as the main modifier
8
9hc keybind $Mod-Shift-q quit
10hc keybind $Mod-Shift-r reload
11hc keybind $Mod-Shift-c close
12hc keybind $Mod-Return spawn xterm
13hc keybind $Mod-grave spawn dmenu_run $dmenu_opts
14hc keybind XF86AudioLowerVolume spawn amixer set Master 1%-
15hc keybind XF86AudioRaiseVolume spawn amixer set Master 1%+
16
17# Basic movement
18# Focusing clients
19hc keybind $Mod-h focus left
20hc keybind $Mod-j focus down
21hc keybind $Mod-k focus up
22hc keybind $Mod-l focus right
23
24# Moving clients
25hc keybind $Mod-Shift-h shift left
26hc keybind $Mod-Shift-j shift down
27hc keybind $Mod-Shift-k shift up
28hc keybind $Mod-Shift-l shift right
29
30# Splitting frames
31# Create an empty frame at the specified direction
32hc keybind $Mod-u split bottom 0.5
33hc keybind $Mod-o split right 0.5
34# Let the current frame explode into subframes
35hc keybind $Mod-Control-space split explode
36
37# Resizing frames
38resizestep=0.05
39hc keybind $Mod-Control-h resize left +$resizestep
40hc keybind $Mod-Control-j resize down +$resizestep
41hc keybind $Mod-Control-k resize up +$resizestep
42hc keybind $Mod-Control-l resize right +$resizestep
43
44# Selecting workspaces
45hc keybind Alt-Control-h use_index -1
46hc keybind Alt-Control-l use_index +1
47hc rename default "${tag_names[0]}" || true
48for i in ${!tag_names[@]} ; do
49 hc add "${tag_names[$i]}"
50 key="${tag_keys[$i]}"
51 if ! [ -z "$key" ] ; then
52 hc keybind "$Mod-$key" use_index "$i"
53 hc keybind "$Mod-Shift-$key" move_index "$i"
54 fi
55done
56
57# Cycle through tags
58hc keybind $Mod-period use_index +1 --skip-visible
59hc keybind $Mod-comma use_index -1 --skip-visible
60
61# Layouting
62hc keybind $Mod-r remove
63hc keybind $Mod-space cycle_layout 1
64hc keybind $Mod-s floating toggle
65hc keybind $Mod-f fullscreen toggle
66hc keybind $Mod-p pseudotile toggle
67
68# Mouse
69hc mouseunbind --all
70hc mousebind $Mod-Button1 move
71hc mousebind $Mod-Button2 zoom
72hc mousebind $Mod-Button3 resize
73
74# Focus
75hc keybind $Mod-BackSpace cycle_monitor
76hc keybind $Mod-Tab cycle_all +1
77hc keybind $Mod-Shift-Tab cycle_all -1
78hc keybind $Mod-c cycle
79hc keybind $Mod-i jumpto urgent
80hc set focus_follows_mouse 1
diff --git a/herbstluftwm/.config/herbstluftwm/hlwm-rules b/herbstluftwm/.config/herbstluftwm/hlwm-rules
new file mode 100644
index 0000000..df4df45
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/hlwm-rules
@@ -0,0 +1,13 @@
1#!/usr/bin/env bash
2
3# Rules
4hc unrule -F
5hc rule focus=on # normally focus new clients
6
7hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
8hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
9
10hc rule --class~'(.*[Ss]team.*)' --tag=IX --focus=off
11hc rule --class~'(.*[Hh]exchat.*)' --tag=X --focus=off
12hc rule --class~'(.*[Ss]potify.*)' --tag=X --focus=off
13hc rule --class~'(.*[Ss]kype.*)' --tag=VIII --focus=off
diff --git a/herbstluftwm/.config/herbstluftwm/hlwm-theming b/herbstluftwm/.config/herbstluftwm/hlwm-theming
new file mode 100644
index 0000000..0ffd366
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/hlwm-theming
@@ -0,0 +1,31 @@
1#!/usr/bin/env bash
2
3# Theme
4hc attr theme.tiling.reset 1
5hc attr theme.floating.reset 1
6hc set frame_border_width 0
7hc set always_show_frame 0
8hc set frame_bg_transparent 1
9hc set frame_normal_opacity 0
10hc set frame_active_opacity 0
11hc set frame_transparent_width 0
12hc set frame_gap 0
13
14hc attr theme.active.color $color_accent
15hc attr theme.normal.color $color_bg
16hc attr theme.urgent.color orange
17hc attr theme.inner_width 1
18hc attr theme.inner_color $color_bg
19hc attr theme.border_width 3
20hc attr theme.floating.border_width 4
21hc attr theme.floating.outer_width 1
22hc attr theme.floating.outer_color $color_bg
23hc attr theme.active.inner_color $color_bg
24hc attr theme.active.outer_color $color_bg
25hc attr theme.background_color $color_bg
26
27hc set window_gap $window_p
28hc set frame_padding 0
29hc set smart_window_surroundings 0
30hc set smart_frame_surroundings 1
31hc set mouse_recenter_gap 1
diff --git a/herbstluftwm/.config/herbstluftwm/panel_handler.sh b/herbstluftwm/.config/herbstluftwm/panel_handler.sh
new file mode 100755
index 0000000..6bff693
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/panel_handler.sh
@@ -0,0 +1,17 @@
1#!/usr/bin/env bash
2
3#Handle clickable areas
4while read line; do
5 IFS=',' read -a c <<< $(echo $line)
6 case "${c[0]}" in
7 tag)
8 herbstclient use "${c[1]}"
9 echo "herbstclient use \"${c[1]}\""
10 ;;
11 *)
12 echo "${c[0]}: not valid command"
13 ;;
14 esac
15done
16
17# vim: set ts=4 sw=4 tw=0 et :
diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh
index e450337..5797781 100644..100755
--- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh
+++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh
@@ -1,7 +1,11 @@
1#!/bin/bash 1#!/usr/bin/env bash
2battery_icon=("\ue113" "\ue114" "\ue115" "\ue116" "\ue042") 2
3network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "\ue0af") 3icon_font="FontAwesome-10"
4music_icon="\ue05c" 4
5battery_icon=("\uf244" "\uf243" "\uf242" "\uf241" "\uf240" "\uf1e6")
6network_icon=("\uf1eb" "\uf109")
7music_icon="\uf001"
8volume_icon=("\uf026" "\uf027" "\uf028")
5 9
6music() 10music()
7{ 11{
@@ -34,16 +38,21 @@ volume()
34 volumes=$(\ 38 volumes=$(\
35 amixer get Master | \ 39 amixer get Master | \
36 grep "Front Right: Playback"\ 40 grep "Front Right: Playback"\
37 ) 41 )
38 vol=$(\ 42 vol=$(\
39 echo $volumes | \ 43 echo $volumes | \
40 sed "s/.*\[\([0-9]*\)%\].*/\1/"\ 44 sed "s/.*\[\([0-9]*\)%\].*/\1/"\
41 ) 45 )
42 if [ -z $vol ] ; then 46 if [ -z $vol ] ; then
43 echo -e "volume\toff" 47 vol_status="off"
48 elif [ $vol -eq 0 ]; then
49 vol_status="%{F$acolor_fg}${volume_icon[0]} $vol%%{F-}"
50 elif [ $vol -lt 33 ]; then
51 vol_status="%{F$acolor_fg}${volume_icon[1]} $vol%%{F-}"
44 else 52 else
45 echo -e "volume\t%{F$acolor_fg}\ue05d $vol%%%{F-}" 53 vol_status="%{F$acolor_fg}${volume_icon[2]} $vol%%{F-}"
46 fi 54 fi
55 echo -e "volume\t$vol_status"
47 else 56 else
48 echo -e "volume\toff" 57 echo -e "volume\toff"
49 fi 58 fi
@@ -66,7 +75,7 @@ network()
66 if [ $int == $wifi ] ; then 75 if [ $int == $wifi ] ; then
67 iwconfig=$(iwconfig $int) 76 iwconfig=$(iwconfig $int)
68 ssid=$( 77 ssid=$(
69 echo $iwconfig | \ 78 echo $iwconfig | \
70 sed "s/.*ESSID:\(\".*\"\).*/\1/" | \ 79 sed "s/.*ESSID:\(\".*\"\).*/\1/" | \
71 sed "s/.*\(off\/any\).*/\"\1\"/" | \ 80 sed "s/.*\(off\/any\).*/\"\1\"/" | \
72 sed "s/.*\"\(.*\)\".*/\1/" 81 sed "s/.*\"\(.*\)\".*/\1/"
@@ -79,49 +88,53 @@ network()
79 ) 88 )
80 89
81 if [ $ssid == "off/any" ] ; then 90 if [ $ssid == "off/any" ] ; then
82 echo -e "net\toff" 91 net_status="off"
83 elif [ $quality -lt 33 ] ; then
84 echo -e "net\t${network_icon[0]} $ssid"
85 elif [ $quality -lt 66 ] ; then
86 echo -e "net\t${network_icon[1]} $ssid"
87 else 92 else
88 echo -e "net\t${network_icon[2]} $ssid" 93 net_status="${network_icon[0]} $ssid $quality%"
89 fi 94 fi
90 95
91 elif [ $int == $eth ] ; then 96 elif [ $int == $eth ] ; then
92 echo -e "net\t${network_icon[3]} ethernet" 97 net_status="${network_icon[1]} Ethernet"
93 else 98 else
94 echo -e "net\toff" 99 net_status="off"
95 fi 100 fi
101
102 echo -e "net\t$net_status"
96} 103}
97 104
98battery() 105battery()
99{ 106{
100 # Battery 107 # Batteries
101 if $(test -e /sys/class/power_supply/BAT1) ; then 108 bat_info="off"
109 for bat in $(find /sys/class/power_supply | grep BAT); do
110 nr="${bat: -1}"
111 bat_info=""
102 112
103 bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity) 113 bat_lvl=$(cat /sys/class/power_supply/BAT0/capacity)
104 bat_state=$(cat /sys/class/power_supply/BAT1/status) 114 bat_state=$(cat /sys/class/power_supply/BAT0/status)
105 115
106 if [ $bat_state == "Charging" ] ; then 116 if [ $bat_state == "Charging" ] ; then
107 bat_status="${battery_icon[4]}" 117 bat_status="${battery_icon[5]}"
108 elif [ $bat_lvl -lt 10 ] ; then 118 elif [ $bat_lvl -lt 10 ] ; then
109 bat_status="${F$acolor_accent}${battery_icon[0]}${F-}" 119 bat_status="${F$acolor_accent}${battery_icon[0]}${F-}"
110 elif [ $bat_ -lt 33 ] ; then 120 elif [ $bat_ -lt 25 ] ; then
111 bat_status="${battery_icon[1]}" 121 bat_status="${battery_icon[1]}"
112 elif [ $bat_lvl -lt 66 ] ; then 122 elif [ $bat_ -lt 50 ] ; then
113 bat_status="${battery_icon[2]}" 123 bat_status="${battery_icon[2]}"
114 else 124 elif [ $bat_lvl -lt 75 ] ; then
115 bat_status="${battery_icon[3]}" 125 bat_status="${battery_icon[3]}"
126 else
127 bat_status="${battery_icon[4]}"
116 fi 128 fi
117 129
118 echo -e "battery\t$bat_status $bat_lvl%%%{F-}" 130 bat_info+="$nr: $bat_status $bat_lvl%%{F-}"
119 else 131 done
120 echo -e "battery\toff" 132 echo -e "battery\t$bat_info"
121 fi
122} 133}
123 134
124clock() 135clock()
125{ 136{
126 echo -e $(date +$"date\t%{F$acolor_fg}%H:%M:%S %{F$acolor_fg}(%d-%m-%Y)%{F-}") 137 echo -e $(date +$"date\t%{F$acolor_fg}%H:%M:%S %{F$acolor_fg}(%d-%m-%Y)%{F-}")
127} 138}
139
140# vim: set ts=4 sw=4 tw=0 et :
diff --git a/herbstluftwm/.config/herbstluftwm/panel.sh b/herbstluftwm/.config/herbstluftwm/populate_panel.sh
index 41952a6..7afa0c3 100755
--- a/herbstluftwm/.config/herbstluftwm/panel.sh
+++ b/herbstluftwm/.config/herbstluftwm/populate_panel.sh
@@ -1,39 +1,21 @@
1#!/bin/bash 1#!/usr/bin/env bash
2 2
3hc() { 3source "$HLWM_CONF_DIR/themes/current"
4 "${herbstclient_command[@]:-herbstclient}" "$@" ; 4source "$HLWM_CONF_DIR/panel_indicators.sh"
5}
6 5
7dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 6monitor=$1
8source "$dir/theme.sh"
9source "$dir/panel_indicators.sh"
10
11monitor=${1:-0}
12
13geometry=( $(herbstclient monitor_rect "$monitor") )
14if [ -z "$geometry" ] ;then
15 echo "Invalid monitor $monitor"
16 exit 1
17fi
18# geometry has the format W H X Y
19x=$(echo "${geometry[0]} + $window_p" | bc)
20y=$(echo "${geometry[1]} + $window_p" | bc)
21panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc)
22bar_opts="-g ${panel_width}x${panel_h}+${x}+${y} -f $font,$font_sec -u 2 -B $acolor_bg -F $acolor_fg"
23
24hc pad $monitor $(echo "$panel_h + $window_p" | bc)
25 7
26if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then 8if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
27 # mawk needs "-W interactive" to line-buffer stdout correctly 9 # mawk needs "-W interactive" to line-buffer stdout correctly
28 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504 10 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504
29 uniq_linebuffered() { 11 uniq_linebuffered() {
30 awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@" 12 awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
31 } 13 }
32else 14else
33 # other awk versions (e.g. gawk) issue a warning with "-W interactive", so 15 # other awk versions (e.g. gawk) issue a warning with "-W interactive", so
34 # we don't want to use it there. 16 # we don't want to use it there.
35 uniq_linebuffered() { 17 uniq_linebuffered() {
36 awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" 18 awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
37 } 19 }
38fi 20fi
39 21
@@ -42,29 +24,36 @@ fi
42 # <eventname>\t<data> [...] 24 # <eventname>\t<data> [...]
43 # e.g. 25 # e.g.
44 # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 26 # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29
27
45 while true ; do 28 while true ; do
46 music 29 music
47 volume 30 volume &
48 network 31 network &
49 battery 32 battery &
50 clock 33 clock &
51 sleep 1 || break 34 sleep 1 || break
52 done > >(uniq_linebuffered) & 35 done > >(uniq_linebuffered) &
36
53 childpid=$! 37 childpid=$!
54 hc --idle 38 hc --idle
55 kill $childpid 39 kill $childpid
40
56} 2> /dev/null | { 41} 2> /dev/null | {
57 42
58 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" 43 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
44
59 visible=true 45 visible=true
46
60 date="" 47 date=""
61 volume="" 48 volume=""
62 battery="" 49 battery=""
63 net="" 50 net=""
64 windowtitle="" 51 windowtitle=""
52
53 separator="%{F$acolor_accent}|%{F-}"
54
65 while true ; do 55 while true ; do
66 separator="%{F$acolor_accent}|%{F-}" 56
67 # draw tags
68 for i in "${tags[@]}" ; do 57 for i in "${tags[@]}" ; do
69 case ${i:0:1} in 58 case ${i:0:1} in
70 '#') 59 '#')
@@ -85,15 +74,16 @@ fi
85 esac 74 esac
86 echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}" 75 echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}"
87 done 76 done
77
88 echo -n "$separator%{F-}%{B-} " 78 echo -n "$separator%{F-}%{B-} "
89 echo -n "${windowtitle//^/^^}" 79 echo -n "${windowtitle//^/^^}"
90 80
91 #Right part of panel 81 # Right part of panel
92 right="$music$volume$net$battery$date " 82 right="$music$volume$net$battery$date "
93 echo -n "%{r}$right" 83 echo -n "%{r}$right"
94 84
95 #DO NOT REMOVE THIS ECHO 85 #DO NOT REMOVE THIS ECHO
96 echo 86 echo
97 87
98 # wait for next event 88 # wait for next event
99 IFS=$'\t' read -ra cmd || break 89 IFS=$'\t' read -ra cmd || break
@@ -102,38 +92,38 @@ fi
102 #echo "resetting tags" >&2 92 #echo "resetting tags" >&2
103 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" 93 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
104 ;; 94 ;;
105 music) 95 music)
106 music="${cmd[@]:1}" 96 music="${cmd[@]:1}"
107 if [ $music == "off" ] ; then 97 if [ $music == "off" ] ; then
108 music="" 98 music=""
109 else 99 else
110 music="$music $separator%{B-} " 100 music="$music $separator%{B-} "
111 fi 101 fi
112 ;; 102 ;;
113 volume) 103 volume)
114 volume="${cmd[@]:1}" 104 volume="${cmd[@]:1}"
115 if [ $volume == "off" ] ; then 105 if [ $volume == "off" ] ; then
116 volume="" 106 volume=""
117 else 107 else
118 volume="$volume $separator%{B-} " 108 volume="$volume $separator%{B-} "
119 fi 109 fi
120 ;; 110 ;;
121 net) 111 net)
122 net="${cmd[@]:1}" 112 net="${cmd[@]:1}"
123 if [ $net = "off" ] ; then 113 if [ $net = "off" ] ; then
124 net="" 114 net=""
125 else 115 else
126 net="$net $separator%{B-} " 116 net="$net $separator%{B-} "
127 fi 117 fi
128 ;; 118 ;;
129 battery) 119 battery)
130 battery="${cmd[@]:1}" 120 battery="${cmd[@]:1}"
131 if [ $battery == "off" ] ; then 121 if [ $battery == "off" ] ; then
132 battery="" 122 battery=""
133 else 123 else
134 battery="$battery $separator%{B-} " 124 battery="$battery $separator%{B-} "
135 fi 125 fi
136 ;; 126 ;;
137 date) 127 date)
138 #echo "resetting date" >&2 128 #echo "resetting date" >&2
139 date="${cmd[@]:1}" 129 date="${cmd[@]:1}"
@@ -143,18 +133,7 @@ fi
143 ;; 133 ;;
144 esac 134 esac
145 done 135 done
146} 2> /dev/null | lemonbar $bar_opts | { 136
147 #Handle clickable areas 137} 2> /dev/null
148 while read line; do 138
149 IFS=',' read -a c <<< $(echo $line) 139# vim: set ts=4 sw=4 tw=0 et :
150 case "${c[0]}" in
151 tag)
152 herbstclient use "${c[1]}"
153 echo "herbstclient use \"${c[1]}\""
154 ;;
155 *)
156 echo "${c[0]}: not valid command"
157 ;;
158 esac
159 done
160}
diff --git a/herbstluftwm/.config/herbstluftwm/start.sh b/herbstluftwm/.config/herbstluftwm/start.sh
index f10fca6..53b9e45 100755
--- a/herbstluftwm/.config/herbstluftwm/start.sh
+++ b/herbstluftwm/.config/herbstluftwm/start.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/usr/bin/env bash
2 2
3opts=($@) 3opts=($@)
4 4
diff --git a/herbstluftwm/.config/herbstluftwm/start_panel.sh b/herbstluftwm/.config/herbstluftwm/start_panel.sh
new file mode 100755
index 0000000..e573a53
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/start_panel.sh
@@ -0,0 +1,34 @@
1#!/usr/bin/env bash
2source "$HLWM_CONF_DIR/themes/current"
3source "$HLWM_CONF_DIR/panel_indicators.sh"
4
5# Check for valid monitors
6monitor=${1:-0}
7geometry=($(herbstclient monitor_rect "$monitor"))
8if [ -z "$geometry" ] ;then
9 echo "Invalid monitor $monitor"
10 exit 1
11fi
12
13# Make sure only one instanve per monitor is running
14lockfile="/tmp/start_panel-$monitor.lck"
15if [ -e "$lockfile" ] && kill -0 $(cat $lockfile); then
16 pkill -P $(cat $lockfile)
17fi
18trap "rm -f $lockfile; exit" INT TERM EXIT
19echo "$$" > "$lockfile"
20
21# Geometry has the format W H X Y
22x=$(echo "${geometry[0]} + $window_p" | bc)
23y=$(echo "${geometry[1]} + $window_p" | bc)
24panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc)
25
26# Apply padding to make room for the panel
27hc pad $monitor $(echo "$panel_h + $window_p" | bc)
28
29# Start the panel
30$HLWM_CONF_DIR/populate_panel.sh $monitor |
31lemonbar -g ${panel_width}x${panel_h}+${x}+${y} -f "$font" -f "$icon_font" -u2 -B$acolor_bg -F$acolor_fg |
32$HLWM_CONF_DIR/panel_handler.sh
33
34# vim: set ts=4 sw=4 tw=0 et :
diff --git a/herbstluftwm/.config/herbstluftwm/themes/current b/herbstluftwm/.config/herbstluftwm/themes/current
new file mode 120000
index 0000000..8a80c5f
--- /dev/null
+++ b/herbstluftwm/.config/herbstluftwm/themes/current
@@ -0,0 +1 @@
purpur \ No newline at end of file
diff --git a/herbstluftwm/.config/herbstluftwm/theme.sh b/herbstluftwm/.config/herbstluftwm/themes/purpur
index 34e22a7..5fedc6d 100644
--- a/herbstluftwm/.config/herbstluftwm/theme.sh
+++ b/herbstluftwm/.config/herbstluftwm/themes/purpur
@@ -1,7 +1,9 @@
1#!/usr/bin/env bash
2
1# Get color from ~/.Xresources 3# Get color from ~/.Xresources
2get_x_color() { 4get_x_color() {
3 xresources=$(cat ~/.Xresources) 5 xresources=$(cat ~/.Xresources)
4 color=$(echo $xresources | sed "s/.*\*color$1: \(#[0-9A-Fa-f]*\).*/\1/") 6 color=$(echo $xresources | sed "s/.*\*color$1: \(\#[0-9A-Fa-f]*\).*/\1/")
5 echo $color 7 echo $color
6} 8}
7 9
@@ -18,9 +20,8 @@ wallpaper="$HOME/.config/herbstluftwm/poligons.png"
18window_p=20 20window_p=20
19 21
20# Panel 22# Panel
21panel_h=24 23panel_h=25
22font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*" 24font="DejaVu Sans Mono-10"
23font_sec="-*-stlarch-medium-*-*-*-10-*-*-*-*-*-*-*"
24 25
25# Colors 26# Colors
26color_fg=$(get_x_color 15) 27color_fg=$(get_x_color 15)