add support for theme toggle in AGS side

This commit is contained in:
Franek 2025-05-03 06:21:15 +02:00
parent 1e6cc30ba0
commit f9e34ba18b
4 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,5 @@
{
"SHELL": "fish",
"IDLE_INHIBIT_SCRIPT": "$HOME/.config/hypr/scripts/idle-inhibitor.py",
"RANDOM_WALLPAPER_SCRIPT": "$HOME/.config/hypr/scripts/random-wallpaper.sh"
}
"SWITCH_THEME_SCRIPT": "command -v darkman &>/dev/null && darkman toggle"
}

View File

@ -5,7 +5,7 @@ import Bluetooth from "gi://AstalBluetooth";
import Hyprland from "gi://AstalHyprland";
import Network from "gi://AstalNetwork";
import { SHELL, IDLE_INHIBIT_SCRIPT, RANDOM_WALLPAPER_SCRIPT } from "@/settings.json";
import { SHELL, IDLE_INHIBIT_SCRIPT, SWITCH_THEME_SCRIPT } from "@/settings.json";
import { hideWindow, openOnButton } from "@lib/utils";
@ -118,10 +118,10 @@ export default async function QuickSettings(_monitor_id: number) {
bindingMethod={toggleIdleInhibitor.bind(null, idleInhibitorEnabled)}
/>
<Preference
icon="preferences-desktop-wallpaper-symbolic"
command={RANDOM_WALLPAPER_SCRIPT}
label="Random wallpaper"
/>
icon="applications-graphics-symbolic"
command={SWITCH_THEME_SCRIPT}
label="Switch theme"
/>
</box>
<box orientation={Gtk.Orientation.HORIZONTAL} halign={CENTER}>
<Preference

View File

@ -1 +1 @@
/nix/store/9pn39dgph6rpfvw2dmw4qn2qcsk3bqmn-home-manager-files/.config/hypr/hyprpaper.conf
/nix/store/bwhz6gwfbpjfyi8669nmdisr8vlcvrvs-home-manager-files/.config/hypr/hyprpaper.conf

12
hypr/scripts/find-generation.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env -S bash
for line in $(home-manager generations | grep -o '/.*')
do
res=$(find $line | grep specialisation | head -1)
output=$?
if [[ $output -eq 0 ]] && [[ $res != "" ]]; then
echo $res
exit
fi
done