Let me preface this by saying I know very little about programming or scripting and have limited experience with the Linux command line.
Now that that’s done… I have a program that I run through Wine that doesn’t use very much keyboard or mouse input. Consequently, my screensaver likes to kick on in the middle of using the program, which is annoying. I don’t want to have to disable the screensaver just to run this one program. I came across something via Google about using dbus to inhibit the screensaver. I can do this:
qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.Inhibit "$$" "Wine"
to inhibit the screensaver. This outputs a number, different every time. To cancel the inhibiting of the screensaver, I have to run a different command and pass that number as an argument, e.g.:
qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.UnInhibit 5822
I’d like to create an alias to run in a terminal so that I can inhibit the screensaver, run my program through Wine, and uninhibit the screensaver when I close Wine, all with one command. But since the cookie from the inhibit command changes every time its run, I don’t know how to pass that number to the uninhibit command. There must be a way to do it with pipes or redirection, right?
I hope you understand what I’m getting at, and any ideas are appreciated. Thanks.