yarn && yarn start
jeantil / autokbisw Goto Github PK
View Code? Open in Web Editor NEWproject has migrated - Automatic keyboard/input source switching for OSX
project has migrated - Automatic keyboard/input source switching for OSX
yarn && yarn start
Hi Jean,
Unfortunately, or maybe I missing something, the switch does not operate on my setup
I've tried a few times using sublime text to switch from MBP keyboard or USB one... without success..
I just want an automagic switch between input source/keymap.
Do we have any troubleshooting procedures or verification steps to do a diagnostic?
> ps ax|grep autok
98748 ?? S 0:00.04 /usr/local/Cellar/autokbisw/1.2.0/bin/autokbisw
99076 s004 SN 0:00.02 sudo autokbisw
99095 s004 SN 0:00.03 autokbisw
Thanks,
Victor
Is it possible to make it work with karabiner-elements? I checked the code and it seems autokbisw is detecting layout through the device code, I'm not sure if Karabiner is sending the proper layout code though.
How do I use this?
I can't see any binaries in the repository... I'd like to use this as I have an internal British keyboard and external British PC keyboard.
Unfortunately I am not familiar with xcode or swift.
Many thanks
Hello,
first of all many thanks for all you've done!
I've just changed my Intel MacBook for the new M1 MacBook and it seems that autokbisw can't be installed using Homebrew:
I've run "brew install jeantil/autokbisw/autokbisw" and here there is the error
....
swift
build
-c
release
-Xswiftc
-static-stdlib
--disable-sandbox
Hi
I try to install autokbisw on MacOS 11.6 with brew and it faild with
Cloning into '/usr/local/Homebrew/Library/Taps/jeantil/homebrew-autokbisw'...
remote: Enumerating objects: 34, done.
remote: Total 34 (delta 0), reused 0 (delta 0), pack-reused 34
Unpacking objects: 100% (34/34), 9.79 KiB | 417.00 KiB/s, done.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/jeantil/homebrew-autokbisw/Formula/autokbisw.rb
autokbisw: undefined method 'cellar' for #<BottleSpecification:0x00007ff19d8a8db0>
Error: Cannot tap jeantil/autokbisw: invalid syntax in tap!
On my Mac is this version of ruby
ruby --version
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
Any hint ?
Soooo, I can't figure out why, but having this installed … it looks like I can't change my layout, for a given input device, ever again?
I have autokbisw installed, and registered with LaunchD. I have an external, Colemak-layout mechanical keyboard, that I use at work; autokbisw keeps my macOS layout set to U.S.
while using my hardware-Colemak board. I -also- use my work laptop on the go; when typing on my internal keyboard, autokbisw sets my macOS layout to Colemak
.
Problem is, today, after a couple weeks of happily using this setup, I tried to install and run a game on this laptop. I switch to U.S.
keyboard layout … open the game … and try to WASD around. No dice. I tab back out, and … the macOS layout is back in Colemak
, even though I manually changed it? I try switching it to U.S.
(success), ⌘␣ to try it out … and watch the macOS input-source in my menubar immediately switch back to Colemak
as soon as I touch my keyboard.
tl;dr Am I missing something? I thought autokbisw was supposed to only change my layout when I used a different keyboard; not keep switching it while I'm on a single keyboard, even when I try to manually override it.
bash-3.2$ cp ${le chemin ci-dessus} /usr/local/bin/
bash: ${le chemin ci-dessus}: bad substitution
pwd
[.....]/Users/jean/dev/opt/autokbis
ll
total 10676
-rwxr-xr-x 1 bao3 10929376 Dec 19 18:16 autokbisw
How to resolve it ?
To have a programm started in the background automatically in osx there are 4 options according to Table 1-1 in https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/DesigningDaemons.html#//apple_ref/doc/uid/10000172i-SW4-BBCBHBFB
From that table I think the correct choice for autokbisw would be a "Launch Agent" . According to the documentation
It loads the parameters for each launch-on-demand user agent from the property list files found in /System/Library/LaunchAgents, /Library/LaunchAgents, and the user’s individual Library/LaunchAgents directory.
So autokbisw needs a plist that can be put in one of these 3 folders. Most likely as this is a user specific choice in ~/Library/LaunchAgents
.
I'm relying on autokbisw
for my daily work so it was a bummer when it didn't work anymore after upgrading to Monterey. So I went and fixed it ;-)
Please have a look at my fork over at https://github.com/ohueter/autokbisw, see the updated README for building and installation instructions and give it a try. I've never worked with native macOS development and Swift before, so if something doesn't work, let's try and find a solution together :-)
Hi, thanks for this... it is exactly what i was looking for!
However, it doesn't seem to be working in my setup. I am using Mac OS Mojave v10.14.1 and have the software installed via homebrew. It was added to the homebrew startup list and is verified as running.
Forgive me if I'm being dumb but that's all that should need doing right? It's just not switching when a different keyboard is used.
Happy to help in any way i can.
Do you think you could add an option to save the settings between restart?
Do you think it could be possible to manage 2 external keyboards?
Currently it only remembers the settings for 1 external keyboard, even when 2 are used.
Cheers,
Hello
First thanks for this tool. I'm wondering if this script could work in this scenario:
Thanks in advance
I haven't found how to unregister the call back for now.
See http://stackoverflow.com/questions/40808676/how-to-cast-nil-to-iokit-iohidvaluecallback-in-swift for the details.
I have a 2020 13 inch MB pro running Mojave with EN KB and an external Spanish Apple BT keyboard. It launches at startup no problem, but after the machine goes to sleep, autokbisw stops working... the executable is running, but won't change the input source anymore. I end up having to run it manually and the ps output is:
501 641 1 0 9:06AM ?? 0:05.35 /usr/local/bin/autokbisw
0 3486 3466 0 12:27PM ttys000 0:00.09 sudo ./autokbisw
0 3487 3486 0 12:27PM ttys000 0:02.97 ./autokbisw
Some console log entries:
default 14:49:37.339998 -0500 autokbisw IOHIDDeviceClass::buildElements: type=1 *buffer=7fa076d5abc0 *count=4 size=384
default 14:49:37.340305 -0500 autokbisw IOHIDDeviceClass::buildElements: type=0 *buffer=7f8040e5aaa0 *count=9 size=864
default 14:49:37.340834 -0500 autokbisw IOHIDDeviceClass::buildElements: type=1 *buffer=7f8040c6baf0 *count=4 size=384
error 14:49:58.462046 -0500 kernel autokbisw is not entitled for IOHIDLibUserClient keyboard access
error 14:49:58.462050 -0500 kernel autokbisw is not entitled for IOHIDLibUserClient keyboard access
it would be nice to have a homebrew formula to install and update autokbisw
however it is unclear to me how to proceed on this topic for now. I will investigate https://github.com/shtirlic/yubikeylockd
Help is welcome :D
Great little tool for my MBP for correcting the layout of my USB keyboard when it's plugged in, however I also have a logitech USB mouse and autokbisw also seems to be assigning a keyboard layout to that whenever I click!
Here's a log of my typing on both my keyboards and clicking my mouse:
starting with useLocation:false - verbosity:1
set input source to <TSMInputSource 0x7f9f35003740> KB Layout: British - PC (id=250) for keyboard Optional(Dell USB Keyboard)-[Optional(16700)-Optional(8195)-Optional(Dell)-nil]
set input source to <TSMInputSource 0x7f9f35002fa0> KB Layout: British (id=2) for keyboard Optional(Apple Internal Keyboard / Trackpad)-[Optional(1452)-Optional(635)-Optional(Apple Inc.)-Optional(FM783050239J3VYAX+RCP)]
set input source to <TSMInputSource 0x7f9f35003740> KB Layout: British - PC (id=250) for keyboard Optional(Dell USB Keyboard)-[Optional(16700)-Optional(8195)-Optional(Dell)-nil]
set input source to <TSMInputSource 0x7f9f35003740> KB Layout: British - PC (id=250) for keyboard Optional(Gaming Mouse G402)-[Optional(1133)-Optional(49278)-Optional(Logitech)-Optional(6D93279B5255)]
Is there any way to exclude the mouse from having its own layout?
Do we really need to install the full Xcode bundle? It's really heavy in terms of GB for my laptop.
For me this would be great, if it didn't see both my keyboards as the same device.
Tried using this with two apple magic keyboards, unfortunately they follow the same rule.. ish. There is alot of flickering of the flags in the menu (seems like it toggles back and forth several times per keypress)
Anyone successfully got this scenario working?
I absolutely ❤️this fix! It make pairing so much easier - thank you so much! 😊
We have some windows users that have converted to mac switch the modifier keys (ctrl and cmd) to make the transition easier.
Would it be possible to store the setting for each keyboard as well?
Part of the command "launchctl" is apparently deemed legacy.
It leads to the following message in Terminal:
Load failed: 5: Input/output
Using first launchctl unload path/to/plist
and then launchctl load path/to/plist
does not return the error, but also does not seem to make the binary work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.