diff --git a/src/roster_window.py b/src/roster_window.py
index 5aa1434a6d211d25e658e0d4670b417238df00e5..3c98e90dbe786533a57126d680050b9b63ca7a73 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -2193,7 +2193,7 @@ class RosterWindow:
 	def on_roster_window_delete_event(self, widget, event):
 		'''Main window X button was clicked'''
 		if gajim.interface.systray_enabled and not gajim.config.get(
-		'quit_on_roster_x_button'):
+		'quit_on_roster_x_button') and gajim.config.get('trayicon') != 'on_event':
 			self.tooltip.hide_tooltip()
 			self.window.hide()
 		else: