Thursday, May 16, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 4659  / 2 Years ago, wed, september 7, 2022, 11:13:35

I asked a related, but more specific, question here. I want to know if there is a way to specify where you want a program to launch. I basically want to write a shell script which is launched every time I log in, like so



google-chrome www.gmail.com    -workspace=1 -monitor=1
google-chrome www.facebook.com -workspace=1 -monitor=2
google-chrome www.youtube.com -workspace=1 -monitor=3

gedit a.txt b.txt c.txt -workspace=2 -monitor=1
gedit d.txt e.txt f.txt -workspace=2 -monitor=2
gedit g.txt h.txt i.txt -workspace=2 -monitor=3

mplayer Terminator1.mkv -workspace=3 -monitor=1
mplayer Terminator2.mkv -workspace=3 -monitor=2
mplayer Terminator3.mkv -workspace=3 -monitor=3


there is a program called wmctrl but it fails in so many ways that I don't even know where to begin. In principle it is simple, specify the window, and move it. But specifying windows is not easy, two browsers are both named the same "Google Chrome". One can use their unique window IDs, but getting this information is not trivial (AFAIK, this is not returned upon execution). Then there is an :ACTIVE: option which is the most recently launched program, but there is no guarantee that the window is launched when control is returned to the command line. To make matters worse, one must specify global coordinates, as opposed to optional coordinates within a workspace/monitor.






Here is the approach I am currently taking. I have uploaded some scripts to GitHub (see here or here) which use wmctrl to move windows around.


More From » command-line

 Answers
4

You can determine which display to launch a program by using the following:



$ DISPLAY=":0.1" program_name


Some programs allow you to set their default display in a config file. mplayer is one of these programs. Append the following to ~/.mplayer/config




display=":0.1"




Your first display is 0.0. Your second display is 0.1. Your third display is 0.2.


[#42852] Thursday, September 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
diket

Total Points: 167
Total Questions: 124
Total Answers: 109

Location: Somalia
Member since Wed, Mar 15, 2023
1 Year ago
diket questions
Fri, Dec 24, 21, 22:31, 2 Years ago
Fri, Mar 31, 23, 02:30, 1 Year ago
Mon, Jan 23, 23, 05:58, 1 Year ago
Tue, Nov 1, 22, 02:02, 2 Years ago
;