Nama / swayrst

Restore workspaces in sway to displays and move applications to saved workspaces
MIT License
54 stars 7 forks source link

Config not found - missing trailing slash #9

Closed pineman closed 1 year ago

pineman commented 1 year ago

Hi, thanks for this script.

When I run it, I get this error: Sway config not found! Make sure to use a default config path (man sway).

I've tracked it to 561eca1. home_folder and config_folder don't have a trailing slash, so each path in paths looks like /home/user.sway/ or /home/user/.configsway.

Adding a trailing slash worked for me. Here's the diff I used:

diff --git a/sway_workspaces/sway_workspaces.py b/sway_workspaces/sway_workspaces.py
index 9d81709..4a9ea22 100644
--- a/sway_workspaces/sway_workspaces.py
+++ b/sway_workspaces/sway_workspaces.py
@@ -23,9 +23,9 @@ else:
     notifysend = None

 PATH = None
-home_folder = os.path.expanduser('~')
+home_folder = os.path.expanduser('~') + '/'
 try:
-    config_folder = os.environ['XDG_CONFIG_HOME']
+    config_folder = os.environ['XDG_CONFIG_HOME'] + '/'
 except KeyError:
     config_folder = home_folder + '/.config/'
 paths = [

I can open a PR if you want. Thanks!

Nama commented 1 year ago

Oh right, that environment variable was never set on my system.

Sure, open a PR. Just remove the leading slash in config_folder = home_folder + '/.config/'