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
13 changes: 7 additions & 6 deletions config/noctalia/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ reserve_space = true

start = ["launcher", "workspaces", "taskbar"]
center = ["clock"]
# `stoa/drive:pill` and `stoa/health:pill` are the local plugins in
# theme/noctalia-plugins/{stoa-drive,stoa-health} (plugin widgets are
# addressed as <plugin-id>:<entry-id>).
end = ["media", "tray", "notifications", "clipboard", "stoa/drive:pill", "stoa/health:pill", "sysmon", "network", "bluetooth", "volume", "brightness", "battery", "control-center", "session"]
# `stoa/drive:pill`, `stoa/health:pill` and `stoa/keybinds:pill` are the local
# plugins in theme/noctalia-plugins/{stoa-drive,stoa-health,stoa-keybinds}
# (plugin widgets are addressed as <plugin-id>:<entry-id>).
end = ["media", "tray", "notifications", "clipboard", "stoa/drive:pill", "stoa/health:pill", "stoa/keybinds:pill", "sysmon", "network", "bluetooth", "volume", "brightness", "battery", "control-center", "session"]

# ── Control centre shortcuts ──────────────────────────────────────────

Expand Down Expand Up @@ -239,7 +239,8 @@ started = "~/.local/bin/stoa-doctor"
# ── Plugins ───────────────────────────────────────────────────────────
# Stoa's local plugins live in theme/noctalia-plugins/ and are symlinked
# into ~/.local/share/noctalia/plugins by install.sh:
# stoa/drive, stoa/health bar pills (see [bar.default] above)
# stoa/drive, stoa/health, bar pills (see [bar.default] above)
# stoa/keybinds
# stoa/memento Memento Mori desktop widget (below)
# stoa/predict text-prediction popup (Super+Shift+S)
# alexander/screen-toolkit comes from the built-in community source: screen
Expand All @@ -251,7 +252,7 @@ started = "~/.local/bin/stoa-doctor"
# plugins over IPC so an existing install picks up new ones too.

[plugins]
enabled = ["stoa/drive", "stoa/health", "stoa/memento", "stoa/predict", "alexander/screen-toolkit"]
enabled = ["stoa/drive", "stoa/health", "stoa/keybinds", "stoa/memento", "stoa/predict", "alexander/screen-toolkit"]

# ── Desktop widgets ───────────────────────────────────────────────────
# One Memento Mori tile. No `output`: Noctalia puts it on the focused
Expand Down
5 changes: 4 additions & 1 deletion dotfiles/.local/state/noctalia/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,14 @@ manage_open_near_click = true
[plugin_settings."stoa/health"]
manage_open_near_click = true

[plugin_settings."stoa/keybinds"]
manage_open_near_click = true

[plugin_settings."stoa/predict"]
popup_placement = "attached"

[plugins]
enabled = [ "stoa/drive", "stoa/health", "alexander/screen-toolkit", "stoa/memento", "stoa/predict" ]
enabled = [ "stoa/drive", "stoa/health", "stoa/keybinds", "alexander/screen-toolkit", "stoa/memento", "stoa/predict" ]

