diff options
-rwxr-xr-x | bin/common/ytclipo | 20 | ||||
-rwxr-xr-x | bin/extra/confirm | 4 | ||||
-rwxr-xr-x | bin/extra/pomo | 31 | ||||
-rwxr-xr-x | bin/extra/setip | 16 | ||||
-rwxr-xr-x | bin/menuscripts/mplay | 6 | ||||
-rw-r--r-- | config/X/dunst/dunstrc | 4 | ||||
-rw-r--r-- | config/essentials/nvim/after/plugin/luasnip.lua | 1 |
7 files changed, 31 insertions, 51 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo index fc98b6e..712b068 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -2,19 +2,20 @@ # argument ($1) -> clipboard -> stdin if [ "$WAYLAND_DISPLAY" ] -then - paste="$(wl-paste)" -else - paste="$(xclip -o -sel c)" +then paste() { wl-paste; } +elif [ "$TERMUX_VERSION" ] +then paste() { termux-clipboard-get; } +else paste() { xclip -o -sel c; } fi -test -z "${inp:=${1:-$paste}}" && - inp="$(cat /dev/stdin)" + +inp="$1" +[ "${inp:=$(paste)}" ] || inp="$(cat /dev/stdin)" # take last link from clipboard # works when link is from yt-local inp="https://youtu.be/$(echo "$inp" | sed 's/.*\(.\{11\}\)$/\1/')" -echo "inp: ${inp}" 1>&2 -notify-send "ytclipo" "<b>downloading</b> $inp" +>&2 printf "inp: %s\n" "$inp" +notify-send "ytclipo" "<b>downloading</b> $inp" || : yt-dlp "$inp" \ --restrict-filenames \ @@ -23,5 +24,4 @@ yt-dlp "$inp" \ -S "res:1080" \ -P "$HOME/vids/youtube/" \ -o "%(channel)s - %(title)s.%(ext)s" -notify-send "ytclipo" "<b>ytclipo</b><br>finished downloading." -echo "$inp" >> /tmp/ytclipo_history +notify-send "ytclipo" "<b>ytclipo</b><br>finished downloading." || : diff --git a/bin/extra/confirm b/bin/extra/confirm index 116b468..630d701 100755 --- a/bin/extra/confirm +++ b/bin/extra/confirm @@ -5,8 +5,8 @@ read_char () old_stty_cfg=$(stty -g 2> /dev/null) stty raw -echo 2> /dev/null dd ibs=1 count=1 2> /dev/null - stty $old_stty_cfg 2> /dev/null + stty "$old_stty_cfg" 2> /dev/null } ->&2 printf "$1 " +>&2 printf "%s " "$1" read_char | grep -q "[yY]" diff --git a/bin/extra/pomo b/bin/extra/pomo deleted file mode 100755 index a2c371d..0000000 --- a/bin/extra/pomo +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -notif() { notify-send -t 1000 -w "pomo" "$1"; } - -for msg in "three" "two" "one" -do notif "$msg" -done - -# $1: time in minutes -# $2: msg for notification -ring_ring() -{ - date '+%R B' - notify-send -w "$(($1*1000*60))" -u critical "pomo" "$2" -} - -i="${1-0}" -while true - -do - notif "<b>START</b>" - date '+%R S' - sleep 20m - if [ "$i" -eq 3 ] - then - i=0 - ring_ring 20 "GIGA BREAK TIME" - else - ring_ring 5 "BREAK TIME" - i=$((i+1)) - fi -done diff --git a/bin/extra/setip b/bin/extra/setip new file mode 100755 index 0000000..b10e7cc --- /dev/null +++ b/bin/extra/setip @@ -0,0 +1,16 @@ +#!/bin/sh + +ips="192.168.178.79 192.168.178.52 10.7.0.1 none" + +for ip in $ips +do ping -i .2 -c 1 "$ip" > /dev/null 2>&1 && break +done + +if [ "$ip" = "none" ] +then + >&2 printf 'No ip.\n' + exit 1 +fi + +sed -i "/Host db/,/^$/s/.*HostName.*/\tHostname $ip/" "$HOME"/.ssh/config +>&2 printf 'Done: %s \n' "$ip" diff --git a/bin/menuscripts/mplay b/bin/menuscripts/mplay deleted file mode 100755 index e4fca54..0000000 --- a/bin/menuscripts/mplay +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -choice="$(mpc listall | commander -c -l -d -x)" -[ "$choice" ] || exit 1 -mpc insert "$choice" || exit 1 -mpc next 2> /dev/null -mpc play 2> /dev/null diff --git a/config/X/dunst/dunstrc b/config/X/dunst/dunstrc index 4975d0a..a83f45f 100644 --- a/config/X/dunst/dunstrc +++ b/config/X/dunst/dunstrc @@ -30,7 +30,7 @@ height = 80 # Position the notification in the top right corner - origin = right + origin = top-right # Offset from the origin offset = 10x10 @@ -171,7 +171,7 @@ # Show age of message if message is older than show_age_threshold # seconds. # Set to -1 to disable. - show_age_threshold = 60 + show_age_threshold = -1 # Specify where to make an ellipsis in long lines. # Possible values are "start", "middle" and "end". diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua index 3f607ab..70d7570 100644 --- a/config/essentials/nvim/after/plugin/luasnip.lua +++ b/config/essentials/nvim/after/plugin/luasnip.lua @@ -143,6 +143,7 @@ ls.add_snippets("java", { ls.add_snippets("sh", { s("TD", t "THISDIR=\"$(dirname \"$(readlink -f \"$0\")\")\""), + parse("pf", ">&2 printf '$1\\n'$0", {}), parse("fn", "$1 ()\n{\n\t$2\n}$0", {}), -- Functions parse("rchar", |