Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-09-25 16:24:05

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 276

Wanted: shortcut to "unhide" panel

Prompted by a friend's question, I created a deskbar-type panel like in this screenshot: tablet_like_panel.png
It works great when "anchored" to any of the desktop sides (TLRB), or any of the corners, but its intellihide/always panel-hiding setting is non-functioning in my desired position (centered on my desktop, as shown). It appears as if the panel does not receive mouse-focus when set to intellihide/always hide. Is there any keyboard shortcut that could be set to "unhide" that panel whenever needed? Thanks.

NB: A further observation: as it works right now (not ideal in terms of looks & usability) when this panel is "anchored" to an edge, or corner, i must bounce the mouse [pointer] onto that edge or corner to unhide the panel. Even a tiny gap of a few pixels results in the mentioned non-focus condition.


Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support

Offline

#2 2018-09-25 17:53:50

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Wanted: shortcut to "unhide" panel

Well, you could switch the autotohide on and off.
That can be done if in the chanel xfce4-panel property /panels/panel-3/autohide is toggled.
Not sure what the panel number is, let's say it's panel number 3 (check yours):

xfconf-query -c xfce4-panel -p /panels/panel-3/autohide -t bool --toggle

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

Offline

#3 2018-09-25 19:47:07

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 276

Re: Wanted: shortcut to "unhide" panel

Hmmm ...

Thanks for the suggestion; alas, i tried it & failed. Per the xfce4-panel.xml (for xfce 4.12), the "autohide" property is now called "autohide-behavior", and it is of type "uint" with 3 values (afaict): 0, 1, 2 which i assume signify "never", "intelligent", "always", respectively.

So i modified the command accordingly, but it only returns the present value which is "2" (always hide). More ideas?


Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support

Offline

#4 2018-09-25 20:30:15

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Wanted: shortcut to "unhide" panel

Sorry, mine is still old on this machine.

To check the current value:

xfconf-query --channel 'xfce4-panel' --property '/panels/panel-3/autohide-behavior'

set value 0

xfconf-query --channel 'xfce4-panel' --property '/panels/panel-3/autohide-behavior' --type int --set 0

set value 2

xfconf-query --channel 'xfce4-panel' --property '/panels/panel-3/autohide-behavior' --type int --set 2

Other than that there is xdotool. But you can only show and hide the panel.
You can map and unmap windows if you know their XID (Xwindow ID) and panel is also a window.
The panel xids can be viewed like this:

wmctrl -Glx | awk '/[Xx]fce4\-[Pp]anel.*[Xx]fce4-[Pp]anel/ {if ($3 !~ /-9999/) print $1}'

you have to install wmctrl, panel with geometry -9999 is excluded here, because it's not viewable.
Xfce loads the panels from first to last, so their xids should be from first to last.
panel-1
panel-2
panel-3

0x01800004
0x01800036
0x0180af68

panel 3 can be unmaped like this

xdotool windowunmap 0x0180af68

anbd mapped back

xdotool windowmap 0x0180af68

Maybe the monitor corners can be used to show and hide the panel when the mouse enters one of them.
I have no more ideas, it's getting late.

Last edited by Misko_2083 (2018-09-25 20:51:43)


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

Offline

#5 2018-09-26 22:45:19

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 276

Re: Wanted: shortcut to "unhide" panel

Thanks a lot, misko!

Your help with those xfconf-query commands were very instructive, but didn't quite work out for me. However, your expos'e of those two xdotool options (windowunmap / windowmap) worked great! After 1st testing them in the terminal, i setup 2 keyboard shortcuts: super+1 and super+2. They accomplish those panel-unhide/-rehide functions i was looking for. Then i added 2 command buttons (launchers) to my normal, fixed, right-edge vertical panel that do the same thing the keyboard shortcuts do (a slicker solution since i am mousing around 80% of the time). Btw: all these workarounds work ONLY if the panel's hiding-option is set to "Never".

Now i can live with xfce's inability to provide me with a hidden tablet-like, centered panel. For the time being i can live without the intellihide/autohide option for that panel.

@ ToZ ... It seems that the system does not provide mouse-focus to such a panel when (a) the desktop is empty (no active app windows) and (b) the panel is NOT snapped to any edge, or corner. Should I open a bug report on this?


Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support

Offline

