Skip to content

Commit

Permalink
Updated xsndiomenu to position xmenu at bottom left of icon position,…
Browse files Browse the repository at this point in the history
… if launched by wmlaunchbutton. Issue #1
  • Loading branch information
morgant committed Nov 29, 2023
1 parent 7601cb5 commit 457912f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion bin/xsndiomenu
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,18 @@ _xmenu_sndio_input_vol() {
printf "\tMin\tsndioctl -q input.level=0\n"
}

xmenu <<EOF | sh
_wmlaunchbutton_xmenu_position() {
_icon_geometry="$(printenv BUTTON_GEOMETRY)"
_icon_padding="$(printenv BUTTON_GEOMETRY_PADDING)"
_icon_padding="${_icon_padding:-0}"
[ -n "$_icon_geometry" ] && echo "$_icon_geometry" | while IFS=x+ read -r _w _h _x _y ; do
_top="$(( _y + _h + _icon_padding ))"
[ "$_x" -ge "$_icon_padding" ] && _left="$(( _x - _icon_padding ))" || _left="$_x"
printf "-p %sx%s" "$_left" "$_top"
done
}

xmenu $(_wmlaunchbutton_xmenu_position) <<EOF | sh
$(_xmenu_sndio_devs)
$(_xmenu_sndio_output_vol)
Expand Down

0 comments on commit 457912f

Please sign in to comment.