From 78f5931d70a3a6dd0549110d167fc81cfb22f52b Mon Sep 17 00:00:00 2001 From: Tyler Kelley Date: Wed, 17 Jan 2024 02:17:12 -0600 Subject: [PATCH] Adding Theme Changing Script --- config/hyprland.nix | 2 ++ config/scripts/themechange.nix | 11 +++++++++++ flake.nix | 5 +++-- home.nix | 4 +++- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 config/scripts/themechange.nix diff --git a/config/hyprland.nix b/config/hyprland.nix index 85ee2dd..8ee160a 100644 --- a/config/hyprland.nix +++ b/config/hyprland.nix @@ -76,6 +76,8 @@ env = QT_QPA_PLATFORM, wayland env = QT_WAYLAND_DISABLE_WINDOWDECORATION, 1 env = QT_AUTO_SCREEN_SCALE_FACTOR, 1 env = MOZ_ENABLE_WAYLAND, 1 +#env = WLR_NO_HARDWARE_CURSORS,1 +#env = WLR_RENDERER_ALLOW_SOFTWARE,1 exec-once = dbus-update-activation-environment --systemd --all exec-once = systemctl --user import-environment QT_QPA_PLATFORMTHEME WAYLAND_DISPLAY XDG_CURRENT_DESKTOP diff --git a/config/scripts/themechange.nix b/config/scripts/themechange.nix new file mode 100644 index 0000000..19e0bff --- /dev/null +++ b/config/scripts/themechange.nix @@ -0,0 +1,11 @@ +{ pkgs, flakeDir, }: + +pkgs.writeShellScriptBin "themechange" '' + if [[ ! $@ ]];then + echo "No Theme Given" + else + replacement="$1" + sed -i "/^\s*theme[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$replacement\"/" ${flakeDir}/flake.nix + fi + +'' diff --git a/flake.nix b/flake.nix index 413722a..554c872 100644 --- a/flake.nix +++ b/flake.nix @@ -22,8 +22,9 @@ theTimezone = "America/Chicago"; theme = "tokyo-night-storm"; browser = "firefox"; - wallpaperDir = "/home/${username}/Pictures/Wallpapers"; wallpaperGit = "https://gitlab.com/Zaney/my-wallpapers.git"; + wallpaperDir = "/home/${username}/Pictures/Wallpapers"; + flakeDir = "/home/zaney/zaneyos"; pkgs = import nixpkgs { inherit system; @@ -61,7 +62,7 @@ home-manager.nixosModules.home-manager { home-manager.extraSpecialArgs = { inherit username; inherit gitUsername; inherit gitEmail; inherit inputs; inherit theme; - inherit browser; inherit wallpaperDir; inherit wallpaperGit; + inherit browser; inherit wallpaperDir; inherit wallpaperGit; inherit flakeDir; inherit (inputs.nix-colors.lib-contrib {inherit pkgs;}) gtkThemeFromScheme; }; home-manager.useGlobalPkgs = true; diff --git a/home.nix b/home.nix index f6e3a38..e052c19 100644 --- a/home.nix +++ b/home.nix @@ -1,6 +1,7 @@ { config, pkgs, inputs, username, gitUsername, gitEmail, gtkThemeFromScheme, - theme, browser, wallpaperDir, wallpaperGit, ... }: + theme, browser, wallpaperDir, wallpaperGit, + flakeDir, ... }: { # Home Manager Settings @@ -68,6 +69,7 @@ (import ./config/scripts/task-waybar.nix { inherit pkgs; }) (import ./config/scripts/squirtle.nix { inherit pkgs; }) (import ./config/scripts/wallsetter.nix { inherit pkgs; inherit wallpaperDir; }) + (import ./config/scripts/themechange.nix { inherit pkgs; inherit flakeDir; }) ];