[shell]
external_ip_enabled = true
Expand Down
4 changes: 3 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ _link "${STOA_DIR}/theme/noctalia-plugins/stoa-drive" \
"${NOCTALIA_PLUGINS}/stoa-drive"
_link "${STOA_DIR}/theme/noctalia-plugins/stoa-health" \
"${NOCTALIA_PLUGINS}/stoa-health"
_link "${STOA_DIR}/theme/noctalia-plugins/stoa-keybinds" \
"${NOCTALIA_PLUGINS}/stoa-keybinds"
_link "${STOA_DIR}/theme/noctalia-plugins/stoa-memento" \
"${NOCTALIA_PLUGINS}/stoa-memento"
_link "${STOA_DIR}/theme/noctalia-plugins/stoa-predict" \
Expand All @@ -161,7 +163,7 @@ _link "${STOA_DIR}/theme/noctalia-plugins/stoa-predict" \
# On a live shell, enable each through IPC instead; it appends to whatever
# the user already has and is a no-op for one already enabled.
if command -v noctalia &>/dev/null && noctalia msg plugins list &>/dev/null; then
for plugin in stoa/drive stoa/health stoa/memento stoa/predict alexander/screen-toolkit; do
for plugin in stoa/drive stoa/health stoa/keybinds stoa/memento stoa/predict alexander/screen-toolkit; do
noctalia msg plugins enable "$plugin" &>/dev/null || \
echo -e " ${S}[~] Could not enable ${plugin} (enable it in Settings → Plugins).${R}"
done
Expand Down
145 changes: 145 additions & 0 deletions theme/noctalia-plugins/stoa-keybinds/panel.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
-- ╔══════════════════════════════════════════════════════════════╗
-- ║ STOA LINUX — Keybinds panel ║
-- ║ The cheatsheet, laid out. ║
-- ╚══════════════════════════════════════════════════════════════╝
--
-- Renders the output of `stoa-keybinds-bar text` — the same text Super+/
-- shows in the yad dialog — as a scrollable list: one block per "▸"
-- section, each bind as key (left) + description (right). Nothing is
-- hard-coded here, so the panel follows the script, including its niri
-- substitutions.
--
-- Written in the Lua 5.4-compatible subset of Luau (no type annotations,
-- no if-expressions) so the CI lua step can actually parse it.

local KEYBINDS_BIN = "$HOME/.local/bin/stoa-keybinds-bar"
local TOGGLE_BIN = "$HOME/.local/bin/stoa-keybinds-toggle"

-- ── UI tree node builders (same helpers as the stoa-health panel) ──
local function node(kind, props, children)
return { type = kind, props = props or {}, children = children or {} }
end
local function col(props, children) return node("column", props, children) end
local function rowN(props, children) return node("row", props, children) end
local function lbl(props) return node("label", props) end
local function btn(props) return node("button", props) end
local function sep(props) return node("separator", props) end
local function scr(props, children) return node("scroll", props, children) end

-- ── State ──

local state = {
loaded = false,
failed = false,
-- { { title = "Window", binds = { { key = "...", desc = "..." }, ... } }, ... }
sections = {},
binds = 0,
}

-- ── Data ──

