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

Using evsieve with barrier #16

Open
acama opened this issue May 17, 2022 · 1 comment
Open

Using evsieve with barrier #16

acama opened this issue May 17, 2022 · 1 comment

Comments

@acama
Copy link

acama commented May 17, 2022

Hi,
This is not an "issue" per se but I don't know where else to ask this question. Sorry for spamming you with issues. I would like to be able to use evsieve with barrier (the keyboard and mouse sharing tool). My current setup is that I have a VFIO setup where I am using evsieve to switch keyboard and mouse between guest and host and also switch the display back and forth using ddcutil with "exec-shell" command. It is working pretty well and I have no issues with that. However, recently I have added a mac machine to my setup (a physical machine) and the way I am sharing the keyboard and mouse with that machine is by using 'barrier'. The question is then, how can I use evsieve together with barrier and add all that to my current setup ? I have started implementing a solution but I am missing some pieces in order to make it work fully. I have modified barrier so that I can switch the kbd/ms between the main (linux) machine and the macos machine by issuing a command (think barrierctl switchtoa/switchtob). Currently my evsieve command is the following:

	--input  /dev/input/by-id/usb-SteelSeries_SteelSeries_Aerox_3_Wireless-event-mouse    persist=reopen domain=ms grab \
        --toggle @kb @guest-kb @host-kb  \
        --toggle @ms @guest-ms @host-ms  \
        --hook   key:leftalt@host-kb key:rightalt@host-kb toggle   exec-shell="sudo ddcutil --display=1 setvcp 60 0x0f"\
        --hook   key:leftalt@guest-kb key:rightalt@guest-kb toggle  exec-shell="sudo ddcutil --display=1 setvcp 60 0x13" \
        --output @host-kb create-link=/dev/input/by-id/host-kbd   \
        --output @host-ms create-link=/dev/input/by-id/host-mouse      \
        --output @guest-kb create-link=/dev/input/by-id/guest-kbd \
	--output @guest-ms create-link=/dev/input/by-id/guest-mouse

This is switching between guest and host when I press leftalt+rightalt. Is there anyway I could add switching to the macos machine to this somehow in a way that wouldn't result in some inconsistencies in my setup ? For instance using leftshit+rightshift to switch back and forth between the macos machine and the host machine using a combination of the barrierctl command and ddcutil.

@KarsMulder
Copy link
Owner

Maybe something like the following can solve your problem?

    --input  /dev/input/by-id/YOUR_KEYBOARD                                               persist=reopen domain=kb grab \
    --input  /dev/input/by-id/usb-SteelSeries_SteelSeries_Aerox_3_Wireless-event-mouse    persist=reopen domain=ms grab \
    --toggle @kb @guest-kb @host-kb @gmac-kb @hmac-kb \
    --toggle @ms @guest-ms @host-ms @gmac-kb @hmac-kb \
    --hook   key:leftalt@host-kb    key:rightalt@host-kb    toggle=:1 exec-shell="sudo ddcutil --display=1 setvcp 60 0x0f" \
    --hook   key:leftshift@host-kb  key:rightshift@host-kb  toggle=:4 exec-shell="barrierctl switchtob" \
    --hook   key:leftalt@guest-kb   key:rightalt@guest-kb   toggle=:2 exec-shell="sudo ddcutil --display=1 setvcp 60 0x13" \
    --hook   key:leftshift@guest-kb key:rightshift@guest-kb toggle=:3 exec-shell="barrierctl switchtob" \
    --hook   key:leftalt@gmac-kb    key:rightalt@gmac-kb    toggle=:4 exec-shell="sudo ddcutil --display=1 setvcp 60 0x13" \
    --hook   key:leftshift@gmac-kb  key:rightshift@gmac-kb  toggle=:1 exec-shell="barrierctl switchtoa" \
    --hook   key:leftalt@hmac-kb    key:rightalt@hmac-kb    toggle=:3 exec-shell="sudo ddcutil --display=1 setvcp 60 0x0f" \
    --hook   key:leftshift@hmac-kb  key:rightshift@hmac-kb  toggle=:2 exec-shell="barrierctl switchtoa" \
    --output @host-kb @hmac-kb @gmac-kb create-link=/dev/input/by-id/host-kbd   \
    --output @host-ms @hmac-ms @gmac-ms create-link=/dev/input/by-id/host-mouse \
    --output @guest-kb create-link=/dev/input/by-id/guest-kbd \
    --output @guest-ms create-link=/dev/input/by-id/guest-mouse

It internally considers four different states: (1) guest screen is active, controlling main pc; (2) host screen active, controlling main pc, (3) guest screen active, controlling mac, (4) host screen active, controlling mac,. For each of those four states, it provides hotkeys to transition between them. Whenever either the host screen is active or the mac is being controlled, the keys are outputted on the host devices.

(Yes, I acknowledge that the above script is a bit unwieldy.)

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

No branches or pull requests

2 participants