systray_hints/README.md

59 lines
3.0 KiB
Markdown
Raw Normal View History

2022-02-10 07:53:04 +01:00
We are surprised at the time of this writing that the system tray remains such an obvious bottleneck in the nevertheless ubiquitous fight against mouse-dependency among neckbeards the world over. We present accordingly, systray_hints.
2022-01-07 22:58:30 +01:00
# Overview
2022-01-07 22:18:49 +01:00
2022-02-09 00:42:18 +01:00
When `systray_hints.run()` is executed, a popup widget displays numbers next to each icon in the system tray while keygrabber listens for input. The number entered on the keyboard sends a right click to the corresponding icon and the original position of the mouse pointer is restored. For most programs this opens a context menu the user may then navigate using arrow keys and pressing Return.
2022-01-07 22:18:49 +01:00
2022-02-09 00:42:18 +01:00
The default option of a right click may be overriden on the fly by pressing the Left or Right arrow key before making a selection for a left or right click, respectively. Alternatively, pressing either the Up or Down key will bypass all clicking and the pointer is simply moved to the location of the selected icon to display its on-hover tooltip, if any.
2022-01-07 22:58:30 +01:00
2022-02-09 00:42:18 +01:00
If ten or more icons are displayed, the function will interpret the "1" key as the first digit of the selection and wait for the second digit, or wait for the Return key. Up to 19 icons are supported.
2022-01-07 22:18:49 +01:00
2022-02-09 00:42:18 +01:00
# Install
2022-01-07 22:18:49 +01:00
2022-02-09 00:42:18 +01:00
cd ~/.config/awesome
2022-02-09 02:09:16 +01:00
git clone https://github.com/ryanthomas-org/systray-hints
2022-01-07 22:18:49 +01:00
2022-02-10 07:53:04 +01:00
Add `systray_hints = require("systray_hints")` to rc.lua. Note this may work better at the end of the file.
2022-01-07 22:58:30 +01:00
2022-02-09 00:42:18 +01:00
# Configuration
2022-02-09 00:42:18 +01:00
If the system tray is normally hidden in your environment and toggled as needed with a keybinding, you can replace that keybinding with something like this:
2022-01-07 22:45:54 +01:00
awful.key({ modkey }, "s", function ()
local s
awful.screen.connect_for_each_screen(
function(screen) if screen.systray then s = screen end
end)
2022-02-09 00:42:18 +01:00
if s.systray.visible then
s.systray.visible = false
2022-01-07 22:45:54 +01:00
else
2022-02-09 00:42:18 +01:00
systray_hints.run()
2022-01-07 22:45:54 +01:00
end
2022-02-09 00:42:18 +01:00
end, {description="toggle systray with hints", group="awesome"}),
2022-02-09 00:42:18 +01:00
The `systray_hints.run()` function will automatically unhide the system tray as needed and will return it to its original visiblity state whenever a selection is not made.
2022-02-09 00:42:18 +01:00
If your system tray is always displayed, simply create a keybinding like the following:
2022-02-09 00:42:18 +01:00
awful.key({ modkey }, "s", function ()
2022-01-07 22:18:49 +01:00
2022-02-09 00:42:18 +01:00
local s
awful.screen.connect_for_each_screen(
function(screen) if screen.systray then s = screen end
end)
2022-01-07 22:58:30 +01:00
2022-02-09 00:42:18 +01:00
systray_hints.run()
2022-02-09 00:42:18 +01:00
end, {description="toggle systray hints", group="awesome"}),
# Issues
2022-01-07 22:18:49 +01:00
2022-02-09 00:42:18 +01:00
The ability to obtain the geometry of the system tray is not referenced in the awesome API for a reason; in theory it may occasionally return incorrect data, requiring an additional execution of the keybinding.
2022-01-07 22:18:49 +01:00
2022-02-09 00:42:18 +01:00
This project was previously assembled as a quick hack in the form of a shell script requiring iocane, rofi, and xdotool. It has been rewritten as a native lua module for the latest stable release with no external dependencies. Final testing and clean-up in progress.
2022-01-07 22:18:49 +01:00
2022-02-09 00:42:18 +01:00
While deprecated functions were avoided, we have not yet tested it in the development version.