Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/gala.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
<summary>Whether hotcorners should be enabled when fullscreen window is opened</summary>
<description></description>
</key>
<key type="b" name="focus-on-demands-attention">
<default>true</default>
<summary>Whether windows should automatically be focused when they demand attention</summary>
<description></description>
</key>
<key enum="SuperScrollAction" name="super-scroll-action">
<default>"none"</default>
<summary>What action should be performed on Super + Scroll</summary>
Expand Down
10 changes: 8 additions & 2 deletions src/WindowAttentionTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
*/

public class Gala.WindowAttentionTracker : GLib.Object {
private static GLib.Settings behavior_settings;

public static void init (Meta.Display display) {
behavior_settings = new GLib.Settings ("io.elementary.desktop.wm.behavior");

display.window_demands_attention.connect (on_window_demands_attention);
display.window_marked_urgent.connect (on_window_demands_attention);
}

private static void on_window_demands_attention (Meta.Window window) {
window.raise ();
window.get_workspace ().activate_with_focus (window, window.display.get_current_time ());
if (behavior_settings.get_boolean ("focus-on-demands-attention")) {
window.raise ();
window.get_workspace ().activate_with_focus (window, window.display.get_current_time ());
}
}
}
Loading