diff options
| author | Don Williams <don.e.williams@gmail.com> | 2025-11-02 17:23:53 -0500 |
|---|---|---|
| committer | Don Williams <don.e.williams@gmail.com> | 2025-11-02 17:23:53 -0500 |
| commit | 7441f2cb05b6916ff7cb08a8c0f14b7ff865a1b1 (patch) | |
| tree | 26097b0f6063f1f388ca3f1882049ef055a50bb7 | |
| parent | 4687cfc8c6786ebaae169e19219f1cf9f3be982d (diff) | |
feat: Add smart AGS/Quickshell fallback with OverviewToggle wrapper
Implements a robust fallback mechanism for desktop overview functionality
that handles both AGS and Quickshell installations gracefully.
Changes:
- Add OverviewToggle.sh wrapper script that tries Quickshell first,
falls back to AGS if unavailable or broken
- Update UserKeybinds.conf with new SUPER+A binding to OverviewToggle.sh
- Preserve original AGS and Quickshell keybinds as commented references
- Simplify copy.sh logic to enable both AGS and QS simultaneously
- Remove conflicting keybind toggle logic from copy.sh
Benefits:
- Users can have both AGS and Quickshell installed simultaneously
- Automatic fallback when one tool is broken or unavailable
- Quickshell preferred (tried first) as it's more performant
- Graceful degradation with user notification if neither available
- Auto-starts AGS if installed but not running
- Compatible with existing upgrade.sh and ComposeHyprConfigs.sh workflow
Technical details:
- OverviewToggle.sh checks for running processes before attempting toggle
- Uses hyprctl dispatch for Quickshell's global dispatcher
- Falls back to ags -t 'overview' with rofi cleanup for AGS
- Shows desktop notification if neither tool is available
- Script auto-made executable via existing chmod in copy.sh (line 1027)
Addresses: Issue where AGS and Quickshell have had recent stability
problems, requiring manual keybind switching between them
| -rw-r--r-- | config/hypr/UserConfigs/UserKeybinds.conf | 1 | ||||
| -rw-r--r-- | config/hypr/scripts/OverviewToggle.sh | 28 | ||||
| -rwxr-xr-x | copy.sh | 21 |
3 files changed, 36 insertions, 14 deletions
diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf index 4bebe342..17711559 100644 --- a/config/hypr/UserConfigs/UserKeybinds.conf +++ b/config/hypr/UserConfigs/UserKeybinds.conf @@ -18,6 +18,7 @@ source= $UserConfigs/01-UserDefaults.conf #bindr = $mainMod, $mainMod_L, exec, pkill rofi || rofi -show drun -modi drun,filebrowser,run,window # Super Key to Launch rofi menu bindd = $mainMod, D, app launcher, exec, pkill rofi || true && rofi -show drun -modi drun,filebrowser,run,window bindd = $mainMod, B, open default browser, exec, xdg-open "https://" +bindd = $mainMod, A, desktop overview, exec, $scriptsDir/OverviewToggle.sh # toggles quickshell or ags overview (tries QS first, falls back to AGS) #bindd = $mainMod, A, ags overview, exec, pkill rofi || true && ags -t 'overview' # desktop overview (if installed) #bindd = $mainMod, A, Quickshell overview, global, quickshell:overviewToggle # desktop overview (if installed) bindd = $mainMod, Return, Open terminal, exec, $term diff --git a/config/hypr/scripts/OverviewToggle.sh b/config/hypr/scripts/OverviewToggle.sh new file mode 100644 index 00000000..18683984 --- /dev/null +++ b/config/hypr/scripts/OverviewToggle.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ # +# Overview toggle wrapper - tries quickshell first, falls back to AGS + +# Try quickshell first if installed +if command -v qs >/dev/null 2>&1; then + # Check if quickshell is running + if pgrep -x qs >/dev/null 2>&1; then + # Try to toggle quickshell overview + hyprctl dispatch global quickshell:overviewToggle 2>/dev/null && exit 0 + fi +fi + +# Fall back to AGS if quickshell failed or isn't available +if command -v ags >/dev/null 2>&1; then + # Check if AGS is running, start it if not + if ! pgrep -x ags >/dev/null 2>&1; then + ags & + sleep 0.5 + fi + # Toggle AGS overview + pkill rofi || true + ags -t 'overview' 2>/dev/null && exit 0 +fi + +# If we get here, neither worked +notify-send "Overview" "Neither Quickshell nor AGS is available" -u low 2>/dev/null || true +exit 1 @@ -259,38 +259,31 @@ if command -v blueman-applet >/dev/null 2>&1; then grep -qx 'exec-once = blueman-applet' "$OVERLAY_SA" || echo 'exec-once = blueman-applet' >>"$OVERLAY_SA" fi -# Check if ags is installed edit ags behaviour on configs +# Check if ags is installed and enable it if command -v ags >/dev/null 2>&1; then + echo "${INFO} AGS detected - enabling in startup and refresh scripts" 2>&1 | tee -a "$LOG" OVERLAY_SA="config/hypr/UserConfigs/Startup_Apps.conf" mkdir -p "$(dirname "$OVERLAY_SA")" touch "$OVERLAY_SA" grep -qx 'exec-once = ags' "$OVERLAY_SA" || echo 'exec-once = ags' >>"$OVERLAY_SA" sed -i '/#ags -q && ags &/s/^#//' config/hypr/scripts/RefreshNoWaybar.sh sed -i '/#ags -q && ags &/s/^#//' config/hypr/scripts/Refresh.sh - - # Uncomment the ags overview keybind - sed -i '/^#bind = \$mainMod, A, exec, pkill rofi || true && ags -t '\''overview'\''/s/^#//' config/hypr/UserConfigs/UserKeybinds.conf - - # Comment the quickshell line if not already commented - sed -i '/^\s*bind\s*=\s*\$mainMod,\s*A,\s*global,\s*quickshell:overviewToggle/{s/^\s*/#/}' config/hypr/UserConfigs/UserKeybinds.conf fi -# Check if quickshell is installed; edit quickshell behaviour on configs +# Check if quickshell is installed and enable it if command -v qs >/dev/null 2>&1; then + echo "${INFO} Quickshell detected - enabling in startup and refresh scripts" 2>&1 | tee -a "$LOG" OVERLAY_SA="config/hypr/UserConfigs/Startup_Apps.conf" mkdir -p "$(dirname "$OVERLAY_SA")" touch "$OVERLAY_SA" grep -qx 'exec-once = qs' "$OVERLAY_SA" || echo 'exec-once = qs' >>"$OVERLAY_SA" sed -i '/#pkill qs && qs &/s/^#//' config/hypr/scripts/RefreshNoWaybar.sh sed -i '/#pkill qs && qs &/s/^#//' config/hypr/scripts/Refresh.sh - - # Uncomment the quickshell keybind line - sed -i "/^#bind = \$mainMod, A, global, quickshell:overviewToggle/s/^#//" config/hypr/UserConfigs/UserKeybinds.conf - - # Ensure the ags overview keybind is commented - sed -i "/^\s*bind\s*=\s*\\\$mainMod,\s*A,\s*exec,\s*pkill rofi\s*||\s*true\s*&&\s*ags\s*-t\s*'overview'/{s/^\s*/#/}" config/hypr/UserConfigs/UserKeybinds.conf fi +# Note: The SUPER+A keybind now uses OverviewToggle.sh which automatically +# tries quickshell first and falls back to AGS, so both can be installed + printf "\n%.0s" {1..1} # Checking if neovim or vim is installed and offer user if they want to make as default editor |
