commit 14ef7bfab4b21a03c13aec1fbbfb560fdc953288 parent 944e8367452a18b53e87b27d92e5ee1e78f2fb99 Author: awy <awy@awy.one> Date: Sun, 21 Dec 2025 16:16:58 +0300 up Diffstat:
25 files changed, 209 insertions(+), 227 deletions(-)
diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup @@ -1,16 +1,14 @@ #!/bin/sh # Syncs repositories and downloads updates, meant to be run as a cronjob. -pkill -RTMIN+8 ".*blocks|waybar" -touch /tmp/pacupgrade && pkill -RTMIN+8 ".*blocks|waybar" -trap 'rm -f "/tmp/pacupgrade"' EXIT INT TERM +export STATUSBAR="i3blocks" doas pacman -Syyuw --noconfirm || notify-send "Error downloading updates. Check your internet connection, if pacman is already running, or run update manually to see errors." -pkill -RTMIN+8 ".*blocks|waybar" +pkill -RTMIN+8 "$STATUSBAR" if pacman -Qu | rg -v "\[ignored\]"; then notify-send "Repository Sync" "Updates available." - pkill -RTMIN+8 ".*blocks|waybar" + pkill -RTMIN+8 "$STATUSBAR" fi diff --git a/.local/bin/cron/mailup b/.local/bin/cron/mailup @@ -1,9 +1,12 @@ #!/bin/sh +# Set as a cron job to check for new mail. + +export STATUSBAR="i3blocks" pgrep -f mailsync && exit echo 🔃 >/tmp/mailupdate -pkill -RTMIN+12 ".*blocks|waybar" +pkill -RTMIN+12 "$STATUSBAR" /usr/bin/mailsync rm -f /tmp/mailupdate -pkill -RTMIN+12 ".*blocks|waybar" +pkill -RTMIN+12 "$STATUSBAR" diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup @@ -2,13 +2,14 @@ # Set as a cron job to check for new RSS entries for newsraft. # If newsraft is open, sends it an "R" key to refresh. +export STATUSBAR="i3blocks" export XDG_RUNTIME_DIR=/run/user/1000 export WAYLAND_DISPLAY=wayland-1 pgrep -f newsraft$ && /usr/bin/wlrctl window focus title:newsraft && /usr/bin/wlrctl keyboard type R && exit echo "🔃" >/tmp/newsupdate -pkill -RTMIN+6 ".*blocks|waybar" +pkill -RTMIN+6 "$STATUSBAR" /usr/bin/newsraft -e reload-all rm -f /tmp/newsupdate -pkill -RTMIN+6 ".*blocks|waybar" +pkill -RTMIN+6 "$STATUSBAR" diff --git a/.local/bin/dmenumountcifs b/.local/bin/dmenumountcifs @@ -1,20 +0,0 @@ -#!/bin/sh -# Gives a mew prompt to mount unmounted local NAS shares for read/write. -# Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL" -# -# Browse for mDNS/DNS-SD services using the Avahi daemon... -srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | mew -i -p "Which NAS?") || exit 1 -notify-send "Searching for network shares..." "Please wait..." -# Choose share disk... -share=$(smbclient -L "$srvname" -N | rg Disk | awk '{print $1}' | mew -i -p "Mount which share?") || exit 1 -# Format URL... -share2mnt=//"$srvname".local/"$share" - -sharemount() { - mounted=$(mount -v | rg "$share2mnt") || ([ ! -d /mnt/"$share" ] && doas mkdir /mnt/"$share") - [ -z "$mounted" ] && doas mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0 - notify-send "Netshare $share already mounted" - exit 1 -} - -sharemount diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord @@ -1,146 +0,0 @@ -#!/bin/sh - -# Usage: -# `$0`: Ask for recording type via mew -# `$0 screencast`: Record both audio and screen -# `$0 video`: Record only screen -# `$0 audio`: Record only audio -# `$0 kill`: Kill existing recording -# -# If there is already a running instance, user will be prompted to end it. - -getdim() { - gpu-screen-recorder --list-capture-options | sed 's/|[0-9]\{1,\}x[0-9]\{1,\}//g' | - mew -c -l 10 -p "Select output: " -} - -updateicon() { - echo "$1" >/tmp/recordingicon - pkill -RTMIN+9 ".*blocks|waybar" -} - -killrecording() { - recpid="$(bat /tmp/recordingpid)" - echo "$recpid" - kill -2 "$recpid" - rm -f /tmp/recordingpid - updateicon "" - pkill -RTMIN+9 ".*blocks|waybar" -} - -screencast() { - gpu-screen-recorder \ - -w "$(getdim)" \ - -fm content \ - -f 60 \ - -a default_output \ - -a default_input \ - -o "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! >/tmp/recordingpid - updateicon "📹🎙️" -} - -video() { - gpu-screen-recorder \ - -w "$(getdim)" \ - -fm content \ - -f 60 \ - -o "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! >/tmp/recordingpid - updateicon "📹" -} - -webcamhidef() { - ffmpeg \ - -f v4l2 \ - -i /dev/video0 \ - -video_size 1920x1080 \ - "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! >/tmp/recordingpid - updateicon "📷(hq)" -} - -webcam() { - ffmpeg \ - -f v4l2 \ - -i /dev/video0 \ - -video_size 640x480 \ - "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! >/tmp/recordingpid - updateicon "📷" -} - -audio() { - ffmpeg \ - -f alsa -i default \ - -c:a flac \ - "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & - echo $! >/tmp/recordingpid - updateicon "🎙️" -} - -replay() { - gpu-screen-recorder \ - -w "$(getdim)" \ - -fm content \ - -f 60 \ - -r 60 \ - -c mkv \ - -a default_output \ - -a default_input \ - -o "/mnt/ssd/rndm/clips/replays" & - echo $! >/tmp/recordingpid - updateicon "🔃📹🎙️" -} - -savereplay() { - recpid="$(bat /tmp/recordingpid)" - echo $recpid - kill -37 "$recpid" - pkill -RTMIN+9 ".*blocks|waybar" - notify-send "Replay" "Last 60 seconds saved" - exit -} - -videoselected() { - gpu-screen-recorder \ - -w region -region "$(slurp -f "%wx%h+%x+%y")" \ - -fm content \ - -f 60 \ - -o "$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" & - echo $! >/tmp/recordingpid - updateicon "📹(selected)" -} - -askrecording() { - choice=$(printf "screencast\\nreplay\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | mew -c -l 7 -i -p "Select recording style:") - case "$choice" in - screencast) screencast ;; - replay) replay ;; - audio) audio ;; - video) video ;; - *selected) videoselected ;; - webcam) webcam ;; - "webcam (hi-def)") webcamhidef ;; - esac -} - -asktoend() { - if grep -q "🔃" /tmp/recordingicon; then - response=$(printf "No\\nYes" | mew -c -l 2 -i -p "Replay is active. Save it?") && - [ "$response" = "Yes" ] && savereplay - fi - - response=$(printf "No\\nYes" | mew -c -l 2 -i -p "Recording still active. End recording?") && - [ "$response" = "Yes" ] && killrecording -} - -case "$1" in -screencast) screencast ;; -replay) replay ;; -audio) audio ;; -video) video ;; -*selected) videoselected ;; -kill) killrecording ;; -*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording ;; -esac diff --git a/.local/bin/bookmarks b/.local/bin/menu/bookmarks diff --git a/.local/bin/chooseprofile b/.local/bin/menu/chooseprofile diff --git a/.local/bin/dmenuhandler b/.local/bin/menu/dmenuhandler diff --git a/.local/bin/dmenupass b/.local/bin/menu/dmenupass diff --git a/.local/bin/menu/dmenurecord b/.local/bin/menu/dmenurecord @@ -0,0 +1,146 @@ +#!/bin/sh + +# Usage: +# `$0`: Ask for recording type via mew +# `$0 screencast`: Record both audio and screen +# `$0 video`: Record only screen +# `$0 audio`: Record only audio +# `$0 kill`: Kill existing recording +# +# If there is already a running instance, user will be prompted to end it. + +getdim() { + gpu-screen-recorder --list-capture-options | sed 's/|[0-9]\{1,\}x[0-9]\{1,\}//g' | + mew -c -l 10 -p "Select output: " +} + +updateicon() { + echo "$1" >/tmp/recordingicon + pkill -RTMIN+9 "$STATUSBAR" +} + +killrecording() { + recpid="$(bat /tmp/recordingpid)" + echo "$recpid" + kill -2 "$recpid" + rm -f /tmp/recordingpid + updateicon "" + pkill -RTMIN+9 "$STATUSBAR" +} + +screencast() { + gpu-screen-recorder \ + -w "$(getdim)" \ + -fm content \ + -f 60 \ + -a default_output \ + -a default_input \ + -o "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! >/tmp/recordingpid + updateicon "📹🎙️" +} + +video() { + gpu-screen-recorder \ + -w "$(getdim)" \ + -fm content \ + -f 60 \ + -o "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! >/tmp/recordingpid + updateicon "📹" +} + +webcamhidef() { + ffmpeg \ + -f v4l2 \ + -i /dev/video0 \ + -video_size 1920x1080 \ + "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! >/tmp/recordingpid + updateicon "📷(hq)" +} + +webcam() { + ffmpeg \ + -f v4l2 \ + -i /dev/video0 \ + -video_size 640x480 \ + "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! >/tmp/recordingpid + updateicon "📷" +} + +audio() { + ffmpeg \ + -f alsa -i default \ + -c:a flac \ + "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & + echo $! >/tmp/recordingpid + updateicon "🎙️" +} + +replay() { + gpu-screen-recorder \ + -w "$(getdim)" \ + -fm content \ + -f 60 \ + -r 60 \ + -c mkv \ + -a default_output \ + -a default_input \ + -o "/mnt/ssd/rndm/clips/replays" & + echo $! >/tmp/recordingpid + updateicon "🔃📹🎙️" +} + +savereplay() { + recpid="$(bat /tmp/recordingpid)" + echo $recpid + kill -37 "$recpid" + pkill -RTMIN+9 "$STATUSBAR" + notify-send "Replay" "Last 60 seconds saved" + exit +} + +videoselected() { + gpu-screen-recorder \ + -w region -region "$(slurp -f "%wx%h+%x+%y")" \ + -fm content \ + -f 60 \ + -o "$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! >/tmp/recordingpid + updateicon "📹(selected)" +} + +askrecording() { + choice=$(printf "screencast\\nreplay\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | mew -c -l 7 -i -p "Select recording style:") + case "$choice" in + screencast) screencast ;; + replay) replay ;; + audio) audio ;; + video) video ;; + *selected) videoselected ;; + webcam) webcam ;; + "webcam (hi-def)") webcamhidef ;; + esac +} + +asktoend() { + if grep -q "🔃" /tmp/recordingicon; then + response=$(printf "No\\nYes" | mew -c -l 2 -i -p "Replay is active. Save it?") && + [ "$response" = "Yes" ] && savereplay + fi + + response=$(printf "No\\nYes" | mew -c -l 2 -i -p "Recording still active. End recording?") && + [ "$response" = "Yes" ] && killrecording +} + +case "$1" in +screencast) screencast ;; +replay) replay ;; +audio) audio ;; +video) video ;; +*selected) videoselected ;; +kill) killrecording ;; +*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording ;; +esac diff --git a/.local/bin/doas_askpass b/.local/bin/menu/doas_askpass diff --git a/.local/bin/maimpick b/.local/bin/menu/maimpick diff --git a/.local/bin/mounter b/.local/bin/menu/mounter diff --git a/.local/bin/notes b/.local/bin/menu/notes diff --git a/.local/bin/rssget b/.local/bin/menu/rssget diff --git a/.local/bin/singboxwrap b/.local/bin/menu/singboxwrap diff --git a/.local/bin/menu/sysact b/.local/bin/menu/sysact @@ -0,0 +1,36 @@ +#!/bin/sh + +# A mew wrapper script for system functions. +export WM="sway" +case "$(readlink -f /sbin/init)" in +*systemd*) ctl='systemctl' ;; +*) ctl='loginctl' ;; +esac + +wmpid() { # This function is needed if there are multiple instances of the window manager. + tree="$(pstree -ps $$)" + tree="${tree#*"$WM"(}" + echo "${tree%%)*}" +} + +lock() { + mpc pause + pauseallmpv + wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + kill -44 "$(pidof "$STATUSBAR")" + swaylock + wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + kill -44 "$(pidof "$STATUSBAR")" +} + +case "$(printf "lock\nleave %s\nrenew %s\nhibernate\nreboot\nshutdown\nsleep\ndisplay off" "$WM" "$WM" | mew -c -l 8 -i -p 'Action: ')" in +'lock') lock ;; +"leave $WM") swaymsg exit ;; +"renew $WM") swaymsg reload ;; +'hibernate') $ctl hibernate -i ;; +'sleep') $ctl suspend -i ;; +'reboot') $ctl reboot -i ;; +'shutdown') $ctl poweroff -i ;; +'display off') xset dpms force off ;; +*) exit 1 ;; +esac diff --git a/.local/bin/menu/td-toggle b/.local/bin/menu/td-toggle @@ -0,0 +1,11 @@ +#!/bin/sh + +# If transmission-daemon is running, will ask to kill, else will ask to start. + +if pidof transmission-daemon >/dev/null; then + [ "$(printf "No\\nYes" | mew -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-daemon && notify-send "transmission-daemon disabled." +else + ifinstalled transmission-cli || exit + [ "$(printf "No\\nYes" | mew -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "transmission-daemon enabled." +fi +sleep 3 && pkill -RTMIN+7 "$STATUSBAR" diff --git a/.local/bin/unmounter b/.local/bin/menu/unmounter diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone @@ -3,7 +3,7 @@ case $BLOCK_BUTTON in 1) setsid -w -f "$TERMINAL" -e pulsemixer - pkill -RTMIN+23 "${STATUSBAR:-i3blocks}" + pkill -RTMIN+23 "$STATUSBAR" ;; 2) wpctl set-mute @DEFAULT_SOURCE@ toggle ;; 4) wpctl set-volume @DEFAULT_SOURCE@ 1%+ ;; @@ -20,7 +20,7 @@ vol="${vol#Volume: }" split() { # For ommiting the . without calling and external program. IFS=$2 - set -- $1 + set -- "$1" printf '%s' "$@" } diff --git a/.local/bin/statusbar/sb-popupgrade b/.local/bin/statusbar/sb-popupgrade @@ -3,7 +3,7 @@ printf "Beginning upgrade.\\n" paru -pkill -RTMIN+8 "${STATUSBAR:-i3blocks}" +pkill -RTMIN+8 "$STATUSBAR" printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n" read -r _ diff --git a/.local/bin/sysact b/.local/bin/sysact @@ -1,36 +0,0 @@ -#!/bin/sh - -# A mew wrapper script for system functions. -export WM="sway" -case "$(readlink -f /sbin/init)" in -*systemd*) ctl='systemctl' ;; -*) ctl='loginctl' ;; -esac - -wmpid() { # This function is needed if there are multiple instances of the window manager. - tree="$(pstree -ps $$)" - tree="${tree#*$WM(}" - echo "${tree%%)*}" -} - -lock() { - mpc pause - pauseallmpv - wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle - kill -44 $(pidof i3blocks) - swaylock - wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle - kill -44 $(pidof i3blocks) -} - -case "$(printf "lock\nleave $WM\nrenew $WM\nhibernate\nreboot\nshutdown\nsleep\ndisplay off" | mew -c -l 8 -i -p 'Action: ')" in -'lock') lock ;; -"leave $WM") swaymsg exit ;; -"renew $WM") swaymsg reload ;; -'hibernate') $ctl hibernate -i ;; -'sleep') $ctl suspend -i ;; -'reboot') $ctl reboot -i ;; -'shutdown') $ctl poweroff -i;; -'display off') xset dpms force off ;; -*) exit 1 ;; -esac diff --git a/.local/bin/td-toggle b/.local/bin/td-toggle @@ -1,11 +0,0 @@ -#!/bin/sh - -# If transmission-daemon is running, will ask to kill, else will ask to start. - -if pidof transmission-daemon >/dev/null; then - [ "$(printf "No\\nYes" | mew -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-daemon && notify-send "transmission-daemon disabled." -else - ifinstalled transmission-cli || exit - [ "$(printf "No\\nYes" | mew -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "transmission-daemon enabled." -fi -sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-i3blocks}" diff --git a/.local/bin/torwrap b/.local/bin/torwrap @@ -5,4 +5,4 @@ ifinstalled stig transmission-cli || exit 1 ! pidof transmission-daemon >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." $TERMINAL -e stig -pkill -RTMIN+7 "${STATUSBAR:-i3blocks}" +pkill -RTMIN+7 "$STATUSBAR" diff --git a/.local/bin/transadd b/.local/bin/transadd @@ -4,6 +4,6 @@ # transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. -pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-i3blocks}") +pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "$STATUSBAR") transmission-remote -a "$@" && notify-send "🔽 Torrent added."