Is it possible to hide a single panel in XFCE?

I have two panels after installing XFCE desktop. One is dock and the second one is the bar at the top of the screen. I’d like to remove the dock but rather than removing it I’d prefer hiding it. Is there a configuration file I could change it in?

Asked By: Konrad

||

You can get the xfce panel configuration inside /home/user/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml

Answered By: Thushi

Option 1: Set the panel to autohide

Xfce supports Panel autohiding. I didn’t find out since when but the feature appears to be present at least since 2010 which is as far as the official git repo dates back to.

Panel autohiding can be enabled for any individual panel by configuring the option "Automatically hide the panel" in the Panel preferences. When enabled, the panel will minimize itself after the mouse cursor leaves it and pop out again when the cursor returns, which should suit most use cases.

a panel popping in and out of hiding as the mouse cursor moves around it


Option 2: Disable the panel by switching configurations

If the panel autohiding feature does not fit your use-case and you prefer to temporarly disable a panel entirely, along with all plugins that would be running, then this is, sadly, not a supported feature.
From https://gitlab.xfce.org/xfce/xfce4-panel/-/issues/443

Please just create a backup of your config/layout with xfce4-panel-profiles and remove the panel.
This feature really doesn’t make any sense to me. You’d waste resources for having to keep something around which you clearly don’t want to keep around (otherwise why would you disable/hide it?).

Too much code and hassle for something that is not done on a regular basis by a lot of users…

To help with this task you may try out "Xfce4 Panel Profiles". Here’s an article about this program and its features from when it was introduced in Xubuntu 15.10. It is available from the official Ubuntu universe repository:

apt install xfpanel-switch

According to its entry on launchpad.net, the program hasn’t been updated in a while but continues to be included in current Ubuntu releases, with a seemingly new version being tested in Ubuntu 23.04.

Since i don’t use Xubuntu i did not test this program and don’t know about its current state and how functional or useful it currently is, but i presume they would have dropped the package if it stopped working by now.


Option 3: Disable the panel by messing with things you shouldn’t touch

If you need more granular control there is also the option to jank you way around things by messing directly with the Xfce settings yourself:
¬†Among the individual panel preferences in the xfconf channel for the xfce4-panel there is also an Array with all the corresponding Panel ID’s and as it turns out, manipulating this array influences which panels are recognized.

enter image description here

Messing with the config like this obviously comes with issues, most notably that adding panels while the indexing array is incomplete usually overwrites existing panels. Be prepared to lose your settings and create backups as needed.
Unless you find another way to prevent this you always have to remember to restore the array to its original state before making any edits in GUI, although you can also add new panels manually by editing the raw config files.

If you’re fine with all of that, here’s how to do it. This was tested to work with Xfce 4.18

Basic Steps

xfconf files are kept in ~/.config/xfce4/xfconf/xfce-per-channel/. Additional config files may be in ~/.config/xfce4/panel/ depending on the panel items in use. Make sure you copy these to a safe location before you start. For some use-cases you may want to edit these files directly for more granular control. You may want to use a dedicated XML editor for a better overview, otherwise mousepad with syntax highlighting should be fine.

Open a Terminal, then:

  1. Quit the Panel
    xfce4-panel --quit
  2. Set the Panel ID’s you want to enable. This is a bit clunky, since every value needs to be specified individually as far as i know. This example sets the array to [0, 1]
    xfconf-query -c xfce4-panel -p /panels --force-array -t int -s 0 -t int -s 1
  3. Restart the panel
    xfce4-panel >/dev/null 2>&1 & disown

To edit the raw xfconf files:

  1. Quit the Panel and xfconfd
    xfce4-panel --quit && pkill xfconfd
  2. Make your edits and save
  3. Restart the panel. xfconfd is started automatically.

Sharing plugin settings across panel configurations

In my use-case I have two different panel configurations and I switch between those two. Since I use most of my panel items in both configurations with the same settings i edited the raw config files such that both panels use the same plugin ID’s for these items. This works very well but these panels may never be active at the same time, since doing so messes up the plugin ID’s: Only the first panel remains intact while the second panel loses some plugins while recreating the remaining ones with default settings.

Automation

To facilitate switching between my panels i wrote a simple script and a Desktop Entry. You most likely want to adapt these to better suit your personal needs.

To use them, put the shell script into any directory in your $PATH. If there are only system directories in your PATH you can add export PATH=$PATH:~/.local/bin to ~/.profile. This should take effect once you log in the next time. Alternatively, see https://wiki.archlinux.org/title/Environment_variables#Per_user or specify the full path to the script in the desktop entry.
¬†Then put the Desktop Entry into ~/.local/share/applications/. You should be able to right click on the desktop entry in the Whiskermenu or any other launcher to run the custom actions. If they don’t show up restarting the Whiskermenu or the whole panel as described above will force a full reload.

Shell Script

#!/bin/sh
print_help() {
printf 'Usage: %s PANEL_TYPE

Possible values for PANEL_TYPE:
    -d|default
        My normal panel.
    -s|slim
        A smaller panel that leaves all the display area to windows.
' ${0##*/}
}
switch_panel() {
    local panel_id=${1:-0}
    local titleless=${2:-false}
    xfce4-panel --quit
    xfconf-query -c xfce4-panel -p /panels -a -t int -s $panel_id
    # Window Manager Tweaks -> Accesibility -> Hide title of windows when maximized
    xfconf-query -c xfwm4 -p /general/titleless_maximize -t bool -s $titleless
    xfce4-panel >/dev/null 2>&1 & disown
}

case "$1" in
    -d|"default")
        switch_panel
        ;;
    -s|"slim")
        switch_panel 1 true
        ;;
    *)
        print_help
        exit
        ;;
esac

Desktop Entry for panel-preferences.desktop
If you want localized values or if this is out of date, get a fresh copy of the original file from /usr/share/applications/, then add all lines starting at Actions=... to the end of it.

[Desktop Entry]
Version=1.0
Exec=xfce4-panel --preferences
Icon=org.xfce.panel
Type=Application
Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-PersonalSettings;
OnlyShowIn=XFCE;
Terminal=false
StartupNotify=true
X-XfcePluggable=true
X-XfceHelpComponent=xfce4-panel
X-XfceHelpPage=preferences
Name=Panel
Comment=Customize the panel
Keywords=panels;settings;preferences;taskbar;autohide;application menu;start;buttons;launcher;notification area;status;icons;plugins;

Actions=panel-default;panel-slim;
[Desktop Action panel-default]
Name=Panelswitch: Default
Exec=xfce-panelswitch default
[Desktop Action panel-slim]
Name=Panelswitch: Slim
Exec=xfce-panelswitch slim
Answered By: Brian
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.