Cleanup good morning script

This commit is contained in:
Daniel Flanagan 2023-05-17 09:53:26 -05:00
parent a17a891cad
commit 4068fdf409
4 changed files with 46 additions and 2 deletions

View file

@ -2,6 +2,5 @@
has_command gawk || { echo "No gawk." >&2 ; exit 1; } has_command gawk || { echo "No gawk." >&2 ; exit 1; }
index="${1:-1}" index="${1:-1}"
echo "$#" >&2
[ "$#" -lt 1 ] || shift [ "$#" -lt 1 ] || shift
gawk "$@" '{print $'"${index}"'}' gawk "$@" '{print $'"${index}"'}'

21
common/bin/good-morning Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env fish
# create a messages file for subscripts to write to or manipulate for ending
# output
set message_file (mktemp)
for f in (fd good-morning.d.fish $HOME/.config/lytedev-env --max-depth 2)
# run scripts for any linked environments with a hooked script
source $f $message_file
end
# output the messages file's contents
echo
cat $message_file
echo
# since this script almost always runs in its own window which dies after
# finishing, give the user a chance to read the output
echo "When you're ready, hit enter to finish!"
read

21
common/bin/maybe-good-morning Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env fish
# TODO: some kind of better time-based or last-awakened heuristic to determine
# whether or not this shows
set -l hours 08 09 10
if ! contains (date +%H) $hours
echo "Not sending notification since it isn't the morning" >>&2
exit 1
end
notify-send \
--urgency critical \
"Good morning!" \
"Activate this notification (click it) to run the script. Dismiss (Super+Ctrl+Space) to ignore." \
--action=default=Activate \
| rg default
if test $status -eq 0
hyprctl dispatch exec [float] wezterm start good-morning
end

View file

@ -5,7 +5,7 @@ monitor=,preferred,auto,auto
# Execute your favorite apps at launch # Execute your favorite apps at launch
exec-once = firefox & wezterm & hyprpaper & mako & /usr/lib/polkit-kde-authentication-agent-1 & eww daemon & eww open-many bar exec-once = firefox & wezterm & hyprpaper & mako & /usr/lib/polkit-kde-authentication-agent-1 & eww daemon & eww open-many bar
exec-once = swayidle -w timeout 600 'notify-send "Locking in 30 seconds..."' timeout 630 'swaylock -f' timeout 660 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep 'swaylock -f' exec-once = swayidle -w timeout 600 'notify-send "Locking in 30 seconds..."' timeout 630 'swaylock -f' timeout 660 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' resume 'maybe-good-morning' before-sleep 'swaylock -f'
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
env = XCURSOR_SIZE,24 env = XCURSOR_SIZE,24
@ -208,3 +208,6 @@ bind = CTRL SHIFT $mainMod, L, exec, swaylock
bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow bindm = $mainMod, mouse:273, resizewindow
bind = $mainMod CTRL, space, exec, makoctl dismiss
bind = $mainMod SHIFT CTRL, space, exec, makoctl restore
bind = $mainMod SHIFT, space, exec, makoctl invoke