diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:54:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:54:43 +0000 |
commit | e4283f6d48b98e764b988b43bbc86b9d52e6ec94 (patch) | |
tree | c8f7f7a6c2f5faa2942d27cefc6fd46cca492656 /js/ui/status/autoRotate.js | |
parent | Initial commit. (diff) | |
download | gnome-shell-54cc9b72c7f1eca5c7acbdf783df9cfc8e4c2680.tar.xz gnome-shell-54cc9b72c7f1eca5c7acbdf783df9cfc8e4c2680.zip |
Adding upstream version 43.9.upstream/43.9upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | js/ui/status/autoRotate.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/js/ui/status/autoRotate.js b/js/ui/status/autoRotate.js new file mode 100644 index 0000000..bde3b80 --- /dev/null +++ b/js/ui/status/autoRotate.js @@ -0,0 +1,45 @@ +/* exported Indicator */ +const {Gio, GObject} = imports.gi; + +const SystemActions = imports.misc.systemActions; + +const {QuickToggle, SystemIndicator} = imports.ui.quickSettings; + +const RotationToggle = GObject.registerClass( +class RotationToggle extends QuickToggle { + _init() { + this._systemActions = new SystemActions.getDefault(); + + super._init({ + label: _('Auto Rotate'), + }); + + this._systemActions.bind_property('can-lock-orientation', + this, 'visible', + GObject.BindingFlags.DEFAULT | + GObject.BindingFlags.SYNC_CREATE); + this._systemActions.bind_property('orientation-lock-icon', + this, 'icon-name', + GObject.BindingFlags.DEFAULT | + GObject.BindingFlags.SYNC_CREATE); + + this._settings = new Gio.Settings({ + schema_id: 'org.gnome.settings-daemon.peripherals.touchscreen', + }); + this._settings.bind('orientation-lock', + this, 'checked', + Gio.SettingsBindFlags.INVERT_BOOLEAN); + + this.connect('clicked', + () => this._systemActions.activateLockOrientation()); + } +}); + +var Indicator = GObject.registerClass( +class Indicator extends SystemIndicator { + _init() { + super._init(); + + this.quickSettingsItems.push(new RotationToggle()); + } +}); |