kitowall 3.5.7 → 3.5.11

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/dist/core/init.js CHANGED
@@ -150,7 +150,10 @@ WantedBy=graphical-session.target
150
150
  await (0, exec_1.run)('systemctl', ['--user', 'daemon-reload']);
151
151
  await (0, exec_1.run)('systemctl', ['--user', 'enable', '--now', `swww-daemon@${ns}.service`]);
152
152
  await (0, exec_1.run)('systemctl', ['--user', 'enable', '--now', 'kitowall-watch.service']);
153
- await (0, exec_1.run)('systemctl', ['--user', 'enable', '--now', 'kitowall-login-apply.service']);
153
+ // login-apply is oneshot and can fail on first run if library is still empty.
154
+ // Enable it for next graphical session, but do not make init fail here.
155
+ await (0, exec_1.run)('systemctl', ['--user', 'enable', 'kitowall-login-apply.service']);
156
+ await (0, exec_1.run)('systemctl', ['--user', 'start', 'kitowall-login-apply.service']).catch(() => { });
154
157
  // Si quieres: aplicar una vez ahora mismo
155
158
  if (opts.apply) {
156
159
  const controller = new controller_1.Controller(config, state);
package/dist/core/live.js CHANGED
@@ -48,6 +48,7 @@ const LIVE_BROWSER_UA = process.env.KITOWALL_LIVE_UA ||
48
48
  const LIVE_BROWSER_UA_FALLBACK = process.env.KITOWALL_LIVE_UA_FALLBACK ||
49
49
  'insomnia/12.3.1';
50
50
  const INTEGRATED_RENDERCORE_ENV = 'KITOWALL_FLATPAK_INTEGRATED_RENDERCORE';
51
+ const INTEGRATED_RENDERCORE_BIN_FALLBACK = '/app/bin/kitsune-rendercore';
51
52
  function nowUnix() {
52
53
  return Math.floor(Date.now() / 1000);
53
54
  }
@@ -104,10 +105,13 @@ function getLiveLockPath() {
104
105
  return node_path_1.default.join(getLiveInternalRoot(), 'index.lock');
105
106
  }
106
107
  function defaultRunnerConfig() {
108
+ const integratedBin = clean(process.env.KITOWALL_LIVE_RUNNER_BIN) || INTEGRATED_RENDERCORE_BIN_FALLBACK;
107
109
  return {
108
110
  mode: 'bin',
109
111
  cargo_project_dir: process.env.KITOWALL_LIVE_RUNNER_PROJECT?.trim() || '',
110
- bin_name: process.env.KITOWALL_LIVE_RUNNER_BIN?.trim() || 'kitsune-rendercore'
112
+ bin_name: integratedRendercoreMode()
113
+ ? integratedBin
114
+ : (process.env.KITOWALL_LIVE_RUNNER_BIN?.trim() || 'kitsune-rendercore')
111
115
  };
112
116
  }
113
117
  function defaultIndex() {
@@ -872,6 +876,12 @@ function integratedRendercoreMode() {
872
876
  const v = clean(process.env[INTEGRATED_RENDERCORE_ENV]).toLowerCase();
873
877
  return v === '1' || v === 'true' || v === 'yes' || v === 'on';
874
878
  }
879
+ function resolveRendercoreBin(index) {
880
+ if (integratedRendercoreMode()) {
881
+ return clean(process.env.KITOWALL_LIVE_RUNNER_BIN) || INTEGRATED_RENDERCORE_BIN_FALLBACK;
882
+ }
883
+ return clean(index.runner.bin_name) || 'kitsune-rendercore';
884
+ }
875
885
  function integratedRendercorePidPath() {
876
886
  return node_path_1.default.join(getLiveInternalRoot(), 'rendercore.pid');
877
887
  }
@@ -1633,7 +1643,7 @@ async function liveApply(opts) {
1633
1643
  if (!item || !node_fs_1.default.existsSync(item.file_path)) {
1634
1644
  throw new Error(`Live file not found for ${idRaw}. Re-download it with live fetch.`);
1635
1645
  }
1636
- const bin = index.runner.bin_name;
1646
+ const bin = resolveRendercoreBin(index);
1637
1647
  const setVideoArgs = [
1638
1648
  'set-video',
1639
1649
  '--monitor', monitor,
@@ -1792,18 +1802,26 @@ async function liveDoctor(opts) {
1792
1802
  catch {
1793
1803
  deps.hyprctl = false;
1794
1804
  }
1795
- try {
1796
- await (0, exec_1.run)('which', [index.runner.bin_name], { timeoutMs: 4000 });
1797
- deps.runner_bin = true;
1805
+ const runnerBin = resolveRendercoreBin(index);
1806
+ if (runnerBin.startsWith('/')) {
1807
+ deps.runner_bin = node_fs_1.default.existsSync(runnerBin);
1798
1808
  }
1799
- catch {
1800
- deps.runner_bin = false;
1801
- fix.push(`Install ${index.runner.bin_name} and ensure it is available in PATH`);
1809
+ else {
1810
+ try {
1811
+ await (0, exec_1.run)('which', [runnerBin], { timeoutMs: 4000 });
1812
+ deps.runner_bin = true;
1813
+ }
1814
+ catch {
1815
+ deps.runner_bin = false;
1816
+ }
1817
+ }
1818
+ if (!deps.runner_bin) {
1819
+ fix.push(`Install ${runnerBin} and ensure it is available in PATH`);
1802
1820
  }
1803
1821
  if (opts?.fix && deps.runner_bin) {
1804
1822
  try {
1805
- await (0, exec_1.run)(index.runner.bin_name, ['install-deps'], { timeoutMs: 180000 });
1806
- fix.push(`Executed: ${index.runner.bin_name} install-deps`);
1823
+ await (0, exec_1.run)(runnerBin, ['install-deps'], { timeoutMs: 180000 });
1824
+ fix.push(`Executed: ${runnerBin} install-deps`);
1807
1825
  try {
1808
1826
  await (0, exec_1.run)('ffmpeg', ['-version'], { timeoutMs: 4000 });
1809
1827
  deps.ffmpeg = true;
@@ -1824,7 +1842,7 @@ async function liveDoctor(opts) {
1824
1842
  }
1825
1843
  }
1826
1844
  else if (!deps.ffmpeg || !deps.hyprctl) {
1827
- fix.push(`Run '${index.runner.bin_name} install-deps' to install missing runtime dependencies`);
1845
+ fix.push(`Run '${runnerBin} install-deps' to install missing runtime dependencies`);
1828
1846
  }
1829
1847
  return {
1830
1848
  ok: Object.values(deps).every(Boolean) || (deps.hyprctl === false && Object.keys(deps).filter(k => k !== 'hyprctl').every(k => deps[k])),
@@ -1836,7 +1854,7 @@ async function liveDoctor(opts) {
1836
1854
  }
1837
1855
  async function liveServiceAutostart(action) {
1838
1856
  const index = readIndex();
1839
- let bin = index.runner.bin_name;
1857
+ let bin = resolveRendercoreBin(index);
1840
1858
  if (integratedRendercoreMode()) {
1841
1859
  let out;
1842
1860
  if (action === 'status') {
@@ -36,6 +36,37 @@ async function installSystemd(opts) {
36
36
  const userDir = (0, node_path_1.join)((0, node_os_1.homedir)(), '.config', 'systemd', 'user');
37
37
  ensureDir(userDir);
38
38
  const every = systemdInterval(opts.every);
39
+ const ns = (opts.namespace && opts.namespace.trim()) ? opts.namespace.trim() : 'kitowall';
40
+ const isFlatpak = Boolean(process.env.FLATPAK_ID);
41
+ const flatpakAppId = (process.env.FLATPAK_ID || 'io.kitotsu.KitoWall').trim();
42
+ const nodePath = process.execPath;
43
+ const cliPath = (0, node_path_1.resolve)(process.argv[1] || '');
44
+ const xdgRuntimeDir = (process.env.XDG_RUNTIME_DIR && process.env.XDG_RUNTIME_DIR.trim())
45
+ ? process.env.XDG_RUNTIME_DIR.trim()
46
+ : `/run/user/${process.getuid?.() ?? 1000}`;
47
+ const pathEnv = [
48
+ `${(0, node_os_1.homedir)()}/.local/bin`,
49
+ '/usr/local/bin',
50
+ '/usr/bin',
51
+ '/bin'
52
+ ].join(':');
53
+ const waylandBootstrap = 'WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-$(ls \\"$XDG_RUNTIME_DIR\\"/wayland-* 2>/dev/null | xargs -r -n1 basename | sort | tail -n1)}"; ' +
54
+ 'if [ -z "$WAYLAND_DISPLAY" ]; then WAYLAND_DISPLAY=wayland-1; fi; ' +
55
+ 'export WAYLAND_DISPLAY;';
56
+ const nextCmd = isFlatpak
57
+ ? `${waylandBootstrap} exec /usr/bin/flatpak run --command=kitowall ${flatpakAppId} rotate-now --namespace ${ns} --force`
58
+ : `${waylandBootstrap} exec ${JSON.stringify(nodePath)} ${JSON.stringify(cliPath)} rotate-now --namespace ${JSON.stringify(ns)} --force`;
59
+ const kitowallNextService = `
60
+ [Unit]
61
+ Description=Kitowall apply next wallpapers
62
+
63
+ [Service]
64
+ Type=oneshot
65
+ Environment=PATH=${pathEnv}
66
+ Environment=XDG_RUNTIME_DIR=${xdgRuntimeDir}
67
+ ExecStart=/bin/sh -lc ${JSON.stringify(nextCmd)}
68
+ `.trimStart();
69
+ (0, node_fs_1.writeFileSync)((0, node_path_1.join)(userDir, 'kitowall-next.service'), kitowallNextService, 'utf8');
39
70
  const kitowallTimer = `
40
71
  [Unit]
41
72
  Description=Run kitowall-next periodically
@@ -54,6 +85,8 @@ async function installSystemd(opts) {
54
85
  `.trimStart();
55
86
  (0, node_fs_1.writeFileSync)((0, node_path_1.join)(userDir, 'kitowall-next.timer'), kitowallTimer, 'utf8');
56
87
  await (0, exec_1.run)('systemctl', ['--user', 'daemon-reload']);
88
+ await (0, exec_1.run)('systemctl', ['--user', 'reset-failed', 'kitowall-next.service']).catch(() => { });
89
+ await (0, exec_1.run)('systemctl', ['--user', 'reset-failed', 'kitowall-next.timer']).catch(() => { });
57
90
  await (0, exec_1.run)('systemctl', ['--user', 'enable', '--now', 'kitowall-next.timer']);
58
91
  }
59
92
  async function uninstallSystemd() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitowall",
3
- "version": "3.5.7",
3
+ "version": "3.5.11",
4
4
  "description": "CLI/daemon for Hyprland wallpapers using swww with pack-based rotation.",
5
5
  "repository": {
6
6
  "type": "git",