diff --git a/modules/services/window-managers/labwc/function.nix b/modules/services/window-managers/labwc/function.nix
index e1505795..dd3fa03f 100644
--- a/modules/services/window-managers/labwc/function.nix
+++ b/modules/services/window-managers/labwc/function.nix
@@ -27,19 +27,27 @@ let
let
idAttr = " id=\"${escape item.menuId}\"";
labelAttr = if item ? label then " label=\"${escape item.label}\"" else "";
+ iconAttr = if item ? icon then " icon=\"${escape item.icon}\"" else "";
children = if item ? items then lib.concatMapStringsSep "\n" generateMenu item.items else "";
+ executeAttr = if item ? execute then " execute=\"${escape item.execute}\"" else "";
+ outputMenu =
+ if item ? execute || children == "" then
+ "
"
+ else
+ "";
in
- ""
+ outputMenu
else
let
labelAttr = " label=\"${escape item.label}\"";
+ iconAttr = if item ? icon then " icon=\"${escape item.icon}\"" else "";
action = item.action;
nameAttr = " name=\"${escape action.name}\"";
toAttr = if action ? to then " to=\"${escape action.to}\"" else "";
commandAttr = if action ? command then " command=\"${escape action.command}\"" else "";
in
- "- \n \n
";
+ "- \n \n
";
# Get keys in a preferred order
orderedKeys =
diff --git a/modules/services/window-managers/labwc/labwc.nix b/modules/services/window-managers/labwc/labwc.nix
index 443715c7..e6efb08c 100644
--- a/modules/services/window-managers/labwc/labwc.nix
+++ b/modules/services/window-managers/labwc/labwc.nix
@@ -100,6 +100,11 @@ in
description = "Config to configure labwc menu";
example = lib.literalExpression ''
[
+ {
+ label = "pipemenu";
+ menuId = "menu";
+ execute = "/home/user/nix/scripts/pipe.sh";
+ }
{
menuId = "client-menu";
label = "Client Menu";
@@ -118,12 +123,6 @@ in
name = "ToggleFullscreen";
};
}
- {
- label = "Always on Top";
- action = {
- name = "ToggleAlwaysOnTop";
- };
- }
{
label = "Alacritty";
action = {
diff --git a/tests/modules/services/window-managers/labwc/labwc-menu.nix b/tests/modules/services/window-managers/labwc/labwc-menu.nix
index f42b3e85..f6e842ca 100644
--- a/tests/modules/services/window-managers/labwc/labwc-menu.nix
+++ b/tests/modules/services/window-managers/labwc/labwc-menu.nix
@@ -3,14 +3,19 @@
enable = true;
package = null;
menu = [
+ {
+ label = "pipemenu";
+ menuId = "menu";
+ execute = "/home/user/nix/scripts/pipe.sh";
+ }
{
menuId = "client-menu";
label = "Client Menu";
- icon = "";
+ icon = "path";
items = [
{
label = "Maximize";
- icon = "";
+ icon = "Max";
action = {
name = "ToggleMaximize";
};
@@ -61,17 +66,16 @@
{
menuId = "menu-two";
label = "Client Menu Two";
- icon = "";
+ icon = "menu-two";
items = [
{
label = "Menu In Menu";
menuId = "menu-in-menu";
- icon = "";
items = [
{
label = "Menu In Menu In Menu";
menuId = "menu-in-menu-in-menu";
- icon = "";
+ icon = "menu-in-menu-in-menu";
items = [
{
label = "Move Right";
@@ -80,12 +84,14 @@
to = "right";
};
}
+ { menuId = "fourth"; }
];
}
];
}
];
}
+ #
{ menuId = ""; }
];
};
diff --git a/tests/modules/services/window-managers/labwc/menu.xml b/tests/modules/services/window-managers/labwc/menu.xml
index 6ba0821c..6faf980b 100644
--- a/tests/modules/services/window-managers/labwc/menu.xml
+++ b/tests/modules/services/window-managers/labwc/menu.xml
@@ -1,8 +1,9 @@
-