qutebrowser
qutebrowser copied to clipboard
Reconsider macOS config locations
This is mostly a continuation of #383. Various things come to mind:
autoconfig path
- Qt gives us
~/Library/Preferencesfor a macOS config path. However, looking at the macOS documentation that seems like a bad idea (emphasis mine):
This directory contains app-specific preference files. You should not create files in this directory yourself. Instead, use the NSUserDefaults class or CFPreferences API to get and set preference values for your app.
The "application support" folder seems to be more appropriate:
Use this directory to store all app data files except those associated with the user’s documents. For example, you might use this directory to store app-created data files, configuration files, templates, or other fixed or modifiable resources that are managed by the app.
This seems like a bug in Qt's QStandardPaths to me - the only related discussion I could find is: [QTBUG-40737] OSX: be consistent in using either ~/.config/QtProject or ~/Library/Preferences for ini files - Qt Bug Tracker
subdirectory name
We currently use a simple qutebrowser subdirectory - the docs for Application Support say:
All content in this directory should be placed in a custom subdirectory whose name is that of your app’s bundle identifier or your company.
Our bundle identifier currently is org.qt-project.Qt.QtWebEngineCore because that used to be needed for QtWebEngine to find its resources. Likely this isn't needed anymore, see #5180. After fixing that, we should probably use org.qutebrowser.qutebrowser for the subdirectory as well.
config path
We currently use ~/.qutebrowser/config for the "human-writable" part of configs. Some users would prefer qutebrowser to use an XDG-like ~/.config/qutebrowser instead. Fully supporting XDG probably is a bad idea (for example, the cache folder should stay at ~/Library/Caches which is excluded from Time Machine backups by default). However, I guess supporting $XDG_CONFIG_HOME (defaulting to ~/.config) wouldn't be a too bad idea.
Another question is how we handle the migration - some possibilities:
- Move
~/.qutebrowserto~/.config/qutebrowserautomatically - Read
~/.qutebrowserif it exists (and ignore~/.config/qutebrowser), but default to~/.config/qutebrowserif not - Read both - for
config.pythat should be possible, for quickmarks/bookmarks probably too? Might not be worth the effort, though. On the positive side, it'd allow us to also considerXDG_CONFIG_DIRS(e.g./etc/xdg/qutebrowser) on Linux.
As a data point, some XDG folder contents on macOS from this Reddit post:
~/.local/share/next # Next browser
~/.local/share/heroku
~/.local/share/bower
~/.local/share/nvim # neovim
# created by Meld merge, GTK app w/ unofficial macOS builds, so not the best example
~/.local/share/recently-used.xbel
~/.local/share/applications # created by WineBottler
~/.local/share/mime # created by WineBottler
~/.local/share/desktop-directories # created by WineBottler
# created by Meld merge, populated by recents referenced in `recently-used.xbel`
~/.local/share/meld
~/.local/share/karabiner # created by Karabiner Elements, macOS-exclusive app
~/.config/alacritty
~/.config/glade.conf
~/.config/heroku
~/.config/configstore
~/.config/nvim
~/.config/cmus
~/.config/gtk-3.0
~/.config/yarn
~/.config/inkscape
~/.config/htop
~/.config/gtk-2.0
~/.config/rtv
~/.config/mpv
~/.config/minidlna
~/.config/menus
~/.config/kitty
~/.config/fontforge
~/.config/fish
~/.config/hub
~/.config/git
~/.config/karabiner
~/.cache/proselint
~/.cache/ruby-install
~/.cache/gegl-0.2 # GIMP?
~/.cache/inkscape
~/.cache/fontconfig
~/.cache/ctrlp
~/.cache/youtube-dl
~/.cache/neocomplcache
~/.cache/cabal-helper
~/.cache/babl # GIMP?
So using ~/.config but not the rest probably wouldn't be too bad (though some of those examples might put data files in ~/.config as well?).
is there a way to manually set where the file should be?
@marco-silva0000 Which file? There's --config-py, other than that, no.
There seems to be no way edit flags of isntalled mac applications right? currently I'm using applescript:
do shell script "open -a qutebrowser --args -B ~/.config/qutebrowser -C ~/.config/qutebrowser/config.py"
To replicate linux configuration. Then save it as .app. However now there are two entry points to qutebrowser that polute all of the app namespaces :(
Is ther alternative way to set application flags in MacOs?
I'm afraid this isn't going to make it into v2.0.0.
A simple solution which avoids the need to migrate data/steps from users is to support multiple locations. On startup you pick the first location you find. For example this is what emacs did (which added support for XDG using this approach) https://www.gnu.org/software/emacs/manual/html_node/emacs/Find-Init.html#Find-Init I'm not familiar with the qutebrowser codebase, but would that be a reasonable solution?
I second @keegancsmith's idea. This way all 'new' users will be XDG-compliant out of the box and anyone who already uses qutebrowser could choose to move their config or not.
- Move ~/.qutebrowser to ~/.config/qutebrowser automatically
I like this option, but you would have to add an alert when doing so. Many sync their config files from a git repo into specific locations and so you would move it but then then next time they resynced it would just be put back.
I second using ~/.config/qutebrowser instead of ~/.qutebrowser; it's causing me a lot of trouble with my dotfiles.
At the mean time, is there any workaround to load the config from ~/.config/qutebrowser on macOS?
Is there any solution for this?
Nothing I'm aware of, otherwise it'd be in this issue.
Is this being worked on? If not, I could try to contribute a fix.
I don't think so - happy to assign this to you if you want to take a look. Note that a contribution will need to provide answers for various questions raised above, especially around how to best migrate things to the new location. It will also need to consider various corner cases, e.g. what to do if both locations exist.
Awesome, thanks for the quick reply. The solution I propose mirrors the one @keegancsmith suggested: support both locations. I think the Wezterm documentation goes over the corresponding logic quite well. Essentially, there will be an order of locations qutebrowser checks for a config ($XDG_CONFIG_HOME/qutebrowser, then ~/.config/qutebrowser, then ~/.qutebrowser). This way, existing configs can remain where they are. I don't think we need to do any merging of configs or automatic moving.