Coder Social home page Coder Social logo

duanefields / virtualkvm Goto Github PK

View Code? Open in Web Editor NEW
305.0 305.0 34.0 10.54 MB

Automatically toggles Bluetooth and Target Display Mode when you connect a Macbook to your iMac via Thunderbolt.

Ruby 0.36% Objective-C 31.41% Swift 37.36% C 0.13% Rich Text Format 1.12% Python 24.30% Shell 5.32%

virtualkvm's People

Contributors

alvaromurillo avatar donaldchai avatar duanefields avatar marcferna avatar reitermarkus avatar soneejohn avatar xlc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

virtualkvm's Issues

Target display mode not enabled after sleep

There's a problem I keep running into where the iMac or the Macbook falls asleep and things can't recover. When I wake them up, Target Display Mode is disabled, and plugging/unplugging the thunderbolt cable doesn't do anything. I've confirmed that the app still recognizes connect/unconnect, but it can't re-enable target display mode.

I'm guessing that because at this point the iMac has no keyboard, the Mac is ignoring the AppleScript key code commands, because the only "fix" is to re-enable bluetooth and connect to the keyboard on the iMac.

Target display mode not detected whatsoever

I have a Mid 2015 MacBook Pro connected to a Mid 2011 iMac using a new thunderbolt cable. Both macs are running High Sierra and Virtual KVM is on the iMac. The iMac is not detected when connected to the MacBook Pro as a second display. Any ideas?

Toggle specific bluetooth devices

It'd be nice to have the app only toggle the mouse and keyboard when connecting/disconnecting. At the moment, the bluetooth toggle turns off so I lose my headphones and any other devices connected to my laptop.

Maybe some kind of menu where you can select which devices to toggle on connecting?

Possible serious issue?

Hi,

I'm really not sure if this was a direct cause of VirtualKVM but I have had a serious issue croup while using it, and think it's worth investigating.

Basically I had VirtualKVM installed and running on my iMac which had been working fine. However I did something this week, and maybe didn't fully think about the potential ramifications.

I needed to connect my MacBook using target disk mode, put it into that mode and connected it to my iMac. This didn't go well at all, the disks didn't mount and basically my MacBook volume got corrupted and the MacBook would not boot at all afterwards.

After some hard work I have managed to recover the data, but had to do a fresh install etc.

Could this have had anything to do with VirtualKVM? It feels to me that putting my MacBook into target disk mode made the MacBook emulate a thunderbolt storage, as it was plugged into the iMac would VirtualKVM have detected the thunderbolt connection and switched to display mode at the same time the drive was trying to mount? In hindsight it sounds like what I did was asking for trouble, but just didn't occur to me at the time!!.

Thanks

Client Mode status not changing

Since my update to El Capitan and VirtualKVM v1.1.2 both MacBook and iMac the Client Mode status is not set correctly both on connecting and disconnecting the iMac.

iMac could be left with Client Mode: Connected even if disconnected and MacBook are left in Client Mode: Not Connected even when connected.

The Target Display Mode works as usual but I have to change the bluetooth status manually – very annoying since I use a bluetooth keyboard.

Not working with new MacBook Pro 2017 model

I have a 27" iMac 2011 model that works fantastic when I manually put the display into target display mode. I run the Virtual KVM package on my MacBook and it shows that the iMac is connected only after manually activating target display mode. Plugging it in and unplugging the thunderbolt cable only changed the status from "Connected" to "Not Connected". Once "not connected", I can not get it to say connected again until I manually activate display mode from the iMac again. I have tried using all packages compatible with OSX 10.11. I've rebooted everything multiple times and tried a few different wired and wireless keyboards. I've left a keyboard on the iMac through all of the testing. Nothing works. Any ideas?

'Host Mode : Ready to Accept Connections' is greyed out

I was really hoping this would resolve issue trying to connect my 2016( new gen) MBP to a mid 2011 iMac. Cannot seem to get iMac into Target Display Mode no matter what I try - any suggestions appreciated.

When I run the tool it seems to be active but plugging in MBP has no effect and I note that in the status bar on the iMac, the 'host mode' status seems to be greyed out as per the subject line above.

thanks

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to set posix_spawn_file_actions for fd -1 at index 0 with errno 9

