diff --git a/config/waybar/colors/pastel.css b/config/waybar/colors/pastel.css deleted file mode 100644 index 8b137891..00000000 --- a/config/waybar/colors/pastel.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/config/waybar/config.json b/config/waybar/config.json deleted file mode 100644 index 9303df22..00000000 --- a/config/waybar/config.json +++ /dev/null @@ -1,86 +0,0 @@ -[ - { - "include": [ - "~/.config/waybar/monitor.json" - ], - - "layer": "top", - "position": "top", - "height": 40, - "spacing": 4, - - "modules-left": [ - "custom/launcher", - "user", - "hyprland/window" - ], - - "modules-center": [ - "hyprland/workspaces" - ], - - "modules-right": [ - "pulseaudio", - "network", - "cpu", - "memory", - "temperature", - "clock", - "tray" - ], - - "custom/launcher": { - "format": " ", - "interval": "once", - "tooltip": false - }, - - "hyprland/workspaces": { - "all-outputs": false, - "format": "{name}", - "on-click": "activate", - "sort-by-coordinates": false, - "sort-by-name": true, - "sort-by-number": false - }, - - "pulseaudio": { - "format": " {volume}%", - "format-muted": " ", - // "on-click": "alacritty -o font.size=12 -e ncpamixer -t o" - "on-click": "kitty ncpamixer -t o" - }, - - "network": { - "format": " {ipaddr}", - "format-disconnected": " ", - "interface": "enp8s0", - "tooltip-format": "{ifname} via {gwaddr}" - }, - - "cpu": { - "format": " {load}%" - }, - - "memory": { - "format": " {percentage}%" - }, - - "temperature": { - "format": " {temperatureC}°C", - "thermal-zone": 3 - }, - - "clock": { - "format": " {:%H:%M}", - "timezone": "Europe/Berlin", - "tooltip-format": "{calendar}" - }, - - "tray": { - "icon-size": 20, - "show-passive-items": true, - "spacing": 5 - } - } -] \ No newline at end of file diff --git a/home/modules/hyprland/options.nix b/home/modules/hyprland/options.nix index e8101547..2e0b3ec1 100644 --- a/home/modules/hyprland/options.nix +++ b/home/modules/hyprland/options.nix @@ -62,6 +62,7 @@ with mylib.modules; { "kitty" ] ''; + default = []; }; delayed = mkOption { diff --git a/config/waybar/colors/foggy-lake.css b/home/modules/waybar/colors/Foggy-Lake.css similarity index 100% rename from config/waybar/colors/foggy-lake.css rename to home/modules/waybar/colors/Foggy-Lake.css diff --git a/config/waybar/colors/three-bears.css b/home/modules/waybar/colors/Three-Bears.css similarity index 100% rename from config/waybar/colors/three-bears.css rename to home/modules/waybar/colors/Three-Bears.css diff --git a/home/modules/waybar/default.nix b/home/modules/waybar/default.nix index ff25f54e..257ba933 100644 --- a/home/modules/waybar/default.nix +++ b/home/modules/waybar/default.nix @@ -1,5 +1,3 @@ -# TODO: Generate the config modularly, like with hyprland -# - It should especially be possible to set styling programatically, for themes { config, lib, @@ -10,70 +8,83 @@ with lib; with mylib.modules; let cfg = config.modules.waybar; + hyprcfg = config.modules.hyprland; in { options.modules.waybar = import ./options.nix {inherit lib mylib;}; - /* - config = let - # Taken from https://github.com/Ruixi-rebirth/flakes/blob/main/modules/programs/wayland/waybar/workspace-patch.nix - hyprctl = "${pkgs.hyprland}/bin/hyprctl"; - workspaces-patch = pkgs.writeTextFile { - name = "waybar-hyprctl.diff"; - text = '' - diff --git a/src/modules/wlr/workspace_manager.cpp b/src/modules/wlr/workspace_manager.cpp - index 6a496e6..a689be0 100644 - --- a/src/modules/wlr/workspace_manager.cpp - +++ b/src/modules/wlr/workspace_manager.cpp - @@ -511,7 +511,9 @@ auto Workspace::handle_clicked(GdkEventButton *bt) -> bool { - if (action.empty()) - return true; - else if (action == "activate") { - - zext_workspace_handle_v1_activate(workspace_handle_); - + // zext_workspace_handle_v1_activate(workspace_handle_); - + const std::string command = "${hyprctl} dispatch workspace " + name_; - + system(command.c_str()); - } else if (action == "close") { - zext_workspace_handle_v1_remove(workspace_handle_); - } else { - ''; - }; - waybar-hyprland = pkgs.waybar.overrideAttrs (oldAttrs: { - mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"]; - patches = (oldAttrs.patches or []) ++ [workspaces-patch]; - }); - in - */ config = mkIf cfg.enable { programs.waybar = { enable = true; - # package = waybar-hyprland; - package = pkgs.waybar; + systemd.enable = true; - systemd = { - enable = false; # Gets started by hyprland + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 40; + spacing = 4; + output = ["${cfg.monitor}"]; + + modules-left = ["custom/launcher" "user" "hyprland/window"]; + modules-center = ["hyprland/workspaces"]; + modules-right = ["pulseaudio" "network" "cpu" "memory" "temperature" "clock" "tray"]; + + "custom/launcher" = { + format = " "; + interval = "once"; + tooltip = false; + }; + + "hyprland/workspaces" = { + all-outputs = false; + format = "{name}"; + on-click = "activate"; + sort-by-coordinates = false; + sort-by-name = true; + sort-by-number = false; + }; + + "pulseaudio" = { + format = " {volume}%"; + format-muted = " "; + on-click = "kitty ncpamixer -t o"; + }; + + "network" = { + format = " {ipaddr}"; + format-disconnected = " "; + interface = "enp8s0"; + tooltip-format = "{ifname} via {gwaddr}"; + }; + + cpu = { + format = " {load}%"; + }; + + memory = { + format = " {percentage}%"; + }; + + temperature = { + format = " {temperatureC}°C"; + thermal-zone = 3; + }; + + clock = { + format = " {:%H:%M}"; + timezone = "Europe/Berlin"; + tooltip-format = "{calendar}"; + }; + + tray = { + icon-size = 20; + show-passive-items = true; + spacing = 5; + }; + }; }; + + style = "@import url('colors/${hyprcfg.theme}.css')" + builtins.readFile ./style.css; }; - - modules.hyprland.autostart.immediate = let - waybar-reload = pkgs.writeScript "waybar-reload" '' - #! ${pkgs.bash}/bin/bash - - trap "${pkgs.procps}/bin/pkill waybar" EXIT - - while true; do - ${pkgs.waybar}/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}" - } - ''; }; } diff --git a/config/waybar/style.css b/home/modules/waybar/style.css similarity index 57% rename from config/waybar/style.css rename to home/modules/waybar/style.css index 09f3551b..19615587 100644 --- a/config/waybar/style.css +++ b/home/modules/waybar/style.css @@ -1,4 +1,3 @@ -/*TODO: Set this through nixos module programatically*/ /*@import url("colors/three-bears.css");*/ @import url("colors/foggy-lake.css"); @@ -8,7 +7,7 @@ window#waybar { font-family: JetBrainsMono Nerd Font Mono; font-weight: bold; color: @base; - background-color: rgba(239,241,245,0.6); + background-color: rgba(239, 241, 245, 0.6); } /*Square Widgets*/ @@ -46,14 +45,36 @@ window#waybar { } /*Colors*/ -#custom-launcher { background-color: @flamingo; } -#user { background-color: @pink; } -#window { background-color: @mauve; } -#workspaces button { background-color: @red; } -#pulseaudio { background-color: @maroon; } -#network { background-color: @peach; } -#cpu { background-color: @yellow; } -#memory { background-color: @green; } -#temperature { background-color: @teal; } -#clock { background-color: @sky; } -#tray { background-color: @sapphire; } +#custom-launcher { + background-color: @flamingo; +} +#user { + background-color: @pink; +} +#window { + background-color: @mauve; +} +#workspaces button { + background-color: @red; +} +#pulseaudio { + background-color: @maroon; +} +#network { + background-color: @peach; +} +#cpu { + background-color: @yellow; +} +#memory { + background-color: @green; +} +#temperature { + background-color: @teal; +} +#clock { + background-color: @sky; +} +#tray { + background-color: @sapphire; +}