Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to execute commands as a different user with su <user> -c <code> doesn't always work #211

Closed
TadejDragojlovic opened this issue May 10, 2022 · 2 comments
Labels

Comments

@TadejDragojlovic
Copy link

I've been trying to get this to work but with no particular success:

capslock = layer(l1)

[capslock]
x = command(su <user> -c spotify)

After updating the default.conf and restarting the service, utilizing this action doesn't result in anything. I've tried making it work without switching users but some applications couldn't be simply ran as root.

However, I tried stopping the service and manually starting the keyd to see what would happen.
sudo keyd
Utilizing the 'command()' action now works without a problem and command spotify executes without the problem when pressing assigned keys.
Is there any way I can achieve the successful execution of this command when the keyd.service is ran?

Thank you!

@rvaiya
Copy link
Owner

rvaiya commented May 10, 2022

capslock = layer(l1)

should be

capslock = layer(capslock)

unless you have defined l1 somewhere else.

x = command(su <user> -c spotify)

I would strongly recommend against doing this. You should map programs like this inside of your window manager or desktop environment. If you are on a single user machine and know what you are doing (e.g have set DISPLAY appropriately, etc) then you might want to try something like this

command(su <user> -c spotify > /tmp/log 2>&1)

to see what is going wrong.

@TadejDragojlovic
Copy link
Author

Setting the DISPLAY variable does the trick. Appreciate it, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants