aboutsummaryrefslogtreecommitdiff
path: root/tools/panel
diff options
context:
space:
mode:
authorVasil Zlatanov <vasil.zlatanov@gmail.com>2015-04-12 13:05:47 +0200
committerVasil Zlatanov <vasil.zlatanov@gmail.com>2015-04-12 13:05:47 +0200
commit47a0a3f433f820fc78d180884f6ca376fba97b73 (patch)
tree587b80062ebdb947d26ca7a70e32b38b7d67ca45 /tools/panel
parent269e617fea39658233db38ad503030c4fe040e80 (diff)
downloaddotfiles-47a0a3f433f820fc78d180884f6ca376fba97b73.tar.gz
dotfiles-47a0a3f433f820fc78d180884f6ca376fba97b73.tar.bz2
dotfiles-47a0a3f433f820fc78d180884f6ca376fba97b73.zip
Tidy up everything :)
Diffstat (limited to 'tools/panel')
-rwxr-xr-xtools/panel/batterymon13
-rwxr-xr-xtools/panel/load7
-rwxr-xr-xtools/panel/monce25
-rwxr-xr-xtools/panel/music20
-rwxr-xr-xtools/panel/panel26
-rwxr-xr-xtools/panel/panel_bar123
-rw-r--r--tools/panel/panel_colors33
-rw-r--r--tools/panel/profile4
-rwxr-xr-xtools/panel/signal19
9 files changed, 270 insertions, 0 deletions
diff --git a/tools/panel/batterymon b/tools/panel/batterymon
new file mode 100755
index 0000000..19a4d5a
--- /dev/null
+++ b/tools/panel/batterymon
@@ -0,0 +1,13 @@
+#!/bin/bash
+while true;do
+if [ `battery -f '%i'` -lt 5 ] && ! [ -z ~/.dontshut ]; then
+touch ~/.dontshut
+zenity --question --title "Battery" --text "Battery if pretty fucking low, go to sleep?"
+if [ $? -ne 1 ];then
+pm-suspend
+fi
+else
+rm ~/.dontshut
+fi
+sleep 30;
+done
diff --git a/tools/panel/load b/tools/panel/load
new file mode 100755
index 0000000..3977bee
--- /dev/null
+++ b/tools/panel/load
@@ -0,0 +1,7 @@
+#!/bin/bash
+while true; do
+cpu=`mpstat -P ALL 2 1 | grep "Average.*all" | awk '{print $3+$5}'`
+mem=`free | grep Mem | awk '{print $3/$2 * 100.0}'`
+printf "C%.*f\n" 1 $cpu
+printf "R%.*f\n" 0 $mem
+done
diff --git a/tools/panel/monce b/tools/panel/monce
new file mode 100755
index 0000000..caa316c
--- /dev/null
+++ b/tools/panel/monce
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+
+f=1
+d=30 # width
+
+new=`mpc current`
+if [ "$old" != "$new" ];then
+f=1;
+old="$new"
+fi
+
+
+e=$(expr $f + $d)
+
+if mpc | grep -q playing; then
+symbol='p'
+else
+symbol='P'
+fi
+
+echo "$symbol`echo $new | cut --bytes $f-$e`"
+echo "K`mpc -h 127.0.0.1 volume | perl -pe 's/^volume://' | perl -pe 's/%$//' | perl -pe 's/^ //'`"
+
+
diff --git a/tools/panel/music b/tools/panel/music
new file mode 100755
index 0000000..2fb91d1
--- /dev/null
+++ b/tools/panel/music
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+while true;do
+
+new=`mpc current`
+
+if mpc | grep -q playing; then
+symbol='p'
+else
+symbol='P'
+fi
+
+echo "$symbol`echo $new | cut --bytes 1-30`"
+echo "K`mpc -h 127.0.0.1 volume | perl -pe 's/^volume://' | perl -pe 's/%$//' | perl -pe 's/^ //'`"
+mpc idle > /dev/null
+if [ $? -ne 0 ];then
+echo 'mpd not alive';
+sleep 30;
+fi
+done
diff --git a/tools/panel/panel b/tools/panel/panel
new file mode 100755
index 0000000..39d8e1a
--- /dev/null
+++ b/tools/panel/panel
@@ -0,0 +1,26 @@
+#! /bin/sh
+cd ~/.tools/panel
+source ./profile
+source ~/.colors
+
+[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
+mkfifo "$PANEL_FIFO"
+
+bspc config top_padding $PANEL_HEIGHT
+bspc control --subscribe > "$PANEL_FIFO" &
+xtitle -sf 'T%s' > "$PANEL_FIFO" &
+volume -f 'V%i' > "$PANEL_FIFO" &
+battery -i 60 -sf 'B%i' > "$PANEL_FIFO" &
+clock -i 60 -sf 'Z%d %a %H:%M' > "$PANEL_FIFO" &
+./music > "$PANEL_FIFO" &
+#./load > "$PANEL_FIFO" &
+#essid -sf 'E%s' -i 30 -w wlp2s0 > "$PANEL_FIFO" &
+# ./signal > "$PANEL_FIFO" &
+
+
+source ./panel_colors
+
+cat "$PANEL_FIFO" | ./panel_bar | bar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" &
+
+sleep 1;
+stalonetray --geometry 4x1-1+1 --icon-gravity E --grow-gravity E -bg $COLOR0 -i 18 &
diff --git a/tools/panel/panel_bar b/tools/panel/panel_bar
new file mode 100755
index 0000000..0b2e55e
--- /dev/null
+++ b/tools/panel/panel_bar
@@ -0,0 +1,123 @@
+#! /bin/sh
+#
+# Example panel for LemonBoy's bar
+
+
+num_mon=$(bspc query -M | wc -l)
+
+source ./panel_colors
+while read -r line ; do
+ case $line in
+ C*)
+ cpu="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} C:${line#?} %{B-}%{F-}"
+ ;;
+ R*)
+ ram="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} R:${line#?} %{B-}%{F-}"
+ ;;
+
+# S*)
+# signal="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} S:${line#?} %{B-}%{F-}"
+# ;;
+
+ p*)
+ # playing mpc
+ paused=''
+ playing="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} p:${line#?} %{B-}%{F-}"
+ ;;
+
+ P*)
+ # paused mpc
+ playing=''
+ paused="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} P:${line#?} %{B-}%{F-}"
+ ;;
+ K*)
+ # volume output
+ musicvol="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} M:${line#?} %{B-}%{F-}"
+ ;;
+
+
+ B*)
+ # battery output
+ battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} B:${line#?} %{B-}%{F-}"
+ ;;
+
+
+ V*)
+ # volume output
+ volume="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} V:${line#?} %{B-}%{F-}"
+ ;;
+
+ E*)
+ # essid output
+ if [ -z ${line#?} ];then
+ essid="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} E:No WiFi %{B-}%{F-}"
+ else
+ essid="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} E:${line#?} %{B-}%{F-}"
+ fi
+ ;;
+
+ Z*)
+ # clock output
+ time_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}"
+ ;;
+ T*)
+ # xtitle output
+ title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
+ ;;
+ W*)
+ # bspwm internal state
+ wm_infos=""
+ IFS=':'
+ set -- ${line#?}
+ while [ $# -gt 0 ] ; do
+ item=$1
+ name=${item#?}
+ case $item in
+ M*)
+ # active monitor
+ if [ $num_mon -gt 1 ] ; then
+ wm_infos="$wm_infos %{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG} ${name} %{B-}%{F-} "
+ fi
+ ;;
+# m*)
+# # inactive monitor
+# if [ $num_mon -gt 1 ] ; then
+# wm_infos="$wm_infos %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG} ${name} %{B-}%{F-} "
+# fi
+# ;;
+ O*)
+ # focused occupied desktop
+ wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG}%{U$COLOR_FOREGROUND} ${name} %{-u}%{B-}%{F-}"
+ ;;
+ F*)
+ # focused free desktop
+ wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG}%{U$COLOR_FOREGROUND} ${name} %{-u}%{B-}%{F-}"
+ ;;
+ U*)
+ # focused urgent desktop
+ wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG}%{U$COLOR_FOREGROUND} ${name} %{-u}%{B-}%{F-}"
+ ;;
+# o*)
+# # occupied desktop
+# wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG} ${name} %{B-}%{F-}"
+# ;;
+# f*)
+# # free desktop
+# wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG} ${name} %{B-}%{F-}"
+# ;;
+# u*)
+# # urgent desktop
+# wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG} ${name} %{B-}%{F-}"
+# ;;
+# L*)
+# # layout
+# wm_infos="$wm_infos %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG} ${name} %{B-}%{F-}"
+# ;;
+ esac
+ shift
+ done
+ ;;
+ esac
+# printf "%s\n" "%{l}${wm_infos}${title}%{r}${playing}${paused}${cpu}${ram}${essid}${signal}${volume}${musicvol}${battery}${time_infos} "
+ printf "%s\n" "%{l}${wm_infos}${title}%{r}${playing}${paused}${cpu}${ram}${volume}${musicvol}${battery}${time_infos} "
+done
diff --git a/tools/panel/panel_colors b/tools/panel/panel_colors
new file mode 100644
index 0000000..f436113
--- /dev/null
+++ b/tools/panel/panel_colors
@@ -0,0 +1,33 @@
+source ~/.colors
+
+
+COLOR_FOREGROUND="#FF`echo $COLOR11 | cut -c 2-`"
+COLOR_BACKGROUND="#FF`echo $COLOR0 | cut -c 2-`"
+COLOR_ACTIVE_MONITOR_FG='#FF34322E'
+COLOR_ACTIVE_MONITOR_BG='#FF58C5F1'
+COLOR_INACTIVE_MONITOR_FG='#FF58C5F1'
+COLOR_INACTIVE_MONITOR_BG='#FF34322E'
+COLOR_FOCUSED_OCCUPIED_FG='#FFF6F9FF'
+COLOR_FOCUSED_OCCUPIED_BG='#FF5C5955'
+COLOR_FOCUSED_FREE_FG='#FFF6F9FF'
+COLOR_FOCUSED_FREE_BG='#FF6D561C'
+COLOR_FOCUSED_URGENT_FG='#FF34322E'
+COLOR_FOCUSED_URGENT_BG='#FFF9A299'
+COLOR_OCCUPIED_FG='#FFA3A6AB'
+COLOR_OCCUPIED_BG='#FF34322E'
+COLOR_FREE_FG='#FF6F7277'
+COLOR_FREE_BG='#FF34322E'
+COLOR_URGENT_FG='#FFF9A299'
+COLOR_URGENT_BG='#FF34322E'
+COLOR_LAYOUT_FG='#FFA3A6AB'
+COLOR_LAYOUT_BG='#FF34322E'
+
+
+COLOR_FOCUSED_FG="#FF`echo $COLOR10 | cut -c 2-`"
+COLOR_FOCUSED_BG="#FF`echo $COLOR0 | cut -c 2-`"
+
+COLOR_TITLE_FG="#FF`echo $COLOR11 | cut -c 2-`"
+COLOR_TITLE_BG="#FF`echo $COLOR0 | cut -c 2-`"
+
+COLOR_STATUS_FG="#FF`echo $COLOR12 | cut -c 2-`"
+COLOR_STATUS_BG="#FF`echo $COLOR0 | cut -c 2-`"
diff --git a/tools/panel/profile b/tools/panel/profile
new file mode 100644
index 0000000..c7a3ba0
--- /dev/null
+++ b/tools/panel/profile
@@ -0,0 +1,4 @@
+PANEL_FIFO=/tmp/panel-fifo
+PANEL_HEIGHT=24
+PANEL_FONT_FAMILY="-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso10646-1"
+export PANEL_FIFO PANEL_HEIGHT PANEL_FONT_FAMILY
diff --git a/tools/panel/signal b/tools/panel/signal
new file mode 100755
index 0000000..d494f5d
--- /dev/null
+++ b/tools/panel/signal
@@ -0,0 +1,19 @@
+#!/bin/bash
+while true;do
+signal=`iwconfig $INTERFACE | grep Signal| perl -pe 's/.*level=//; s/ dBm.*//'`
+#convert to Quality
+
+ if [ $signal -le -100 ];then
+ quality=0;
+ elif [ $signal -ge -50 ];then
+ quality=100;
+ elif [ -z $signal ];then
+ quality=0;
+ else
+ quality=$(( 2 * ( $signal + 100 )));
+ fi
+
+echo "S$quality";
+sleep 3;
+done
+