[gnome-shell] Add ShowMonitorLabels2 D-Bus API
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Add ShowMonitorLabels2 D-Bus API
- Date: Fri, 7 Apr 2017 14:33:46 +0000 (UTC)
commit 4cd46781940c8ce1967b15197380b3db916dd46e
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Apr 6 13:18:39 2017 +0800
Add ShowMonitorLabels2 D-Bus API
Add a new D-Bus method for setting the monitor labels. This new method
takes connector names instead of output ids for associating with actual
monitors.
https://bugzilla.gnome.org/show_bug.cgi?id=777732
js/ui/osdMonitorLabeler.js | 19 +++++++++++++++++++
js/ui/shellDBus.js | 9 +++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/osdMonitorLabeler.js b/js/ui/osdMonitorLabeler.js
index 90682bd..83a7927 100644
--- a/js/ui/osdMonitorLabeler.js
+++ b/js/ui/osdMonitorLabeler.js
@@ -120,6 +120,25 @@ const OsdMonitorLabeler = new Lang.Class({
}
},
+ show2: function(client, params) {
+ if (!this._trackClient(client))
+ return;
+
+ this._reset();
+
+ for (let connector in params) {
+ let monitor = this._monitorManager.get_monitor_for_connector(connector);
+ if (monitor == -1)
+ continue;
+ this._monitorLabels.get(monitor).push(params[connector].deep_unpack());
+ }
+
+ for (let [monitor, labels] of this._monitorLabels.entries()) {
+ labels.sort();
+ this._osdLabels.push(new OsdMonitorLabel(monitor, labels.join(' ')));
+ }
+ },
+
hide: function(client) {
if (!this._untrackClient(client))
return;
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 14dba72..9259f84 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -28,6 +28,9 @@ const GnomeShellIface = '<node> \
<method name="ShowMonitorLabels"> \
<arg type="a{uv}" direction="in" name="params" /> \
</method> \
+<method name="ShowMonitorLabels2"> \
+ <arg type="a{sv}" direction="in" name="params" /> \
+</method> \
<method name="HideMonitorLabels" /> \
<method name="FocusApp"> \
<arg type="s" direction="in" name="id"/> \
@@ -250,6 +253,12 @@ const GnomeShell = new Lang.Class({
Main.osdMonitorLabeler.show(sender, dict);
},
+ ShowMonitorLabels2Async: function(params, invocation) {
+ let sender = invocation.get_sender();
+ let [dict] = params;
+ Main.osdMonitorLabeler.show2(sender, dict);
+ },
+
HideMonitorLabelsAsync: function(params, invocation) {
let sender = invocation.get_sender();
Main.osdMonitorLabeler.hide(sender);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]