Skip to content

Commit 03b93f1

Browse files
authored
Merge pull request #86 from JaKooLit/ags-fix
Ags fix - Ported from ubuntu/debian fixes
2 parents 9a04e54 + f5b4a9c commit 03b93f1

2 files changed

Lines changed: 208 additions & 13 deletions

File tree

WARP.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# WARP.md
2+
3+
This file provides guidance to WARP (warp.dev) when working with code in this repository.
4+
5+
## Essential commands
6+
7+
- Install (interactive)
8+
- chmod +x install.sh && ./install.sh
9+
- Install with a preset file
10+
- ./install.sh --preset presets/my-desktop.preset
11+
- Example preset (ON/OFF strings are read via `source`):
12+
```bash
13+
gtk_themes="ON"
14+
bluetooth="OFF"
15+
thunar="ON"
16+
ags="ON"
17+
sddm="OFF"
18+
sddm_theme="OFF"
19+
xdph="ON"
20+
zsh="ON"
21+
pokemon="OFF"
22+
rog="OFF"
23+
dots="ON"
24+
input_group="OFF"
25+
nvidia="OFF"
26+
```
27+
- Re-run a specific module (from repo root; do not cd into install-scripts)
28+
- ./install-scripts/<script-name>.sh
29+
- Examples: ./install-scripts/gtk_themes.sh, ./install-scripts/sddm.sh, ./install-scripts/04-Final-Check.sh
30+
- Auto installer (local wrapper)
31+
- ./auto-install.sh
32+
- Uninstall (guided)
33+
- chmod +x uninstall.sh && ./uninstall.sh
34+
- Logs
35+
- All runs write timestamped logs to Install-Logs/
36+
- Tail last log: ls -t Install-Logs | head -n1 | xargs -I{} tail -n 200 -f Install-Logs/{}
37+
38+
Notes from README that affect usage
39+
- Do not run as root; run from a directory where you have write permissions (e.g., your home).
40+
- If a login manager like GDM/LightDM is active, SDDM install options will be disabled until you stop/disable them and reboot.
41+
- On NVIDIA systems, the script can configure the G06 driver when you select the NVIDIA option.
42+
- In VMs, enable 3D acceleration or Hyprland may not start.
43+
44+
## High-level architecture
45+
46+
This repo is a modular Bash installer for Hyprland on openSUSE Tumbleweed. There is no build or test suite; development involves editing shell modules and running them.
47+
48+
- Entry point: install.sh
49+
- Guards: not-root, ensures `whiptail`/`pciutils` exist, logs to Install-Logs/.
50+
- Interactive flow (whiptail) selects features; supports `--preset <file>` by sourcing ON/OFF flags.
51+
- Environment detection: active login managers (disables SDDM path), NVIDIA GPU prompt.
52+
- Orchestration order (core): adds Packman repo → installs base deps → fonts → Hyprland core → ecosystem → forced installs → OBS/opi pkgs → wallust → optional selections → final cleanup → final package check.
53+
- Executes modules via a helper that keeps paths and executability consistent.
54+
55+
- Module library: install-scripts/
56+
- Global_functions.sh: shared helpers used by all modules
57+
- zypper/opi install variants (normal, no-recommends, force, auto-agree), cargo install, package removal
58+
- progress spinner, colorized output, central logging
59+
- Core modules (representative)
60+
- 00-add-repo.sh (Packman), 01-dependencies.sh (patterns + opi), hyprland.sh (Hyprland packages)
61+
- 02-hypr-pkgs.sh (main and secondary desktop packages, no-recommends list, uninstall conflicts), 03-opi-pkgs.sh (OBS via `opi`)
62+
- force-install.sh (reinstall edge cases), 04-Final-Check.sh (verifies essential packages and /usr/local tools)
63+
- Optional feature modules (selected in install.sh)
64+
- Examples: sddm.sh and sddm_theme.sh, gtk_themes.sh, xdph.sh (xdg-desktop-portal-hyprland), bluetooth.sh, thunar.sh (+ thunar_default.sh), ags.sh (builds AGS v1.9.0 via git/npm/meson and installs wrapper in /usr/local/bin), nvidia.sh, rog.sh, dotfiles-main.sh, wallust.sh, InputGroup.sh, zsh.sh, zsh_pokemon.sh
65+
66+
- Automation/maintenance
67+
- auto-install.sh: clone-or-update then run install.sh
68+
- uninstall.sh: interactive package and config removal (zypper removes, deletes ~/.config/* selections)
69+
70+
## Repository documents considered
71+
72+
- README.md: usage, prerequisites, uninstall availability, and operational caveats (NVIDIA, SDDM, VM acceleration, re-running modules from repo root).
73+
- CONTRIBUTING.md and .github/PULL_REQUEST_TEMPLATE.md: contribution flow; no repo-defined lint/typecheck/test commands.
74+
75+
## What’s not here
76+
77+
- No configured linter, formatter, or test suite in this repo. If you need linting, run your preferred shell tools locally (e.g., shellcheck, shfmt) but there are no project scripts for them.

install-scripts/ags.sh

Lines changed: 131 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Aylur's GTK Shell v 1.9.0 #
44
# for desktop overview
55

6+
set -euo pipefail
67

78
ags=(
89
typescript
@@ -16,6 +17,13 @@ ags=(
1617
NetworkManager
1718
libdbusmenu-gtk3-4
1819
libpulse-devel
20+
gobject-introspection
21+
gobject-introspection-devel
22+
)
23+
24+
# Packages to force re-install (if needed)
25+
f_ags=(
26+
npm
1927
)
2028

2129
# specific tags to download
@@ -38,34 +46,57 @@ fi
3846
LOG="Install-Logs/install-$(date +%d-%H%M%S)_ags.log"
3947
MLOG="install-$(date +%d-%H%M%S)_ags2.log"
4048

41-
# Check if AGS is installed
42-
if command -v ags &>/dev/null; then
43-
AGS_VERSION=$(ags -v | awk '{print $NF}')
49+
# Check if AGS is installed (only if main ESM exists to avoid wrapper error)
50+
AGS_ESM=""
51+
if [ -f "/usr/local/share/com.github.Aylur.ags/com.github.Aylur.ags" ]; then
52+
AGS_ESM="/usr/local/share/com.github.Aylur.ags/com.github.Aylur.ags"
53+
elif [ -f "/usr/share/com.github.Aylur.ags/com.github.Aylur.ags" ]; then
54+
AGS_ESM="/usr/share/com.github.Aylur.ags/com.github.Aylur.ags"
55+
fi
56+
57+
if command -v ags &>/dev/null && [ -n "$AGS_ESM" ]; then
58+
AGS_VERSION=$(ags -v | awk '{print $NF}')
4459
if [[ "$AGS_VERSION" == "1.9.0" ]]; then
45-
printf "${INFO} ${MAGENTA}Aylur's GTK Shell v1.9.0${RESET} is already installed. Skipping installation."
46-
printf "\n%.0s" {1..2}
47-
exit 0
60+
printf "${INFO} ${MAGENTA}Aylur's GTK Shell v1.9.0${RESET} is already installed.\n"
61+
read -r -p "Reinstall v1.9.0 anyway? [y/N]: " REPLY
62+
case "$REPLY" in
63+
[yY]|[yY][eE][sS])
64+
printf "${NOTE} Reinstalling Aylur's GTK Shell v1.9.0...\n"
65+
;;
66+
*)
67+
printf "Skipping reinstallation.\n"
68+
printf "\n%.0s" {1..2}
69+
exit 0
70+
;;
71+
esac
4872
fi
4973
fi
5074

5175
# Installation of main components
52-
printf "\n%s - Installing ${SKY_BLUE}Aylur's GTK shell $ags_tag${RESET} Dependencies \n" "${NOTE}"
76+
printf "\n%s - Installing ${SKY_BLUE}Aylur's GTK shell $ags_tag${RESET} Dependencies \n" "${INFO}"
5377

5478
# Installing ags Dependencies
5579
for PKG1 in "${ags[@]}"; do
5680
install_package "$PKG1" "$LOG"
5781
done
5882

83+
# Force reinstall select packages if requested
84+
for force_ags in "${f_ags[@]}"; do
85+
install_package_force "$force_ags" 2>&1 | tee -a "$LOG"
86+
done
87+
5988
printf "\n%.0s" {1..1}
6089

6190
# ags v1
6291
printf "${NOTE} Install and Compiling ${SKY_BLUE}Aylur's GTK shell $ags_tag${RESET}..\n"
6392

64-
# Check if directory exists and remove it
65-
if [ -d "ags" ]; then
66-
printf "${NOTE} Removing existing ags directory...\n"
67-
rm -rf "ags"
68-
fi
93+
# Remove previous sources (both legacy "ags" and tagged "ags_v1.9.0")
94+
for SRC_DIR in "ags" "ags_v1.9.0"; do
95+
if [ -d "$SRC_DIR" ]; then
96+
printf "${NOTE} Removing existing %s directory...\n" "$SRC_DIR"
97+
rm -rf "$SRC_DIR"
98+
fi
99+
done
69100

70101
printf "\n%.0s" {1..1}
71102
printf "${INFO} Kindly Standby...cloning and compiling ${SKY_BLUE}Aylur's GTK shell $ags_tag${RESET}...\n"
@@ -76,7 +107,94 @@ if git clone --depth=1 https://github.com/JaKooLit/ags_v1.9.0.git; then
76107
npm install
77108
meson setup build
78109
if sudo meson install -C build 2>&1 | tee -a "$MLOG"; then
110+
: # with pipefail set, this reflects meson install status
79111
printf "\n${OK} ${YELLOW}Aylur's GTK shell $ags_tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG"
112+
113+
# Patch installed AGS launchers to ensure GI typelibs in /usr/local/lib are discoverable in GJS ESM
114+
printf "${NOTE} Applying AGS launcher patch for GI typelibs search path...\n"
115+
116+
patch_ags_launcher() {
117+
local target="$1"
118+
if ! sudo test -f "$target"; then
119+
return 1
120+
fi
121+
122+
# 1) Remove deprecated GIR Repository path tweaks and GIRepository import (harmless if absent)
123+
sudo sed -i \
124+
-e '/Repository\.prepend_search_path/d' \
125+
-e '/Repository\.prepend_library_path/d' \
126+
-e '/gi:\/\/GIRepository/d' \
127+
"$target"
128+
129+
# 2) Ensure GLib import exists (insert after first import line, or at top if none)
130+
if ! sudo grep -q '^import GLib from "gi://GLib";' "$target"; then
131+
TMPF=$(sudo mktemp)
132+
sudo awk 'BEGIN{added=0} {
133+
if (!added && $0 ~ /^import /) { print; print "import GLib from \"gi://GLib\";"; added=1; next }
134+
print
135+
} END { if (!added) print "import GLib from \"gi://GLib\";" }' "$target" | sudo tee "$TMPF" >/dev/null
136+
sudo mv "$TMPF" "$target"
137+
fi
138+
139+
# 3) Inject GI_TYPELIB_PATH export right after the GLib import (once)
140+
if ! sudo grep -q 'GLib.setenv("GI_TYPELIB_PATH"' "$target"; then
141+
TMPF=$(sudo mktemp)
142+
sudo awk '{print} $0 ~ /^import GLib from "gi:\/\/GLib";$/ {print "const __old = GLib.getenv(\"GI_TYPELIB_PATH\");"; print "GLib.setenv(\"GI_TYPELIB_PATH\", \"/usr/local/lib64:/usr/local/lib:/usr/local/lib64/girepository-1.0:/usr/local/lib/girepository-1.0:/usr/lib64/girepository-1.0:/usr/lib/girepository-1.0:/usr/lib64/ags:/usr/local/lib/ags\" + (__old ? \":\" + __old : \"\"), true);"; print "const __oldld = GLib.getenv(\"LD_LIBRARY_PATH\");"; print "GLib.setenv(\"LD_LIBRARY_PATH\", \"/usr/local/lib64:/usr/local/lib\" + (__oldld ? \":\" + __oldld : \"\"), true);"}' "$target" | sudo tee "$TMPF" >/dev/null
143+
sudo mv "$TMPF" "$target"
144+
fi
145+
146+
# 4) Ensure LD_LIBRARY_PATH export exists even if GI_TYPELIB_PATH was already present
147+
if ! sudo grep -q 'GLib.setenv("LD_LIBRARY_PATH"' "$target"; then
148+
TMPF=$(sudo mktemp)
149+
sudo awk '{print} $0 ~ /^import GLib from "gi:\/\/GLib";$/ {print "const __oldld = GLib.getenv(\"LD_LIBRARY_PATH\");"; print "GLib.setenv(\"LD_LIBRARY_PATH\", \"/usr/local/lib64:/usr/local/lib\" + (__oldld ? \":\" + __oldld : \"\"), true);"}' "$target" | sudo tee "$TMPF" >/dev/null
150+
sudo mv "$TMPF" "$target"
151+
fi
152+
153+
# Restore executable bit for bin wrappers (mv from mktemp resets mode to 0600)
154+
case "$target" in
155+
*/bin/ags)
156+
sudo chmod 0755 "$target" || true
157+
;;
158+
esac
159+
160+
printf "${OK} Patched: %s\n" "$target"
161+
return 0
162+
}
163+
164+
# Try common locations
165+
for CAND in \
166+
"/usr/local/share/com.github.Aylur.ags/com.github.Aylur.ags" \
167+
"/usr/share/com.github.Aylur.ags/com.github.Aylur.ags" \
168+
"/usr/local/bin/ags" \
169+
"/usr/bin/ags"; do
170+
patch_ags_launcher "$CAND" || true
171+
done
172+
173+
# Create an env-setting wrapper for AGS to ensure GI typelibs/libs are discoverable
174+
printf "${NOTE} Creating env wrapper /usr/local/bin/ags...\n"
175+
sudo tee /usr/local/bin/ags >/dev/null <<'WRAP'
176+
#!/usr/bin/env bash
177+
set -euo pipefail
178+
cd "$HOME" 2>/dev/null || true
179+
# Locate AGS ESM entry
180+
MAIN_JS="/usr/local/share/com.github.Aylur.ags/com.github.Aylur.ags"
181+
if [ ! -f "$MAIN_JS" ]; then
182+
MAIN_JS="/usr/share/com.github.Aylur.ags/com.github.Aylur.ags"
183+
fi
184+
if [ ! -f "$MAIN_JS" ]; then
185+
echo "Unable to find AGS entry script (com.github.Aylur.ags) in /usr/local/share or /usr/share" >&2
186+
exit 1
187+
fi
188+
# Ensure GI typelibs and native libs are discoverable before gjs ESM loads
189+
export GI_TYPELIB_PATH="/usr/local/lib64:/usr/local/lib:/usr/local/lib64/girepository-1.0:/usr/local/lib/girepository-1.0:/usr/lib64/girepository-1.0:/usr/lib/girepository-1.0:/usr/lib64/ags:/usr/local/lib/ags:${GI_TYPELIB_PATH-}"
190+
export LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/lib:${LD_LIBRARY_PATH-}"
191+
exec /usr/bin/gjs -m "$MAIN_JS" "$@"
192+
WRAP
193+
sudo chmod 0755 /usr/local/bin/ags
194+
# Ensure ESM entry is readable by gjs
195+
sudo chmod 0644 /usr/local/share/com.github.Aylur.ags/com.github.Aylur.ags 2>/dev/null || true
196+
sudo chmod 0644 /usr/share/com.github.Aylur.ags/com.github.Aylur.ags 2>/dev/null || true
197+
printf "${OK} AGS wrapper installed at /usr/local/bin/ags\n"
80198
else
81199
echo -e "\n${ERROR} ${YELLOW}Aylur's GTK shell $ags_tag${RESET} Installation failed\n " 2>&1 | tee -a "$MLOG"
82200
fi
@@ -89,4 +207,4 @@ else
89207
exit 1
90208
fi
91209

92-
printf "\n%.0s" {1..2}
210+
printf "\n%.0s" {1..2}

0 commit comments

Comments
 (0)