From f3daaf17455209dd602f80d57d914dfb4fc0a8dc Mon Sep 17 00:00:00 2001 From: capecodnative Date: Wed, 1 Sep 2021 22:27:30 -0400 Subject: [PATCH 1/2] Added "Sync Sleep Status" option Added a "Sync Sleep Status" option (and code, pref pane option, status menu option). When off [the default], prevents the controlled machines from sleeping when controller sleeps. Based on the Sync Lock Status option/code. --- Base.lproj/teleportPref.xib | 11 +++++++++++ TPMainController.m | 2 +- TPPreferencesManager.h | 1 + TPPreferencesManager.m | 1 + TPServerController.m | 2 ++ TPStatusItemController.m | 6 ++++++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Base.lproj/teleportPref.xib b/Base.lproj/teleportPref.xib index 4aa828f..0c454f5 100644 --- a/Base.lproj/teleportPref.xib +++ b/Base.lproj/teleportPref.xib @@ -297,6 +297,17 @@ + diff --git a/TPMainController.m b/TPMainController.m index a7ca62f..ccdf385 100644 --- a/TPMainController.m +++ b/TPMainController.m @@ -217,7 +217,7 @@ - (void)screensDidSleep:(NSNotification*)notification [self _invalidateTimer]; TPClientController * clientController = [TPClientController defaultController]; TPMessage *message = [TPMessage messageWithType:TPControlSleepType]; - if ([clientController currentConnection] != nil) { + if ([clientController currentConnection] != nil && [[TPPreferencesManager sharedPreferencesManager] boolForPref:SYNC_SLEEP_STATUS]) { [[clientController currentConnection] sendMessage:message]; } } diff --git a/TPPreferencesManager.h b/TPPreferencesManager.h index 6e4810f..76756f5 100644 --- a/TPPreferencesManager.h +++ b/TPPreferencesManager.h @@ -12,6 +12,7 @@ #define PREFS_VERSION @"prefsVersion" #define SHARE_PASTEBOARD @"sharePasteboard" #define SYNC_LOCK_STATUS @"syncLockStatus" +#define SYNC_SLEEP_STATUS @"syncSleepStatus" #define ALLOW_CONTROL @"allowControl" #define REQUIRE_KEY @"requireKey" #define DELAYED_SWITCH @"delayedSwitch" diff --git a/TPPreferencesManager.m b/TPPreferencesManager.m index bed72a0..bce609a 100644 --- a/TPPreferencesManager.m +++ b/TPPreferencesManager.m @@ -126,6 +126,7 @@ - (NSUserDefaultsController*)_defaultsController [_userDefaultsController setInitialValues:@{SHARE_PASTEBOARD: @YES, SYNC_LOCK_STATUS: @NO, + SYNC_SLEEP_STATUS: @NO, ALLOW_CONTROL: @NO, REQUIRE_KEY: @NO, DELAYED_SWITCH: @NO, diff --git a/TPServerController.m b/TPServerController.m index 578666e..da42672 100644 --- a/TPServerController.m +++ b/TPServerController.m @@ -338,7 +338,9 @@ - (void)connection:(TPNetworkConnection*)connection receivedMessage:(TPMessage*) switch(type) { case TPControlSleepType: DebugLog(@"received sleep msg"); + if ([[TPPreferencesManager sharedPreferencesManager] boolForPref:SYNC_SLEEP_STATUS]) { [[TPLocalHost localHost] sleepScreen]; + } break; case TPControlWakeType: DebugLog(@"received wake msg"); diff --git a/TPStatusItemController.m b/TPStatusItemController.m index 558e4a5..dac38b2 100644 --- a/TPStatusItemController.m +++ b/TPStatusItemController.m @@ -81,6 +81,12 @@ - (void)setShowStatusItem:(BOOL)showStatusItem [syncLockStatusMenuItem setRepresentedObject:SYNC_LOCK_STATUS]; [syncLockStatusMenuItem bind:@"state" toObject:[TPPreferencesManager sharedPreferencesManager] withKeyPath:SYNC_LOCK_STATUS options:nil]; [menu addItem:syncLockStatusMenuItem]; + + NSMenuItem * syncSleepStatusMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Sync sleep status", nil) action:@selector(switchMenuItem:) keyEquivalent:@""]; + [syncSleepStatusMenuItem setTarget:self]; + [syncSleepStatusMenuItem setRepresentedObject:SYNC_SLEEP_STATUS]; + [syncSleepStatusMenuItem bind:@"state" toObject:[TPPreferencesManager sharedPreferencesManager] withKeyPath:SYNC_SLEEP_STATUS options:nil]; + [menu addItem:syncSleepStatusMenuItem]; [menu addItem:[NSMenuItem separatorItem]]; From 0e3c7e3109bbc033a271d4bb65144c3e8b110949 Mon Sep 17 00:00:00 2001 From: John Britton Date: Mon, 31 Jan 2022 21:12:43 -0500 Subject: [PATCH 2/2] bump version to `1.3.5` --- teleport.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/teleport.xcodeproj/project.pbxproj b/teleport.xcodeproj/project.pbxproj index 09ebfa6..e75b64c 100644 --- a/teleport.xcodeproj/project.pbxproj +++ b/teleport.xcodeproj/project.pbxproj @@ -1139,7 +1139,7 @@ CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 1.3.4; + CURRENT_PROJECT_VERSION = 1.3.5; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; EXCLUDED_ARCHS = ""; @@ -1167,7 +1167,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1.3.4; + CURRENT_PROJECT_VERSION = 1.3.5; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; EXCLUDED_ARCHS = ""; @@ -1280,7 +1280,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1.3.4; + CURRENT_PROJECT_VERSION = 1.3.5; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; EXCLUDED_ARCHS = "";