diff --git a/config/waybar/config b/config/waybar/config.json similarity index 96% rename from config/waybar/config rename to config/waybar/config.json index 35164286..f453cd34 100644 --- a/config/waybar/config +++ b/config/waybar/config.json @@ -1,8 +1,11 @@ [ { + "include": [ + "~/.config/waybar/monitor.json" + ], + "layer": "top", "position": "top", - "output": "HDMI-A-1", "height": 40, "spacing": 4, @@ -77,6 +80,6 @@ "icon-size": 20, "show-passive-items": true, "spacing": 5 - }, + } } ] \ No newline at end of file diff --git a/home/christoph/nixinator/default.nix b/home/christoph/nixinator/default.nix index 4b795c28..20591102 100644 --- a/home/christoph/nixinator/default.nix +++ b/home/christoph/nixinator/default.nix @@ -88,6 +88,8 @@ rec { protonup = true; }; }; + + waybar.monitor = "HDMI-A-1"; }; home.packages = with pkgs; [ diff --git a/home/christoph/nixtop/default.nix b/home/christoph/nixtop/default.nix index ab77872e..030a0005 100644 --- a/home/christoph/nixtop/default.nix +++ b/home/christoph/nixtop/default.nix @@ -38,6 +38,8 @@ rec { "eDP-1" = [1 2 3 4 5 6 7 8 9]; }; }; + + waybar.monitor = "eDP-1"; }; home.packages = with pkgs; [ diff --git a/home/modules/waybar/default.nix b/home/modules/waybar/default.nix index 02f07fdb..6e48d15d 100644 --- a/home/modules/waybar/default.nix +++ b/home/modules/waybar/default.nix @@ -11,7 +11,6 @@ with lib; with mylib.modules; let cfg = config.modules.waybar; - hypr = config.modules.hyprland; in { options.modules.waybar = import ./options.nix {inherit lib mylib;}; @@ -61,13 +60,19 @@ in { trap "${pkgs.procps}/bin/pkill waybar" EXIT while true; do - ${waybar-hyprland}/bin/waybar -c $HOME/NixFlake/config/waybar/config -s $HOME/NixFlake/config/waybar/style.css & - ${pkgs.inotifyTools}/bin/inotifywait -e create,modify $HOME/NixFlake/config/waybar/config $HOME/NixFlake/config/waybar/style.css + ${waybar-hyprland}/bin/waybar -c $HOME/NixFlake/config/waybar/config.json -s $HOME/NixFlake/config/waybar/style.css & + ${pkgs.inotifyTools}/bin/inotifywait -e create,modify $HOME/NixFlake/config/waybar/config.json $HOME/NixFlake/config/waybar/style.css ${pkgs.procps}/bin/pkill waybar done ''; in [ "${waybar-reload}" ]; + + home.file.".config/waybar/monitor.json".text = '' + { + "output": "${cfg.monitor}" + } + ''; }; }