diff options
Diffstat (limited to 'ar/.local')
44 files changed, 212 insertions, 105 deletions
diff --git a/ar/.local/bin/cron/checkup b/ar/.local/bin/cron/checkup index 801d406..2ea6772 100755 --- a/ar/.local/bin/cron/checkup +++ b/ar/.local/bin/cron/checkup @@ -7,7 +7,7 @@ notify-send "π¦ Repository Sync" "Checking for package updates..." sudo 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+16 "${STATUSBAR:-dwmblocks}" +pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}" if pacman -Qu | grep -v "\[ignored\]"; then notify-send "π Repository Sync" "Updates available. Click statusbar icon (π¦) or run sb-popupgrade in terminal for update." diff --git a/ar/.local/bin/cron/crontog b/ar/.local/bin/cron/crontog index 70e7cf1..ccabe61 100755 --- a/ar/.local/bin/cron/crontog +++ b/ar/.local/bin/cron/crontog @@ -23,4 +23,4 @@ else fi # Notify status bar to update -pkill -RTMIN+3 "${STATUSBAR:-dwmblocks}" +pkill -RTMIN+2 "${STATUSBAR:-dwmblocks}" diff --git a/ar/.local/bin/cron/newsup b/ar/.local/bin/cron/newsup index 346ec75..f8b40b7 100755 --- a/ar/.local/bin/cron/newsup +++ b/ar/.local/bin/cron/newsup @@ -8,8 +8,8 @@ pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit echo π >/tmp/newsupdate -pkill -RTMIN+19 "${STATUSBAR:-dwmblocks}" +pkill -RTMIN+17 "${STATUSBAR:-dwmblocks}" /usr/bin/newsboat -x reload rm -f /tmp/newsupdate -pkill -RTMIN+19 "${STATUSBAR:-dwmblocks}" +pkill -RTMIN+17 "${STATUSBAR:-dwmblocks}" /usr/bin/notify-send "π° RSS feed update complete." diff --git a/ar/.local/bin/dmenurecord b/ar/.local/bin/dmenurecord index 621133d..a497aa4 100755 --- a/ar/.local/bin/dmenurecord +++ b/ar/.local/bin/dmenurecord @@ -17,7 +17,7 @@ getdim() { xrandr | grep -oP '(?<=current ).*(?=,)' | tr -d ' '; } updateicon() { echo "$1" >/tmp/recordingicon - pkill -RTMIN+24 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+22 "${STATUSBAR:-dwmblocks}" } killrecording() { @@ -25,7 +25,7 @@ killrecording() { kill -15 "$recpid" rm -f /tmp/recordingpid updateicon "" - pkill -RTMIN+24 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+22 "${STATUSBAR:-dwmblocks}" } getmonitor() { diff --git a/ar/.local/bin/dmenuupgrade b/ar/.local/bin/dmenuupgrade index b43ff4c..b23e80a 100755 --- a/ar/.local/bin/dmenuupgrade +++ b/ar/.local/bin/dmenuupgrade @@ -16,7 +16,7 @@ case "$selection" in if [ "$(printf "No\nYes" | dmenu -i -p 'Proceed with upgrade for all packages?')" = "Yes" ]; then notify-send "π¦ Upgrading all packages..." yay -Syu --noconfirm - pkill -RTMIN+16 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}" notify-send "β
Upgrade of all packages completed." else notify-send "β Upgrade cancelled." @@ -31,7 +31,7 @@ case "$selection" in if [ "$(printf "No\nYes" | dmenu -i -p 'Proceed with pacman upgrade?')" = "Yes" ]; then notify-send "π¦ Upgrading pacman packages..." printf "%s" "$pacman_updates" | awk '{print $1}' | xargs sudo pacman -S --noconfirm - pkill -RTMIN+16 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}" notify-send "β
Pacman packages upgrade completed." else notify-send "β Upgrade cancelled." @@ -46,7 +46,7 @@ case "$selection" in if [ "$(printf "No\nYes" | dmenu -i -p 'Proceed with upgrade for this package?')" = "Yes" ]; then notify-send "π¦ Upgrading package: $selection..." sudo pacman -S --noconfirm "$(printf "%s" "$selection" | awk '{print $1}')" - pkill -RTMIN+16 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}" notify-send "β
Upgrade completed for package: $selection." else notify-send "β Upgrade cancelled." @@ -73,7 +73,7 @@ case "$selection" in if [ "$(printf "No\nYes" | dmenu -i -p 'Proceed with AUR upgrade?')" = "Yes" ]; then notify-send "π¦ Upgrading AUR packages..." yay -Syu --aur --noconfirm - pkill -RTMIN+16 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}" notify-send "β
AUR packages upgrade completed." else notify-send "β Upgrade cancelled." @@ -88,7 +88,7 @@ case "$selection" in if [ "$(printf "No\nYes" | dmenu -i -p 'Proceed with upgrade for this package?')" = "Yes" ]; then notify-send "π¦ Upgrading AUR package: $selection..." yay -S --noconfirm "$(printf "%s" "$selection" | awk '{print $2}')" - pkill -RTMIN+16 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}" notify-send "β
Upgrade completed for AUR package: $selection." else notify-send "β Upgrade cancelled." diff --git a/ar/.local/bin/ecrypt b/ar/.local/bin/ecrypt index e13c033..4240c71 100755 --- a/ar/.local/bin/ecrypt +++ b/ar/.local/bin/ecrypt @@ -27,6 +27,9 @@ attempt_mount() { targets="$HOME/.secret" mounts="$HOME/Private" pw="default" +[ -d "$targets" ] || mkdir -p "$targets" +[ -d "$mounts" ] || mkdir -p "$mounts" + set -- $mounts # Set positional parameters to mounts i=1 for target in $targets; do diff --git a/ar/.local/bin/ethwifi b/ar/.local/bin/ethwifi index 26366e9..c4fa0c6 100755 --- a/ar/.local/bin/ethwifi +++ b/ar/.local/bin/ethwifi @@ -28,4 +28,4 @@ else fi # Refresh status bar -pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}" +pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" diff --git a/ar/.local/bin/extractkeys b/ar/.local/bin/extractkeys index b45358d..4e4e5b4 100755 --- a/ar/.local/bin/extractkeys +++ b/ar/.local/bin/extractkeys @@ -125,6 +125,7 @@ for file_path in "${config_files[@]}"; do s/&layouts\[12\]/"|M|"/g; s/&layouts\[13\]/">M>"/g; s/^\s*//g; + s/pkexec //g; /^\s*0\s*$/d ') diff --git a/ar/.local/bin/fzffiles b/ar/.local/bin/fzffiles index 97047e9..9f5cd90 100755 --- a/ar/.local/bin/fzffiles +++ b/ar/.local/bin/fzffiles @@ -35,7 +35,7 @@ files=$(fzf-tmux \ fi fi if [ -d \"\$target\" ]; then - exa --color=always --long --all --header --icons --git \"\$target\" + eza --color=always --long --all --header --icons --git \"\$target\" elif [ -f \"\$target\" ]; then bat --color=always --style=header,grid --line-range=:500 \"\$target\" else diff --git a/ar/.local/bin/gitupdate b/ar/.local/bin/gitupdate index 6ee163a..87c13c3 100755 --- a/ar/.local/bin/gitupdate +++ b/ar/.local/bin/gitupdate @@ -87,4 +87,4 @@ printf "\n[repo] %s(%s): %s\n" "$(basename "$repo_root")" "$branch" "$message" # Return to the original directory cd - >/dev/null -command -v dwmblocks >/dev/null 2>&1 && pkill -RTMIN+18 "${STATUSBAR:-dwmblocks}" +command -v dwmblocks >/dev/null 2>&1 && pkill -RTMIN+16 "${STATUSBAR:-dwmblocks}" diff --git a/ar/.local/bin/hugow b/ar/.local/bin/hugow index 0460174..13cdf51 100755 --- a/ar/.local/bin/hugow +++ b/ar/.local/bin/hugow @@ -2,11 +2,11 @@ set -eu repodir="$HOME/Private/repos/THESIAH" -out="$repodir/public/recordings/index.html" +out="$repodir/public/diary/index.html" server="${THESIAH_SERVER:-root@thesiah.xyz}" -dest="/var/www/thesiah/recordings/" +dest="/var/www/thesiah/diary/" defaults="sy after foramonth" -src="$repodir/public/recordings/" +src="$repodir/public/diary/" cd "$repodir" hugo --cleanDestinationDir @@ -16,35 +16,35 @@ if [ ! -f "$out" ]; then exit 1 fi -tmp="$(mktemp "$out.XXXXXXXX.tmp")" - -awk -v defaults="$defaults" ' -BEGIN { - n = split(defaults, a, /[[:space:]]+/) - insert = "" - for (i = 1; i <= n; i++) { - if (a[i] == "") continue - name = a[i] ".mp4" - insert = insert \ -" <li>\n" \ -" <a href=\"/recordings/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \ -" </li>\n" - } - injected = 0 -} -{ - print - if (!injected && $0 ~ /<ul[^>]*id=["'\''"]list["'\''"][^>]*>/) { - printf("%s", insert) - injected = 1 - } -} -END { if (!injected) exit 2 } -' "$out" >"$tmp" - -mv "$tmp" "$out" -echo "Injected defaults into: $out" +# tmp="$(mktemp "$out.XXXXXXXX.tmp")" +# awk -v defaults="$defaults" ' +# BEGIN { +# n = split(defaults, a, /[[:space:]]+/) +# insert = "" +# for (i = 1; i <= n; i++) { +# if (a[i] == "") continue +# name = a[i] ".mp4" +# insert = insert \ +# " <li>\n" \ +# " <a href=\"/diary/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \ +# " </li>\n" +# } +# injected = 0 +# } +# { +# print +# if (!injected && $0 ~ /<ul[^>]*id=["'\''"]list["'\''"][^>]*>/) { +# printf("%s", insert) +# injected = 1 +# } +# } +# END { if (!injected) exit 2 } +# ' "$out" >"$tmp" +# +# mv "$tmp" "$out" +# echo "Injected defaults into: $out" +# ssh "$server" "mkdir -p '$dest'" if [ -n "${THESIAH_SSH_OPTS:-}" ]; then @@ -57,7 +57,7 @@ else fi if [ -n "${1-}" ]; then - new="$repodir/content/recordings/$1" + new="$repodir/content/diary/$1" if [ -f "$new" ]; then rsync -az --update "$new" "$server:$dest" elif [ -d "$new" ]; then diff --git a/ar/.local/bin/monitorbright b/ar/.local/bin/monitorbright index 2de2e5d..db2bcf3 100755 --- a/ar/.local/bin/monitorbright +++ b/ar/.local/bin/monitorbright @@ -15,10 +15,6 @@ case "$monitor" in esac new_brightness=$(echo "if ($new_brightness > 1) 1 else if ($new_brightness < 0) 0 else $new_brightness" | bc -l) xrandr --output "$monitor" --brightness "$new_brightness" - current_brightness=$(echo "$new_brightness * 100" | bc -l) - else - current_brightness=$(echo "$current_brightness * 100" | bc -l) fi - printf "πͺ%.0f%%\n" "$current_brightness" ;; esac diff --git a/ar/.local/bin/mounter b/ar/.local/bin/mounter index a9d7a61..c8eabbf 100755 --- a/ar/.local/bin/mounter +++ b/ar/.local/bin/mounter @@ -81,7 +81,7 @@ unopenedluks="$(for drive in $allluks; do done | filter)" # Get all normal, non-encrypted or decrypted partitions that are not mounted. -normalparts="$(echo "$lsblkoutput" | grep -v crypto_LUKS | grep -v 'part 1M' | grep 'part\|rom\|crypt' | sed "s/^/πΎ /" | filter)" +normalparts="$(echo "$lsblkoutput" | grep -v crypto_LUKS | grep -v 'LVM2_member' | grep -v 'part 1M' | grep 'part\|rom\|crypt' | sed "s/^/πΎ /" | filter)" # Get all available IP addresses with open Samba shares in the wlan0 subnet, excluding eth0 IP smbips="$(sudo arp-scan --interface=eth0 --interface=wlan0 --localnet | grep -vEi '(EFM Networks|DUP:)' | awk '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/{print $1}')" diff --git a/ar/.local/bin/opensessions b/ar/.local/bin/opensessions index 6f9f236..d16f42f 100755 --- a/ar/.local/bin/opensessions +++ b/ar/.local/bin/opensessions @@ -18,7 +18,10 @@ set -- $dirs for dir in $dirs; do if [ -d "$dir" ]; then session_name=$(get_session_name "$dir") - if ! tmux has-session -t "$session_name" 2>/dev/null; then + if tmux has-session -t "$session_name" 2>/dev/null; then + session_path=$(tmux display-message -t "$session_name" -p '#{session_path}') + tmux send-keys -t "$session_name" "cd \"$session_path\"" C-m + else tmux new-session -d -s "$session_name" -c "$dir" if git -C "$dir" rev-parse --is-inside-work-tree >/dev/null 2>&1 && [ -n "$(git -C "$dir" status --porcelain)" ]; then tmux send-keys -t "$session_name" "git status --porcelain" C-m diff --git a/ar/.local/bin/ovpn b/ar/.local/bin/ovpn index a89c357..10ecc01 100755 --- a/ar/.local/bin/ovpn +++ b/ar/.local/bin/ovpn @@ -7,7 +7,6 @@ turnonoffvpn() { ;; *off*) nmcli connection down "$THESIAH_VPN" 2>/dev/null && notify-send "βοΈ THESIAH_VPN: OFF" || notify-send "βοΈ Error to disconnect" - ;; esac } diff --git a/ar/.local/bin/qndl b/ar/.local/bin/qndl index 46b4aa8..2757eb8 100755 --- a/ar/.local/bin/qndl +++ b/ar/.local/bin/qndl @@ -47,7 +47,7 @@ case $type in video_id=$(echo "$line" | awk '{print $2}') ytdl_cmd="$ytdl_cmd_base --output \"$ytdl_output_format\" \"https://www.youtube.com/watch?v=$video_id\"" idnum=$(tsp bash -c "$ytdl_cmd") - pkill -RTMIN+21 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+19 "${STATUSBAR:-dwmblocks}" done <"$archive_file" exit 0 ;; @@ -120,7 +120,7 @@ filename=$($simulation_cmd 2>/dev/null) [ -f /tmp/qplaylist ] && rm -rf /tmp/qplaylist notify-send "β³ Downloading $download_type:" "$filename" idnum=$(tsp bash -c "$ytdl_cmd") -pkill -RTMIN+21 "${STATUSBAR:-dwmblocks}" +pkill -RTMIN+19 "${STATUSBAR:-dwmblocks}" # Notify upon completion tsp -D "$idnum" notify-send "β
$download_type download complete:" "$url" || diff --git a/ar/.local/bin/remaps b/ar/.local/bin/remaps index 93832ea..580076d 100755 --- a/ar/.local/bin/remaps +++ b/ar/.local/bin/remaps @@ -10,6 +10,10 @@ xinput list | grep 'id=' | while read -r line; do mouse=$(echo "$line" | grep -i '.*id.*pointer' | sed 's/.*id=\([0-9]\+\).*/\1/') [ -z "$keyboard" ] || { case "$(echo "$line" | grep -oE '.*id=' | sed 's/ id=.*//')" in + *"Lenovo TrackPoint Keyboard II"*) + setxkbmap -device "$keyboard" -option + setxkbmap -device "$keyboard" -option caps:ctrl_modifier,altwin:menu_win,altwin:swap_lalt_lwin + ;; *"Lite-On Tech Lenovo USB Travel Keyboard with Ultra Nav"*) setxkbmap -device "$keyboard" -option setxkbmap -device "$keyboard" -option caps:ctrl_modifier,ctrl:swap_lwin_lctl @@ -43,6 +47,9 @@ xinput list | grep 'id=' | while read -r line; do *"SynPS/2 Synaptics TouchPad"*) xinput set-prop "$mouse" "libinput Tapping Enabled" 0 ;; + *"Lenovo TrackPoint Keyboard II"*) + [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 5, 0, 0, 0, 5, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1 + ;; *"Lite-On Tech Lenovo USB Travel Keyboard with Ultra Nav Mouse"*) [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 5, 0, 0, 0, 5, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1 xinput set-prop "$mouse" "libinput Scroll Method Enabled" 0, 0, 1 diff --git a/ar/.local/bin/statusbar/sb-battery b/ar/.local/bin/statusbar/sb-battery index faf3d04..fc02f61 100755 --- a/ar/.local/bin/statusbar/sb-battery +++ b/ar/.local/bin/statusbar/sb-battery @@ -10,7 +10,7 @@ get_status_icon() { Discharging) echo "π" ;; Charging) echo "π" ;; "Not charging") echo "π" ;; - Unknown) echo "β»οΈ" ;; + Unknown) echo "β»" ;; *) echo "" ;; esac } @@ -57,7 +57,7 @@ case "$BLOCK_BUTTON" in 2) bluetooth && devices "hid*" ;; # Middle click for Bluetooth battery levels 3) notify-send "π Battery module" "\- π: discharging - π: not charging -- β»οΈ: stagnant charge +- β»: stagnant charge - π: charging - β‘: fully charged - β: battery very low! diff --git a/ar/.local/bin/statusbar/sb-bghitness b/ar/.local/bin/statusbar/sb-bghitness index 0aabfb6..83dc809 100755 --- a/ar/.local/bin/statusbar/sb-bghitness +++ b/ar/.local/bin/statusbar/sb-bghitness @@ -10,7 +10,7 @@ max_brightness=$(cat /sys/class/backlight/*/max_brightness) brightness_per=$((100 * curr_brightness / max_brightness)) case $BLOCK_BUTTON in -3) notify-send "π‘ Brightness module" "\- Shows current brightness level βοΈ." ;; +3) notify-send "π‘ Brightness module" "\- Shows current brightness level β ." ;; 4) pkexec brillo -A 5 -q ;; 5) pkexec brillo -U 5 -q ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; diff --git a/ar/.local/bin/statusbar/sb-brightness b/ar/.local/bin/statusbar/sb-brightness index 909e676..e18fa2c 100755 --- a/ar/.local/bin/statusbar/sb-brightness +++ b/ar/.local/bin/statusbar/sb-brightness @@ -1,11 +1,31 @@ #!/bin/sh +monitor=$(xrandr --query | grep -i '\sconnected' | grep '[0-9]x[0-9]' | grep -i 'primary' | cut -d ' ' -f1) +[ -z "$monitor" ] && monitor=$(xrandr --query | grep -i '\sconnected' | grep '[0-9]x[0-9]' | cut -d ' ' -f1) +case "$monitor" in +*DP* | *HDMI*) + current_brightness=$(xrandr --verbose | grep -i "^$monitor connected" -A5 | grep -i "Brightness:" | cut -d ' ' -f2) + current_brightness=$(printf "%.0f\n" "$(echo "$current_brightness * 100" | bc -l)") + ;; +esac + case $BLOCK_BUTTON in 3) notify-send "π Backlight module -- Scroll up & down changes backlight" ;; -4) monbright -inc 5 ;; -5) monbright -dec 5 ;; +- Scroll up & down changes screen brightness +- Shift + Scroll up & down changes monitor backlight" ;; +4) pkexec brillo -A 5 -q ;; +5) pkexec brillo -U 5 -q ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +7) monbright -inc 5 ;; +8) monbright -dec 5 ;; +9) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac -monitorbright +if [ -r /sys/class/backlight/*/brightness ]; then + curr_brightness=$(cat /sys/class/backlight/*/brightness) + max_brightness=$(cat /sys/class/backlight/*/max_brightness) + brightness_per=$((100 * curr_brightness / max_brightness)) + printf "%s %s\n" "π‘${brightness_per}%" "πͺ$current_brightness" +else + printf "%s\n" "πͺ$current_brightness" +fi diff --git a/ar/.local/bin/statusbar/sb-clock b/ar/.local/bin/statusbar/sb-clock index a5992a5..d909326 100755 --- a/ar/.local/bin/statusbar/sb-clock +++ b/ar/.local/bin/statusbar/sb-clock @@ -1,7 +1,7 @@ #!/bin/sh # Get current hour and minute -calendar="ποΈ" +calendar="π" hour=$(date '+%I') minute=$(date '+%M') diff --git a/ar/.local/bin/statusbar/sb-cpu b/ar/.local/bin/statusbar/sb-cpu index 565ca26..0cb6f4f 100755 --- a/ar/.local/bin/statusbar/sb-cpu +++ b/ar/.local/bin/statusbar/sb-cpu @@ -9,4 +9,4 @@ case $BLOCK_BUTTON in 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac -sensors | awk '/Core 0/ {printf "π§%dΒ°\n", $3}' +sensors | awk '/Tctl:/ {gsub(/[+Β°C]/,"",$2); printf "π§%sΒ°", $2}' diff --git a/ar/.local/bin/statusbar/sb-forecast b/ar/.local/bin/statusbar/sb-forecast index d9dded0..063c8e5 100755 --- a/ar/.local/bin/statusbar/sb-forecast +++ b/ar/.local/bin/statusbar/sb-forecast @@ -59,7 +59,7 @@ gethightemp() { jq -r '.weather[0].hourly[].tempC' "$weatherreportjson" | sort - gethumidity() { humidity=$(get_nearest_hourly | jq -r '.humidity') case "$humidity" in - [0-9] | [1-2][0-9]) echo "ποΈ: $humidity%" ;; + [0-9] | [1-2][0-9]) echo "π: $humidity%" ;; [3-4][0-9]) echo "π²: $humidity%" ;; [5-6][0-9]) echo "π§: $humidity%" ;; [7-8][0-9]) echo "π¦: $humidity%" ;; @@ -351,7 +351,7 @@ case $BLOCK_BUTTON in π₯Ά: Daily lowest temperature π₯΅: Daily highest temperature" notify-send "$(todayweather)" - notify-send "πΊοΈ Doppler RADAR module" "\- Middle click for local Doppler RADAR + notify-send "πΊ Doppler RADAR module" "\- Middle click for local Doppler RADAR - Shift + middle click to update RADAR location After $secs seconds, new clicks will also automatically update the doppler RADAR" ;; @@ -360,6 +360,6 @@ After $secs seconds, new clicks will also automatically update the doppler RADAR 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac -checkforecast "$weatherreport" "3600" || { getweatherreport && pkill -RTMIN+15 "${STATUSBAR:-dwmblocks}" && sleep 3; } -checkforecast "$weatherreportjson" "86400" || { getweatherreportjson && pkill -RTMIN+15 "${STATUSBAR:-dwmblocks}" && sleep 3; } +checkforecast "$weatherreport" "3600" || { getweatherreport && pkill -RTMIN+13 "${STATUSBAR:-dwmblocks}" && sleep 3; } +checkforecast "$weatherreportjson" "86400" || { getweatherreportjson && pkill -RTMIN+13 "${STATUSBAR:-dwmblocks}" && sleep 3; } showweather diff --git a/ar/.local/bin/statusbar/sb-internet b/ar/.local/bin/statusbar/sb-internet index df43676..4dfb605 100755 --- a/ar/.local/bin/statusbar/sb-internet +++ b/ar/.local/bin/statusbar/sb-internet @@ -2,12 +2,48 @@ # Show wifi π and percent strength or π‘ if none. # Show π if connected to ethernet or β if none. -# Show π°οΈ if a vpn connection is active +# Show π° if a vpn connection is active + +eth_con="$(nmcli -t -f NAME,TYPE,DEVICE connection show | + awk -F: '$2=="ethernet" && $3!="" { print $1; exit }')" + +wifi_con="$(nmcli -t -f NAME,TYPE connection show | + awk -F: '$2=="wifi" { print $1; exit }')" + +if [ -n "$eth_con" ]; then + nmcli connection modify "$eth_con" ipv4.method auto + nmcli connection modify "$eth_con" ipv4.never-default no + nmcli connection modify "$eth_con" ipv4.dns-priority -42 + nmcli connection modify "$eth_con" ipv4.route-metric 100 + nmcli connection modify "$eth_con" connection.autoconnect yes +fi + +if [ -n "$wifi_con" ]; then + nmcli connection modify "$wifi_con" ipv4.dns-priority 100 + nmcli connection modify "$wifi_con" ipv4.route-metric 600 +fi case $BLOCK_BUTTON in 1) "$TERMINAL" -e nmtui - pkill -RTMIN+7 dwmblocks + pkill -RTMIN+6 dwmblocks + ;; +2) + wifi_dev="$(nmcli -t -f DEVICE,TYPE device | + awk -F: '$2=="wifi" { print $1; exit }')" + + wifi_state="$(nmcli -t -f DEVICE,STATE device | + awk -F: -v dev="$wifi_dev" '$1==dev { print $2 }')" + + if [ "$wifi_state" = "connected" ]; then + nmcli radio wifi off + notify-send "Wi-Fi" "Wi-Fi disconnected" + else + nmcli radio wifi on + notify-send "Wi-Fi" "Wi-Fi connected" + fi + + pkill -RTMIN+6 dwmblocks ;; 3) notify-send "π Internet module" "\- Left click to connect β: wifi disabled @@ -15,23 +51,27 @@ case $BLOCK_BUTTON in π: wifi connection with quality β: no ethernet π: ethernet working -π°οΈ: vpn is active +π°: vpn is active " ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac # Wifi -if grep -q 'up' /sys/class/net/w*/operstate; then - wifiicon="$(awk '/^\s*w/ { print "π" int($3 * 100 / 70) "%" }' /proc/net/wireless)" -elif grep -q 'down' /sys/class/net/w*/operstate; then - grep -q '0x1003' /sys/class/net/w*/flags && wifiicon="π‘" || wifiicon="β" +if grep -q 'up' /sys/class/net/w*/operstate 2>/dev/null; then + if grep -q '^\s*w' /proc/net/wireless; then + wifiicon="$(awk '/^\s*w/ { print "π" int($3 * 100 / 70) "%" }' /proc/net/wireless)" + else + wifiicon="π‘" + fi +elif grep -q 'down' /sys/class/net/w*/operstate 2>/dev/null; then + wifiicon="β" fi # Ethernet grep -q 'up' /sys/class/net/e*/operstate && ethericon="π" || ethericon="β" # TUN -[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon="π°οΈ" +[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon="π°" icons="" [ -n "$wifiicon" ] && icons="${icons}$wifiicon " diff --git a/ar/.local/bin/statusbar/sb-iplocate b/ar/.local/bin/statusbar/sb-iplocate index d84445e..d7a9349 100755 --- a/ar/.local/bin/statusbar/sb-iplocate +++ b/ar/.local/bin/statusbar/sb-iplocate @@ -10,6 +10,6 @@ set -e ifinstalled "geoip" addr="$(geoiplookup "$(curl -sfm 1 ifconfig.me 2>/dev/null)")" name="${addr##*, }" -flag="$(grep "flag: $name" "${XDG_DATA_HOME:-${HOME}/.local/share}/larbs/emoji")" +flag="$(grep "flag: $name" "${XDG_DATA_HOME:-${HOME}/.local/share}/thesiah/chars/emoji")" flag="${flag%% *}" printf "%s %s\\n" "$flag" "$name" diff --git a/ar/.local/bin/statusbar/sb-keyboard b/ar/.local/bin/statusbar/sb-keyboard index 34fa2bc..2257b1b 100755 --- a/ar/.local/bin/statusbar/sb-keyboard +++ b/ar/.local/bin/statusbar/sb-keyboard @@ -3,9 +3,9 @@ # works on any init system # requirements: dmenu, xorg-setxkbmap case $BLOCK_BUTTON in -1) fcitx5-remote -t && kill -44 "$(pidof "${STATUSBAR:-dwmblocks}")" ;; +1) fcitx5-remote -t && kill -43 "$(pidof "${STATUSBAR:-dwmblocks}")" ;; 2) remaps ;; -3) notify-send "β¨οΈ Input Method module" "\- Shows current input method (defalt US) +3) notify-send "β¨ Input Method module" "\- Shows current input method (defalt US) - Left click to switch language (EN/KO) - Middle click to change keyboard" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; @@ -14,7 +14,7 @@ case $BLOCK_BUTTON in [ -z "$kb_choice" ] && exit 0 kb="$(echo "$kb_choice" | awk '{print $3}')" setxkbmap "$kb" - pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" ;; esac @@ -28,4 +28,4 @@ hangul) lang="KO" ;; *) lang="??" ;; esac -echo "β¨οΈ$lang" +echo "β¨$lang" diff --git a/ar/.local/bin/statusbar/sb-mailbox b/ar/.local/bin/statusbar/sb-mailbox index c772a0d..6926b6e 100755 --- a/ar/.local/bin/statusbar/sb-mailbox +++ b/ar/.local/bin/statusbar/sb-mailbox @@ -6,7 +6,7 @@ case $BLOCK_BUTTON in 1) setsid -w -f "$TERMINAL" -e neomutt - pkill -RTMIN+20 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+18 "${STATUSBAR:-dwmblocks}" ;; 2) setsid -f mw -Y >/dev/null ;; 3) notify-send "π¬ Mail module" "\- Shows unread mail diff --git a/ar/.local/bin/statusbar/sb-memory b/ar/.local/bin/statusbar/sb-memory index 5b06d29..3c9dd03 100755 --- a/ar/.local/bin/statusbar/sb-memory +++ b/ar/.local/bin/statusbar/sb-memory @@ -10,9 +10,15 @@ case $BLOCK_BUTTON in esac width=$(xrandr | grep "\*" | awk '{print $1}' | sed 's/x[0-9]*//g' | head -n1) +nvme_temp=$(sensors 2>/dev/null | + awk '/Composite:/ {gsub(/[+Β°C]/,"",$2); print $2; exit}') if [ -n "$width" ] && [ "$width" -eq "$width" ] 2>/dev/null; then - [ "$width" -lt 1920 ] && - free --mebi | sed -n '2{p;q}' | awk '{printf ("π%d%%\n", ($3/$2)*100+0.5 )}' || - free --mebi | sed -n '2{p;q}' | awk '{printf ("π%dGB/%dGB", $3/1000+0.5,$2/1000+0.5)}' + if [ "$width" -lt 1920 ]; then + free --mebi | sed -n '2{p;q}' | + awk -v t="$nvme_temp" '{printf "π‘%sΒ° π%d%%\n", t, ($3/$2)*100+0.5}' + else + free --mebi | sed -n '2{p;q}' | + awk -v t="$nvme_temp" '{printf "π‘%sΒ° π%dGB/%dGB", t, $3/1000+0.5, $2/1000+0.5}' + fi fi diff --git a/ar/.local/bin/statusbar/sb-mpdup b/ar/.local/bin/statusbar/sb-mpdup index 90e9c7e..fa9b61b 100755 --- a/ar/.local/bin/statusbar/sb-mpdup +++ b/ar/.local/bin/statusbar/sb-mpdup @@ -4,5 +4,5 @@ # music player's status. mpd must be running on X's start for this to work. while :; do - mpc idle >/dev/null && kill -57 "$(pidof "${STATUSBAR:-dwmblocks}")" || break + mpc idle >/dev/null && kill -55 "$(pidof "${STATUSBAR:-dwmblocks}")" || break done diff --git a/ar/.local/bin/statusbar/sb-music b/ar/.local/bin/statusbar/sb-music index a71969f..d730116 100755 --- a/ar/.local/bin/statusbar/sb-music +++ b/ar/.local/bin/statusbar/sb-music @@ -61,7 +61,7 @@ case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e ncmpcpp ;; # left click, opens ncmpcpp 2) mpc toggle ;; # middle click, pause/unpause 3) # right click - { [ -n "$(mpc current)" ] && [ -n "$(mpc queued)" ]; } && notify-send "π΅ $(mpc current)" "βοΈ $(mpc queued)" + { [ -n "$(mpc current)" ] && [ -n "$(mpc queued)" ]; } && notify-send "π΅ $(mpc current)" "β $(mpc queued)" notify-send "π΅ Music module" "\- Shows mpd song playing and status - π΅ if playing - βΈ if paused diff --git a/ar/.local/bin/statusbar/sb-packages b/ar/.local/bin/statusbar/sb-packages index 5955c75..467bfb3 100755 --- a/ar/.local/bin/statusbar/sb-packages +++ b/ar/.local/bin/statusbar/sb-packages @@ -15,7 +15,7 @@ # [Action] # Description = Updating statusbar... # When = PostTransaction -# Exec = /usr/bin/pkill -RTMIN+16 dwmblocks # Or i3blocks if using i3. +# Exec = /usr/bin/pkill -RTMIN+14 dwmblocks # Or i3blocks if using i3. case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e sb-popupgrade && remaps ;; diff --git a/ar/.local/bin/statusbar/sb-popupgrade b/ar/.local/bin/statusbar/sb-popupgrade index 14036eb..221c7db 100755 --- a/ar/.local/bin/statusbar/sb-popupgrade +++ b/ar/.local/bin/statusbar/sb-popupgrade @@ -3,7 +3,7 @@ printf "Beginning upgrade\\n" yay -Syu -pkill -RTMIN+16 "${STATUSBAR:-dwmblocks}" +pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}" printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n" read -r _ diff --git a/ar/.local/bin/statusbar/sb-queues b/ar/.local/bin/statusbar/sb-queues index 40445f8..477fa7f 100755 --- a/ar/.local/bin/statusbar/sb-queues +++ b/ar/.local/bin/statusbar/sb-queues @@ -18,7 +18,7 @@ EOF if [ -z "$url" ]; then notify-send "π€ No active yt-dlp downloads" fi - pkill -RTMIN+21 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+19 "${STATUSBAR:-dwmblocks}" } # This block displays the number of running and queued background tasks. Requires tsp. diff --git a/ar/.local/bin/statusbar/sb-repos b/ar/.local/bin/statusbar/sb-repos index 2c259ba..d5acfac 100755 --- a/ar/.local/bin/statusbar/sb-repos +++ b/ar/.local/bin/statusbar/sb-repos @@ -9,7 +9,7 @@ private_repos="$HOME/Private/repos" public_repos="${XDG_PUBLICSHARE_DIR:-${HOME}/Public}/repos" # Icon indicators -dotfiles_icon="βοΈ" +dotfiles_icon="β" suckless_icon="π " private_icon="π " public_icon="π’" diff --git a/ar/.local/bin/statusbar/sb-tasks b/ar/.local/bin/statusbar/sb-tasks index 66be81b..5fc61df 100755 --- a/ar/.local/bin/statusbar/sb-tasks +++ b/ar/.local/bin/statusbar/sb-tasks @@ -67,7 +67,7 @@ $(printf "%b" "$overdue_list")" ;; 2) check_task_sync ;; 3) - notify-send "ποΈ Task Module" "Shows task counts. + notify-send "π Task Module" "Shows task counts. - Left click: Show tasks due soon. - Middle click: Show follow-up tasks." ;; diff --git a/ar/.local/bin/statusbar/sb-torrent b/ar/.local/bin/statusbar/sb-torrent index ec104b4..3e4b729 100755 --- a/ar/.local/bin/statusbar/sb-torrent +++ b/ar/.local/bin/statusbar/sb-torrent @@ -5,7 +5,7 @@ status=$(transmission-remote -l | grep % | s/.*Stopped.*/A π/; s/.*Seeding.*/Z π±/; s/.*100%.*/N β
/; - s/.*Idle.*/B π°οΈ/; + s/.*Idle.*/B π°/; s/.*Uploading.*/L πΌ/; s/.*Downloading.*/M π½/; s/.*%.*/Q β/" | diff --git a/ar/.local/bin/statusbar/sb-volume b/ar/.local/bin/statusbar/sb-volume index 7881bfd..291e78d 100755 --- a/ar/.local/bin/statusbar/sb-volume +++ b/ar/.local/bin/statusbar/sb-volume @@ -5,7 +5,7 @@ case $BLOCK_BUTTON in 1) setsid -w -f "$TERMINAL" -e pulsemixer - pkill -RTMIN+5 "${STATUSBAR:-dwmblocks}" + pkill -RTMIN+4 "${STATUSBAR:-dwmblocks}" ;; 2) wpctl set-mute @DEFAULT_SINK@ toggle ;; 3) notify-send "π’ Volume module" "\- Shows volume π, π if muted diff --git a/ar/.local/bin/synctime b/ar/.local/bin/synctime index 47f4310..664639f 100755 --- a/ar/.local/bin/synctime +++ b/ar/.local/bin/synctime @@ -19,4 +19,4 @@ sudo hwclock --systohc echo "Current timezone: $current_zone" date -pkill -RTMIN+3 ${STATUSBAR:-dwmblocks} +pkill -RTMIN+2 ${STATUSBAR:-dwmblocks} diff --git a/ar/.local/bin/sysact b/ar/.local/bin/sysact index d4f3653..64ef127 100755 --- a/ar/.local/bin/sysact +++ b/ar/.local/bin/sysact @@ -11,10 +11,10 @@ lock() { mpc pause pauseallmpv wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle - kill -39 "$(pidof dwmblocks)" + kill -38 "$(pidof dwmblocks)" slock wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle - kill -39 "$(pidof dwmblocks)" + kill -38 "$(pidof dwmblocks)" } wmpid() { # This function is needed if there are multiple instances of the window manager. diff --git a/ar/.local/bin/td-toggle b/ar/.local/bin/td-toggle index 4bbe75c..c71d53f 100755 --- a/ar/.local/bin/td-toggle +++ b/ar/.local/bin/td-toggle @@ -8,4 +8,4 @@ else ifinstalled transmission-cli || exit [ "$(printf "No\\nYes" | dmenu -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "π transmission-daemon enabled." fi -sleep 3 && pkill -RTMIN+22 "${STATUSBAR:-dwmblocks}" +sleep 3 && pkill -RTMIN+20 "${STATUSBAR:-dwmblocks}" diff --git a/ar/.local/bin/tordone b/ar/.local/bin/tordone index 4e097a0..016568f 100755 --- a/ar/.local/bin/tordone +++ b/ar/.local/bin/tordone @@ -5,6 +5,6 @@ if [ -n "$completed_torrents" ]; then for torrent_id in $completed_torrents; do transmission-remote -n "$USER" -t "$torrent_id" -r done - pkill -RTMIN+22 "${STATUSBAR:-dwmblocks}" && notify-send "β
Transmission-daemon" "Torrent(s) $TR_TORRENT_NAME has completed downloading. Deleting torrent files." + pkill -RTMIN+20 "${STATUSBAR:-dwmblocks}" && notify-send "β
Transmission-daemon" "Torrent(s) $TR_TORRENT_NAME has completed downloading. Deleting torrent files." [ -z "$(transmission-remote -n "$USER" -l | grep -v "Sum:")" ] && killall transmission-daemon && notify-send "β Transmission-daemon disabled." fi diff --git a/ar/.local/bin/torwrap b/ar/.local/bin/torwrap index 54f5c0e..624778a 100755 --- a/ar/.local/bin/torwrap +++ b/ar/.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:-st}" -n stig -e stig -pkill -RTMIN+22 "${STATUSBAR:-dwmblocks}" +pkill -RTMIN+20 "${STATUSBAR:-dwmblocks}" diff --git a/ar/.local/bin/transadd b/ar/.local/bin/transadd index ffd8ded..567b1bc 100755 --- a/ar/.local/bin/transadd +++ b/ar/.local/bin/transadd @@ -4,7 +4,7 @@ # 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+22 "${STATUSBAR:-dwmblocks}") +pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "π‘ Starting transmission daemon..." && sleep 3 && pkill -RTMIN+20 "${STATUSBAR:-dwmblocks}") directory="$HOME/Torrents" diff --git a/ar/.local/bin/ylog b/ar/.local/bin/ylog index 254803b..c56df36 100755 --- a/ar/.local/bin/ylog +++ b/ar/.local/bin/ylog @@ -5,7 +5,7 @@ LOG_DIR="/var/log/nginx" TARGET="all" # "all" means no target filter (show all lines) COUNTRY="all" # all|kr|us -SCOPE="all" # all|access|recordings +SCOPE="all" # all|access|recordings|hidden|diary|peertube EXCL_FIREFOX=0 # 1 = exclude Firefox lines by default EXCLUDES="59.19.56.8" # default exclude pattern ADD_EXCLUDES="" @@ -24,13 +24,16 @@ Options: -c COUNTRY Select country logs (default: all) all : all logs - kr : recordings.kr.log + recordings.access.log - us : recordings.us.log + recordings.access.log + kr : recordings.kr.log + recordings.access.log (and diary.kr.log when -s diary) + us : recordings.us.log + recordings.access.log (and diary.us.log when -s diary) -s SCOPE Select log scope (default: all) - all : recordings + access + all : recordings + access + hidden + diary + peertube recordings : recordings.* logs only access : access.* logs only + hidden : hidden.access.* logs only + diary : diary.* logs only + peertube : peertube.* logs only -n Disable Firefox exclusion (by default, Firefox lines are excluded) @@ -51,7 +54,10 @@ Options: Examples: ylog # All logs, last 10 lines each ylog -s recordings # Recordings logs only, last 10 lines each + ylog -s diary # Diary logs only, last 10 lines each + ylog -s peertube # Peertube logs only, last 10 lines each ylog -c kr -t 1.2.3.4 # Search specific IP in Korean logs + ylog -c kr -s diary # Korean diary logs only ylog -t all -l 50 # All logs, last 50 lines each ylog -d 1 # Logs from 1 day ago only ylog -d ~2 # Logs from 2 days ago to today @@ -119,6 +125,32 @@ pick_files() { [ -e "$q" ] && printf "%s\n" "$q" done fi + # diary logs: similar structure to recordings + if [ "$SCOPE" = "diary" ] || [ "$SCOPE" = "all" ]; then + if [ "$COUNTRY" = "all" ]; then + for q in "$LOG_DIR/diary.access.log" "$LOG_DIR/diary.access.log".*; do + [ -e "$q" ] && printf "%s\n" "$q" + done + fi + case "$COUNTRY" in + kr) for q in "$LOG_DIR/diary.kr.log" "$LOG_DIR/diary.kr.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;; + us) for q in "$LOG_DIR/diary.us.log" "$LOG_DIR/diary.us.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;; + all) + for p in diary.kr.log diary.us.log; do + for q in "$LOG_DIR/$p" "$LOG_DIR/$p".*; do [ -e "$q" ] && printf "%s\n" "$q"; done + done + ;; + esac + fi + # peertube logs + if [ "$SCOPE" = "peertube" ] || [ "$SCOPE" = "all" ]; then + for q in "$LOG_DIR/peertube.access.log" "$LOG_DIR/peertube.access.log".*; do + [ -e "$q" ] && printf "%s\n" "$q" + done + for q in "$LOG_DIR/peertube.error.log" "$LOG_DIR/peertube.error.log".*; do + [ -e "$q" ] && printf "%s\n" "$q" + done + fi } # build exclude regex |
