Commit e32ca0a0 authored by Erik Reider's avatar Erik Reider

Fixed trying to set monitor when not using wlr-layer-shell

parent a222a896
......@@ -307,6 +307,13 @@ namespace SwayNotificationCenter {
}
}
}
// Set the preferred monitor
string ?monitor_name = ConfigModel.instance.control_center_preferred_output;
if (this.monitor_name != null) {
monitor_name = this.monitor_name;
}
set_monitor (Functions.try_get_monitor (monitor_name));
}
// Set the window margins
......@@ -364,13 +371,6 @@ namespace SwayNotificationCenter {
ConfigModel.instance.control_center_height);
box.set_size_request (ConfigModel.instance.control_center_width,
ConfigModel.instance.control_center_height);
// Set the preferred monitor
string ?monitor_name = ConfigModel.instance.control_center_preferred_output;
if (this.monitor_name != null) {
monitor_name = this.monitor_name;
}
set_monitor (Functions.try_get_monitor (monitor_name));
}
public uint notification_count () {
......@@ -434,7 +434,8 @@ namespace SwayNotificationCenter {
}
public void set_monitor (Gdk.Monitor ?monitor) {
debug ("Setting monitor for ControlCenter: %s", Functions.monitor_to_string (monitor));
debug ("Setting monitor for ControlCenter: %s",
Functions.monitor_to_string (monitor) ?? "Monitor Picked by Compositor");
this.monitor_name = monitor == null ? null : monitor.connector;
GtkLayerShell.set_monitor (this, monitor);
}
......
......@@ -136,6 +136,13 @@ namespace SwayNotificationCenter {
scrolled_window.set_valign (Gtk.Align.END);
break;
}
// Set the preferred monitor
string ?monitor_name = ConfigModel.instance.notification_window_preferred_output;
if (NotificationWindow.monitor_name != null) {
monitor_name = NotificationWindow.monitor_name;
}
set_monitor (Functions.try_get_monitor (monitor_name));
}
list.animation_reveal_type = AnimatedListItem.RevealAnimationType.SLIDE;
......@@ -163,12 +170,7 @@ namespace SwayNotificationCenter {
break;
}
// Set the preferred monitor
string ?monitor_name = ConfigModel.instance.notification_window_preferred_output;
if (NotificationWindow.monitor_name != null) {
monitor_name = NotificationWindow.monitor_name;
}
set_monitor (Functions.try_get_monitor (monitor_name));
set_input_region ();
}
private void set_input_region () {
......@@ -365,7 +367,8 @@ namespace SwayNotificationCenter {
}
public void set_monitor (Gdk.Monitor ?monitor) {
debug ("Setting monitor for ControlCenter: %s", Functions.monitor_to_string (monitor));
debug ("Setting monitor for Floating Notifications: %s",
Functions.monitor_to_string (monitor) ?? "Monitor Picked by Compositor");
NotificationWindow.monitor_name = monitor == null ? null : monitor.connector;
GtkLayerShell.set_monitor (this, monitor);
......
......@@ -318,6 +318,12 @@ namespace SwayNotificationCenter {
}
public bool set_cc_monitor (string name) throws DBusError, IOError {
if (!use_layer_shell) {
critical (
"Setting Control Center monitor isn't supported "
+ "when layer shell is disabled!");
return false;
}
unowned Gdk.Monitor ?monitor = Functions.try_get_monitor (name);
if (monitor == null) {
return false;
......@@ -328,6 +334,12 @@ namespace SwayNotificationCenter {
}
public bool set_noti_window_monitor (string name) throws DBusError, IOError {
if (!use_layer_shell) {
critical (
"Setting Notification Window monitor isn't supported "
+ "when layer shell is disabled!");
return false;
}
unowned Gdk.Monitor ?monitor = Functions.try_get_monitor (name);
if (monitor == null) {
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment