Compare commits

...

5 commits

12 changed files with 114 additions and 26 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,2 +0,0 @@
[Settings]
gtk-application-prefer-dark-theme=1

View file

@ -1,2 +0,0 @@
[Settings]
gtk-application-prefer-dark-theme=1

View file

@ -1,2 +0,0 @@
[Settings]
gtk-application-prefer-dark-theme=1

View file

@ -1,8 +1,5 @@
#!/bin/env sh
if [ "$(pidof slurp)" = "" ]; then
hyprshade off
grimblast copy area
hyprshade auto
fi

64
scripts/sunset.sh Executable file
View file

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

6
systemd/sunset.service Normal file
View file

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

11
systemd/sunset.timer Normal file
View file

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