Skip to content
Manuel Schneider edited this page Apr 10, 2024 · 17 revisions

Outsource hotkey handling

Some environments are problematic when it comes to hotkeys (Gnome, Wayland, etc…). A generic solution is to let your desktop environment handle the hotkey registration. Bind the hotkey to the command you want it to run, e.g.

albert toggle

Note that this runs a new albert instance, which is relatively heavy. Another approach is to pipe the command you want to send directly into the albert IPC socket ~/.cache/albert/ipc_socket (before v0.21: ~/.cache/albert_socket) using less heavy tools like netcat:

# Using netcat-openbsd
echo -n toggle | nc -U ~/.cache/albert/ipc_socket

# Using socat
echo -n toggle | socat - ~/.cache/albert/ipc_socket

Note that you have to explicitly invoke a shell if your desktop environment does not do this for you (Gnome!):

sh -c "echo -n toggle | socat - ~/.cache/albert/ipc_socket"

Launch albert with trigger

albert show "trigger "

will open the running instance and set a text. You can omit the quotation marks, but your shell may trim the spaces.

Using xcb / Avoid Wayland

# Do not set QT_QPA_PLATFORM as it will propagate to launched apps
albert --platform xcb

Gnome appearance and auto dark mode

Install QGnomePlatform. QGnomePlatform project is unmaintained and no longer actively developed, however there is nothing else providing that good integration (afaik). Note that QGnomePlatform sets styles and such (read more). So using QT_STYLE_OVERRIDE/--style may not work as expected. Run Albert using:

# Do not set QT_QPA_PLATFORMTHEME as it will propagate to launched apps
albert --platformtheme gnome