waybar: nixify configs

This commit is contained in:
Aly Raffauf 2024-08-08 16:37:46 -04:00
parent af9554a030
commit 4b07b5d4f9

View file

@ -32,60 +32,60 @@ in {
]; ];
"hyprland/workspaces" = { "hyprland/workspaces" = {
"all-outputs" = true; all-outputs = true;
"format" = "{icon} {name}"; format = "{icon} {name}";
"format-icons" = { format-icons = {
"default" = "󰝥"; default = "󰝥";
"active" = "󰪥"; active = "󰪥";
}; };
"sort-by" = "id"; sort-by = "id";
}; };
"hyprland/submap" = { "hyprland/submap" = {
"on-click" = ''${lib.getExe' on-click = ''${lib.getExe'
config.wayland.windowManager.hyprland.package "hyprctl"} dispatch submap reset''; config.wayland.windowManager.hyprland.package "hyprctl"} dispatch submap reset'';
}; };
"sway/workspaces" = { "sway/workspaces" = {
"all-outputs" = true; all-outputs = true;
"format" = "{icon} {name}"; format = "{icon} {name}";
"format-icons" = { format-icons = {
"default" = "󰝥"; default = "󰝥";
"focused" = "󰪥"; focused = "󰪥";
}; };
"sort-by" = "id"; sort-by = "id";
}; };
"sway/mode" = { "sway/mode" = {
"on-click" = ''${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} mode default''; on-click = ''${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} mode default'';
}; };
"sway/scratchpad" = { "sway/scratchpad" = {
"format" = "{icon} {count}"; format = "{icon} {count}";
"format-icons" = ["" ""]; format-icons = ["" ""];
"show-empty" = false; show-empty = false;
"tooltip" = true; tooltip = true;
"tooltip-format" = "{app}: {title}"; tooltip-format = "{app}: {title}";
}; };
"custom/hyprland-close" = { "custom/hyprland-close" = {
"on-click" = ''${lib.getExe' on-click = ''${lib.getExe'
config.wayland.windowManager.hyprland.package "hyprctl"} dispatch killactive''; config.wayland.windowManager.hyprland.package "hyprctl"} dispatch killactive'';
"format" = "󰅗"; format = "󰅗";
"tooltip-format" = "Close the focused window."; tooltip-format = "Close the focused window.";
}; };
"clock" = { clock = {
"format" = "{:%I:%M%p}"; format = "{:%I:%M%p}";
"interval" = 60; interval = 60;
"tooltip-format" = "{:%Y-%m-%d | %H:%M}"; tooltip-format = "{:%Y-%m-%d | %H:%M}";
}; };
"battery" = let battery = let
checkBattery = pkgs.writeShellScript "check-battery" '' checkBattery = pkgs.writeShellScript "check-battery" ''
if [ -d /sys/class/power_supply/BAT0 ]; then if [ -d /sys/class/power_supply/BAT0 ]; then
BAT=/sys/class/power_supply/BAT0 BAT=/sys/class/power_supply/BAT0
@ -106,82 +106,82 @@ in {
fi fi
''; '';
in { in {
"format" = "{icon}"; format = "{icon}";
"format-icons" = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
"on-update" = "${checkBattery}"; on-update = "${checkBattery}";
"tooltip-format" = '' tooltip-format = ''
{capacity}%: {timeTo}. {capacity}%: {timeTo}.
Draw: {power} watts.''; Draw: {power} watts.'';
"states" = {"critical" = 20;}; states = {critical = 20;};
}; };
"idle_inhibitor" = { idle_inhibitor = {
"format" = "{icon}"; format = "{icon}";
"format-icons" = { format-icons = {
"activated" = "󰅶"; activated = "󰅶";
"deactivated" = "󰾪"; deactivated = "󰾪";
}; };
"timeout" = 45; timeout = 45;
"tooltip-format-activated" = '' tooltip-format-activated = ''
Presentation mode enabled. Presentation mode enabled.
System will not sleep.''; System will not sleep.'';
"tooltip-format-deactivated" = '' tooltip-format-deactivated = ''
Presentation mode disabled. Presentation mode disabled.
System will sleep normally.''; System will sleep normally.'';
}; };
"bluetooth" = { bluetooth = {
"format" = ""; format = "";
"format-connected" = " {num_connections}"; format-connected = " {num_connections}";
"format-disabled" = ""; # an empty format will hide the module format-disabled = ""; # an empty format will hide the module
"on-click" = lib.getExe' pkgs.blueberry "blueberry"; on-clic = lib.getExe' pkgs.blueberry "blueberry";
"tooltip-format" = "{controller_alias} {controller_address}"; tooltip-format = "{controller_alias} {controller_address}";
"tooltip-format-connected" = '' tooltip-format-connected = ''
{controller_alias} {controller_address} {controller_alias} {controller_address}
{device_enumerate}''; {device_enumerate}'';
"tooltip-format-enumerate-connected" = "{device_alias} {device_address}"; tooltip-format-enumerate-connected = "{device_alias} {device_address}";
}; };
"pulseaudio" = { pulseaudio = {
"format" = "{icon}"; format = "{icon}";
"format-bluetooth" = "{volume}% {icon}󰂯"; format-bluetooth = "{volume}% {icon}󰂯";
"format-muted" = ""; format-muted = "";
"format-icons" = { format-icons = {
"headphones" = "󰋋"; headphones = "󰋋";
"handsfree" = "󰋎"; handsfree = "󰋎";
"headset" = "󰋎"; headset = "󰋎";
"default" = ["" "" ""]; default = ["" "" ""];
}; };
"ignored-sinks" = ["Easy Effects Sink"]; ignored-sinks = ["Easy Effects Sink"];
"on-click" = "${lib.getExe pkgs.pavucontrol} -t 3"; on-click = "${lib.getExe pkgs.pavucontrol} -t 3";
"scroll-step" = 5; scroll-step = 5;
}; };
"network" = { network = {
"format-disabled" = "󰀝"; format-disabled = "󰀝";
"format-disconnected" = "󰀦"; format-disconnected = "󰀦";
"format-ethernet" = "󰈀"; format-ethernet = "󰈀";
"format-icons" = ["󰤟" "󰤢" "󰤥" "󰤨"]; format-icons = ["󰤟" "󰤢" "󰤥" "󰤨"];
"format-wifi" = "{icon}"; format-wifi = "{icon}";
"on-click" = "${lib.getExe pkgs.networkmanager_dmenu} -i"; on-click = "${lib.getExe pkgs.networkmanager_dmenu} -i";
"tooltip-format" = "{ifname} via {gwaddr} 󰊗"; tooltip-format = "{ifname} via {gwaddr} 󰊗";
"tooltip-format-disconnected" = "Disconnected"; tooltip-format-disconnected = "Disconnected";
"tooltip-format-ethernet" = "{ifname} "; tooltip-format-ethernet = "{ifname} ";
"tooltip-format-wifi" = "{essid} ({signalStrength}%) {icon}"; tooltip-format-wifi = "{essid} ({signalStrength}%) {icon}";
}; };
"tray" = {"spacing" = 15;}; tray = {spacing = 15;};
"custom/dnd" = let "custom/dnd" = let
mako-dnd = pkgs.writeShellScript "mako-dnd" '' mako-dnd = pkgs.writeShellScript "mako-dnd" ''
@ -202,66 +202,55 @@ in {
[ $# -gt 0 ] && toggle || show [ $# -gt 0 ] && toggle || show
''; '';
in { in {
"exec" = "${mako-dnd}"; exec = "${mako-dnd}";
"interval" = "once"; interval = "once";
"on-click" = "${mako-dnd} toggle"; on-click = "${mako-dnd} toggle";
"return-type" = "json"; return-type = "json";
"signal" = 2; signal = 2;
}; };
"custom/logout" = { "custom/logout" = {
"format" = "󰤆"; format = "󰤆";
"on-click" = ''${lib.getExe config.programs.rofi.package} -i -show power-menu -modi "power-menu:${lib.getExe pkgs.rofi-power-menu} --choices=logout/lockscreen/suspend/shutdown/reboot"''; on-click = ''${lib.getExe config.programs.rofi.package} -i -show power-menu -modi "power-menu:${lib.getExe pkgs.rofi-power-menu} --choices=logout/lockscreen/suspend/shutdown/reboot"'';
"tooltip-format" = "Manage your session."; tooltip-format = "Manage your session.";
}; };
"custom/menu" = { "custom/menu" = {
"format" = "󰀻"; format = "󰀻";
"on-click" = "${lib.getExe pkgs.nwg-drawer} -mt 5"; on-click = "${lib.getExe pkgs.nwg-drawer} -mt 5";
"tooltip-format" = "Touch-friendly application menu."; tooltip-format = "Touch-friendly application menu.";
}; };
"power-profiles-daemon" = { power-profiles-daemon = {
"format" = "{icon}"; format = "{icon}";
"format-icons" = { format-icons = {
"balanced" = "󰗑"; balanced = "󰗑";
"default" = "󱐌"; default = "󱐌";
"performance" = "󱐌"; performance = "󱐌";
"power-saver" = "󰌪"; power-saver = "󰌪";
}; };
"tooltip-format" = '' tooltip-format = ''
Profile: {profile} Profile: {profile}
Driver: {driver}''; Driver: {driver}'';
"tooltip" = true; tooltip = true;
}; };
"group/hardware" = { "group/hardware" = {
"orientation" = "horizontal"; orientation = "horizontal";
modules = ["pulseaudio" "bluetooth" "network" "power-profiles-daemon" "battery"]; modules = ["pulseaudio" "bluetooth" "network" "power-profiles-daemon" "battery"];
}; };
"group/session" = { "group/session" = {
"orientation" = "horizontal"; orientation = "horizontal";
modules = ["custom/dnd" "idle_inhibitor" "custom/logout"]; modules = ["custom/dnd" "idle_inhibitor" "custom/logout"];
}; };
}; };
}; };
systemd.enable = true; style = ''
};
systemd.user.services.waybar = {
Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"];
Service = {
Restart = lib.mkForce "on-failure";
RestartSec = 5;
};
};
xdg.configFile."waybar/style.css".text = ''
* { * {
border: none; border: none;
border-radius: 0px; border-radius: 0px;
@ -341,5 +330,16 @@ in {
background: rgba(255, 123, 99, 0.8); background: rgba(255, 123, 99, 0.8);
} }
''; '';
systemd.enable = true;
};
systemd.user.services.waybar = {
Install.WantedBy = lib.mkForce ["hyprland-session.target" "sway-session.target"];
Service = {
Restart = lib.mkForce "on-failure";
RestartSec = 5;
};
};
}; };
} }