aboutsummaryrefslogtreecommitdiff
path: root/ratpoison
diff options
context:
space:
mode:
authorVasil Zlatanov <vasil.zlatanov@gmail.com>2015-02-12 19:45:58 +0100
committerVasil Zlatanov <vasil.zlatanov@gmail.com>2015-02-12 19:45:58 +0100
commitf7ac47a1102006842d074146237c756648478675 (patch)
treeebd106e074f56d94046fc06d7718b2fc31ea3386 /ratpoison
parent504b3cc5d6cbc9ec66c5e89e3ecd4310c8dd5a69 (diff)
downloaddotfiles-f7ac47a1102006842d074146237c756648478675.tar.gz
dotfiles-f7ac47a1102006842d074146237c756648478675.tar.bz2
dotfiles-f7ac47a1102006842d074146237c756648478675.zip
bspwm update
Diffstat (limited to 'ratpoison')
-rwxr-xr-xratpoison/clipboard3
-rwxr-xr-xratpoison/create_framebin0 -> 9832 bytes
-rwxr-xr-xratpoison/exec_to_workspace5
-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
-rwxr-xr-xratpoison/pentfocus5
-rw-r--r--ratpoison/py/color_detect.py108
-rw-r--r--ratpoison/py/colorz.py71
-rw-r--r--ratpoison/py/colorz.pycbin2992 -> 0 bytes
-rw-r--r--ratpoison/ratpoisonrc.conf9
-rwxr-xr-xratpoison/spotlight2
-rwxr-xr-xratpoison/tray13
-rwxr-xr-xratpoison/wp5
-rwxr-xr-xratpoison/xtoolwaitbin0 -> 13112 bytes
18 files changed, 214 insertions, 207 deletions
diff --git a/ratpoison/clipboard b/ratpoison/clipboard
index 8b5a776..514394f 100755
--- a/ratpoison/clipboard
+++ b/ratpoison/clipboard
@@ -74,7 +74,8 @@ elif [ $command = menu_paste -o $command = menu_set ]; then
menu
elif [ $command = paste ]; then
xcb -p $option | xclip
- ratpoison -c "meta S-Insert"
+ xdotool key shift+Insert
+
elif [ $command = set ]; then
xclip -o | xcb -n 10 -s $option
elif [ $command = push ]; then
diff --git a/ratpoison/create_frame b/ratpoison/create_frame
new file mode 100755
index 0000000..e39f7dc
--- /dev/null
+++ b/ratpoison/create_frame
Binary files differ
diff --git a/ratpoison/exec_to_workspace b/ratpoison/exec_to_workspace
index 451bb07..d97efff 100755
--- a/ratpoison/exec_to_workspace
+++ b/ratpoison/exec_to_workspace
@@ -8,6 +8,5 @@
wg=$1; shift
cmd="$@"
-eval $cmd &
-rpws $wg
-
+bspc desktop -f $wg &
+eval $cmd
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
diff --git a/ratpoison/pentfocus b/ratpoison/pentfocus
deleted file mode 100755
index e8be6f8..0000000
--- a/ratpoison/pentfocus
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-ratpoison -c 'ratwarp 1332 568'
-sleep 0.01
-ratpoison -c 'ratclick 1'
-ratpoison -c banish
diff --git a/ratpoison/py/color_detect.py b/ratpoison/py/color_detect.py
deleted file mode 100644
index 30661f8..0000000
--- a/ratpoison/py/color_detect.py
+++ /dev/null
@@ -1,108 +0,0 @@
-import sys
-import colorsys
-from colorz import colorz
-from math import sqrt
-
-try:
- import Image
-except ImportError:
- from PIL import Image
-
-if len(sys.argv) < 2:
- print "Usage: {0} FILENAME [num_colors]".format(sys.argv[0])
- sys.exit()
-
-
-print sys.argv[1]
-
-WALLPAPER = sys.argv[1]
-filename = WALLPAPER.split('/').pop()
-COLORS = ".{0}.colors".format(filename)
-XRESOURCES = ".{0}.Xres".format(filename)
-SAMPLE = ".{0}.sample.png".format(filename)
-
-cols = ''
-xres = ''
-
-def torgb(hexv):
- hexv = hexv[1:]
- r, g, b = (
- int(hexv[0:2], 16) / 256.0,
- int(hexv[2:4], 16) / 256.0,
- int(hexv[4:6], 16) / 256.0,
- )
- return r, g, b
-
-def normalize(hexv, minv=128, maxv=256):
- r, g, b = torgb(hexv)
- h, s, v = colorsys.rgb_to_hsv(r, g, b)
- minv = minv / 256.0
- maxv = maxv / 256.0
- if v < minv:
- v = minv
- if v > maxv:
- v = maxv
- r, g, b = colorsys.hsv_to_rgb(h, s, v)
- return '#{:02x}{:02x}{:02x}'.format(int(r * 256), int(g * 256), int(b * 256))
-
-def darkness(hexv):
- r, g, b = torgb(hexv)
- darkness = sqrt((255 - r) ** 2 + (255 - g) ** 2 + (255 - b) ** 2)
- return darkness
-
-def to_hsv(c):
- r, g, b = torgb(c)
- h, s, v = colorsys.rgb_to_hsv(r, g, b)
- return h, s, v
-
-def hex_color_to_rgb(color):
- color = color[1:] if color[0]=="#" else color
- return (
- int(color[:2], 16),
- int(color[2:4], 16),
- int(color[4:], 16)
- )
-
-def create_sample(f, colors):
- im = Image.new("RGB", (1000, 100), "white")
- pix = im.load()
-
- width_sample = im.size[0]/len(colors)
-
- for i, c in enumerate(colors):
- for j in range(width_sample*i, width_sample*i+width_sample):
- for k in range(0, 100):
- pix[j, k] = hex_color_to_rgb(c)
-
- im.save(f)
-
-if __name__ == '__main__':
- if len(sys.argv) == 2:
- n = 16
- else:
- n = int(sys.argv[2])
-
-
- i = 0
- # sort by value, saturation, then hue
- colors = colorz(WALLPAPER, n=n)
- colors.sort(key=lambda x:darkness(x), reverse=True)
- for c in colors:
- if i == 0:
- c = normalize(c, minv=0, maxv=32)
- elif i == 8:
- c = normalize(c, minv=128, maxv=192)
- elif i < 8:
- c = normalize(c, minv=160, maxv=224)
- else:
- c = normalize(c, minv=200, maxv=256)
- c = normalize(c, minv=32, maxv=224)
- xres += """*color{}: {}\n""".format(i, c)
- cols += """export COLOR{}="{}"\n""".format(i, c)
- i += 1
-
- create_sample(SAMPLE, colors)
- with open(XRESOURCES, 'w') as f:
- f.write(xres)
- with open(COLORS, 'w') as f:
- f.write(cols)
diff --git a/ratpoison/py/colorz.py b/ratpoison/py/colorz.py
deleted file mode 100644
index 8c00f0c..0000000
--- a/ratpoison/py/colorz.py
+++ /dev/null
@@ -1,71 +0,0 @@
-from collections import namedtuple
-from math import sqrt
-import random
-try:
- import Image
-except ImportError:
- from PIL import Image
-
-Point = namedtuple('Point', ('coords', 'n', 'ct'))
-Cluster = namedtuple('Cluster', ('points', 'center', 'n'))
-
-def get_points(img):
- points = []
- w, h = img.size
- for count, color in img.getcolors(w * h):
- points.append(Point(color, 3, count))
- return points
-
-rtoh = lambda rgb: '#%s' % ''.join(('%02x' % p for p in rgb))
-
-def colorz(filename, n=3):
- img = Image.open(filename)
- img.thumbnail((200, 200))
- w, h = img.size
-
- points = get_points(img)
- clusters = kmeans(points, n, 1)
- rgbs = [map(int, c.center.coords) for c in clusters]
- return map(rtoh, rgbs)
-
-def euclidean(p1, p2):
- return sqrt(sum([
- (p1.coords[i] - p2.coords[i]) ** 2 for i in range(p1.n)
- ]))
-
-def calculate_center(points, n):
- vals = [0.0 for i in range(n)]
- plen = 0
- for p in points:
- plen += p.ct
- for i in range(n):
- vals[i] += (p.coords[i] * p.ct)
- return Point([(v / plen) for v in vals], n, 1)
-
-def kmeans(points, k, min_diff):
- clusters = [Cluster([p], p, p.n) for p in random.sample(points, k)]
-
- while 1:
- plists = [[] for i in range(k)]
-
- for p in points:
- smallest_distance = float('Inf')
- for i in range(k):
- distance = euclidean(p, clusters[i].center)
- if distance < smallest_distance:
- smallest_distance = distance
- idx = i
- plists[idx].append(p)
-
- diff = 0
- for i in range(k):
- old = clusters[i]
- center = calculate_center(plists[i], old.n)
- new = Cluster(plists[i], center, old.n)
- clusters[i] = new
- diff = max(diff, euclidean(old.center, new.center))
-
- if diff < min_diff:
- break
-
- return clusters
diff --git a/ratpoison/py/colorz.pyc b/ratpoison/py/colorz.pyc
deleted file mode 100644
index 9c842d7..0000000
--- a/ratpoison/py/colorz.pyc
+++ /dev/null
Binary files differ
diff --git a/ratpoison/ratpoisonrc.conf b/ratpoison/ratpoisonrc.conf
index e010ff5..d50d8cc 100644
--- a/ratpoison/ratpoisonrc.conf
+++ b/ratpoison/ratpoisonrc.conf
@@ -48,13 +48,14 @@ exec xsetroot -cursor_name left_ptr
#exec nitrogen --restore
#Border & Padding
-alias showpadding set border 3
-alias hidepadding set border 0
+alias showpadding set padding 10 10 10 10
+alias hidepadding set padding 0 0 0 0
showpadding
barinpadding 0
-alias showborder set barpadding 0 0
-alias hideborder set barpadding 0 0
+alias showborder set border 3
+alias hideborder set border 0
+showborder
set fwcolor #657b83
set bwcolor #839496
diff --git a/ratpoison/spotlight b/ratpoison/spotlight
index 2ec8bfb..0544825 100755
--- a/ratpoison/spotlight
+++ b/ratpoison/spotlight
@@ -1,4 +1,4 @@
#!/bin/sh
source ~/.colors
-find ~/ -not -path "~/Games/*" -not -path "~/.mozilla/*" -not -path "~/dotfiles/vim/undodir/*" | sed 's/ /\\ /g' | dmenu -i -l 20 -nb $COLOR11 -nf $COLOR0 | xargs urxvt -e rifle -p0
+find ~/ -not -path "~/Games/*" -not -path "~/.mozilla/*" -not -path "~/dotfiles/vim/undodir/*" | sed 's/ /\\ /g' | dmenu -i -l 20 -sb $COLOR0 -nb $COLOR0 -nf $COLOR11 -sf $COLOR3 | xargs urxvt -e rifle -p0
exit 0
diff --git a/ratpoison/tray b/ratpoison/tray
deleted file mode 100755
index 16fbb56..0000000
--- a/ratpoison/tray
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-source ~/.colors
-
-mon_num=${1:-0}
-width=${2:-0}
-height=${3:-0}
-x=${4:-0}
-y=${5:-0}
-
-let x_offset=$x+$width-16
-stalonetray -bg $COLOR0 --geometry 1x1+$x_offset+$y --grow-gravity NE \
- --icon-size 16 --icon-gravity W --kludges force_icons_size
diff --git a/ratpoison/wp b/ratpoison/wp
index 4069e77..483e3c2 100755
--- a/ratpoison/wp
+++ b/ratpoison/wp
@@ -249,4 +249,7 @@ Actions
#:: End function declaration, begin executing
main $*
-~/.ratpoison/ratcolor
+~/.config/bspwm/colors
+pkill panel
+pkill stalone
+~/bin/panel & disown
diff --git a/ratpoison/xtoolwait b/ratpoison/xtoolwait
new file mode 100755
index 0000000..6d07668
--- /dev/null
+++ b/ratpoison/xtoolwait
Binary files differ