diff options
author | Botond Hende <nettingman@gmail.com> | 2024-04-14 06:38:49 +0200 |
---|---|---|
committer | Botond Hende <nettingman@gmail.com> | 2024-04-14 06:38:49 +0200 |
commit | 0221492f62bcc1b766c2a4d5dbe26f6ff2ed8bc2 (patch) | |
tree | f91b7ada571a4dab7ae99c8f3ee252616baff2db /home/.selfconfigs |
squashed init
Diffstat (limited to 'home/.selfconfigs')
-rwxr-xr-x | home/.selfconfigs/git/git_pull_all | 16 | ||||
-rwxr-xr-x | home/.selfconfigs/imv/imv-ctl | 65 | ||||
-rwxr-xr-x | home/.selfconfigs/newsboat/open-nb-unread | 7 | ||||
-rwxr-xr-x | home/.selfconfigs/ssh/ssh_setup_display | 2 | ||||
-rwxr-xr-x | home/.selfconfigs/sway/capture_current_window | 3 | ||||
-rw-r--r-- | home/.selfconfigs/waybar/sshd_poll | 10 | ||||
-rw-r--r-- | home/.selfconfigs/zsh/additional.d/desktop | 1 | ||||
-rw-r--r-- | home/.selfconfigs/zsh/functions/cdl | 8 | ||||
-rw-r--r-- | home/.selfconfigs/zsh/functions/timer | 9 | ||||
-rw-r--r-- | home/.selfconfigs/zsh/functions/yt | 8 | ||||
-rw-r--r-- | home/.selfconfigs/zsh/functions/yta | 8 | ||||
-rw-r--r-- | home/.selfconfigs/zsh/motd | 33 |
12 files changed, 170 insertions, 0 deletions
diff --git a/home/.selfconfigs/git/git_pull_all b/home/.selfconfigs/git/git_pull_all new file mode 100755 index 0000000..9c8a606 --- /dev/null +++ b/home/.selfconfigs/git/git_pull_all @@ -0,0 +1,16 @@ +#!/usr/bin/bash -eu + +git_repos="$(find ~/git -mindepth 1 -maxdepth 1 -type l,d)" +echo "$git_repos" | while read line ; do + echo "<==================>" + echo "$line" + cd "$line" + git pull + if [[ -f "$line"/TODO ]]; then + echo + echo ">> TODO:" + cat "$line/TODO" + fi + echo "<==================>" + echo +done diff --git a/home/.selfconfigs/imv/imv-ctl b/home/.selfconfigs/imv/imv-ctl new file mode 100755 index 0000000..a55e5e8 --- /dev/null +++ b/home/.selfconfigs/imv/imv-ctl @@ -0,0 +1,65 @@ +#!/bin/bash -eu + +if [ $# == 0 ] || ! [[ "$1" =~ ^[0-9]+$ ]]; then + echo usage: imv-ctl [IMV PID] + exit +fi + +trap 'tput sgr0; tput cnorm; tput rmcup || clear; exit 0' SIGINT + +tput smcup; tput civis +tput clear + +cat << EOF +Current pid: $1 +---------------------- +Controls: +p - quit +left - previous image +right - next image +f - toggle fullscreen +i - zoom in +k - zoom out +l/j - increase/decrease zoom speed +w/a/s/d - pan +q/e - increase/decrease pan speed +u - reset zoom and pan speed +o - toggle scale modes + +current zoom speed: 1 +current pan speed: 10 +EOF + +escape_char=$(printf "\u1b") +zoom_speed=1 +pan_speed=10 +help_lenght=15 +while true; do + read -rsn1 mode # get 1 character + if [[ $mode == $escape_char ]]; then + read -rsn2 mode # read 2 more chars + fi + case $mode in + 'p') echo Quitting... ; tput sgr0; tput cnorm; tput rmcup || clear; exit 0 ;; + #'[A') echo UP ;; + #'[B') echo DN ;; + '[D') imv-msg "$1" p ;; + '[C') imv-msg "$1" n ;; + 'f') imv-msg "$1" fullscreen ;; + 'i') imv-msg "$1" zoom "$zoom_speed" ;; + 'k') imv-msg "$1" zoom "-$zoom_speed" ;; + 'l') zoom_speed=$((zoom_speed+1)) ; tput sc ; tput cup "$help_lenght" 20 ; echo "$zoom_speed " ; tput sc ;; + 'j') zoom_speed=$((zoom_speed-1)) ; if [ "$zoom_speed" -lt 0 ] ; then zoom_speed=0 ; fi ; tput sc ; tput cup "$help_lenght" 20 ; echo "$zoom_speed " ; tput sc ;; + 'd') imv-msg "$1" pan "$pan_speed" 0 ;; + 'a') imv-msg "$1" pan "-$pan_speed" 0 ;; + 's') imv-msg "$1" pan 0 "$pan_speed" ;; + 'w') imv-msg "$1" pan 0 "-$pan_speed" ;; + 'e') pan_speed=$((pan_speed+5)) ; tput sc ; tput cup $(($help_lenght+1)) 19 ; echo "$pan_speed " ; tput sc ;; + 'q') pan_speed=$((pan_speed-5)) ; if [ "$pan_speed" -lt 0 ] ; then pan_speed=0 ; fi ; tput sc ; tput cup $(($help_lenght+1)) 19 ; echo "$pan_speed " ; tput sc ;; + 'u') zoom_speed=1 ; pan_speed=10 ; tput sc ; tput cup "$help_lenght" 20 ; echo "$zoom_speed " ; tput sc ;; + 'o') imv-msg "$1" scaling next ;; + + + *) continue ;; + esac +done diff --git a/home/.selfconfigs/newsboat/open-nb-unread b/home/.selfconfigs/newsboat/open-nb-unread new file mode 100755 index 0000000..ff4809d --- /dev/null +++ b/home/.selfconfigs/newsboat/open-nb-unread @@ -0,0 +1,7 @@ +#!/bin/bash -eu + +newsboat -x reload +unread=$(newsboat -x print-unread) +if ! [[ "$unread" == 0* ]]; then + newsboat +fi diff --git a/home/.selfconfigs/ssh/ssh_setup_display b/home/.selfconfigs/ssh/ssh_setup_display new file mode 100755 index 0000000..f78e218 --- /dev/null +++ b/home/.selfconfigs/ssh/ssh_setup_display @@ -0,0 +1,2 @@ +export DISPLAY=:0 +export SWAYSOCK=$(ls /run/user/1000/sway-ipc.1000.*.sock) diff --git a/home/.selfconfigs/sway/capture_current_window b/home/.selfconfigs/sway/capture_current_window new file mode 100755 index 0000000..4a5d428 --- /dev/null +++ b/home/.selfconfigs/sway/capture_current_window @@ -0,0 +1,3 @@ +#!/usr/bin/bash -eu + +grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"')" ~/screenshot.png diff --git a/home/.selfconfigs/waybar/sshd_poll b/home/.selfconfigs/waybar/sshd_poll new file mode 100644 index 0000000..723af9e --- /dev/null +++ b/home/.selfconfigs/waybar/sshd_poll @@ -0,0 +1,10 @@ +#!/bin/bash -eu + +lines=$(who | grep pts | grep -Ev "\(:pts") +if [[ -z "$lines" ]]; then + printf '{"text":"No SSH connections", "tooltip":"No SSH connections", "class":"normal"}' +else + line_count=$(echo "$lines" | wc --lines) + lines="${lines/$'\n'/\\\\n}" + printf '{"text":"'"$line_count"' SSH connection(s)", "tooltip":"'"$lines"'", "class":"active"}' +fi diff --git a/home/.selfconfigs/zsh/additional.d/desktop b/home/.selfconfigs/zsh/additional.d/desktop new file mode 100644 index 0000000..f5b14de --- /dev/null +++ b/home/.selfconfigs/zsh/additional.d/desktop @@ -0,0 +1 @@ +alias ls='ls --color=auto -1' diff --git a/home/.selfconfigs/zsh/functions/cdl b/home/.selfconfigs/zsh/functions/cdl new file mode 100644 index 0000000..d11c086 --- /dev/null +++ b/home/.selfconfigs/zsh/functions/cdl @@ -0,0 +1,8 @@ +function cdl() +{ + if [ $# == 0 ] || [ ! -L $1 ]; then + echo usage: cdl \[LINK\] + else + cd $1(:A:h) + fi +} diff --git a/home/.selfconfigs/zsh/functions/timer b/home/.selfconfigs/zsh/functions/timer new file mode 100644 index 0000000..4978d4f --- /dev/null +++ b/home/.selfconfigs/zsh/functions/timer @@ -0,0 +1,9 @@ +function timer() +{ + if [ $# -lt 2 ]; then + echo usage: timer [SLEEP_TIME] [MESSAGE] + else + echo Timer set for $1: $2 + $(sleep $1; notify-send "$2") > /dev/null & disown + fi +} diff --git a/home/.selfconfigs/zsh/functions/yt b/home/.selfconfigs/zsh/functions/yt new file mode 100644 index 0000000..8d0ad2a --- /dev/null +++ b/home/.selfconfigs/zsh/functions/yt @@ -0,0 +1,8 @@ +function yt() +{ + if [ $# == 0 ]; then + echo usage: yt \[SEARCH TERM\] + else + mpv ytdl://ytsearch:"$*" + fi +} diff --git a/home/.selfconfigs/zsh/functions/yta b/home/.selfconfigs/zsh/functions/yta new file mode 100644 index 0000000..42cef33 --- /dev/null +++ b/home/.selfconfigs/zsh/functions/yta @@ -0,0 +1,8 @@ +function yta() +{ + if [ $# == 0 ]; then + echo usage: yta \[SEARCH TERM\] + else + mpv --ytdl-format=bestaudio ytdl://ytsearch:"$*" + fi +} diff --git a/home/.selfconfigs/zsh/motd b/home/.selfconfigs/zsh/motd new file mode 100644 index 0000000..7c61895 --- /dev/null +++ b/home/.selfconfigs/zsh/motd @@ -0,0 +1,33 @@ + [38;5;9m_,..wWWw--.[38;5;81m/+'.[39m [38;5;75m_[39m [38;5;81m,.[39m + [38;5;9m..wwWWWWWWWWW;[38;5;202mooo[38;5;221m;[38;5;81m++++.[39m [38;5;81m.[38;5;75mll'[39m [38;5;81m,.++;[39m + [38;5;9m`'"">wW[38;5;202m;oOOOOOO[38;5;221m;:[38;5;81m++[38;5;32m\[38;5;81m++.[39m [38;5;81m.[38;5;75mlll [38;5;81m.[38;5;75ml[38;5;81m"+++' ,..[39m + [38;5;9m,ww[38;5;202mOOOOOOOO[38;5;221m,,,[38;5;81m++++[38;5;32m\[38;5;81m+++[38;5;82m.[39m [38;5;75mlll'[38;5;81m,[38;5;75mll[38;5;81m'++; ,++;'[39m + [38;5;202m,oOOOOOOOO[38;5;221m,,,,[38;5;81m+++++[38;5;32m`'[38;5;81m++[38;5;82mll.[39m [38;5;81m;[38;5;75mlll ll[38;5;81m:+++' ;+++'[39m + [38;5;202m;OOOOOOOOO[38;5;221m,,,'[38;5;81m++++++++++[38;5;82mlll [38;5;81m;[38;5;75mlll ll[38;5;81m:++:'.+++'[39m + [38;5;202mOOOO;OOO"[38;5;221m,,"[38;5;240m/[38;5;221m;[38;5;81m++++[38;5;240m,[38;5;81m+[38;5;240m,[38;5;81m++++[38;5;82mll[38;5;32m`[38;5;81m:[38;5;75mllllll[38;5;81m++++'+++[39m + [38;5;202mOOOO;OO"[38;5;221m,,'[38;5;81m++[38;5;240m'[38;5;81m+++[38;5;240m;###;"-[38;5;81m++[38;5;82mll[38;5;32mX[38;5;75m llll[38;5;81m`;+++++++' ,.[39m [38;5;92m., _[39m + [38;5;202m;O;'oOOO[39m [38;5;221m,'[38;5;81m+++[38;5;240m\,-[38;5;161m:[39m [38;5;240m###[38;5;81m++++[38;5;82mll[38;5;32mX [38;5;81m:[38;5;75ml.;;[38;5;81m;,--++."-+++++[39m [38;5;92mw":---wWWWWWww-._[39m +[38;5;202m;' /O'"'"[38;5;81m++++++[38;5;240m'[39m [38;5;161m:;[38;5;15m";[38;5;240m#[38;5;161m'[38;5;81m+++[38;5;82mlll[38;5;32mXX[38;5;92m,[38;5;75mllll[38;5;81m;++.+++++++++[38;5;92mW,"WWWWWWWWww;""""'`[39m + [38;5;202m."[39m [38;5;81m`"+++++[38;5;240m'.[38;5;161m'"''`[38;5;81m;[38;5;82m'll;[38;5;32mxXX[38;5;92mw[38;5;75mllll[38;5;81m++;--.++++;[38;5;92mwWW[38;5;32m;xXXXXXXXXXx[38;5;92m"Ww.[39m + [38;5;81m.+++++++++++'[38;5;32m;xXXXXX;[38;5;92mW[38;5;75mll"[38;5;81m+-"++,'---"-[38;5;32m.x""`[38;5;82m"lllllll[38;5;32mxXXx[38;5;92mWWw.[39m + [38;5;81m"[38;5;32m---'[38;5;81m++++++-[38;5;32m;XXXXXX[38;5;92mwWW[38;5;75ml"[38;5;81m++++,"---++++[38;5;221m",,,,,,,,,,;[38;5;82mlll[38;5;32mXXXx[38;5;92mWW,[39m +[38;5;81m `'""""',+[38;5;32mxXXXXX;[38;5;92mwWW'[38;5;81m+++++++++;;;[38;5;9m";;;;;[38;5;202m;;;oOo[38;5;221m,,,,,[38;5;82mll[38;5;32mXXX;[38;5;92mWW`[39m + [38;5;81m,+[38;5;32mxXXXXX[38;5;92mwWW"[38;5;81m++.++++-[38;5;15m.;;[38;5;81m+++<[38;5;9m' `"WWWww[38;5;202m;Oo[38;5;221m,,,[38;5;82mll[38;5;32mXXX[38;5;92m"Ww[39m + [38;5;81m+[38;5;32mxXXX"[38;5;92mwwW"[38;5;81m+++++'"-[38;5;15m-'"' )[38;5;81m+++[39m [38;5;9m`WWW"Ww[38;5;202mOO[38;5;221m,,[38;5;82mlll[38;5;32mXXX[38;5;92mww[39m + [38;5;81m,x++++[38;5;92m;"[38;5;81m+++++++++++[38;5;15m`., ) )[38;5;81m+++[39m [38;5;9m)W; ,W[38;5;202mOO[38;5;221m,,[38;5;82mlll[38;5;32mX:"[38;5;92mWw[39m + [38;5;81m:++++++++++++++++++++[38;5;9mW[38;5;221m'"-[38;5;32m:[38;5;81m++++[39m [38;5;9m.W' WW[38;5;202mOO[38;5;221m,,[38;5;82mlll[38;5;32mX;[39m [38;5;92m`w[39m + [38;5;81m.++++++++++++++++.+++[38;5;9m"ww[39m [38;5;32m:[38;5;81m+++'[39m [38;5;9m," ,WW[38;5;202mOO[38;5;221m,,[38;5;82mlll[38;5;32mX;[39m [38;5;92m;[39m + [38;5;81m;[38;5;75mll--[38;5;81m.[38;5;75m-"[38;5;81m`.;++++++++++++++.+++;+[38;5;221m.[38;5;32m;[38;5;81m++([39m [38;5;9m:WW[38;5;202mOO[38;5;221m,,[38;5;82mlll[38;5;32mXx[39m + [38;5;81m,[38;5;75m'lllllllll[38;5;81m,++++;+++++++++;"++++++++++++-.[39m [38;5;9m:WW[38;5;202mOO[38;5;221m,,[38;5;82mlll[38;5;32mXx[39m + [38;5;81m;[38;5;75mllll[38;5;81m;;;[38;5;75m"'[38;5;81m;'++++;'"""'''`` [38;5;81m`[38;5;75mlll;;:[38;5;81m+++++++++.[39m [38;5;9mWW[38;5;202mOOO[38;5;221m,,[38;5;82mlll[38;5;32mX'[39m + [38;5;81m,[38;5;75mlllll[38;5;81m, ;+++++;[39m [38;5;81m`[38;5;75m"lllll.[38;5;81m++++++++[39m [38;5;9mWWw[38;5;202mO[38;5;221m,,,[38;5;82mll[38;5;32mX;[39m + [38;5;75mlllllll[38;5;81m, ,++++++;[39m [38;5;75mllllll[38;5;81m+++++++.[38;5;9m:WWw[38;5;202m'[38;5;221m,,[38;5;82mll[38;5;32mx[39m + [38;5;81m,[38;5;75mllllllll[38;5;81m, ;++++++;[39m [38;5;81m:[38;5;75mllllll[38;5;81m+++++++.[38;5;9m"WW[38;5;202m;[38;5;221m,,[38;5;82mll[38;5;32mx[39m + [38;5;81m;[38;5;75mlllllllll[38;5;81mV+++++++;[39m [38;5;81m:[38;5;75mlllllll[38;5;81m+++++++.[38;5;9m`w'[39m [38;5;221m`.[38;5;82ml[38;5;32mx.[39m + [38;5;81m`[38;5;75mlllllllll[38;5;81m'+++++++;[39m [38;5;81m:[38;5;75mlllllll[38;5;81m++++++++[39m [38;5;9m`\[39m [38;5;82m`[38;5;32m,X\[39m + [38;5;75m"llllll[38;5;81m;++++++++;[39m [38;5;81m;[38;5;75mllllll'[38;5;81m+++++++++[39m [38;5;9m`-[39m [38;5;32m\X;[39m + [38;5;75m"llll'[38;5;81m+++++++++;[39m [38;5;81m;[38;5;75mlllllll"[38;5;81m+++++++++[39m [38;5;32m`)[39m + [38;5;81m`[38;5;75m-'[38;5;81m`+++++++++;'[39m [38;5;81m,[38;5;75mllllllll[38;5;81m++++++++++[39m + [38;5;81m+++++++++++;[39m [38;5;81m,[38;5;75mllllllll'[38;5;81m++++++++++[39m + [38;5;81m'++++++++++"[39m [38;5;81m`[38;5;75m""""""""'[38;5;81m+++++++++"[39m +[m |