diff options
| author | 2014-10-05 21:41:33 +0200 | |
|---|---|---|
| committer | 2014-10-05 21:41:33 +0200 | |
| commit | d9d9c28ed02611bdb2e37039fb62a19fc39815ad (patch) | |
| tree | b898e7aaf7f51dbdf5fc0d4b723743647d4bedac | |
| parent | f7797474ecbc52177efe2fd2bc728bd7e564fcf3 (diff) | |
| download | dotfiles-d9d9c28ed02611bdb2e37039fb62a19fc39815ad.tar.gz dotfiles-d9d9c28ed02611bdb2e37039fb62a19fc39815ad.tar.bz2 dotfiles-d9d9c28ed02611bdb2e37039fb62a19fc39815ad.zip | |
Added notifications
| -rwxr-xr-x | .config/herbstluftwm/autostart | 118 | ||||
| -rwxr-xr-x | .config/herbstluftwm/notify.sh | 30 | ||||
| -rwxr-xr-x | .config/herbstluftwm/panel.sh | 27 | ||||
| -rwxr-xr-x | .config/herbstluftwm/popup.sh | 60 | ||||
| -rwxr-xr-x | .config/herbstluftwm/start.sh | 13 | ||||
| -rw-r--r-- | Makefile | 2 |
6 files changed, 156 insertions, 94 deletions
diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart index b5115cf..fb6d2e0 100755 --- a/.config/herbstluftwm/autostart +++ b/.config/herbstluftwm/autostart | |||
| @@ -6,33 +6,30 @@ hc() { | |||
| 6 | herbstclient "$@" | 6 | herbstclient "$@" |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | #get colors from .Xresources | 9 | get_x_color() { |
| 10 | get_xcolor(){ | 10 | xresources=$(cat ~/.Xresources) |
| 11 | xresources=$(\ | 11 | color=$(echo $xresources | sed "s/.*\*color$1: \(#[0-9A-Fa-f]*\).*/\1/") |
| 12 | cat ~/.Xresources\ | 12 | echo $color |
| 13 | ) | ||
| 14 | color=$(\ | ||
| 15 | echo $xresources | \ | ||
| 16 | sed "s/.*\*color$1: \(#[0-9A-Fa-f]*\).*/\1/"\ | ||
| 17 | ) | ||
| 18 | echo $color | ||
| 19 | } | 13 | } |
| 20 | 14 | ||
| 21 | #Wallpaper | 15 | hlwm_scripts="$HOME/.config/herbstluftwm" |
| 22 | WALLPAPER=/home/tom/Pictures/rocks.jpg | 16 | |
| 17 | #wallpaper | ||
| 18 | wallpaper=/home/tom/Pictures/rocks.jpg | ||
| 23 | 19 | ||
| 24 | #Numix color palette | 20 | #Numix color palette |
| 25 | LIGHT=$(get_xcolor 15) | 21 | export WM_LIGHT=$(get_x_color 15) |
| 26 | LLIGHT=$(get_xcolor 7) | 22 | export WM_LLIGHT=$(get_x_color 7) |
| 27 | ACCENT=$(get_xcolor 12) | 23 | export WM_ACCENT=$(get_x_color 12) |
| 28 | LDARK=$(get_xcolor 8) | 24 | export WM_LDARK=$(get_x_color 8) |
| 29 | DARK=$(get_xcolor 0) | 25 | export WM_DARK=$(get_x_color 0) |
| 30 | 26 | ||
| 31 | #Panel and padding | 27 | #Panel and window_p |
| 32 | padding=20 | 28 | window_p=20 |
| 33 | monitor_width=$(hc list_monitors | sed 's/^[0-9]: \([0-9]*\)x.*$/\1/') | 29 | monitor_w=$(hc list_monitors | sed 's/^[0-9]: \([0-9]*\)x.*$/\1/') |
| 34 | panel_height=24 | 30 | panel_h=24 |
| 35 | panel_width=$(echo "$monitor_width - (2 * $padding)" | bc) | 31 | panel_w=$(echo "$monitor_w - (2 * $window_p)" | bc) |
| 32 | dmenu_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" | ||
| 36 | 33 | ||
| 37 | hc emir_hook reload | 34 | hc emir_hook reload |
| 38 | 35 | ||
| @@ -46,7 +43,7 @@ hc keybind $Mod-Shift-q quit | |||
| 46 | hc keybind $Mod-Shift-r reload | 43 | hc keybind $Mod-Shift-r reload |
| 47 | hc keybind $Mod-Shift-c close | 44 | hc keybind $Mod-Shift-c close |
| 48 | hc keybind $Mod-Return spawn xterm | 45 | hc keybind $Mod-Return spawn xterm |
| 49 | hc 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 | 46 | hc keybind $Mod-grave spawn dmenu_run $dmenu_opts |
| 50 | hc keybind XF86AudioLowerVolume spawn amixer set Master 5%- | 47 | hc keybind XF86AudioLowerVolume spawn amixer set Master 5%- |
| 51 | hc keybind XF86AudioRaiseVolume spawn amixer set Master 5%+ | 48 | hc keybind XF86AudioRaiseVolume spawn amixer set Master 5%+ |
| 52 | 49 | ||
| @@ -134,30 +131,30 @@ hc set focus_follows_mouse 1 | |||
| 134 | # theme | 131 | # theme |
| 135 | hc attr theme.tiling.reset 1 | 132 | hc attr theme.tiling.reset 1 |
| 136 | hc attr theme.floating.reset 1 | 133 | hc attr theme.floating.reset 1 |
| 137 | hc set frame_border_active_color $LDARK | 134 | hc set frame_border_active_color $WM_LDARK |
| 138 | hc set frame_border_normal_color $DARK | 135 | hc set frame_border_normal_color $WM_DARK |
| 139 | hc set frame_bg_normal_color $LDARK | 136 | hc set frame_bg_normal_color $WM_LDARK |
| 140 | hc set frame_bg_active_color $DARK | 137 | hc set frame_bg_active_color $WM_DARK |
| 141 | hc set frame_border_width 0 | 138 | hc set frame_border_width 0 |
| 142 | hc set always_show_frame 0 | 139 | hc set always_show_frame 0 |
| 143 | hc set frame_bg_transparent 1 | 140 | hc set frame_bg_transparent 1 |
| 144 | hc set frame_transparent_width 0 | 141 | hc set frame_transparent_width 0 |
| 145 | hc set frame_gap 0 | 142 | hc set frame_gap 0 |
| 146 | 143 | ||
| 147 | hc attr theme.active.color $ACCENT | 144 | hc attr theme.active.color $WM_ACCENT |
| 148 | hc attr theme.normal.color $DARK | 145 | hc attr theme.normal.color $WM_DARK |
| 149 | hc attr theme.urgent.color orange | 146 | hc attr theme.urgent.color orange |
| 150 | hc attr theme.inner_width 1 | 147 | hc attr theme.inner_width 1 |
| 151 | hc attr theme.inner_color $DARK | 148 | hc attr theme.inner_color $WM_DARK |
| 152 | hc attr theme.border_width 3 | 149 | hc attr theme.border_width 3 |
| 153 | hc attr theme.floating.border_width 4 | 150 | hc attr theme.floating.border_width 4 |
| 154 | hc attr theme.floating.outer_width 1 | 151 | hc attr theme.floating.outer_width 1 |
| 155 | hc attr theme.floating.outer_color $DARk | 152 | hc attr theme.floating.outer_color $WM_DARK |
| 156 | hc attr theme.active.inner_color $DARK | 153 | hc attr theme.active.inner_color $WM_DARK |
| 157 | hc attr theme.active.outer_color $DARK | 154 | hc attr theme.active.outer_color $WM_DARK |
| 158 | hc attr theme.background_color $DARK | 155 | hc attr theme.background_color $WM_DARK |
| 159 | 156 | ||
| 160 | hc set window_gap $padding | 157 | hc set window_gap $window_p |
| 161 | hc set frame_padding 0 | 158 | hc set frame_padding 0 |
| 162 | hc set smart_window_surroundings 0 | 159 | hc set smart_window_surroundings 0 |
| 163 | hc set smart_frame_surroundings 1 | 160 | hc set smart_frame_surroundings 1 |
| @@ -179,20 +176,15 @@ hc unlock | |||
| 179 | 176 | ||
| 180 | herbstclient set tree_style '╾│ ├└╼─┐' | 177 | herbstclient set tree_style '╾│ ├└╼─┐' |
| 181 | 178 | ||
| 182 | # do multi monitor setup here, e.g.: | ||
| 183 | # hc set_monitors 1280x1024+0+0 1280x1024+1280+0 | ||
| 184 | # or simply: | ||
| 185 | # hc detect_monitors | ||
| 186 | |||
| 187 | #Start panel in all monitors | 179 | #Start panel in all monitors |
| 188 | start_panel() { | 180 | start_panel() { |
| 189 | for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do | 181 | for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do |
| 190 | "$1" $monitor $panel_height $padding $LIGHT $LLIGHT $ACCENT $LDARK $DARK $2& | 182 | "$1" $monitor $panel_h $window_p & |
| 191 | done | 183 | done |
| 192 | } | 184 | } |
| 193 | 185 | ||
| 194 | # find the panel | 186 | # find the panel |
| 195 | panel=~/.config/herbstluftwm/panel.sh | 187 | panel=$hlwm_scripts/panel.sh |
| 196 | [ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh | 188 | [ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh |
| 197 | if pgrep panel.sh >> /dev/null | 189 | if pgrep panel.sh >> /dev/null |
| 198 | then | 190 | then |
| @@ -202,37 +194,9 @@ else | |||
| 202 | start_panel $panel | 194 | start_panel $panel |
| 203 | fi | 195 | fi |
| 204 | 196 | ||
| 205 | #Wallpaper | 197 | $hlwm_scripts/start.sh feh --bg-fill $wallpaper |
| 206 | feh --bg-fill $WALLPAPER | 198 | $hlwm_scripts/start.sh compton --config ~/.compton |
| 207 | 199 | $hlwm_scripts/start.sh xrdb -load ~/.Xresources | |
| 208 | #Start compton if not running | 200 | $hlwm_scripts/start.sh pulseaudio --start |
| 209 | start_compton(){ compton --config ~/.compton & } | 201 | $hlwm_scripts/start.sh xscreensaver -no-splash |
| 210 | if pgrep compton >> /dev/null | 202 | $hlwm_scripts/start.sh $hlwm_scripts/notify.sh $monitor_w $window_p $panel_h $hlwm_scripts/popup.sh |
| 211 | then | ||
| 212 | kill $(pgrep compton) | ||
| 213 | start_compton | ||
| 214 | else | ||
| 215 | start_compton | ||
| 216 | fi | ||
| 217 | |||
| 218 | #Load .Xresources | ||
| 219 | xrdb -load ~/.Xresources | ||
| 220 | |||
| 221 | #Start pulseaudio | ||
| 222 | if pgrep pulseaudio >> /dev/null | ||
| 223 | then | ||
| 224 | kill $(pgrep pulseaudio) | ||
| 225 | pulseaudio --start | ||
| 226 | else | ||
| 227 | pulseaudio --start | ||
| 228 | fi | ||
| 229 | |||
| 230 | #Start xscreensaver | ||
| 231 | if pgrep xscreensaver >> /dev/null | ||
| 232 | then | ||
| 233 | kill $(pgrep xscreensaver) | ||
| 234 | xscreensaver -no-splash& | ||
| 235 | else | ||
| 236 | xscreensaver -no-splash& | ||
| 237 | fi | ||
| 238 | |||
diff --git a/.config/herbstluftwm/notify.sh b/.config/herbstluftwm/notify.sh new file mode 100755 index 0000000..190d496 --- /dev/null +++ b/.config/herbstluftwm/notify.sh | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | monitor_w=$1 | ||
| 4 | window_p=$2 | ||
| 5 | panel_h=$3 | ||
| 6 | |||
| 7 | popup_w=$(echo "$monitor_w - (2 * $window_p)" | bc) | ||
| 8 | popup_h=$panel_h | ||
| 9 | popup_x=$window_p | ||
| 10 | popup_y=$window_p | ||
| 11 | |||
| 12 | popup_opts="-w $popup_w -h $popup_h -x $popup_x -y $popup_y" | ||
| 13 | |||
| 14 | while 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; | ||
| 30 | done | ||
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh index 4e35d0d..ac06100 100755 --- a/.config/herbstluftwm/panel.sh +++ b/.config/herbstluftwm/panel.sh | |||
| @@ -13,11 +13,11 @@ monitor=${1:-0} | |||
| 13 | panel_height=$2 | 13 | panel_height=$2 |
| 14 | padding=$3 | 14 | padding=$3 |
| 15 | 15 | ||
| 16 | light=$(add_alpha_channel $4) | 16 | light=$(add_alpha_channel $WM_LIGHT) |
| 17 | llight=$(add_alpha_channel $5) | 17 | llight=$(add_alpha_channel $WM_LLIGHT) |
| 18 | accent=$(add_alpha_channel $6) | 18 | accent=$(add_alpha_channel $WM_ACCENT) |
| 19 | ldark=$(add_alpha_channel $7) | 19 | ldark=$(add_alpha_channel $WM_LDARK) |
| 20 | dark=$(add_alpha_channel $8) | 20 | dark=$(add_alpha_channel $WM_DARK) |
