Omahub
← All plugins
D

Lock Keys

by Dorneles

Displays status indicators on the bar for Caps Lock, Num Lock, and Scroll Lock keys with click toggles, visual settings, and smart notifications.

Install
$ omarchy plugin add https://github.com/jvlianodorneles/lock-keys --enable
Widgets #quickshell

Lock Keys for Omarchy ⌨️

Status bar indicator plugin for Omarchy that monitors and displays the active states of Caps Lock, Num Lock, and Scroll Lock keys, with interactive click toggles, visual settings window, OSD notifications, and smart power saving.

<p align="center"> <img src="preview.png" alt="Lock Keys Plugin Preview" width="650"> </p>

✨ Features

  • ⚡ Fast & Smart Polling: Reads Linux kernel LED states directly from /sys/class/leds/ with automatic idle backoff to save battery (~4ms execution).
  • 🔔 Synchronous OSD Notifications: Displays clean on-screen notifications whenever Caps Lock, Num Lock, or Scroll Lock is toggled (can be turned on/off in settings).
  • 🖱️ Interactive Mouse Controls:
    • Left-Click: Toggles the key's state immediately (Caps Lock, Num Lock, or Scroll Lock).
    • Middle-Click: Quick-cycles through visual styles (TextCompactIcons).
    • Right-Click: Opens the visual configuration popup directly on the status bar.
  • 🎯 Configurable Display Modes:
    • Always Show: All 3 indicators are visible (active keys highlighted, inactive keys dimmed).
    • Active Only: Displays only keys that are currently active (ON). When all keys are OFF, the widget collapses and consumes 0 space on the bar.
  • 🎨 3 Label Styles:
    • Text: CAPS, NUM, SCR
    • Compact: C, N, S
    • Icons: Nerd Font glyphs (󰬈, 󰎠, 󰜎)
  • 💊 2 Badge Styles:
    • Flat: Clean minimalist transparent background.
    • Pill / Badge: Rounded capsule badge highlighting active states.
  • 📐 Orientation Responsive: Automatically adapts layout for both horizontal and vertical bars.
  • 🎨 Omarchy Theme Integration: Seamlessly follows system themes, font families, and colors (bar.urgent, bar.barForeground, bar.fontFamily).

📋 Requirements & Dependencies

  • Linux Kernel: standard /sys/class/leds/ interface (built-in).
  • Nerd Fonts: (optional) recommended for rendering glyphs in icons mode (shipped by default in Omarchy).
  • wtype: (optional) used for simulating key presses when left-clicking to toggle locks.
  • libnotify / notify-send: (optional) for OSD desktop notifications.

📦 Installation

Install directly with the Omarchy CLI:

omarchy plugin add https://github.com/jvlianodorneles/lock-keys.git --enable --yes

Or clone manually into your plugins folder:

git clone https://github.com/jvlianodorneles/lock-keys.git ~/.config/omarchy/plugins/dorneles.lock-keys
omarchy-shell shell rescanPlugins
omarchy plugin enable dorneles.lock-keys

🗑️ Removal / Uninstallation

To disable or remove the plugin from Omarchy:

# Disable the widget from the bar
omarchy plugin disable dorneles.lock-keys

# Or completely remove the plugin
omarchy plugin remove dorneles.lock-keys --yes

If installed manually:

omarchy plugin disable dorneles.lock-keys
rm -rf ~/.config/omarchy/plugins/dorneles.lock-keys
omarchy-shell shell rescanPlugins

🎮 Usage & Controls

Action Control Description
Toggle Key Left-Click Toggles state of Caps Lock, Num Lock, or Scroll Lock
Cycle Style Middle-Click Cycles styles: TextCompactIcons
Open Settings Right-Click Opens the visual configuration popup menu

⚙️ Configuration (~/.config/omarchy/shell.json)

You can configure the widget directly via the right-click popup or by editing ~/.config/omarchy/shell.json:

{
  "id": "dorneles.lock-keys",
  "mode": "always",
  "style": "icons",
  "badgeStyle": "pill",
  "showNotifications": true,
  "showCaps": true,
  "showNum": true,
  "showScroll": true
}

Options Reference

Option Type Options / Values Default Description
mode enum "always", "active-only" "always" "always" shows all keys; "active-only" shows indicators only when ON.
style enum "text", "compact", "icons" "text" Indicator label appearance.
badgeStyle enum "flat", "pill" "flat" "flat" transparent style vs "pill" capsule style.
showNotifications boolean true, false true Show brief on-screen notification on lock change.
showCaps boolean true, false true Show/hide Caps Lock indicator.
showNum boolean true, false true Show/hide Num Lock indicator.
showScroll boolean true, false true Show/hide Scroll Lock indicator.
intervalMs integer 100 - 5000 250 Active status refresh interval in ms.

📄 License

This project is licensed under the MIT License.