How to keep android emulator always on top in ubuntu 14.04
Asked Answered
M

7

29

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.

Miscellaneous answered 23/5, 2016 at 6:6 Comment(2)
An issue is filed at ASOP regarding this code.google.com/p/android/issues/detail?id=206796Catanzaro
And last comment on that issues is mine.Miscellaneous
M
76

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.

  1. Right Click emulator top bar, and set it as always on top
  2. 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.

Menchaca answered 8/7, 2016 at 19:45 Comment(2)
what was the need of big caps here, it made it reading horrendousClaudetta
Thank you so much for remember me the obvious: ALT + space! It really worked.Shy
C
59

On active widow emulator, press alt + space, select always on top.

Councillor answered 22/10, 2019 at 14:53 Comment(3)
Its the best answer.Butacaine
Yeah, and looks like cross-DM one, at least it works in Openbox too.Lather
The reason why it's hidden is because in the ... 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
K
7

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
Katzir answered 25/4, 2018 at 8:19 Comment(1)
Couldn't toggle with any right-clicking on Linux Mint 20 (possibly just clicking on the wrong stuff), but this solution worked like a charm! I made a function for it in my .bashrc.Estell
R
1

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
Rathbone answered 2/6, 2020 at 19:39 Comment(1)
That's DM specific, it may work in e.g. in Gnome, but in e.g. Openbox there is no such menu yet.Lather
S
1

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.

Skardol answered 1/8, 2022 at 9:4 Comment(0)
O
1

Its work for Windows

-> follow 2 steps:-

enter image description here

Oxheart answered 2/9, 2022 at 8:1 Comment(1)
The question is for Ubuntu.Mistress
M
0

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:

  1. Make sure wmctrl is installed in your system by trying the wmctrl -l command. For Debian-based systems, you can install it with sudo apt-get install wmctrl.

  2. Save the script as a .sh file in any location, for example ~/scripts/emulator_always_on_top.sh.

  3. 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.

Mistress answered 10/5, 2023 at 2:34 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.