#6 2018-09-27 00:44:09

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Wanted: shortcut to "unhide" panel

mint4all wrote:

@ ToZ ... It seems that the system does not provide mouse-focus to such a panel when (a) the desktop is empty (no active app windows) and (b) the panel is NOT snapped to any edge, or corner. Should I open a bug report on this?

I do get a mouse over focus event, but its a very small pixel range that allows it (on both xfce-panel 4.12 and 4.13 git version). It is difficult to hit though and an awkward design. Misko's windowmap/windowunmap solution seems the better option.


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

#7 2018-10-04 19:43:45

CwF
Member
Registered: 2018-01-28
Posts: 305

Re: Wanted: shortcut to "unhide" panel

This is a great idea for the 'windows button' if the mouse over is flaky. I'm inspired....

Offline

#8 2018-10-04 23:45:49

Laurentius
Member
Registered: 2016-09-04
Posts: 58

Re: Wanted: shortcut to "unhide" panel

@mint4all wrote
           "Btw: all these workarounds work ONLY if the panel's hiding-option is set to "Never"."


Probably you have already seen this but, just in case, to set a single shortcut for toggle the autohide behavior (whichever its current value is), in this ubuntu forum thread

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

there is a script by @topisani that toggles the autohide behavior: "Never" (0) / "Intelligently" (1)

It can be adapted to switch between 0 and 2:

#!/bin/bash

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

(There are two lines where you have to adapt your panel id)

Offline

#9 2018-10-05 23:57:43

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 276

Re: Wanted: shortcut to "unhide" panel

@ laurentious ... Thanks for sharing this script. Of course, I will include in my ongoing testing.

@ ToZ... Thanks for your input, too! I also observed that (few-pixels wide) vertical "hot" edge/line you mentioned, located right in the center of the panel. Alas, the window-manager's inability to reliably autohide what i call a "floating" panlel, a panel NOT snapped to any of the desktop edges (or corners), is not an option for me, or for the folks i support.

However, my trial-and-error work with xdotool has continued. The windowunmap/windowmap functions work great so far; i also got the "behave_screen_edge" and "behave" {on mouse-leave} functions working nicely, but  unfortunately with one BAD observation: if i use any of the "behave"-related functions, parts of xdotool remain in memory causing a 3.1MB memory leak upon every invocation, both initial & later.

I've gotten the source code for xdotool and tried to find the leak, but my C-language skills have rusted for 25+ years and fixing THAT bug may just be way over my head. Moreover, xdotool hasn't been maintained since 2016, the bug list is quite long, and Mint's/Ubuntu's version is on older version (3.20150503.1). Sooo, i may have to give up on xdotool after all ... i'll let you know.

Cheers, m4a


Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support

Offline

#10 2018-10-06 03:57:03

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Wanted: shortcut to "unhide" panel

mint4all wrote:

However, my trial-and-error work with xdotool has continued. The windowunmap/windowmap functions work great so far; i also got the "behave_screen_edge" and "behave" {on mouse-leave} functions working nicely, but  unfortunately with one BAD observation: if i use any of the "behave"-related functions, parts of xdotool remain in memory causing a 3.1MB memory leak upon every invocation, both initial & later.

Maybe minimizing and restoring a window would be better.
To minimize:

xdotool windowminimize 0x0180af68

When a window is restored with  xdotool there is an error from XGetWindowProperty:

xdotool windowactivate --sync 0x0180af68
XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)

With wmctrl seems fine:

wmctrl -i -R 0x0180af68

behave_screen_edge runs xdotool as a daemon

If xdotool is buggy there is a python script cb-hotcorners to run commands when the mouse enters screen corners (from the CrunchBang forum).
Requires: python-xlib
Script starts with: cb-hotcorners --daemon

#!/usr/bin/env python
# cb-hotcorners:
# A script for adding hot corners to Openbox.
# Written for CrunchBang Linux <http://crunchbang.org/>
# by Philip Newborough <corenominal@corenominal.org>
# ----------------------------------------------------------------------
# License:
#            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#                    Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
#            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
#  0. You just DO WHAT THE FUCK YOU WANT TO.
# ----------------------------------------------------------------------

from Xlib import display
from Xlib.ext.xtest import fake_input
from Xlib import X
from subprocess import Popen, PIPE, STDOUT
import sys, time, os, ConfigParser, re

check_intervall = 0.2

