From dcfd734112dfbff3ad24c6bdbdea46b9f7919369 Mon Sep 17 00:00:00 2001
From: Vasil Zlatanov <vasil.zlatanov@gmail.com>
Date: Sun, 1 Mar 2015 14:09:52 +0100
Subject: firefox + panel update

---
 Xdefaults                 |  2 +-
 config/bspwm/bspwmrc      |  2 +-
 config/sxhkd/sxhkdrc      |  6 +++---
 config/uzbl/config        |  6 +++---
 mutt/mailcap              |  2 --
 ratpoison/firesend        |  2 +-
 ratpoison/panel/cpu       |  3 ---
 ratpoison/panel/load      |  7 +++++++
 ratpoison/panel/monce     | 25 +++++++++++++++++++++++++
 ratpoison/panel/music     | 38 +++++++++++++++++++++++++++++++++-----
 ratpoison/panel/panel     |  5 +++--
 ratpoison/panel/panel_bar | 13 +++++++++++--
 ratpoison/panel/signal    | 19 +++++++++++++++++++
 13 files changed, 107 insertions(+), 23 deletions(-)
 delete mode 100755 ratpoison/panel/cpu
 create mode 100755 ratpoison/panel/load
 create mode 100755 ratpoison/panel/monce
 create mode 100755 ratpoison/panel/signal

diff --git a/Xdefaults b/Xdefaults
index fa59dee..ee1a11d 100644
--- a/Xdefaults
+++ b/Xdefaults
@@ -55,5 +55,5 @@ URxvt.keysym.M-s: perl:keyboard-select:search
 ! M-u to select open copy links
 !URxvt.perl-ext-common: ...,url-select
 URxvt.keysym.M-u: perl:url-select:select_next
-URxvt.url-select.launcher: /home/vasko/.ratpoison/exec_to_workspace II uzbl-browser --uri 
+URxvt.url-select.launcher: /home/vasko/.ratpoison/firesend
 
diff --git a/config/bspwm/bspwmrc b/config/bspwm/bspwmrc
index a4f5239..6a2b2fe 100755
--- a/config/bspwm/bspwmrc
+++ b/config/bspwm/bspwmrc
@@ -1,7 +1,7 @@
 #! /bin/sh
 source ~/.config/bspwm/colors
 
-bspc config border_width        2
+bspc config border_width        3
 bspc config window_gap         12
 
 bspc config split_ratio         0.50
diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc
index 3709f54..9931cd7 100644
--- a/config/sxhkd/sxhkdrc
+++ b/config/sxhkd/sxhkdrc
@@ -177,13 +177,13 @@ grave;  g
 #
 
 super + space 
-	mpc -h 127.0.0.1 toggle 
+	mpc -h 127.0.0.1 toggle  && ~/.ratpoison/panel/monce > /tmp/panel-fifo
 
 super + Right 
-	mpc -h 127.0.0.1 next  && echo "p`mpc current`" | cut --bytes 1-40> /tmp/panel-fifo
+	mpc -h 127.0.0.1 next  && echo "p`mpc current`" | cut --bytes 1-32 > /tmp/panel-fifo
 
 super + Left  
-	mpc -h 127.0.0.1 prev  && echo "p`mpc current`" | cut --bytes 1-40 > /tmp/panel-fifo
+	mpc -h 127.0.0.1 prev  && echo "p`mpc current`" | cut --bytes 1-32 > /tmp/panel-fifo
 
 super + Up    
 	mpc -h 127.0.0.1 volume +5 && mpc -h 127.0.0.1 volume | perl -pe 's/^volume://' | perl -pe 's/%$//' | perl -pe 's/^ /K/' > /tmp/panel-fifo 
diff --git a/config/uzbl/config b/config/uzbl/config
index 6a36779..5a5c887 100644
--- a/config/uzbl/config
+++ b/config/uzbl/config
@@ -377,7 +377,7 @@ set ebind     @mode_bind global,-insert
 @cbind  yu  = spawn_sh 'echo -n "$UZBL_URI" | xclip'
 @cbind  yU  = spawn_sh 'echo -n "$0" | xclip' '\@SELECTED_URI'
 @cbind  yy  = spawn_sh 'echo -n "$UZBL_TITLE" | xclip'
-@cbind  ys  = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard
+@cbind  ys  = spawn @config_home/scripts/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard
 
 # Selection bindings
 @cbind <Ctrl>a = js (function () { var r = document.createRange(), s = window.getSelection(); r.selectNodeContents(document); s.removeAllRanges(); s.addRange(r); })();
@@ -431,8 +431,8 @@ set follow_hint_keys 0123456789
 #   Fl -> open in a new window
 #   fL -> take the url and navigate directly to it
 #   FL -> copy the url to the clipboard
-@cbind  f*  = spawn @scripts_dir/follow.sh \@< uzbl.follow.followLinks("\@follow_hint_keys", "%s", 'click') >\@
-@cbind  F*  = spawn @scripts_dir/follow.sh \@< uzbl.follow.followLinks("\@follow_hint_keys", "%s", 'newwindow') >\@
+@cbind  f*  = spawn @config_home/scripts/follow.sh \@< uzbl.follow.followLinks("\@follow_hint_keys", "%s", 'click') >\@
+@cbind  F*  = spawn @config_home/scrpts/follow.sh \@< uzbl.follow.followLinks("\@follow_hint_keys", "%s", 'newwindow') >\@
 #@cbind  fL*  = spawn @scripts_dir/follow.sh \@< uzbl.follow.followLinks("\@follow_hint_keys", "%s", 'returnuri') >\@ set
 #@cbind  FL*  = spawn @scripts_dir/follow.sh \@< uzbl.follow.followLinks("\@follow_hint_keys", "%s", 'returnuri') >\@ clipboard
 @cbind  gi   = spawn @scripts_dir/go_input.sh
