Problem:
Hi, I am using talon with cursorless to program in a VS Codium flatpak installation. Works great 馃憤. Now the only thing that's bothering me is the location of the .cursorless directory in the home folder. To be more in line with the XDG Base Directory Specifications.
Solution:
I would recommend moving the folder to "~/.config/cursorless" or "~/.cache/cursorless". I don't know which one would be best here, as I don't really get what purpose that folder serves. If you want to be really fancy you could even read $XDG_CONFIG_HOME or $XDG_CACHE_HOME environment variable respectively to determine where to put it that folder, but i am not even asking for that much.
Implementation:
As far is I could tell by looking at the code, you are using that directory only once on Linux. And that is here:
|
SPOKEN_FORMS_OUTPUT_PATH = Path.home() / ".cursorless" / "state.json" |
Take that with a grain of salt tho, as I only looked at the "cursorless-talon/src" folder.
You could change that to something like that:
from talon import app
import os #is this needed or can talon also read environment variables?
from pathlib import Path
def config_dir_linux():
xdg_config_home = os.getenv("XDG_CONFIG_HOME")
if xdg_config_home:
# If XDG_CONFIG_HOME is set, use that path
config_path = Path(xdg_config_home)
else:
# Otherwise, fall back to the default ~/.config
config_path = Path.home() / ".config"
return config_path / "cursorless"
if app.platform == "linux":
SPOKEN_FORMS_OUTPUT_PATH = config_dir_linux() / "state.json"
else:
SPOKEN_FORMS_OUTPUT_PATH = Path.home() / ".cursorless" / "state.json"
I hope that makes changing this relatively easy.
Thanks you for your time and effort.
Problem:
Hi, I am using talon with cursorless to program in a VS Codium flatpak installation. Works great 馃憤. Now the only thing that's bothering me is the location of the .cursorless directory in the home folder. To be more in line with the XDG Base Directory Specifications.
Solution:
I would recommend moving the folder to "~/.config/cursorless" or "~/.cache/cursorless". I don't know which one would be best here, as I don't really get what purpose that folder serves. If you want to be really fancy you could even read $XDG_CONFIG_HOME or $XDG_CACHE_HOME environment variable respectively to determine where to put it that folder, but i am not even asking for that much.
Implementation:
As far is I could tell by looking at the code, you are using that directory only once on Linux. And that is here:
cursorless/cursorless-talon/src/spoken_forms_output.py
Line 7 in bfc4d84
Take that with a grain of salt tho, as I only looked at the "cursorless-talon/src" folder.
You could change that to something like that:
I hope that makes changing this relatively easy.
Thanks you for your time and effort.