Git Product home page Git Product logo

Comments (6)

Lenbok avatar Lenbok commented on August 12, 2024 26

I played with runuser, but it's difficult to get environment variables passed through (e.g. I need variables to disable client-side decorations etc). Instead, I've set up udev rules so that xkeysnail can run as the current user, without sudo.

First create a new group to which we allow access to the input stuff, and add this group to your user:

sudo groupadd -f uinput
sudo gpasswd -a $USER uinput

Create new udev rule granting access:

cat <<EOF | sudo tee /etc/udev/rules.d/70-xkeysnail.rules
KERNEL=="uinput", GROUP="uinput", MODE="0660", OPTIONS+="static_node=uinput"
KERNEL=="event[0-9]*", GROUP="uinput", MODE="0660"
EOF

Reboot. xkeysnail should now run OK without sudo. The launch examples I listed above now work fine.

from xkeysnail.

Lenbok avatar Lenbok commented on August 12, 2024

According to the example config, there is a 'launch' command, so you can do something like this:

define_keymap(None, {
    K("print"): launch(["gnome-screenshot", "--interactive"]),
    K("Super-p"): launch(["gnome-screenshot", "--interactive"]),
}, "Global shortcuts")

I had never tried it before, but since I've been wanting to try converting my xbindkeys config to such a launch system, so I gave it a go. It works, but since xkeysnail is run via sudo, the subsequent gnome-screenshot is running as root, which is less than ideal. Does @mooz use the launch capability?

from xkeysnail.

singletS avatar singletS commented on August 12, 2024

Would runuser work here?

from xkeysnail.

rbreaves avatar rbreaves commented on August 12, 2024

I think runuser would probably work with something like env DISPLAY=:0 /sbin/runuser -l username -c "/path/to/program" would be my guess.

This is going to be useful though as I am thinking about implementing something to help inspect the clipboard before just copying the contents into a terminal without warning or a previewing assuming it is multiline or has carriage returns in it.

from xkeysnail.

joshgoebel avatar joshgoebel commented on August 12, 2024

Sorry, wrong thread.

from xkeysnail.

joshgoebel avatar joshgoebel commented on August 12, 2024

I have an issue on my fork exploring how this might be done properly and securely.... it's not super difficult if someone wanted to implement it and test it out... (on top of my fork or even on top of the last xkeysnail 0.4.0). I don't believe any of the new things I've implemented in my fork are necessary.

joshgoebel/keyszer#44

from xkeysnail.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.