How to setup VLC with gtk file dialog?

VLC media player has been using Qt interface for quite long time. VLC however, has an option to override window style, which will also change the file dialog as well.

In VLC media player, do the following steps:

  1. Go to Tools > Preferences (or press Ctrl+P)

  2. In the first tab, under Interface Settings - Look and feel, look for "Force window style:" with the drop-down menu and change selection from System's default to GTK+

  3. Finally, click Save to apply the changes.

Then, go to Media > Open File... (or press Ctrl+O) to confirm that the file dialog has been applied with GTK+ window style. That's all.

Tested with VLC 2.2.1 in Debian 8 Xfce (Xfce 4.10).

Force style for Qt5 in Debian/Ubuntu

Previously, for Debian 9 (testing) and Ubuntu 16.04 (xenial) and older, user had to additionally install libqt5libqgtk2 package from the repository. For newer releases, that is now provided by qt5-gtk-platformtheme or qt5-gtk2-platformtheme and either one will be installed automatically by recommends.

  • Debian Testing (stretch) -- needed libqt5libqgtk2
  • Debian Old Stable (stretch) and newer
  • Ubuntu 15.10 (wily) until 16.04 (xenial) -- needed libqt5libqgtk2
  • Ubuntu 18.04 (bionic) and newer

Tested with VLC 2.2.2 in Xubuntu 16.04 (Xfce 4.12). I did not test in Debian, but reportedly works according to this post on Ask Ubuntu. Later, I had observed that qt5-gtk-platformtheme package was installed by default for VLC 3.0.9 in Xubuntu 20.04.

Force style for Qt5 in other distributions

The package above is not available in repositories of other distributions, including openSUSE, according to this search result from software.opensuse.org. As an alternative, this Arch Wiki noted that QT_STYLE_OVERRIDE environment variable will force specific style to Qt applications.

Therefore, the line QT_STYLE_OVERRIDE=gtk2 or QT_STYLE_OVERRIDE=GTK+ may be added in one of the following locations:

  • ~/.profile (reportedly works in Linux Mint, suggested in this post on Unix.SE)

  • ~/.bashrc (suggested in this post on Ask Ubuntu)

  • ~/.xsession or ~/.xinitrc (suggested in this post on FreeBSD forum)

  • ~/.xsessionrc (suggested for OpenBox in this post on CrunchBang Linux forum)

Without installing the Qt5 package, I have tried export the line to each of above configuration files one at a time, except for the last one. However, none of these worked for VLC in Xubuntu 16.04.

At the moment, I can't verify whether the environment variable actually works or not.


I would like to amend the accepted answer on how to get Qt to use the GTK+ theme (VLC now (2018) uses Qt5, so go by the second item).

  • Qt4 can use the current GTK2 theme. To activate this, simply choose GTK+ as the style for Qt4 in its configuration file ~/.config/Trolltech.conf (or using any graphical tool for configuring Qt4):

    [Qt]
    style=GTK+
    
  • Qt5 had support for GTK+ theming moved from the main package to a separate one. On ArchLinux, it is called qt5-styleplugins. Moreover, selecting the theme apparently goes by setting an environment variable, either QT_STYLE_OVERRIDE or QT_QAP_PLATFORMTHEME (both work for me), to gtk2 (notice this is gtk2, not GTK+). Adding this setting to any of the script files listed by the accepted answer will do the trick. I would personally argue in favor of ~/.xinitrc or similar, as this is related to the graphical environment.

    To sum up: on ArchLinux, install the package qt5-styleplugins, then launch your Qt5 application (VLC here) with QT_STYLE_OVERRIDE=gtk2 set in the environment.

Links: Arch Wiki on “Qt”, Arch Wiki on “Uniform look for Qt and GTK applications”.

Tags:

Gtk

Qt

Vlc