Move flags to persistent setup so hyprctl reload doesn't reset them
This commit is contained in:
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if a Hyprland flag is currently disabled (missing).
|
||||
|
||||
[[ ! -f "$HOME/.local/state/omarchy/flags/hypr/$1.conf" ]]
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if a Hyprland flag is currently enabled.
|
||||
|
||||
[[ -f "$HOME/.local/state/omarchy/flags/hypr/$1.conf" ]]
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Toggle permanent Hyprland flags by copying them into a directory that's sourced entirely.
|
||||
|
||||
ENABLED_NOTIFICATION=""
|
||||
DISABLED_NOTIFICATION=""
|
||||
|
||||
while [[ $# -gt 1 ]]; do
|
||||
case $1 in
|
||||
--enabled-notification) ENABLED_NOTIFICATION="$2"; shift 2 ;;
|
||||
--disabled-notification) DISABLED_NOTIFICATION="$2"; shift 2 ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
FLAG_NAME="$1"
|
||||
flag="$HOME/.local/state/omarchy/flags/hypr/$FLAG_NAME.conf"
|
||||
flag_source="$OMARCHY_PATH/default/hypr/flags/$FLAG_NAME.conf"
|
||||
|
||||
if [[ -f $flag ]]; then
|
||||
rm $flag
|
||||
[[ -n $DISABLED_NOTIFICATION ]] && notify-send -u low "$DISABLED_NOTIFICATION"
|
||||
elif [[ -f $flag_source ]]; then
|
||||
cp $flag_source $flag
|
||||
[[ -n $ENABLED_NOTIFICATION ]] && notify-send -u low "$ENABLED_NOTIFICATION"
|
||||
else
|
||||
echo "Flag not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hyprctl reload
|
||||
@@ -1,29 +1,16 @@
|
||||
#!/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.
|
||||
# Toggle the internal laptop display on/off using the flag system.
|
||||
|
||||
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"
|
||||
hyprctl dispatch movecursor 0 0
|
||||
notify-send -u low " Internal display on"
|
||||
else
|
||||
if omarchy-hyprland-flag-missing internal-monitor-disable; then
|
||||
ACTIVE_COUNT=$(hyprctl monitors -j | jq 'length')
|
||||
if [[ $ACTIVE_COUNT -le 1 ]]; then
|
||||
notify-send -u low " Can't disable the only active display"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hyprctl keyword monitor "$INTERNAL,disable"
|
||||
notify-send -u low " Internal display off"
|
||||
fi
|
||||
|
||||
omarchy-hyprland-flag-toggle \
|
||||
--enabled-notification " Internal display off" \
|
||||
--disabled-notification " Internal display on" \
|
||||
internal-monitor-disable
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check current single_window_aspect_ratio setting
|
||||
CURRENT_VALUE=$(hyprctl getoption "layout:single_window_aspect_ratio" 2>/dev/null | head -1)
|
||||
# Toggle single-window square aspect ratio using the flag system.
|
||||
|
||||
# Parse vec2 output: "vec2: [1, 1]" or "vec2: [0, 0]"
|
||||
if [[ $CURRENT_VALUE == *"[1, 1]"* ]]; then
|
||||
hyprctl keyword layout:single_window_aspect_ratio "0 0"
|
||||
notify-send -u low " Disable single-window square aspect ratio"
|
||||
else
|
||||
hyprctl keyword layout:single_window_aspect_ratio "1 1"
|
||||
notify-send -u low " Enable single-window square aspect"
|
||||
fi
|
||||
omarchy-hyprland-flag-toggle \
|
||||
--enabled-notification " Enable single-window square aspect ratio" \
|
||||
--disabled-notification " Disable single-window square aspect ratio" \
|
||||
single-window-aspect-ratio
|
||||
|
||||
Reference in New Issue
Block a user