Xfce Forum

Sub domains
 

You are not logged in.

#1 2025-05-14 14:52:28

advice1010
Member
Registered: 2023-02-19
Posts: 162
LinuxChrome 130.0

Way to hide panel with a command

XFCE 4.20.x

OVERVIEW
Is there a command line command that can allow user to hide the panel
Panel - Display - Automatically Hide Panel = Always
and then one to revert this back to
Panel - Display - Automatically Hide Panel = Never
I put more specific details about the functionality I am looking for below.

RESEARCH RESULTS
In doing some research, I saw older posts elsewhere and apparently this was possible in the past because the setting was said to be a "boolean" but in newer versions this is said to have changed?

xfconf-query -c xfce4-panel -p /panels/panel-0/autohide-behavior -s 0

Value at the end can be 0  1   2

Someone else mentioned could also set as a toggle with this

xfconf-query -c xfce4-panel -p /panels/panel-0/autohide -T

but these did not work for me


IDEAL FUNCTIONALITY
What I am really looking for is the simplest way (without need for extra applications) to do the following.
Would have to be some kind of Bash script I imagine.
Looking to do this in other programs but for this example lets just use Thunar.
I would like to be able to set it up where if I was to launch Thunar, to have the Panel change to autohide = "Always".
Then when that instance of Thunar is closed the Panel would change back to autohide = "Never"

Probably not possible so I guess the next best thing would be a toggle based hotkey set in Keyboard - Application Shortcuts.
As mentioned this in past was apparently possible but not sure if it is anymore?

Thank you to anyone who reads this

Offline

#2 2025-05-14 17:18:19

Tamaranch
Member
From: France
Registered: 2020-12-31
Posts: 399
Website
LinuxFirefox 138.0

Re: Way to hide panel with a command

Yes it's possible, you need something like devilspie, which tracks the opening of new windows and executes actions according to matching criteria (e.g. based on the window title). In this case the action would be the xfconf-query command you mention with the right value (never 0, always 2).

Offline

#3 2025-05-14 20:20:37

Misko_2083
Member
Registered: 2015-10-13
Posts: 223
Website
LinuxFirefox 128.0

Re: Way to hide panel with a command

Tamaranch wrote:

Yes it's possible, you need something like devilspie, which tracks the opening of new windows and executes actions according to matching criteria (e.g. based on the window title). In this case the action would be the xfconf-query command you mention with the right value (never 0, always 2).

I use my own app. toggle-xfce4-panel https://gist.githubusercontent.com/Misk … e4-panel.c
It can hide and show multiple panels 

./toggle-xfce4-panel <panel_number> [<panel_number> ...]

uaimuR5.gif

Last edited by Misko_2083 (2025-05-14 20:24:00)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#4 2025-05-14 22:15:40

CwF
Moderator
Registered: 2018-01-28
Posts: 316
LinuxFirefox 128.0

Re: Way to hide panel with a command

Misko_2083 wrote:

I use my own app

from your code;

* Toggle the visibility of a panel window (minimize or restore).

Does this imply the panel exist even while hidden?

This, or with xfconf-query and even 'Panel Profiles'  I've tried to make a more dynamic layout that can adjust to a situation. Always I run into the same problem. Either the panel exist and is sucking resources without being visible or used, or it doesn't exist until called for, yet needs interaction to inilialize.

Offline

#5 2025-05-14 23:01:31

Misko_2083
Member
Registered: 2015-10-13
Posts: 223
Website
LinuxFirefox 128.0

Re: Way to hide panel with a command

CwF wrote:
Misko_2083 wrote:

I use my own app

from your code;

* Toggle the visibility of a panel window (minimize or restore).

Does this imply the panel exist even while hidden?

This, or with xfconf-query and even 'Panel Profiles'  I've tried to make a more dynamic layout that can adjust to a situation. Always I run into the same problem. Either the panel exist and is sucking resources without being visible or used, or it doesn't exist until called for, yet needs interaction to initialize.

