Xfce Forum

Sub domains
 

You are not logged in.

#1 2016-11-06 07:15:42

javatechnical
Member
Registered: 2016-08-07
Posts: 18

Hide Xfce4 Panel on keyboard shortcut

I would like to hide the Xfce panel 1 (aka Taskbar) when a keyboard shortcut is pressed.
I don't want to chose auto hide panel, which has three options like Never, Hide, Intelligently. This is because, they show the panel as soon as the mouse is hovered to the bottom position (where the panel is located).

What all I want is that the panel should be shown only when the keyboard shortcut is pressed.
and it must also not reserve space on borders as soon as it is shown i.e. the panel should not overlay on the maximized windows hiding a portion of those windows which I don't want.

I have tried the script in the https://wiki.xfce.org/tips bottom section, added permissions for it. It is getting executed but with no result at all. The terminal output doesn't show anything.

#!/bin/sh
 
test -z "$1" && echo missing panel id  && exit 1
test ! -z "`echo $1 | sed s/[0-9]*//g`" && echo bad panel id  && exit 1
 
CHANNEL=xfce4-panel
PANELID=$1
PROP=/panels/panel-$PANELID/autohide
 
if `xfconf-query -c $CHANNEL -p $PROP >/dev/null 2>&1`; then
    xfconf-query -c $CHANNEL -T -p $PROP
else
    xfconf-query -c $CHANNEL -n -p $PROP -t bool -s false
fi

There doesn't seem to be autohide property but autohide-behavior from http://askubuntu.com/questions/244466/c … 958_246446

However, that doesn't seem to solve the problem.

Also tried querying for xfce4-panel properties using

xfconf-query -c xfce4-panel -p /panels -l -v

Channel Xfce4 panel contains no properties

is the output produced.

http://askubuntu.com/questions/244466/c … g-mouse-cu

The answer(s) in the above also did not work.

I think there must be some shell script written to achieve this.

P.S: I don't want to install any additional software for this.

Last edited by javatechnical (2016-11-06 07:20:22)

Offline

#2 2016-11-06 15:43:38

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Hide Xfce4 Panel on keyboard shortcut

There's a simple solution here.

In short:

pgrep xfce4-panel && xfce4-panel -q || xfce4-panel

I have it as script, attached to a keyboard shortcut, works great!

Edit: I see now that maybe it's not the perfect solution for you as you want to show/hide just one panel, you might have to tweak it.

I have the feeling that ToZ will show up and set things straight smile Hi ToZ!

Last edited by alcornoqui (2016-11-06 15:46:19)

Offline

#3 2016-11-06 16:05:16

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Hide Xfce4 Panel on keyboard shortcut

I was just composing a reply when I noticed alcornoqui's reply. True that will work for cases where all panels need to be enabled/disabled, but you will need something more for selective panel management. It is possible, however, it looks like there may be a bug preventing it from working properly. Anyways, my reply:

There doesn't seem to be autohide property but autohide-behavior from http://askubuntu.com/questions/244466/c … 958_246446

Yes, it was changed from "autohide" to "autohide-behavior" for version 4.11.2. It is no longer a boolean value, so that script won't work post 4.11.1. The new values are:
0 = Hide never
1 = Hide Intelligently
2 = Hide always

Also tried querying for xfce4-panel properties using

xfconf-query -c xfce4-panel -p /panels -l -v

Channel Xfce4 panel contains no properties

This is more serious of an issue. Do you have any xfce4-panel properties?

xfconf-query -c xfce4-panel -lv

Also have a look at Settings Manager > Settings Editor, in the xfce4-panel channel. You should have some values there.

What all I want is that the panel should be shown only when the keyboard shortcut is pressed
and it must also not reserve space on borders as soon as it is shown i.e. the panel should not overlay on the maximized windows hiding a portion of those windows which I don't want.

You could modify the script to set autohide-behavior to 2 (always) to hide the script and back to 1 (intelligently) to display it intelligently (ie. not over an active window), but this doesn't seem to work. It seems like xfce4-panel does not take into consideration the positions of existing windows when switching to hide intelligently mode. This is probably a bug and a bug report should be filed.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#4 2016-11-06 16:13:19

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Hide Xfce4 Panel on keyboard shortcut

ToZ, you're great, thanks!!!

Offline

#5 2016-11-06 19:44:36

javatechnical
Member
Registered: 2016-08-07
Posts: 18

Re: Hide Xfce4 Panel on keyboard shortcut

pgrep xfce4-panel && xfce4-panel -q || xfce4-panel

I have only one panel, so I need not tweak it.

This code worked fine, is it killing the panel process? If so, is it not something serious? I mean killing and starting the process again and again?
Is killing and starting costly?

Would you recommend doing this, as a matter of fact?

Last edited by javatechnical (2016-11-06 19:47:12)

Offline

#6 2016-11-06 20:21:19

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Hide Xfce4 Panel on keyboard shortcut

I haven't had any problem with this method, and I've used it many many times.

This is on a netbook with a Celeron CPU and just 1GB of RAM, so the load times are noticeable, but otherwise you're ok, none of my panel plugins have acted strange so far, including the popup terminal.

Again, I'm no expert whatsoever, just a happy user...

Offline

Board footer

Powered by FluxBB