p = Popen(['xdotool','getdisplaygeometry'], stdout=PIPE, stderr=STDOUT)
Dimensions = p.communicate()
Dimensions = Dimensions[0].replace('\n', '')
Dimensions = Dimensions.split(' ')
width = int(Dimensions[0])
height = int(Dimensions[1])
hw = width / 2
rt = width - 1
bt = height - 1

def print_usage():
	print "cb-hotcorners: usage:"
	print "  --help          show this message and exit"
	print "  --kill          attempt to kill any running instances"
	print "  --daemon        run daemon and listen for cursor triggers"
	print ""
	exit()

if len(sys.argv) < 2 or sys.argv[1] == "--help":
	print_usage()

elif sys.argv[1] == "--kill":
	print "Attempting to kill any running instances..."
	os.system('pkill -9 -f cb-hotcorners')
	exit()

elif sys.argv[1] == "--daemon":
	Config = ConfigParser.ConfigParser()
	cfgdir = os.getenv("HOME")+"/.config/cb-hotcorners"
	rcfile = cfgdir+"/cb-hotcornersrc"
	bounce = 40
	disp = display.Display()
	root=display.Display().screen().root

	def mousepos():
		data = root.query_pointer()._data
		return data["root_x"], data["root_y"], data["mask"]

	def mousemove(x, y):
		fake_input(disp, X.MotionNotify, x=x, y=y)
		disp.sync()

	try:
		cfgfile = open(rcfile)
	except IOError as e:
		if not os.path.exists(cfgdir):
			os.makedirs(cfgdir)
		cfgfile = open(rcfile,'w')
		Config.add_section('Hot Corners')
		Config.set('Hot Corners','top_left_corner_command', 'gmrun')
		Config.set('Hot Corners','top_right_corner_command', '')
		Config.set('Hot Corners','bottom_left_corner_command', '')
		Config.set('Hot Corners','bottom_right_corner_command', '')
		Config.write(cfgfile)
		cfgfile.close()

	while True:
		Config.read(rcfile)
		time.sleep(check_intervall)
		pos = mousepos()
		
		if pos[0] == 0 and pos[1] == 0:	
			if Config.get('Hot Corners','top_left_corner_command') != '':
				time.sleep(0.2)
				pos = mousepos()
				if pos[0] == 0 and pos[1] == 0:
					mousemove(pos[0] + bounce, pos[1] + bounce)
					os.system('(' + Config.get('Hot Corners','top_left_corner_command') + ') &')
					mousemove(pos[0] + bounce, pos[1] + bounce)
					time.sleep(2)
		
		elif pos[0] == rt and pos[1] == 0:
			if Config.get('Hot Corners','top_right_corner_command') != '':
				time.sleep(0.2)
				pos = mousepos()
				if pos[0] == rt and pos[1] == 0 :
					mousemove(pos[0] - bounce, pos[1] + bounce)
					os.system('(' + Config.get('Hot Corners','top_right_corner_command') + ') &')
					mousemove(pos[0] - bounce, pos[1] + bounce)
					time.sleep(2)

		elif pos[0] == 0 and pos[1] == bt:
			if Config.get('Hot Corners','bottom_left_corner_command') != '':
				time.sleep(0.2)
				pos = mousepos()
				if pos[0] == 0 and pos[1] == bt:
					mousemove(pos[0] + bounce, pos[1] - bounce)
					os.system('(' + Config.get('Hot Corners','bottom_left_corner_command') + ') &')
					mousemove(pos[0] + bounce, pos[1] - bounce)
					time.sleep(2)

		elif pos[0] == rt and pos[1] == bt:
			if Config.get('Hot Corners','bottom_right_corner_command') != '':
				time.sleep(0.2)
				pos = mousepos()
				if pos[0] == rt and pos[1] == bt:
					mousemove(pos[0] - bounce, pos[1] - bounce)
					os.system('(' + Config.get('Hot Corners','bottom_right_corner_command') + ') &')
					mousemove(pos[0] - bounce, pos[1] - bounce)
					time.sleep(2)

else:
	print_usage()

Configuration file for this script is  /home/your_username/.config/cb-hotcorner/cb-hotcornersrc
This is han example on how to set the configuration file (just change the command or path to script)