Yes, you are right about everything..

But I've had another approach and just rewritten this app to toggle between the autohide modes.
This way it will not depend on X11.

https://gist.github.com/Misko-2083/cc42 … cb43564084

toggle-xfce4-panel
A command-line C program to manage XFCE4 panel autohide behavior
Handles up to 100 panels, assumes integer IDs.
Portable for XFCE4 systems with libxfconf-0 and GLib.

toggle-xfce4-panel controls the autohide settings of XFCE4 panels using the xfconf system.
It queries, sets, toggles, or resets the autohide-behavior property, which has three modes:

  • 0 (never): Panel is always visible.

  • 1 (intelligently): Panel hides when a window overlaps, reappears when needed.

  • 2 (always): Panel autohides, appears on mouse hover.

Features

  • Query: Display current autohide settings for specific or all panels.

  • Set: Configure to never, intelligently, or always.

  • Toggle: Cycle through modes (never → intelligently → always → never).

  • Reset: Restore to never.

  • All Panels: Apply operations to all panels with "all".

  • Error Handling: Reports invalid panels, non-integer properties, and xfconf errors.

Usage

./toggle-xfce4-panel <panel_number> [<panel_number> ...]
./toggle-xfce4-panel all
./toggle-xfce4-panel --set=<never|intelligently|always> <panel_number> [<panel_number> ...] | all
./toggle-xfce4-panel --query <panel_number> [<panel_number> ...] | all
./toggle-xfce4-panel --reset <panel_number> [<panel_number> ...] | all

Examples:

  • Query all panels:

    ./toggle-xfce4-panel --query all
    Panel 1 autohide is set to intelligently
    Panel 2 autohide is set to always
  • Set panel 1 to intelligently:

    ./toggle-xfce4-panel --set=intelligently 1
    Panel 1 autohide set to intelligently
  • Toggle panel 2:

    ./toggle-xfce4-panel 2

    Output (if always): Panel 2 autohide set to never

  • Toggle panels 1 and 2:

    ./toggle-xfce4-panel 1 2
    ./toggle-xfce4-panel --set=never 1 --set=always 2
    Panel 1 autohide set to never
    Panel 2 autohide set to always
  • Reset all:

    ./toggle-xfce4-panel --reset all

    Output: Panel 1 autohide reset to never
    Panel 2 autohide reset to never

Dependencies

  • libxfconf-0-dev: For xfconf configuration.

  • libglib2.0-dev: For GValue, GPtrArray, and utilities.

Install (Debian-based):

sudo apt-get install libxfconf-0-dev libglib2.0-dev

Compile:

gcc toggle-xfce4-panel.c -o toggle-xfce4-panel -lxfconf-0 -Wall `pkg-config --cflags --libs libxfconf-0 glib-2.0`

Just fixed some bugs. Option "all" made it complicated, but it is neat to have something like that.
If you find more bugs please report.
https://gist.github.com/Misko-2083/cc42 … cb43564084

My dev libs are a bit older on debian.

apt-cache policy libxfconf-0-dev
libxfconf-0-dev:
  Installed: 4.18.0-2
  Candidate: 4.18.0-2
  Version table:
 *** 4.18.0-2 500
        500 http://deb.debian.org/debian bookworm/main amd64 Packages
        100 /var/lib/dpkg/status

Last edited by Misko_2083 (2025-05-15 00:44:29)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#6 2025-09-29 21:51:51

advice1010
Member
Registered: 2023-02-19
Posts: 162
LinuxChrome 130.0

Re: Way to hide panel with a command

I would prefer to not have to use a separate application this but thank you for providing this.

The following two commands work but unfortunately there is no way to toggle between them, they require two separate hotkeys which is not as convenient

Hide Panel

xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior -s 2

Show panel

xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior -s 0

