aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.config/herbstluftwm/autostart31
-rwxr-xr-x.config/herbstluftwm/panel.sh85
2 files changed, 57 insertions, 59 deletions
diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart
index 0fb9ea7..16101b3 100755
--- a/.config/herbstluftwm/autostart
+++ b/.config/herbstluftwm/autostart
@@ -2,6 +2,10 @@
2 2
3# this is a simple config for herbstluftwm 3# this is a simple config for herbstluftwm
4 4
5hc() {
6 herbstclient "$@"
7}
8
5#get colors from .Xresources 9#get colors from .Xresources
6get_xcolor(){ 10get_xcolor(){
7 xresources=$(\ 11 xresources=$(\
@@ -15,26 +19,23 @@ get_xcolor(){
15} 19}
16 20
17#Wallpaper 21#Wallpaper
18WALLPAPER=/home/tom/Pictures/ThDLxEW.jpg 22WALLPAPER=/home/tom/Pictures/web16002.jpg
19 23
20#Numix color palette 24#Numix color palette
21LIGHT=$(get_xcolor 15) 25LIGHT=$(get_xcolor 15)
22LLIGHT=$(get_xcolor 7) 26LLIGHT=$(get_xcolor 7)
23ACCENT=$(get_xcolor 9) 27ACCENT=$(get_xcolor 12)
24LDARK=$(get_xcolor 8) 28LDARK=$(get_xcolor 8)
25DARK=$(get_xcolor 0) 29DARK=$(get_xcolor 0)
26 30
27#Panel 31#Panel and padding
28PANEL_HEIGHT=24 32padding=20
29 33monitor_width=$(hc list_monitors | sed 's/^[0-9]: \([0-9]*\)x.*$/\1/')
30hc() { 34panel_height=24
31 herbstclient "$@" 35panel_width=$(echo "$monitor_width - (2 * $padding)" | bc)
32}
33 36
34hc emir_hook reload 37hc emir_hook reload
35 38
36xsetroot -solid $ACCENT
37
38# remove all existing keybindings 39# remove all existing keybindings
39hc keyunbind --all 40hc keyunbind --all
40 41
@@ -45,7 +46,7 @@ hc keybind $Mod-Shift-q quit
45hc keybind $Mod-Shift-r reload 46hc keybind $Mod-Shift-r reload
46hc keybind $Mod-Shift-c close 47hc keybind $Mod-Shift-c close
47hc keybind $Mod-Return spawn xterm 48hc keybind $Mod-Return spawn xterm
48hc keybind $Mod-grave spawn dmenu_run -h $PANEL_HEIGHT -p "Run:" -nb $DARK -nf $LIGHT -sb $ACCENT -sf $DARK 49hc keybind $Mod-grave spawn dmenu_run -h $panel_height -w $panel_width -x $padding -y $padding -p "Run:" -nb $DARK -nf $LIGHT -sb $ACCENT -sf $DARK
49hc keybind XF86AudioLowerVolume spawn amixer set Master 5%- 50hc keybind XF86AudioLowerVolume spawn amixer set Master 5%-
50hc keybind XF86AudioRaiseVolume spawn amixer set Master 5%+ 51hc keybind XF86AudioRaiseVolume spawn amixer set Master 5%+
51 52
@@ -94,7 +95,7 @@ tag_keys=( {1..9} 0 )
94 95
95# Selecting workspaces 96# Selecting workspaces
96hc keybind Alt-Control-Left use_index -1 97hc keybind Alt-Control-Left use_index -1
97hc keybind Alt-Control-Right use_index +1 98hc keybind Alt-Control-Right use_index +1
98hc rename default "${tag_names[0]}" || true 99hc rename default "${tag_names[0]}" || true
99for i in ${!tag_names[@]} ; do 100for i in ${!tag_names[@]} ; do
100 hc add "${tag_names[$i]}" 101 hc add "${tag_names[$i]}"
@@ -156,7 +157,7 @@ hc attr theme.active.inner_color $DARK
156hc attr theme.active.outer_color $DARK 157hc attr theme.active.outer_color $DARK
157hc attr theme.background_color $DARK 158hc attr theme.background_color $DARK
158 159
159hc set window_gap 20 160hc set window_gap $padding
160hc set frame_padding 0 161hc set frame_padding 0
161hc set smart_window_surroundings 0 162hc set smart_window_surroundings 0
162hc set smart_frame_surroundings 1 163hc set smart_frame_surroundings 1
@@ -186,7 +187,7 @@ herbstclient set tree_style '╾│ ├└╼─┐'
186#Start panel in all monitors 187#Start panel in all monitors
187start_panel() { 188start_panel() {
188 for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do 189 for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
189 "$1" $monitor $PANEL_HEIGHT $LIGHT $LLIGHT $ACCENT $LDARK $DARK $2& 190 "$1" $monitor $panel_height $padding $LIGHT $LLIGHT $ACCENT $LDARK $DARK $2&
190 done 191 done
191} 192}
192 193
@@ -202,7 +203,7 @@ else
202fi 203fi
203 204
204#Wallpaper 205#Wallpaper
205feh --bg-scale $WALLPAPER 206feh --bg-fill $WALLPAPER
206 207
207#Start compton if not running 208#Start compton if not running
208start_compton(){ compton -c -z & } 209start_compton(){ compton -c -z & }
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh
index 7dfed18..7a4627d 100755
--- a/.config/herbstluftwm/panel.sh
+++ b/.config/herbstluftwm/panel.sh
@@ -1,28 +1,23 @@
1#!/bin/bash 1#!/bin/bash
2 2
3hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;} 3hc() {
4monitor=${1:-0} 4 "${herbstclient_command[@]:-herbstclient}" "$@" ;
5geometry=( $(herbstclient monitor_rect "$monitor") ) 5}
6if [ -z "$geometry" ] ;then
7 echo "Invalid monitor $monitor"
8 exit 1
9fi
10# geometry has the format W H X Y
11x=${geometry[0]}
12y=${geometry[1]}
13panel_width=${geometry[2]}
14 6
15add_alpha_channel(){ 7add_alpha_channel(){
16 echo "$1" | \ 8 echo "$1" | \
17 sed "s/.*#\([0-9a-fA-F]*\).*/#ff\1/" 9 sed "s/.*#\([0-9a-fA-F]*\).*/#ff\1/"
18} 10}
19 11
12monitor=${1:-0}
20panel_height=$2 13panel_height=$2
21light=$(add_alpha_channel $3) 14padding=$3
22llight=$(add_alpha_channel $4) 15
23accent=$(add_alpha_channel $5) 16light=$(add_alpha_channel $4)
24ldark=$(add_alpha_channel $6) 17llight=$(add_alpha_channel $5)
25dark=$(add_alpha_channel $7) 18accent=$(add_alpha_channel $6)
19ldark=$(add_alpha_channel $7)
20dark=$(add_alpha_channel $8)
26 21
27font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*" 22font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*"
28#font="" 23#font=""
@@ -32,7 +27,17 @@ selected_txt=$dark
32normal_txt=$light 27normal_txt=$light
33inactive_txt=$llight 28inactive_txt=$llight
34 29
35hc pad $monitor $panel_height 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)
39
40hc pad $monitor $(echo "$panel_height + $padding" | bc)
36 41
37if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then 42if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
38 # mawk needs "-W interactive" to line-buffer stdout correctly 43 # mawk needs "-W interactive" to line-buffer stdout correctly
@@ -79,7 +84,7 @@ fi
79 # Network 84 # Network
80 iwconfig=$(iwconfig wlp3s0) 85 iwconfig=$(iwconfig wlp3s0)
81 if [ -z $iwconfig ] ; then 86 if [ -z $iwconfig ] ; then
82 echo -e "wireless\toff" 87 echo -e "net\toff"
83 else 88 else
84 ssid=$(\ 89 ssid=$(\
85 echo $iwconfig | \ 90 echo $iwconfig | \
@@ -89,33 +94,25 @@ fi
89 ) 94 )
90 if [ $ssid = "off/any" ] ; then 95 if [ $ssid = "off/any" ] ; then
91 ifconf=$ 96 ifconf=$
92 echo -e "wireless\t%{F$normal_txt}Wlan: No connection%{F-}" 97 echo -e "net\t%{F$normal_txt}Net: No connection%{F-}"
93 else 98 else
94 IFS=',' read -a quality_info <<< $(\ 99 echo -e "net\t%{F$normal_txt}Net: $ssid%{F-}"
95 echo $iwconfig | \
96 sed "s/.*Link Quality=\([0-9]*\)\/\([0-9]*\).*/\1,\2/"\
97 )
98 cur_qual=${quality_info[0]}
99 max_qual=${quality_info[1]}
100 quality_p=$(echo "$cur_qual*100/$max_qual" | bc)
101 echo -e "wireless\t%{F$normal_txt}Wlan: $quality_p%% %{F$inactive_txt}($ssid)%{F-}"
102 fi 100 fi
103 fi 101 fi
104 102
105 # Battery 103 # Battery
106 IFS=' ' read -a batinfo <<< $(acpi -b) 104 if $(test -e /sys/class/power_supply/BAT1) ; then
107 if [ -z $batinfo ] ; then 105 charge=$(cat /sys/class/power_supply/BAT1/capacity)
108 echo -e "battery\toff"
109 else
110 charge=$(echo ${batinfo[3]} | tr -d '%,')
111 if [ $charge -lt 15 ] ; then 106 if [ $charge -lt 15 ] ; then
112 bat_color=$accent 107 bat_color=$accent
113 else 108 else
114 bat_color=$normal_txt 109 bat_color=$normal_txt
115 fi 110 fi
116 state=$(echo ${batinfo[2]} | tr -d ',') 111 state=$(cat /sys/class/power_supply/BAT1/status)
117 remaining=$(echo ${batinfo[4]}) 112 remaining=$(echo ${batinfo[4]})
118 echo -e "battery\t%{F$normal_txt}$state: %{F$bat_color}$charge%{F$normal_txt}%% %{F$inactive_txt}($remaining)%{F-}" 113 echo -e "battery\t%{F$normal_txt}$state: %{F$bat_color}$charge%{F$normal_txt}%% %{F-}"
114 else
115 echo -e "battery\toff"
119 fi 116 fi
120 117
121 # Time 118 # Time
@@ -132,7 +129,7 @@ fi
132 date="" 129 date=""
133 volume="" 130 volume=""
134 battery="" 131 battery=""
135 wireless="" 132 net=""