Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

Comments on Show icon in menu bar while a shell script is running?

Post

Show icon in menu bar while a shell script is running?

+1
−0

When running a finder quick action, a cute little cog wheel is shown in the menu bar while the task is still running:

Icon depicting a cog wheel

Is there a way to make a similar icon appear in the menu bar while a shell script is running in terminal?

For example with the following shell script test.sh

sleep 10

Is there a way to make a wrapper or something, which would trigger a menu bar icon?

History

1 comment thread

Make a tray icon (1 comment)
Make a tray icon
matthewsnyder‭ wrote 12 months ago · edited 12 months ago

You could probably accomplish this by creating a program that does nothing except display a tray icon until it exits.

There are many programs on OS X that display tray icons, so you can probably use their example (I don't know exactly how to do it). Seems like one way could be a Python program that uses https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QSystemTrayIcon.html

Then you have at least 2 options:

  1. Start the tray icon program in the beginning of the script, and kill it at the end (you'd probably have to hold on to the PID or something like that)
  2. Make the tray icon program take an argument, create the tray icon, then run the command in the argument using something like Python subprocess - when the subprocess exits, the tray should disappear as well

Don't have time to develop and test a full solution, unfortunately.