Created
March 10, 2026 18:01
-
-
Save SmileYzn/7ed396722b0267471a186e173873aef8 to your computer and use it in GitHub Desktop.
Abrir o whisker menu centralizado na tela do XFCE 4 (Sem Flicker)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ############################################################# | |
| # O comando completo com os valores fixados | |
| ############################################################# | |
| # 1920x1080: Tamanho da tela | |
| # 510x416: Tamanho do menu whisker | |
| # 35: Tamanho do painel inferior | |
| # xdotool mousemove $(((1920 - 510) / 2)) $((1080 - 416 - 35)) && xfce4-popup-whiskermenu -p | |
| ############################################################# | |
| # 1. Obter posição do mouse em $X e $Y (Inicial) | |
| ############################################################# | |
| eval "$(xdotool getmouselocation --shell)" | |
| ############################################################# | |
| # 2. Resolução Altura x Largura | |
| ############################################################# | |
| read WIDTH HEIGHT <<< $(xdotool getdisplaygeometry) | |
| # 3. Obter tamanho do painel (1) | |
| PANEL_SIZE=$(xfconf-query -c xfce4-panel -p "/panels/panel-1/size") | |
| ############################################################# | |
| # 4. Obter o nome do menu principal | |
| ############################################################# | |
| PH=$(xfconf-query -c xfce4-panel -lv | awk -F'whiskermenu' '/whiskermenu/ {gsub(/[ \t]+$/, "", $1); print $1; exit}') | |
| ############################################################# | |
| # 5. Obter largura do menu | |
| ############################################################# | |
| MW=$(xfconf-query -c xfce4-panel -p "$PH/menu-width") | |
| ############################################################# | |
| # 6. Obter altura do menu | |
| ############################################################# | |
| MH=$(xfconf-query -c xfce4-panel -p "$PH/menu-height") | |
| ############################################################# | |
| # 7. Posição do mouse para o menu (Largura) | |
| ############################################################# | |
| MX=$(((WIDTH - MW) / 2)) | |
| ############################################################# | |
| # 8. Posição do mouse para o menu (Altura) | |
| ############################################################# | |
| MY=$((HEIGHT - MH - PANEL_SIZE - 5)) | |
| ############################################################# | |
| # 9. Mover Mouse | |
| ############################################################# | |
| xdotool mousemove --sync "$MX" "$MY" | |
| ############################################################# | |
| # 10. Mostrar menu na posicão do mouse | |
| ############################################################# | |
| xfce4-popup-whiskermenu -p | |
| ############################################################# | |
| # 11. Retornar cursor a posição inicial | |
| ############################################################# | |
| xdotool mousemove --sync "$X" "$Y" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment