[TIP] Fluxbox menu in a fixed location, not on the pointer

Forum Forums General Software [TIP] Fluxbox menu in a fixed location, not on the pointer

  • This topic has 1 reply, 2 voices, and was last updated Sep 3-2:08 pm by PPC.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #66129
    Member
    zblsv

      If you use keyboard to run apps from Fluxbox Root Menu then may be you prefer it appears in fixed location, not on the mouse pointer.
      If so, you can simply use xdotool to automatically move mouse and then press ALT-R.

      Somewhat a like:
      xdotool mousemove 590 150
      xdotool key alt+r

      Add something appropriate to ~/.fluxbox/keys
      Mod1 r :RootMenu
      Mod1 w :ExecCommand xdotool mousemove 590 150 && xdotool key alt+r

      Words are carried away by the wind...

      #66342
      Member
      PPC
        Helpful
        Up
        1
        ::

        Good idea… I used a similar one, a while back, to open fluxbox menu from tint2 toolbar… I made the script so it re-positions the mouse pointer right where it was before summoning the menu. Which is nice, since people don-t usually like the mouse jumping around the screen.
        You can add that part to your code, if you find it useful.

        #!/bin/bash
        #Get panel size from ~/.config/tint2/tint2rc
        panel_size=$(grep -hr "panel_size" ~/.config/tint2/tint2rc)
        toolbar_height=$(echo $panel_size | grep -o "%.*"|cut -c3-)
        toolbar_position=$(egrep "^panel_position =" ~/.config/tint2/tint2rc | cut -d'=' -f2)
        toolbar_position_top_botom=$(echo $toolbar_position| cut -d' ' -f1)
        echo $toolbar_position_top_botom
        #select the right menu_height and the fluxbox menu will always come up right above the toolbar, just touching it, and not overlapting, adjusting to the panel's size
        
        if [ $toolbar_position_top_botom == "bottom" ] 
        then
        Yaxis=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2) && menu_height=534 && offset=$(($menu_height+$toolbar_height)) && correct_y_position_for_mouse_click=$(($Yaxis-$offset)) && eval $(xdotool getmouselocation --shell) && xdotool mousemove 0 $correct_y_position_for_mouse_click && fluxbox-remote rootmenu && xdotool mousemove $X $Y
        fi
        
        if [ $toolbar_position_top_botom == "top" ] 
        then
        Yaxis=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2) 
        menu_height=610 
        offset=$(($menu_height+$toolbar_height)) 
        correct_y_position_for_mouse_click=$((6+$toolbar_height)) 
        eval $(xdotool getmouselocation --shell) 
        xdotool mousemove 0 $correct_y_position_for_mouse_click && fluxbox-remote rootmenu && xdotool mousemove $X $Y
        fi
        
        if [ $toolbar_position_top_botom == "left" ] 
        then
        fluxbox-remote rootmenu
        fi
        
        if [ $toolbar_position_top_botom == "right" ] 
        then
        fluxbox-remote rootmenu
        fi
      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.