mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
feat: Everything in the home folder under steamify (state, scripts, icon), moved once from the old name
This commit is contained in:
1 parent
2e0881b4fa
commit
479b70b337
10 files changed
+113
-20
No files matched your search
+59
-1
@@ -5,7 +5,11 @@
|
||||
# deletes the key if it didn't exist before).
|
||||
# Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/cachyos-gamescope-boot"
|
||||
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/steamify"
|
||||
# Steamify's own files in the home folder: the app (app/, from
|
||||
# steamify-app.sh) and the shortcut's and notifier's scripts (bin/).
|
||||
STEAMIFY_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/steamify"
|
||||
STEAMIFY_BIN="$STEAMIFY_DATA/bin"
|
||||
UNSET=$'\x01'
|
||||
|
||||
kset() {
|
||||
@@ -77,3 +81,57 @@ state_clear() {
|
||||
current_display_manager() {
|
||||
systemctl show -p Id --value display-manager 2>/dev/null | sed 's/\.service$//'
|
||||
}
|
||||
|
||||
migrate_dir() {
|
||||
# migrate_dir <old> <new>: moves <old> to <new> and leaves a symlink.
|
||||
# When both exist (an older release ran after a newer one), what <new>
|
||||
# lacks is moved over; a file in both keeps <new>'s copy and <old> stays
|
||||
# as it is. Returns 0 when something moved.
|
||||
local old="$1" new="$2" f moved=1
|
||||
[[ -d "$old" && ! -L "$old" ]] || return 1
|
||||
if [[ ! -e "$new" ]]; then
|
||||
mkdir -p "$(dirname "$new")"
|
||||
mv "$old" "$new" && ln -s "$new" "$old"
|
||||
return 0
|
||||
fi
|
||||
for f in "$old"/* "$old"/.[!.]*; do
|
||||
[[ -e "$f" || -L "$f" ]] || continue
|
||||
[[ -e "$new/${f##*/}" ]] && continue
|
||||
mv "$f" "$new/" && moved=0
|
||||
done
|
||||
rmdir "$old" 2>/dev/null && ln -s "$new" "$old"
|
||||
return "$moved"
|
||||
}
|
||||
|
||||
migrate_layout() {
|
||||
# Before 2.5.0 the state and scripts were under the project's old name
|
||||
# (cachyos-gamescope-boot). Moved once; the old names stay as symlinks,
|
||||
# so an older release that still runs finds the same state.
|
||||
local old_state="${XDG_STATE_HOME:-$HOME/.local/state}/cachyos-gamescope-boot"
|
||||
local old_bin="${XDG_DATA_HOME:-$HOME/.local/share}/cachyos-gamescope-boot"
|
||||
local old_icon="${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor/scalable/apps/cachyos-gamescope-boot-wizard.svg"
|
||||
local f
|
||||
# Links left pointing at nothing once their component was turned off.
|
||||
for f in "$old_state" "$old_bin"; do [[ -L "$f" && ! -e "$f" ]] && rm -f "$f"; done
|
||||
migrate_dir "$old_state" "$STATE_DIR"
|
||||
if migrate_dir "$old_bin" "$STEAMIFY_BIN"; then
|
||||
# The notifier had the old paths built in; its unit and the
|
||||
# shortcut's entries point at the scripts.
|
||||
[[ -f "$STEAMIFY_BIN/steamify-notifier" ]] &&
|
||||
patch_file steamify-notifier.py | install_executable "$STEAMIFY_BIN/steamify-notifier" 755
|
||||
for f in "$NOTIFY_UNITS/$NOTIFY_NAME.service" "$WIZARD_APP_ENTRY" "$WIZARD_TERMINAL_ENTRY" \
|
||||
"$(wizard_desktop_dir)/$WIZARD_DESKTOP_NAME"; do
|
||||
[[ -f "$f" ]] && sed -i "s|$old_bin/|$STEAMIFY_BIN/|g" "$f"
|
||||
done
|
||||
systemctl --user daemon-reload 2>/dev/null
|
||||
fi
|
||||
if [[ -f "$old_icon" ]]; then
|
||||
if [[ -e "$WIZARD_ICON" ]]; then rm -f "$old_icon"; else mv "$old_icon" "$WIZARD_ICON"; fi
|
||||
gtk-update-icon-cache -q -f -t "$(dirname "$(dirname "$(dirname "$WIZARD_ICON")")")" 2>/dev/null || true
|
||||
fi
|
||||
for f in "$WIZARD_APP_ENTRY" "$WIZARD_TERMINAL_ENTRY" "$(wizard_desktop_dir)/$WIZARD_DESKTOP_NAME"; do
|
||||
[[ -f "$f" ]] && grep -q '^Icon=cachyos-gamescope-boot-wizard$' "$f" &&
|
||||
sed -i 's|^Icon=cachyos-gamescope-boot-wizard$|Icon=steamify|' "$f"
|
||||
done
|
||||
return 0
|
||||
}
|
||||
@@ -311,7 +311,9 @@ led_dkms_override_remove() {
|
||||
sudo rm -f "$LED_DKMS_OVERRIDE"
|
||||
fi
|
||||
}
|
||||
HEADERS_SCRIPT="/usr/local/lib/cachyos-gamescope-boot/ensure-kernel-headers"
|
||||
HEADERS_SCRIPT="/usr/local/lib/steamify/ensure-kernel-headers"
|
||||
# Before 2.5.0; removed when it's set up again or turned off.
|
||||
HEADERS_SCRIPT_OLD="/usr/local/lib/cachyos-gamescope-boot/ensure-kernel-headers"
|
||||
HEADERS_UNIT="/etc/systemd/system/ensure-kernel-headers.service"
|
||||
|
||||
install_headers_boot_check() {
|
||||
@@ -323,6 +325,7 @@ install_headers_boot_check() {
|
||||
sudo mkdir -p "$(dirname "$HEADERS_SCRIPT")"
|
||||
patch_file ensure-kernel-headers.sh | sudo tee "$HEADERS_SCRIPT" > /dev/null
|
||||
sudo chmod 755 "$HEADERS_SCRIPT"
|
||||
sudo rm -rf "$(dirname "$HEADERS_SCRIPT_OLD")"
|
||||
service_file ensure-kernel-headers.service HEADERS_SCRIPT="$HEADERS_SCRIPT" | sudo tee "$HEADERS_UNIT" > /dev/null
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable ensure-kernel-headers.service
|
||||
@@ -432,7 +435,7 @@ machine_disable() {
|
||||
sudo systemctl disable ensure-kernel-headers.service 2>/dev/null
|
||||
led_dkms_override_remove
|
||||
sudo rm -f "$HEADERS_UNIT" "$HEADERS_SCRIPT"
|
||||
sudo rmdir "$(dirname "$HEADERS_SCRIPT")" 2>/dev/null
|
||||
sudo rm -rf "$(dirname "$HEADERS_SCRIPT")" "$(dirname "$HEADERS_SCRIPT_OLD")"
|
||||
sudo systemctl daemon-reload
|
||||
ok "Steam Machine support removed (the AUR helper, if installed, is kept)."
|
||||
}
|
||||
@@ -6,8 +6,7 @@
|
||||
# then; it never updates anything itself (patches/steamify-notifier.py).
|
||||
# Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
NOTIFY_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/cachyos-gamescope-boot"
|
||||
NOTIFY_SCRIPT="$NOTIFY_DIR/steamify-notifier"
|
||||
NOTIFY_SCRIPT="$STEAMIFY_BIN/steamify-notifier"
|
||||
NOTIFY_UNITS="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
|
||||
NOTIFY_NAME=steamify-update-check
|
||||
|
||||
@@ -52,7 +51,7 @@ notify_enable() {
|
||||
notify_disable() {
|
||||
systemctl --user disable --now "$NOTIFY_NAME.timer" "$NOTIFY_NAME.service" >/dev/null 2>&1
|
||||
rm -f "$NOTIFY_UNITS/$NOTIFY_NAME.service" "$NOTIFY_UNITS/$NOTIFY_NAME.timer" "$NOTIFY_SCRIPT"
|
||||
rmdir "$NOTIFY_DIR" 2>/dev/null || true
|
||||
rmdir "$STEAMIFY_BIN" 2>/dev/null || true
|
||||
systemctl --user daemon-reload
|
||||
state_clear notify
|
||||
ok "Update notifications off."
|
||||
|
||||
@@ -10,9 +10,9 @@ WIZARD_RELEASE="https://github.com/theupriser/steamify-cachyos/releases/latest/d
|
||||
WIZARD_URL="$WIZARD_RELEASE/steamify.sh"
|
||||
WIZARD_APP_URL="$WIZARD_RELEASE/steamify-app.sh"
|
||||
# Steam logo with a gear (assets/ in the repo, published with every release).
|
||||
WIZARD_ICON="${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor/scalable/apps/cachyos-gamescope-boot-wizard.svg"
|
||||
WIZARD_LAUNCHER="${XDG_DATA_HOME:-$HOME/.local/share}/cachyos-gamescope-boot/run-wizard"
|
||||
WIZARD_APP_LAUNCHER="${XDG_DATA_HOME:-$HOME/.local/share}/cachyos-gamescope-boot/run-app"
|
||||
WIZARD_ICON="${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor/scalable/apps/steamify.svg"
|
||||
WIZARD_LAUNCHER="$STEAMIFY_BIN/run-wizard"
|
||||
WIZARD_APP_LAUNCHER="$STEAMIFY_BIN/run-app"
|
||||
WIZARD_APPS="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
|
||||
# steamify-ui: the id the app gives itself, so its window belongs to this
|
||||
# entry. steamify-app.sh leaves an entry with X-Steamify-Shortcut alone.
|
||||
@@ -91,7 +91,7 @@ EOF
|
||||
tmp="$(mktemp)"
|
||||
if curl -fsSL --max-time 20 "$WIZARD_RELEASE/steam-gaming-settings.svg" -o "$tmp" && grep -q '<svg' "$tmp"; then
|
||||
install -D -m 644 "$tmp" "$WIZARD_ICON"
|
||||
icon=cachyos-gamescope-boot-wizard
|
||||
icon=steamify
|
||||
gtk-update-icon-cache -q -f -t "${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor" 2>/dev/null || true
|
||||
else
|
||||
warn "Couldn't download the shortcut's icon; using Steam's icon instead."
|
||||
|
||||
Reference in new issue
Block a user