site  contact  subhomenews

Automatic popup of drives menu fixed

April 06, 2022 — BarryK

Some snapshots of the JWM-mode icon-free-desktop were posted here:

https://bkhome.org/news/202203/stark-black-theme-for-pending-easyos-344.html

Reproducing one of those snapshots, the drives menu, showing that the menu can be popped up by a middle-button-click anywhere over the wallpaper:

img1

It is intended also, that the drives menu will popup automatically, whenever there is some change to the drives, for example, a USB-stick plugged in or removed, or a partition mounted or unmounted. However, that is not happening in Easy 3.4.4.

What is supposed to happen is that the 'xdotool' utility is used to move the mouse pointer over the drives icon in the tray, then a middle-mouse-button click simulated. This was not happening, the mouse pointer was not getting moved correctly.

The appropriate script is /usr/local/ui/jwm/popup-drives-menu, and it is now fixed:

#!/bin/ash
#20220209 popup drives menu. called from:
# /usr/local/pup_event/frontend_change, frontend_funcs
# /usr/local/ui/unmount-all, unmount-part, jwm/rescan-drives-menu
#20220406 fix position to move mouse pointer.

SCRN_X=$(cat /tmp/pup_event_frontend_scrn_x)
SCRN_Y=$(cat /tmp/pup_event_frontend_scrn_y)

Twidth0="$(grep -m 1 -o 'width="[^"]*' /root/.jwmrc-tray)" #ex: width="1172
Twidth="${Twidth0/*\"/}"
if [ "$Twidth" == "0" -o "$Twidth" == "" ];then
Xoff=53
else
Xoff=$(((($SCRN_X - $Twidth) / 2) + 53))
fi

grep -q '<Tray .*valign="top"' /root/.jwmrc-tray
if [ $? -eq 0 ];then
#tray is at top of screen.
Yoff=20
else
Yoff=$(($SCRN_Y - 20))
fi

xdotool mousemove ${Xoff} ${Yoff} #on top of drives icon.
xdotool click 2 #middle button

Having the drives menu popup when there is some drive/partition change, is a significant improvement to usability.   

Tags: easy