From 07e3facc7bdc301be08d536e471f3c649d9fd3f0 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Wed, 22 Jul 2026 02:10:24 -0400 Subject: Add: script to set qs-hyprview layout Signed-off-by: Don Williams 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 --- config/hypr/UserConfigs/hyprview-layout.conf | 1 + config/hypr/scripts/Kool_Quick_Settings.sh | 4 ++ config/hypr/scripts/select-hyprview-layout.sh | 72 +++++++++++++++++++++++++++ config/hypr/scripts/toggle-qs-hyprview.sh | 31 ++++++++++-- 4 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 config/hypr/UserConfigs/hyprview-layout.conf create mode 100755 config/hypr/scripts/select-hyprview-layout.sh (limited to 'config/hypr') diff --git a/config/hypr/UserConfigs/hyprview-layout.conf b/config/hypr/UserConfigs/hyprview-layout.conf new file mode 100644 index 00000000..7c142eb1 --- /dev/null +++ b/config/hypr/UserConfigs/hyprview-layout.conf @@ -0,0 +1 @@ +smartgrid diff --git a/config/hypr/scripts/Kool_Quick_Settings.sh b/config/hypr/scripts/Kool_Quick_Settings.sh index fa7e520b..442cdcc6 100755 --- a/config/hypr/scripts/Kool_Quick_Settings.sh +++ b/config/hypr/scripts/Kool_Quick_Settings.sh @@ -339,6 +339,9 @@ handle_choice() { "Edit User Laptop Settings") file="$(resolve_user_overlay_file "$user_laptops_lua" "$user_laptops_conf")" ;; + "Select Hyprview Layout") + "$scriptsDir/select-hyprview-layout.sh" + ;; "Edit System Default Keybinds") if [[ "$hypr_config_mode" == "lua" ]]; then file="$(resolve_system_lua_file system_keybinds.lua)"; else file="$configs/Keybinds.conf"; fi ;; @@ -453,6 +456,7 @@ Edit User Settings Edit User Decorations Edit User Animations Edit User Laptop Settings +Select Hyprview Layout EOF ) ;; 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 diff --git a/config/hypr/scripts/toggle-qs-hyprview.sh b/config/hypr/scripts/toggle-qs-hyprview.sh index 4f00762e..53786a1c 100755 --- a/config/hypr/scripts/toggle-qs-hyprview.sh +++ b/config/hypr/scripts/toggle-qs-hyprview.sh @@ -1,15 +1,36 @@ #!/usr/bin/env bash -layout="${1:-smartgrid}" +# Available layouts +# +# "smartgrid", "justified", "masonry", "bands", "hero", "spiral" +# "satellite", "staggered", "columnar", "vortex", "random" +# + +default_layout="smartgrid" +layout_config="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserConfigs/hyprview-layout.conf" +layout="${1:-}" config_name="qs-hyprview" config_path="${XDG_CONFIG_HOME:-$HOME/.config}/quickshell/${config_name}" +if [[ -z "$layout" ]]; then + if [[ -f "$layout_config" && -r "$layout_config" ]]; then + layout="$(sed -n '1p' "$layout_config" | tr -d '[:space:]')" + else + notify-send "Can't read hyprview-layout.conf, falling back to smartgrid" + fi +fi + +case "$layout" in +smartgrid | justified | masonry | bands | hero | spiral | satellite | staggered | columnar | vortex | random) ;; +*) layout="$default_layout" ;; +esac + if ! pgrep -u "${UID}" -f "qs .* -p ${config_path}($| )" >/dev/null 2>&1; then - qs --log-rules "qt.qpa.wayland.textinput.warning=false" -p "${config_path}" >/dev/null 2>&1 & - sleep 0.2 + qs --log-rules "qt.qpa.wayland.textinput.warning=false" -p "${config_path}" >/dev/null 2>&1 & + sleep 0.2 fi if ! qs -c "${config_name}" ipc call expose toggle "${layout}" >/dev/null 2>&1; then - sleep 0.3 - qs -c "${config_name}" ipc call expose toggle "${layout}" + sleep 0.3 + qs -c "${config_name}" ipc call expose toggle "${layout}" fi -- cgit v1.2.3