-
Notifications
You must be signed in to change notification settings - Fork 10
Home
This wiki provides explanations of some of flashfocus' more niche features, see the README for basic usage.
Flashfocus contains two options for flashing the currently active window.
-
flash_window
is implemented in python with no extra dependencies. Its fairly fast and should work fine for most people. -
nc_flash_window
is ~4X faster thanflash_window
, but requires the OpenBSD flavor ofnetcat
to be installed (openbsd-netcat
on Arch).
Flash rules are defined by matching the WM_CLASS property of a window. To get the WM_CLASS property
of a window use xprop WM_CLASS
and click on a window. The property is a tuple of the form
(window-id, window-class). The window-class is usually the name of the application, but not always.
Say I'd like to set all termite
windows to 80% opacity but leave other
windows at full opacity:
rules:
- window-class: Termite
default-opacity: 0.8
I also would prefer that firefox
windows are not flashed on focus:
rules:
- window-class: firefox
flash-on-focus: False
- window-class: Termite
default-opacity: 0.8
For more complicated rules, you can use (python-style) regexes:
rules:
- window-id: ^(?!termite)$
default-opacity: 0.8
Native wayland apps can be matched using the app_id and window name. These
can be found using swaymsg -t get_tree
. XWayland apps are matched with
using WM_CLASS as above (this can also be found with swaymsg
)
Given that termite is wayland native and firefox is not, the rules above could instead be written:
rules:
- window-class: firefox
flash-on-focus: False
- app-id: termite
default-opacity: 0.8
rules:
- window-name: ^(?!termite)$
default-opacity: 0.8
Instructions for setting up flashfocus to run as a systemd service.
First make sure that /usr/lib/systemd/user/flashfocus.service
exists. If not you'll need to manually create the file. See https://github.com/fennerm/flashfocus/blob/master/flashfocus.service
- Place the following systemd unit file in
~/.config/systemd/user/sway-session.target
:
[Unit]
Description=sway compositor session
Documentation=man:systemd.special(7)
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
-
Add
exec "systemctl --user import-environment; systemctl --user start sway-session.target"
to the bottom of your sway config file. -
systemctl --systemctl --user enable --now flashfocus
-
Flashfocus should start up automatically next time you log in.
For more detailed instructions see https://github.com/swaywm/sway/wiki/Systemd-integration
- Place the following systemd unit file in
~/.config/systemd/user/xsession.target
:
[Unit]
Description=X session
Documentation=man:systemd.special(7)
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
-
Add
systemctl --user import-environment; systemctl --user start xsession.target
to~/.xinitrc
. Might need to tweak this step depending on your setup and it might not be necessary at all if you use a login manager. -
systemctl --systemctl --user enable --now flashfocus
-
Flashfocus should start up automatically next time you log in.
For more detailed instructions see https://goral.net.pl/post/systemd-x-sessions/
-
hyprfocus - Focus animations for Hyprland
-
glimmer - Similar idea to flashfocus but using window borders rather than opacity.
-
If you use sway and you want something simple, this script replicates the core functionality of flashfocus.
#!/bin/bash
for OP in 0.905 0.82 0.745 0.68 0.625 0.58 0.545 0.52 0.505 0.5 0.505 0.52 0.545 0.58 0.625 0.68 0.745 0.82 0.905 1
do
swaymsg opacity $OP
sleep .005
done
Then you'd need to add something like this to your sway config:
bindsym $mod+$left exec swaymsg focus left && path-to-script
bindsym $mod+$right exec swaymsg focus right && path-to-script
bindsym $mod+$down exec swaymsg focus down && path-to-script
bindsym $mod+$up exec swaymsg focus up && path-to-script