nwg-panel: make configurable through nix
This commit is contained in:
parent
49ccf95fb3
commit
734da36639
|
@ -6,7 +6,7 @@
|
|||
"position": "top",
|
||||
"controls": "right",
|
||||
"width": "auto",
|
||||
"height": 40,
|
||||
"height": @height@,
|
||||
"homogeneous": true,
|
||||
"margin-top": 0,
|
||||
"margin-bottom": 0,
|
||||
|
@ -84,8 +84,8 @@
|
|||
"image-size": 16,
|
||||
"workspaces-spacing": 0,
|
||||
"task-padding": 0,
|
||||
"show-app-icon": true,
|
||||
"show-app-name": true,
|
||||
"show-app-icon": @windowIcon@,
|
||||
"show-app-name": @windowTitle@,
|
||||
"show-layout": false,
|
||||
"workspace-buttons": false,
|
||||
"all-workspaces": true,
|
||||
|
@ -109,9 +109,9 @@
|
|||
],
|
||||
"custom-labels": [],
|
||||
"focused-labels": [],
|
||||
"show-icon": true,
|
||||
"show-icon": @windowIcon@,
|
||||
"image-size": 16,
|
||||
"show-name": true,
|
||||
"show-name": @windowTitle@,
|
||||
"name-length": 40,
|
||||
"mark-autotiling": true,
|
||||
"mark-content": false,
|
||||
|
@ -144,7 +144,7 @@
|
|||
"playerctl": {
|
||||
"buttons-position": "left",
|
||||
"icon-size": 16,
|
||||
"chars": 30,
|
||||
"chars": @playerctlChars@,
|
||||
"scroll": false,
|
||||
"button-css-name": "playerctl-button",
|
||||
"label-css-name": "playerctl-label",
|
||||
|
|
|
@ -4,11 +4,56 @@
|
|||
#
|
||||
# interactively configure with: `nwg-panel-config`
|
||||
# ^ note that this may interfere with the `nwg-panel` service
|
||||
{ ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.nwg-panel;
|
||||
mkEnableOption' = default: description: lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
inherit default description;
|
||||
};
|
||||
in
|
||||
{
|
||||
sane.programs.nwg-panel = {
|
||||
fs.".config/nwg-panel/config".symlink.target = ./config;
|
||||
fs.".config/nwg-panel/style.css".symlink.target = ./style.css;
|
||||
configOption = with lib; mkOption {
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
options = {
|
||||
fontSize = mkOption {
|
||||
type = types.int;
|
||||
default = 16;
|
||||
};
|
||||
height = mkOption {
|
||||
type = types.int;
|
||||
default = 40;
|
||||
description = ''
|
||||
height of the top bar in px.
|
||||
'';
|
||||
};
|
||||
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";
|
||||
windowTitle = mkEnableOption' true "display title of active window";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
packageUnwrapped = pkgs.nwg-panel.overrideAttrs (base: {
|
||||
patches = (base.patches or []) ++ lib.optionals (!cfg.config.mediaPrevNext) [
|
||||
./playerctl-no-prev-next.diff
|
||||
];
|
||||
});
|
||||
|
||||
# fs.".config/nwg-panel/config".symlink.target = ./config;
|
||||
# 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;
|
||||
playerctlChars = if cfg.config.mediaTitle then 30 else 0;
|
||||
};
|
||||
fs.".config/nwg-panel/style.css".symlink.target = pkgs.substituteAll {
|
||||
src = ./style.css;
|
||||
inherit (cfg.config) fontSize;
|
||||
};
|
||||
|
||||
services.nwg-panel = {
|
||||
description = "nwg-panel status/topbar for wayland";
|
||||
|
|
36
hosts/common/programs/nwg-panel/playerctl-no-prev-next.diff
Normal file
36
hosts/common/programs/nwg-panel/playerctl-no-prev-next.diff
Normal file
|
@ -0,0 +1,36 @@
|
|||
diff --git a/nwg_panel/modules/playerctl.py b/nwg_panel/modules/playerctl.py
|
||||
index 9b53b4b..c4d96ae 100644
|
||||
--- a/nwg_panel/modules/playerctl.py
|
||||
+++ b/nwg_panel/modules/playerctl.py
|
||||
@@ -180,15 +180,6 @@ class Playerctl(Gtk.EventBox):
|
||||
if self.settings["angle"] != 0.0:
|
||||
button_box.set_orientation(Gtk.Orientation.VERTICAL)
|
||||
|
||||
- img = Gtk.Image()
|
||||
- update_image(img, "media-skip-backward-symbolic", self.settings["icon-size"], icons_path=self.icons_path)
|
||||
- btn = Gtk.Button()
|
||||
- btn.set_image(img)
|
||||
- if self.settings["button-css-name"]:
|
||||
- btn.set_property("name", self.settings["button-css-name"])
|
||||
- btn.connect("clicked", self.launch, self.PlayerOps.PREVIOUS)
|
||||
- button_box.pack_start(btn, False, False, 1)
|
||||
-
|
||||
self.play_pause_btn = Gtk.Button()
|
||||
if self.settings["button-css-name"]:
|
||||
self.play_pause_btn.set_property("name", self.settings["button-css-name"])
|
||||
@@ -198,15 +189,6 @@ class Playerctl(Gtk.EventBox):
|
||||
self.play_pause_btn.connect("clicked", self.launch, self.PlayerOps.PLAY_PAUSE)
|
||||
button_box.pack_start(self.play_pause_btn, False, False, 1)
|
||||
|
||||
- img = Gtk.Image()
|
||||
- update_image(img, "media-skip-forward-symbolic", self.settings["icon-size"], icons_path=self.icons_path)
|
||||
- btn = Gtk.Button()
|
||||
- btn.set_image(img)
|
||||
- if self.settings["button-css-name"]:
|
||||
- btn.set_property("name", self.settings["button-css-name"])
|
||||
- btn.connect("clicked", self.launch, self.PlayerOps.NEXT)
|
||||
- button_box.pack_start(btn, False, False, 1)
|
||||
-
|
||||
self.label = AutoScrollLabel(self.settings["scroll"],
|
||||
self.settings["chars"],
|
||||
self.settings["interval"])
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
|
||||
* {
|
||||
font-size: 16px;
|
||||
font-size: @fontSize@px;
|
||||
}
|
||||
|
||||
button {
|
||||
|
|
|
@ -56,6 +56,14 @@
|
|||
modules.windowTitle = false;
|
||||
# TODO: show modem state
|
||||
};
|
||||
sane.programs.nwg-panel.config = {
|
||||
fontSize = 14;
|
||||
height = 26;
|
||||
windowIcon = false;
|
||||
windowTitle = false;
|
||||
mediaPrevNext = false;
|
||||
mediaTitle = false;
|
||||
};
|
||||
|
||||
sane.programs.zsh.config.showDeadlines = false; # unlikely to act on them when in shell
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user