Expand description
The window manager’s focus mode (click to focus, or focus following the pointer), read in the process instead of through a helper program.
Experimental: may change in any release
(docs/stability.md).
egui-pop follows the system’s focus mode (egui_pop_core::focus_mode);
by default it asks gsettings or kreadconfig at start (and reads
nothing on Windows, where a helper program would flash a console). This
reads the same answers in-process:
| Read from | Followed while running | |
|---|---|---|
| GNOME (and desktops using its settings) | the XDG Settings portal, org.gnome.desktop.wm.preferences focus-mode (click, sloppy, mouse) | yes: read again when the window gets the focus back |
| KDE Plasma | kwinrc, group Windows, FocusPolicy, read as a file (the portal does not carry KWin’s settings) | yes, the same way |
| Windows | the active window tracking bit of HKCU\Control Panel\Desktop\UserPreferencesMask, what SystemParametersInfo(SPI_GETACTIVEWINDOWTRACKING) reports, read through the registry API (winreg; egui-pop has no unsafe code) | yes, the same way |
| macOS | nothing to read: its window manager has no focus following the pointer | |
| Other Linux desktops, the web | nothing read: click |
The EGUI_POP_FOCUS_MODE variable (click, hover) still stands in
for the system. read reads now (a D-Bus call on Linux, with a
timeout); give it to AppBuilder::system_focus so run_native
starts no helper. FocusModePlugin reads it again, from a thread,
each time the window gets the focus back, so a change in the
desktop’s settings applies without a restart.
use egui_pop_core::focus_mode::FocusMode;
use egui_pop_platform::focus;
let kwinrc = "[Windows]\nFocusPolicy=FocusFollowsMouse\n";
assert_eq!(focus::kwin_policy(kwinrc), Some(FocusMode::Hover));
let read = focus::read_with(None, "KDE", &focus::Sources {
kwinrc: &|| Some(kwinrc.into()),
..focus::Sources::NONE
});
assert_eq!(read.mode, FocusMode::Hover);
assert_eq!(read.from, Some("KDE"));Structs§
- Focus
Mode Plugin - Reads the focus mode in-process at start and again each time the window gets the focus back, from a thread (see the module).
- Sources
- Where the system’s answer comes from, each a function giving the raw
answer (none: not there).
Sources::SYSTEMreads the real ones.
Constants§
- PLUGIN
- The plugin’s id.
Functions§
- kwin_
policy - KWin’s
FocusPolicyin akwinrc(none written: click). - read
- The system’s focus mode, read now in-process (see the module).
- read_
with - The system’s focus mode from what
sourcesanswer (see the module).