Git Product home page Git Product logo

Comments (11)

hankisthatyou avatar hankisthatyou commented on September 2, 2024 2

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.

avaidyam avatar avaidyam commented on September 2, 2024 2

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.

robbertkl avatar robbertkl commented on September 2, 2024 1

Great, we're also working on something similar, but I'm interested to see what you've made @avaidyam.

from touchbardemoapp.

robbertkl avatar robbertkl commented on September 2, 2024 1

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.

robbertkl avatar robbertkl commented on September 2, 2024

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.

avaidyam avatar avaidyam commented on September 2, 2024

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.

avaidyam avatar avaidyam commented on September 2, 2024

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.

avaidyam avatar avaidyam commented on September 2, 2024

@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.

avaidyam avatar avaidyam commented on September 2, 2024

I think this issue is fixed with the recent commit 😉

from touchbardemoapp.

robbertkl avatar robbertkl commented on September 2, 2024

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.

avaidyam avatar avaidyam commented on September 2, 2024

@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)

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.