bottlesdevs / Bottles

Run Windows software and games on Linux
https://usebottles.com
GNU General Public License v3.0
6.21k stars 258 forks source link

[Request] Pre-run scripts #2274

Open senolfeldmann opened 1 year ago

senolfeldmann commented 1 year ago
    This feature ended as a "before run" script.

Originally posted by @mirkobrombin in https://github.com/bottlesdevs/Bottles/issues/948#issuecomment-1100654153

I cannot find this function in the current version. Pre-run scripts would be great to have. How I would use this feature: Currently, I have several retro games which benefit from having the desktop resolution switched to 640x480 while using nvidia gpu scaling via metamodes. I have a command for this, and also a command for switching back to my desired resolution after playing. I currently launch these games via shell-scripts which switch to the gaming resolution, launch the game via bottles-cli. Switching back can be done via the post-run script function of bottles. If there was a pre-run script function, I could reference one script for switching to my nvidia metamode for all games which need the same resolution. Also, launching the games from desktop shortcuts or from steam (xdg-open) would be more seamless.

mirkobrombin commented 1 year ago

In the program context menu -> Launch options

image

duarm commented 1 year ago

This request was about a "Pre" run, not a "Post" run, found myself in need of the same feature.

lunalucadou commented 1 year ago

I am trying to mount an ISO prior to launch and I cannot get it to work using the command arguments field. gnome-disk-image-mounter ../disk.iso && %command% hangs (no terminal output) and gnome-disk-image-mounter ../disk.iso; %command% launches the application without mounting the ISO (causing the application to error).

We need a dedicated pre-launch script field.

Pointing to command arguments isn't a good argument against a dedicated field since you should be able to do what the post-run script field does with %command% && post-launch-cmd, yet we still have a dedicated field for it.

cybin commented 5 months ago

I need that too, so I started working on that. Now I'm at the point where my post-/pre-run script is being executed. Some tests are still required, but I'm convinced to provide a PR for it somewhen at the weekend.

Anyway, it's quite confusing with all the execution paths in Bottles, so it certainly is not finished yet. These changes will need to be reviewed and someone may point me into the right direction to get it finished.

But since you are waiting for this that long, I thought it might be some good news to you.