Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rumps App gets hidden if title is too long #198

Open
vladoski opened this issue Jan 26, 2023 · 2 comments
Open

rumps App gets hidden if title is too long #198

vladoski opened this issue Jan 26, 2023 · 2 comments

Comments

@vladoski
Copy link

I'm trying to use rumps to make a simple RSS feed title viewer in my macOS status bar, displaying the RSS article title on the status bar app title.
Sometimes, the title is too big for my status bar and the app won't be visible anymore. I've tried to tinker with rumps to see if there's a way to know beforehand how much free space there is on the status bar but I couldn't come up with a solution.

Is there a way to do it? I'd be happy even if I'd have to make a big mess with Foundation/AppKit wrappers.

@SKaplanOfficial
Copy link
Contributor

I don't think you can detect how much space is available, unfortunately, but you could detect whether the menu bar item is visible and then adjust the title accordingly. Since hiding is different from forced removal, you have to check the item's window visibility. To do that, you can use a private API to check the window occlusion state:

app._nsapp.nsstatusitem._window().occlusionState()

This will return 8194 if the item is displayed and 8192 if it's not. If it's not displayed, you can update the title to something shorter.

@stefanbuchauer
Copy link

how about adding a feature to scroll the title text back and forth automatically? i try do implement this actually in my script, but somehow the text is moved one line up...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants