mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-01 07:26:05 +02:00
waybar: Move modules to separate attribute set
Makes it possible to use the same modules in multiple bars.
This commit is contained in:
parent
bc6f862279
commit
c143c065a2
155
home/waybar.nix
155
home/waybar.nix
@ -6,13 +6,90 @@ let
|
|||||||
position = "top";
|
position = "top";
|
||||||
opposite = builtins.replaceStrings ["left" "right" "top" "bottom"] ["right" "left" "bottom" "top"] position;
|
opposite = builtins.replaceStrings ["left" "right" "top" "bottom"] ["right" "left" "bottom" "top"] position;
|
||||||
isVertical = position == "left" || position == "right";
|
isVertical = position == "left" || position == "right";
|
||||||
|
modules = {
|
||||||
|
tray = {
|
||||||
|
icon-size = 24;
|
||||||
|
spacing = 8;
|
||||||
|
};
|
||||||
|
|
||||||
|
"wlr/taskbar" = {
|
||||||
|
icon-size = 32;
|
||||||
|
on-click = "activate";
|
||||||
|
on-click-middle = "activate";
|
||||||
|
on-click-right = "activate";
|
||||||
|
};
|
||||||
|
|
||||||
|
"hyprland/window" = {
|
||||||
|
rotate = if isVertical then 90 else 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
"wlr/workspaces" = {
|
||||||
|
on-click = "activate";
|
||||||
|
sort-by-number = true;
|
||||||
|
format = "{icon}";
|
||||||
|
format-icons = {
|
||||||
|
"1" = "一";
|
||||||
|
"2" = "二";
|
||||||
|
"3" = "三";
|
||||||
|
"4" = "四";
|
||||||
|
"5" = "五";
|
||||||
|
"6" = "六";
|
||||||
|
"7" = "七";
|
||||||
|
"8" = "八";
|
||||||
|
"9" = "九";
|
||||||
|
"10" = "十";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
wireplumber = {
|
||||||
|
format = "{icon}";
|
||||||
|
tooltip-format = "{volume}% {node_name}";
|
||||||
|
format-muted = "";
|
||||||
|
format-icons = [ "" "" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
battery = {
|
||||||
|
format = "{icon}";
|
||||||
|
tooltip-format = "{capacity}% {timeTo}";
|
||||||
|
format-icons = [ "" "" "" "" "" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
clock = {
|
||||||
|
format = if isVertical then "{:%H\n%M}" else "{:%H:%M}";
|
||||||
|
tooltip-format = "<tt>{calendar}</tt>";
|
||||||
|
calendar = {
|
||||||
|
mode = "month";
|
||||||
|
weeks-pos = "right";
|
||||||
|
format = {
|
||||||
|
months = "<span color='#ffead3'><b>{}</b></span>";
|
||||||
|
days = "<span color='#ecc6d9'><b>{}</b></span>";
|
||||||
|
weeks = "<span size='14pt' color='#99ffdd'><b>W{}</b></span>";
|
||||||
|
weekdays = "<span size='18pt' color='#ffcc66'><b>{}</b></span>";
|
||||||
|
today = "<span color='#ff6699'><b>{}</b></span>";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
backlight = {
|
||||||
|
format = "{icon}";
|
||||||
|
format-icons = [ "" "" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
"custom/new-workspace" = {
|
||||||
|
format = "+";
|
||||||
|
on-click = "hyprctl dispatch workspace empty && sleep 0.1 && rofi -show drun";
|
||||||
|
on-click-right = "sleep 0.1 && rofi -show drun";
|
||||||
|
on-click-middle = "hyprctl dispatch workspace empty";
|
||||||
|
tooltip = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.waybar = {
|
programs.waybar = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
mainBar = {
|
mainBar = modules // {
|
||||||
layer = "top";
|
layer = "top";
|
||||||
position = position;
|
position = position;
|
||||||
width = if isVertical then 45 else null;
|
width = if isVertical then 45 else null;
|
||||||
@ -25,82 +102,6 @@ in
|
|||||||
|
|
||||||
modules-left = if icons then [ "wlr/taskbar" ] else [ "wlr/workspaces" "custom/new-workspace" ];
|
modules-left = if icons then [ "wlr/taskbar" ] else [ "wlr/workspaces" "custom/new-workspace" ];
|
||||||
modules-right = [ "tray" "wireplumber" "backlight" "battery" "clock" ];
|
modules-right = [ "tray" "wireplumber" "backlight" "battery" "clock" ];
|
||||||
|
|
||||||
tray = {
|
|
||||||
icon-size = 24;
|
|
||||||
spacing = 8;
|
|
||||||
};
|
|
||||||
|
|
||||||
"wlr/taskbar" = {
|
|
||||||
icon-size = 32;
|
|
||||||
on-click = "activate";
|
|
||||||
on-click-middle = "activate";
|
|
||||||
on-click-right = "activate";
|
|
||||||
};
|
|
||||||
|
|
||||||
"hyprland/window" = {
|
|
||||||
rotate = if isVertical then 90 else 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
"wlr/workspaces" = {
|
|
||||||
on-click = "activate";
|
|
||||||
sort-by-number = true;
|
|
||||||
format = "{icon}";
|
|
||||||
format-icons = {
|
|
||||||
"1" = "一";
|
|
||||||
"2" = "二";
|
|
||||||
"3" = "三";
|
|
||||||
"4" = "四";
|
|
||||||
"5" = "五";
|
|
||||||
"6" = "六";
|
|
||||||
"7" = "七";
|
|
||||||
"8" = "八";
|
|
||||||
"9" = "九";
|
|
||||||
"10" = "十";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
wireplumber = {
|
|
||||||
format = "{icon}";
|
|
||||||
tooltip-format = "{volume}% {node_name}";
|
|
||||||
format-muted = "";
|
|
||||||
format-icons = [ "" "" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
battery = {
|
|
||||||
format = "{icon}";
|
|
||||||
tooltip-format = "{capacity}% {timeTo}";
|
|
||||||
format-icons = [ "" "" "" "" "" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
clock = {
|
|
||||||
format = if isVertical then "{:%H\n%M}" else "{:%H:%M}";
|
|
||||||
tooltip-format = "<tt>{calendar}</tt>";
|
|
||||||
calendar = {
|
|
||||||
mode = "month";
|
|
||||||
weeks-pos = "right";
|
|
||||||
format = {
|
|
||||||
months = "<span color='#ffead3'><b>{}</b></span>";
|
|
||||||
days = "<span color='#ecc6d9'><b>{}</b></span>";
|
|
||||||
weeks = "<span size='14pt' color='#99ffdd'><b>W{}</b></span>";
|
|
||||||
weekdays = "<span size='18pt' color='#ffcc66'><b>{}</b></span>";
|
|
||||||
today = "<span color='#ff6699'><b>{}</b></span>";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
backlight = {
|
|
||||||
format = "{icon}";
|
|
||||||
format-icons = [ "" "" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
"custom/new-workspace" = {
|
|
||||||
format = "+";
|
|
||||||
on-click = "hyprctl dispatch workspace empty && sleep 0.1 && rofi -show drun";
|
|
||||||
on-click-right = "sleep 0.1 && rofi -show drun";
|
|
||||||
on-click-middle = "hyprctl dispatch workspace empty";
|
|
||||||
tooltip = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user