Files
dotfiles/hypr/scripts/toggle_mirror_display.sh
Nikolai Papin 070e44a5e0 feat: add startup reminder notification and dark theme preference;
feat: implement privacy window tagging and screensharing protection rules;
feat: add cursor zoom keybinds and swapnext window keybinds;
feat: add keybinds for locking with sleep and shutdown;
refactor: change monitor swap keybind to focus monitor and adjust toggle mirror script;
chore: comment out hyprfocus and easymotion plugins;
feat: add random wallpaper mode for both monitors;
refactor: rewrite toggle mirror display script for mirror and normal modes
2025-11-06 00:27:36 +03:00

36 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Define the file to modify
FILE="$HOME/.config/hypr/monitors.conf"
DELAY="0.5"
# Get specific lines from the file
LINE_DISABLE=$(sed -n '3p' "$FILE") # 3rd line: disable HDMI
LINE_MIRROR=$(sed -n '4p' "$FILE") # 4th line: mirror configuration
# Check if the first argument is "g" (get status)
if [ "$1" = "g" ]; then
[[ $LINE_MIRROR == \#* ]] && echo false || echo true
exit 0
fi
# Check if mirror mode is currently active (last line is NOT commented)
if [[ $LINE_MIRROR != \#* ]]; then
# Switching FROM mirror mode TO normal mode
# Comment the mirror line (disable mirror)
sed -i '4s/^/# /' "$FILE"
# Uncomment the disable line (temporarily disable HDMI)
sed -i '3s/^# //' "$FILE"
sleep $DELAY
sed -i '3s/^/# /' "$FILE"
else
sed -i '3s/^# //' "$FILE"
# Switching TO mirror mode FROM normal mode
# Uncomment the mirror line (enable mirror)
sed -i '4s/^# //' "$FILE"
sleep $DELAY
# Comment the disable line (don't need explicit disable when using mirror)
sed -i '3s/^/# /' "$FILE"
fi