diff --git a/.config/X11/dwm-xinit b/.config/X11/dwm-xinit index 39d574c..79b27bd 100644 --- a/.config/X11/dwm-xinit +++ b/.config/X11/dwm-xinit @@ -1,4 +1,4 @@ -exec rm ~/.cache/wal/ & +exec rm -r ~/.cache/wal/ & exec wal -n -i ~/pix/wallpapers/wallpaper & exec feh --no-fehbg --bg-fill ~/pix/wallpapers/wallpaper & exec xrdb ~/.cache/wal/colors.Xresources & @@ -16,14 +16,11 @@ exec xss-lock -- /usr/bin/slock & exec keynav & exec light -S 100 & umask 002 & -if test -f /usr/lib/ssh/x11-ssh-askpass -then - SSH_ASKPASS=/usr/lib/ssh/x11-ssh-askpass ssh-add < /dev/null -fi & +eval $(keychain --eval --quiet id_ed25519) exec dstartup & exec xephyr-helper & -exec xhost +si:localuser:"$USER" & no-hdmi-port.sh && with-hdmi-port.sh & +exec xhost +si:localuser:"$USER" & exec unclutter & # relaunch DWM if the binary changes, otherwise bail csum="" diff --git a/.config/env b/.config/env index e92ea94..3dfed53 100644 --- a/.config/env +++ b/.config/env @@ -17,9 +17,13 @@ export PATH="/usr/games/:$PATH" export PATH="$XDG_BIN_HOME:$PATH" export GPG_TTY=$(tty) + +# TODOTXT STUFF export TODOTXT_DEFAULT_ACTION=ls +export TODOTXT_SORT_COMMAND='env LC_COLLATE=C sort -k 2,2 -k 1,1n' # ~/ clean-up +export SSH_ASKPASS=ssh-askpass export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority export GTK2_RC_FILES="$HOME/.config/gtk-2.0/gtkrc-2.0" export LESSHISTFILE="-" diff --git a/.config/picom.conf b/.config/picom.conf index d2957e8..8b024ab 100644 --- a/.config/picom.conf +++ b/.config/picom.conf @@ -3,7 +3,7 @@ ################################# # requires https://github.com/jonaburg/picom # (These are also the default values) -transition-length = 300 +transition-length = 15 transition-pow-x = 0.1 transition-pow-y = 0.1 transition-pow-w = 0.1 diff --git a/.local/bin/dclock b/.local/bin/dclock new file mode 100755 index 0000000..ad00c7e --- /dev/null +++ b/.local/bin/dclock @@ -0,0 +1,92 @@ +#!/bin/bash + +ScriptName=${0##*/} +TimerPIDFile="/tmp/dclock.pids" + +# MenuItems +AddTimer="1. Add timer" +RemTimer="2. Remove timer" +ListTimers="3. List timers" +StartStopWatch="4. Start Stopwatch" +StopStopWatch="5. Stop Stopwatch" +ListStopWatch="6. Show Stopwatch" +ResetStopWatch="7. Reset Stopwatch" + +_pid_file_cleanup() { + # Get timer PIDs + readarray -t timer_PIDs < $TimerPIDFile + + [ "${timer_PIDs[0]}" = "" ] && return 1 + + # Remove no longer present timers + for PID in "${timer_PIDs[@]}" + do + [ "$(ps -p "$picked_PID" -o comm=)" = "" ] \ + && timer_PIDs=("${timer_PIDs[@]/$PID}") + done + + # Save new PIDs + touch $TimerPIDFile + echo ${timer_PIDs[@]} > $TimerPIDFile +} + +_timer_add() { + sleep $1 & + + # Save pid + PID=$! + echo $PID >> $TimerPIDFile + + notify-send "$ScriptName" "Added timer with duration: $duration, with \ + PID: $PID" +} + +_timer_remove() { + # Get timer PIDs + readarray -t timer_PIDs < $TimerPIDFile + + # Get timers as menuitem + declare -a timers_duration + declare -a timers_took + declare -a timers + for PID in "${timer_PIDs[@]}" + do + sleep_duration=$(ps -o cmd= -fp $PID | sed 's/^sleep //' -) + durations+=($sleep_duration) + sleeped_duration=$(ps -o lstart= -p $PID \ + | sed 's/^sleep //' -) + timers+="$PID timer $sleep_duration out of $sleep_duration" + done + + # Prompt user to pick + picked_PID=$(echo ${timers[@]} \ + | dmenu -i -l 10 -p "Pick timer to delete:" \ + | awk 'BEGIN {FS=" "} ; {print $1}') + + # Kill sleep process + [ "$(ps -p "$picked_PID" -o comm=)" = "sleep" ] && kill -9 $(awk '{print $1}') + + # Check and notify if timer still active + [ "$(ps -p "$picked_PID" -o comm=)" = "sleep" ] \ + && notify-send "$ScriptName" "Failed to stop timer with PID: $picked_PID" && exit + + # Remove unset PIDs from $TimerPIDFile + _pid_file_cleanup + + notify-send "$ScriptName" "Stopped timer with PID: $picked_PID" +} + +_pid_file_cleanup + +ChosenMenu=$(printf '**Timers\n%s\n%s\n%s\n**Stopwatch\n%s\n%s\n%s\n%s' \ + "$AddTimer" "$RemTimer" "$ListTimers" \ + "$StartStopWatch" "$StopStopWatch" "$ListStopWatch" "$ResetStopWatch" \ + | dmenu -i -l 7 -p "$ScriptName") + +if [ "$ChosenMenu" = "$AddTimer" ]; then + duration=$(printf "h = hours\nm = minutes\ns = seconds" \ + | dmenu -i -l 3 -p \ "Timer Duration:") + _timer_add $duration +elif [ "$ChosenMenu" = "$RemTimer" ]; then + _timer_remove +fi diff --git a/.local/bin/dtodotxt b/.local/bin/dtodotxt index 93a69f4..50a7d51 100755 --- a/.local/bin/dtodotxt +++ b/.local/bin/dtodotxt @@ -1,3 +1,36 @@ #!/bin/sh # Options + +AddItem="1. Add todo item" +RemItem="2. Remove todo item" +MarkItem="3. Mark todo item" +ListItems="4. List todo items" +Archive="5. Archive todo items" +Report="6. Report todo items" + +# Choose item +ChosenMenu=$(printf '%s\n%s\n%s\n%s\n%s\n%s\n%s' \ + "$AddItem" "$RemItem" "$MarkItem" "$ListItems" "$Archive" "$Report" \ + | dmenu -i -l 10 -p "todo:") + +_select_item() { + return "$(todo.sh ls | dmenu -i -l 30 | awk '{print $1}')" +} + +if [ "$ChosenMenu" = "$AddItem" ]; then + text=$(echo "" | dmenu -i -l 1 -p "item:") + todo.sh add "$text" +elif [ "$ChosenMenu" = "$RemItem" ]; then + _select_item + todo.sh rm $? +elif [ "$ChosenMenu" = "$MarkItem" ]; then + _select_item + todo.sh do $? +elif [ "$ChosenMenu" = "$ListItems" ]; then + todo.sh ls | dmenu -i -l 30 +elif [ "$ChosenMenu" = "$Archive" ]; then + todo.sh archive +elif [ "$ChosenMenu" = "$Report" ]; then + todo.sh report +fi diff --git a/.local/bin/dweb b/.local/bin/dweb index 52ea309..6d00cd6 100755 --- a/.local/bin/dweb +++ b/.local/bin/dweb @@ -20,7 +20,7 @@ ChosenMenu=$(printf '%s\n%s\n%s\n%s' \ | dmenu -i -l 10 -p "$ScriptName:") # Search web if [ "$ChosenMenu" = "$SearchWeb" ]; then - search=$(echo "" | dmenu -i -p "Search:") + search=$(dmenu -l 1 -i -p "Search:") [ "$search" ] && $($browser "$search_engine$(echo $search | sed -r 's/ /+/g')") & fi diff --git a/.zprofile b/.zprofile index 82905f8..692a78b 100755 --- a/.zprofile +++ b/.zprofile @@ -3,4 +3,4 @@ [[ -f ~/.config/env ]] && source ~/.config/env #if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec sx sh ~/.config/X11/dwm-xinit; fi -if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec startx ~/.config/X11/dwm-xinit; fi +if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec ssh-agent startx ~/.config/X11/dwm-xinit; fi