GnomeSnapExtensions / gSnap

Gnome-shell extension that allows you to move windows into specific regions similiar to FancyZones on windows.
https://extensions.gnome.org/extension/4442/gsnap/
Other
160 stars 23 forks source link

Extension broken when installed in read-only directory #45

Closed elizagamedev closed 1 year ago

elizagamedev commented 1 year ago

Some Linux distros package gSnap upstream, like NixOS. Unfortunately, gSnap assumes that its own directory is user-writable, which is not the case when installing as a system package. In such cases, an error like the following is thrown shortly after enabling gSnap:

GLib.FileError: Failed to create file “/etc/profiles/per-user/eliza/share/gnome-shell/extensions/gSnap@micahosborne/layouts.json.UFBZW1”: Read-only file system

Perhaps instead of storing data in this directory, the next version of gSnap could instead store it somewhere in $XDG_CONFIG_DIR with some backwards-compatibility glue?

meronz commented 1 year ago

Mmh nice catch. This is something that should definitively be implemented.

meronz commented 1 year ago

@elizagamedev I opened a PR with the requested changes. I think it was an error to store the layouts.json file in the extension directory anyway, so I changed it in favor of ~/.config, or whatever the user_config_dir is. Could you test the PR to see if it works on your side? I'm also downloading an ISO of NixOS (which I've never used before) to test it, but a test from an experienced NixOS user would be best.

In the future, I'd like to store everything in dconf as it is cleaner and avoids these sorts of problems.

meronz commented 1 year ago

I'll close the issue. Feel free to reopen it if this does not solve the problem.

elizagamedev commented 1 year ago

Thank you for the quick fix! I'll try this out on Nix.