diff --git a/assets/steamify-symbolic.svg b/assets/steamify-symbolic.svg new file mode 100644 index 0000000..c413d5b --- /dev/null +++ b/assets/steamify-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/update-notifier.sh b/lib/update-notifier.sh index 6b20c34..5f3c3fb 100644 --- a/lib/update-notifier.sh +++ b/lib/update-notifier.sh @@ -35,6 +35,9 @@ notify_enable() { sudo pacman -S --needed --noconfirm "${missing[@]}" || { err "Installing ${missing[*]} failed."; return 1; } fi + # The single-color icon for GNOME's top bar tray. + patch_file steamify-symbolic.svg | install -D -m 644 /dev/stdin \ + "${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor/symbolic/apps/steamify-symbolic.svg" patch_file steamify-notifier.py | install_executable "$NOTIFY_SCRIPT" 755 || { err "Couldn't write $NOTIFY_SCRIPT."; return 1; } mkdir -p "$NOTIFY_UNITS" @@ -51,6 +54,7 @@ notify_enable() { notify_disable() { user_systemctl 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" + rm -f "${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor/symbolic/apps/steamify-symbolic.svg" rmdir "$STEAMIFY_BIN" 2>/dev/null || true user_systemctl daemon-reload state_clear notify diff --git a/patches/steamify-notifier.py b/patches/steamify-notifier.py index 677dd9e..e4cb67d 100644 --- a/patches/steamify-notifier.py +++ b/patches/steamify-notifier.py @@ -73,6 +73,21 @@ def terminal(): return ["xterm", "-e"] +def tray_icon(): + # Steamify's icon: the single-color one in GNOME's top bar (it draws its tray icons that way), + # the colored one elsewhere; Steam's own only when neither is installed. + from PySide6.QtGui import QIcon + icons = os.path.join(DATA, "icons", "hicolor") + names = ["symbolic/apps/steamify-symbolic.svg", "scalable/apps/steamify.svg"] + if "GNOME" not in os.environ.get("XDG_CURRENT_DESKTOP", ""): + names.reverse() + for name in names: + path = os.path.join(icons, name) + if os.path.exists(path): + return QIcon(path) + return QIcon.fromTheme("steamify", QIcon.fromTheme("steam")) + + def main(): if "--delay" in sys.argv: time.sleep(int(sys.argv[sys.argv.index("--delay") + 1])) @@ -94,7 +109,7 @@ def main(): app.setApplicationName("Steamify") app.setDesktopFileName("steamify-ui") app.setQuitOnLastWindowClosed(False) - icon = QIcon.fromTheme("steamify", QIcon.fromTheme("steam")) + icon = tray_icon() def open_app(): # The way Steamify was last used (the app or the terminal menu), the diff --git a/patches/steamify-symbolic.svg b/patches/steamify-symbolic.svg new file mode 100644 index 0000000..c413d5b --- /dev/null +++ b/patches/steamify-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file