aboutsummaryrefslogtreecommitdiff
path: root/Panel
diff options
context:
space:
mode:
authorVasil Zlatanov <vasil.zlatanov@gmail.com>2015-08-18 02:48:41 +0200
committerVasil Zlatanov <vasil.zlatanov@gmail.com>2015-08-18 02:48:41 +0200
commitd17d81bd627c7a640b5d63dd58acb3a426553ca2 (patch)
tree0a67ee2f82b51c22c830de96584c76791c56b80a /Panel
parentde81781c8e860fe05ee9c68b3a20b39a12a33f9d (diff)
downloaddotfiles-d17d81bd627c7a640b5d63dd58acb3a426553ca2.tar.gz
dotfiles-d17d81bd627c7a640b5d63dd58acb3a426553ca2.tar.bz2
dotfiles-d17d81bd627c7a640b5d63dd58acb3a426553ca2.zip
Seperate panel
Diffstat (limited to 'Panel')
-rw-r--r--Panel/README.md3
-rw-r--r--Panel/lemonbar/audio_mon1
-rwxr-xr-xPanel/lemonbar/batterymon13
-rwxr-xr-xPanel/lemonbar/icons23
-rwxr-xr-xPanel/lemonbar/load7
-rwxr-xr-xPanel/lemonbar/monce25
-rwxr-xr-xPanel/lemonbar/music20
-rwxr-xr-xPanel/lemonbar/panel29
-rwxr-xr-xPanel/lemonbar/panel_bar144
-rwxr-xr-xPanel/lemonbar/panel_colors15
-rwxr-xr-xPanel/lemonbar/profile8
-rwxr-xr-xPanel/lemonbar/signal19
-rwxr-xr-xPanel/lemonbar/windows3
13 files changed, 310 insertions, 0 deletions
diff --git a/Panel/README.md b/Panel/README.md
new file mode 100644
index 0000000..c1897c1
--- /dev/null
+++ b/Panel/README.md
@@ -0,0 +1,3 @@
+```
+ln -s ~/dotfiles/Panel/lemonbar ~/.config/ratpoison/panel
+```
diff --git a/Panel/lemonbar/audio_mon b/Panel/lemonbar/audio_mon
new file mode 100644
index 0000000..1a1fa55
--- /dev/null
+++ b/Panel/lemonbar/audio_mon
@@ -0,0 +1 @@
+alsactl monitor |
diff --git a/Panel/lemonbar/batterymon b/Panel/lemonbar/batterymon
new file mode 100755
index 0000000..19a4d5a
--- /dev/null
+++ b/Panel/lemonbar/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/Panel/lemonbar/icons b/Panel/lemonbar/icons
new file mode 100755
index 0000000..aa27523
--- /dev/null
+++ b/Panel/lemonbar/icons
@@ -0,0 +1,23 @@
+
+# Icons
+ICON_CLOCK=''
+ICON_CAL=''
+ICON_WIFI=''
+ICON_PWR=''
+ICON_DB=''
+ICON_SQUARE=''
+ICON_PREV=''
+ICON_PAUSE=''
+ICON_PLAY=''
+ICON_NEXT=''
+ICON_VOLUME_DOWN=''
+ICON_VOLUME_UP=''
+ICON_VOLUME_OFF=''
+ICON_HPHONES=''
+ICON_MUSIC=''
+ICON_PLUG=''
+ICON_FACE=''
+ICON_PRIV=''
+ICON_PUB=''
+ICON_MAIL=''
+
diff --git a/Panel/lemonbar/load b/Panel/lemonbar/load
new file mode 100755
index 0000000..3977bee
--- /dev/null
+++ b/Panel/lemonbar/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/Panel/lemonbar/monce b/Panel/lemonbar/monce
new file mode 100755
index 0000000..caa316c
--- /dev/null
+++ b/Panel/lemonbar/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/Panel/lemonbar/music b/Panel/lemonbar/music
new file mode 100755
index 0000000..2fb91d1
--- /dev/null
+++ b/Panel/lemonbar/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/Panel/lemonbar/panel b/Panel/lemonbar/panel
new file mode 100755
index 0000000..0477467
--- /dev/null
+++ b/Panel/lemonbar/panel
@@ -0,0 +1,29 @@
+#! /bin/sh
+cd ~/.tools/panel
+. ./profile
+. ~/.colors
+
+[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
+mkfifo -m 777 "$PANEL_FIFO"
+
+
+#bspc config top_padding $PANEL_HEIGHT
+#bspc control --subscribe > "$PANEL_FIFO" &
+./windows > "$PANEL_FIFO" &
+echo "D`rpws current`" > "$PANEL_FIFO" &
+volume -f 'V%i' > "$PANEL_FIFO" &
+battery -i 60 -sf 'B%s %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" &
+unbuffer alsactl monitor | grep --line-buffered 'Headphone Jack' | while read line; do volume -f 'V%i' > $PANEL_FIFO;done &
+
+
+source ./panel_colors
+
+cat "$PANEL_FIFO" | ./panel_bar | lemonbar -f "$FONT_FONT" -f "$ICON_FONT" -g x$PANEL_HEIGHT -F "$COLOR11" -B "$COLOR0" -u 3 &
+
+#sleep 1;
+#stalonetray --geometry 1x1-415+2 --icon-gravity E --grow-gravity E -bg $COLOR0 -i 20 &
diff --git a/Panel/lemonbar/panel_bar b/Panel/lemonbar/panel_bar
new file mode 100755
index 0000000..99370d8
--- /dev/null
+++ b/Panel/lemonbar/panel_bar
@@ -0,0 +1,144 @@
+#! /bin/sh
+
+num_mon=$(bspc query -M | wc -l)
+
+. ./panel_colors
+. ./icons
+while read -r line ; do
+ case $line in
+ Imail)
+ mbsync -a > /dev/null
+ if bspc control --get-status | grep OIX > /dev/null;then
+ mail=''
+ else
+ mail="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_MAIL} %{B-}%{F-}"
+ fi
+ ;;
+
+ Iface)
+ if bspc control --get-status | grep OX > /dev/null;then
+ face=''
+ else
+ face="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_FACE} %{B-}%{F-}"
+ fi
+ ;;
+
+ Ipub)
+ if bspc control --get-status | grep OX > /dev/null;then
+ pub=''
+ else
+ pub="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PUB} %{B-}%{F-}"
+ fi
+ ;;
+
+ Ipriv)
+ if bspc control --get-status | grep OX > /dev/null;then
+ priv=''
+ else
+ priv="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PRIV} %{B-}%{F-}"
+ fi
+ ;;
+ Iclear)
+ priv=""
+ pub=""
+ face=""
+ ;;
+ Ixlear)
+ mail=''
+ ;;
+# 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} ${ICON_PLAY} ${line#?} %{B-}%{F-}"
+ ;;
+
+ P*)
+ # paused mpc
+ playing=''
+ paused="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PAUSE} ${line#?} %{B-}%{F-}"
+ ;;
+ K*)
+ # volume output
+ musicvol="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_MUSIC} ${line#?} %{B-}%{F-}"
+ ;;
+
+
+ BDischarging*)
+ percent=`echo ${line#?} | cut -d' ' -f2`
+ battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PWR} ${percent} %{B-}%{F-}";
+ ;;
+ B*)
+ percent=`echo ${line#?} | cut -d' ' -f2`
+ battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PLUG} ${percent} %{B-}%{F-}";
+ ;;
+
+
+ V*)
+ # volume output
+ if amixer contents | head -12 | tail -1 | grep on > /dev/null;then
+ volume="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_HPHONES} ${line#?} %{B-}%{F-}"
+ else
+ volume="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_VOLUME_UP} ${line#?} %{B-}%{F-}";
+ fi
+ ;;
+
+ 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-}"
+# ;;
+ D*)
+ # active desktop
+ desktop="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?}%{B-}%{F-} "
+ ;;
+ Wclear)
+ wm_infos=''
+ ;;
+
+ \**)
+ # current focused window
+ wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG}%{U$COLOR_FOCUSED_UG}%{+o} ${line#?} %{-o}%{B-}%{F-}%{U-}"
+ ;;
+ +*)
+ # last focused window
+ wm_infos="${wm_infos}%{F$COLOR_OTHER_FG}%{B$COLOR_OTHER_BG} ${line#?} %{B-}%{F-}"
+ ;;
+ -*)
+ # other windows
+ wm_infos="${wm_infos}%{F$COLOR_ELSE_FG}%{B$COLOR_ELSE_BG} ${line#?} %{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
+# printf "%s\n" "%{l}${wm_infos}${title}%{r}${playing}${paused}${cpu}${ram}${essid}${signal}${volume}${musicvol}${battery}${time_infos} "
+ printf "%s\n" "%{l}${desktop}${wm_infos}%{r}${face}${priv}${pub}${mail}${playing}${paused}${cpu}${ram}${volume}${musicvol}${battery}${time_infos}"
+done
diff --git a/Panel/lemonbar/panel_colors b/Panel/lemonbar/panel_colors
new file mode 100755
index 0000000..ac3d3b4
--- /dev/null
+++ b/Panel/lemonbar/panel_colors
@@ -0,0 +1,15 @@
+#!/bin/bash
+. ~/.colors
+
+COLOR_FOCUSED_FG="#FF`echo $COLOR4 | cut -c 2-`"
+COLOR_FOCUSED_BG="#FF`echo $COLOR0 | cut -c 2-`"
+COLOR_FOCUSED_UG="#FF`echo $COLOR1 | cut -c 2-`"
+
+COLOR_OTHER_FG="#FF`echo $COLOR10 | cut -c 2-`"
+COLOR_OTHER_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-`"
+
+COLOR_ELSE_FG="#FF`echo $COLOR11 | cut -c 2-`"
+COLOR_ELSE_BG="#FF`echo $COLOR0 | cut -c 2-`"
diff --git a/Panel/lemonbar/profile b/Panel/lemonbar/profile
new file mode 100755
index 0000000..e0eeba2
--- /dev/null
+++ b/Panel/lemonbar/profile
@@ -0,0 +1,8 @@
+#!/bin/bash
+PANEL_FIFO=/tmp/panel-fifo
+PANEL_HEIGHT=24
+
+FONT_FONT="fixed"
+ICON_FONT="FontAwesome-9"
+
+export PANEL_FIFO PANEL_HEIGHT PANEL_FONT_FAMILY FONT_FONT ICON_FONT
diff --git a/Panel/lemonbar/signal b/Panel/lemonbar/signal
new file mode 100755
index 0000000..d494f5d
--- /dev/null
+++ b/Panel/lemonbar/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
+
diff --git a/Panel/lemonbar/windows b/Panel/lemonbar/windows
new file mode 100755
index 0000000..e5ae808
--- /dev/null
+++ b/Panel/lemonbar/windows
@@ -0,0 +1,3 @@
+#!/bin/bash
+echo 'Wclear' > /tmp/panel-fifo
+ratpoison -c 'windows %s%n %t' | while read line;do echo "${line}" | cut -c -25 > /tmp/panel-fifo && sleep 0.004;done