aboutsummaryrefslogtreecommitdiff
path: root/ratpoison/panel
diff options
context:
space:
mode:
Diffstat (limited to 'ratpoison/panel')
-rwxr-xr-xratpoison/panel/cpu5
-rwxr-xr-xratpoison/panel/music11
-rwxr-xr-xratpoison/panel/panel31
-rwxr-xr-xratpoison/panel/panel_bar116
-rw-r--r--ratpoison/panel/panel_colors33
-rw-r--r--ratpoison/panel/profile4
6 files changed, 200 insertions, 0 deletions
diff --git a/ratpoison/panel/cpu b/ratpoison/panel/cpu
new file mode 100755
index 0000000..908f207
--- /dev/null
+++ b/ratpoison/panel/cpu
@@ -0,0 +1,5 @@
+while true; do
+echo -n 'C'
+ps -eo pcpu |grep -vE '^\s*(0.0|%CPU)' |sed -n '1h;$!H;$g;s/\n/ +/gp' | bc
+sleep 2;
+done
diff --git a/ratpoison/panel/music b/ratpoison/panel/music
new file mode 100755
index 0000000..6190dbc
--- /dev/null
+++ b/ratpoison/panel/music
@@ -0,0 +1,11 @@
+while true;do
+if mpc | grep -q playing; then
+echo "p`mpc current`" | cut --bytes 1-40
+echo "K`mpc -h 127.0.0.1 volume | perl -pe 's/^volume://' | perl -pe 's/%$//' | perl -pe 's/^ //'`"
+else
+echo "P`mpc current`" | cut --bytes 1-40
+sleep 1;
+echo "K`mpc -h 127.0.0.1 volume | perl -pe 's/^volume://' | perl -pe 's/%$//' | perl -pe 's/^ //'`"
+fi
+sleep 5;
+done
diff --git a/ratpoison/panel/panel b/ratpoison/panel/panel
new file mode 100755
index 0000000..414fffc
--- /dev/null
+++ b/ratpoison/panel/panel
@@ -0,0 +1,31 @@
+#! /bin/sh
+cd ~/.ratpoison/panel
+source ./profile
+source ~/.colors
+if [ $(pgrep -cx panel) -gt 1 ] ; then
+ printf "%s\n" "The panel is already running." >&2
+ exit 1
+fi
+
+trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
+
+[ -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" &
+essid -sf 'E%s' -i 3 -w wlp2s0 > "$PANEL_FIFO" &
+volume -i 10 -sf 'V%i' > "$PANEL_FIFO" &
+battery -i 5 -sf 'B%i' > "$PANEL_FIFO" &
+clock -sf 'S%a %H:%M' > "$PANEL_FIFO" &
+./music > "$PANEL_FIFO" &
+./cpu > "$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" &
+
+stalonetray --geometry 4x1-1+1 --icon-gravity E --grow-gravity E -bg $COLOR0 -i 18
+wait
diff --git a/ratpoison/panel/panel_bar b/ratpoison/panel/panel_bar
new file mode 100755
index 0000000..5015464
--- /dev/null
+++ b/ratpoison/panel/panel_bar
@@ -0,0 +1,116 @@
+#! /bin/sh
+#
+# Example panel for LemonBoy's bar
+
+
+num_mon=$(bspc query -M | wc -l)
+
+while read -r line ; do
+source ./panel_colors
+ case $line in
+ C*)
+ # playing mpc
+ cpu="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} C:${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*)
+ # volume 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
+ ;;
+
+ S*)
+ # 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}${essid}${volume}${musicvol}${battery}${time_infos} "
+done
diff --git a/ratpoison/panel/panel_colors b/ratpoison/panel/panel_colors
new file mode 100644
index 0000000..f436113
--- /dev/null
+++ b/ratpoison/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/ratpoison/panel/profile b/ratpoison/panel/profile
new file mode 100644
index 0000000..c7a3ba0
--- /dev/null
+++ b/ratpoison/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