power menu

This commit is contained in:
mjallen18
2025-11-24 18:45:35 -06:00
parent 5aaae9ca99
commit e985d6e104
5 changed files with 240 additions and 50 deletions

View File

@@ -122,6 +122,23 @@ let
background-color: transparent;
}
#custom-power {
color: ${palette.colors.primary};
background-color: ${palette.colors.bg};
${defaultOpacity}
${defaultCenterOptions}
border-radius: 0;
}
menu {
border-radius: 15px;
background: ${palette.colors.bg};
color: ${palette.colors.text};
}
menuitem {
border-radius: 15px;
}
#custom-weather {
color: ${palette.colors.primary};
background-color: ${palette.colors.bg};
@@ -130,6 +147,25 @@ let
border-radius: 0;
}
#custom-notifications {
color: ${palette.colors.primary};
background-color: ${palette.colors.bg};
${defaultOpacity}
${defaultCenterOptions}
border-radius: 0;
}
#custom-notifications.notify {
color: ${palette.colors.danger};
}
#custom-notifications.alert {
animation-name: blinker;
animation-duration: 3s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
#battery {
color: ${palette.colors.accent};
background-color: ${palette.colors.bg};
@@ -292,6 +328,7 @@ in
./options.nix
./scripts/audio-control.nix
./scripts/hass.nix
./scripts/notifications.nix
./scripts/weather.nix
];
@@ -299,6 +336,39 @@ in
# https://github.com/Alexays/Waybar/wiki/Module:-Hyprland
# https://www.nerdfonts.com/cheat-sheet
home.file = {
".config/waybar/power_menu.xml".text = ''
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkMenu" id="menu">
<child>
<object class="GtkMenuItem" id="suspend">
<property name="label">Suspend</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="hibernat">
<property name="label">Hibernate</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="shutdown">
<property name="label">Shutdown</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="delimiter1" />
</child>
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label">Reboot</property>
</object>
</child>
</object>
</interface>
'';
};
programs.waybar = {
enable = true;
systemd.enable = true;
@@ -377,15 +447,37 @@ in
};
};
"custom/notifications" = {
interval = 30;
format = { };
tooltip = true;
exec = "waybar-notifications";
return-type = "json";
on-click-middle = "makoctl restore && makoctl dismiss --all --no-history"; # todo
};
"custom/left-end" = {
format = "&nbsp";
format = "&ampnbsp";
tooltip = false;
};
"custom/right-end" = {
format = "&nbsp";
format = "&ampnbsp";
tooltip = false;
};
"custom/power" = {
format = " ";
tooltip = false;
menu = "on-click";
menu-file = "~/.config/waybar/power_menu.xml";
menu-actions = {
shutdown = "shutdown";
reboot = "reboot";
suspend = "systemctl suspend";
hibernate = "systemctl hibernate";
};
};
}
(mkIf cfg.features.tray.enable {