kitowall 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  `Kitowall` is a wallpaper manager for Hyprland/Wayland using `swww`.
6
6
 
7
- Current version: `1.0.5`.
7
+ Current version: `1.0.7`.
8
8
 
9
9
  ## What You Can Do
10
10
  - Rotate wallpapers with transitions.
package/dist/core/init.js CHANGED
@@ -41,7 +41,7 @@ async function detectAndHandleConflicts(force) {
41
41
  async function initKitowall(opts) {
42
42
  if (process.env.FLATPAK_ID) {
43
43
  throw new Error('init/repair cannot be executed from Flatpak UI because it would generate host systemd units with sandbox paths. ' +
44
- 'Run on host shell: node dist/cli.js init --namespace kitowall --apply --force');
44
+ 'Run on host shell: kitowall init --namespace kitowall --apply --force (or, in local dev, node dist/cli.js init --namespace kitowall --apply --force)');
45
45
  }
46
46
  const config = (0, config_1.loadConfig)(); // crea/migra config si hace falta
47
47
  const state = (0, state_1.loadState)(); // crea/migra state si hace falta
@@ -57,10 +57,6 @@ async function initKitowall(opts) {
57
57
  ensureDir(userDir);
58
58
  const nodePath = process.execPath;
59
59
  const cliPath = (0, node_path_1.resolve)(process.argv[1]); // dist/cli.js absoluto
60
- // Entorno Wayland (defaults seguros)
61
- const waylandDisplay = (process.env.WAYLAND_DISPLAY && process.env.WAYLAND_DISPLAY.trim())
62
- ? process.env.WAYLAND_DISPLAY.trim()
63
- : 'wayland-1';
64
60
  const xdgRuntimeDir = (process.env.XDG_RUNTIME_DIR && process.env.XDG_RUNTIME_DIR.trim())
65
61
  ? process.env.XDG_RUNTIME_DIR.trim()
66
62
  : `/run/user/${process.getuid?.() ?? 1000}`;
@@ -70,6 +66,11 @@ async function initKitowall(opts) {
70
66
  '/usr/bin',
71
67
  '/bin'
72
68
  ].join(':');
69
+ // Resolve WAYLAND_DISPLAY at runtime for every service start. This avoids
70
+ // stale values across relogin (e.g. wayland-0 vs wayland-1).
71
+ const waylandBootstrap = 'WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-$(ls \\"$XDG_RUNTIME_DIR\\"/wayland-* 2>/dev/null | xargs -r -n1 basename | sort | tail -n1)}"; ' +
72
+ 'if [ -z "$WAYLAND_DISPLAY" ]; then WAYLAND_DISPLAY=wayland-1; fi; ' +
73
+ 'export WAYLAND_DISPLAY;';
73
74
  // 1) swww-daemon template
74
75
  const swwwDaemonTemplate = `
75
76
  [Unit]
@@ -80,9 +81,8 @@ PartOf=graphical-session.target
80
81
  [Service]
81
82
  Type=simple
82
83
  Environment=PATH=${pathEnv}
83
- Environment=WAYLAND_DISPLAY=${waylandDisplay}
84
84
  Environment=XDG_RUNTIME_DIR=${xdgRuntimeDir}
85
- ExecStart=swww-daemon --no-cache --namespace %i
85
+ ExecStart=/bin/sh -lc ${esc(`${waylandBootstrap} exec swww-daemon --no-cache --namespace %i`)}
86
86
  Restart=on-failure
87
87
  RestartSec=1
88
88
 
@@ -92,7 +92,7 @@ WantedBy=graphical-session.target
92
92
  (0, node_fs_1.writeFileSync)((0, node_path_1.join)(userDir, 'swww-daemon@.service'), swwwDaemonTemplate, 'utf8');
93
93
  // 2) kitowall-next.service (oneshot)
94
94
  // OJO: aunque CLI ignore --namespace en algunos comandos, aquí lo dejamos por compatibilidad.
95
- const nextExec = `${nodePath} ${esc(cliPath)} ${esc('next')} ${esc('--namespace')} ${esc(ns)}`;
95
+ const nextExec = `/bin/sh -lc ${esc(`${waylandBootstrap} exec ${nodePath} ${esc(cliPath)} ${esc('next')} ${esc('--namespace')} ${esc(ns)}`)}`;
96
96
  const kitowallNextService = `
97
97
  [Unit]
98
98
  Description=Kitowall apply next wallpapers
@@ -102,13 +102,12 @@ Requires=swww-daemon@${ns}.service
102
102
  [Service]
103
103
  Type=oneshot
104
104
  Environment=PATH=${pathEnv}
105
- Environment=WAYLAND_DISPLAY=${waylandDisplay}
106
105
  Environment=XDG_RUNTIME_DIR=${xdgRuntimeDir}
107
106
  ExecStart=${nextExec}
108
107
  `.trimStart();
109
108
  (0, node_fs_1.writeFileSync)((0, node_path_1.join)(userDir, 'kitowall-next.service'), kitowallNextService, 'utf8');
110
109
  // 3) kitowall-watch.service (hotplug watcher)
111
- const watchExec = `${nodePath} ${esc(cliPath)} ${esc('watch')} ${esc('--namespace')} ${esc(ns)}`;
110
+ const watchExec = `/bin/sh -lc ${esc(`${waylandBootstrap} exec ${nodePath} ${esc(cliPath)} ${esc('watch')} ${esc('--namespace')} ${esc(ns)}`)}`;
112
111
  const kitowallWatchService = `
113
112
  [Unit]
114
113
  Description=Kitowall watcher (monitor hotplug)
@@ -119,7 +118,6 @@ PartOf=graphical-session.target
119
118
  [Service]
120
119
  Type=simple
121
120
  Environment=PATH=${pathEnv}
122
- Environment=WAYLAND_DISPLAY=${waylandDisplay}
123
121
  Environment=XDG_RUNTIME_DIR=${xdgRuntimeDir}
124
122
  ExecStart=${watchExec}
125
123
  Restart=on-failure
@@ -130,7 +128,7 @@ WantedBy=graphical-session.target
130
128
  `.trimStart();
131
129
  (0, node_fs_1.writeFileSync)((0, node_path_1.join)(userDir, 'kitowall-watch.service'), kitowallWatchService, 'utf8');
132
130
  // 4) kitowall-login-apply.service (apply once on login to avoid gray background)
133
- const loginApplyExec = `/bin/sh -lc ${esc(`sleep 2; ${nodePath} ${esc(cliPath)} ${esc('rotate-now')} ${esc('--namespace')} ${esc(ns)} ${esc('--force')}`)}`;
131
+ const loginApplyExec = `/bin/sh -lc ${esc(`sleep 2; ${waylandBootstrap} exec ${nodePath} ${esc(cliPath)} ${esc('rotate-now')} ${esc('--namespace')} ${esc(ns)} ${esc('--force')}`)}`;
134
132
  const kitowallLoginApplyService = `
135
133
  [Unit]
136
134
  Description=Kitowall apply wallpapers on session start
@@ -141,7 +139,6 @@ PartOf=graphical-session.target
141
139
  [Service]
142
140
  Type=oneshot
143
141
  Environment=PATH=${pathEnv}
144
- Environment=WAYLAND_DISPLAY=${waylandDisplay}
145
142
  Environment=XDG_RUNTIME_DIR=${xdgRuntimeDir}
146
143
  ExecStart=${loginApplyExec}
147
144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitowall",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "CLI/daemon for Hyprland wallpapers using swww with pack-based rotation.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "commonjs",
@@ -27,7 +27,6 @@
27
27
  "test:regression": "bash ./tests/regression.e2e.sh",
28
28
  "test:e2e": "npm run test:smoke && npm run test:regression"
29
29
  },
30
- "dependencies": {},
31
30
  "devDependencies": {
32
31
  "@types/node": "^22.10.0",
33
32
  "typescript": "^5.4.0"