-- " Super+Return Terminal (kitty)" → key, desc. Key and
-- description are separated by two or more spaces; the key never contains
-- a space. The box-drawing banner lines and blank lines match neither
-- pattern and are skipped.
local function parseText(text)
local sections, current, binds = {}, nil, 0
for line in string.gmatch(text, "[^\n]+") do
local title = string.match(line, "^▸%s*(.+)$")
if title then
current = { title = title, binds = {} }
sections[#sections + 1] = current
elseif current then
local key, desc = string.match(line, "^%s+(%S+)%s%s+(%S.*)$")
if key then
current.binds[#current.binds + 1] = { key = key, desc = desc }
binds = binds + 1
end
end
end
state.sections = sections
state.binds = binds
end

local function load()
noctalia.runAsync(KEYBINDS_BIN .. " text", function(result)
state.loaded = true
if result.exitCode == 0 and result.stdout ~= "" then
state.failed = false
parseText(result.stdout)
else
state.failed = true
end
render()
end)
end

-- ── Rendering ──

local function bindRow(b)
return rowN({ align = "center", gap = 10 }, {
lbl({ text = b.key, fontSize = 12, fontWeight = "bold", color = "primary", width = 150 }),
lbl({ text = b.desc, fontSize = 12, flexGrow = 1 }),
})
end

local function sectionBlock(section)
local children = {
lbl({ text = section.title, fontWeight = "bold", fontSize = 13 }),
}
for _, b in ipairs(section.binds) do
children[#children + 1] = bindRow(b)
end
return col({ gap = 4 }, children)
end

local function body()
if not state.loaded then
return col({ flexGrow = 1, align = "center", justify = "center" }, {
lbl({ text = "…", color = "on_surface_variant" }),
})
end
if state.failed or #state.sections == 0 then
return col({ flexGrow = 1, align = "center", justify = "center", gap = 6 }, {
lbl({ text = "Could not read the cheatsheet", color = "error" }),
lbl({ text = "stoa-keybinds-bar text failed", color = "on_surface_variant", fontSize = 12 }),
})
end

local children = {}
for i, section in ipairs(state.sections) do
if i > 1 then children[#children + 1] = sep({ opacity = 0.3 }) end
children[#children + 1] = sectionBlock(section)
end
return scr({ flexGrow = 1, gap = 10 }, children)
end

function render()
local subtitle = ""
if state.loaded and not state.failed then
subtitle = string.format("%d binds", state.binds)
end

panel.render(col({ flexGrow = 1, gap = 10, padding = 12 }, {
rowN({ align = "center" }, {
lbl({ text = "Stoa Keybinds", fontWeight = "bold", flexGrow = 1 }),
lbl({ text = subtitle, color = "on_surface_variant", fontSize = 12 }),
}),
sep({}),
body(),
sep({}),
rowN({ gap = 6 }, {
btn({ text = "Open as window", flexGrow = 1, controlSize = "sm", variant = "outline",
onClick = function() noctalia.runAsync(TOGGLE_BIN) end }),
}),
}))
end

-- ── Lifecycle ──

function onOpen(context)
-- Re-read on every open: cheap, and it picks up a changed script or a
-- compositor switch without restarting the shell.
render()
load()
end
61 changes: 61 additions & 0 deletions theme/noctalia-plugins/stoa-keybinds/plugin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# ╔══════════════════════════════════════════════════════════════╗
# ║ STOA LINUX — Keybinds pill (Noctalia v5 plugin) ║
# ║ The cheatsheet one click away, in the bar. ║
# ╚══════════════════════════════════════════════════════════════╝
#
# Noctalia v5 ships no cheatsheet widget, so Super+/ used to be the only
# way to see the binds (a yad text dialog, scripts/stoa-keybinds-toggle.sh).
# This puts the same cheatsheet in the bar: a keyboard icon whose tooltip
# lists the sections, and an attached panel with every bind grouped the
# way the cheatsheet groups them.
#
# The data is NOT duplicated here. scripts/stoa-keybinds-bar.sh stays the
# single source of truth (it already swaps the navigation lines on niri),
# and this plugin only reads its `text` output and lays it out — so a new
# bind added to that script shows up in the panel with no change here.
#
# Optionally the compact "most-used apps" line the old waybar module
# carried can be shown next to the icon (setting `show_apps`); it follows
# STOA_SHOW_KEYBINDS from stoa.conf, same as before.

id = "stoa/keybinds"
name = "Stoa Keybinds"
version = "1.0.0"
author = "stoa"
icon = "keyboard"
description = "Keyboard shortcut cheatsheet — one icon, opens a panel with every bind"
tags = ["bar", "keybinds", "help"]

# Same floor as the other Stoa plugins: panel.luau hands inline Lua
# closures as onClick props (plugin API level 9, see stoa-drive).
plugin_api = 9

[[widget]]
id = "pill"
entry = "widget.luau"

# Attached: opens anchored below the bar icon that toggled it, same as
# stoa-drive and stoa-health.
[[panel]]
id = "cheatsheet"
entry = "panel.luau"
placement = "attached"
width = 380
height = 560

# Settings are an ARRAY of tables named `setting` (singular), each with an
# explicit `key`; `label_key` is a translation key resolved against
# translations/en.json.
[[setting]]
key = "icon"
type = "glyph"
default = "keyboard"
label_key = "settings.icon.label"
description_key = "settings.icon.description"

[[setting]]
key = "show_apps"
type = "bool"
default = false
label_key = "settings.show_apps.label"
description_key = "settings.show_apps.description"
12 changes: 12 additions & 0 deletions theme/noctalia-plugins/stoa-keybinds/translations/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"settings": {
"icon": {
"label": "Icon",
"description": "Glyph shown in the bar."
},
"show_apps": {
"label": "Show app shortcuts in the bar",
"description": "Display the compact line of the most-used app binds (Terminal, Launcher, Brave, Files…) next to the icon. Follows STOA_SHOW_KEYBINDS in stoa.conf."
}
}
}
Loading
Loading