module(waybar): Refactor waybar module
This commit is contained in:
parent
90a5b36616
commit
6c4546df9c
4 changed files with 181 additions and 129 deletions
|
|
@ -1,7 +1,14 @@
|
|||
{inputs, ...}: let
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.niri-flake.lib.kdl) node leaf flag;
|
||||
in {
|
||||
david.programs.niri = {
|
||||
waybar.settings = let
|
||||
cfg = config.david.programs.niri.waybar;
|
||||
in [(cfg.template // (cfg.mkBacklight "intel_backlight") // {output = "eDP-1";})];
|
||||
wluma.extraSettings = {
|
||||
output = {
|
||||
backlight = [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,17 @@
|
|||
{inputs, ...}: let
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.niri-flake.lib.kdl) node leaf flag;
|
||||
in {
|
||||
david.programs.niri = {
|
||||
waybar.settings = let
|
||||
cfg = config.david.programs.niri.waybar;
|
||||
in [
|
||||
(cfg.template // (cfg.helper.mkBacklight "ddcci13") // {output = "DP-3";})
|
||||
(cfg.template // (cfg.helper.mkBacklight "nvidia_0") // {output = "eDP-1";})
|
||||
];
|
||||
wluma.extraSettings = {
|
||||
output = {
|
||||
backlight = [
|
||||
|
|
@ -12,7 +22,7 @@ in {
|
|||
}
|
||||
{
|
||||
name = "DP-3";
|
||||
path = "/sys/class/backlight/ddcci15";
|
||||
path = "/sys/class/backlight/ddcci13";
|
||||
capturer = "wayland";
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -19,6 +19,21 @@ in {
|
|||
wluma.extraSettings = lib.mkOption {
|
||||
inherit (options.david.programs.wluma.extraSettings) type;
|
||||
};
|
||||
waybar = {
|
||||
template = lib.mkOption {
|
||||
readOnly = true;
|
||||
type = lib.types.anything;
|
||||
default = config.david.programs.waybar.template;
|
||||
};
|
||||
helper = lib.mkOption {
|
||||
readOnly = true;
|
||||
type = lib.types.anything;
|
||||
default = config.david.programs.waybar.helper;
|
||||
};
|
||||
settings = lib.mkOption {
|
||||
inherit (options.david.programs.waybar.settings) type;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
|
|
@ -65,7 +80,10 @@ in {
|
|||
};
|
||||
david.programs = {
|
||||
fuzzel.enable = true;
|
||||
waybar.enable = true;
|
||||
waybar = {
|
||||
enable = true;
|
||||
inherit (cfg.waybar) settings;
|
||||
};
|
||||
wluma = {
|
||||
enable = true;
|
||||
inherit (cfg.wluma) extraSettings;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
cfg = config.david.programs.waybar;
|
||||
|
|
@ -9,6 +10,145 @@ in {
|
|||
options = {
|
||||
david.programs.waybar = {
|
||||
enable = lib.mkEnableOption "waybar";
|
||||
settings = lib.mkOption {
|
||||
type = options.programs.waybar.settings.type;
|
||||
};
|
||||
template = lib.mkOption {
|
||||
readOnly = true;
|
||||
type = lib.types.anything;
|
||||
default = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
modules-left = [
|
||||
"niri/workspaces"
|
||||
"wlr/taskbar"
|
||||
];
|
||||
modules-center = ["clock"];
|
||||
modules-right = [
|
||||
"tray"
|
||||
"idle_inhibitor"
|
||||
"memory"
|
||||
"custom/backlight"
|
||||
"pulseaudio"
|
||||
"battery"
|
||||
"custom/notification"
|
||||
];
|
||||
"wlr/taskbar" = {
|
||||
on-click = "activate";
|
||||
};
|
||||
|
||||
"niri/worksapces" = {};
|
||||
"niri/taskbar" = {
|
||||
icon-size = 15;
|
||||
on-click = "activate";
|
||||
on-click-middle = "close";
|
||||
};
|
||||
"tray" = {
|
||||
icon-size = 15;
|
||||
spacing = 10;
|
||||
};
|
||||
|
||||
idle_inhibitor = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
activated = " ";
|
||||
deactivated = " ";
|
||||
};
|
||||
};
|
||||
|
||||
memory = {
|
||||
format = " {percentage}%";
|
||||
on-click = lib.getExe pkgs.resources;
|
||||
};
|
||||
|
||||
pulseaudio = {
|
||||
format = "{icon}{volume}%";
|
||||
format-bluetooth = " {volume}%";
|
||||
format-muted = " -%";
|
||||
format-source = " {volume}%";
|
||||
format-source-muted = " ";
|
||||
format-icons = {
|
||||
default = [
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
];
|
||||
headphone = " ";
|
||||
headset = " ";
|
||||
hands-free = " ";
|
||||
};
|
||||
on-click = "${lib.getExe' pkgs.wireplumber "wpctl"} set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
||||
on-click-right = lib.getExe pkgs.pwvucontrol;
|
||||
tooltip-format = "{icon}{desc} {volume}%";
|
||||
};
|
||||
|
||||
battery = {
|
||||
states = {
|
||||
warning = 30;
|
||||
critical = 15;
|
||||
};
|
||||
format = "{icon}{capacity}%";
|
||||
format-charging = " {capacity}%";
|
||||
format-icons = [
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
];
|
||||
tooltip-format = ''
|
||||
{power}W
|
||||
{timeTo}'';
|
||||
};
|
||||
|
||||
clock = {
|
||||
format = "{:%a %b %d %R}";
|
||||
calendar.format = {
|
||||
months = "<span color='#ff7b63'>{}</span>";
|
||||
days = "<span color='#ffffff'>{}</span>";
|
||||
weeks = "<span color='#8ff0a4'>W{}</span>";
|
||||
weekdays = "<span color='#f8e45c'>{}</span>";
|
||||
today = "<span color='#78aeed'><u>{}</u></span>";
|
||||
};
|
||||
actions = {
|
||||
on-scroll-up = "shift_up";
|
||||
on-scroll-down = "shift_down";
|
||||
};
|
||||
tooltip-format = "{calendar}";
|
||||
};
|
||||
"custom/notification" = {
|
||||
"tooltip" = false;
|
||||
"format" = "{icon}";
|
||||
"format-icons" = {
|
||||
"notification" = "<span foreground='red'><sup></sup></span>";
|
||||
"none" = "";
|
||||
"dnd-notification" = "<span foreground='red'><sup></sup></span>";
|
||||
"dnd-none" = "";
|
||||
};
|
||||
"return-type" = "json";
|
||||
"exec" = "swaync-client -swb";
|
||||
"on-click" = "swaync-client -t -sw";
|
||||
"on-click-right" = "swaync-client -d -sw";
|
||||
"escape" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
helper = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
readOnly = true;
|
||||
default = {
|
||||
mkBacklight = device: {
|
||||
"custom/backlight" = {
|
||||
format = "{icon}{}%";
|
||||
interval = 2;
|
||||
exec = "cat /sys/class/backlight/${device}/actual_brightness";
|
||||
format-icons = " ";
|
||||
on-scroll-up = "${lib.getExe pkgs.brightnessctl} -d ${device} set +1%";
|
||||
on-scroll-down = "${lib.getExe pkgs.brightnessctl} -d ${device} set 1%-";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
|
|
@ -16,130 +156,7 @@ in {
|
|||
programs.waybar = {
|
||||
enable = true;
|
||||
systemd.enable = false;
|
||||
settings = [
|
||||
{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
modules-left = [
|
||||
"niri/workspaces"
|
||||
"wlr/taskbar"
|
||||
];
|
||||
modules-center = ["clock"];
|
||||
modules-right = [
|
||||
"tray"
|
||||
"idle_inhibitor"
|
||||
"memory"
|
||||
"backlight"
|
||||
"pulseaudio"
|
||||
"battery"
|
||||
"custom/notification"
|
||||
];
|
||||
"wlr/taskbar" = {
|
||||
on-click = "activate";
|
||||
};
|
||||
|
||||
"niri/worksapces" = {};
|
||||
"niri/taskbar" = {
|
||||
icon-size = 15;
|
||||
on-click = "activate";
|
||||
on-click-middle = "close";
|
||||
};
|
||||
"tray" = {
|
||||
icon-size = 15;
|
||||
spacing = 10;
|
||||
};
|
||||
|
||||
idle_inhibitor = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
activated = " ";
|
||||
deactivated = " ";
|
||||
};
|
||||
};
|
||||
|
||||
memory = {
|
||||
format = " {percentage}%";
|
||||
on-click = lib.getExe pkgs.resources;
|
||||
};
|
||||
backlight = {
|
||||
format = "{icon}{percent}%";
|
||||
format-icons = " ";
|
||||
on-scroll-up = "${lib.getExe pkgs.brightnessctl} set +1%";
|
||||
on-scroll-down = "${lib.getExe pkgs.brightnessctl} set 1%-";
|
||||
};
|
||||
|
||||
pulseaudio = {
|
||||
format = "{icon}{volume}%";
|
||||
format-bluetooth = " {volume}%";
|
||||
format-muted = " -%";
|
||||
format-source = " {volume}%";
|
||||
format-source-muted = " ";
|
||||
format-icons = {
|
||||
default = [
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
];
|
||||
headphone = " ";
|
||||
headset = " ";
|
||||
hands-free = " ";
|
||||
};
|
||||
on-click = "${lib.getExe' pkgs.wireplumber "wpctl"} set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
||||
on-click-right = lib.getExe pkgs.pwvucontrol;
|
||||
tooltip-format = "{icon}{desc} {volume}%";
|
||||
};
|
||||
|
||||
battery = {
|
||||
states = {
|
||||
warning = 30;
|
||||
critical = 15;
|
||||
};
|
||||
format = "{icon}{capacity}%";
|
||||
format-charging = " {capacity}%";
|
||||
format-icons = [
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
];
|
||||
tooltip-format = ''
|
||||
{power}W
|
||||
{timeTo}'';
|
||||
};
|
||||
|
||||
clock = {
|
||||
format = "{:%a %b %d %R}";
|
||||
calendar.format = {
|
||||
months = "<span color='#ff7b63'>{}</span>";
|
||||
days = "<span color='#ffffff'>{}</span>";
|
||||
weeks = "<span color='#8ff0a4'>W{}</span>";
|
||||
weekdays = "<span color='#f8e45c'>{}</span>";
|
||||
today = "<span color='#78aeed'><u>{}</u></span>";
|
||||
};
|
||||
actions = {
|
||||
on-scroll-up = "shift_up";
|
||||
on-scroll-down = "shift_down";
|
||||
};
|
||||
tooltip-format = "{calendar}";
|
||||
};
|
||||
"custom/notification" = {
|
||||
"tooltip" = false;
|
||||
"format" = "{icon}";
|
||||
"format-icons" = {
|
||||
"notification" = "<span foreground='red'><sup></sup></span>";
|
||||
"none" = "";
|
||||
"dnd-notification" = "<span foreground='red'><sup></sup></span>";
|
||||
"dnd-none" = "";
|
||||
};
|
||||
"return-type" = "json";
|
||||
"exec" = "swaync-client -swb";
|
||||
"on-click" = "swaync-client -t -sw";
|
||||
"on-click-right" = "swaync-client -d -sw";
|
||||
"escape" = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
settings = cfg.settings;
|
||||
style = ''
|
||||
* {
|
||||
font-family: Libertinus Serif, Source Han Serif;
|
||||
|
|
@ -160,7 +177,7 @@ in {
|
|||
#tray,
|
||||
#mpris,
|
||||
#idle_inhibitor,
|
||||
#backlight,
|
||||
#custom-backlight,
|
||||
#cpu,
|
||||
#memory,
|
||||
#pulseaudio,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue