Posted: . At: 10:43 AM. This was 1 year ago. Post ID: 17642
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to open mpv in a certain place on your monitor in Linux.


Opening the MPV video player in a certain place on your desktop is very easy with the right command line parameters. This will set the window size and the location on the screen.

The example below starts MPV at a window size of 720×576 and is located at 960×2103 pixels.

┌──(john㉿DESKTOP-PF01IEE)-[~]
└─$ mpv https://i.mjh.nz/channel-9-nsw.m3u8 --geometry=720x576+960+2103

This is from the right side of the screen to the left.

This example below on a 3440×1440 resolution monitor moves the window further to the left.

┌──(john㉿DESKTOP-PF01IEE)-[~]
└─$ mpv https://i.mjh.nz/channel-9-nsw.m3u8 --geometry=720x576+960+960

It would not be too hard to calculate the position of the window on the screen with a script. If you wished to open multiple windows in a video wall.

The best way to get the geometry and coordinates of a window is to open it and in another terminal run xwininfo and click the window. This will print information about the window. This may not work with Wayland, but not much does.

┌──(john㉿DESKTOP-PF01IEE)-[~]
└─$ xwininfo 
 
xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.
 
xwininfo: Window id: 0xe0000c "john@DESKTOP-PF01IEE: ~"
 
  Absolute upper-left X:  134
  Absolute upper-left Y:  115
  Relative upper-left X:  38
  Relative upper-left Y:  59
  Width: 759
  Height: 587
  Depth: 24
  Visual: 0x23
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x22 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +134+115  -2547+115  -2547-738  +134-738
  -geometry 125x44+96+56

The geometry is -geometry 125×44+96+56 so we can use this in the aforementioned examples above to see the size and location of a window on Linux.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.