Fixing BSPWM Centered Drop Down Menus in Android Studio

3 minute read

For a uni assignment, we have to create an Android App from scratch. One of the largest annoyances of using Android Studio on BSPWM is the fact that all the drop down menus are centered on the screen.


The Arch Linux wiki had the resolution to this issue to run this command in your bspwmrc file, however this did not fix the issue for me.

wmname LG3D &

Another idea was to set an Java env variable before running Android Studio. This also did not work for me.

_JAVA_AWT_WM_NONREPARENTING=1

After some more research on Google, I found this Reddit comment from u/CodyBonney. The solution they had was to create an explicit rule to unmanage the child windows of Java.

Card

Post is copied here:

Alright, I think I have a workaround!

First, I installed xtitle

Then, I created a new external_rules file:

#! /bin/sh

wid=$1
class=$2

# fix context menus in IntelliJ IDEA 2018.1
[[ "$class" = "jetbrains-idea" ]] && [[ $(xtitle "$wid") =~ > ^win[0-9]*$ ]] && echo "manage=off";

Then, I made it executable: sudo chmod +x external_rules

Then, I added the following to my bspwmrc file:

bspc config external_rules_command "/home/cody/.config/bspwm/external_rules"

I had to change the "jetbrains-idea" in the script to "jetbrains-studio" because the window class was different since I was using Android Studio and not IntelliJ.

#! /bin/sh

wid=$1
class=$2

[[ "$class" = "jetbrains-studio" ]] && [[ $(xtitle "$wid") =~ ^win[0-9]*$ ]] && echo "manage=off";