Received this exception today.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to set posix_spawn_file_actions for fd -1 at index 0 with errno 9'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fffb149f7bb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffc5c0ca2a objc_exception_throw + 48
	2   CoreFoundation                      0x00007fffb151ca65 +[NSException raise:format:] + 197
	3   Foundation                          0x00007fffb2ed2a16 -[NSConcreteTask launchWithDictionary:] + 2518
	4   VirtualKVM                          0x000000010f02b089 +[KVMSystemProfiler dataTypes:] + 265
	5   VirtualKVM                          0x000000010f02948d -[KVMThunderboltObserver updateSystemProfilerInformation] + 141
	6   VirtualKVM                          0x000000010f0296bb -[KVMThunderboltObserver checkForThunderboltConnection] + 43
	7   VirtualKVM                          0x000000010f028f1f __45-[KVMThunderboltObserver registerRepeatBlock]

App No Longer Works on macOS Sierra

I am running a MacBook Pro on OS X El Capitan and an iMac on the macOS Sierra and the Virtual KVM software no longer detects the Thunderbolt cable being connected and disconnected. Has anyone else running macOS Sierra experienced this issue?

How to build page

It's not really difficult to build the project, but it takes some time if you're no a Mac developer. It would be great to describe the process at least shortly. Tricky moments for me were to find, that:

  • CocoaPods have to be installed first (sudo gem install cocoapods)
  • than pod (pod install)
  • Xcode has to be run from the terminal (open VirtualKVM.xcworkspace)

Also I still don't know how to build Release instead of Debug.

Doesn't work with OWC Thunderbolt 3 dock

Hi All,
I had the vKVM working beautifully between my 2011 iMac and 2015 MacBook Pro via Thunderbolt 2

