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

*nix specific usage questions
kessz
New Cone
New Cone
Posts: 6
Joined: 08 Dec 2022 08:54

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

Postby kessz » 09 Dec 2022 12:23

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?

kessz
New Cone
New Cone
Posts: 6
Joined: 08 Dec 2022 08:54

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

Postby kessz » 09 Dec 2022 12:29

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

kessz
New Cone
New Cone
Posts: 6
Joined: 08 Dec 2022 08:54

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

Postby kessz » 10 Dec 2022 18:08

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.
Last edited by kessz on 10 Dec 2022 19:10, edited 2 times in total.

Rémi Denis-Courmont
Developer
Developer
Posts: 15311
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 10 Dec 2022 18:12

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
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

kessz
New Cone
New Cone
Posts: 6
Joined: 08 Dec 2022 08:54

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

Postby kessz » 10 Dec 2022 19:14

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


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 29 guests