#!/usr/bin/env bash # Detect fish shell and ask user to switch to bash (bash-only syntax) if [ -n "${FISH_VERSION:-}" ] || case "$SHELL" in *fish*) ;; *) false ;; esac; then echo "Warning: fish shell detected." echo "This script is written for bash and may have syntax issues under fish." echo "Please switch to bash first and re-run it, e.g.: bash $0" read -r -p "Press Enter to continue anyway, or Ctrl+C to cancel..." "$WORKSPACES_LUA" echo "Generated $WORKSPACES_LUA" patched=1 else echo "Warning: $WORKSPACE_CONF not found. Creating default $WORKSPACES_LUA ..." cat > "$WORKSPACES_LUA" <<- 'LUA' -- Default workspaces generated by fix-nwg-hyprland-lua.sh -- Workspaces 1-10 are available on all monitors for i = 1, 10 do hl.workspace_rule({ workspace = tostring(i) }) end LUA echo "Created default $WORKSPACES_LUA" patched=1 fi else echo "Skipped workspaces.lua: already exists" fi # When monitors.lua is missing, only warn (conversion from monitors.conf is # non-trivial; run nwg-displays to generate it, or `cp monitors.conf monitors.lua` # is not valid because the formats differ). if [ ! -f "$HYPR_DIR/monitors.lua" ]; then echo "Warning: $HYPR_DIR/monitors.lua not found." echo " Run nwg-displays to generate it, or create it manually with hl.monitor() calls." fi if [ "$patched" -eq 1 ]; then echo "" echo "Done! Run 'hyprctl reload' or restart Hyprland for the fix to take effect." echo "nwg-displays changes should now apply immediately." else echo "" echo "No changes needed." fi