From 7773d867f6266a5cd72971bfb1256c8976b280f4 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 22 Sep 2026 13:57:08 +0100 Subject: Prefer external displays on the corporate laptop --- .../external-display@dotfiles/extension.js | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 dot_local/share/gnome-shell/extensions/external-display@dotfiles/extension.js (limited to 'dot_local/share/gnome-shell/extensions/external-display@dotfiles/extension.js') 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; + } +} -- cgit v1.3.1