diff options
| author | 2014-05-15 16:40:26 +0200 | |
|---|---|---|
| committer | 2014-05-15 16:40:26 +0200 | |
| commit | 1de9064f69b45b922a13996e54259ec8fa0c844a (patch) | |
| tree | c08cb02b6e3b23fe57d23de9b951e4a80a727c2c /.config | |
| parent | f228e2ad2aaac15ae522565661698decc84ccbca (diff) | |
| download | dotfiles-1de9064f69b45b922a13996e54259ec8fa0c844a.tar.gz dotfiles-1de9064f69b45b922a13996e54259ec8fa0c844a.tar.bz2 dotfiles-1de9064f69b45b922a13996e54259ec8fa0c844a.zip | |
Added sound functionalities to HLWM
Diffstat (limited to '.config')
| -rwxr-xr-x | .config/herbstluftwm/autostart | 11 | ||||
| -rwxr-xr-x | .config/herbstluftwm/panel.sh | 69 |
2 files changed, 62 insertions, 18 deletions
diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart index e9cf3ee..cb59263 100755 --- a/.config/herbstluftwm/autostart +++ b/.config/herbstluftwm/autostart | |||
| @@ -34,6 +34,8 @@ hc keybind $Mod-Shift-r reload | |||
| 34 | hc keybind $Mod-Shift-c close | 34 | hc keybind $Mod-Shift-c close |
| 35 | hc keybind $Mod-Return spawn xterm | 35 | hc keybind $Mod-Return spawn xterm |
| 36 | hc keybind $Mod-grave spawn dmenu_run -h $PANEL_HEIGHT -p "Run:" -nb $DARK -nf $LIGHT -sb $ACCENT -sf $DARK | 36 | hc keybind $Mod-grave spawn dmenu_run -h $PANEL_HEIGHT -p "Run:" -nb $DARK -nf $LIGHT -sb $ACCENT -sf $DARK |
| 37 | hc keybind XF86AudioLowerVolume spawn amixer set Master 5%- | ||
| 38 | hc keybind XF86AudioRaiseVolume spawn amixer set Master 5%+ | ||
| 37 | 39 | ||
| 38 | # basic movement | 40 | # basic movement |
| 39 | # focusing clients | 41 | # focusing clients |
| @@ -202,3 +204,12 @@ fi | |||
| 202 | 204 | ||
| 203 | #Load .Xresources | 205 | #Load .Xresources |
| 204 | xrdb -load ~/.Xresources | 206 | xrdb -load ~/.Xresources |
| 207 | |||
| 208 | #Start pulseaudio | ||
| 209 | if pgrep pulseaudio >> /dev/null | ||
| 210 | then | ||
| 211 | kill $(pgrep pulseaudio) | ||
| 212 | pulseaudio --start | ||
| 213 | else | ||
| 214 | pulseaudio --start | ||
| 215 | fi | ||
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh index 3448e62..b243d73 100755 --- a/.config/herbstluftwm/panel.sh +++ b/.config/herbstluftwm/panel.sh | |||
| @@ -76,29 +76,58 @@ hc pad $monitor $panel_height | |||
| 76 | # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 | 76 | # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 |
| 77 | 77 | ||
| 78 | while true ; do | 78 | while true ; do |
| 79 | # Volume | ||
| 80 | volumes=$(\ | ||
| 81 | amixer get Master | \ | ||
| 82 | grep Front\ | ||
| 83 | ) | ||
| 84 | vol=$(\ | ||
| 85 | echo $volumes | \ | ||
| 86 | sed "s/.*\[\([0-9]*\)%\].*/\1/"\ | ||
| 87 | ) | ||
| 88 | if [ -z $vol ] ; then | ||
| 89 | echo -e "volume\t^fg($normax_txt)Audio off" | ||
| 90 | else | ||
| 91 | echo -e "volume\t^fg($normal_txt)Volume: $vol%" | ||
| 92 | fi | ||
| 93 | |||
| 79 | # Network | 94 | # Network |
| 80 | iwconfig=$(iwconfig wlp3s0) | 95 | iwconfig=$(iwconfig wlp3s0) |
| 81 | ssid_regex=".*ESSID:\"\(.*\)\".*" | 96 | ssid=$(\ |
| 82 | quality_regex=".*Link Quality=\([0-9]*\)\/\([0-9]*\).*" | 97 | echo $iwconfig | \ |
| 83 | ssid=$(echo $iwconfig | sed "s/$ssid_regex/\1/") | 98 | sed "s/.*ESSID:\(\".*\"\).*/\1/" | \ |
| 84 | IFS=',' read -a quality_info <<< $(echo $iwconfig | sed "s/$quality_regex/\1,\2/") | 99 | sed "s/.*\(off\/any\).*/\"\1\"/" | \ |
| 85 | cur_qual=${quality_info[0]} | 100 | sed "s/.*\"\(.*\)\".*/\1/"\ |
| 86 | max_qual=${quality_info[1]} | 101 | ) |
| 87 | quality_p=$(echo "$cur_qual*100/$max_qual" | bc) | 102 | if [ $ssid = "off/any" ] ; then |
| 88 | echo -e "wireless\t^fg($normal_txt)Wlan: $quality_p% ^fg($inactive_txt)($ssid)" | 103 | echo -e "wireless\t^fg($normal_txt)Wlan: No connection" |
| 89 | 104 | else | |
| 105 | IFS=',' read -a quality_info <<< $(\ | ||
| 106 | echo $iwconfig | \ | ||
| 107 | sed "s/.*Link Quality=\([0-9]*\)\/\([0-9]*\).*/\1,\2/"\ | ||
| 108 | ) | ||
| 109 | cur_qual=${quality_info[0]} | ||
| 110 | max_qual=${quality_info[1]} | ||
| 111 | quality_p=$(echo "$cur_qual*100/$max_qual" | bc) | ||
| 112 | echo -e "wireless\t^fg($normal_txt)Wlan: $quality_p% ^fg($inactive_txt)($ssid)" | ||
| 113 | fi | ||
| 114 | |||
| 90 | # Battery | 115 | # Battery |
| 91 | IFS=' ' read -a batinfo <<< $(acpi -b) | 116 | IFS=' ' read -a batinfo <<< $(acpi -b) |
| 117 | if [ -z $batinfo ] ; then | ||
| 118 | echo -e "battery\t^fg($normax_txt)No battery" | ||
| 119 | else | ||
| 92 | charge=$(echo ${batinfo[3]} | tr -d '%,') | 120 | charge=$(echo ${batinfo[3]} | tr -d '%,') |
| 93 | if [ $charge -lt 15 ] ; then | 121 | if [ $charge -lt 15 ] ; then |
| 94 | bat_color=$accent | 122 | bat_color=$accent |
| 95 | else | 123 | else |
| 96 | bat_color=$normal_txt | 124 | bat_color=$normal_txt |
| 125 | fi | ||
| 126 | state=$(echo ${batinfo[2]} | tr -d ',') | ||
| 127 | remaining=$(echo ${batinfo[4]}) | ||
| 128 | echo -e "battery\t^fg($normal_txt)$state: ^fg($bat_color)$charge^fg($normal_txt)% ^fg($inactive_txt)($remaining)" | ||
| 97 | fi | 129 | fi |
| 98 | state=$(echo ${batinfo[2]} | tr -d ',') | 130 | |
| 99 | remaining=$(echo ${batinfo[4]}) | ||
| 100 | echo -e "battery\t^fg($normal_txt)$state: ^fg($bat_color)$charge^fg($normal_txt)% ^fg($inactive_txt)($remaining)" | ||
| 101 | |||
| 102 | # Time | 131 | # Time |
| 103 | echo -e $(date +$"date\t^fg($normal_txt)%H:%M:%S^fg($inactive_txt) (%d-%m-%Y)") | 132 | echo -e $(date +$"date\t^fg($normal_txt)%H:%M:%S^fg($inactive_txt) (%d-%m-%Y)") |
| 104 | sleep 1 || break | 133 | sleep 1 || break |
| @@ -111,6 +140,7 @@ hc pad $monitor $panel_height | |||
| 111 | IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" | 140 | IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" |
| 112 | visible=true | 141 | visible=true |
| 113 | date="" | 142 | date="" |
| 143 | volume="" | ||
| 114 | battery="" | 144 | battery="" |
| 115 | wireless="" | 145 | wireless="" |
| 116 | windowtitle="" | 146 | windowtitle="" |
| @@ -155,7 +185,7 @@ hc pad $monitor $panel_height | |||
| 155 | echo -n "$separator" | 185 | echo -n "$separator" |
| 156 | echo -n "^bg()^fg() ${windowtitle//^/^^}" | 186 | echo -n "^bg()^fg() ${windowtitle//^/^^}" |
| 157 | # small adjustments | 187 | # small adjustments |
| 158 | right="$wireless $separator^bg() $battery $separator^bg() $date " | 188 | right="$volume $separator^bg() $wireless $separator^bg() $battery $separator^bg() $date " |
| 159 | right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g') | 189 | right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g') |
| 160 | # get width of right aligned text.. and add some space.. | 190 | # get width of right aligned text.. and add some space.. |
| 161 | width=$($textwidth "$font" "$right_text_only") | 191 | width=$($textwidth "$font" "$right_text_only") |
| @@ -178,6 +208,9 @@ hc pad $monitor $panel_height | |||
| 178 | #echo "resetting tags" >&2 | 208 | #echo "resetting tags" >&2 |
| 179 | IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" | 209 | IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" |
| 180 | ;; | 210 | ;; |
| 211 | volume) | ||
| 212 | volume="${cmd[@]:1}" | ||
| 213 | ;; | ||
| 181 | wireless) | 214 | wireless) |
| 182 | wireless="${cmd[@]:1}" | 215 | wireless="${cmd[@]:1}" |
| 183 | ;; | 216 | ;; |
