(SOLVED) autolaunch steam minimized to panel tray LM 20 cinnamon- using Python script

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
motoryzen
Level 4
Level 4
Posts: 242
Joined: Sun Dec 08, 2019 12:25 am

(SOLVED) autolaunch steam minimized to panel tray LM 20 cinnamon- using Python script

Post by motoryzen »

*** SOLVED*** UPDATE = a good hour or so later *** = solved the problem with using python script

1. Found this https://www.youtube.com/watch?v=0cWkV-UOpXs. but did not download the pypthon 1.1 download per this person's link...

I downloaded the older one on that git site https://files8.blogspot.com/2019/04/lin ... ipt-1.html aka the bottom one

2. Then following the video's directions, I pasted the process name of Steam which is just simply Steam ( as it is labeled in gnome-system-monitor) per the video's instructions ( of course in the video this person uses auto-key for the example instead Steam. but it worked all the same)

3. After saving the newly created document as "Steam Python script.py" without quotes, I made it executable, then ran it via gnome-terminal command without quotes as " python '/home/userpcname/Desktop/Steam Python script.py' " since it saved it on my desktop for testing.

4. To confirm it works, I ran steam from within a cinnamon menu start/search within 5 seconds of running that python script command, and it worked within 3/4ths of a second..it auto minimized it.

Finally, I added that exact terminal command listed in number 3 as an auto start custom command and made it delay launching for 6 seconds after steam autolaunches and it works perfectly!! :D GIGGIDEE GIGGIDEE!! It's odd you have to make the python script launch AFTER steam launches when setting it up as an auto launch and auto minimized - deal.... instead of having to run the python script 1st and THEN launching steam ( if doing it manually) for it to auto minimize steam. ( shrugs shoulders)



Mission: I want steam to auto launch minimized.

Why? I have all the shortcuts of all of my games in a single folder within Nemo; thus a single place to select which game I want to run at any time. All I care about involving steam is that is already running when I start up my LM 20 cinnamon PC so that whichever games depend on Steam running will be ready to launch when I double left click to run each one.

I've looked everywhere online trying to find an updated method on how to launch Steam to where it autominimizes to the LM 20 cinnamon panel tray area, but nothing seems to work OR it could be I'm misunderstanding something to do those instructions successfully.

I've tried the following:
1. Editing the command in Start Up applications which in my case is sh -c 'STEAM_FRAME_FORCE_CLOSE=1 steam' %U
Tried adding without quotes "-silent" after =1, after steam but before the apostrophe, after apostrophe but before %U, and after %U, both without a single space and then -silent AND with a single space then -silent. No changes or it wouldn't launch..period.

2. Tried just launching steam manually in terminal without quotes using "steam -silent" and it just simply works, but shows the Steam window as it normally should, but again I want it to auto minimize.

I'm not necessarily against trying to create a terminal bash script to run as a replacement for how steam currently autolaunches in my PC, but it seems extremely in depth and alittle over my head. But I'm willing to give it a reasonable shot if someone can walk me through it.

The solution type almost doesn't matter to me ( save for manually launching steam and of course having to manually do keyboard shortcuts to minimize it or move my mouse to leftclick on the minimize button on the Steam window obviously). I don't think " we need your inxi results/info " applies here, but if I'm wrong, cool. Let me know :D
Welcome
Level 5
Level 5
Posts: 580
Joined: Wed Aug 19, 2020 11:38 am

Re: (SOLVED) autolaunch steam minimized to panel tray LM 20 cinnamon- using Python script

Post by Welcome »

Thank you for posting the answer to your original question!

By the way, I looked at both the older and newer version of the script. Both use xdotool to minimize window(s). The first version uses the class name that you enter (e.g. Steam). The reason you have to run this script after Steam starts is because it needs to know the X window identifier of the Steam window in order to minimize that window.

I ran a quick command test in a terminal for a windowed program named ghex. This command returns the X window identifier (note: this is NOT the pid):

Code: Select all

echo $(xdotool search --onlyvisible --class 'ghex')
85983235
I then ran this command and observed that the ghex window was minimized:

Code: Select all

xdotool windowminimize $(xdotool search --onlyvisible --class 'ghex')
This last command is the key command that does the work.

I think you could just use one command in your Startup Applications to do this. If you have any problems with the python script, you might want to try a simple shell command like this instead:

Code: Select all

xdotool windowminimize $(xdotool search --all --sync --onlyvisible --class 'ghex')
Replace 'ghex' with the appropriate class name, of course. This has the advantage that it'll wait until the class name becomes available. From 'man xdotool':
--sync
Block until there are results. This is useful when you are
launching an application and want to wait until the application
window is visible. For example:

google-chrome &
xdotool search --sync --onlyvisible --class "google-chrome"
Post Reply

Return to “Newbie Questions”