diff --git a/deluge/ui/gtkui/glade/preferences_dialog.ui b/deluge/ui/gtkui/glade/preferences_dialog.ui
index e9f526d38..09a6ea5de 100644
--- a/deluge/ui/gtkui/glade/preferences_dialog.ui
+++ b/deluge/ui/gtkui/glade/preferences_dialog.ui
@@ -2465,6 +2465,19 @@ used sparingly.
0
+
+
+
+ 1
+
+
diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py
index 53072e2ac..e48472d99 100644
--- a/deluge/ui/gtkui/gtkui.py
+++ b/deluge/ui/gtkui/gtkui.py
@@ -149,6 +149,7 @@ DEFAULT_PREFS = {
"pieces_color_waiting": [4874, 56494, 0],
"pieces_color_downloading": [65535, 55255, 0],
"pieces_color_completed": [4883, 26985, 56540],
+ "focus_main_window_on_add": True,
}
class GtkUI(object):
diff --git a/deluge/ui/gtkui/ipcinterface.py b/deluge/ui/gtkui/ipcinterface.py
index cb7259cc5..d061a7a8d 100644
--- a/deluge/ui/gtkui/ipcinterface.py
+++ b/deluge/ui/gtkui/ipcinterface.py
@@ -60,7 +60,8 @@ log = logging.getLogger(__name__)
class IPCProtocolServer(Protocol):
def dataReceived(self, data):
data = rencode.loads(data)
- component.get("MainWindow").present()
+ if not data or config["focus_main_window_on_add"]:
+ component.get("MainWindow").present()
process_args(data)
class IPCProtocolClient(Protocol):
diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py
index 34f8da6f0..eeb264c69 100644
--- a/deluge/ui/gtkui/preferences.py
+++ b/deluge/ui/gtkui/preferences.py
@@ -552,6 +552,8 @@ class Preferences(component.Component):
self.gtkui_config["classic_mode"])
self.builder.get_object("chk_show_rate_in_title").set_active(
self.gtkui_config["show_rate_in_title"])
+ self.builder.get_object("chk_focus_main_window_on_add").set_active(
+ self.gtkui_config["focus_main_window_on_add"])
self.builder.get_object("piecesbar_toggle").set_active(
self.gtkui_config["show_piecesbar"]
)
@@ -739,6 +741,8 @@ class Preferences(component.Component):
new_gtkui_config["show_rate_in_title"] = \
self.builder.get_object("chk_show_rate_in_title").get_active()
+ new_gtkui_config["focus_main_window_on_add"] = \
+ self.builder.get_object("chk_focus_main_window_on_add").get_active()
## Other tab ##
new_gtkui_config["show_new_releases"] = \