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

Command-Line option: Start new program minimized #20

Open
patricknelson opened this issue Jan 17, 2019 · 13 comments
Open

Command-Line option: Start new program minimized #20

patricknelson opened this issue Jan 17, 2019 · 13 comments

Comments

@patricknelson
Copy link

NOTE: I've copied/modified this request from the Sourceforge feature request here: https://sourceforge.net/p/rbtray/feature-requests/11/


It would be nice, if one could also use RBTray to start a new program minimized.

For example:

"C:\RBTray.exe Notepad.exe"

Would start Notepad.exe minimized in the system tray. I would use this, to start some programs service-like but still accessible in the system tray.

@benbuck
Copy link
Owner

benbuck commented Jan 30, 2019

Hi @patricknelson,

I can see how this would be useful, but so far I haven't been able to think of a good way to implement it due to limitations in the APIs that Windows provides.

-Benbuck

@benbuck
Copy link
Owner

benbuck commented Feb 4, 2019

Hi @patricknelson,

I was just researching this a little, and found that there is at least one utility that can do it called Actual Window Minimizer (https://www.actualtools.com/windowminimizer/). So for sure it's possible, but seeing how they did it, the UI and settings required may be more than I care to add to RBTray, but I'll think about it.

Also, it looks like you may be able to cobble something together with AutoHotKey if you care to invest the time and effort: https://www.autohotkey.com/boards/viewtopic.php?t=4373.

-Benbuck

@pstein
Copy link

pstein commented Sep 27, 2020

Just want to say that I would appreciate this feature too

@parkstraat9
Copy link

This would be a great feature.

@tuaone
Copy link

tuaone commented Jan 2, 2022

Just want to say that I would appreciate this feature too

@james28909
Copy link

i think the reason it cannot be implemented easily is because you have to fake clicks which requires you to get the client screen size, then get the window size... and then calculate where the minimize button is mathematically, and then fake a right click event. ive done this and scheduled a task for when the executable is run, it will automatically run my script which does the calculation and fake mouse right click.

if anyone is interested in the script just let me know. im sure i could add a arg to be able to input the window to be systrayed. if anyone is interested let me know

@garoto
Copy link

garoto commented Feb 21, 2022

i think the reason it cannot be implemented easily is because you have to fake clicks [...]

Programming APIs don't need to fake mouse clicks. You invoke a function exposed by a OS provided library which is responsible for GUI manipulation and whatnot.

@james28909
Copy link

Programming APIs don't need to fake mouse clicks. You invoke a function exposed by a OS provided library which is responsible for GUI manipulation and whatnot.

what function is exposed when you right click the minimize button? is there an open source lib that already has this implemented that someone can study?

@garoto
Copy link

garoto commented Feb 21, 2022

Plenty of open-source Windows programs offer the option of being started minimized in the systray. From the top of my head: ditto-cp, hexchat, AltSnap.

Either browse their code or ask the authors directly.

@james28909
Copy link

james28909 commented Feb 21, 2022

ive acheived this task with AutoHotKey script Min2Tray which was released here on the autohotkey forums.

in order to add windows to the "StartUpMinimized" list, you have to minimize them to tray via min2tray script or compiled executable, then right click the minimized windows tray icon and go to "preferences" and select "Windows is on the StartUpMinimized list. i also selected "Minimize window immediately (skip the task bar)" as well. also, im on the latest win 11 and it seems to be functioning flawlessly for me. have enabled the option to minimize to tray when right clicking the close button too.

works very good for such an old piece of software

@Mansarde
Copy link

Mansarde commented Feb 9, 2023

Why is it closed?

What do you mean? This issue is open.

@patricknelson
Copy link
Author

I see the confusion. Looks like #68 was closed, not this one 😄

@JamesHoi
Copy link

JamesHoi commented Feb 15, 2024

It seems min2tray that james28909 mention not work for me. I have done a simple script for this issue. However, I dont think this is a elegant implementation because you can see the program start minimize in taskbar and minimize to tray quickly.
https://gist.github.com/JamesHoi/3d884caaeaa3626ae0ee3d8367c8ae75

By the way, I use SW_MINIMIZE for starting new program without display so the function in RestoreWindowFromTray should be changed to SW_SHOWNORMAL. I have also tried using the flag SW_HIDE, but somehow it cannot be restored window by rbtray.

ShowWindow(hwnd, SW_SHOW);

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

No branches or pull requests

9 participants