diff options
Diffstat (limited to 'dot_local/share/gnome-shell')
| -rw-r--r-- | dot_local/share/gnome-shell/extensions/external-display@dotfiles/extension.js | 26 | ||||
| -rw-r--r-- | dot_local/share/gnome-shell/extensions/external-display@dotfiles/metadata.json | 7 |
2 files changed, 33 insertions, 0 deletions
diff --git a/dot_local/share/gnome-shell/extensions/external-display@dotfiles/extension.js b/dot_local/share/gnome-shell/extensions/external-display@dotfiles/extension.js new file mode 100644 index 0000000..ce32fd9 --- /dev/null +++ b/dot_local/share/gnome-shell/extensions/external-display@dotfiles/extension.js @@ -0,0 +1,26 @@ +import Meta from "gi://Meta"; +import { Extension } from "resource:///org/gnome/shell/extensions/extension.js"; + +export default class ExternalDisplay extends Extension { + enable() { + this._manager = global.backend.get_monitor_manager(); + this._signal = this._manager.connect("monitors-changed", () => + this._apply(), + ); + this._apply(); + } + + _apply() { + if ( + this._manager.has_builtin_panel && + this._manager.can_switch_config() && + this._manager.get_is_builtin_display_on() + ) + this._manager.switch_config(Meta.MonitorSwitchConfigType.EXTERNAL); + } + + disable() { + this._manager.disconnect(this._signal); + this._manager = null; + } +} diff --git a/dot_local/share/gnome-shell/extensions/external-display@dotfiles/metadata.json b/dot_local/share/gnome-shell/extensions/external-display@dotfiles/metadata.json new file mode 100644 index 0000000..ab3eba8 --- /dev/null +++ b/dot_local/share/gnome-shell/extensions/external-display@dotfiles/metadata.json @@ -0,0 +1,7 @@ +{ + "uuid": "external-display@dotfiles", + "name": "External Display", + "description": "Use external displays when connected to a laptop.", + "shell-version": ["50"], + "version": 1 +} |
