waybar: add waybar module
This commit is contained in:
parent
606a6cae37
commit
c077841ce5
3 changed files with 243 additions and 0 deletions
13
trivionomicon/modules/waybar/default.nix
Normal file
13
trivionomicon/modules/waybar/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
doctrine,
|
||||
...
|
||||
}:
|
||||
doctrine.lib.mkModule {
|
||||
inherit config;
|
||||
name = "waybar";
|
||||
hm = ./hm.nix;
|
||||
options = ./options.nix;
|
||||
}
|
207
trivionomicon/modules/waybar/hm.nix
Normal file
207
trivionomicon/modules/waybar/hm.nix
Normal file
|
@ -0,0 +1,207 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
cfg,
|
||||
doctrine,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
settings = {
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 20;
|
||||
spacing = 0;
|
||||
|
||||
modules-left = [
|
||||
"sway/workspaces"
|
||||
"sway/mode"
|
||||
];
|
||||
modules-center = [
|
||||
"clock"
|
||||
];
|
||||
|
||||
modules-right =
|
||||
[
|
||||
"keyboard-state"
|
||||
"privacy"
|
||||
"idle_inhibitor"
|
||||
"cpu"
|
||||
"memory"
|
||||
"disk"
|
||||
"temperature"
|
||||
"tray"
|
||||
]
|
||||
++ lists.optionals cfg.battery [
|
||||
"battery"
|
||||
];
|
||||
battery = mkIf cfg.battery {
|
||||
format = "{capacity}% {icon}";
|
||||
format-plugged = "{capacity}% {icon}";
|
||||
format-icons = ["" "" "" "" "" "" "" "" "" "" ""];
|
||||
states = {
|
||||
warning = 20;
|
||||
critical = 10;
|
||||
};
|
||||
};
|
||||
keyboard-state = {
|
||||
capslock = true;
|
||||
format.capslock = "{icon}";
|
||||
format-icons = {
|
||||
locked = " ";
|
||||
unlocked = "";
|
||||
};
|
||||
};
|
||||
idle_inhibitor = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
activated = " ";
|
||||
deactivated = " ";
|
||||
};
|
||||
};
|
||||
tray = {
|
||||
icon-size = 13;
|
||||
spacing = 8;
|
||||
};
|
||||
clock = {
|
||||
interval = 60;
|
||||
format = "{:%A %B %d %Y %H:%M}";
|
||||
tooltip = false;
|
||||
};
|
||||
cpu = {
|
||||
format = " {usage}%";
|
||||
tooltip = false;
|
||||
};
|
||||
memory = {
|
||||
format = " {percentage}% ";
|
||||
tooltip = true;
|
||||
tooltip-format = "{used}/{total}";
|
||||
};
|
||||
disk = {
|
||||
format = " {specific_used:0.0f}/{specific_total:0.0f}";
|
||||
unit = "GiB";
|
||||
tooltip = false;
|
||||
};
|
||||
temperature = {
|
||||
format = " {temperatureC}°C";
|
||||
};
|
||||
privacy = {
|
||||
icon-size = 12;
|
||||
};
|
||||
};
|
||||
};
|
||||
style = ''
|
||||
* {
|
||||
font-family: "${cfg.fontFamily}", monospace;
|
||||
font-size: ${cfg.fontSize};
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Entire bar: fully transparent, no border */
|
||||
window#waybar {
|
||||
background: transparent;
|
||||
color: #eaeaea;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Optional: small edge breathing room (comment out if you want edge-to-edge) */
|
||||
/* window#waybar { margin: 3px 6px 0 6px; } */
|
||||
|
||||
/* Module containers */
|
||||
.modules-left, .modules-center, .modules-right {
|
||||
padding: 0;
|
||||
margin: 0 6px;
|
||||
}
|
||||
|
||||
/* Subtle separators between modules (no boxes) */
|
||||
.modules-left > widget:not(:first-child),
|
||||
.modules-center > widget:not(:first-child),
|
||||
.modules-right > widget:not(:first-child) {
|
||||
margin-left: 12px;
|
||||
padding-left: 12px;
|
||||
border-left: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
/* Tightest possible workspaces */
|
||||
#workspaces { padding: 0; margin: 0; }
|
||||
#workspaces button {
|
||||
margin: 0;
|
||||
padding: 0 3px;
|
||||
min-width: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
color: #cfcfcf;
|
||||
}
|
||||
#workspaces button:hover {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
#workspaces button.active,
|
||||
#workspaces button.focused {
|
||||
background: rgba(255, 255, 255, 0.10);
|
||||
color: #ffffff;
|
||||
box-shadow: inset 0 -2px #ffffff;
|
||||
}
|
||||
#workspaces button.urgent {
|
||||
background: rgba(255, 80, 80, 0.25);
|
||||
box-shadow: inset 0 -2px #ff5050;
|
||||
}
|
||||
|
||||
/* Focused window title: single line, no glow */
|
||||
#window {
|
||||
padding: 0 6px;
|
||||
margin: 0;
|
||||
color: #dedede;
|
||||
}
|
||||
|
||||
/* Sway mode indicator: visible only when active, no bloat */
|
||||
#mode {
|
||||
padding: 0 6px;
|
||||
margin: 0;
|
||||
background: rgba(255, 255, 255, 0.10);
|
||||
color: #ffffff;
|
||||
box-shadow: inset 0 -2px #ffffff;
|
||||
}
|
||||
|
||||
/* Status modules — keep them flat and compact */
|
||||
#clock, #battery, #network, #pulseaudio, #backlight, #cpu, #memory, #temperature, #tray {
|
||||
padding: 0 6px;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
color: #eaeaea;
|
||||
}
|
||||
|
||||
/* States (battery, network, audio) */
|
||||
#battery.charging { color: #27f902; }
|
||||
#battery.warning:not(.charging) { color: #fc8b02; }
|
||||
#battery.critical:not(.charging) { color: #fc0000; }
|
||||
|
||||
#network.disconnected { color: #ffb4b4; }
|
||||
#pulseaudio.muted { color: #9aa0a6; }
|
||||
|
||||
/* Tray: compress icons */
|
||||
#tray > .passive { opacity: 0.6; }
|
||||
#tray > .needs-attention { opacity: 1; }
|
||||
|
||||
/* Tooltips: clean and readable */
|
||||
tooltip {
|
||||
background: rgba(30, 30, 30, 0.95);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
color: #eaeaea;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
|
||||
/* Remove any leftover borders around everything */
|
||||
#custom-*, #idle_inhibitor, #privacy, #bluetooth {
|
||||
border: none;
|
||||
background: transparent;
|
||||
margin: 0;
|
||||
padding: 0 6px;
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
23
trivionomicon/modules/waybar/options.nix
Normal file
23
trivionomicon/modules/waybar/options.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{lib, ...}:
|
||||
with lib.types; {
|
||||
hm = {
|
||||
battery = lib.mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
`true` to display battery info
|
||||
'';
|
||||
};
|
||||
fontFamily = lib.mkOption {
|
||||
type = str;
|
||||
example = "JetBrainsMono Nerd Font";
|
||||
description = ''
|
||||
needs to be a nerdfont
|
||||
'';
|
||||
};
|
||||
fontSize = lib.mkOption {
|
||||
type = str;
|
||||
default = "12px";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue