mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Merge branch 'dev' into rc
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
TOGGLE="internal-monitor-disable"
|
||||
MIRROR_TOGGLE="internal-monitor-mirror"
|
||||
|
||||
enable() {
|
||||
if omarchy-hyprland-toggle-enabled "$TOGGLE"; then
|
||||
@@ -10,7 +11,7 @@ enable() {
|
||||
|
||||
disable() {
|
||||
if omarchy-hw-external-monitors; then
|
||||
if omarchy-hyprland-toggle-disabled "$TOGGLE"; then
|
||||
if omarchy-hyprland-toggle-disabled "$TOGGLE" && omarchy-hyprland-toggle-disabled "$MIRROR_TOGGLE"; then
|
||||
omarchy-hyprland-toggle --enabled-notification " Laptop display disabled" "$TOGGLE"
|
||||
fi
|
||||
else
|
||||
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
TOGGLE="internal-monitor-mirror"
|
||||
TOGGLE_FLAG="$HOME/.local/state/omarchy/toggles/hypr/$TOGGLE.conf"
|
||||
DISABLE_TOGGLE="internal-monitor-disable"
|
||||
|
||||
# Get names dynamically
|
||||
INTERNAL=$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP")).name' | head -n 1)
|
||||
# Get the first available external monitor
|
||||
EXTERNAL=$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP") | not).name' | head -n 1)
|
||||
|
||||
enable() {
|
||||
if [[ -z "$EXTERNAL" ]]; then
|
||||
notify-send -u low " No external monitors found for mirror"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$INTERNAL" ]]; then
|
||||
notify-send -u low " No laptop monitor found to mirror"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if omarchy-hyprland-toggle-enabled "$DISABLE_TOGGLE"; then
|
||||
omarchy-hyprland-toggle "$DISABLE_TOGGLE"
|
||||
fi
|
||||
|
||||
if omarchy-hyprland-toggle-disabled "$TOGGLE"; then
|
||||
echo "monitor=$EXTERNAL, preferred, auto, 1, mirror, $INTERNAL" > "$TOGGLE_FLAG"
|
||||
notify-send -u low " Mirroring enabled ($EXTERNAL)"
|
||||
hyprctl reload
|
||||
fi
|
||||
}
|
||||
|
||||
disable() {
|
||||
if omarchy-hyprland-toggle-enabled "$TOGGLE"; then
|
||||
omarchy-hyprland-toggle --disabled-notification " Extended mode restored" "$TOGGLE"
|
||||
fi
|
||||
}
|
||||
|
||||
recover() {
|
||||
if ! omarchy-hw-external-monitors && omarchy-hyprland-toggle-enabled "$TOGGLE"; then
|
||||
omarchy-hyprland-toggle "$TOGGLE"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
on) enable ;;
|
||||
off) disable ;;
|
||||
toggle) if omarchy-hyprland-toggle-enabled "$TOGGLE"; then disable; else enable; fi ;;
|
||||
recover) recover ;;
|
||||
*)
|
||||
echo "Usage: $(basename "$0") {on|off|toggle|recover}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Listen on Hyprland's event socket and recover the internal display whenever
|
||||
# a monitor is removed.
|
||||
# Listen on Hyprland's event socket and recover monitor toggles whenever a
|
||||
# monitor is removed.
|
||||
|
||||
SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
|
||||
|
||||
@@ -9,6 +9,7 @@ socat -U - "UNIX-CONNECT:$SOCKET" | while read -r event; do
|
||||
case "$event" in
|
||||
monitorremoved\>\>*|monitorremovedv2\>\>*)
|
||||
omarchy-hyprland-monitor-internal recover
|
||||
omarchy-hyprland-monitor-internal-mirror recover
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
+2
-1
@@ -186,7 +186,7 @@ show_toggle_menu() {
|
||||
}
|
||||
|
||||
show_hardware_menu() {
|
||||
local options=" Laptop Display"
|
||||
local options=" Laptop Display\n Mirror Display"
|
||||
|
||||
if omarchy-hw-hybrid-gpu; then
|
||||
options="$options\n Hybrid GPU"
|
||||
@@ -198,6 +198,7 @@ show_hardware_menu() {
|
||||
|
||||
case $(menu "Toggle" "$options") in
|
||||
*Laptop*) omarchy-hyprland-monitor-internal toggle ;;
|
||||
*Mirror*) omarchy-hyprland-monitor-internal-mirror toggle;;
|
||||
*Touchpad*) omarchy-toggle-touchpad ;;
|
||||
*"Hybrid GPU"*) present_terminal omarchy-toggle-hybrid-gpu ;;
|
||||
*) back_to show_trigger_menu ;;
|
||||
|
||||
@@ -30,6 +30,7 @@ bindd = SUPER SHIFT ALT, COMMA, Restore last notification, exec, makoctl restore
|
||||
bindd = SUPER CTRL, I, Toggle locking on idle, exec, omarchy-toggle-idle
|
||||
bindd = SUPER CTRL, N, Toggle nightlight, exec, omarchy-toggle-nightlight
|
||||
bindd = SUPER CTRL, Delete, Toggle laptop display, exec, omarchy-hyprland-monitor-internal toggle
|
||||
bindd = SUPER CTRL ALT, Delete, Toggle laptop display mirroring, exec, omarchy-hyprland-monitor-internal-mirror toggle
|
||||
bindl = , switch:on:Lid Switch, exec, omarchy-hyprland-monitor-internal off
|
||||
bindl = , switch:off:Lid Switch, exec, omarchy-hyprland-monitor-internal on
|
||||
|
||||
|
||||
Reference in New Issue
Block a user