Tune waybar a bit, allow multi-monitor differences

This commit is contained in:
Natsu Kagami 2023-06-15 11:26:33 +02:00
parent d531f78075
commit 193f82f288
Signed by: nki
GPG key ID: 55A032EB38B49ADB
2 changed files with 172 additions and 158 deletions

View file

@ -64,6 +64,12 @@
};
nki.programs.kitty.enable = true;
nki.programs.kitty.fontSize = 14;
programs.my-sway.waybar.makeBars = barWith: [
# For primary
(barWith { extraSettings = { output = [ "AOC U28G2G6B PPYP2JA000013" ]; }; })
# For secondary, hide mpd
(barWith { showMedia = false; showConnectivity = false; extraSettings = { output = [ "AOC 24G2W1G4 ATNN21A005410" ]; }; })
];
# Yellow light!
services.wlsunset = {

View file

@ -94,9 +94,14 @@ in
};
waybar = {
makeBars = mkOption {
type = types.raw;
description = "Create bars with the barWith function, return a list of bars";
default = barWith: [ (barWith { }) ];
};
extraSettings = mkOption {
type = types.attrs;
description = "Additional settings for the default waybar";
type = types.raw;
description = "Extra settings to be included with every default bar";
default = { };
};
extraStyle = mkOption {
@ -367,12 +372,9 @@ in
];
};
config.programs.waybar = mkIf cfg.enable {
enable = true;
systemd.enable = true;
settings = [
# Top bar
(mkMerge [{
config.programs.waybar =
let
barWith = { showMedia ? true, showConnectivity ? true, extraSettings ? { }, ... }: (mkMerge [{
position = "top";
modules-left = [
"sway/workspaces"
@ -381,20 +383,20 @@ in
];
modules-center = [
];
modules-right = [
(if cfg.enableMpd then "mpd" else "custom/media")
modules-right =
lib.optional showMedia (if cfg.enableMpd then "mpd" else "custom/media")
++ [
"tray"
"pulseaudio"
] ++ lib.optionals showConnectivity [
"bluetooth"
"network"
] ++ [
"cpu"
"memory"
"temperature"
] ++ (
if cfg.enableLaptopBars
then [ "battery" "battery#bat2" ]
else [ ]
) ++ [
] ++ lib.optionals cfg.enableLaptopBars [ "battery" "battery#bat2" ]
++ [
"clock"
];
@ -409,13 +411,14 @@ in
max-length = 70;
format = "{title}";
"rewrite" = {
"(.*) Mozilla Firefox" = "🌎 $1";
"(.*) - Kakoune" = "$1";
"(.*) - fish" = ">_ $1";
"(.*) - Discord" = "🗨 $1";
"(.*) Mozilla Firefox" = "[🌎] $1";
"(.*) - Mozilla Thunderbird" = "[📧] $1";
"(.*) - Kakoune" = "[] $1";
"(.*) - fish" = "[>_] $1";
"(.*) - Discord" = "[🗨] $1";
# ArmCord thing
" Discord \\| (.*)" = "🗨 $1";
"\\((\\d+)\\) Discord \\| (.*)" = "🗨 [$1] $2";
" Discord \\| (.*)" = "[🗨] $1";
"\\((\\d+)\\) Discord \\| (.*)" = "[🗨] {$1} $2";
};
};
"tray" = {
@ -534,8 +537,13 @@ in
};
};
}
cfg.waybar.extraSettings])
];
cfg.waybar.extraSettings
extraSettings]);
in
mkIf cfg.enable {
enable = true;
systemd.enable = true;
settings = cfg.waybar.makeBars barWith;
style = ''
* {
border: none;