Icona app (terminale+freccia resume) con integrazione KDE Plasma/Wayland corretta
- icona generata con agy (verificata): terminale scuro + freccia circolare ciano - asset PNG multi-dimensione in assets/ - integrazione: app-id GLib 'it.enne2.pi-session-launcher' == stem .desktop == nome icona hicolor (su Wayland l'icona di finestra viene dal .desktop, NON da set_icon_from_file) - install.sh: icone hicolor 48-512px + .desktop con StartupWMClass, rimozione vecchio nome - binario PyInstaller rebuilt con icona bundled (--add-data)
|
After Width: | Height: | Size: 632 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 266 KiB |
|
After Width: | Height: | Size: 338 KiB |
@@ -6,7 +6,8 @@ set -euo pipefail
|
|||||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
APP="$DIR/pi-session-launcher.py"
|
APP="$DIR/pi-session-launcher.py"
|
||||||
BIN="$DIR/dist/pi-session-launcher"
|
BIN="$DIR/dist/pi-session-launcher"
|
||||||
DESKTOP="$HOME/.local/share/applications/pi-session-launcher.desktop"
|
APP_ID="it.enne2.pi-session-launcher"
|
||||||
|
DESKTOP="$HOME/.local/share/applications/$APP_ID.desktop"
|
||||||
|
|
||||||
# usa l'eseguibile portabile se presente, altrimenti lo script python
|
# usa l'eseguibile portabile se presente, altrimenti lo script python
|
||||||
if [[ -x "$BIN" ]]; then
|
if [[ -x "$BIN" ]]; then
|
||||||
@@ -24,6 +25,23 @@ fi
|
|||||||
|
|
||||||
chmod +x "$APP" 2>/dev/null || true
|
chmod +x "$APP" 2>/dev/null || true
|
||||||
|
|
||||||
|
# icona nel tema icone KDE (più dimensioni: KDE le scala dal tema)
|
||||||
|
ICON_SRC="$DIR/assets/pi-session-launcher.png"
|
||||||
|
if [[ -f "$ICON_SRC" ]]; then
|
||||||
|
for size in 48 64 128 256 512; do
|
||||||
|
ICON_DIR="$HOME/.local/share/icons/hicolor/${size}x${size}/apps"
|
||||||
|
mkdir -p "$ICON_DIR"
|
||||||
|
if [[ -f "$DIR/assets/pi-session-launcher-${size}.png" ]]; then
|
||||||
|
cp "$DIR/assets/pi-session-launcher-${size}.png" "$ICON_DIR/$APP_ID.png"
|
||||||
|
else
|
||||||
|
cp "$ICON_SRC" "$ICON_DIR/$APP_ID.png"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
ICON_NAME="$APP_ID"
|
||||||
|
else
|
||||||
|
ICON_NAME="utilities-terminal"
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "$(dirname "$DESKTOP")"
|
mkdir -p "$(dirname "$DESKTOP")"
|
||||||
cat > "$DESKTOP" <<EOF
|
cat > "$DESKTOP" <<EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
@@ -32,13 +50,18 @@ Name=Pi Session Launcher
|
|||||||
GenericName=Riprendi sessioni di Pi Agent
|
GenericName=Riprendi sessioni di Pi Agent
|
||||||
Comment=Elenca le sessioni di Pi Agent e le riprende nella loro cartella
|
Comment=Elenca le sessioni di Pi Agent e le riprende nella loro cartella
|
||||||
Exec=$EXEC
|
Exec=$EXEC
|
||||||
Icon=utilities-terminal
|
Icon=$ICON_NAME
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=Development;
|
Categories=Development;
|
||||||
Keywords=pi;agent;session;resume;
|
Keywords=pi;agent;session;resume;
|
||||||
|
StartupWMClass=$APP_ID
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# rimuove il vecchio desktop entry con nome non allineato (se esiste)
|
||||||
|
rm -f "$HOME/.local/share/applications/pi-session-launcher.desktop"
|
||||||
|
|
||||||
echo "✓ Installato: $DESKTOP"
|
echo "✓ Installato: $DESKTOP"
|
||||||
echo " Eseguibile: $EXEC"
|
echo " Eseguibile: $EXEC"
|
||||||
|
echo " Icona: $ICON_NAME"
|
||||||
echo " Cerca 'Pi Session Launcher' nel menu applicazioni KDE."
|
echo " Cerca 'Pi Session Launcher' nel menu applicazioni KDE."
|
||||||
echo " (Per rimuovere: $0 --uninstall)"
|
echo " (Per rimuovere: $0 --uninstall)"
|
||||||
|
|||||||
@@ -216,6 +216,16 @@ def display_text(info: dict, limit: int = 100) -> str:
|
|||||||
return first or "(sessione senza messaggi)"
|
return first or "(sessione senza messaggi)"
|
||||||
|
|
||||||
|
|
||||||
|
def icon_path():
|
||||||
|
"""Percorso dell'icona: dati bundlati (PyInstaller) o cartella assets del sorgente."""
|
||||||
|
base = getattr(sys, "_MEIPASS", os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
for rel in ("assets/pi-session-launcher.png", "pi-session-launcher.png"):
|
||||||
|
p = os.path.join(base, rel)
|
||||||
|
if os.path.isfile(p):
|
||||||
|
return p
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# GUI
|
# GUI
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -224,6 +234,12 @@ class LauncherWindow(Gtk.ApplicationWindow):
|
|||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
super().__init__(application=app, title=APP_TITLE)
|
super().__init__(application=app, title=APP_TITLE)
|
||||||
self.set_default_size(1000, 600)
|
self.set_default_size(1000, 600)
|
||||||
|
icon = icon_path()
|
||||||
|
if icon:
|
||||||
|
try:
|
||||||
|
self.set_icon_from_file(icon)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
# modello: markup_sessione, cwd, rel_time, abs_time, mtime(float), path, size(int), search_text
|
# modello: markup_sessione, cwd, rel_time, abs_time, mtime(float), path, size(int), search_text
|
||||||
self.store = Gtk.ListStore(str, str, str, str, float, str, int, str)
|
self.store = Gtk.ListStore(str, str, str, str, float, str, int, str)
|
||||||
@@ -465,7 +481,8 @@ class LauncherWindow(Gtk.ApplicationWindow):
|
|||||||
|
|
||||||
class LauncherApp(Gtk.Application):
|
class LauncherApp(Gtk.Application):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(application_id="it.enne2.pi-session-launcher")
|
# deve combaciare con il nome del file .desktop (senza estensione)
|
||||||
|
super().__init__(application_id=APP_ID)
|
||||||
self.win = None
|
self.win = None
|
||||||
|
|
||||||
def do_activate(self):
|
def do_activate(self):
|
||||||
@@ -474,7 +491,15 @@ class LauncherApp(Gtk.Application):
|
|||||||
self.win.present()
|
self.win.present()
|
||||||
|
|
||||||
|
|
||||||
|
APP_ID = "it.enne2.pi-session-launcher"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
# KDE Plasma/Wayland: l'icona di finestra viene associata via app-id
|
||||||
|
# + file .desktop con lo stesso nome stem (vedi ricerca Perplexity).
|
||||||
|
# GLib richiede un punto nell'application_id (reverse-DNS).
|
||||||
|
GLib.set_prgname(APP_ID)
|
||||||
|
Gtk.Window.set_default_icon_name(APP_ID)
|
||||||
app = LauncherApp()
|
app = LauncherApp()
|
||||||
app.run(sys.argv)
|
app.run(sys.argv)
|
||||||
|
|
||||||
|
|||||||