tomexx
Posts: 122
Joined: Thu Nov 01, 2012 4:58 pm
Location: Kitchener, ON, Canada, Earth
Contact: Website

Display lxterminal at specific screen location

Wed Oct 16, 2019 4:23 pm

Hi,
I'm using a desktop shortcut that opens mplayer in a lxterminal like this:

Code: Select all

[Desktop Entry]
Type=Application
Name=Webcam
Comment=
Exec=lxterminal -e mplayer tv:// -tv driver=v4l2:width=640:device=/dev/video0:fps=20:outfmt=yuy2 –geometry 50:50 -xy 960
Terminal=false
Hidden=false
The terminal starts and opens mplayer which shows my camera feed. Problem is the lxterminal opens randomly in different parts of the screen and interferes with my video feed.

Can I supply a parameter to lxterminal in the above desktop shortcut that will keep the lxterminal in a specific location of the screen so I can cover it with the mplayer window?

Thanks,
Tom

bjtheone
Posts: 381
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Display lxterminal at specific screen location

Wed Oct 16, 2019 7:03 pm

Most terminals can be launched using the geometry switch allowing you to specify terminal's size and position (COLUMNSxROWS+X+Y) e.g.:

Code: Select all

gnome-terminal --geometry 73x31+100+300
or

Code: Select all

xterm -geometry 93x31+100+350
The "X" man page (http://www.x.org/archive/X11R6.8.1/doc/X.7.html#sect6) says

most X programs accept a command line argument of the form -geometry WIDTHxHEIGHT+XOFF+YOFF

The WIDTH and HEIGHT parts of the geometry specification are usually measured in either pixels or characters, depending on the application. The XOFF and YOFF parts are measured in pixels and are used to specify the distance of the window from the left or right and top and bottom edges of the screen, respectively.

However, I took a quick look at lxterminal's man page and am not convinced it has these options. I don't run LXDE so am not super familiar with it. You should be able to install a terminal program that does support location placement.

MarkDH102
Posts: 357
Joined: Fri Feb 13, 2015 3:18 pm

Re: Display lxterminal at specific screen location

Thu Oct 17, 2019 6:19 am

I use xdotool.
You will have to install it.
However, I run it from within a python script that runs in the terminal window and call it using :

Code: Select all

import os
os.system("xdotool getactivewindow windowmove 40 35 windowsize --usehints 165 43")
I guess you can call it from the shortcut but I don't know how to get the appropriate active window.

Return to “General discussion”