Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion hypr-layout-switcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ The `poller` service runs `hyprctl activeworkspace -j` once per second and publi

Clicking the widget cycles to the next layout in `dwindle → master → monocle → scrolling → dwindle`. Special workspaces (scratchpads) are handled too, matched by name instead of id.

## Settings

| Setting | Type | Default | Description |
| --- | --- | --- | --- |
| `show_label` | `bool` | `true` | Show the layout name next to the icon. Turn off for an icon-only widget. |

## IPC

The `poller` service accepts a `cycle` event, which does the same thing as clicking the widget:
Expand Down Expand Up @@ -63,7 +69,7 @@ Note that `general:layout` changes the global default, whereas the plugin's `cyc
## Notes

- **Commands spawned:** `hyprctl activeworkspace -j` every second while the plugin is enabled, and `hyprctl eval '…'` on each cycle. No network access, no files written.
- **No settings.** To change behaviour, fork the repo and add your fork as the plugin source. The layout list lives at the top of `service.luau`:
- **Layout list is fixed.** To change the list or its glyphs, use a local clone or fork. The layout list lives at the top of `service.luau`:

```lua
local layouts = { "dwindle", "master", "monocle", "scrolling" }
Expand Down
9 changes: 8 additions & 1 deletion hypr-layout-switcher/plugin.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id = "maddingo/hypr-layout-switcher"
name = "Hyprland Layout Switcher"
description = "Shows and cycles the active workspace's layout"
version = "0.1.1"
version = "0.2.0"
plugin_api = 3
author = "maddingo"
license = "MIT"
Expand All @@ -16,3 +16,10 @@ entry = "service.luau"
[[widget]]
id = "toggle"
entry = "widget.luau"

[[widget.setting]]
key = "show_label"
type = "bool"
label_key = "settings.show_label.label"
description_key = "settings.show_label.description"
default = true
9 changes: 7 additions & 2 deletions hypr-layout-switcher/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{

}
"settings": {
"show_label": {
"description": "Show the current layout's name next to the icon. Turn off for an icon-only widget.",
"label": "Show layout name"
}
}
}
6 changes: 5 additions & 1 deletion hypr-layout-switcher/widget.luau
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ local current = noctalia.state.get("layout") or "dwindle"

local function render()
barWidget.setGlyph(glyphs[current] or "layout-grid")
barWidget.setText(current:sub(1, 1):upper() .. current:sub(2))
if noctalia.getConfig("show_label") == false then
barWidget.setText("")
else
barWidget.setText(current:sub(1, 1):upper() .. current:sub(2))
end
end

noctalia.state.watch("layout", function(value)
Expand Down
Loading