Then I decided to add the OWC Thunderbolt 3 dock to the mix (Why 3, because I will be upgrading soon and didn't want to buy a legacy dock).
So now my setup is
2015 MBP <-> T2 Cable <-> T2 to T3 Adapter <-> OWC T3 Dock <-> T3 to T2 Adapter <-> T2 Cable <-> 2011 iMac

I can manually turn on TDM from iMac, and then use screen sharing to get K+M working, but when I connect or disconnect Thunderbolt from my MBP nothing happens. Looks like the client/server communication is totally blocked by the dock.

Is this expected behaviour or a bug?
Any chance this will get fixed?
I shelled out quite a bit of cash for that dock, and may need to return it if this doesn't work

I am running latest 1.2.3
Thx

BQ

Feature Request: Restart VirtualKVM from Menu

There is already an issue regarding manually connecting KVM.

My current workaround is to quit VirtualKVM and start it up again. That seems to do the trick.

Would it be possible to add that as a menu item?

iMac Pro to iMac ?

I am wondering if this also works with the iMac Pro using an older iMac 2013 as an external second display. Both running the latest OSX High Sierra. Does anyone know?
Thank you

Downloadlink broken

The link to the release build is broken.

I have downloaded the binary and could run the application from Xcode. The screen will toggle to target display mode. However if I build an application and start it then it doesn't work.

Please provide a ready-to-go release build.

Awesome Tool!

So I lucked upon your repository and you may have added a few hours to my life and hairs to my head! I was banging my forehead against the keyboard asking why I had to do an automator workflow for this? Seems like it should be "apple-matic", especially with the bluetooth release.

Anyways, thank you for starting the project and going at the problem with complete solution.

EDIT
Got it working! Thanks again!

Aloha!

Jeremy

Feature Request: toggle manually from MacBook

I'd love to be able to toggle TDM from my MacBook, manually. The auto mode doesn't work so well for me, because it's a bit imprecise.

What I mean is, if I leave my desk and my laptop goes into screensaver, after a while the iMac goes to sleep. I turn it back on but since it doesn't record a Thunderbolt connection, VirtualKVM doesn't trigger TDM and I have to go in and do it manually.

Would be awesome if I could install VirtualKVM on my laptop as well and use it to trigger the one on the iMac...

Auto Toggle Bluetooth doesn't work in a client mode

I use macOS 10.12.4 and VirtualKVM 1.2.2 but the same issue appeared in the previous versions, too.

When I connect a cable iMac is switching to the TDM but Mac Book doesn't enable Bluetooth and I have to enable it manually. When I disconnect a cable Bluetooth is not disabled on Mac Book. At the same time, "Auto Toggle Bluetooth" works fine in a host mode.

error

Ok I figured out the cocoapods thing but I'm now getting this error upon attempting to build

linker command failed with exit code 1 (use -v to see invocation)

Can't get TDM to work with VirtualKVM or Manually (iMac Late 2009 & MBP Mid-2014)

Here's the setup:

  • iMac Late 2009, Mini-displayport, has wired Apple keyboard and wireless Apple magic mouse, High Sierra 10.13.6
  • MBP Mid-2014, Thunderbolt 1/2 ports, wireless Apple mouse & keyboard separate from above, High Sierra 10.13.6
  • Mini-displayport-to-Mini-displayport cables connecting them

VirtualKVM isn't detecting a connection. Any suggestions? Should I be able to see a connection in System Information on the MBP under Thunderbolt?

Connection not detected between macbook air & imac

with 1.2.3, I'm attaching a macbook air 6,1 (High Sierra) to an imac13,2 (Sierra)

The system report recognises each other under thunderbolt, (so the cable is connected okay) but VirtualKVM just has Host: ready to accept connections and macbook has client mode: not connected.

Moreover, I cannot seem to manually invoke target display mode, (but with a non-apple keyboard)

It may just be a case of an incompatible pair of machines, but just in case, I thought I'd report it! :)

High energy utilization due to NSTimer

I noticed high energy utilization due to NSTimer that fires every 2.5 seconds. I can understand why the timer is needed on the host computer but not on the client.

screen shot 2016-11-24 at 8 33 32 pm

I usually have VirtualKVM always open on MacBook and having a timer that is polling for thunderbolt connection isn't very inefficient. I know this issue may seem trivial to some but I decided to report it anyway. πŸ™‚

Disconnecting DisplayPort monitor disconnects Bluetooth, but reconnecting doesn't enable

I have a MacBook Pro (13-inch, 2015) that I use in target display mode with my iMac (21-inch, 2011) at home using a Thunderbolt cable. I also use this MacBook Pro with a DisplayPort monitor (not Thunderbolt) at work.

I've noticed that if I have VirtualKVM running when I have the device connected to the DisplayPort monitor, it will disconnect Bluetooth when the DisplayPort cable is detached. However, when I reattach the cable, Bluetooth isn't re-enabled automatically.

This is odd - it should either disconnect and reconnect automatically when a DisplayPort cable is disconnected/reconnected, or do neither. I'd prefer that it do both, as when I attach the DisplayPort cable I'm typically using a Bluetooth keyboard/mouse.

Build for OS X 10.7

Is there any reason OS X 10.9 is the minimum build version?

I'm trying to compile this for 10.7 on my fork at https://github.com/nybblr/VirtualKVM, but I am not an Obj-C coder (yet =) so I don't know if there are breaking SDK changes that would prevent this.

Thoughts?

Feature Request: Start VirtualKVM on startup

It would be great if you provide an option in preferences to start "VirtualKVM" on system login.

Now I have to manually start VirtualKVM and then connect my MacbookPro via thunderbolt cable.

NSTimer stops repeating?

I've been debugging the NSTimer not repeating for the last two days now. I found that sometimes the timer would simply stop firing on the host machine. This usually happens after the machine exited or entered sleep mode or when the screensaver started.

Target Display Mode not starting without keyboard

This report relates to Issue number 2.

I have two iMacs, only the master iMac has a cabled keyboard.
VirtualKVM on the slave iMac recognizes when the master is connected via Thunderbolt, but it does't toogle to TDM since no keyboard is connected.
Having two keyboards connected all time isn't a real solution because then I can also just use the shortcut on the slave iMac to start TDM.

Thunderbolt 3 and Bluetooth

Are there any known issues with thunderbolt 3 and the bluetooth toggle? I just got a new Macbook Pro and I'm using the thunderbolt 2 to thunderbolt 3 adapter to connect to my iMac. Everything works except bluetooth does not toggle on/off on the Macbook. I'm wondering if it has to do with the thunderbolt converter.

plan to upload new release?

It seems like there have been many commits since the latest release. (Oct. 12)
Can we get a new release with the latest code?

Entering TDM without keyboard

I believe it's possible to enter TDM without having a keyboard connected to the iMac.

I was able to open the force quit window using:

AXUIElementRef appRef = AXUIElementCreateSystemWide();
AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)55, true);
AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)58, true ); AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)53, true );            AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)55, false );
AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)58, false ); AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)53, false );

