Emacs newbie here. I simply want to setup Emacs GUI to toggle hide/show(visibility) just like we see in guake, tilda or yakuake terminals. for example I have am working with Emacs within GUI and I have a browser window behind it, I want to hide Emacs with a shortcut(e.g F12) and then I will see my browser and will be able to interact with it and other windows, then again press F12 and I will have my Emacs GUI back. If it is not possible from inside Emacs, can I do this from desktop(running KDE 5.13).
Asked
Active
Viewed 338 times
2
-
1Please explain in more detail what "toggle hide/show(visibility)" means for people that do not know guake, tilda, or yakuake. Note that `C-z` is bound to the command `suspend-frame` which hides the active emacs frame. – Tobias Aug 14 '18 at 07:40
-
@Tobias thanks for your comment. I updated the question to better explain the question. – milad zahedi Aug 14 '18 at 08:12
-
1Please try `C-z`, i.e., hold the control key down and press the z-key. The emacs frame will be hidden. Pressing `C-z` again reveals the emacs frame again. Is that what you want? Note, I've tested that under Windows10/cygwin. Don't know wether it works under X11/KDE. It should work. – Tobias Aug 14 '18 at 08:27
-
@Tobias I tried and it didn't work. I don't think that you will be able to interact with the browser after `C-z`. I want the GUI to go completely away and let me interact with other windows, and then then bring it back with focus on the emacs GUI. – milad zahedi Aug 14 '18 at 09:43
-
1You wrote in your comment: "I don't think that you will be able to interact with the browser after `C-z`. I want the GUI to go completely away and let me interact with other windows". But you wrote in your question: "I want to hide Emacs with a shortcut(e.g F12) and then I will see my browser, then again press F12 and I will see my Emacs GUI". `C-z` does exactly what you wrote in your question (at least under Win10/cygwin) but not what you wrote in your comment. I think you should update your question with the relevant text from your comment. – Tobias Aug 14 '18 at 09:49
-
@Tobias you are absolutely right. I did update my question again. – milad zahedi Aug 14 '18 at 11:32
-
2I really do think it's more of a window manager question... – manandearth Aug 14 '18 at 20:09
-
@manandearth, it is likely related to window manager, but since the mentioned terminal have built-in support for this feature( and since it is such a useful feature), I thought maybe Emacs have it built in. – milad zahedi Aug 15 '18 at 05:32
-
If Emacs (or your terminal for that matter) does not have focus in the window manager, then Emacs has no idea if you have pressed F12 (or anything else). You would need to tell your window manager that pressing F12 should make it look for an Emacs frame and do the appropriate thing. I would guess that the terminals you mention are installing some kind of similar support. – phils Aug 23 '18 at 00:12
2 Answers
2
I use this script (I found it, it is in Russian):
#!/bin/bash
######################################################################################################
# This script will toggle minimize/activate first window with specified class
# If window not found program will be launched
#
# window class can be found with next programs:
# wmctrl -x -l
# xprop
# No credit taken.......... Cannot read the original.....
# Found on http://blog.sokolov.me/2014/06/20/linuxx11-toggle-window-minimizemaximize/
# in Russian :) but works when adjusting the wrapping.
######################################################################################################
NEEDED_WINDOW_CLASS="emacs.Emacs"
LAUNCH_PROGRAM="emacs"
######################################################################################################
NEEDED_WINDOW_WINDOW_ID_HEX=`wmctrl -x -l | grep ${NEEDED_WINDOW_CLASS} | awk '{print $1}' | head -n 1`
NEEDED_WINDOW_WINDOW_ID_DEC=$((${NEEDED_WINDOW_WINDOW_ID_HEX}))
if [ -z "${NEEDED_WINDOW_WINDOW_ID_HEX}" ]; then
${LAUNCH_PROGRAM}
else
echo "Found window ID:${NEEDED_WINDOW_WINDOW_ID_DEC}(0x${NEEDED_WINDOW_WINDOW_ID_HEX})"
ACIVE_WINDOW_DEC=`xdotool getactivewindow`
if [ "${ACIVE_WINDOW_DEC}" == "${NEEDED_WINDOW_WINDOW_ID_DEC}" ]; then
xdotool windowminimize ${NEEDED_WINDOW_WINDOW_ID_DEC}
else
xdotool windowactivate ${NEEDED_WINDOW_WINDOW_ID_DEC}
fi
fi
Assign the script to a hotkey.

Steve Fisher
- 36
- 1
-
-
-
1@miladzahedi In Gnome. Go to System Settings -> keyboard -> shortcuts. Click on + to add a custom shortcut. Name it anything. Make sure your script has executable permission. – slk500 May 15 '22 at 21:24
0
I found two Emacs packages for this, one if yequake which does exactly what you asked for (makes the Emacs GUI to work like you want):
and there is equake which does this for shells of Emacs:
Both have their own merits and potentials. I personally would rather use yequake as I would like to be able to see images and PDFs in my Emacs, and I don't heavily use eshell/term/ansi-term. Also there is Yakuake in KDE which is an amazing terminal and does everything I want.

Mehrad Mahmoudian
- 131
- 5