Move waybar modules into importable nix expressions

This commit is contained in:
Evie Litherland-Smith 2023-07-10 16:09:25 +01:00
parent 7a3534ee1b
commit 733d86c759
21 changed files with 212 additions and 266 deletions

View file

@ -1,6 +1,4 @@
{...}: let
modules = import ./modules.nix;
in {
{...}: {
imports = [./default.nix];
programs.waybar.settings.laptop = {
layer = "top";
@ -27,16 +25,16 @@ in {
"battery#compact"
"tray"
];
"clock#compact" = modules."clock#compact";
cpu = modules.cpu;
memory = modules.memory;
temperature = modules.temperature;
"wlr/workspaces" = modules."wlr/workspaces";
"pulseaudio#compact" = modules."pulseaudio#compact";
"bluetooth#compact" = modules."bluetooth#compact";
"network#compact" = modules."network#compact";
backlight = modules.backlight;
"battery#compact" = modules."battery#compact";
tray = modules.tray;
"clock#compact" = import ./modules/clock.compact.nix;
cpu = import ./modules/cpu.nix;
memory = import ./modules/memory.nix;
temperature = import ./modules/temperature.nix;
"wlr/workspaces" = import ./modules/wlr_workspaces.nix;
"pulseaudio#compact" = import ./modules/pulseaudio.compact.nix;
"bluetooth#compact" = import ./modules/bluetooth.compact.nix;
"network#compact" = import ./modules/network.compact.nix;
backlight = import ./modules/backlight.nix;
"battery#compact" = import ./modules/battery.compact.nix;
tray = import ./modules/tray.nix;
};
}

View file

@ -1,6 +1,4 @@
{...}: let
modules = import ./modules.nix;
in {
{...}: {
imports = [./default.nix];
programs.waybar.settings.main = {
layer = "top";
@ -26,16 +24,16 @@ in {
"battery"
"tray"
];
clock = modules.clock;
cpu = modules.cpu;
memory = modules.memory;
temperature = modules.temperature;
"wlr/workspaces" = modules."wlr/workspaces";
pulseaudio = modules.pulseaudio;
bluetooth = modules.bluetooth;
network = modules.network;
backlight = modules.backlight;
battery = modules.battery;
tray = modules.tray;
clock = import ./modules/clock.nix;
cpu = import ./modules/cpu.nix;
memory = import ./modules/memory.nix;
temperature = import ./modules/temperature.nix;
"wlr/workspaces" = import ./modules/wlr_workspaces.nix;
pulseaudio = import ./modules/pulseaudio.nix;
bluetooth = import ./modules/bluetooth.nix;
network = import ./modules/network.nix;
backlight = import ./modules/backlight.nix;
battery = import ./modules/battery.nix;
tray = import ./modules/tray.nix;
};
}

View file

@ -1,232 +0,0 @@
{
keyboard-state = {
numlock = true;
capslock = true;
format = "{name} {icon}";
format-icons = {
locked = "";
unlocked = "";
};
};
tray.spacing = 10;
clock = {
format = "{:%A %Y-%m-%d 󰃭 | %R 󰅐 }";
tooltip-format = "<tt>{calendar}</tt>";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "right";
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
actions = {
on-click-right = "mode";
on-click-forward = "tz_up";
on-click-backward = "tz_down";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
};
"clock#compact" = {
format = "{:%R 󰅐 }";
format-alt = "{:%A %Y-%m-%d 󰃭 }";
tooltip-format = "<tt>{calendar}</tt>";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "right";
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
};
cpu = {
format = "{usage}% 󰻠";
tooltip = false;
};
memory.format = "{}% 󰍛";
temperature = {
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [
"󱃃"
"󰔏"
"󱃂"
];
};
backlight = {
format = "{icon}";
tooltip-format = "{percent}%";
format-icons = [
""
""
""
""
""
""
""
""
""
];
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{time} {capacity}% {icon}";
format-charging = "{time} {capacity}% 󰂄";
format-plugged = "{capacity}% 󰚥";
format-icons = [
"󱃍"
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
};
"battery#compact" = {
states = {
warning = 30;
critical = 15;
};
format = "{icon}";
format-charging = "󰂄";
format-plugged = "󰚥";
tooltip-format = "{time} {capacity}%";
format-icons = [
"󱃍"
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
};
network = {
format-wifi = "{essid} ({signalStrength}%) 󰖩";
format-ethernet = "Connected 󰈁";
tooltip-format = "{ifname}";
format-linked = "{ifname} (No IP) 󰈁";
format-disconnected = "Disconnected 󰈂";
on-click = "nm-connection-editor";
};
"network#compact" = {
format-wifi = "({signalStrength}%) 󰖩";
format-ethernet = "󰈁";
tooltip-format = "{essid}";
format-linked = "(No IP) 󰈁";
format-disconnected = "󰈂";
on-click = "nm-connection-editor";
};
bluetooth = {
format = "󰂯 {status}";
format-disabled = "󰂲 {status}";
format-off = "󰂲 {status}";
format-on = "󰂯 {status}";
format-connected = "󰂱 {device_alias}";
on-click = "blueman-manager";
};
"bluetooth#compact" = {
format = "󰂯";
format-disabled = "󰂲";
format-off = "󰂲";
format-on = "󰂯";
format-connected = "󰂱";
tooltip-format = "{status} | {device_alias}";
on-click = "blueman-manager";
};
pulseaudio = {
scroll-step = 5;
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = "󰝟 {icon} {format_source}";
format-muted = "󰝟 {format_source}";
format-source = "{volume}% 󰍬";
format-source-muted = "󰍭";
format-icons = {
headphone = "󰋋";
hands-free = "󰥰";
headset = "󰋎";
phone = "󰏲";
portable = "󰏳";
car = "󰄍";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
on-click = "pavucontrol";
};
"pulseaudio#compact" = {
scroll-step = 5;
format = "{icon} {format_source}";
format-bluetooth = "{icon} {format_source}";
format-bluetooth-muted = "󰝟 {icon} {format_source}";
format-muted = "󰝟 {format_source}";
format-source = "󰍬";
format-source-muted = "󰍭";
format-icons = {
headphone = "󰋋";
hands-free = "󰥰";
headset = "󰋎";
phone = "󰏲";
portable = "󰏳";
car = "󰄍";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
on-click = "pavucontrol";
};
"custom/power" = {
format = "󰐥";
on-click = "powermenu";
};
"wlr/workspaces" = {
on-click = "activate";
disable-scroll = true;
all-outputs = false;
format = "{icon}";
format-icons = {
"1" = "󰟀";
"2" = "󰅴";
"3" = "󰈹";
"4" = "󰝰";
"5" = "󰭹";
"6" = "";
"7" = "󰓓";
"8" = "󰣙";
urgent = "";
default = "󰣘";
};
sort-by-number = true;
};
}

View file

@ -0,0 +1,5 @@
{
format = "{icon}";
tooltip-format = "{percent}%";
format-icons = ["" "" "" "" "" "" "" "" ""];
}

View file

@ -0,0 +1,11 @@
{
states = {
warning = 30;
critical = 15;
};
format = "{icon}";
format-charging = "󰂄";
format-plugged = "󰚥";
tooltip-format = "{time} {capacity}%";
format-icons = ["󱃍" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
}

View file

@ -0,0 +1,10 @@
{
states = {
warning = 30;
critical = 15;
};
format = "{time} {capacity}% {icon}";
format-charging = "{time} {capacity}% 󰂄";
format-plugged = "{capacity}% 󰚥";
format-icons = ["󱃍" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
}

View file

@ -0,0 +1,9 @@
{
format = "󰂯";
format-disabled = "󰂲";
format-off = "󰂲";
format-on = "󰂯";
format-connected = "󰂱";
tooltip-format = "{status} | {device_alias}";
on-click = "blueman-manager";
}

View file

@ -0,0 +1,8 @@
{
format = "󰂯 {status}";
format-disabled = "󰂲 {status}";
format-off = "󰂲 {status}";
format-on = "󰂯 {status}";
format-connected = "󰂱 {device_alias}";
on-click = "blueman-manager";
}

View file

@ -0,0 +1,19 @@
{
format = "{:%R 󰅐 }";
format-alt = "{:%A %Y-%m-%d 󰃭 }";
tooltip-format = "<tt>{calendar}</tt>";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "right";
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
}

View file

@ -0,0 +1,25 @@
{
format = "{:%A %Y-%m-%d 󰃭 | %R 󰅐 }";
tooltip-format = "<tt>{calendar}</tt>";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "right";
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
actions = {
on-click-right = "mode";
on-click-forward = "tz_up";
on-click-backward = "tz_down";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
}

View file

@ -0,0 +1,4 @@
{
format = "{usage}% 󰻠";
tooltip = false;
}

View file

@ -0,0 +1,9 @@
{
numlock = true;
capslock = true;
format = "{name} {icon}";
format-icons = {
locked = "";
unlocked = "";
};
}

View file

@ -0,0 +1 @@
{format = "{}% 󰍛";}

View file

@ -0,0 +1,8 @@
{
format-wifi = "({signalStrength}%) 󰖩";
format-ethernet = "󰈁";
tooltip-format = "{essid}";
format-linked = "(No IP) 󰈁";
format-disconnected = "󰈂";
on-click = "nm-connection-editor";
}

View file

@ -0,0 +1,8 @@
{
format-wifi = "{essid} ({signalStrength}%) 󰖩";
format-ethernet = "Connected 󰈁";
tooltip-format = "{ifname}";
format-linked = "{ifname} (No IP) 󰈁";
format-disconnected = "Disconnected 󰈂";
on-click = "nm-connection-editor";
}

View file

@ -0,0 +1,23 @@
{
scroll-step = 5;
format = "{icon} {format_source}";
format-bluetooth = "{icon} {format_source}";
format-bluetooth-muted = "󰝟 {icon} {format_source}";
format-muted = "󰝟 {format_source}";
format-source = "󰍬";
format-source-muted = "󰍭";
format-icons = {
headphone = "󰋋";
hands-free = "󰥰";
headset = "󰋎";
phone = "󰏲";
portable = "󰏳";
car = "󰄍";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
on-click = "pavucontrol";
}

View file

@ -0,0 +1,19 @@
{
scroll-step = 5;
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = "󰝟 {icon} {format_source}";
format-muted = "󰝟 {format_source}";
format-source = "{volume}% 󰍬";
format-source-muted = "󰍭";
format-icons = {
headphone = "󰋋";
hands-free = "󰥰";
headset = "󰋎";
phone = "󰏲";
portable = "󰏳";
car = "󰄍";
default = ["󰕿" "󰖀" "󰕾"];
};
on-click = "pavucontrol";
}

View file

@ -0,0 +1,5 @@
{
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = ["󱃃" "󰔏" "󱃂"];
}

View file

@ -0,0 +1 @@
{spacing = 10;}

View file

@ -0,0 +1,19 @@
{
on-click = "activate";
disable-scroll = true;
all-outputs = false;
format = "{icon}";
format-icons = {
"1" = "󰟀";
"2" = "󰅴";
"3" = "󰈹";
"4" = "󰝰";
"5" = "󰭹";
"6" = "";
"7" = "󰓓";
"8" = "󰣙";
urgent = "";
default = "󰣘";
};
sort-by-number = true;
}

View file

@ -1,6 +1,4 @@
{...}: let
modules = import ./modules.nix;
in {
{...}: {
imports = [./default.nix];
programs.waybar.settings = {
vertical = {
@ -14,9 +12,9 @@ in {
"modules-left" = ["wlr/workspaces"];
"modules-center" = ["clock#compact"];
"modules-right" = ["tray"];
"wlr/workspaces" = modules."wlr/workspaces";
"clock#compact" = modules."clock#compact";
tray = modules.tray;
"wlr/workspaces" = import ./modules/wlr_workspaces.nix;
"clock#compact" = import ./modules/clock.compact.nix;
tray = import ./modules/tray.nix;
};
};
}