Xfce Forum

Sub domains
 

You are not logged in.

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

mint4all
Member
From: America
Registered: 2018-08-21
Posts: 33

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 18.3-xfce & Linux Mint 19-xfce  -- Dell Precision T1500 Desktops -- Toshiba Satellite Laptop -- Family & Community Support re. Linux

Offline

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

Misko_2083
Member
Registered: 2015-10-13
Posts: 75
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

Offline

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

mint4all
Member
From: America
Registered: 2018-08-21
Posts: 33

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 18.3-xfce & Linux Mint 19-xfce  -- Dell Precision T1500 Desktops -- Toshiba Satellite Laptop -- Family & Community Support re. Linux

Offline

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

Misko_2083
Member
Registered: 2015-10-13
Posts: 75
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)

Offline

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

mint4all
Member
From: America
Registered: 2018-08-21
Posts: 33

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 18.3-xfce & Linux Mint 19-xfce  -- Dell Precision T1500 Desktops -- Toshiba Satellite Laptop -- Family & Community Support re. Linux

Offline

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

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 4,660

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.

Offline

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

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

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: 33

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: America
Registered: 2018-08-21
Posts: 33

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 18.3-xfce & Linux Mint 19-xfce  -- Dell Precision T1500 Desktops -- Toshiba Satellite Laptop -- Family & Community Support re. Linux

Offline

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

Misko_2083
Member
Registered: 2015-10-13
Posts: 75
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

Offline

Board footer

Powered by FluxBB