Unverified Commit a1dc0a2f authored by vaw's avatar vaw Committed by GitHub

feat: Choose outputs by name (#602)

* feat: Choose outputs by name * Match the full monitor name + serial number like sway does * Updated documentation --------- Co-authored-by: 's avatarErik Reider <35975961+ErikReider@users.noreply.github.com>
parent 7765e0dd
......@@ -116,8 +116,10 @@ config file to be able to detect config errors
type: string ++
default: "" ++
description: The preferred output to open the notification window ++
(popup notifications). If the output is not found, the ++
currently focused one is picked.
(popup notifications). Can either be the monitor connector ++
name (ex: "DP-1"), or the full name, manufacturer model serial ++
(ex: "Acer Technologies XV272U V 503023B314202"). ++
If the output is not found, the currently focused one is picked.
*keyboard-shortcuts* ++
type: bool ++
......@@ -183,7 +185,10 @@ config file to be able to detect config errors
*control-center-preferred-output* ++
type: string ++
default: "" ++
description: The preferred output to open the control center. If the ++
description: The preferred output to open the control center. Can either ++
be the monitor connector name (ex: "DP-1"), or ++
the full name, manufacturer model serial ++
(ex: "Acer Technologies XV272U V 503023B314202"). If the ++
output is not found, the currently focused one is picked.
*notification-visibility* ++
......
......@@ -472,6 +472,11 @@ namespace SwayNotificationCenter {
/**
* The preferred output to open the notification window (popup notifications).
*
* Can either be the monitor connector name (ex: "DP-1"),
* or the full name, manufacturer model serial
* (ex: "Acer Technologies XV272U V 503023B314202").
*
* If the output is not found, the currently focused one is picked.
*/
public string notification_window_preferred_output { get; set; default = ""; }
......@@ -618,6 +623,11 @@ namespace SwayNotificationCenter {
/**
* The preferred output to open the control center.
*
* Can either be the monitor connector name (ex: "DP-1"),
* or the full name, manufacturer model serial
* (ex: "Acer Technologies XV272U V 503023B314202").
*
* If the output is not found, the currently focused one is picked.
*/
public string control_center_preferred_output { get; set; default = ""; }
......
......@@ -145,7 +145,7 @@
},
"notification-window-preferred-output": {
"type": "string",
"description": "The preferred output to open the notification window (popup notifications). If the output is not found, the currently focused one is picked"
"description": "The preferred output to open the notification window (popup notifications). Can either be the monitor connector name (ex: \"DP-1\"), or the full name, manufacturer model serial (ex: \"Acer Technologies XV272U V 503023B314202\"). If the output is not found, the currently focused one is picked"
},
"fit-to-screen": {
"type": "boolean",
......@@ -171,7 +171,7 @@
},
"control-center-preferred-output": {
"type": "string",
"description": "The preferred output to open the control center. If the output is not found, the currently focused one is picked"
"description": "The preferred output to open the control center. Can either be the monitor connector name (ex: \"DP-1\"), or the full name, manufacturer model serial (ex: \"Acer Technologies XV272U V 503023B314202\"). If the output is not found, the currently focused one is picked"
},
"keyboard-shortcuts": {
"type": "boolean",
......
......@@ -369,9 +369,19 @@ namespace SwayNotificationCenter {
Object ? obj = monitors.get_item (i);
if (obj == null || !(obj is Gdk.Monitor)) continue;
unowned Gdk.Monitor monitor = (Gdk.Monitor) obj;
if (monitor.connector == name) {
return monitor;
}
// Try matching a string consisting of the manufacturer + model + serial number.
// Just like Sway does (sway-output(5) man page)
string id = "%s %s %s".printf (monitor.manufacturer,
monitor.model,
monitor.description);
if (id == name) {
return monitor;
}
}
return null;
......
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