From 8ad61cadcb78f8025bfa2f3ba7609175ee377c90 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 9 Apr 2026 09:53:12 +0200 Subject: [PATCH] Add way to toggle on/off internal display on laptops --- bin/omarchy-hyprland-monitor-internal-toggle | 22 ++++++++++++++++++++ bin/omarchy-menu | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 bin/omarchy-hyprland-monitor-internal-toggle diff --git a/bin/omarchy-hyprland-monitor-internal-toggle b/bin/omarchy-hyprland-monitor-internal-toggle new file mode 100755 index 00000000..325f7589 --- /dev/null +++ b/bin/omarchy-hyprland-monitor-internal-toggle @@ -0,0 +1,22 @@ +#!/bin/bash + +# Toggle the internal laptop display on/off. +# Useful when connected to an external monitor and you want to close the lid +# or just use the external display only. + +INTERNAL=$(hyprctl monitors all -j | jq -r '.[] | select(.name | startswith("eDP")) | .name') + +if [[ -z $INTERNAL ]]; then + notify-send -u low "󰍹 No internal display found" + exit 1 +fi + +DISABLED=$(hyprctl monitors all -j | jq -r --arg m "$INTERNAL" '.[] | select(.name == $m) | .disabled') + +if [[ $DISABLED == "true" ]]; then + hyprctl keyword monitor "$INTERNAL,preferred,auto,auto" + notify-send -u low "󰍹 Internal display on" +else + hyprctl keyword monitor "$INTERNAL,disable" + notify-send -u low "󰍹 Internal display off" +fi diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 53d2b4cf..362e0ef0 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -168,7 +168,7 @@ show_share_menu() { } show_toggle_menu() { - case $(menu "Toggle" "󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Display Scaling") in + case $(menu "Toggle" "󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Monitor Scaling\n󰶐 Laptop Display") in *Screensaver*) omarchy-toggle-screensaver ;; *Nightlight*) omarchy-toggle-nightlight ;; @@ -178,6 +178,7 @@ show_toggle_menu() { *Ratio*) omarchy-hyprland-window-single-square-aspect-toggle ;; *Gaps*) omarchy-hyprland-window-gaps-toggle ;; *Scaling*) omarchy-hyprland-monitor-scaling-cycle ;; + *Laptop*) omarchy-hyprland-monitor-internal-toggle ;; *) back_to show_trigger_menu ;; esac }