refactor: Centralize app path configuration and separate dev + prod paths for most configs #37

Merged
javif89 merged 8 commits from fix/separate-dev-and-prod-sockets into master 2026-07-06 22:17:52 +00:00
Owner

Closes #35

An unintended consequence of the last refactor is that the way we acquired the lock to determine whether to show the UI or start the daemon would conflict during development if you were already running waycast on your machine.

This exposed a deeper issue with the design where paths for config files and such were resolved all over the place, instead of resolved once, which made it harder to separate dev and prod builds.

This PR addresses this in the following ways:

  • Introduced AppConfig and AppDirectories in core/config.rs. These are containers that hold the directories the app can use, allowing us to separate default and development paths.
  • Introduced WaycastSocketServer and WaycastSocketListener abstractions. This cleans up usage. They also take a path as an argument meaning we can resolve it at the top level.
  • prod and local socket + lockfile paths are now different resolving the actual issue

There will be a future ongoing effort to centralize more of the config resolution at the top level, and trickle down the necessary parts downwards to the pieces that needed. That already started on this PR by resolving the database path at the AppConfig level and passing it to the daemon from there, as well as passing it to the UI instead of having it resolve it on its own.

Closes #35 An unintended consequence of the last refactor is that the way we acquired the lock to determine whether to show the UI or start the daemon would conflict during development if you were already running waycast on your machine. This exposed a deeper issue with the design where paths for config files and such were resolved all over the place, instead of resolved once, which made it harder to separate dev and prod builds. This PR addresses this in the following ways: - Introduced `AppConfig` and `AppDirectories` in `core/config.rs`. These are containers that hold the directories the app can use, allowing us to separate default and development paths. - Introduced `WaycastSocketServer` and `WaycastSocketListener` abstractions. This cleans up usage. They also take a path as an argument meaning we can resolve it at the top level. - prod and local socket + lockfile paths are now different resolving the actual issue There will be a future ongoing effort to centralize more of the config resolution at the top level, and trickle down the necessary parts downwards to the pieces that needed. That already started on this PR by resolving the database path at the `AppConfig` level and passing it to the daemon from there, as well as passing it to the UI instead of having it resolve it on its own.
javif89 self-assigned this 2026-07-03 18:56:11 +00:00
javif89 requested review from xbazzi 2026-07-03 18:56:17 +00:00
xbazzi approved these changes 2026-07-06 22:17:26 +00:00
xbazzi left a comment

LGTM 💯

LGTM 💯
javif89 merged commit 769992992b into master 2026-07-06 22:17:52 +00:00
javif89 deleted branch fix/separate-dev-and-prod-sockets 2026-07-06 22:17:57 +00:00
Sign in to join this conversation.
No description provided.