Page 1 of 1

how to toggle full screen from the command line when vlc is already running

Posted: 09 Dec 2022 12:23
by kessz
I am running the latest version of the following packages
- arch linux 6.0.10-arch2-1 #1
- bash 5.1.16(1)-release
- VLC media player 3.0.17.4 Vetinari (revision 3.0.13-8-g41878ff4f2)

How do I toggle full screen from the command line when vlc already running?

One idea is to use playerctl as follows, but apparentley is has no full-screen command?

Code: Select all

playerctl --player=vlc full-screen
Another is to is to use something like this

Code: Select all

dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set string:org.mpris.MediaPlayer2.Player string:Volume variant:double:1.0
... ??? although that is obviously for doing something with the volume

as described here https://unix.stackexchange.com/question ... with-qdbus

But how that works is not obvious to me either and I don't know the structure of how dbus works and the pay off for learning this for one command seems hardly worth it.

Anyone know if dbus will support full screen toggle?

Re: how to toggle full screen from the command line when vlc is already running

Posted: 09 Dec 2022 12:29
by kessz
does not look like the dbus-send will support full screen toggle, if available commands listed here are correct
https://specifications.freedesktop.org/ ... rface.html

SOLUTION: how to toggle full screen from the command line when vlc is already running

Posted: 10 Dec 2022 18:08
by kessz
Don't know why I did not think of these solutions earlier.

Two solutions available. I prefer the first

Code: Select all

# use xdtool to send an f for fullscreen to the application using the application ID xdotool windowactivate --sync "$(xdotool search --class VLC | head -1)" key f

Code: Select all

# use the built-in function on wmctrl to toggle fullscreen # the below code is used in a keybinding to bring the open minimised VLC media player to focus and make it full screen bash -c ' wmctrl -R "VLC media player"; sleep 0.25; wmctrl -i -a $(wmctrl -l | grep VLC | grep -oE "^[0-9a-zA-Z]{1,10}" | head -n 1) -b toggle,fullscreen '
The first one is better for my purpose.

If you are on windows or apple I have no idea if these utilities area available to you or how you would solve this problem.

Re: how to toggle full screen from the command line when vlc is already running

Posted: 10 Dec 2022 18:12
by RĂ©mi Denis-Courmont
wmctrl is way more advisable than injecting keys which may have different effect depending on context.

With that said, most programmatic scenarii would just set fullscreen before starting not after

Re: how to toggle full screen from the command line when vlc is already running

Posted: 10 Dec 2022 19:14
by kessz
My purpose is to use a keybinding to bring the open minimised VLC media player to focus and make it full screen.

This is repeated often and will be used very many times across hours of numerous videos, hence the need for the keybinding.

Turns out that the small script for wmctrl I have above works out best.

What it does is as follows
- it brings the media player to focus,
- then small time gap just to make sure nothing messes up,
- then toggles to full screen

That's it