Note: The keyboard was disconnected from the computer with the above example.

However I am unable to use it to enter TDM

AXUIElementRef appRef = AXUIElementCreateSystemWide();
AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)55, true);
AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)120, true);
AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)55, false);
AXUIElementPostKeyboardEvent (appRef, (CGCharCode) 0, (CGKeyCode)120, false);

Any suggestion of how I would be able to enter the key codes to trigger TDM?

Detect Cable On Startup

In the current state, then I start the VirtualKVM and the cable is already plugged in, it does not detect it and does not switch to TDM. Would it be possible to change this behavior, so that the application also switches to TDM if the cable is already connected?

Use case is the following: If I boot or reboot the target iMac, it starts without TDM enabled. I would like it to automatically switch to TDM if booted and cable plugged in. (Application is in Login Items and there is a dummy user configured with auto login.)

Installation via homebrew?

Hi all,

thx to saving time and nerves. Are there any plans to make it available via homebrew?

Greetings
Olli

Display Not Toggling Since Updating to Mojave 10.14

Is anyone else having issues since upgrading to Mojave?

I started to see problems after upgrading. Then, found I needed to update VirtualKVM which I did. I think it worked once when I unchecked Prevent Display Sleep and hasn't worked since with a combination of turning settings on and off.

I have an 2012 iMac running Mojave and a 2016 Macbook Pro running Mojave. Thanks for your help and input on the issue!

Feature request: switch between host/client via menu item

VirtualKVM v1.1.0 allows users to transfer control of a keyboard/mouse/display (in particular the iMac display) by connecting or disconnecting a Thunderbolt cable. My setup involves two computers that may be connected indefinitely, and I would like to avoid stressing the hardware with repeated (dis)connections. This request is for the addition of a menu item to transfer KVM control.

It is assumed that communication between VirtualKVM processes occurs strictly through the Thunderbolt connection (or lack thereof).

Changes to existing behavior

The "Auto Toggle Bluetooth" and "Auto Toggle Display" options of VirtualKVM v1.1.0 effectively allow a user to toggle the Bluetooth keyboard/mouse independently of the display. It does not make much sense to me for a wired connection to only toggle a wireless protocol and do nothing else. The below proposal removes this functionality.

Definitions

The abbreviations "TDM", "hBT", "cBT", and "cTB" stand for "Target Display Mode", "host Bluetooth", "client Bluetooth", and "client Thunderbolt", respectively. The prefixes "-" and "+" used with one of these abbreviations denote actions/events depending on the context. For example, "+TDM" means both "host enters TDM via key code 144" and "client observes TDM being entered via 'system_profiler SPDisplaysDataType'". Note that not all actions can be observed on the other end.

Proposal

The VirtualKVM menu on the host computer will have these items:

  • Host Mode: ...
  • (checkbox) Auto Toggle Display
  • (greyed-out if above checked, or unconnected) Toggle Display
  • (checkbox) Bluetooth follows Display (or something to this effect)

The menu on the client computer will have:

  • Client Mode: ...
  • (greyed-out if unconnected) Toggle Display
  • (checkbox) Bluetooth follows Display (or something to this effect)

Notes:

  1. If "Bluetooth follows Display" is checked on only one machine, the behavior is undefined.
  2. I don't know of a simple way to grey-out "Toggle Display" on the client if "Auto Toggle Display" is enabled on the host. In this case, selecting "Toggle Display" will have no lasting side effects, but is expected to toggle things back and forth. Users with "Auto Toggle Display" will not interact with the menus very often, so I don't consider this to be a serious issue.

When "Bluetooth follows Display" is enabled, both host and client watch for -TDM and +TDM events and react accordingly. This means that manually toggling the display via Command-F2 (as opposed to the VirtualKVM UI) will transfer control of the KVM to the client.

When "Auto Toggle Display" is enabled, the host will +TDM if a +cTB is observed. (-TDM always happens upon -cTB.)

