Hyprland: Use HM module for waybar config instead of own files
This commit is contained in:
37
home/modules/waybar/colors/Foggy-Lake.css
Normal file
37
home/modules/waybar/colors/Foggy-Lake.css
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
*
|
||||
* Catppuccin Latte palette
|
||||
* Maintainer: rubyowo
|
||||
*
|
||||
*/
|
||||
|
||||
@define-color base #eff1f5;
|
||||
@define-color mantle #e6e9ef;
|
||||
@define-color crust #dce0e8;
|
||||
|
||||
@define-color text #4c4f69;
|
||||
@define-color subtext0 #6c6f85;
|
||||
@define-color subtext1 #5c5f77;
|
||||
|
||||
@define-color surface0 #ccd0da;
|
||||
@define-color surface1 #bcc0cc;
|
||||
@define-color surface2 #acb0be;
|
||||
|
||||
@define-color overlay0 #9ca0b0;
|
||||
@define-color overlay1 #8c8fa1;
|
||||
@define-color overlay2 #7c7f93;
|
||||
|
||||
@define-color blue #1e66f5;
|
||||
@define-color lavender #7287fd;
|
||||
@define-color sapphire #209fb5;
|
||||
@define-color sky #04a5e5;
|
||||
@define-color teal #179299;
|
||||
@define-color green #40a02b;
|
||||
@define-color yellow #df8e1d;
|
||||
@define-color peach #fe640b;
|
||||
@define-color maroon #e64553;
|
||||
@define-color red #d20f39;
|
||||
@define-color mauve #8839ef;
|
||||
@define-color pink #ea76cb;
|
||||
@define-color flamingo #dd7878;
|
||||
@define-color rosewater #dc8a78;
|
14
home/modules/waybar/colors/Three-Bears.css
Normal file
14
home/modules/waybar/colors/Three-Bears.css
Normal file
@ -0,0 +1,14 @@
|
||||
@define-color dark #2A231C;
|
||||
@define-color light #EBEBE5;
|
||||
@define-color accent-dark #463A2E;
|
||||
@define-color accent-light #865E43;
|
||||
|
||||
@define-color pastel-a #797D62;
|
||||
@define-color pastel-b #9B9B7A;
|
||||
@define-color pastel-c #D9AE94;
|
||||
@define-color pastel-d #E5C59E;
|
||||
@define-color pastel-e #F1DCA7;
|
||||
@define-color pastel-f #F8D488;
|
||||
@define-color pastel-g #E4B074;
|
||||
@define-color pastel-h #D08C60;
|
||||
@define-color pastel-i #997B66;
|
@ -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 = "<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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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}"
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
80
home/modules/waybar/style.css
Normal file
80
home/modules/waybar/style.css
Normal file
@ -0,0 +1,80 @@
|
||||
/*@import url("colors/three-bears.css");*/
|
||||
@import url("colors/foggy-lake.css");
|
||||
|
||||
/*Order is Top-Right-Bottom-Left for combined properties*/
|
||||
|
||||
window#waybar {
|
||||
font-family: JetBrainsMono Nerd Font Mono;
|
||||
font-weight: bold;
|
||||
color: @base;
|
||||
background-color: rgba(239, 241, 245, 0.6);
|
||||
}
|
||||
|
||||
/*Square Widgets*/
|
||||
#custom-launcher,
|
||||
#workspaces button,
|
||||
#tray {
|
||||
padding: 0px 10px 0px 10px;
|
||||
margin: 5px 5px 5px 5px;
|
||||
border-radius: 6px;
|
||||
color: @base;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
color: @pink;
|
||||
}
|
||||
|
||||
/*Tux Icon*/
|
||||
#custom-launcher {
|
||||
font-size: 18px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
/*Rectangle Widgets*/
|
||||
#user,
|
||||
#window,
|
||||
#pulseaudio,
|
||||
#network,
|
||||
#cpu,
|
||||
#memory,
|
||||
#temperature,
|
||||
#clock {
|
||||
padding: 0px 10px 0px 10px;
|
||||
margin: 8px 5px 8px 5px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/*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;
|
||||
}
|
Reference in New Issue
Block a user