rszyma / kanata-tray

Tray Icon for Kanata
GNU General Public License v3.0
66 stars 1 forks source link

Use XDG config path for macOS instead #25

Closed jussapaavo closed 4 months ago

jussapaavo commented 4 months ago

Regarding:

The config folder location:
* Linux ~/.config/kanata-tray.
* Windows C:\Users\<YourUsername>\AppData\Roaming\kanata-tray
* macOS $HOME/Library/Application\ Support/kanata-tray

Is it possible to use the same XDG config path spec as in Linux for macOS also? I think it would make more sense, as it is used by other utilities as well. It would make organizing and managing the configs via dotfiles more straight forward. For example, utilities like kitty, Raycast and gcloud use ~/.config/ path.

At least, would it be possible to set or customize this via environment variables, like KANATA_TRAY_CONFIG etc.

rszyma commented 4 months ago

Thta default config dir path is standard for macos, so I wouldn't change it's default to not go off spec. You should be already be able to change config dir location by setting XDG_CONFIG_HOME env var. If that doesn't work for you, there's also command line option to set any path you want.

rszyma commented 4 months ago

Actually, there's no cli option for setting config (yet, I thought I added it), but still, you should be able to set XDG_CONFIG_HOME to change config dir like this:

XDG_CONFIG_HOME=~/.config kanata-tray
jussapaavo commented 4 months ago

Thta default config dir path is standard for macos, so I wouldn't change it's default to not go off spec. You should be already be able to change config dir location by setting XDG_CONFIG_HOME env var. If that doesn't work for you, there's also command line option to set any path you want.

I suppose using ~/Library/Application Support/ is the default only for installed apps but not for cli utilities that run from the terminal. I've never seen any other cli utility using Application Support, instead they either create their own hidden config dir in $HOME (like vscode, docker, aws, etc) or use ~/.config/ (like previously mentioned Google Cloud, kitty, Raycast, etc).

jussapaavo commented 4 months ago

Actually, there's no cli option for setting config (yet, I thought I added it), but still, you should be able to set XDG_CONFIG_HOME to change config dir like this:

XDG_CONFIG_HOME=~/.config kanata-tray

Anyway, I tried to set this but it didn't work. I set it directly in the same command line like in your example and also via the launcher's env vars config, neither changed anything. kanata-tray still uses the configs from the old path and not the specified by $XDG_CONFIG_HOME.

rszyma commented 4 months ago

Looking at implementation in configdir go library which we use, XDG_CONFIG_HOME doesn't apply to macos. https://github.com/kirsle/configdir/blob/e45d2f54772fea5426e7ce417474b62da9457dcc/config_darwin.go#L13. Let's just add a custom env variable.

rszyma commented 4 months ago

implemented in main

jussapaavo commented 4 months ago

Nice, thanks for the fast response. Appreciate it.