diff options
Diffstat (limited to 'dot_local')
3 files changed, 34 insertions, 0 deletions
diff --git a/dot_local/lib/dotfiles/canonical_desktop.py b/dot_local/lib/dotfiles/canonical_desktop.py index 85d265d..d530058 100644 --- a/dot_local/lib/dotfiles/canonical_desktop.py +++ b/dot_local/lib/dotfiles/canonical_desktop.py @@ -10,6 +10,7 @@ from pathlib import Path HOME = Path.home() STATE = HOME / ".local/state/dotfiles/gnome-settings.json" EXTENSIONS = [ + "external-display@dotfiles", "o-tiling@oliwebd.github.com", "copyous@boerdereinar.dev", "emoji-copy@felipeftn", 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 +} |
