diff --git a/.gitignore b/.gitignore index 1dc4e4a..510ee38 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /hyprland/ignore.conf +/scheme/current.conf diff --git a/hyprland/colours.conf b/hyprland/colours.conf index 3b6bf36..270f7de 100644 --- a/hyprland/colours.conf +++ b/hyprland/colours.conf @@ -1,5 +1,6 @@ -exec = ~/.config/hypr/scripts/gen-scheme.fish hyprland -source = ~/.config/hypr/hyprland/scheme.conf +exec-once = ~/.config/hypr/scripts/monitor-scheme.fish +exec = ~/.config/hypr/scripts/gen-scheme.fish +source = ~/.config/hypr/scheme/current.conf general { col.active_border = rgba($peachd5) diff --git a/hyprland/scheme.conf b/hyprland/scheme.conf deleted file mode 100644 index 742a330..0000000 --- a/hyprland/scheme.conf +++ /dev/null @@ -1,26 +0,0 @@ -$rosewater = f4dbd6 -$flamingo = f0c6c6 -$pink = f5bde6 -$mauve = c6a0f6 -$red = ed8796 -$maroon = ee99a0 -$peach = f5a97f -$yellow = eed49f -$green = a6da95 -$teal = 8bd5ca -$sky = 91d7e3 -$sapphire = 7dc4e4 -$blue = 8aadf4 -$lavender = b7bdf8 -$text = cad3f5 -$subtext1 = b8c0e0 -$subtext0 = a5adcb -$overlay2 = 939ab7 -$overlay1 = 8087a2 -$overlay0 = 6e738d -$surface2 = 5b6078 -$surface1 = 494d64 -$surface0 = 363a4f -$base = 24273a -$mantle = 1e2030 -$crust = 181926 diff --git a/scheme/hyprland/frappe.conf b/scheme/frappe.conf similarity index 100% rename from scheme/hyprland/frappe.conf rename to scheme/frappe.conf diff --git a/scheme/hyprland/latte.conf b/scheme/latte.conf similarity index 100% rename from scheme/hyprland/latte.conf rename to scheme/latte.conf diff --git a/scheme/hyprland/macchiato.conf b/scheme/macchiato.conf similarity index 100% rename from scheme/hyprland/macchiato.conf rename to scheme/macchiato.conf diff --git a/scheme/hyprland/mocha.conf b/scheme/mocha.conf similarity index 100% rename from scheme/hyprland/mocha.conf rename to scheme/mocha.conf diff --git a/scripts/gen-scheme.fish b/scripts/gen-scheme.fish index 2177082..f693aec 100755 --- a/scripts/gen-scheme.fish +++ b/scripts/gen-scheme.fish @@ -1,32 +1,11 @@ #!/bin/fish -set -q XDG_CACHE_HOME && set cache $XDG_CACHE_HOME/caelestia || set cache ~/.cache/caelestia -set scheme_path $cache/scheme/current.txt -set lock_file $cache/locks/hypr-gen-scheme.lock -set hypr ~/.config/hypr - -set default mocha -set program $argv[1] - -function update-scheme -a scheme - cp $hypr/scheme/$program/$scheme.conf $hypr/$program/scheme.conf -end +set -q XDG_CACHE_HOME && set cache $XDG_CACHE_HOME || set cache ~/.cache +set scheme_path $cache/caelestia/scheme/current.txt +set scheme mocha if test -f $scheme_path - if test -f $lock_file - set -l scheme (cat $scheme_path) - test -f $hypr/scheme/$program/$scheme.conf && update-scheme $scheme || update-scheme $default - else - # Lock so only 1 monitor - mkdir -p (dirname $lock_file) - touch $lock_file - trap "rm $lock_file" SIGINT - - # Monitor file for changes - tail -f $scheme_path | while read line - test -f $hypr/scheme/$program/$line.conf && update-scheme $line - end - end -else - update-scheme $default + set -l current_scheme (cat $scheme_path) + test -f ~/.config/hypr/schemes/$current_scheme.conf && set scheme $current_scheme end +echo "source = ~/.config/hypr/schemes/$scheme.conf" > ~/.config/hypr/schemes/current.conf diff --git a/scripts/monitor-scheme.fish b/scripts/monitor-scheme.fish new file mode 100755 index 0000000..4d3a544 --- /dev/null +++ b/scripts/monitor-scheme.fish @@ -0,0 +1,9 @@ +#!/bin/fish + +set -q XDG_CACHE_HOME && set cache $XDG_CACHE_HOME || set cache ~/.cache +set scheme_path $cache/caelestia/scheme/current.txt +set schemes ~/.config/hypr/scheme + +inotifywait -e 'close_write,moved_to,create' -m (dirname $scheme_path) | while read dir events file + test "$dir$file" = $scheme_path && hyprctl reload +end