aboutsummaryrefslogtreecommitdiff
path: root/Window_Manager/ratpoison/panel
diff options
context:
space:
mode:
authorVasil Zlatanov <vasil.zlatanov@gmail.com>2015-08-18 02:38:33 +0200
committerVasil Zlatanov <vasil.zlatanov@gmail.com>2015-08-18 02:38:33 +0200
commit6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42 (patch)
tree93ebfb332b3a231931fe1b1276632bdaa33fa6e4 /Window_Manager/ratpoison/panel
parentc021038355b6773ab13dae92327fda50c366395f (diff)
downloaddotfiles-6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42.tar.gz
dotfiles-6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42.tar.bz2
dotfiles-6efac1a12c8ab0b7d96a8d342fbd74fce35e8c42.zip
Organise everything systematically.
Diffstat (limited to 'Window_Manager/ratpoison/panel')
-rw-r--r--Window_Manager/ratpoison/panel/audio_mon1
-rwxr-xr-xWindow_Manager/ratpoison/panel/batterymon13
-rwxr-xr-xWindow_Manager/ratpoison/panel/icons23
-rwxr-xr-xWindow_Manager/ratpoison/panel/load7
-rwxr-xr-xWindow_Manager/ratpoison/panel/monce25
-rwxr-xr-xWindow_Manager/ratpoison/panel/music20
-rwxr-xr-xWindow_Manager/ratpoison/panel/panel29
-rwxr-xr-xWindow_Manager/ratpoison/panel/panel_bar144
-rwxr-xr-xWindow_Manager/ratpoison/panel/panel_colors15
-rwxr-xr-xWindow_Manager/ratpoison/panel/profile8
-rwxr-xr-xWindow_Manager/ratpoison/panel/signal19
-rwxr-xr-xWindow_Manager/ratpoison/panel/windows3
12 files changed, 307 insertions, 0 deletions
diff --git a/Window_Manager/ratpoison/panel/audio_mon b/Window_Manager/ratpoison/panel/audio_mon
new file mode 100644
index 0000000..1a1fa55
--- /dev/null
+++ b/Window_Manager/ratpoison/panel/audio_mon
@@ -0,0 +1 @@
+alsactl monitor |
diff --git a/Window_Manager/ratpoison/panel/batterymon b/Window_Manager/ratpoison/panel/batterymon
new file mode 100755
index 0000000..19a4d5a
--- /dev/null
+++ b/Window_Manager/ratpoison/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/Window_Manager/ratpoison/panel/icons b/Window_Manager/ratpoison/panel/icons
new file mode 100755
index 0000000..aa27523
--- /dev/null
+++ b/Window_Manager/ratpoison/panel/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/Window_Manager/ratpoison/panel/load b/Window_Manager/ratpoison/panel/load
new file mode 100755
index 0000000..3977bee
--- /dev/null
+++ b/Window_Manager/ratpoison/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/Window_Manager/ratpoison/panel/monce b/Window_Manager/ratpoison/panel/monce
new file mode 100755
index 0000000..caa316c
--- /dev/null
+++ b/Window_Manager/ratpoison/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/Window_Manager/ratpoison/panel/music b/Window_Manager/ratpoison/panel/music
new file mode 100755
index 0000000..2fb91d1
--- /dev/null
+++ b/Window_Manager/ratpoison/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/Window_Manager/ratpoison/panel/panel b/Window_Manager/ratpoison/panel/panel
new file mode 100755
index 0000000..0477467
--- /dev/null
+++ b/Window_Manager/ratpoison/panel/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/Window_Manager/ratpoison/panel/panel_bar b/Window_Manager/ratpoison/panel/panel_bar
new file mode 100755
index 0000000..99370d8
--- /dev/null
+++ b/Window_Manager/ratpoison/panel/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/Window_Manager/ratpoison/panel/panel_colors b/Window_Manager/ratpoison/panel/panel_colors
new file mode 100755
index 0000000..ac3d3b4
--- /dev/null
+++ b/Window_Manager/ratpoison/panel/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/Window_Manager/ratpoison/panel/profile b/Window_Manager/ratpoison/panel/profile
new file mode 100755
index 0000000..e0eeba2
--- /dev/null
+++ b/Window_Manager/ratpoison/panel/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/Window_Manager/ratpoison/panel/signal b/Window_Manager/ratpoison/panel/signal
new file mode 100755
index 0000000..d494f5d
--- /dev/null
+++ b/Window_Manager/ratpoison/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
+
diff --git a/Window_Manager/ratpoison/panel/windows b/Window_Manager/ratpoison/panel/windows
new file mode 100755
index 0000000..e5ae808
--- /dev/null
+++ b/Window_Manager/ratpoison/panel/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