This commit is contained in:
ayham 2021-08-01 14:38:51 +03:00
parent 087a72b170
commit 56212fa2fc
Signed by: ayham
GPG Key ID: EAB7F5A9DF503678
7 changed files with 135 additions and 9 deletions

View File

@ -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=""

View File

@ -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="-"

View File

@ -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

92
.local/bin/dclock Executable file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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