diff --git a/mutt/mailcap b/mutt/mailcap
index c2ffbc4..136a03f 100644
--- a/mutt/mailcap
+++ b/mutt/mailcap
@@ -1,4 +1,2 @@
 application/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; rifle /tmp/mutt/$(basename %s) &
-image/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; rifle /tmp/mutt/$(basename %s) &
-text/html; ~/.ratpoison/firesend %s &; test=test -n "$DISPLAY"; needsterminal;
 text/html; w3m -I %{charset} -T text/html; copiousoutput;
diff --git a/ratpoison/firesend b/ratpoison/firesend
index d0df600..ddde2ef 100755
--- a/ratpoison/firesend
+++ b/ratpoison/firesend
@@ -1,2 +1,2 @@
 #!/bin/bash
-$HOME/.ratpoison/exec_to_workspace 2 uzbl-browser $@
+$HOME/.ratpoison/exec_to_workspace 2 firefox --new-tab $@
diff --git a/ratpoison/panel/cpu b/ratpoison/panel/cpu
deleted file mode 100755
index fe018a5..0000000
--- a/ratpoison/panel/cpu
+++ /dev/null
@@ -1,3 +0,0 @@
-while true; do
-mpstat -P ALL 2 1 | grep "Average.*all" | awk '{print "C"$3+$5}' 
-done
diff --git a/ratpoison/panel/load b/ratpoison/panel/load
new file mode 100755
index 0000000..3977bee
--- /dev/null
+++ b/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/ratpoison/panel/monce b/ratpoison/panel/monce
new file mode 100755
index 0000000..caa316c
--- /dev/null
+++ b/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/ratpoison/panel/music b/ratpoison/panel/music
index 6190dbc..a01ad03 100755
--- a/ratpoison/panel/music
+++ b/ratpoison/panel/music
@@ -1,11 +1,39 @@
+#!/bin/sh
+
+
+f=1
+d=30 # width
+
 while true;do
+
+new=`mpc current` 
+if [ "$old" != "$new" ];then 
+f=1;
+old="$new"
+fi
+
+
+e=$(expr $f + $d)
+
+if [ $e -gt ${#new} ];then
+e=${#new}
+f=$(expr $e - $d)
+fi
+
 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/^ //'`"
+symbol='p'
 else
-echo "P`mpc current`" | cut --bytes 1-40
-sleep 1;
+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/^ //'`"
+
+f=$(expr $d / 2 + $f)
+
+if [ $e == ${#new} ];then
+f=1;
 fi
-sleep 5;
+
+sleep 2;
 done
diff --git a/ratpoison/panel/panel b/ratpoison/panel/panel
index 08c7df4..95b8aa4 100755
--- a/ratpoison/panel/panel
+++ b/ratpoison/panel/panel
@@ -12,9 +12,10 @@ 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%d %a %H:%M' > "$PANEL_FIFO" &
+clock -sf 'Z%d %a %H:%M' > "$PANEL_FIFO" &
 ./music > "$PANEL_FIFO" &
-./cpu > "$PANEL_FIFO" &
+./load > "$PANEL_FIFO" &
+./signal > "$PANEL_FIFO" &
 
 
 source ./panel_colors
diff --git a/ratpoison/panel/panel_bar b/ratpoison/panel/panel_bar
index 5015464..6ccf74b 100755
--- a/ratpoison/panel/panel_bar
+++ b/ratpoison/panel/panel_bar
@@ -12,6 +12,15 @@ source ./panel_colors
 			# playing mpc 
 			cpu="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} C:${line#?} %{B-}%{F-}"
 			;;
+		R*)
+			# playing mpc 
+			ram="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} R:${line#?} %{B-}%{F-}"
+			;;
+	
+		S*)
+			# playing mpc 
+			signal="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} S:${line#?} %{B-}%{F-}"
+			;;
 	
 		p*)
 			# playing mpc 
@@ -50,7 +59,7 @@ source ./panel_colors
                         fi
 			;;
 	
-		S*)
+		Z*)
 			# clock output
 			time_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}"
 			;;
@@ -112,5 +121,5 @@ source ./panel_colors
 			done
 			;;
 	esac
-	printf "%s\n" "%{l}${wm_infos}${title}%{r}${playing}${paused}${cpu}${essid}${volume}${musicvol}${battery}${time_infos}             "
+	printf "%s\n" "%{l}${wm_infos}${title}%{r}${playing}${paused}${cpu}${ram}${essid}${signal}${volume}${musicvol}${battery}${time_infos}             "
 done
diff --git a/ratpoison/panel/signal b/ratpoison/panel/signal
new file mode 100755
index 0000000..75ec253
--- /dev/null
+++ b/ratpoison/panel/signal
@@ -0,0 +1,19 @@
+#!/bin/sh
+while true;do
+signal=`iwconfig wlp2s0 | 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
+
-- 
cgit v1.2.3-70-g09d2