diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-07-22 02:10:24 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:40:35 -0700 |
| commit | 07e3facc7bdc301be08d536e471f3c649d9fd3f0 (patch) | |
| tree | 99a449053229701b2b9eebcf2c564dab6d10792a /config/hypr/scripts/select-hyprview-layout.sh | |
| parent | 91e9e32cbc77ea39eb5b3d96b5f773791cd897e1 (diff) | |
Add: script to set qs-hyprview layout
Signed-off-by: Don Williams <don.e.williams@gmail.com>
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: CHANGELOG.md
new file: config/hypr/UserConfigs/hyprview-layout.conf
modified: config/hypr/scripts/Kool_Quick_Settings.sh
new file: config/hypr/scripts/select-hyprview-layout.sh
modified: config/hypr/scripts/toggle-qs-hyprview.sh
Diffstat (limited to 'config/hypr/scripts/select-hyprview-layout.sh')
| -rwxr-xr-x | config/hypr/scripts/select-hyprview-layout.sh | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/config/hypr/scripts/select-hyprview-layout.sh b/config/hypr/scripts/select-hyprview-layout.sh new file mode 100755 index 00000000..e16df038 --- /dev/null +++ b/config/hypr/scripts/select-hyprview-layout.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# ================================================== +# KoolDots (2026) +# Project URL: https://github.com/LinuxBeginnings +# License: GNU GPLv3 +# SPDX-License-Identifier: GPL-3.0-or-later +# ================================================== +# Select and persist Hyprview layout for quickshell toggle + +config_home="${XDG_CONFIG_HOME:-$HOME/.config}" +layout_config="$config_home/hypr/UserConfigs/hyprview-layout.conf" +rofi_theme="$config_home/rofi/config-edit.rasi" +default_layout="smartgrid" + +layouts=( + smartgrid + justified + masonry + bands + hero + spiral + satellite + staggered + columnar + vortex + random +) + +current_layout="$default_layout" +if [[ -f "$layout_config" && -r "$layout_config" ]]; then + saved_layout="$(sed -n '1p' "$layout_config" | tr -d '[:space:]')" + for layout in "${layouts[@]}"; do + if [[ "$saved_layout" == "$layout" ]]; then + current_layout="$saved_layout" + break + fi + done +fi + +default_row=0 +for i in "${!layouts[@]}"; do + if [[ "${layouts[$i]}" == "$current_layout" ]]; then + default_row="$i" + break + fi +done + +if pidof rofi >/dev/null; then + pkill rofi +fi + +"$config_home/hypr/scripts/RofiFocusedWallpaperLink.sh" >/dev/null 2>&1 || true +choice="$( + printf '%s\n' "${layouts[@]}" | rofi -i -dmenu -config "$rofi_theme" \ + -p "Hyprview Layout" \ + -mesg "Select Hyprview layout" \ + -selected-row "$default_row" +)" + +[[ -z "$choice" ]] && exit 0 + +for layout in "${layouts[@]}"; do + if [[ "$choice" == "$layout" ]]; then + mkdir -p "$(dirname "$layout_config")" + printf '%s\n' "$choice" > "$layout_config" + notify-send -u low "Hyprview layout set to $choice" + exit 0 + fi +done + +notify-send -u normal "Invalid layout selection; keeping current setting" +exit 1 |
