* feat(ui): add auto-start on boot support - Add --start-minimized CLI flag for autostart entry - Create autostart_manager.py to handle XDG autostart desktop entry - Add autostart config option in config_manager.py - Add Start on Login toggle in Settings dialog - Add Start Minimized toggle in Settings dialog - Add Start on Login checkbox in system tray menu - Add first-run dialog to ask about autostart preference Closes #184 * fix(test): add first_run: False to mock config settings The tests were failing with StopIteration because main() now checks for first_run and shows a dialog if True. By setting first_run: False in the mock config, we skip the first-run dialog code path. * fix(ui): harden autostart behavior across Linux sessions Use XDG-compliant autostart paths and robust Exec command resolution, keep first-run prompt semantics correct, and fix GTK toggle handling so state changes are applied reliably. * docs(autostart): document XDG startup model and limits Clarify that Vocalinux uses desktop-session XDG autostart, not systemd services, and explain compatibility expectations for mainstream DEs versus minimal/custom WM sessions. * feat(ui): add first-run quick-start guidance text Expand the welcome dialog with concise first-time usage guidance and clear direction to the tray menu Settings entry while preserving the existing autostart decision flow. * fix(uninstall): remove XDG autostart desktop entry Ensure uninstall removes ~/.config autostart registration and reports leftover autostart entries during verification. * fix(install): ignore defunct processes in running-check Filter installer process detection to exclude defunct entries and installer/uninstaller shells so stale zombie rows do not block reinstall. * fix(uninstall): ignore defunct processes in running-check Use filtered process detection so zombie entries and installer shells do not trigger false running-process warnings during uninstall.
47 lines
2.1 KiB
Python
47 lines
2.1 KiB
Python
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest.mock import patch
|
|
|
|
from vocalinux.ui import autostart_manager
|
|
|
|
|
|
class TestAutostartManager(unittest.TestCase):
|
|
def test_get_autostart_dir_uses_xdg_config_home(self):
|
|
with patch.dict("os.environ", {"XDG_CONFIG_HOME": "/tmp/vlx-config"}, clear=False):
|
|
autostart_dir = autostart_manager.get_autostart_dir()
|
|
self.assertEqual(autostart_dir, Path("/tmp/vlx-config") / "autostart")
|
|
|
|
def test_get_exec_command_prefers_installed_command(self):
|
|
with patch(
|
|
"vocalinux.ui.autostart_manager.shutil.which",
|
|
return_value="/usr/bin/vocalinux",
|
|
):
|
|
command = autostart_manager.get_exec_command()
|
|
self.assertEqual(command, "/usr/bin/vocalinux --start-minimized")
|
|
|
|
def test_get_exec_command_falls_back_to_python_module(self):
|
|
with patch("vocalinux.ui.autostart_manager.shutil.which", return_value=None), patch(
|
|
"vocalinux.ui.autostart_manager.sys.executable", "/usr/bin/python3"
|
|
), patch("vocalinux.ui.autostart_manager.sys.frozen", new=False, create=True):
|
|
command = autostart_manager.get_exec_command()
|
|
self.assertEqual(command, "/usr/bin/python3 -m vocalinux.main --start-minimized")
|
|
|
|
def test_enable_disable_autostart_creates_and_removes_entry(self):
|
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
|
with patch.dict("os.environ", {"XDG_CONFIG_HOME": tmp_dir}, clear=False), patch(
|
|
"vocalinux.ui.autostart_manager.shutil.which",
|
|
return_value="/usr/bin/vocalinux",
|
|
):
|
|
enabled = autostart_manager.enable_autostart()
|
|
self.assertTrue(enabled)
|
|
|
|
desktop_file = Path(tmp_dir) / "autostart" / "vocalinux.desktop"
|
|
self.assertTrue(desktop_file.exists())
|
|
content = desktop_file.read_text(encoding="utf-8")
|
|
self.assertIn("Exec=/usr/bin/vocalinux --start-minimized", content)
|
|
|
|
disabled = autostart_manager.disable_autostart()
|
|
self.assertTrue(disabled)
|
|
self.assertFalse(desktop_file.exists())
|