Giter VIP home page Giter VIP logo

Comments (22)

plessbd avatar plessbd commented on June 16, 2024 3

in case anyone else wants to do this via a script, this will work.
replace to where you have your synergy log pointed to.

tail -f /usr/local/var/log/synergy.log | awk '/leaving screen/{system("/Applications/Karabiner.app/Contents/Library/bin/karabiner select 0")} /entering screen/ {system("/Applications/Karabiner.app/Contents/Library/bin/karabiner select 1")}' &

from karabiner-archived.

pellesg avatar pellesg commented on June 16, 2024

This would be fantastic!! I have been trying to get around this my self.

from karabiner-archived.

bjeanes avatar bjeanes commented on June 16, 2024

@tekezo, obviously this isn't possible if you are using Synergy to access a different OS, but if the other end is also OS X, try checking out Teleport. I use that regularly and I've never noticed any weird problems with the mappings (but I don't have very many advanced ones enabled).

from karabiner-archived.

tekezo avatar tekezo commented on June 16, 2024

Thanks for the information.
As you say, it is not possible unless we modify Synergy.
However, there are some Synergy support requests.
I'll challenge to this issue in the future.

from karabiner-archived.

loudsong avatar loudsong commented on June 16, 2024

I'm running into this too. I have my Mac as a synergy server, with a Linux box as a synergy client. I want to have remapping take place on the Mac only, but I want to be able to create exclusions so that remapping does not occur when I move over to the Linux box via synergy.

I tried to create an appdef for synergy, but that didn't seem to have any affect. Has anyone figured out how to get this to work?

from karabiner-archived.

paulhybryant avatar paulhybryant commented on June 16, 2024

Another thing is when using a windows as the synergy server, the key mapping defined in karabiner is not effective in the client on a mac book.

from karabiner-archived.

tekezo avatar tekezo commented on June 16, 2024

@paulhybryant Karabiner modifies input events in the keyboard driver.
Therefore, unfortunately, Karabiner requires connected keyboards.

from karabiner-archived.

mooreaa avatar mooreaa commented on June 16, 2024

I have made a profile, default and inactive to resolve this issue. Would be nice to allow automatic profile switching based on an external trigger. Looks like Synergy does have a plugin model to support events.

from karabiner-archived.

tekezo avatar tekezo commented on June 16, 2024

Looks like Synergy does have a plugin model to support events.

It's great!
You can use command line interface to switch profile. (select_by_name)
https://pqrs.org/osx/karabiner/document.html.en#commandlineinterface

from karabiner-archived.

paulhybryant avatar paulhybryant commented on June 16, 2024

@mooreaa can you elaborate on what you mean by making a profile?

from karabiner-archived.

mooreaa avatar mooreaa commented on June 16, 2024

Karabiner allows you to set up different profiles which you can select from the menubar. If you go into Karabiner settings, click on the MenuBar tab, you can add a new SettingList.

I have my default profile with all the settings I like, an an Inactive setting where I have disabled all the functions of Karabiner. When I switch monitors, I switch profiles which essentially set Karabiner to a disabled state so it doesn't interfere.

It would be nice to automatically trigger this profile change when screens change. Unfortunately, the plugin model seems to only be supported on a very old version of Synergy and from Windows only.

from karabiner-archived.

tekezo avatar tekezo commented on June 16, 2024

I don't know how to detect screens change.
I think that the easiest way is adding a hook into Synergy that executes shell commands when screens change.

from karabiner-archived.

twig avatar twig commented on June 16, 2024

Perhaps https://github.com/nbolton from Synergy project may be able to create some global message you can listen out for when it switches between Windows so Karabiner can toggle it's features on/off ?

from karabiner-archived.

tekezo avatar tekezo commented on June 16, 2024

Yes.
If Synergy runs a shell command when OS is switched, we can use command line interface.
https://pqrs.org/osx/karabiner/document.html.en#commandlineinterface

from karabiner-archived.

twig avatar twig commented on June 16, 2024

Actually, I think it would be more appropriate if Synergy provided a SDK of some sort so other programs can listen in for to know when screens have been switched.

Karabiner would be able to toggle whenever the event occurs.

from karabiner-archived.

petersonchen avatar petersonchen commented on June 16, 2024

There is a workaround that writes a script to tail synergy log ,
then we can switch profile automatically using Karabiner CLI command according to the tail result ("INFO: entering screen" , "INFO: leaving screen").

from karabiner-archived.

aminor00 avatar aminor00 commented on June 16, 2024

OK, so my config is a Mac and a Windows PC. The Mac is the Karabiner 'Server' and the PC is the client. On the Mac I've set up two profiles. Default Profile is the one on which I've enabled the settings I want for the Mac and the second profile ("PCMode") has settings for when I've moved the mouse into the PC screen area.

All is great now and I've got my keyboards working really well with the Synergy and Karabiner combo. I used the example tail command above (thank you plessbd!) but tweaking it by swapping around the "select 0" and "select 1".

from karabiner-archived.

ndreisg avatar ndreisg commented on June 16, 2024

@tekezo Hi! I am using Synergy with a Windows machine as server and my Mac as client.
You mentioned, that Karabiner modifies input events in the keyboard driver and therefore requires connected keyboards.

But, when I open the Karabiner Event Viewer, I actually see the events from synergy

CTRL + C from Mac:
eventType:FlagsChanged code:0x3b name:left_control flags:Ctrl
eventType:KeyDown code:0x8 name:c flags:Ctrl
eventType:KeyUp code:0x8 name:c flags:Ctrl
eventType:FlagsChanged code:0x3b name:left_control flags:

CTRL + C from Synergy:
eventType:KeyDown code:0x8 name:c flags:Cmd
eventType:KeyUp code:0x8 name:c flags:Cmd

As you can see, the events from Synergy do not contain the "FlagsChanged" events, though in the KeyDown/KeyUp events the flags are correclty set. Shouldn't this information be enough to modify the events??

from karabiner-archived.

kranasian avatar kranasian commented on June 16, 2024

Now that karabiner is obsolete and I've switched to Karabiner-Elements, here's my workaround for Synergy if anybody happens to stumble onto this thread.
Working on top of @plessbd idea.

Get JQ - quick 1 minute download
Create shell script: I named it switch_karabiner.sh

#!/bin/bash

PROFILE=$1

JQ="${HOME}/bin/jq"
CONFIG=".config/karabiner/karabiner.json"
TMP_CONFIG=${CONFIG}.1

${JQ} ".profiles[].selected = false" ${CONFIG} \
  | ${JQ} ".profiles[${PROFILE}].selected = true" \
  > ${TMP_CONFIG}

if [ $? != 0 ]; then
  echo "Failed!"
  rm ${TMP_CONFIG}
else
  mv ${TMP_CONFIG} ${CONFIG}
fi

Change variables as needed.
My setup is 0 - Mac, 1 - Linux

Then you just call that script with @plessbd script:

tail -f /var/log/synergy.log | awk '/leaving screen/{system("~/bin/switch_karabiner.sh 1")} /entering screen/ {system("~/bin/switch_karabiner.sh 0")}' &

PROFIT!

from karabiner-archived.

DKroot avatar DKroot commented on June 16, 2024

Karabiner Elements now supports switching profiles via CLI, e.g. '/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli' --select-profile '-'. I have problems trying to implement this workaround on the Synergy 1 side though:

  1. I don't have /var/log/synergy.log: running Synergy GUI.
  2. When I try to switch to synergys CLI, I get FATAL: A runtime error occurred: assistive devices does not trust this process, allow it in system settings.. I was able to overcome it when running synergys from iTerm2 by adding iTerm to the Accessibility whitelist. However, I run Synergy server on startup via custom shell script lunched from a user agent, and I'm out of luck because the Accessibility whitelist accepts only apps.

I reported these to Synergy support. I'll see what they say.

from karabiner-archived.

knu avatar knu commented on June 16, 2024

It's 2020 and I'm using Barrier instead of Synergy, and here's how I integrate it with Karabiner-Elements using Hammerspoon: https://gist.github.com/knu/8b3b784100bae2f8088ff09afc7c451b

from karabiner-archived.

zyrain avatar zyrain commented on June 16, 2024

It's 2020 and I'm using Barrier instead of Synergy, and here's how I integrate it with Karabiner-Elements using Hammerspoon: https://gist.github.com/knu/8b3b784100bae2f8088ff09afc7c451b

This was amazing. Thank you!

from karabiner-archived.

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.