When "Toggle Display" is selected on the host, these actions/events occur:
Host: +TDM
Client: nothing

When "Toggle Display" is selected on the client, these events occur:
Client: -cTB, wait 2x polling interval, +cTB
Host: -TDM (the OS should do this automatically in reaction to -cTB)

Thunderbolt can be enabled/disabled programmatically via some kernel extensions . I have not personally tried any of the cited tools.

Feature request: brightness turned up

Big thanks for VirtualKVM and the latest client update! Makes my work set-up so much cleaner, i love it.

The only thing I'm missing now is the client to set brightness to 100% on connection since the iMac i TDM-mode always starts off with brightness on 0%. What do you think?

Testing the 1.1.0 beta right now, will report on any problems.

Feature Request: start on boot w/o login

It seem to be possible to run commands on boot without logging in: use launchctl under root. However that doesn't seem to work with GUI apps.

Target display mode works after boot if disk is not encrypted so logging in is an annoying overhead.

Bluetooth issue on iMac

Lately, I don't remember if after 10.13.3 or 10.13.4 update I have sometimes bluetooth issues. The fact is that bluetooth doesn't turn off on iMact aftwer display switching; thus, keyboard and mouse remain attached to the iMac and are not syn with my Macbook Pro. Any idea about how to deal or debug this issue?

Keep bluetooth connection with keyboard?

Great extension -- I'm wondering if there is a flag that could be added to disable disconnecting from the bluetooth keyboard?

I'd like to get around the issue you mentioned by preserving a keyboard connection to the iMac, but still get the autoswitching. I'm using the Logitech K760 which allows me to pair with multiple devices, so I can preserve the connection to the TDM computer (thus preventing the issue you mentioned).

I'm no Obj-C croney unfortunately, but this looks like it should be easyish to do?

Using a device other than a MacBook

Hi there! I have an editing rig that runs both macOS and Windows (Hackintosh) with an Asus ThunderboltEX 3 add-on card which works great and is recognized by my 2011 27" iMac.

Unfortunately, the iMac won't go into Target Display Mode when I press Command + F2 even though I have a video signal feeding into it (The thunderbolt card has a displayport in which it then injects into the thunderbolt signal). Switching to Target Display Mode does work when I plug in my 2013 13" MacBook Pro.

It seems like the Mac is waiting for some kind of Apple Thunderbolt handshake to switch, and it's not getting it from the Hackintosh.

VirtualKVM won’t pick it up either. Would you happen to know how I could force the iMac into target display mode?

Crashes in OSX Sierra 10.12.6

It seems that perhaps the Objective-C API changed in OSX Sierra because the app crashes in KVMThunderboltObserver.m. In the method isThunderboltEnabled() the call to systemProfilerThunderboltInfo() returns an NSDictionary, not an NSArray. The following code corrects the problem...

- (BOOL)isThunderboltEnabled {
    
    NSDictionary *profilerResponse = [self systemProfilerThunderboltInfo];
    
    if (profilerResponse.count >= 1) {
        NSArray *items = profilerResponse[@"_items"];
        
        if (!items || items.count == 0) {
            return NO;
        }
        NSString *busName = items[0][@"_name"];
        
        if ([busName isEqualToString:@"thunderbolt_bus"]) {
            return YES;
        }
        return NO;
    }
    
    return NO;
}

After that the app seems to be working well. I'm having a slight issue with my new wireless keyboard with number pad though. It seems that two computers can't trade ownership of the keyboard because of a passkey mismatch. This requires me to turn off and turn on the keyboard again before pairing to the other computer. Not a showstopper, but let me know if anyone has any ideas.

Feature: client mode

First of all I'd like to thank you for this software. It perfectly solves my problem and I don't have to deal with Synergy or similar stuff. Good job!

So here's the feature request. Each time I disconnect MacBook from iMac, I've to manually disable bluetooth on MacBook, otherwise iMac can't find keyboard and mouse. The idea of the feature is to avoid it. So if the app is installed on MacBook and client mode is enabled, bluetooth will be automatically switched off when Thunderbolt cable became disconnected or Target Display Mode disabled. If it's possible to know current TDM state, it'll probably fix #2.

What do you think?

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.