waybar: show different modules for moby v.s. others

This commit is contained in:
2024-03-01 15:25:42 +00:00
parent c6e956f3d2
commit b6daeddfa2
3 changed files with 29 additions and 15 deletions

View File

@@ -30,9 +30,16 @@
workspace_layout = "tabbed"; workspace_layout = "tabbed";
}; };
sane.programs.waybar.config.fontSize = 14; sane.programs.waybar.config = {
sane.programs.waybar.config.height = 26; fontSize = 14;
sane.programs.waybar.config.persistWorkspaces = [ "1" "2" "3" "4" "5" ]; height = 26;
persistWorkspaces = [ "1" "2" "3" "4" "5" ];
modules.media = false;
modules.network = false;
modules.perf = false;
modules.windowTitle = false;
# TODO: show modem state
};
sane.gui.sxmo = { sane.gui.sxmo = {
nogesture = true; nogesture = true;

View File

@@ -1,6 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.sane.programs.waybar; cfg = config.sane.programs.waybar;
mkEnableOption' = default: description: lib.mkOption {
type = lib.types.bool;
inherit default description;
};
in in
{ {
sane.programs.waybar = { sane.programs.waybar = {
@@ -35,6 +39,12 @@ in
list of workspaces to always show, e.g. [ "1" "7" ] list of workspaces to always show, e.g. [ "1" "7" ]
''; '';
}; };
modules.windowTitle = mkEnableOption' true "display window title in center";
modules.media = mkEnableOption' true "display current track on right";
modules.perf = mkEnableOption' true "display RAM, CPU on right";
modules.network = mkEnableOption' true "display IP traffic on right";
top = mkOption { top = mkOption {
type = types.submodule { type = types.submodule {
# `attrsOf types.anything` (v.s. plain `attrs`) causes merging of the toplevel items. # `attrsOf types.anything` (v.s. plain `attrs`) causes merging of the toplevel items.
@@ -62,7 +72,7 @@ in
# default waybar # default waybar
config.top = pkgs.callPackage ./waybar-top.nix { } { config.top = pkgs.callPackage ./waybar-top.nix { } {
inherit (cfg.config) height persistWorkspaces; inherit (cfg.config) height modules persistWorkspaces;
}; };
packageUnwrapped = pkgs.waybar.override { packageUnwrapped = pkgs.waybar.override {

View File

@@ -9,19 +9,16 @@ let
pkgs = [ "jq" "playerctl" ]; pkgs = [ "jq" "playerctl" ];
}; };
in in
{ height, persistWorkspaces }: { height, modules, persistWorkspaces }:
{ {
inherit height; inherit height;
modules-left = lib.mkDefault [ "sway/workspaces" ]; modules-left = [ "sway/workspaces" ];
modules-center = lib.mkDefault [ "sway/window" ]; modules-center = lib.mkIf modules.windowTitle [ "sway/window" ];
modules-right = lib.mkDefault [ modules-right = lib.flatten [ # XXX can't use lib.mkMerge here without error ??
"custom/media" (lib.optionals modules.media [ "custom/media" ])
"custom/swaync" [ "custom/swaync" "clock" "battery" ]
"clock" (lib.optionals modules.perf [ "memory" "cpu" ])
"battery" (lib.optionals modules.network [ "network" ])
"memory"
"cpu"
"network"
]; ];
"sway/window" = { "sway/window" = {