diff --git a/.config/X11/realinit b/.config/X11/realinit index 1abd35bf6..0223cc24e 100755 --- a/.config/X11/realinit +++ b/.config/X11/realinit @@ -14,4 +14,6 @@ fi . "$X11_CONFIG/xprofile" -exec dwm +echo $DBUS_SESSION_BUS_ADDRESS > $XDG_STATE_HOME/dbus_session_address + +dwm diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 41e77daf5..edd904794 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -36,7 +36,7 @@ cmd lazygit ${{ clear if [ ! -e "$PWD/.git" ]; then echo "Not in a git repository. Create a new git repository? (y/n): " - [ $(echo "y\nn" | fzf) = "y" ] && git init && lazygit -p $PWD + [ $(echo "Yes\nNo" | fzf) = "Yes" ] && git init && lazygit -p $PWD else lazygit -p $PWD fi @@ -147,12 +147,17 @@ cmd fzfgrep ${{ [ -n "$res" ] && lf -remote "send $id select \"$res\"" }} +# cmd fzfworkon ${{ +# workon -n $(workon | fzf) +# }} + # Bindings map a fzfsearch map t fzftags map m fzfmarks map f fzfshortcut map g fzfgrep +# map w fzfworkon map D trash map $trash-restore $PWD map T delete diff --git a/.local/bin/cron/README.md b/.local/bin/cron/README.md deleted file mode 100644 index 6525a376d..000000000 --- a/.local/bin/cron/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Important Note - -These cronjobs have components that require information about your current display to display notifications correctly. - -When you add them as cronjobs, I recommend you precede the command with commands as those below: - -$()$( - export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus - export DISPLAY=:0 - . $HOME/.zprofile - then_command_goes_here -)$() - -This ensures that notifications will display, xdotool commands will function and environmental variables will work as well. diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup index adcc8c06a..3218a08f8 100755 --- a/.local/bin/cron/checkup +++ b/.local/bin/cron/checkup @@ -1,24 +1,14 @@ #!/bin/sh -# Syncs repositories and downloads updates, meant to be run as a cronjob. - -notify-send " Repository Sync" "Checking for package updates..." - askupgrade() { [ "$(notify-send -c updates --action=Yes=Yes --action=No=No " Repository Sync" "Updates available. Update now?")" = 'Yes' ] && $TERMINAL -e upgrades } -confirmcheck() { - notify-send " Repository Sync" "Sync complete. No new packages for update." -} - if command -v apt 1>/dev/null 2>&1; then n=$(sudo apt upgrade -dy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9' | cut -c1-2) if [ "$n" = '' ]; then - notify-send "Error downloading updates." "Check your internet connection, if apt is already running, or run update manually to see errors." - elif [ "$n" = 00 ]; then - confirmcheck - else + notify-send -u critical "Error downloading updates." "Check your internet connection, if apt is already running, or run update manually to see errors." + elif [ "$n" != 00 ]; then askupgrade fi elif command -v xbps-install 1>/dev/null 2>&1; then @@ -26,11 +16,9 @@ elif command -v xbps-install 1>/dev/null 2>&1; then n="$(wc -l < /tmp/xbps_updates)" ne="$(grep broken /tmp/xbps_errors | wc -l)" n="$(xbps-install -M -n -u | grep -Fe update -e install | wc -l)" - if [ "$n" = "0" ] && [ "$ne" = "0" ]; then - confirmcheck + if [ "$n" != "0" ] && [ "$ne" != "0" ]; then + notify-send -u critical "Error downloading updates." "$(cut -d " " -f 1,5 /tmp/xbps_errors)" elif [ "$n" -gt 1 ] && [ "$ne" = "0" ]; then askupgrade - else - notify-send "Error downloading updates." "$(cut -d " " -f 1,5 /tmp/xbps_errors)" fi fi diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup deleted file mode 100755 index 225e35430..000000000 --- a/.local/bin/cron/newsup +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Set as a cron job to check for new RSS entries for newsboat. -# If newsboat is open, sends it an "R" key to refresh. - -/usr/bin/notify-send " Updating RSS feeds..." - -pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit - -echo " 痢" >/tmp/newsupdate -pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" -/usr/bin/newsboat -x reload -rm -f /tmp/newsupdate -pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" -/usr/bin/notify-send " RSS feed update complete." diff --git a/.local/bin/cron/trash-prune b/.local/bin/cron/trash-prune new file mode 100755 index 000000000..4b469f3df --- /dev/null +++ b/.local/bin/cron/trash-prune @@ -0,0 +1,41 @@ +#!/bin/sh + +IFS=' +' + +days=${1:-7} +types=${2:-ext2,ext3,ext4,xfs,btrfs,vfat,nfs} + +getfsroot() { + printf "%s" "$(df "$1" --output=target | tail -1)" +} + +list_trash_dirs() { + for mnt in $(findmnt -Py -t "$types"); do + eval $mnt + if [ "$TARGET" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ]; then + echo "${XDG_DATA_HOME:-$HOME/.local/share}/Trash" + elif [ "$TARGET" = "/" ]; then + echo "/.Trash" + else + echo "${TARGET}/.Trash" + fi + done +} + +prune_dir() { + [ -w "$1" ] || return 1 + for file in "$1"/info/*; do + [ "$(head -1 "$file")" = "[Trash Info]" ] || continue + if [ "$(date -ud "$days days ago" +%s)" -gt "$(date -ud "$(grep DeletionDate "$file" | cut -d '=' -f2)" +%s)" ]; then + file=$(basename "$file") + echo "$file too old!" + rm "$1/info/$file" + rm "$1/files/$file" + fi + done +} + +for dir in $(list_trash_dirs); do + prune_dir $dir || echo "Not pruning $dir" >&2 +done diff --git a/.local/bin/statusbar/sb-disk b/.local/bin/statusbar/sb-disk index 43e5e0a48..c4e54734f 100755 --- a/.local/bin/statusbar/sb-disk +++ b/.local/bin/statusbar/sb-disk @@ -1,13 +1,13 @@ #!/bin/sh -reset="\033[0m" -big="\033[12m" +# reset="\033[0m" +# big="\033[12m" IFS=' ' types=${1:-ext2,ext3,ext4,xfs,btrfs,vfat} first=true -for mnt in $(findmnt -Py -t $types); do +for mnt in $(findmnt -Py -t "$types"); do [ "$first" = "false" ] && printf " | " eval $mnt [ -d "$TARGET" ] || break diff --git a/.local/bin/trash-restore b/.local/bin/trash-restore index 62743f53d..0c0f9035d 100755 --- a/.local/bin/trash-restore +++ b/.local/bin/trash-restore @@ -8,18 +8,15 @@ list() { # 1st arg is trash files directory # 2nd arg is directory to match trash files for [ ! "$(command ls -A "$1")" ] && exit 1 - for file in "$1"/*; do - [ "$(head -1 "$file")" = "[Trash Info]" ] && - filepath=$(grep Path "$file" | cut -d '=' -f2) && - echo "$filepath" | grep -qP "^$2/[^/]+$" && - printf "%s %s %s\n" \ - "$(basename "$file")" \ - "$filepath" \ - "$(date -d "$(grep Date "$file" | cut -d '=' -f2)" +'%x %X')" - done + while read -r file; do + filepath=$(grep Path "$file" | cut -d '=' -f2) || continue + echo "$filepath" | grep -qP "^$2/[^/]+$" || continue + printf "%s %s %s\n" "$(basename "$file")" "$filepath" "$(date -d "$(grep DeletionDate "$file" | cut -d '=' -f2)" +'%x %X')" + done </dev/null) +EOF } - fsroot="$(getfsroot "$PWD")" if [ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ]; then @@ -31,5 +28,5 @@ fi sel="$(list "$basedir/info" "$PWD" | fzf)" file="$basedir/files/$(echo "$sel" | cut -d '' -f1)" dest="$(echo "$sel" | cut -d '' -f3)" -command mv -ib "$file" "$dest" -command rm "$basedir/info/$(echo "$sel" | cut -d '' -f1)" +mv -ib "$file" "$dest" +rm "$basedir/info/$(echo "$sel" | cut -d '' -f1)" diff --git a/.local/src/dmenu b/.local/src/dmenu index 158ee8a8e..8537c3d39 160000 --- a/.local/src/dmenu +++ b/.local/src/dmenu @@ -1 +1 @@ -Subproject commit 158ee8a8ec25314523d8c5d819a84358af9bf69a +Subproject commit 8537c3d39c01c84c854781af01e050677ec62e01 diff --git a/.local/src/dwm b/.local/src/dwm index 17b6f68ab..38ddeff2c 160000 --- a/.local/src/dwm +++ b/.local/src/dwm @@ -1 +1 @@ -Subproject commit 17b6f68ab4a701ee4a8b01596fd4e810ceea2e61 +Subproject commit 38ddeff2c430311867f11aabdace36cbf683012e diff --git a/.local/src/dwmblocks-async b/.local/src/dwmblocks-async index f8c27ebf0..606d9be33 160000 --- a/.local/src/dwmblocks-async +++ b/.local/src/dwmblocks-async @@ -1 +1 @@ -Subproject commit f8c27ebf0e59cdf2536f5ba8b0019eded565a445 +Subproject commit 606d9be33728041cbf740d1b2c2b134576441e50 diff --git a/.local/src/pinentry-dmenu b/.local/src/pinentry-dmenu index c844a7936..fcb3ded45 160000 --- a/.local/src/pinentry-dmenu +++ b/.local/src/pinentry-dmenu @@ -1 +1 @@ -Subproject commit c844a7936a592aad3693c09e65a4563d2ceba9f1 +Subproject commit fcb3ded4546c3ae24f1a38473976cd5a3651691a diff --git a/.local/src/st b/.local/src/st index c1c84d6fa..3fa572fee 160000 --- a/.local/src/st +++ b/.local/src/st @@ -1 +1 @@ -Subproject commit c1c84d6fa5479b82266f2f6a140e61991e509b60 +Subproject commit 3fa572fee205c8ae85a74e4e350df2daf3c6ed9d