diff --git a/README.md b/README.md index d15dc3d..6b9c1ef 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ The dotfiles are managed with [TOML Bombadil](https://github.com/oknozor/toml-bo ## TODO -* hyprsunset - * Ramp throughout day * Wallpaper * Adjust to time of day * Make sure changed wallpaper is new diff --git a/autostart/1password.desktop b/autostart/1password.desktop new file mode 100644 index 0000000..3e87903 --- /dev/null +++ b/autostart/1password.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=1Password +Exec=/opt/1Password/1password --silent %U +Terminal=false +Type=Application +Icon=1password +StartupWMClass=1Password +Comment=Password manager and secure wallet +MimeType=x-scheme-handler/onepassword; +Categories=Office; diff --git a/autostart/megasync.desktop b/autostart/megasync.desktop new file mode 100644 index 0000000..0cd5686 --- /dev/null +++ b/autostart/megasync.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Type=Application +Version=1.0 +GenericName=File Synchronizer +Name=MEGAsync +Comment=Easy automated syncing between your computers and your MEGA cloud drive. +TryExec=megasync +Exec=/usr/bin/env sh -c "sleep 15;megasync" +Icon=mega +Terminal=false +Categories=Network;System; +StartupNotify=false +X-GNOME-Autostart-Delay=60 diff --git a/bombadil.toml b/bombadil.toml index 8e5ffd6..9810c71 100644 --- a/bombadil.toml +++ b/bombadil.toml @@ -16,12 +16,17 @@ editorconfig = { source = "home/.editorconfig", target = ".editorconfig" } electron = { source = "config/electron-flags.conf", target = ".config/electron-flags.conf" } discord = { source = "config/electron-flags.conf", target = ".config/discord-flags.conf" } +1password = { source = "autostart/1password.desktop", target = ".config/autostart/1password.desktop" } +megasync = { source = "autostart/megasync.desktop", target = ".config/autostart/megasync.desktop" } + git = { source = "git/config", target = ".config/git/config" } -# Also needs a `systemctl --user enable --now eww-daemon.service eww-bars.service ip-geolocation.service swww-daemon.service' +# Also needs a one-time `systemctl --user enable --now eww-daemon.service eww-bars.service ip-geolocation.service sunset.timer swww-daemon.service' eww-daemon = { source = "systemd/eww-daemon.service", target = ".config/systemd/user/eww-daemon.service" } eww-bars = { source = "systemd/eww-bars.service", target = ".config/systemd/user/eww-bars.service" } ip-geolocation = { source = "systemd/ip-geolocation.service", target = ".config/systemd/user/ip-geolocation.service" } +sunset-service = { source = "systemd/sunset.service", target = ".config/systemd/user/sunset.service" } +sunset-timer = { source = "systemd/sunset.timer", target = ".config/systemd/user/sunset.timer" } swww-daemon = { source = "systemd/swww-daemon.service", target = ".config/systemd/user/swww-daemon.service" } btop = { source = "btop", target = ".config/btop" } @@ -30,9 +35,6 @@ eww = { source = "eww", target = ".config/eww"} fastfetch = { source = "fastfetch", target = ".config/fastfetch" } gtk2 = { source = "gtk/gtk-2.0", target = ".config/gtk-2.0" } gtk3 = { source = "gtk/gtk-3.0", target = ".config/gtk-3.0" } -gtk4 = { source = "gtk/gtk-4.0", target = ".config/gtk-4.0" } -gtk5 = { source = "gtk/gtk-5.0", target = ".config/gtk-5.0" } -gtk6 = { source = "gtk/gtk-6.0", target = ".config/gtk-6.0" } hypr = { source = "hypr", target = ".config/hypr" } kitty = { source = "kitty", target = ".config/kitty" } lsd = { source = "lsd", target = ".config/lsd" } diff --git a/eww/eww.yuck b/eww/eww.yuck index 7350ff9..626bc06 100644 --- a/eww/eww.yuck +++ b/eww/eww.yuck @@ -115,8 +115,8 @@ (defwidget clicker [text command] (eventbox :onclick command :cursor "pointer" :timeout "3600s" (label :text text :class "primary"))) -(defwidget color_selector [] - (clicker :text "" :command "hyprpicker -a & disown")) +(defwidget colour_selector [] + (clicker :text "" :command "uwsm-app -- hyprpicker -a")) (defwidget wallpaper [] (clicker :text "󰸉" :command "~/scripts/swww_change.py")) @@ -132,13 +132,6 @@ (label_value :text {battery.charging ? "󰂄" : battery.icon} :value "${battery.charge}%" :value_class {battery.charge < 30 ? "alert" : ""})) -; This is really hacky - a deflisten on a script using gdbus would be better -(defpoll shader :interval 60 "sh -c 'systemctl --user status sunset.service | cat'") -(defwidget shader [] - (eventbox :onclick "systemctl --user ${arraylength(search(shader, "activating")) == 0 ? "--no-block start" : "stop"} sunset.service" :cursor "pointer" - (label :text {arraylength(search(shader, "activating")) == 0 ? "" : "󰖔"} :class "primary"))) - - (defpoll weather :interval 300 "~/scripts/get-weather.sh") (defpoll weather_icons :interval 0 :run-while false "cat ~/.config/eww/scripts/weather-icons.json") (defwidget weather [] @@ -170,8 +163,8 @@ (systray :pack_direction "ltr" :icon-size 20) (box :class "right" :orientation "h" :space-evenly false :halign "end" (gametime)(space) + (colour_selector)(space) (wallpaper)(space) - (shader)(sep) (mountpoint :label "/" :mount "/")(space) (mountpoint :label "󰋊" :mount "/home/mbradley/hdd")(sep) (ram)(space) @@ -188,7 +181,7 @@ (systray :pack_direction "ltr" :icon-size 20) (box :class "right" :orientation "h" :space-evenly false :halign "end" (weather)(sep) - (color_selector)(space) + (colour_selector)(space) (wallpaper)(sep) (ram)(space) (cpu)(sep) diff --git a/gtk/gtk-4.0/settings.ini b/gtk/gtk-4.0/settings.ini deleted file mode 100755 index 29322c1..0000000 --- a/gtk/gtk-4.0/settings.ini +++ /dev/null @@ -1,2 +0,0 @@ -[Settings] -gtk-application-prefer-dark-theme=1 diff --git a/gtk/gtk-5.0/settings.ini b/gtk/gtk-5.0/settings.ini deleted file mode 100755 index 29322c1..0000000 --- a/gtk/gtk-5.0/settings.ini +++ /dev/null @@ -1,2 +0,0 @@ -[Settings] -gtk-application-prefer-dark-theme=1 diff --git a/gtk/gtk-6.0/settings.ini b/gtk/gtk-6.0/settings.ini deleted file mode 100755 index 29322c1..0000000 --- a/gtk/gtk-6.0/settings.ini +++ /dev/null @@ -1,2 +0,0 @@ -[Settings] -gtk-application-prefer-dark-theme=1 diff --git a/scripts/screenshot.sh b/scripts/screenshot.sh index 5cd8197..b210fd9 100755 --- a/scripts/screenshot.sh +++ b/scripts/screenshot.sh @@ -1,8 +1,5 @@ #!/bin/env sh if [ "$(pidof slurp)" = "" ]; then - hyprshade off grimblast copy area - hyprshade auto fi - diff --git a/scripts/sunset.sh b/scripts/sunset.sh new file mode 100755 index 0000000..873db0f --- /dev/null +++ b/scripts/sunset.sh @@ -0,0 +1,64 @@ +#!/bin/env sh + +SUNRISE_START="$((5 * 60 * 60))" # When to start turning up temperature +SUNRISE_END="$((7 * 60 * 60))" # When to reach max temperature + +SUNSET_START="$((21 * 60 * 60))" # When to start turning down temperature +SUNSET_END="$((23 * 60 * 60))" # When to reach min temperature + +DAY_TEMP="6000" # Display temperature (K) to use in full daylight +NIGHT_TEMP="2400" # Display temperature (K) to use at night + +CURRENT="$(((($(date '+%H') * 60) + $(date '+%M')) * 60 + $(date '+%S')))" # Time in seconds since start of day + +# Performs a calculation using an argument containing an input string +calc() { + echo "scale=4; $1" | bc +} + +# Evaluates a boolean expression on an argument containing an input string +bool() { + echo "scale=1; $1" | bc +} + +# GLSL Smoothstep, takes a single number as an argument +smoothstep() { + if [ "$(bool "$1 <= 0")" = "1" ]; then + echo 0 + elif [ "$(bool "$1 >= 1")" = "1" ]; then + echo 1 + else + calc "$1 * $1 * (3 - 2 * $1)" + fi +} + +# Interpolates between the 4th and 5th arguments based on the value of the 2nd in relation to the 1st and 3rd +interpolate() { + LOWER_IN="$1" + VALUE="$2" + UPPER_IN="$3" + LOWER_OUT="$4" + UPPER_OUT="$5" + + if [ "$((VALUE <= LOWER_IN))" = "1" ]; then + echo "$LOWER_OUT" + elif [ "$((VALUE < UPPER_IN))" = "1" ]; then + calc "$LOWER_OUT + (($UPPER_OUT - $LOWER_OUT) * $(smoothstep "$(calc "($VALUE - $LOWER_IN) / ($UPPER_IN - $LOWER_IN)")"))" + else + echo "$UPPER_OUT" + fi +} + +if [ "$((CURRENT <= SUNRISE_START))" = "1" ]; then + TEMP="$NIGHT_TEMP" +elif [ "$((CURRENT < SUNRISE_END))" = "1" ]; then + TEMP="$(interpolate "$SUNRISE_START" "$CURRENT" "$SUNRISE_END" "$NIGHT_TEMP" "$DAY_TEMP")" +elif [ "$((CURRENT <= SUNSET_START))" = "1" ]; then + TEMP="$DAY_TEMP" +elif [ "$((CURRENT < SUNSET_END))" = "1" ]; then + TEMP="$(interpolate "$SUNSET_START" "$CURRENT" "$SUNSET_END" "$DAY_TEMP" "$NIGHT_TEMP")" +else + TEMP="$NIGHT_TEMP" +fi + +hyprctl hyprsunset temperature "$TEMP" diff --git a/systemd/sunset.service b/systemd/sunset.service new file mode 100644 index 0000000..4fa5f55 --- /dev/null +++ b/systemd/sunset.service @@ -0,0 +1,6 @@ +[Unit] +Description=Sets the monitor temperature based on the time of day + +[Service] +Type=oneshot +ExecStart=/home/mbradley/scripts/sunset.sh diff --git a/systemd/sunset.timer b/systemd/sunset.timer new file mode 100644 index 0000000..2f2da6c --- /dev/null +++ b/systemd/sunset.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Changes the monitor temperature over the course of the day to ease eye strain +After=graphical-session.target +After=hyprsunset.service + +[Timer] +OnCalendar=*-*-* *:*:00 +Persistent=true + +[Install] +WantedBy=timers.target