scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit 6b577e4f61229e5812efeef63e08ecbd255fb3c1
parent 6078f8fdacf1fe2350048d557a21f549fd156885
Author: z3bra <willyatmailoodotorg>
Date:   Tue Nov 17 01:21:47 +0100

fuck it, commit everything, at least it's save somewhere

Diffstat:
bars | 4++--
cdump | 19+------------------
changewall | 16++++++++++++++++
img | 1-
ix | 3+++
link-open | 17+++++++++++------
memory | 2+-
menu | 7++++---
square | 2+-
sshmenu | 9+++++++++
teletype | 0
udmenu | 10++++++++++
uplaylist | 6++++++
ushot | 2+-
vroum | 14++++++++++----
xurls | 7+++++++
yawee | 20++++++++++++--------
17 files changed, 94 insertions(+), 45 deletions(-)
diff --git a/bars b/bars @@ -1,8 +1,8 @@ #!/bin/sh . $HOME/.wmrc -COL2="%{B#66ffffff}" -COL1="%{B#66000000}" +COL2="%{B#66000000}" +COL1="%{B#ff000000}" START=$COL1 SEP=$COL2 diff --git a/cdump b/cdump @@ -1,20 +1,3 @@ #!/bin/sh -for NUM in $(seq 0 7); do - CN=$(xrdb -query | grep "^\*color${NUM}:"| cut -d':' -f2 | tr -d ' ') - printf "\e[0;3${NUM}m%s " $CN -done -echo -for NUM in $(seq 0 7); do - printf "\e[0;3${NUM}m███████ " -done -echo -for NUM in $(seq 0 7); do - printf "\e[1;3${NUM}m███████ " -done -echo -for NUM in $(seq 0 7); do - CN=$(xrdb -query | grep "^\*color$((${NUM} + 8)):"| cut -d':' -f2 | tr -d ' ') - printf "\e[1;3${NUM}m%s " $CN -done -printf "\e[0m\n" +xrdb -query | grep -P '^\*color[0-9]*:' | tr -d '\t' | cut -d: -f2 | hex2col diff --git a/changewall b/changewall @@ -0,0 +1,16 @@ +#!/bin/sh + +WALLDIR=$HOME/usr/pics/bg + +setwall() { + WALL=$(readlink -f $1) + hsetroot -fill $WALL + hsetroot -fill $WALL -blur 8 -write $HOME/.blur.png + ln -sf $WALL ~/.wall.png +} + +test -n "$1" && setwall $1 && exit + +find $WALLDIR -name '*.png' | meh -list | while read WALL; do + setwall $WALL +done diff --git a/img b/img @@ -1,7 +1,6 @@ #!/bin/sh IMAGE=/tmp/`basename $1` -echo "Downloading image.." curl -s "$1" > $IMAGE meh $IMAGE rm $IMAGE diff --git a/ix b/ix @@ -0,0 +1,3 @@ +#!/bin/sh + +curl -sF "f:1=<-" ix.io diff --git a/link-open b/link-open @@ -2,18 +2,23 @@ URI="$*" +# yank URI first, just in case :) +printf '%s' "$URI" | xsel -i + case $URI in *.jp*g|*.png) img "$URI";; *.webm|*.mp4|*.ogv) mplayer -geometry 1280x720 "$URI";; *.gif) mplayer -geometry 1280x720 "$URI";; *youtube.com/*) uplay "$URI";; *.html) dwb "$URI";; + *.txt) st -e sh -c "curl -s '$URI'|less -R";; + gopher://*) st -e cgo $URI ;; *) thingmenu -g 140x182 \ - "picture" "img '$URI'" \ - "video" "mplayer -cache 512 '$URI'" \ - "kinda vid" "uplay '$URI'" \ - "text file" "urxvt -e sh -c 'curl -s $URI | less -X'" \ - "donlad" "~/bin/download $URI" \ - "web shit" "dwb '$URI'" 2>/dev/null + "picture" "img '$URI'" \ + "video" "mplayer -cache 512 '$URI'" \ + "kinda vid" "uplay '$URI'" \ + "text file" "st -e sh -c 'curl -s $URI | less -X'" \ + "donlad" "~/bin/download $URI" \ + "web shit" "dwb '$URI'" 2>/dev/null ;; esac diff --git a/memory b/memory @@ -24,7 +24,7 @@ memused () { b=$(grep ^Buffers /proc/meminfo | awk '{print $2}') c=$(grep ^Cached /proc/meminfo | awk '{print $2}') - echo "($t - $f - $c - $b)" | bc + echo "($t - $f - $c - $b) * 1000" | bc } # display the memory used in percentage diff --git a/menu b/menu @@ -1,9 +1,10 @@ #!/bin/bash thingmenu -g 140x224 \ - "pop a term" "urxvt" \ - "chat on irc" "urxvt -e sh -c 'dm irc ssh wizards'" \ + "chat on irc" "st -e sh -c 'dm irc ssh wizards'" \ + "run around" "defrag" \ + "frag people" "quake3e" \ "play a game" "steam" \ - "frag people" "ioquake3" \ + "pop a term" "st" \ "surf the web" "dwb" \ "scrot this shit" "xscreenshot | if2png | imgurup | xsel -pi" \ "want some more?" "thinglaunch" 2> /dev/null diff --git a/square b/square @@ -1,6 +1,6 @@ #!/bin/sh -CHAR=${1:-▒▒} +CHAR=${1:-██} echo for i in {0..7}; do echo -en " \e[0;3${i}m${CHAR}\e[0m"; done; echo diff --git a/sshmenu b/sshmenu @@ -0,0 +1,9 @@ +#!/bin/sh + +gethosts() { + sed "/Host/s/Host //p;d" $HOME/.ssh/config | grep -v '*' | cut -d\ -f1 +} + +TARGET=$(gethosts | slmenu -l 8 -p "host:") + +test -n "$TARGET" && ssh $TARGET diff --git a/teletype b/teletype Binary files differ. diff --git a/udmenu b/udmenu @@ -0,0 +1,10 @@ +#!/bin/sh + +FONT="-windows-codingfonttobi1-medium-r-normal--12-90-96-96-c-70-iso8859-1" +NB='#14120f' +NF='#42403d' +SB='#42403d' +SF='#f1e8d9' + + +dmenu -fn "$FONT" -nb "$NB" -nf "$NF" -sb "$SB" -sf "$SF" $@ diff --git a/uplaylist b/uplaylist @@ -0,0 +1,6 @@ +#!/bin/sh +# +# play a youtube playlist with player +curl -s "$1" | cut -d'"' -f2 | grep 'watch?v='| sort | uniq | + cut -d\& -f1 | sed 's@^@http://www.youtube.com@' | + xargs -I% sh -c 'mplayer -really-quiet -cache 1024 "$(youtube-dl -g %)"' diff --git a/ushot b/ushot @@ -2,7 +2,7 @@ FILE=${1:-/dev/null} -xscreenshot | if2png | tee $FILE | imgurup +xscreenshot | iffpng | tee $FILE | imgurup sed 1q ~/.imgurlog | xsel -pi test -n "$1" && meh $1 diff --git a/vroum b/vroum @@ -3,9 +3,9 @@ # z3bra - 2014 (c) wtfpl # window focus wrapper that sets borders and can focus next/previous window -BW=${BW:-6} # border width +BW=${BW:-8} # border width ACTIVE=${ACTIVE:-0xffffff} # active border color -INACTIVE=${INACTIVE:-0x323232} # inactive border color +INACTIVE=${INACTIVE:-0x646464} # inactive border color # get current window id CUR=$(pfw) @@ -26,8 +26,14 @@ setborder() { test "$(wattr xywh $2)" = "$(wattr xywh $ROOT)" && return case $1 in - active) chwb -s $BW -c $ACTIVE $2 ;; - inactive) chwb -s $BW -c $INACTIVE $2 ;; + active) + chwb -s $BW -c $ACTIVE $2 + chwb2 -O $ACTIVE -I 000000 -i 4 -o 4 $2 + ;; + inactive) + chwb -s $BW -c $INACTIVE $2 + chwb2 -O $INACTIVE -I 000000 -i 4 -o 4 $2 + ;; esac } diff --git a/xurls b/xurls @@ -0,0 +1,7 @@ +#!/bin/sh + +protocols='[a-zA-Z]+://' +hostchars='[-a-zA-Z0-9._+]+' +pathchars='[-a-zA-Z0-9._+#=?&:;%/!~()]+' + +grep -aPo "${protocols}${hostchars}${pathchars}" | tac diff --git a/yawee b/yawee @@ -1,7 +1,8 @@ #!/bin/sh WALL=$HOME/.wall.png -BLUR=10 +BLUR=$HOME/.blur.png +#BLUR=10 blur() { hsetroot -fill $WALL -blur ${1:-$BLUR} @@ -10,18 +11,21 @@ blur() { while IFS=: read ev wid; do case $ev in # window creation - 16) wattr o $wid || { - corner md $wid - test "$(lsw)" = "$wid" && blur & - } + 16) wattr o $wid || corner md $wid ;; # mapping requests - 19) wattr o $wid || vroum $wid ;; + 19) wattr o $wid || { + vroum $wid & + #test $(lsw|wc -l) -eq 1 && hsetroot -fill $BLUR + } + ;; # focus next window when deleting focused window - 18) wattr $(pfw) || vroum prev 2>/dev/null - test -z "$(lsw)" && blur 0 & + 18) wattr $(pfw) || { + vroum prev 2>/dev/null + #test -z "$(lsw)" && hsetroot -fill $WALL + } ;; # entering window