diff options
| author | 2014-11-15 23:29:05 +0100 | |
|---|---|---|
| committer | 2014-11-15 23:29:05 +0100 | |
| commit | f691f01606af95670e0983884062a1d70ec7bce9 (patch) | |
| tree | c8e45309cbfd1f53682ef7d5297c6e2b012f5f7d /herbstluftwm | |
| parent | ba4a9bca449de7e0f9ad0b1d2ebc104a45036638 (diff) | |
| download | dotfiles-f691f01606af95670e0983884062a1d70ec7bce9.tar.gz dotfiles-f691f01606af95670e0983884062a1d70ec7bce9.tar.bz2 dotfiles-f691f01606af95670e0983884062a1d70ec7bce9.zip | |
Moved some panel code to seperate file
Diffstat (limited to 'herbstluftwm')
| -rwxr-xr-x | herbstluftwm/.config/herbstluftwm/autostart | 5 | ||||
| -rwxr-xr-x | herbstluftwm/.config/herbstluftwm/notify.sh | 21 | ||||
| -rwxr-xr-x | herbstluftwm/.config/herbstluftwm/panel.sh | 98 | ||||
| -rw-r--r-- | herbstluftwm/.config/herbstluftwm/panel_indicators.sh | 127 | ||||
| -rwxr-xr-x | herbstluftwm/.config/herbstluftwm/popup.sh | 26 | ||||
| -rw-r--r-- | herbstluftwm/.config/herbstluftwm/theme.sh (renamed from herbstluftwm/.config/herbstluftwm/theme) | 2 |
6 files changed, 148 insertions, 131 deletions
diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index 9ec12f8..c93ff15 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart | |||
| @@ -6,8 +6,9 @@ hc() { | |||
| 6 | herbstclient "$@" | 6 | herbstclient "$@" |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | #Include the theming script | ||
| 9 | dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | 10 | dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 10 | source "$dir/theme" | 11 | source "$dir/theme.sh" |
| 11 | 12 | ||
| 12 | #Detect monitors | 13 | #Detect monitors |
| 13 | hc set auto_detect_monitors 1 | 14 | hc set auto_detect_monitors 1 |
| @@ -186,4 +187,4 @@ $dir/start.sh "xrdb -load $HOME/.Xresources" | |||
| 186 | $dir/start.sh "xset +fp /usr/share/fonts/local" | 187 | $dir/start.sh "xset +fp /usr/share/fonts/local" |
| 187 | $dir/start.sh "xset fp rehash" | 188 | $dir/start.sh "xset fp rehash" |
| 188 | $dir/start.sh "dropboxd" | 189 | $dir/start.sh "dropboxd" |
| 189 | #$dir/start.sh "$dir/notify.sh $monitor_w $window_p $panel_h $dir/popup.sh" | 190 | #$dir/start.sh "$dir/notify.sh $dir/popup.sh" |
diff --git a/herbstluftwm/.config/herbstluftwm/notify.sh b/herbstluftwm/.config/herbstluftwm/notify.sh index 190d496..40c5330 100755 --- a/herbstluftwm/.config/herbstluftwm/notify.sh +++ b/herbstluftwm/.config/herbstluftwm/notify.sh | |||
| @@ -1,29 +1,18 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 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 | 3 | while true; do |
| 15 | 4 | ||
| 16 | bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity) | 5 | bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity) |
| 17 | bat_stat=$(cat /sys/class/power_supply/BAT1/status) | 6 | bat_stat=$(cat /sys/class/power_supply/BAT1/status) |
| 18 | 7 | ||
| 19 | if [[ $bat_lvl -le 5 && $bat_stat == "Discharging" ]]; then | 8 | if [[ $bat_lvl -le 5 && $bat_stat == "Discharging" ]]; then |
| 20 | $4 -m "Battery level critical: $bat_lvl%%" -u "high" $popup_opts | 9 | $1 -m "Battery level critical: $bat_lvl%%" -u "high" |
| 21 | elif [[ $bat_lvl -eq 10 && $bat_stat == "Discharging" ]]; then | 10 | elif [[ $bat_lvl -eq 10 && $bat_stat == "Discharging" ]]; then |
| 22 | $4 -m "Battery level low: $bat_lvl%%" $popup_opts | 11 | $1 -m "Battery level low: $bat_lvl%%" |
| 23 | elif [[ $bat_lvl -eq 50 && $bat_stat == "Discharging" ]]; then | 12 | elif [[ $bat_lvl -eq 50 && $bat_stat == "Discharging" ]]; then |
| 24 | $4 -m "Battery level at $bat_lvl%%" $popup_opts | 13 | $1 -m "Battery level at $bat_lvl%%" |
| 25 | elif [[ $bat_lvl -eq 100 && $bat_stat == "Charging" ]]; then | 14 | elif [[ $bat_lvl -eq 100 && $bat_stat == "Charging" ]]; then |
| 26 | $4 -m "Battery fully charged" | 15 | $1 -m "Battery fully charged" |
| 27 | fi | 16 | fi |
| 28 | 17 | ||
| 29 | sleep 60; | 18 | sleep 60; |
diff --git a/herbstluftwm/.config/herbstluftwm/panel.sh b/herbstluftwm/.config/herbstluftwm/panel.sh index 9b8fb48..763c668 100755 --- a/herbstluftwm/.config/herbstluftwm/panel.sh +++ b/herbstluftwm/.config/herbstluftwm/panel.sh | |||
| @@ -5,7 +5,8 @@ hc() { | |||
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | 7 | dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 8 | source "$dir/theme" | 8 | source "$dir/theme.sh" |
| 9 | source "$dir/panel_indicators.sh" | ||
| 9 | 10 | ||
| 10 | monitor=${1:-0} | 11 | monitor=${1:-0} |
| 11 | 12 | ||
| @@ -41,97 +42,12 @@ fi | |||
| 41 | # <eventname>\t<data> [...] | 42 | # <eventname>\t<data> [...] |
| 42 | # e.g. | 43 | # e.g. |
| 43 | # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 | 44 | # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 |
| 44 | |||
| 45 | while true ; do | 45 | while true ; do |
| 46 | # Music | 46 | music |
| 47 | player_status=$(playerctl status) | 47 | volume |
| 48 | if [ $player_status = "Playing" ]; then | 48 | network |
| 49 | player_artist=$(playerctl metadata artist) | 49 | battery |
| 50 | player_title=$(playerctl metadata title) | 50 | clock |
| 51 | playing="$player_title - $player_artist" | ||
| 52 | |||
| 53 | if [ "$current" != "$playing" ] ; then | ||
| 54 | current=$playing | ||
| 55 | scrolling=$current | ||
| 56 | elif [ ${#scrolling} -gt "24" ] ; then | ||
| 57 | scrolling=${scrolling:1} | ||
| 58 | else | ||
| 59 | scrolling=$current | ||
| 60 | fi | ||
| 61 | |||
| 62 | echo -e "music\t\ue05c ${scrolling:0:24}" | ||
| 63 | else | ||
| 64 | echo -e "music\toff" | ||
| 65 | fi | ||
| 66 | |||
| 67 | # Volume | ||
| 68 | if pgrep pulseaudio >> /dev/null ; then | ||
| 69 | volumes=$(\ | ||
| 70 | amixer get Master | \ | ||
| 71 | grep "Front Right: Playback"\ | ||
| 72 | ) | ||
| 73 | vol=$(\ | ||
| 74 | echo $volumes | \ | ||
| 75 | sed "s/.*\[\([0-9]*\)%\].*/\1/"\ | ||
| 76 | ) | ||
| 77 | if [ -z $vol ] ; then | ||
| 78 | echo -e "volume\toff" | ||
| 79 | else | ||
| 80 | echo -e "volume\t%{F$acolor_fg}\ue05d $vol%%%{F-}" | ||
| 81 | fi | ||
| 82 | else | ||
| 83 | echo -e "volume\toff" | ||
| 84 | fi | ||
| 85 | |||
| 86 | # Network | ||
| 87 | read lo int1 int2 <<< `ip link | sed -n 's/^[0-9]: \(.*\):.*$/\1/p'` | ||
| 88 | if iwconfig $int1 >/dev/null 2>&1; then | ||
| 89 | wifi=$int1 | ||
| 90 | eth=$int2 | ||
| 91 | else | ||
| 92 | wifi=$int2 | ||
| 93 | eth=$int1 | ||
| 94 | fi | ||
| 95 | |||
| 96 | ip link show $eth | grep 'state UP' >/dev/null && int=$eth || int=$wifi | ||
| 97 | |||
| 98 | if [ $int == "wlp3s0" ] ; then | ||
| 99 | iwconfig=$(iwconfig $int) | ||
| 100 | ssid=$(\ | ||
| 101 | echo $iwconfig | \ | ||
| 102 | sed "s/.*ESSID:\(\".*\"\).*/\1/" | \ | ||
| 103 | sed "s/.*\(off\/any\).*/\"\1\"/" | \ | ||
| 104 | sed "s/.*\"\(.*\)\".*/\1/"\ | ||
| 105 | ) | ||
| 106 | |||
| 107 | if [ $ssid != "off/any" ] ; then | ||
| 108 | echo -e "net\t\ue0f3 $ssid" | ||
| 109 | else | ||
| 110 | echo -e "net\toff" | ||
| 111 | fi | ||
| 112 | |||
| 113 | elif [ $int == "enp2s0" ] ; then | ||
| 114 | echo -e "net\t\ue0af ethernet" | ||
| 115 | else | ||
| 116 | echo -e "net\toff" | ||
| 117 | fi | ||
| 118 | |||
| 119 | # Battery | ||
| 120 | if $(test -e /sys/class/power_supply/BAT1) ; then | ||
| 121 | bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity) | ||
| 122 | if [ $bat_lvl -lt 15 ] ; then | ||
| 123 | bat_color=$acolor_accent | ||
| 124 | else | ||
| 125 | bat_color=$acolor_fg | ||
| 126 | fi | ||
| 127 | state=$(cat /sys/class/power_supply/BAT1/status) | ||
| 128 | echo -e "battery\t%{F$acolor_fg}\ue03b %{F$bat_color}$bat_lvl%{F$acolor_fg}%%%{F-}" | ||
| 129 | else | ||
| 130 | echo -e "battery\toff" | ||
| 131 | fi | ||
| 132 | |||
| 133 | # Time | ||
| 134 | echo -e $(date +$"date\t%{F$acolor_fg}%H:%M:%S %{F$acolor_fg}(%d-%m-%Y)%{F-}") | ||
| 135 | sleep 1 || break | 51 | sleep 1 || break |
| 136 | done > >(uniq_linebuffered) & | 52 | done > >(uniq_linebuffered) & |
| 137 | childpid=$! | 53 | childpid=$! |
diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh new file mode 100644 index 0000000..e450337 --- /dev/null +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | battery_icon=("\ue113" "\ue114" "\ue115" "\ue116" "\ue042") | ||
| 3 | network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "\ue0af") | ||
| 4 | music_icon="\ue05c" | ||
| 5 | |||
| 6 | music() | ||
| 7 | { | ||
| 8 | # Music | ||
| 9 | player_status=$(playerctl status) | ||
| 10 | if [ $player_status = "Playing" ]; then | ||
| 11 | player_artist=$(playerctl metadata artist) | ||
| 12 | player_title=$(playerctl metadata title) | ||
| 13 | playing="$player_title - $player_artist" | ||
| 14 | |||
| 15 | if [ "$current" != "$playing" ] ; then | ||
| 16 | current=$playing | ||
| 17 | scrolling=$current | ||
| 18 | elif [ ${#scrolling} -gt "24" ] ; then | ||
| 19 | scrolling=${scrolling:1} | ||
| 20 | else | ||
| 21 | scrolling=$current | ||
| 22 | fi | ||
| 23 | |||
| 24 | echo -e "music\t$music_icon ${scrolling:0:24}" | ||
