How to keep android emulator always on top in ubuntu 14.04 I am using Android Studio 2.1.1 and emulator version of 25.1.6 It was working before updating Android SDK Tools to 25.1.6.
I had the same issue. I solved it like below:
First of all be aware that emulator has two different windows that are attached to each other.
- Right Click emulator top bar, and set it as always on top
- Right Click emulator icon on the dash, and choose "Emulator" this time use shortcut ALT + SPACE to reveal context menu and again choose always on top.
And that's it!
Note : every time you minimizes emulator window, do steps above again.
ALT
+ space
! It really worked. –
Shy On active widow emulator, press alt + space, select always on top.
...
three dot menu in "Settings" there is "Show window frame around device" disabled, alternatively, you can enable it and then you can see the square(nine dots menu) on the system window which displays the same as the alt
+ space
:) –
Indigenous Fast way in terminal (toggle always_on_top):
wmctrl -i -r $(wmctrl -l | grep ' Android Emulator - ' | sed -e 's/\s.*$//g') -b toggle,above
wmctrl -i -r $(wmctrl -l | grep ' Emulator$' | sed -e 's/\s.*$//g') -b toggle,above
.bashrc
. –
Estell I know that this question if for Ubuntu, but anyone who wants another solution, as me on Debian, you could try this:
- Right click on taskbar over "Android Emulator"
- More Actions
- Keep Above Others
Click on the more option button on the side bar of your emulator. Go into settings. Active the option 'Show window frame around device'. Then right click on the window frame of your emulator. Click on the option 'Always on top'. That's it.
Andrey Izman's answer is good, but the "always on top" feature is lost when the emulator is minimized...
Based on his code, I've written a shell script that activates "always on top" whenever the emulator is maximized, and deactivates the feature whenever it's minimized. With minor adaptation, this script can work for any application in Linux.
Here is the code for the script:
#!/bin/bash
# get the window ID of the target window
WINDOW_ID=$(wmctrl -l | grep "Android Emulator - " | awk '{print $1}')
# define the code to execute when the window is maximized
function on_maximize() {
wmctrl -i -r $(wmctrl -l | grep ' Android Emulator - ' | sed -e 's/\s.*$//g') -b add,above
wmctrl -i -r $(wmctrl -l | grep ' Emulator$' | sed -e 's/\s.*$//g') -b add,above
}
# define the code to execute when the window is minimized
function on_minimize() {
wmctrl -i -r $(wmctrl -l | grep ' Android Emulator - ' | sed -e 's/\s.*$//g') -b remove,above
wmctrl -i -r $(wmctrl -l | grep ' Emulator$' | sed -e 's/\s.*$//g') -b remove,above
}
# set initial window state to "unknown"
WINDOW_STATE="unknown"
# loop forever and check for window events
while true; do
# wait for the window to be maximized or minimized
geometry_output=$(xdotool getwindowgeometry $WINDOW_ID 2>&1)
# check if the window was maximized or minimized
if [[ "$(xprop -id $WINDOW_ID _NET_WM_STATE | grep '_NET_WM_STATE_HIDDEN')" != "" ]]; then
if [[ "$WINDOW_STATE" != "minimized" ]]; then
WINDOW_STATE="minimized"
on_minimize
fi
else
if [[ "$WINDOW_STATE" != "maximized" ]]; then
WINDOW_STATE="maximized"
on_maximize
fi
fi
# discard the output of the xdotool command
echo "$geometry_output" > /dev/null
done
Now follow these steps:
Make sure
wmctrl
is installed in your system by trying thewmctrl -l
command. For Debian-based systems, you can install it withsudo apt-get install wmctrl
.Save the script as a .sh file in any location, for example
~/scripts/emulator_always_on_top.sh
.Execute it in terminal with
~/scripts/emulator_always_on_top.sh &
. The&
is important to run it as a daemon (background process).
And voilà!
To turn it off you need to manually kill the process. Look for the emulator_always_on_top.sh
process in System Monitor and kill it. Maybe I'll tweak out for an easier way someday...
Kindly accepting comments aiming to improve this approach!
P.S.: Credits for GPT for helping me write this code! Although it took several iterations to achieve success.
© 2022 - 2025 — McMap. All rights reserved.