dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 02ed13afcae2b828b17029bb9536e4310c87b521
parent d6d8bf8a67e40fef44fc12af14f8a38291cfd11a
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Wed,  1 Apr 2020 00:28:30 +0100

status2d integration of scripts

Diffstat:
M.config/sxhkd/sxhkdrc | 5+----
M.scripts/bin/display/wallblur | 46+++++++++++++++++++++++++++++-----------------
M.scripts/bin/misc/qmv | 24+++++++++++++++++++++++-
M.scripts/dwmblocks/bat | 5+++--
M.scripts/dwmblocks/dwmbar | 2+-
M.scripts/dwmblocks/mpv | 14++++++++------
M.zprofile | 2+-
7 files changed, 66 insertions(+), 32 deletions(-)

diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc @@ -1,7 +1,7 @@ super + {shift, ctrl, alt, shift + ctrl} + bracketright dinput "Are you sure?" "{sudo zzz, sudo ZZZ, sudo halt, sudo reboot}" -super + return +super + Return st super + b @@ -63,6 +63,3 @@ super + alt + {i,p} super + {ctrl,alt} + o hmpv {toggle,quit} /tmp/mpv-socket - -super + bracketright + {0-9} + {,shift} - hvol {0-9}%{-,+} diff --git a/.scripts/bin/display/wallblur b/.scripts/bin/display/wallblur @@ -7,30 +7,42 @@ # Copyright (c) 2019 Hayden Hamilton. backend="xwallpaper" -args="$@" +args=$(echo "$@" | sed 's/--force//g;s/force//g') echo "$args" -[ "$args" == "" ] && args=2 donorm(){ - convert $file -colors $args $1 - files+="$1 " + [ "$args" = "" ] && { + convert $file -sparse-color Barycentric '0,0 black 0,%h white' -function polynomial 3.5,-3.5,1 /tmp/blurmap.png + convert $file /tmp/blurmap.png -compose Blur -set option:compose:args 5 -composite $1 + } || { + convert $file $args $1 + } + files="$files $1" } -input=$(cat ~/.cache/rfeh/prev) +input=$(cat $HOME/.cache/rfeh/prev) count=0 files="" +mkdir -p $HOME/.cache/wallblur/ + for file in $input do count=$(($count+1)) - donorm "/tmp/screen${count}.png" + [ "$(echo "$@" | grep "force")" = "" ] && { + [ -f $HOME/.cache/wallblur/$(basename $file) ] && { + files="$HOME/.cache/wallblur/$(basename $file) $files" + } || { + donorm "$HOME/.cache/wallblur/$(basename $file)" + } + } || { + donorm "$HOME/.cache/wallblur/$(basename $file)" + } + done -[ "$backend" = "xwallpaper" ] && { - files=$(echo "$files" | tr " " "\n" | sed "s~^~--output OUTPUT --zoom ~g" | tr "\n" " ") - for OUTPUT in $(xrandr --listactivemonitors | awk '$4 {print $4}') - do - files=$(echo "$files" | sed "s/OUTPUT/$OUTPUT/") - done - xwallpaper $files -} || { - files=$(echo "$files" | tr " " "\n" | sed "s~^~--bg-fill ~g" | tr "\n" " ") - feh $files -} + +files=$(echo "$files" | sed 's~ $~~g;s~^ ~~g' | tr " " "\n" | sed "s~^~--output OUTPUT --zoom ~g" | tr "\n" " ") +echo $files +for OUTPUT in $(xrandr --listactivemonitors | awk '$4 {print $4}') +do + files=$(echo "$files" | sed "s/OUTPUT/$OUTPUT/") +done +xwallpaper $files diff --git a/.scripts/bin/misc/qmv b/.scripts/bin/misc/qmv @@ -4,7 +4,8 @@ qmv [mode] [modeinfo] [files] $(tput bold)MODES & MODEINFO$(tput sgr0) - number [start number].[file extension]\n" && exit + number [start number].[file extension] + 0number [0-padded start number].[file extension]\n" && exit mode="$1" modeinfo="$2" @@ -24,7 +25,28 @@ _number(){ done } +_number0(){ + number=$(echo "$@" | grep -o "^[0-9]*") + fileext=$(echo "$@" | grep -o "\.[A-Za-z0-9]*" | sed 's/^\.//g') + pad=$(echo "$number" | grep -o "^0*") + padc=$(echo "$pad" | wc -m) + echo $padc + + for file in $all + do + numa=$(echo "$number" | wc -m) + pada=$(($numa-$padc)) + padnum=$(for void in $(seq $pada); do printf "0"; done; printf "$number") + [ "$fileext" = "" ] && { + mv $file $padnum + } || { + mv $file $padnum.$fileext + }; number=$(($number+1)) + done +} + case "$mode" in number|numbered|num|n) _number "$modeinfo" ;; + 0number|number0|0num|num0) _number0 "$modeinfo" ;; *) echo "$mode: not a supported mode."; exit ;; esac diff --git a/.scripts/dwmblocks/bat b/.scripts/dwmblocks/bat @@ -6,7 +6,7 @@ # haydenvh.com # Copyright (c) 2019 Hayden Hamilton. -printf "B " +printf "[B " for b in $(find /sys/class/power_supply -name "BAT*") do read charge < $b/capacity @@ -20,12 +20,13 @@ do esac - [ "$charge" = "100" ] && stat="^c#00ff00^^r0,3,10,9^^f2^^c#00ff00^!^c#00ff00^^f8^" && charge="" + [ "$charge" = "100" ] || [ "$charge" = "99" ] && stat="^c#00ff00^" && charge="$charge!" [ $charge -le 10 ] && stat="^c#ff0000^!!!" printf "%s:%s%s" "^c#aaaaaa^$(echo "$b" | grep -o "[0-9]*$")" "$stat" "$charge" unset dis done +printf "]" echo echo echo \#C625C8 diff --git a/.scripts/dwmblocks/dwmbar b/.scripts/dwmblocks/dwmbar @@ -36,5 +36,5 @@ done & cd ~/.cache/blocks while true; do sleep 1 - xsetroot -name "$(for void in $(seq 150); do printf " "; done) $(cat bat cpu disk disk2 mem mpv net news vol weather time time2 host | sed '/^#/d;/^$/d' | sed '1~2s/^/\^c#aaaaff\^/;2~2s/^/\^c#ffaaaa\^/' | tr '\n' '\f' | sed 's/\f/ /g' | tr "[]" " ") " + xsetroot -name "$(for void in $(seq 150); do printf " "; done) $(cat bat cpu disk disk2 mem mpv net news vol weather time time2 host | sed '/^#/d;/^$/d' | sed '1~2s/^/\^c#aaaaff\^/;2~2s/^/\^c#ffaaaa\^/;s~\[~ ^b#1a3136^ ~g;s~\]~ ^d^~g' | tr '\n' ' ') " done diff --git a/.scripts/dwmblocks/mpv b/.scripts/dwmblocks/mpv @@ -10,6 +10,8 @@ file2=$(echo '{command:["get_property", "media-title"]}' | socat - /tmp/mpv-sock vidtitle2=$(echo '{command:["get_property", "media-title"]}' | socat - /tmp/mpv-socket2 | tr '"{:,}\[' ' ' | sed 's/data//g' | sed 's/request_id 0//g' | sed 's/error success//g' | sed 's/ / /g' | sed 's/ / /g' | sed 's/ / /g' | sed 's/ / /g' | sed 's/^//g') state=$(echo '{ "command": ["get_property", "pause"] }' | socat - /tmp/mpv-socket | tr '{":0,}' ' ' | awk '// {print $2}') state2=$(echo '{ "command": ["get_property", "pause"] }' | socat - /tmp/mpv-socket2 | tr '{":0,}' ' ' | awk '// {print $2}') +artist=$(echo '{ "command": ["get_property", "metadata/artist"] }' | socat - /tmp/mpv-socket | tr '{":0,}' ' ' | sed 's/[[:space:]]*data[[:space:]]*//g;s/[[:space:]]*request_id.*$//g') +artist2=$(echo '{ "command": ["get_property", "metadata/artist"] }' | socat - /tmp/mpv-socket2 | tr '{":0,}' ' ' | sed 's/[[:space:]]*data[[:space:]]*//g;s/[[:space:]]*request_id.*$//g') convertsecs() { ((h=${1}/3600)) ((m=(${1}%3600)/60)) @@ -21,24 +23,24 @@ time2=$(convertsecs $(echo '{ "command": ["get_property", "playback-time"] }' | if [ "$state" == "false" ] then - out=" PLAY - MUSIC - $file2 - $time" + out="$(echo "PLAY - MUSIC - $artist - $file2" | cut -zc-60) - $time" color="true" elif [ "$state" == "true" ] then if [ "$state2" == "false" ] then - out=" PLAY - VIDEO - $vidtitle2 - $time2" + out="$(echo "PLAY - VIDEO - $artist2 - $vidtitle2" | cut -zc-60) - $time2" else - out=" STOP - MUSIC - $file2 - $time" + out="$(echo "STOP - MUSIC - $artist - $file2" | cut -zc-60) - $time" fi color="true" elif [ "$state2" == "false" ] then - out=" PLAY - VIDEO - $vidtitle2 - $time2" + out="$(echo "PLAY - VIDEO - $artist2 - $vidtitle2" | cut -zc-60) - $time2" color="true" elif [ "$state2" == "true" ] then - out=" STOP - VIDEO - $vidtitle2 - $time2" + out="$(echo "STOP - VIDEO - $artist2 - $vidtitle2" | cut -zc-60) - $time2" color="true" else out=" NONE" @@ -46,7 +48,7 @@ else fi if [ "$color" == "true" ] then - echo "[MPV$out]" | cut -zc-70 + echo "[MPV $out]" echo echo \#666b1b elif [ "$color" == "false" ] diff --git a/.zprofile b/.zprofile @@ -21,7 +21,7 @@ export SUDO_ASKPASS="$HOME/.scripts/bin/dmenu/daskpass" export PASS="$HOME/.local/pass" export SHELL="/usr/bin/zsh" export ZDOTDIR="$HOME/.config/zsh" -export IP="$(curl icanhazip.com -qs)" & +export IP="$(curl icanhazip.com -qs)" xrdb -merge ~/.local/xres . .config/zsh/ls.zsh [ "$hostname" != "" ] && {