wheaney / breezy-desktop

XR virtual workspace library for Linux
GNU General Public License v3.0
272 stars 33 forks source link

Update setup to use proper config/data home directories #4

Closed wheaney closed 3 months ago

wheaney commented 1 year ago

Per the Vulkan Linux Layer Discovery documentation, before the setup script copies our vkBasalt config and lib files to ~/.config and ~/.local, we should be checking whether $XDG_CONFIG_HOME or $XDG_DATA_HOME environment variables are set and use them if they are.

wheaney commented 12 months ago

We should also be moving the driver's bin and config files to their proper directories. Keep in mind you'd need to update the setup scripts to copy the existing config file if the user already has one.

wheaney commented 12 months ago

Also note that the setup scripts call uninstall for the previous version already, so if you just update setup to do install properly going forward, you don't need to clean up the old bin files. Only the config file needs special treatment to be preserved.

wheaney commented 12 months ago

We should also update the README docs to reference new bin and config file locations.

pravic commented 11 months ago

~/.xreal_driver_log should be moved somewhere better as well.

wheaney commented 9 months ago

I'm updating all the file locations now soon. Here's my plan:

wheaney commented 8 months ago

Just a note: all my recommendations above are based on eventually moving to a user-systemd service (instead of system/root like it is now).

Additional recommendations from a convo on the Discord:

If stuff is reading and writing to the user-directory then the systemd unit should probably be a user-unit in ${XDG_CONFIG_HOME}/systemd/user too. Likewise IPC and lock bits would go into ${XDG_RUNTIME_DIR}/xr_driver Rather than ~/.local/share/xr_driver/logs logs are considered state so would go to ${XDG_STATE_HOME}/xr_driver/logs

We should also move the license file currently located at /var/lib/xr_driver/device_license.

Also reiterating a point above: we'll want the driver setup script to move some of these files so they're preserved. Specifically the config and log files, but the license could be moved as well (it'll just be re-downloaded to the new location if we don't do this, but if somehow they ran the setup offline, it would be better to proactively move for them so they don't lose functionality if they aren't able to download).

wheaney commented 6 months ago

I plan to tackle this soon. Here's the current plan, slightly modified from the last, also incorporating the latest comments and a more comprehensive list including all Breezy stuff.

XRLinuxDriver

File type XDG directory Fallback Current location
Logs & license *$XDG_STATE_HOME/xr_driver/(logs/|license.json)** ~/.local/state/xr_driver/(logs/*|license.json) ~/.xreal_driver_log /var/lib/xr_driver/device_license
Driver binary & scripts $XDG_BIN_HOME/xr_driver(_setup|_uninstall|_cli|_verify) ~/.local/bin/xr_driver(_setup|_uninstall|_cli|_verify) ~/bin/xrealAirLinuxDriver ~/bin/xrealdriver(config|uninstall) ~/.local/bin/xr_driver/verify_installation
Driver config $XDG_CONFIG_HOME/xr_driver/config.ini ~/.config/xr_driver/config.ini ~/.xreal_driver_config
systemd unit $XDG_CONFIG_HOME/systemd/user/xr-driver.service ~/.config/systemd/user/xr-driver.service /etc/systemd/system/xreal-air-driver.service
Lock file $XDG_RUNTIME_DIR/xr_driver/lock.pid /tmp/xr_driver/lock.pid ~/.xreal_driver_lock
IMU data IPC $XDG_RUNTIME_DIR/xr_driver/shaderruntime* /tmp/xr_driver/shaderruntime* /tmp/shaderruntime*
State/control IPC n/a n/a /dev/shm/xrdriver(state|control) unchanged, uses shared memory location
Driver manifest $XDG_DATA_HOME/xr_driver/manifest ~/.local/share/xr_driver/manifest ~/.local/bin/xr_driver/manifest

Breezy Vulkan

File type XDG directory Fallback Current location
Breezy scripts $XDG_BIN_HOME/breezyvulkan(setup|uninstall|verify) ~/.local/bin/breezyvulkan(setup|uninstall|verify) ~/bin/breezyvulkan(setup|uninstall) ~/.local/bin/breezy_vulkan/verify_installation
Breezy manifest $XDG_DATA_HOME/breezy_vulkan/manifest ~/.local/share/breezy_vulkan/manifest ~/.local/bin/breezy_vulkan/manifest
vkBasalt binaries n/a n/a ~/.local/lib(32) no XDG spec for this one
vkBasalt & reshade config $XDG_CONFIG_HOME/(vkBasalt/*|reshade/*) ~/.config/(vkBasalt/*|reshade/*) ~/.config/(vkBasalt/*|reshade/*)
Vulkan implicit layer config $XDG_DATA_HOME/vulkan/implicit_layer.d/vkBasalt*.json ~/.local/share/vulkan/implicit_layer.d/vkBasalt*.json ~/.local/share/vulkan/implicit_layer.d/vkBasalt*.json
wheaney commented 4 months ago

XRLinuxDriver portion almost complete in https://github.com/wheaney/XRLinuxDriver/compare/xdg_reorg

wheaney commented 3 months ago

This is mostly done, it's incorporated all the way through Breezy Vulkan build, setup, uninstall. Breezy GNOME and decky plugin still need updates, mainly via changes to the shared XRDriverIPC module.

wheaney commented 3 months ago

I've pushed updates to Breezy GNOME and the decky plugin that pull in all the latest XDG reorg changes. The only thing that's left is updated the driver and breezy PKGBUILD files so AUR can build off these changes.

wheaney commented 3 months ago

AUR has been updated to accommodate the XDG changes. Finally closing this!