Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bin/omarchy-hw-lid-closed
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# omarchy:summary=Returns true when the laptop lid is closed
# omarchy:hidden=true

for state in /proc/acpi/button/lid/*/state; do
[[ -r $state ]] || continue
[[ $(< "$state") == *"closed"* ]] && exit 0
done

exit 1
4 changes: 2 additions & 2 deletions bin/omarchy-hyprland-monitor-internal
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on() {
}

off() {
if ! omarchy-hw-external-monitors; then
if ! omarchy-hw-external-monitors && ! omarchy-hw-lid-closed; then
omarchy-notification-send -g 󰍹 "Can't disable the only active display"
exit 1
fi
Expand All @@ -31,7 +31,7 @@ off() {
}

recover() {
if ! omarchy-hw-external-monitors && omarchy-hyprland-toggle-enabled $TOGGLE; then
if ! omarchy-hw-external-monitors && ! omarchy-hw-lid-closed && omarchy-hyprland-toggle-enabled $TOGGLE; then
omarchy-hyprland-toggle $TOGGLE off
fi
}
Expand Down
2 changes: 1 addition & 1 deletion default/hypr/bindings/utilities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ o.bind_toggle("SUPER + CTRL + I", "Toggle locking on idle", "idle")
o.bind_toggle("SUPER + CTRL + N", "Toggle nightlight", "nightlight")
o.bind("SUPER + CTRL + Delete", "Toggle laptop display", "omarchy-hyprland-monitor-internal toggle")
o.bind("SUPER + CTRL + ALT + Delete", "Toggle laptop display mirroring", "omarchy-hyprland-monitor-internal-mirror toggle")
o.bind("switch:on:Lid Switch", nil, "omarchy-hw-external-monitors && omarchy-hyprland-monitor-internal off", { locked = true })
o.bind("switch:on:Lid Switch", nil, "omarchy-hyprland-monitor-internal off", { locked = true })
o.bind("switch:off:Lid Switch", nil, "omarchy-hyprland-monitor-internal on", { locked = true })

o.bind("PRINT", "Screenshot", "omarchy-capture-screenshot")
Expand Down