Hyprland: Use HM module for waybar config instead of own files
This commit is contained in:
@ -1 +0,0 @@
|
|||||||
|
|
@ -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": "<span font=\"FontAwesome\"></span> ",
|
|
||||||
"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": "<span font=\"FontAwesome\"></span> {volume}%",
|
|
||||||
"format-muted": "<span font=\"FontAwesome\"></span> ",
|
|
||||||
// "on-click": "alacritty -o font.size=12 -e ncpamixer -t o"
|
|
||||||
"on-click": "kitty ncpamixer -t o"
|
|
||||||
},
|
|
||||||
|
|
||||||
"network": {
|
|
||||||
"format": "<span font=\"FontAwesome\"></span> {ipaddr}",
|
|
||||||
"format-disconnected": "<span font=\"FontAwesome\"></span> ",
|
|
||||||
"interface": "enp8s0",
|
|
||||||
"tooltip-format": "{ifname} via {gwaddr}"
|
|
||||||
},
|
|
||||||
|
|
||||||
"cpu": {
|
|
||||||
"format": "<span font=\"FontAwesome\"></span> {load}%"
|
|
||||||
},
|
|
||||||
|
|
||||||
"memory": {
|
|
||||||
"format": "<span font=\"FontAwesome\"></span> {percentage}%"
|
|
||||||
},
|
|
||||||
|
|
||||||
"temperature": {
|
|
||||||
"format": "<span font=\"FontAwesome\"></span> {temperatureC}°C",
|
|
||||||
"thermal-zone": 3
|
|
||||||
},
|
|
||||||
|
|
||||||
"clock": {
|
|
||||||
"format": "<span font=\"FontAwesome\"></span> {:%H:%M}",
|
|
||||||
"timezone": "Europe/Berlin",
|
|
||||||
"tooltip-format": "<tt><small>{calendar}</small></tt>"
|
|
||||||
},
|
|
||||||
|
|
||||||
"tray": {
|
|
||||||
"icon-size": 20,
|
|
||||||
"show-passive-items": true,
|
|
||||||
"spacing": 5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
@ -62,6 +62,7 @@ with mylib.modules; {
|
|||||||
"kitty"
|
"kitty"
|
||||||
]
|
]
|
||||||
'';
|
'';
|
||||||
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
delayed = mkOption {
|
delayed = mkOption {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# TODO: Generate the config modularly, like with hyprland
|
|
||||||
# - It should especially be possible to set styling programatically, for themes
|
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
@ -10,70 +8,83 @@
|
|||||||
with lib;
|
with lib;
|
||||||
with mylib.modules; let
|
with mylib.modules; let
|
||||||
cfg = config.modules.waybar;
|
cfg = config.modules.waybar;
|
||||||
|
hyprcfg = config.modules.hyprland;
|
||||||
in {
|
in {
|
||||||
options.modules.waybar = import ./options.nix {inherit lib mylib;};
|
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 {
|
config = mkIf cfg.enable {
|
||||||
programs.waybar = {
|
programs.waybar = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# package = waybar-hyprland;
|
systemd.enable = true;
|
||||||
package = pkgs.waybar;
|
|
||||||
|
|
||||||
systemd = {
|
settings = {
|
||||||
enable = false; # Gets started by hyprland
|
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 = "<span font='FontAwesome'></span> ";
|
||||||
|
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 = "<span font='FontAwesome'></span> {volume}%";
|
||||||
|
format-muted = "<span font='FontAwesome'></span> ";
|
||||||
|
on-click = "kitty ncpamixer -t o";
|
||||||
|
};
|
||||||
|
|
||||||
|
"network" = {
|
||||||
|
format = "<span font='FontAwesome'></span> {ipaddr}";
|
||||||
|
format-disconnected = "<span font='FontAwesome'></span> ";
|
||||||
|
interface = "enp8s0";
|
||||||
|
tooltip-format = "{ifname} via {gwaddr}";
|
||||||
|
};
|
||||||
|
|
||||||
|
cpu = {
|
||||||
|
format = "<span font='FontAwesome'></span> {load}%";
|
||||||
|
};
|
||||||
|
|
||||||
|
memory = {
|
||||||
|
format = "<span font='FontAwesome'></span> {percentage}%";
|
||||||
|
};
|
||||||
|
|
||||||
|
temperature = {
|
||||||
|
format = "<span font='FontAwesome'></span> {temperatureC}°C";
|
||||||
|
thermal-zone = 3;
|
||||||
|
};
|
||||||
|
|
||||||
|
clock = {
|
||||||
|
format = "<span font='FontAwesome'></span> {:%H:%M}";
|
||||||
|
timezone = "Europe/Berlin";
|
||||||
|
tooltip-format = "<tt><small>{calendar}</small></tt>";
|
||||||
|
};
|
||||||
|
|
||||||
|
tray = {
|
||||||
|
icon-size = 20;
|
||||||
|
show-passive-items = true;
|
||||||
|
spacing = 5;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
modules.hyprland.autostart.immediate = let
|
style = "@import url('colors/${hyprcfg.theme}.css')" + builtins.readFile ./style.css;
|
||||||
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}"
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
/*TODO: Set this through nixos module programatically*/
|
|
||||||
/*@import url("colors/three-bears.css");*/
|
/*@import url("colors/three-bears.css");*/
|
||||||
@import url("colors/foggy-lake.css");
|
@import url("colors/foggy-lake.css");
|
||||||
|
|
||||||
@ -46,14 +45,36 @@ window#waybar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Colors*/
|
/*Colors*/
|
||||||
#custom-launcher { background-color: @flamingo; }
|
#custom-launcher {
|
||||||
#user { background-color: @pink; }
|
background-color: @flamingo;
|
||||||
#window { background-color: @mauve; }
|
}
|
||||||
#workspaces button { background-color: @red; }
|
#user {
|
||||||
#pulseaudio { background-color: @maroon; }
|
background-color: @pink;
|
||||||
#network { background-color: @peach; }
|
}
|
||||||
#cpu { background-color: @yellow; }
|
#window {
|
||||||
#memory { background-color: @green; }
|
background-color: @mauve;
|
||||||
#temperature { background-color: @teal; }
|
}
|
||||||
#clock { background-color: @sky; }
|
#workspaces button {
|
||||||
#tray { background-color: @sapphire; }
|
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;
|
||||||
|
}
|
Reference in New Issue
Block a user