[Hot Corners]
top_left_corner_command = xdotool windowminimize 0x0180af68
top_right_corner_command = /path/to/script.sh 
bottom_left_corner_command = path/to/script.sh
bottom_right_corner_command = path/to/script.sh

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

Offline

#11 2018-11-05 16:49:48

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 276

Re: Wanted: shortcut to "unhide" panel

Thanks for the suggestions & tips, Misko! It is certainly worth a shot, in addition to trying out the "BrightSide" plugin.

The problem i've been running into is that the tablet-like panel's window-ID keeps changing on me whenever i reboot, or shutdown -- it is never the same again. So i've been working up a script that ferrets out the panel's changed ID under those varying scenarios, then passes THAT changed ID to xdotool's 2 commands.

On the bright side: i learned that I've been using an outdated version (3.2015) of xdotool. Because the latest version (3.2016) was not in ubuntu's or mint's repos, i tried and obtained the updated master-source from git, compiled from source (a deja vu experience for me, lol) and now i have a working -- read: no more memory-leaks! -- version of xdotool. Both of the behave-functions i needed (behave-screen-edge & mouse-leave) now work without a hitch, and without memory leaks.

When i'm finished with my project, hopefully soon, i'll update this post.

Cheers, m4a


Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support

Offline

#12 2020-03-04 14:52:37

null
Member
Registered: 2020-02-13
Posts: 3

Re: Wanted: shortcut to "unhide" panel

Any updates on this function?

Offline

#13 2020-03-06 01:16:24

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 276

Re: Wanted: shortcut to "unhide" panel

Thanks for asking!

I regret having to admit that I gave up on this project. The reason being that xfce's assignment of window-ids changes seemingly in random fashion between shutdowns, reboots and logouts. Gleaning the tablet-like panel's window-id every time xfce initializes, throwing it into a response file, then reading it in using a bash script every time xdotool runs was just too much trouble to get it to work reliably.

The hot-corner solution works fine, but can run easily afoul with apps that have corner-sensitive goodies, like  the window's resize grippy that uses those very corners. If dragged into a hot corner by accident it triggers the panel's unhide funtion and can mess up the window's resizing attempt.

But i learned a lot, imho. Thanks for all your help!
Cheers, m4a


Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support

Offline

#14 2023-05-01 18:58:10

eja
Member
Registered: 2023-05-01
Posts: 2

Re: Wanted: shortcut to "unhide" panel

Hello and sorry for bumping this thread, but the above plugin looks quite nice. I'm also new to XFCE but would like to start developing plugins, do you by any chance still have it somewhere on github etc.?

Offline

#15 2023-05-02 21:04:37

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 276

Re: Wanted: shortcut to "unhide" panel

eja wrote:

Hello and sorry for bumping this thread, but the above plugin looks quite nice. I'm also new to XFCE but would like to start developing plugins, do you by any chance still have it somewhere on github etc.?

Greetings!

I regret having to disappoint you -- what you see in my above post is just a normal "panel", not a "plugin" with new functionality. So there's no source or other stuff that I could pass on to you. However, it worked quite well on my friend's late-model (back then) HP-laptop. The problem with dynamically-assigned window-IDs persists to this day, so I gave up on the whole idea. Maybe I'll take a look at the Ubuntu-touch OS and see how the developers dealt with the above problem, but I don't have a suitable laptop or tablet at this time to play with ...

Cheers, m4a


Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support

Offline

#16 2024-07-31 15:52:30

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Wanted: shortcut to "unhide" panel

Hey guys someone asked on matrix and, I made an app that minimizes and maps a panel from command line.
It took more time to find this old thread than to write the app, so @mint4all you owe me big time. big_smile

https://gist.githubusercontent.com/Misk … e4-panel.c

You can pass several panel numbers to toggle the appearance of panels.
e.g. :

./toggle-xfce4-panel 2 1 3

It's best to assign the keyboard shortcut for this.


uaimuR5.gif

Last edited by Misko_2083 (2024-07-31 22:03:02)


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

Offline

#17 2024-08-04 23:32:25

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Wanted: shortcut to "unhide" panel

This is fun to play with.
Two panels one set to autohide, both panels with launchers that minimize and show the first panel.
https://i.imgur.com/DdzC0yE.mp4


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

Offline

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

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.016 seconds, 7 queries executed - Memory usage: 641.65 KiB (Peak: 674.93 KiB) ]