diff options
| author | Ja.KooLit <85185940+JaKooLit@users.noreply.github.com> | 2025-02-23 14:46:19 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-23 14:46:19 +0900 |
| commit | 91b9177b0ff5d2fac7b99be9a89f8e9f054347fd (patch) | |
| tree | 5b11da646166995b52bb597cf6a92703d1f5a0a2 /config/hypr/scripts/MonitorProfiles.sh | |
| parent | 9f5b41c3e230cda406592167fcd0446a5f56821c (diff) | |
| parent | b8ab57be1c8e579e69e5bfd56668815465d71785 (diff) | |
Merge pull request #577 from JaKooLit/development
Development to main Dots version 2.3.12
Diffstat (limited to 'config/hypr/scripts/MonitorProfiles.sh')
| -rwxr-xr-x | config/hypr/scripts/MonitorProfiles.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/config/hypr/scripts/MonitorProfiles.sh b/config/hypr/scripts/MonitorProfiles.sh new file mode 100755 index 00000000..ab124335 --- /dev/null +++ b/config/hypr/scripts/MonitorProfiles.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# For applying Pre-configured Monitor Profiles + +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi +fi + +# Variables +iDIR="$HOME/.config/swaync/images" +SCRIPTSDIR="$HOME/.config/hypr/scripts" +monitor_dir="$HOME/.config/hypr/Monitor_Profiles" +target="$HOME/.config/hypr/monitors.conf" +rofi_theme="$HOME/.config/rofi/config-Monitors.rasi" +msg='❗NOTE:❗ This will overwrite $HOME/.config/hypr/monitors.conf' + +# Define the list of files to ignore +ignore_files=( + "README" +) + +# list of Monitor Profiles, sorted alphabetically with numbers first +mon_profiles_list=$(find -L "$monitor_dir" -maxdepth 1 -type f | sed 's/.*\///' | sed 's/\.conf$//' | sort -V) + +# Remove ignored files from the list +for ignored_file in "${ignore_files[@]}"; do + mon_profiles_list=$(echo "$mon_profiles_list" | grep -v -E "^$ignored_file$") +done + +# Rofi Menu +chosen_file=$(echo "$mon_profiles_list" | rofi -i -dmenu -config $rofi_theme -mesg "$msg") + +# Check if a file was selected +if [[ -n "$chosen_file" ]]; then + full_path="$monitor_dir/$chosen_file.conf" + cp -r "$target" "$monitor_dir/Previous_Profile.conf" && cp "$full_path" "$target" + notify-send -u low -i "$iDIR/ja.png" "$chosen_file" "Monitor Profile Loaded" +fi + +sleep 1 +"$SCRIPTSDIR/RefreshNoWaybar.sh" |
