Skip to content

Conversation

@Erdfin
Copy link
Contributor

@Erdfin Erdfin commented Nov 24, 2025

Add the ability to customize the sorting order of the modifiers in the hotkeys popup.
Normally, the modifier keys in hotkeys get sorted before being shown in the hotkeys popup, which I didn't like, so I wanted to add a way for customizing it.
I added a new function that's only used for that, a default order and a variable that needs to be set to true for new sorting to be used. A custom order can be specified by in the rc.lua file of the user.

Normally the modifiers are sorted alphabetically before being displayed in the hotkeys popup, I now added a special sort that, by default, follows the windows hotkey order.
Feature is now activated with a boolean variable, also added comments that get parsed by LDoc to document it
YuzeHao2023

This comment was marked as spam.

@actionless
Copy link
Member

A custom order can be specified by in the rc.lua file of the user.

but that's not even what implemented in your code, did you tried running it yourself before submitting?

@Erdfin
Copy link
Contributor Author

Erdfin commented Dec 14, 2025

A custom order can be specified by in the rc.lua file of the user.

but that's not even what implemented in your code, did you tried running it yourself before submitting?

Yes, it's what I'm using on my install.

@actionless
Copy link
Member

ok, if you claiming it works for you, show how you:

"A custom order can be specified by in the rc.lua file of the user."

in your rc.lua for getting custom order

@Erdfin
Copy link
Contributor Author

Erdfin commented Dec 14, 2025

ok, if you claiming it works for you, show how you:

"A custom order can be specified by in the rc.lua file of the user."

in your rc.lua for getting custom order

Right now I'm replying from the airport, I'll get back to this once I install awesomeWM on the laptop I'm bringing with me

@actionless
Copy link
Member

there is no hurry, but i'd like to point it out, that aside of what i already mentioned above, it clearly not even building: https://github.com/awesomeWM/awesome/actions/runs/19651720043/job/58016350962?pr=4042 so please don't lie about things which they are not

@Erdfin
Copy link
Contributor Author

Erdfin commented Dec 15, 2025

To make it work I added this to the default rc.lua:

hotkeys_popup.widget.use_special_hotkey_mod_sort = true
hotkeys_popup.widget.special_hotkey_mod_order = {
	Shift = 1,
	Ctrl = 2,
	Super = 3,
	Alt = 4,
}

right after the initial part of:

-- awesome_mode: api-level=4:screen=on
-- If LuaRocks is installed, make sure that packages installed through it are
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
pcall(require, "luarocks.loader")

-- @DOC_REQUIRE_SECTION@
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
-- Declarative object management
local ruled = require("ruled")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")

Also, I'm getting:

ERROR: Parameter Super from widget.special_hotkey_mod_order awful.hotkeys_popup.widget starts with a capital letter. This is forbidden.
ERROR: Parameter Ctrl from widget.special_hotkey_mod_order awful.hotkeys_popup.widget starts with a capital letter. This is forbidden.
ERROR: Parameter Alt from widget.special_hotkey_mod_order awful.hotkeys_popup.widget starts with a capital letter. This is forbidden.
ERROR: Parameter Shift from widget.special_hotkey_mod_order awful.hotkeys_popup.widget starts with a capital letter. This is forbidden.

When running make package, but it does build an installable package.
I wanted to ask if it's preferable if I left that table undocumented instead or if I should add like a "translation" layer to avoid violating formatting rules while keeping the table in the docs.

@Erdfin
Copy link
Contributor Author

Erdfin commented Dec 15, 2025

there is no hurry, but i'd like to point it out, that aside of what i already mentioned above, it clearly not even building: https://github.com/awesomeWM/awesome/actions/runs/19651720043/job/58016350962?pr=4042 so please don't lie about things which they are not

Sorry about this, I originally only modified the widget.lua file from my install without doing a fork and then building and installing, so I messed up the LDoc comments for what I added, that and I had missed the s in modifiers. Now it builds, installs and runs on my local linux mint installation.

-- Ctrl = 2,
-- Super = 3,
-- Alt = 4,
-- }
Copy link
Member

@actionless actionless Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it would be better to have one parameter for this same thing (sorting), instead of two:

  • hotkeys_popup.widget.use_special_hotkey_mod_sort
  • hotkeys_popup.widget.special_hotkey_mod_order

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks much better now 👌😸

@actionless
Copy link
Member

actionless commented Dec 19, 2025

Also, I'm getting:
ERROR: Parameter Ctrl from widget.special_hotkey_mod_order awful.hotkeys_popup.widget starts with a capital letter. This is forbidden.
...

that's a special case (predefined X key names), so here you could put luacheck ignore comment

no, those lines are not what's causing luacheck to fail: https://github.com/awesomeWM/awesome/actions/runs/20239923820/job/58512550933?pr=4042

@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.41%. Comparing base (41473c0) to head (fe15b70).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4042       +/-   ##
===========================================
+ Coverage   54.45%   90.41%   +35.95%     
===========================================
  Files         262      938      +676     
  Lines       31196    60242    +29046     
  Branches     1139     1139               
===========================================
+ Hits        16988    54467    +37479     
+ Misses      13702     5269     -8433     
  Partials      506      506               
Files with missing lines Coverage Δ
lib/awful/hotkeys_popup/widget.lua 98.29% <100.00%> (+56.71%) ⬆️

... and 818 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

removed use_special_hotkey_mod_sort
modifier_sort_order is always used and its default is alphabetical sort
actionless
actionless previously approved these changes Dec 19, 2025
actionless
actionless previously approved these changes Dec 22, 2025
@Erdfin Erdfin requested a review from Aire-One December 31, 2025 14:52
@Aire-One Aire-One dismissed YuzeHao2023’s stale review December 31, 2025 16:44

Unnecessary bump

@actionless actionless merged commit b283220 into awesomeWM:master Jan 3, 2026
10 checks passed
@Erdfin Erdfin deleted the special_hotkey_modifier_sort branch January 7, 2026 18:30
JimmyCozza added a commit to trip-zip/somewm that referenced this pull request Jan 14, 2026
… popup

Add widget.modifier_sort_order table allowing users to customize how
modifier keys are sorted when displayed in the hotkeys popup.

Default order: Alt, Ctrl, Shift, Super (alphabetical)
Users can override in rc.lua after requiring awful.hotkeys_popup.

Upstream: awesomeWM/awesome#4042
JimmyCozza added a commit to trip-zip/somewm that referenced this pull request Jan 14, 2026
… popup (#179)

Add widget.modifier_sort_order table allowing users to customize how
modifier keys are sorted when displayed in the hotkeys popup.

Default order: Alt, Ctrl, Shift, Super (alphabetical)
Users can override in rc.lua after requiring awful.hotkeys_popup.

Upstream: awesomeWM/awesome#4042
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants