Skip to content

Commit

Permalink
fix(systemd): respect XDG_CONFIG_HOME
Browse files Browse the repository at this point in the history
Use `XDG_CONFIG_HOME` instead of `~/.config` if set.

Fixes #79.
  • Loading branch information
MithicSpirit authored and bneijt committed May 11, 2024
1 parent 39278dc commit 7145888
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/autotrash/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ def install_service(options, args):
ExecStart="{}" {}
""".format(executable_path, args)

systemd_dir = os.path.expanduser("~/.config/systemd/user")
config_dir = os.environ.get("XDG_CONFIG_HOME") or os.path.expanduser("~/.config")
systemd_dir = f"{config_dir}/systemd/user"
os.makedirs(systemd_dir, exist_ok=True)

with open(os.path.join(systemd_dir, "autotrash.timer"), "w") as f:
Expand Down

0 comments on commit 7145888

Please sign in to comment.