diff options
author | Arnold Sommerfeld <sommerfeld@strisemarx.com> | 2023-05-17 18:44:48 +0100 |
---|---|---|
committer | Arnold Sommerfeld <sommerfeld@strisemarx.com> | 2023-10-18 11:16:43 +0100 |
commit | b487984ecc61c6229cf92550030745c192fd3d0b (patch) | |
tree | 937e598c941fc1172467aeeed8ef51cbfceaca62 /home/.local/bin | |
download | dotfiles-b487984ecc61c6229cf92550030745c192fd3d0b.tar.gz dotfiles-b487984ecc61c6229cf92550030745c192fd3d0b.tar.bz2 dotfiles-b487984ecc61c6229cf92550030745c192fd3d0b.zip |
first commit
Diffstat (limited to 'home/.local/bin')
-rwxr-xr-x | home/.local/bin/automute | 123 | ||||
-rwxr-xr-x | home/.local/bin/display-setup | 22 | ||||
-rwxr-xr-x | home/.local/bin/input-setup | 50 | ||||
-rwxr-xr-x | home/.local/bin/launch-polybar | 17 | ||||
-rwxr-xr-x | home/.local/bin/linkhandler | 49 | ||||
-rwxr-xr-x | home/.local/bin/locknpause | 4 | ||||
-rwxr-xr-x | home/.local/bin/record | 86 | ||||
-rwxr-xr-x | home/.local/bin/rqr | 6 | ||||
-rwxr-xr-x | home/.local/bin/stop | 7 | ||||
-rwxr-xr-x | home/.local/bin/stream | 94 | ||||
-rwxr-xr-x | home/.local/bin/terminal-benchmark | 61 | ||||
-rwxr-xr-x | home/.local/bin/terminal-testdrive | 66 | ||||
-rwxr-xr-x | home/.local/bin/tokodi | 13 | ||||
-rwxr-xr-x | home/.local/bin/videowrapper | 7 | ||||
-rwxr-xr-x | home/.local/bin/wqr | 11 |
15 files changed, 616 insertions, 0 deletions
diff --git a/home/.local/bin/automute b/home/.local/bin/automute new file mode 100755 index 0000000..20b04f4 --- /dev/null +++ b/home/.local/bin/automute @@ -0,0 +1,123 @@ +#!/usr/bin/env sh + +pid_file="/tmp/automutepid" + +pid_exists() { + test -r "$pid_file" +} + +is_running() { + if pid_exists; then + ps "$(cat "$pid_file")" >/dev/null 2>&1 || return 1 + else + return 1 + fi +} + +mute() { + pw-cli set-param "$1" Props '{mute: true}' +} + +unmute() { + pw-cli set-param "$1" Props '{mute: false}' +} + +pid2index() { + pw-dump | jq --argjson targetid "$1" 'map(select(.info.props."application.process.id" == $targetid and .info.params.PropInfo != null)) | .[].id' +} + +list_sink_input_ids() { + pw-dump | jq 'map(select(.info.params.PropInfo != null and .info.params.PropInfo[].id=="mute" and .info.props."application.process.id" != null)) | .[].id' +} + +unmute_all() { + for i in $(list_sink_input_ids); do + unmute "$i" + done + exit +} + +trap unmute_all INT TERM + +mute_all() { + for i in $(list_sink_input_ids); do + mute "$i" + done +} + +do_automute() { + while :; do + focus_pid="$(xdotool getwindowfocus getwindowpid)" + if [ "$focus_pid" ] && [ "$unfocus_pid" != "$focus_pid" ]; then + focus_index=$(pid2index "$focus_pid") + if [ "$unfocus_pid" ]; then + unfocus_index=$(pid2index "$unfocus_pid") + fi + if [ "$focus_index" ]; then + if [ "$unfocus_index" ]; then + mute "$unfocus_index" + else + mute_all + fi + unmute "$focus_index" + unfocus_pid="$focus_pid" + fi + fi + sleep 0.25 + done +} + +start() { + do_automute & + echo "$!" >"$pid_file" + notify-send "Automute started!" +} + +stop() { + pid_exists || exit 1 + pid="$(cat "$pid_file")" + # kill with SIGTERM, allowing finishing touches. + kill "$pid" + # even after SIGTERM, ffmpeg may still run, so SIGKILL it. + sleep 3 + is_running && kill -9 "$pid" + rm -f "$pid_file" + notify-send "Automute stopped!" +} + +toggle() { + if is_running; then + echo "Stopping automute" + stop + else + echo "Starting automute" + start + fi + echo + status +} + +status() { + if is_running; then + echo "Automuting is running with PID $(cat "$pid_file")" + else + echo "Automute inactive" + fi +} +case "$1" in + start) + start + ;; + stop) + stop + ;; + toggle) + toggle + ;; + status) + status + ;; + *) + toggle + ;; +esac diff --git a/home/.local/bin/display-setup b/home/.local/bin/display-setup new file mode 100755 index 0000000..94d5703 --- /dev/null +++ b/home/.local/bin/display-setup @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +if [ "$(uname -n)" = "hercules" ]; then + xrandr --setprovideroutputsource modesetting NVIDIA-G0 + nvidia-settings --load-config-only & + nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1' & +fi +xrandr --auto + +if [ "$(uname -n)" = "hercules" ] && xrandr --query | grep "HDMI-1 connected"; then + xrandr --output eDP-1 --off + xrandr --output HDMI-1 --primary --mode 1920x1080 --rate 144 + # xrandr --output HDMI-1 --primary --mode 1920x1080 + # xrandr --output HDMI-1 --primary --mode 2560x1080 --rate 75 + # xrandr --output HDMI-1 --primary --mode 3840x2160 + # xrandr --output HDMI-1 --mode 1920x1080 --sameas eDP-1 +elif [ "$(uname -n)" = "halley" ] && xrandr --query | grep "HDMI-1 connected"; then + xrandr --output HDMI-1 --mode 1920x1080 --same-as eDP-1 +fi + +bspc wm -r +launch-polybar diff --git a/home/.local/bin/input-setup b/home/.local/bin/input-setup new file mode 100755 index 0000000..95f7d31 --- /dev/null +++ b/home/.local/bin/input-setup @@ -0,0 +1,50 @@ +#!/usr/bin/env sh + +[ -r ~/.config/X11/Xkeymap ] && xkbcomp ~/.config/X11/Xkeymap "$DISPLAY" + +setlayout() { + ids=$(xinput --list | sed -ne '/Virtual core keyboard/{:a' -e 'n;p;ba' -e '}' | grep "$1" | sed -n 's/.*id=\([0-9]\+\).*/\1/p') + for i in $ids; do + setxkbmap -device "$i" -layout "$2" + done +} + +setmodmap() { + kbds=$(xinput --list | sed -ne '/Virtual core keyboard/{:a' -e 'n;p;ba' -e '}' | grep "$1" | sed -n 's/.*id=\([0-9]\+\).*/\1/p') + if [ "$kbds" ]; then + xmodmap ~/.config/X11/Xmodmap + fi +} + +if [ "$(uname -n)" = "halley" ]; then + setxkbmap -layout no +elif [ "$(uname -n)" = "hercules" ]; then + setxkbmap -layout es +fi + +setxkbmap -option "caps:escape" +xset r rate 250 30 + +setlayout "Kingston HyperX Alloy FPS Pro Mechanical Gaming Keyboard" us +# setlayout "SONiX USB DEVICE" us + +setlayout "SEMITEK USB-HID Gaming Keyboard" us +# setmodmap "SEMITEK USB-HID Gaming Keyboard" + +setlayout "Dierya DK61 Keyboard" us +# setmodmap "Dierya DK61 Keyboard" + +xmodmap ~/.config/X11/Xmodmap + +if [ "$(uname -n)" = "hercules" ]; then + xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Tapping Enabled" 1 + xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Natural Scrolling Enabled" 1 + ids=$(xinput --list | sed -ne '/Virtual core pointer/{:a' -e 'n;p;ba' -e '}' | grep "Kingsis Peripherals ZOWIE Gaming mouse" | sed -n 's/.*id=\([0-9]\+\).*/\1/p') + for i in $ids; do + xinput --set-prop "$i" 'libinput Accel Profile Enabled' 0, 1 + done +elif [ "$(uname -n)" = "halley" ]; then + xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1 + xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Natural Scrolling Enabled" 1 + xinput set-prop "ELAN Touchscreen" "Device Enabled" 0 +fi diff --git a/home/.local/bin/launch-polybar b/home/.local/bin/launch-polybar new file mode 100755 index 0000000..c670e56 --- /dev/null +++ b/home/.local/bin/launch-polybar @@ -0,0 +1,17 @@ +#!/usr/bin/env sh +# shellcheck source=/dev/null +[ -r ~/.config/sh/envrc ] && . ~/.config/sh/envrc + +# Terminate already running bar instances +killall -q polybar +# If all your bars have ipc enabled, you can also use +# polybar-msg cmd quit + +# Launch bars +if command -v "xrandr" >/dev/null 2>&1; then + for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do + MONITOR=$m polybar --reload mybar >>/tmp/polybar.log 2>&1 & + done +else + polybar --reload mybar & +fi diff --git a/home/.local/bin/linkhandler b/home/.local/bin/linkhandler new file mode 100755 index 0000000..8b43f70 --- /dev/null +++ b/home/.local/bin/linkhandler @@ -0,0 +1,49 @@ +#!/usr/bin/env sh + +resolve_url() { + if [ -f "$1" ]; then + local_url="$1" + else + local_url="/tmp/$(echo "$1" | sed "s/.*\///")" + curl -sL "$1" >"$local_url" + fi + printf "%s" "$local_url" +} + +if [ -z "$1" ]; then + url=$(xclip -o -selection clipboard) +else + url="$1" +fi + +case "$url" in + *.mkv* | *.webm* | *.mp4* | *.mp3* | *.ogg* | *.mov* | *.ts* | *.m3u8* | *.gif* | *.m4a* | *youtube.com/watch* | *youtube.com/playlist* | *youtu.be* | *twitch.tv* | *invidio.us* | *lbry* | *streamye.com* | *streamvi.com* | *streamwo.com* | *videos.lukesmith.xyz*) + setsid mpv -quiet "$url" >/dev/null 2>&1 & + ;; + acestream://*) + setsid acestream-launcher "$url" >/dev/null 2>&1 & + ;; + *.png | *.jpg | *.jpe | *.jpeg | *.PNG | *.JGP | *.JPE | *.JPEG) + local_url="$(resolve_url "$url")" + setsid sxiv -a "$local_url" >/dev/null 2>&1 & + ;; + *.pdf | *.ps | *.epub) + local_url="$(resolve_url "$url")" + setsid zathura "$local_url" >/dev/null 2>&1 & + ;; + *rss* | *feed* | http*.xml | http*.atom) + setsid rssadd "$url" >/dev/null 2>&1 & + ;; + mailto:*) + setsid aerc "$url" >/dev/null 2>&1 & + ;; + *.dot) + setsid xdot "$url" >/dev/null 2>&1 & + ;; + http*) + librewolf "$url" >/dev/null 2>&1 & + ;; + *) + "$TERMINAL $EDITOR $1" + ;; +esac diff --git a/home/.local/bin/locknpause b/home/.local/bin/locknpause new file mode 100755 index 0000000..0fa728e --- /dev/null +++ b/home/.local/bin/locknpause @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +playerctl pause +# i3lock-fancy -t "" -- scrot -z -o +i3lock-fancy-rapid 5 2 -e -f diff --git a/home/.local/bin/record b/home/.local/bin/record new file mode 100755 index 0000000..0789769 --- /dev/null +++ b/home/.local/bin/record @@ -0,0 +1,86 @@ +#!/usr/bin/env sh + +pid_file="/tmp/recordpid" +log_file="/tmp/record.log" + +pid_exists() { + test -r "$pid_file" +} + +is_running() { + if pid_exists; then + ps "$(cat "$pid_file")" >/dev/null 2>&1 || return 1 + else + return 1 + fi +} + +start() { + ffmpeg \ + -threads 0 \ + -thread_queue_size 512 -f x11grab -s 1920x1080 -framerate 60 -i "$DISPLAY" \ + -thread_queue_size 1024 -f pulse -itsoffset 0.350 -i "alsa_output.usb-SteelSeries_SteelSeries_Arctis_7-00.analog-stereo.monitor" \ + -thread_queue_size 1024 -f pulse -itsoffset 0.350 -i "alsa_input.usb-SteelSeries_SteelSeries_Arctis_7-00.analog-mono" \ + -c:a aac \ + -init_hw_device vaapi=va:/dev/dri/renderD128,driver=i965 -filter_hw_device va \ + -vf format=nv12,hwupload \ + -c:v h264_vaapi \ + -r:v 60 -g:v 120 -bf:v 3 -refs:v 16 \ + "$HOME/vids/$(date '+%y%m%d-%H%M-%S').mkv" >"$log_file" 2>&1 & + echo "$!" >"$pid_file" + + notify-send "Record started!" +} + +stop() { + pid_exists || exit 1 + pid="$(cat "$pid_file")" + # kill with SIGTERM, allowing finishing touches. + kill "$pid" + # even after SIGTERM, ffmpeg may still run, so SIGKILL it. + sleep 3 + is_running && kill -9 "$pid" + rm -f "$pid_file" + notify-send "Record stopped!" +} + +toggle() { + if is_running; then + echo "Stopping record" + stop + else + echo "Starting record" + start + fi + echo + status +} + +status() { + if is_running; then + echo "Recording with PID $(cat "$pid_file")" + echo "Check the logs at" + echo + echo "$log_file" + echo + else + echo "Record inactive" + fi +} +case "$1" in + start) + start + ;; + stop) + stop + ;; + toggle) + toggle + ;; + status) + status + ;; + *) + toggle + ;; +esac diff --git a/home/.local/bin/rqr b/home/.local/bin/rqr new file mode 100755 index 0000000..9621916 --- /dev/null +++ b/home/.local/bin/rqr @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +text="$(zbarcam -q -1 --raw | xclip -selection clipboard -f)" + +echo "$text" +notify-send "$text" diff --git a/home/.local/bin/stop b/home/.local/bin/stop new file mode 100755 index 0000000..993b722 --- /dev/null +++ b/home/.local/bin/stop @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +eval "$@" & +pid="$!" +echo "$pid" +kill -STOP "$pid" +tail --pid=$pid -f /dev/null diff --git a/home/.local/bin/stream b/home/.local/bin/stream new file mode 100755 index 0000000..c427a50 --- /dev/null +++ b/home/.local/bin/stream @@ -0,0 +1,94 @@ +#!/usr/bin/env sh + +pid_file="/tmp/streampid" +log_file="/tmp/stream.log" + +pid_exists() { + test -r "$pid_file" +} + +is_running() { + if pid_exists; then + ps "$(cat "$pid_file")" >/dev/null 2>&1 || return 1 + else + return 1 + fi +} + +start() { + ffmpeg \ + -threads 0 \ + -thread_queue_size 512 -f x11grab -s 1920x1080 -framerate 30 -i "$DISPLAY" \ + -thread_queue_size 512 -f v4l2 -video_size 320x240 -framerate 30 -i /dev/video0 \ + -thread_queue_size 1024 -f pulse -itsoffset 0.350 -i "alsa_output.usb-SteelSeries_SteelSeries_Arctis_7-00.analog-stereo.monitor" \ + -thread_queue_size 1024 -f pulse -itsoffset 0.350 -i "alsa_input.usb-SteelSeries_SteelSeries_Arctis_7-00.analog-mono" \ + -c:a aac \ + -init_hw_device vaapi=va:/dev/dri/renderD128,driver=i965 -filter_hw_device va \ + -filter_complex \ + "[0:v]setpts=PTS-STARTPTS[bg]; \ + [1:v]setpts=PTS-STARTPTS[fg]; \ + [bg][fg]overlay=W-w:H-h,format=nv12,hwupload[vout]" \ + -map "[vout]" \ + -c:v h264_vaapi \ + -r:v 30 -g:v 60 -bf:v 3 -refs:v 16 \ + -filter_complex "[2:a][3:a]amerge=inputs=2[aout]" -map "[aout]" -ac 2 \ + -f flv "rtmp://live.strisemarx.com/hls/index" >"$log_file" 2>&1 & + echo "$!" >"$pid_file" + + bspc config right_padding 320 + notify-send "Stream started!" +} + +stop() { + bspc config right_padding 0 + pid_exists || exit 1 + pid="$(cat "$pid_file")" + # kill with SIGTERM, allowing finishing touches. + kill "$pid" + # even after SIGTERM, ffmpeg may still run, so SIGKILL it. + sleep 3 + is_running && kill -9 "$pid" + rm -f "$pid_file" + notify-send "Stream stopped!" +} + +toggle() { + if is_running; then + echo "Stopping stream" + stop + else + echo "Starting stream" + start + fi + echo + status +} + +status() { + if is_running; then + echo "Streaming with PID $(cat "$pid_file")" + echo "Check the logs at" + echo + echo "$log_file" + echo + else + echo "Stream inactive" + fi +} +case "$1" in + start) + start + ;; + stop) + stop + ;; + toggle) + toggle + ;; + status) + status + ;; + *) + toggle + ;; +esac diff --git a/home/.local/bin/terminal-benchmark b/home/.local/bin/terminal-benchmark new file mode 100755 index 0000000..78923a8 --- /dev/null +++ b/home/.local/bin/terminal-benchmark @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +MAX_RETRIES=100000 +START=$(date +%s.%N) +#6*42 + 48 +for i in {1..100000}; do + echo -e '\r'; + echo -e '\033[0K\033[1mBold\033[0m \033[7mInvert\033[0m \033[4mUnderline\033[0m'; + echo -e '\033[0K\033[1m\033[7m\033[4mBold & Invert & Underline\033[0m'; + echo; + echo -e '\033[0K\033[31m Red \033[32m Green \033[33m Yellow \033[34m Blue \033[35m Magenta \033[36m Cyan \033[0m'; + echo -e '\033[0K\033[1m\033[4m\033[31m Red \033[32m Green \033[33m Yellow \033[34m Blue \033[35m Magenta \033[36m Cyan \033[0m'; + echo; + echo -e '\033[0K\033[41m Red \033[42m Green \033[43m Yellow \033[44m Blue \033[45m Magenta \033[46m Cyan \033[0m'; + echo -e '\033[0K\033[1m\033[4m\033[41m Red \033[42m Green \033[43m Yellow \033[44m Blue \033[45m Magenta \033[46m Cyan \033[0m'; + echo; + echo -e '\033[0K\033[30m\033[41m Red \033[42m Green \033[43m Yellow \033[44m Blue \033[45m Magenta \033[46m Cyan \033[0m'; + echo -e '\033[0K\033[30m\033[1m\033[4m\033[41m Red \033[42m Green \033[43m Yellow \033[44m Blue \033[45m Magenta \033[46m Cyan \033[0m'; +done +END=$(date +%s.%N) +echo "Coloured output test takes: " + "$(echo "($END - $START)" | bc)" + " seconds" +COLOURED_OUPUT=$(echo "(300 * $MAX_RETRIES) / ($END - $START)" | bc) + + +START=$(date +%s.%N) +for i in {1..100000}; do + echo -e '\r'; + echo -e '๐ซ๐๐๐ฃ๐๐๐๐ณ๐๐๐ฆ๐ท๐๐๐ช๐ป๐ป๐๐๐๐ฌ๐ฝ๐๐๐๐๐๐๐๐ข๐ณ๐ก๐ค๐ฃ๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐ฎ๐๐๐ป๐ช๐๐๐ท๐ฆ๐๐ณ๐ข๐๐๐ฏ๐๐๐ผ๐ซ๐๐๐ธ๐ง๐๐ด๐ฃ๐๐๐ฐ๐๐๐ฝ๐ฌ๐๐๐น๐จ๐'; +done +END=$(date +%s.%N) +echo "Unicode output test takes: " "$(echo "($END - $START)" | bc)" " seconds" +UNICODE_OUPUT=$(echo "(139 * $MAX_RETRIES) / ($END - $START)" | bc) + + +START=$(date +%s.%N) +for i in {1..100000}; do + echo -e '\r'; + echo -e 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'; +done +END=$(date +%s.%N) +echo "Non-unicode output test takes: " "$(echo "($END - $START)" | bc)" " seconds" +NONE_UNICODE_OUPUT=$(echo "(118 * $MAX_RETRIES) / ($END - $START)" | bc) + +test_output=''; +START=$(date +%s.%N) +for x in {1..10}; do + test_output="${test_output} a๐ซ" + for i in {1..100000}; do + echo -e '\r'; + echo -e "$test_output"; + done +done +END=$(date +%s.%N) +echo "Mixed output test takes: " "$(echo "($END - $START)" | bc)" " seconds" +MIXED_OUPUT=$(echo "(165 * $MAX_RETRIES) / ($END - $START)" | bc) + + +echo "${COLOURED_OUPUT} coloured characters per second" +echo "${UNICODE_OUPUT} unicode characters per second" +echo "${NONE_UNICODE_OUPUT} none-unicode characters per second" +echo "${MIXED_OUPUT} Mixed characters per second" diff --git a/home/.local/bin/terminal-testdrive b/home/.local/bin/terminal-testdrive new file mode 100755 index 0000000..aa241bc --- /dev/null +++ b/home/.local/bin/terminal-testdrive @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +echo "# 24-bit (true-color)" +# based on: https://gist.github.com/XVilka/8346728 +term_cols="$(tput cols || echo 80)" +cols=$(echo "2^((l($term_cols)/l(2))-1)" | bc -l 2> /dev/null) +rows=$(( cols / 2 )) +awk -v cols="$cols" -v rows="$rows" 'BEGIN{ + s=" "; + m=cols+rows; + for (row = 0; row<rows; row++) { + for (col = 0; col<cols; col++) { + i = row+col; + r = 255-(i*255/m); + g = (i*510/m); + b = (i*255/m); + if (g>255) g = 510-g; + printf "\033[48;2;%d;%d;%dm", r,g,b; + printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b; + printf "%s\033[0m", substr(s,(col+row)%2+1,1); + } + printf "\n"; + } + printf "\n\n"; +}' + +echo "# text decorations" +printf '\e[1mbold\e[22m\n' +printf '\e[2mdim\e[22m\n' +printf '\e[3mitalic\e[23m\n' +printf '\e[4munderline\e[24m\n' +printf '\e[4:1mthis is also underline\e[24m\n' +printf '\e[21mdouble underline\e[24m\n' +printf '\e[4:2mthis is also double underline\e[24m\n' +printf '\e[4:3mcurly underline\e[24m\n' +printf '\e[58;5;10;4mcolored underline\e[59;24m\n' +printf '\e[5mblink\e[25m\n' +printf '\e[7mreverse\e[27m\n' +printf '\e[8minvisible\e[28m <- invisible (but copy-pasteable)\n' +printf '\e[9mstrikethrough\e[29m\n' +printf '\e[53moverline\e[55m\n' +echo + +echo "# magic string (see https://en.wikipedia.org/wiki/Unicode#Web)" +echo "รฉ ฮ ะ ืง ู
เน ใ ๅถ ่ ๋ง" +echo + +echo "# emojis" +echo "๐๐ฑ๐ต" +echo + +echo "# right-to-left ('w' symbol should be at right side)" +echo "ืฉืจื" +echo + +echo "# sixel graphics" +printf '\eP0;0;0q"1;1;64;64#0;2;0;0;0#1;2;100;100;100#1~{wo_!11?@FN^!34~^NB +@?_ow{~$#0?BFN^!11~}wo_!34?_o{}~^NFB-#1!5~}{o_!12?BF^!25~^NB@??ow{!6~$#0!5? +@BN^!12~{w_!25?_o{}~~NFB-#1!10~}w_!12?@BN^!15~^NFB@?_w{}!10~$#0!10?@F^!12~} +{o_!15?_ow{}~^FB@-#1!14~}{o_!11?@BF^!7~^FB??_ow}!15~$#0!14?@BN^!11~}{w_!7?_ +w{~~^NF@-#1!18~}{wo!11?_r^FB@??ow}!20~$#0!18?@BFN!11~^K_w{}~~NF@-#1!23~M!4? +_oWMF@!6?BN^!21~$#0!23?p!4~^Nfpw}!6~{o_-#1!18~^NB@?_ow{}~wo!12?@BFN!17~$#0! +18?_o{}~^NFB@?FN!12~}{wo-#1!13~^NB@??_w{}!9~}{w_!12?BFN^!12~$#0!13?_o{}~~^F +B@!9?@BF^!12~{wo_-#1!8~^NFB@?_w{}!19~{wo_!11?@BN^!8~$#0!8?_ow{}~^FB@!19?BFN +^!11~}{o_-#1!4~^NB@?_ow{!28~}{o_!12?BF^!4~$#0!4?_o{}~^NFB!28?@BN^!12~{w_-#1 +NB@???GM!38NMG!13?@BN$#0?KMNNNF@!38?@F!13NMK-\e'\''' diff --git a/home/.local/bin/tokodi b/home/.local/bin/tokodi new file mode 100755 index 0000000..738d77b --- /dev/null +++ b/home/.local/bin/tokodi @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +if [ -z "$1" ]; then + url=$(xclip -o -selection clipboard) +elif [ "$1" = "-" ]; then + read -r url +else + url="$1" +fi + +payload="$(printf '{"jsonrpc":"2.0", "id": 1, "method":"Player.Open","params": {"item": {"file":"%s"}}}' "$url")" + +curl -u kodi:kodi 'http://xbox.pulpo:8080/jsonrpc' -X POST --data-raw "$payload" -H 'Content-Type: application/json' diff --git a/home/.local/bin/videowrapper b/home/.local/bin/videowrapper new file mode 100755 index 0000000..60dbeb3 --- /dev/null +++ b/home/.local/bin/videowrapper @@ -0,0 +1,7 @@ +#!/usr/bin/env sh +url="$(xclip -o -selection clipboard)" +log="$(mktemp)" +cmd="mpv -quiet $url 2>&1 > $log" + +echo "$cmd" +eval "$cmd" || notify-send "$url" "$(cat "$log")" diff --git a/home/.local/bin/wqr b/home/.local/bin/wqr new file mode 100755 index 0000000..09186ff --- /dev/null +++ b/home/.local/bin/wqr @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +if [ -z "$1" ]; then + text=$(xclip -o -selection clipboard) +elif [ "$1" = "-" ]; then + read -r text +else + text="$1" +fi + +printf '%s' "$text" | qrencode -t SVG -o - | feh - --conversion-timeout 1 |