summaryrefslogtreecommitdiff
path: root/home/.selfconfigs
diff options
context:
space:
mode:
Diffstat (limited to 'home/.selfconfigs')
-rwxr-xr-xhome/.selfconfigs/git/git_pull_all16
-rwxr-xr-xhome/.selfconfigs/imv/imv-ctl65
-rwxr-xr-xhome/.selfconfigs/newsboat/open-nb-unread7
-rwxr-xr-xhome/.selfconfigs/ssh/ssh_setup_display2
-rwxr-xr-xhome/.selfconfigs/sway/capture_current_window3
-rw-r--r--home/.selfconfigs/waybar/sshd_poll10
-rw-r--r--home/.selfconfigs/zsh/additional.d/desktop1
-rw-r--r--home/.selfconfigs/zsh/functions/cdl8
-rw-r--r--home/.selfconfigs/zsh/functions/timer9
-rw-r--r--home/.selfconfigs/zsh/functions/yt8
-rw-r--r--home/.selfconfigs/zsh/functions/yta8
-rw-r--r--home/.selfconfigs/zsh/motd33
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 @@
+ _,..wWWw--./+'. _ ,.
+ ..wwWWWWWWWWW;ooo;++++. .ll' ,.++;
+ `'"">wW;oOOOOOO;:++\++. .lll .l"+++' ,..
+ ,wwOOOOOOOO,,,++++\+++. lll',ll'++; ,++;'
+ ,oOOOOOOOO,,,,+++++`'++ll. ;lll ll:+++' ;+++'
+ ;OOOOOOOOO,,,'++++++++++lll ;lll ll:++:'.+++'
+ OOOO;OOO",,"/;++++,+,++++ll`:llllll++++'+++
+ OOOO;OO",,'++'+++;###;"-++llX llll`;+++++++' ,. ., _
+ ;O;'oOOO ,'+++\,-: ###++++llX :l.;;;,--++."-+++++ w":---wWWWWWww-._
+;' /O'"'"++++++' :;";#'+++lllXX,llll;++.+++++++++W,"WWWWWWWWww;""""'`
+ ." `"+++++'.'"''`;'ll;xXXwllll++;--.++++;wWW;xXXXXXXXXXx"Ww.
+ .+++++++++++';xXXXXX;Wll"+-"++,'---"-.x""`"lllllllxXXxWWw.
+ "---'++++++-;XXXXXXwWWl"++++,"---++++",,,,,,,,,,;lllXXXxWW,
+ `'""""',+xXXXXX;wWW'+++++++++;;;";;;;;;;;oOo,,,,,llXXX;WW`
+ ,+xXXXXXwWW"++.++++-.;;+++<' `"WWWww;Oo,,,llXXX"Ww
+ +xXXX"wwW"+++++'"--'"' )+++ `WWW"WwOO,,lllXXXww
+ ,x++++;"+++++++++++`., ) )+++ )W; ,WOO,,lllX:"Ww
+ :++++++++++++++++++++W'"-:++++ .W' WWOO,,lllX; `w
+ .++++++++++++++++.+++"ww :+++' ," ,WWOO,,lllX; ;
+ ;ll--.-"`.;++++++++++++++.+++;+.;++( :WWOO,,lllXx
+ ,'lllllllll,++++;+++++++++;"++++++++++++-. :WWOO,,lllXx
+ ;llll;;;"';'++++;'"""'''`` `lll;;:+++++++++. WWOOO,,lllX'
+ ,lllll, ;+++++; `"lllll.++++++++ WWwO,,,llX;
+ lllllll, ,++++++; llllll+++++++.:WWw',,llx
+ ,llllllll, ;++++++; :llllll+++++++."WW;,,llx
+ ;lllllllllV+++++++; :lllllll+++++++.`w' `.lx.
+ `lllllllll'+++++++; :lllllll++++++++ `\ `,X\
+ "llllll;++++++++; ;llllll'+++++++++ `- \X;
+ "llll'+++++++++; ;lllllll"+++++++++ `)
+ `-'`+++++++++;' ,llllllll++++++++++
+ +++++++++++; ,llllllll'++++++++++
+ '++++++++++" `""""""""'+++++++++"
+