nwg-panel: port config
to Nix
this makes it easier to plumb config into it, and also to comment it
This commit is contained in:
parent
d8ed82cfdf
commit
aaa40eae04
|
@ -1,153 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "panel-top",
|
||||
"output": "",
|
||||
"layer": "bottom",
|
||||
"position": "top",
|
||||
"controls": "right",
|
||||
"width": "auto",
|
||||
"height": @height@,
|
||||
"homogeneous": false,
|
||||
"margin-top": 0,
|
||||
"margin-bottom": 0,
|
||||
"padding-horizontal": 0,
|
||||
"padding-vertical": 0,
|
||||
"spacing": 0,
|
||||
"items-padding": 0,
|
||||
"icons": "light",
|
||||
"css-name": "panel-top",
|
||||
"modules-left": [
|
||||
"sway-workspaces"
|
||||
],
|
||||
"modules-center": [
|
||||
"clock"
|
||||
],
|
||||
"modules-right": [
|
||||
"playerctl"
|
||||
],
|
||||
"controls-settings": {
|
||||
"components": @components@,
|
||||
"commands": {
|
||||
"battery": ""
|
||||
},
|
||||
"show-values": false,
|
||||
"interval": 1,
|
||||
"icon-size": 16,
|
||||
"hover-opens": false,
|
||||
"leave-closes": false,
|
||||
"click-closes": false,
|
||||
"css-name": "controls-window",
|
||||
"window-width": 400,
|
||||
"custom-items": [],
|
||||
"menu": {
|
||||
"name": "Exit",
|
||||
"icon": "system-shutdown-symbolic",
|
||||
"items": [
|
||||
{
|
||||
"name": "Lock",
|
||||
"cmd": "swaylock -f -c 000000"
|
||||
},
|
||||
{
|
||||
"name": "Logout",
|
||||
"cmd": "swaymsg exit"
|
||||
},
|
||||
{
|
||||
"name": "Reboot",
|
||||
"cmd": "systemctl reboot"
|
||||
},
|
||||
{
|
||||
"name": "Shutdown",
|
||||
"cmd": "systemctl -i poweroff"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"tray": {
|
||||
"root-css-name": "tray",
|
||||
"inner-css-name": "inner-tray"
|
||||
},
|
||||
"sway-taskbar": {
|
||||
"workspace-menu": [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8"
|
||||
],
|
||||
"name-max-len": 20,
|
||||
"image-size": 16,
|
||||
"workspaces-spacing": 0,
|
||||
"task-padding": 0,
|
||||
"show-app-icon": @windowIcon@,
|
||||
"show-app-name": @windowTitle@,
|
||||
"show-layout": false,
|
||||
"workspace-buttons": false,
|
||||
"all-workspaces": true,
|
||||
"mark-autotiling": true,
|
||||
"mark-xwayland": false,
|
||||
"all-outputs": true,
|
||||
"angle": 0.0
|
||||
},
|
||||
"sway-workspaces": {
|
||||
"numbers": @workspaceNumbers@,
|
||||
"custom-labels": [],
|
||||
"focused-labels": [],
|
||||
"show-icon": @windowIcon@,
|
||||
"image-size": 16,
|
||||
"show-name": @windowTitle@,
|
||||
"name-length": 40,
|
||||
"mark-autotiling": true,
|
||||
"mark-content": false,
|
||||
"hide-empty": @workspaceHideEmpty@,
|
||||
"show-layout": false,
|
||||
"angle": 0.0
|
||||
},
|
||||
"clock": {
|
||||
"format": "%H:%M",
|
||||
"tooltip-text": "%a, %d %b %H:%M:%S",
|
||||
"on-left-click": "",
|
||||
"on-middle-click": "",
|
||||
"on-right-click": "",
|
||||
"on-scroll-up": "",
|
||||
"on-scroll-down": "",
|
||||
"css-name": "clock",
|
||||
"interval": 1,
|
||||
"tooltip-date-format": true,
|
||||
"root-css-name": "root-clock",
|
||||
"angle": 0.0,
|
||||
"calendar-path": "",
|
||||
"calendar-css-name": "calendar-window",
|
||||
"calendar-placement": "top",
|
||||
"calendar-margin-horizontal": 0,
|
||||
"calendar-margin-vertical": 0,
|
||||
"calendar-icon-size": 24,
|
||||
"calendar-interval": 60,
|
||||
"calendar-on": true
|
||||
},
|
||||
"playerctl": {
|
||||
"buttons-position": "left",
|
||||
"icon-size": 16,
|
||||
"chars": @playerctlChars@,
|
||||
"scroll": false,
|
||||
"button-css-name": "playerctl-button",
|
||||
"label-css-name": "playerctl-label",
|
||||
"interval": 2
|
||||
},
|
||||
"menu-start": "off",
|
||||
"exclusive-zone": true,
|
||||
"sigrt": 64,
|
||||
"use-sigrt": false,
|
||||
"scratchpad": {},
|
||||
"sway-mode": {},
|
||||
"openweather": {},
|
||||
"brightness-slider": {},
|
||||
"dwl-tags": {},
|
||||
"hyprland-taskbar": {},
|
||||
"hyprland-workspaces": {},
|
||||
"start-hidden": false,
|
||||
"keyboard-layout": {}
|
||||
}
|
||||
]
|
163
hosts/common/programs/nwg-panel/config.nix
Normal file
163
hosts/common/programs/nwg-panel/config.nix
Normal file
|
@ -0,0 +1,163 @@
|
|||
{
|
||||
components,
|
||||
height,
|
||||
playerctlChars,
|
||||
windowIcon,
|
||||
windowTitle,
|
||||
workspaceHideEmpty,
|
||||
workspaceNumbers,
|
||||
}:
|
||||
[
|
||||
{
|
||||
name = "panel-top";
|
||||
output = "";
|
||||
layer = "bottom";
|
||||
position = "top";
|
||||
controls = "right";
|
||||
width = "auto";
|
||||
height = height;
|
||||
homogeneous = false;
|
||||
margin-top = 0;
|
||||
margin-bottom = 0;
|
||||
padding-horizontal = 0;
|
||||
padding-vertical = 0;
|
||||
spacing = 0;
|
||||
items-padding = 0;
|
||||
icons = "light";
|
||||
css-name = "panel-top";
|
||||
modules-left = [
|
||||
"sway-workspaces"
|
||||
];
|
||||
modules-center = [
|
||||
"clock"
|
||||
];
|
||||
modules-right = [
|
||||
"playerctl"
|
||||
];
|
||||
controls-settings = {
|
||||
components = components;
|
||||
commands = {
|
||||
battery = "";
|
||||
};
|
||||
show-values = false;
|
||||
interval = 1;
|
||||
icon-size = 16;
|
||||
hover-opens = false;
|
||||
leave-closes = false;
|
||||
click-closes = false;
|
||||
css-name = "controls-window";
|
||||
window-width = 400;
|
||||
custom-items = [];
|
||||
menu = {
|
||||
name = "Exit";
|
||||
icon = "system-shutdown-symbolic";
|
||||
items = [
|
||||
{
|
||||
name = "Lock";
|
||||
cmd = "swaylock -f -c 000000";
|
||||
}
|
||||
{
|
||||
name = "Logout";
|
||||
cmd = "swaymsg exit";
|
||||
}
|
||||
{
|
||||
name = "Reboot";
|
||||
cmd = "systemctl reboot";
|
||||
}
|
||||
{
|
||||
name = "Shutdown";
|
||||
cmd = "systemctl -i poweroff";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
tray = {
|
||||
root-css-name = "tray";
|
||||
inner-css-name = "inner-tray";
|
||||
};
|
||||
sway-taskbar = {
|
||||
workspace-menu = [
|
||||
"1"
|
||||
"2"
|
||||
"3"
|
||||
"4"
|
||||
"5"
|
||||
"6"
|
||||
"7"
|
||||
"8"
|
||||
];
|
||||
name-max-len = 20;
|
||||
image-size = 16;
|
||||
workspaces-spacing = 0;
|
||||
task-padding = 0;
|
||||
show-app-icon = windowIcon;
|
||||
show-app-name = windowTitle;
|
||||
show-layout = false;
|
||||
workspace-buttons = false;
|
||||
all-workspaces = true;
|
||||
mark-autotiling = true;
|
||||
mark-xwayland = false;
|
||||
all-outputs = true;
|
||||
angle = 0.0;
|
||||
};
|
||||
sway-workspaces = {
|
||||
numbers = workspaceNumbers;
|
||||
custom-labels = [];
|
||||
focused-labels = [];
|
||||
show-icon = windowIcon;
|
||||
image-size = 16;
|
||||
show-name = windowTitle;
|
||||
name-length = 40;
|
||||
mark-autotiling = true;
|
||||
mark-content = false;
|
||||
hide-empty = workspaceHideEmpty;
|
||||
show-layout = false;
|
||||
angle = 0.0;
|
||||
};
|
||||
clock = {
|
||||
format = "%H:%M";
|
||||
tooltip-text = "%a; %d %b %H:%M:%S";
|
||||
on-left-click = "";
|
||||
on-middle-click = "";
|
||||
on-right-click = "";
|
||||
on-scroll-up = "";
|
||||
on-scroll-down = "";
|
||||
css-name = "clock";
|
||||
interval = 1;
|
||||
tooltip-date-format = true;
|
||||
root-css-name = "root-clock";
|
||||
angle = 0.0;
|
||||
calendar-path = "";
|
||||
calendar-css-name = "calendar-window";
|
||||
calendar-placement = "top";
|
||||
calendar-margin-horizontal = 0;
|
||||
calendar-margin-vertical = 0;
|
||||
calendar-icon-size = 24;
|
||||
calendar-interval = 60;
|
||||
calendar-on = true;
|
||||
};
|
||||
playerctl = {
|
||||
buttons-position = "left";
|
||||
icon-size = 16;
|
||||
chars = playerctlChars;
|
||||
scroll = false;
|
||||
button-css-name = "playerctl-button";
|
||||
label-css-name = "playerctl-label";
|
||||
interval = 2;
|
||||
};
|
||||
menu-start = "off";
|
||||
exclusive-zone = true;
|
||||
sigrt = 64;
|
||||
use-sigrt = false;
|
||||
scratchpad = {};
|
||||
sway-mode = {};
|
||||
openweather = {};
|
||||
brightness-slider = {};
|
||||
dwl-tags = {};
|
||||
hyprland-taskbar = {};
|
||||
hyprland-workspaces = {};
|
||||
start-hidden = false;
|
||||
keyboard-layout = {};
|
||||
}
|
||||
]
|
||||
|
|
@ -90,15 +90,11 @@ in
|
|||
|
||||
# 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 = 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.
|
||||
fs.".config/nwg-panel/config".symlink.target = builtins.toJSON (import ./config.nix {
|
||||
inherit (cfg.config) height windowIcon windowTitle workspaceHideEmpty workspaceNumbers;
|
||||
# component order matters, mostly for the drop-down.
|
||||
# default for most tools (e.g. swaync) is brightness control above volume.
|
||||
components =
|
||||
lib.optionals cfg.config.brightness [
|
||||
"brightness"
|
||||
] ++ [
|
||||
|
@ -107,14 +103,9 @@ in
|
|||
] ++ 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) clockFontSize fontSize;
|
||||
};
|
||||
});
|
||||
|
||||
services.nwg-panel = {
|
||||
description = "nwg-panel status/topbar for wayland";
|
||||
|
|
Loading…
Reference in New Issue
Block a user