nwg-panel: fixup the formatting

especially, make it fit on moby
This commit is contained in:
Colin 2024-06-15 03:49:01 +00:00
parent ebff35a378
commit 3c2347faba
5 changed files with 49 additions and 14 deletions

View File

@ -91,7 +91,7 @@
- replace starship prompt with something more efficient
- watch `forkstat`: it does way too much
- cleanup waybar/nwg-panel so that it's not invoking playerctl every 2 seconds
- nwg-panel: alerts on battery = 0 on desko even though there's no battery
- nwg-panel: swaync icon is stuck as the refresh icon
- nwg-panel: doesn't appear on all desktops
- nwg-panel: doesn't know that virtual-desktop 10/TV exists
- install apps:

View File

@ -35,6 +35,11 @@
sane.programs."gnome.geary".config.autostart = true;
sane.programs.signal-desktop.config.autostart = true;
sane.programs.nwg-panel.config = {
battery = false;
brightness = false;
};
sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ];
# needed to use libimobiledevice/ifuse, for iphone sync

View File

@ -7,7 +7,7 @@
"controls": "right",
"width": "auto",
"height": @height@,
"homogeneous": true,
"homogeneous": false,
"margin-top": 0,
"margin-bottom": 0,
"padding-horizontal": 0,
@ -26,11 +26,7 @@
"playerctl"
],
"controls-settings": {
"components": [
"brightness",
"volume",
"battery"
],
"components": @components@,
"commands": {
"battery": ""
},
@ -41,6 +37,7 @@
"leave-closes": false,
"click-closes": false,
"css-name": "controls-window",
"window-width": 400,
"custom-items": [],
"menu": {
"name": "Exit",

View File

@ -18,6 +18,13 @@ in
default = {};
type = types.submodule {
options = {
clockFontSize = mkOption {
type = types.int;
# what looks good:
# - 15px on moby
# - 24px on lappy
default = lib.min 24 (cfg.config.fontSize - 1);
};
fontSize = mkOption {
type = types.int;
default = 16;
@ -29,6 +36,8 @@ in
height of the top bar in px.
'';
};
battery = mkEnableOption' true "display battery status";
brightness = mkEnableOption' true "display backlight level and slider";
mediaTitle = mkEnableOption' true "display title of current song/media";
mediaPrevNext = mkEnableOption' true "display prev/next button in media";
windowIcon = mkEnableOption' true "display icon of active window";
@ -60,6 +69,15 @@ in
patches = (base.patches or []) ++ lib.optionals (!cfg.config.mediaPrevNext) [
./playerctl-no-prev-next.diff
];
# disable the drop-down chevron by the controls.
# it's precious space on moby, doesn't do much to help on lappy either.
postPatch = (base.postPatch or "") + ''
substituteInPlace nwg_panel/modules/controls.py --replace-fail \
'box.pack_start(self.pan_image, False, False, 4)' \
'# box.pack_start(self.pan_image, False, False, 4)'
'';
# XXX(2024/06/13) the bluetooth stuff doesn't cross compile, so disable it
propagatedBuildInputs = lib.filter (p: p.pname != "pybluez") base.propagatedBuildInputs;
@ -70,20 +88,35 @@ in
# fs.".config/nwg-panel/style.css".symlink.target = ./style.css;
fs.".config/nwg-panel/config".symlink.target = pkgs.substituteAll {
src = ./config;
inherit (cfg.config) height windowIcon windowTitle workspaceHideEmpty;
playerctlChars = if cfg.config.mediaTitle then 30 else 0;
inherit (cfg.config) height;
windowIcon = builtins.toJSON cfg.config.windowIcon;
windowTitle = builtins.toJSON cfg.config.windowTitle;
workspaceHideEmpty = builtins.toJSON cfg.config.workspaceHideEmpty;
components = builtins.toJSON (
# order matters, mostly for the drop-down.
# default for most tools (e.g. swaync) is brightness control above volume.
lib.optionals cfg.config.brightness [
"brightness"
] ++ [
"volume"
] ++ lib.optionals cfg.config.battery [
"battery"
]
);
playerctlChars = if cfg.config.mediaTitle then 60 else 0;
workspaceNumbers = builtins.toJSON cfg.config.workspaceNumbers;
};
fs.".config/nwg-panel/style.css".symlink.target = pkgs.substituteAll {
src = ./style.css;
inherit (cfg.config) fontSize;
inherit (cfg.config) clockFontSize fontSize;
};
services.nwg-panel = {
description = "nwg-panel status/topbar for wayland";
partOf = [ "graphical-session" ];
command = "nwg-panel";
# to debug styling, run with GTK_DEBUG=interactive
command = "env G_MESSAGES_DEBUG=all nwg-panel";
};
};
}

View File

@ -145,10 +145,10 @@ scale slider {
min-width: 25px;
}
/*#clock {
#clock {
font-family: monospace;
font-size: 16px
}*/
font-size: @clockFontSize@px;
}
/* UNUSED IN MY CURRENT CONFIG: COPIED FROM SAMPLE CONFIG */