···11+From 86cc27022015697a61d1ec1b13e52f9dbe7f6c57 Mon Sep 17 00:00:00 2001
22+From: worldofpeace <worldofpeace@protonmail.ch>
33+Date: Mon, 23 Mar 2020 18:34:00 -0400
44+Subject: [PATCH] Adjust get_data_path for NixOS
55+66+We construct the ulauncher data path from xdg_data_dirs
77+and prevent it from being a nix store path or being xdg_data_home.
88+We do this to prevent /nix/store paths being hardcoded to shortcuts.json.
99+On NixOS this path will either be /run/current-system/sw/share/ulauncher
1010+or $HOME/.nix-profile/share/ulauncher if the user used nix-env.
1111+---
1212+ ulauncher/config.py | 27 ++++++++++++++++++---------
1313+ 1 file changed, 18 insertions(+), 9 deletions(-)
1414+1515+diff --git a/ulauncher/config.py b/ulauncher/config.py
1616+index f21014e..cc636e1 100644
1717+--- a/ulauncher/config.py
1818++++ b/ulauncher/config.py
1919+@@ -50,15 +50,24 @@ def get_data_path():
2020+ is specified at installation time.
2121+ """
2222+2323+- # Get pathname absolute or relative.
2424+- path = os.path.join(
2525+- os.path.dirname(__file__), __ulauncher_data_directory__)
2626+-
2727+- abs_data_path = os.path.abspath(path)
2828+- if not os.path.exists(abs_data_path):
2929+- raise ProjectPathNotFoundError(abs_data_path)
3030+-
3131+- return abs_data_path
3232++ paths = list(
3333++ filter(
3434++ os.path.exists,
3535++ [
3636++ os.path.join(dir, "ulauncher")
3737++ for dir in xdg_data_dirs
3838++ # Get path that isn't in the /nix/store so they don't get hardcoded into configs
3939++ if not dir.startswith("/nix/store/")
4040++ # Exclude .local/share/ulauncher which isn't what we want
4141++ if not dir.startswith(xdg_data_home)
4242++ ],
4343++ )
4444++ )
4545++
4646++ try:
4747++ return paths[0]
4848++ except:
4949++ raise ProjectPathNotFoundError()
5050+5151+5252+ def is_wayland():
5353+--
5454+2.25.1
5555+