I was told that there might be a way to combine these using a script, I am assuming a bash script?
Does anyone know how these commands can be combined?
I assume it would have to be a script with side kind of "if" statement
If 0 change to 2
If 2 change to 0

If anyone has any ideas, please let me know.
Thank You

Offline

#7 2025-09-29 22:54:46

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,315
LinuxFirefox 143.0

Re: Way to hide panel with a command

As a one-liner:

[[ $(xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior) == 0 ]] && xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior -s 2 || xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior -s 0

As a one-liner command for a keyboards shortcut:

sh -c '[[ $(xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior) == 0 ]] && xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior -s 2 || xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior -s 0'

As a script:

#!/bin/sh

RES=$(xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior)

if [ $RES == 0 ]; then
	xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior -s 2
else
	xfconf-query -c xfce4-panel -p /panels/panel-1/autohide-behavior -s 0
fi

Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#8 2025-10-08 22:35:23

advice1010
Member
Registered: 2023-02-19
Posts: 162
LinuxChrome 130.0

Re: Way to hide panel with a command

@ToZ
Thank you for providing all of these options, I like seeing all different ways things can be applied.
I was able to test some of these out but ran into some issues though.
Some things might need to be updated in your post just in case others come across this in the future.

I will start with the bash script, at first this did not work, after trying some things out I tried removing the double equal signs from the "$RES == 0" line and then this script worked when signed to hotkey in "Keyboards - Application Shortcuts".  Was this double equal sign a typo or is it suppose to be there?

The other one I tried was the "one-liner command for a keyboards shortcut".
I could not get this to work in its original version.
When I made discovery about the double equal sign in the "bash script" version I tried removing the extra equal sign but this still did not work for me, so maybe the double equal signs are not the issue?

Thank you again

Offline

#9 2025-10-08 23:47:02

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,315
LinuxFirefox 143.0

Re: Way to hide panel with a command

Hmm. It worked for me.

Try replacing "==" (string comparison) with "-eq" (numerical comparison) in both instances to see if that works better.


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#10 2025-10-09 06:06:19

Tamaranch
Member
From: France
Registered: 2020-12-31
Posts: 399
Website
LinuxFirefox 143.0

Re: Way to hide panel with a command

These are bash scripts.
Use '#!/bin/bash' and 'bash -c' instead of '#!/bin/sh' and 'sh -c'.
If you're on ubuntu (and all debian derived distros?), /bin/sh points to /bin/dash, which is fairly strictly POSIX.

Offline

#11 2025-10-15 23:54:43

advice1010
Member
Registered: 2023-02-19
Posts: 162
LinuxChrome 130.0

Re: Way to hide panel with a command

@Tamaranch
Ahhh that was it, thank you for mentioning this, works great!

@ToZ
As per the information Tamaranch mentioned, I changed the top line to  '#!/bin/bash'
I also then added back the double equal "==" you had originally mentioned as well.
Ran using 'bash -c' and the bash script version worked.

I also tested the "one-liner command" with 'bash -c' which worked as well.
All my other Bash related "Keyboard" shortcuts used this, I don't know why I didn't try this smile
Thank you again for providing all this information.

Again hopefully these will be useful to other users in the future as well.
Thank you guys again for the help.

Offline

#12 2025-10-24 13:36:01

SamuelBeau
Member
Registered: 2025-10-21
Posts: 3
Windows 10Chrome 141.0

Re: Way to hide panel with a command

Thanks for sharing this! I’m new here and found your solution really helpful.

Offline

#13 2025-11-04 23:55:32

advice1010
Member
Registered: 2023-02-19
Posts: 162
LinuxChrome 130.0

Re: Way to hide panel with a command

@SamuelBeau
Sorry I did not realize anyone responded.
I had the least to do about it but glad to hear that this post was helpful to you.
Welcome to the forum.

Last edited by advice1010 (2025-11-04 23:57:10)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.013 seconds, 7 queries executed - Memory usage: 640.68 KiB (Peak: 673.52 KiB) ]