diff --git a/data/gala.gschema.xml b/data/gala.gschema.xml
index ea079697a..63f6eeb89 100644
--- a/data/gala.gschema.xml
+++ b/data/gala.gschema.xml
@@ -102,6 +102,11 @@
Whether hotcorners should be enabled when fullscreen window is opened
+
+ true
+ Whether windows should automatically be focused when they demand attention
+
+
"none"
What action should be performed on Super + Scroll
diff --git a/src/WindowAttentionTracker.vala b/src/WindowAttentionTracker.vala
index 2d01542a2..870d556c9 100644
--- a/src/WindowAttentionTracker.vala
+++ b/src/WindowAttentionTracker.vala
@@ -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 ());
+ }
}
}