diff --git a/hypr-layout-switcher/README.md b/hypr-layout-switcher/README.md index 41ece0171..2bfd0bc00 100644 --- a/hypr-layout-switcher/README.md +++ b/hypr-layout-switcher/README.md @@ -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: @@ -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" } diff --git a/hypr-layout-switcher/plugin.toml b/hypr-layout-switcher/plugin.toml index f3f31b97f..ee06446ce 100644 --- a/hypr-layout-switcher/plugin.toml +++ b/hypr-layout-switcher/plugin.toml @@ -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" @@ -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 diff --git a/hypr-layout-switcher/translations/en.json b/hypr-layout-switcher/translations/en.json index 077404aaa..258b647ed 100644 --- a/hypr-layout-switcher/translations/en.json +++ b/hypr-layout-switcher/translations/en.json @@ -1,3 +1,8 @@ { - -} \ No newline at end of file + "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" + } + } +} diff --git a/hypr-layout-switcher/widget.luau b/hypr-layout-switcher/widget.luau index dc44e2c11..d1c56ae98 100644 --- a/hypr-layout-switcher/widget.luau +++ b/hypr-layout-switcher/widget.luau @@ -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)