swhkd icon indicating copy to clipboard operation
swhkd copied to clipboard

swhkd wont run + XDG_CONFIG_HOME/RUNTIME_DIR issues

Open webbb82 opened this issue 2 years ago • 4 comments

Version Information: swhkd 1.3.0-dev

  • Distribution Information ( run uname -a )
  • swhkd version ( swhkd -V ) Linux archlinux 6.2.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 20 Apr 2023 16:11:55 +0000 x86_64 GNU/Linux Describe the bug: Cant get keybinds to work in swhkd. They do work when put in the hyprland config file. When in the terminal i type "swhkswhkd pkexec swhkd" I get this error ERROR swhkd] XDG_RUNTIME_DIR has not been set. Running swhkd as root! [2023-04-28T01:40:11Z ERROR swhkd] XDG_CONFIG_HOME has not been set

so ok Lets look into this. I looked it up and putting export XDG_RUNTIME_DOR=/run/user/1000 amd export XDG_CONFIG_HOME=/run/user/1000 in the .zshrc file this is suppose to fix that. It didnt. another similar bug report for swhkd said to try and run systemctl --user restart hotkey.service amd O tried that but i get Failed to restart hotkeys.service: Unit hotkeys.service not found.

So now I dont know what else to do. here is my journal log https://pastebin.com/j2qi9w4j Expected behavior: I expected that once installed, and Ran sxgkd and plkexes something that my keybinds on the config file would start to work

Actual behavior: Nothing happened. swhkd did not start nor did my keybinds work To Reproduce: Install swhkd in hyprland and try to start. It never started on its own so I had to try and manually start it

Additional information:

webbb82 avatar Apr 28 '23 02:04 webbb82

I believe this is the similar to https://github.com/waycrate/swhkd/issues/201

heyzec avatar May 05 '23 13:05 heyzec

Ok so maybe I tell swhkd and pexec to run in the startup screipt with the c flag after the name and point it toward where the actual config is located ?

On Fri, May 5, 2023, 6:14 AM heyzec @.***> wrote:

I believe this is the similar to #201 https://github.com/waycrate/swhkd/issues/201

— Reply to this email directly, view it on GitHub https://github.com/waycrate/swhkd/issues/203#issuecomment-1536245492, or unsubscribe https://github.com/notifications/unsubscribe-auth/A46AI3F4FHJ7Q5F3Z6WXDK3XET4J3ANCNFSM6AAAAAAXOTSH2E . You are receiving this because you authored the thread.Message ID: @.***>

webbb82 avatar May 05 '23 17:05 webbb82

This is happening because swhkd tries to use the config in your .config directory if the XDG_CONFIG_HOME environment variable is set, however since pkexec doesn't pass-through all of your environment variables (including XDG_CONFIG_HOME), swhkd falls back to a hardcoded path that is /etc/swhkd/swhkdrc

Pkexec marks this logging message as an expected error instead of a warning, and doesn't mention that it's falling back to a hardcoded path, until you actually look at at the source, which is leading to this confusion

All you have to do is just create the file at /etc/swhkd/swhkdrc. Pkexec will still warn you that the environment variables are not set, but it will not terminate this time since the config file exists at the hardcoded path it falls back to.

ItsProfessional avatar May 16 '23 13:05 ItsProfessional

This is happening because swhkd tries to use the config in your .config directory if the XDG_CONFIG_HOME environment variable is set, however since pkexec doesn't pass-through all of your environment variables (including XDG_CONFIG_HOME), swhkd falls back to a hardcoded path that is /etc/swhkd/swhkdrc

Pkexec marks this logging message as an expected error instead of a warning, and doesn't mention that it's falling back to a hardcoded path, until you actually look at at the source, which is leading to this confusion

All you have to do is just create the file at /etc/swhkd/swhkdrc. Pkexec will still warn you that the environment variables are not set, but it will not terminate this time since the config file exists at the hardcoded path it falls back to.

oh alrigh ill give that a try. thank you very much

webbb82 avatar Jun 02 '23 00:06 webbb82