xmenu icon indicating copy to clipboard operation
xmenu copied to clipboard

XParseGeometry docs and xmenu docs causes ambiguity for positioning

Open Avinash-Bhat opened this issue 1 year ago • 0 comments

According to the xmenu documentation, XParseGeometry is used for parsing the (first part of) -p option.

The XParseGeometry documentation says the format should be:

[=][<width>{xX}<height>][{+-}<xoffset>{+-}<yoffset>]

But when invoking xmenu using xmenu -p 0x0 it shows at position 0,0 (top-left) of the monitor. If I'm not wrong here, following the documentation of XParseGeometry, we should be invoking xmenu -p '+0+0' instead for the same behavior. This causes some ambiguity in positioning the menus.

On the same note, using xmenu -p '-0-0' should theoretically place it at the bottom right of the monitor which would be a good use-case to considering the user is left to do xrandr math in shell.

I'm sure that there are other users who would want to do the same.

personal note:

I ran into this weirdness when I was creating a power menu using xmenu.

#!/bin/sh
POSITION=$(xrandr --query |awk -F '[ x+]' '/\<primary\>/{print $4-(8*2)"x"$5-(95*2)}')
echo $POSITION
xmenu -p ${POSITION}:cursor <<EOF | sh &
Shutdown			systemctl poweroff
Reboot				systemctl reboot
Hibernate			loginctl lock-session $XDG_SESSION_ID && systemctl hibernate
Sleep				loginctl lock-session $XDG_SESSION_ID && systemctl suspend
Logout				i3-msg exit
Lock				loginctl lock-session $XDG_SESSION_ID
EOF

whenever I added a new item to the menu I have to adjust the y-position using awk as the height of the menu changes.

I hope you see that this is a bit awkward to work with.

Avinash-Bhat avatar Jul 13 '24 20:07 Avinash-Bhat