Comments (11)
When switching between windows and full screen apps, currently you need to retoggle on-screen Touch Bar. Is there anyway to make it stay in the same position all the time?
On Nov 7, 2016, at 5:09 PM, Robbert Klarenbeek [email protected] wrote:
Do you mean for the on-screen Touch Bar, or the USB iPad Touch Bar? What do you mean by fullscreen mode?
Currently, the Fn-toggled on-screen Touch Bar already works in fullscreen macOS apps, but perhaps this is not what you mean.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
from touchbardemoapp.
There is; I've got a very stripped down version of this tool that does that. I'll make the code happy and release it later. It also supports docking the window at the bottom of the screen instead of following your cursor around.
from touchbardemoapp.
Great, we're also working on something similar, but I'm interested to see what you've made @avaidyam.
from touchbardemoapp.
No problem, thanks for the good fixes! Just packaged a new release (v1.3) to get those fixes out there.
Now this issue can be closed!
from touchbardemoapp.
Do you mean for the on-screen Touch Bar, or the USB iPad Touch Bar? What do you mean by fullscreen mode?
Currently, the Fn-toggled on-screen Touch Bar already works in fullscreen macOS apps, but perhaps this is not what you mean.
from touchbardemoapp.
In [TouchBarWindow init...]
:
// For rounded edges:
self.styleMask = NSTitledWindowMask | NSFullSizeContentViewWindowMask;
self.titlebarAppearsTransparent = YES;
self.titleVisibility = NSWindowTitleHidden;
[self standardWindowButton:NSWindowCloseButton].hidden = YES;
[self standardWindowButton:NSWindowFullScreenButton].hidden = YES;
[self standardWindowButton:NSWindowZoomButton].hidden = YES;
[self standardWindowButton:NSWindowMiniaturizeButton].hidden = YES;
// For squared edges:
//self.styleMask = NSBorderlessWindowMask;
// Common:
self.movable = NO;
self.acceptsMouseMovedEvents = YES;
self.movableByWindowBackground = NO;
self.level = CGWindowLevelForKey(kCGAssistiveTechHighWindowLevelKey);
self.collectionBehavior = (NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorStationary | NSWindowCollectionBehaviorIgnoresCycle | NSWindowCollectionBehaviorFullScreenDisallowsTiling);
self.backgroundColor = [NSColor blackColor];
[self _setPreventsActivation:YES];
[self setFrame:NSMakeRect(0, 0, 1085 + 10, 30 + 10) display:YES];
self.contentView = [TouchBarView new];
from touchbardemoapp.
In AppDelegate
:
// FIXME: Currently has a shadow gap between the bottom edges.
- (NSPoint)screenCenterOrigin {
NSPoint mousePoint = [NSEvent mouseLocation];
NSScreen* currentScreen = [NSScreen mainScreen];
for(NSScreen* screen in [NSScreen screens]) {
if(NSPointInRect(mousePoint, screen.visibleFrame)) {
currentScreen = screen;
break;
}
}
NSRect screenFrame = currentScreen.visibleFrame;
CGFloat screenDiff = screenFrame.size.width - _touchBarWindow.frame.size.width;
return NSMakePoint(screenDiff / 2.0, 0.0);
}
- (NSPoint)mouseTouchOrigin {
NSPoint mousePoint = [NSEvent mouseLocation];
NSScreen* currentScreen = [NSScreen mainScreen];
for(NSScreen* screen in [NSScreen screens]) {
if(NSPointInRect(mousePoint, screen.visibleFrame)) {
currentScreen = screen;
break;
}
}
NSRect screenFrame = currentScreen.visibleFrame;
CGFloat screenRight = screenFrame.origin.x + screenFrame.size.width;
CGFloat barWidth = _touchBarWindow.frame.size.width;
CGFloat barHeight = _touchBarWindow.frame.size.height;
NSPoint origin = mousePoint;
origin.x -= barWidth * 0.5;
origin.y -= barHeight;
if(origin.x < screenFrame.origin.x)
origin.x = screenFrame.origin.x;
if(origin.x + barWidth > screenRight)
origin.x = screenRight - barWidth;
if(origin.y - barHeight < screenFrame.origin.y)
origin.y += barHeight;
return origin;
}
Then, where you were doing the setFrameOrigin:
before,
NSUserDefaultsController *d2 = [NSUserDefaultsController sharedUserDefaultsController];
BOOL origin = [[d2 valueForKeyPath:@"values.FollowMouse"] boolValue];
[_touchBarWindow setFrameOrigin:origin ? self.mouseTouchOrigin : self.screenCenterOrigin];
from touchbardemoapp.
@robbertkl @AndreasVerhoeven That covers the majority of the changes I'd made. I ended up gutting out the iOS portion on a whim. The changes above allow the bar to both follow the mouse cursor and stay docked to the bottom of the screen, and stay on top of every window (except the login window).
from touchbardemoapp.
I think this issue is fixed with the recent commit 😉
from touchbardemoapp.
Thanks @avaidyam for the changes. I took the rounded edges and other window fixes (level, collectionBehavior, etc). It will be included in the next release.
I did not yet take the "stick to bottom" code, as we're planning something a bit different (though similar).
Next time, just send us a PR (for each change/feature separately), so we can apply it more easily and your name/commit gets into the history.
from touchbardemoapp.
@robbertkl My bad about not PR'ing it. Put simply, I mangled your codebase beyond belief for personal profit and decided I should give back the good fixes and keep the terrible sins to myself.
from touchbardemoapp.
Related Issues (20)
- SUGGESTION: Trackpad Support HOT 1
- swiping HOT 2
- iOS App crashes on iPad 2 (9.3.5) HOT 1
- Doesn't work on High Sierra HOT 2
- (enhancement) Option to drag the TouchBar around HOT 1
- Client: "Address already in use” error
- Keyboard works - touchbar does not HOT 5
- Broken on 16inch MacBook Pro
- Freezes
- Touchbar via Raspberry HOT 1
- New Mac support needed ! HOT 1
- Touch Bar Server "crashes" touchbar HOT 3
- [Suggestion] Allow physical function keys to control on screen touch bar HOT 1
- ios app link HOT 1
- Does not show up on 10.2.2 (16C67) HOT 2
- Does not show up on 10.12.3 (16D32) HOT 12
- Every key EXCEPT fn works. Uninstall? HOT 5
- Latest version still stops working after some time
- [suggestion] HOT 1
- [Suggestion] Adaptive iPhone small screen & Add touchpad mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from touchbardemoapp.