A drop-down terminal (sometimes called Quake-style) is one that can be quickly invoked and hidden with a keystroke.
This can be easily done by setting up a system keybinding
for either domterm window toggle-minimize
or domterm window toggle-hide
.
These currently only work for the Electron front-end.
These commands will create a window if it doesn’t exist,
make it visible if it is minimized/hidden,
and minimize/hide it if it is visible.
The difference between toggle-minimize
and toggle-hide
is that an minimized window may be still visible in the task bar,
as an icon on the desktop, or during an “windows expose” operation;
a hidden window is not. (This depends on the desktop environment.)
If you’re using the Gnome desktop (common on GNU/Linux systems),
enter the system (desktop) Settings
application,
and select Devices
and Keyboard shortcurs
.
Click the +
at the bottom to add a new custom shortcut.
You can then bind your preferred keybinding (F5
in the screenshot)
to the domterm toggle-minimizew
(or toggle-hide
) command.
(The screenshot uses a fully-qualifed path for domterm
,
just in case.)
We need to bind a shortcut key (hotkey) to a command like:
wsl -e /mnt/c/path-to-domterm/bin/domterm --geometry=775x600+20+10 window toggle-minimize
where the --geometry
option is an optional geometry specifier,
and /mnt/c/path-to-domterm
is the location of your DomTerm installation.
Note this needs to be a Unix-style path (since it is executed by wsl
)
to a Windows directory (so Electron can find the needed files).
(The -e
flag is an optimization so WSL doesn’t create a shell
to parse the command arguments; remove that flag if shell expansion is needed.)
We will look at some possible ways to bind the “hot-key”.
AutoHotkey is a popular,
flexible and somewhat complex tool.
After downloading and installing it,
you need to create a script (in a file with extension .ahk
).
The following .ahk
script file will toggle domterm
when you type Ctrl+Alt+t, specified by the ^!t
pattern:
^!t:: run, wsl -e "/mnt/c/path-to-domterm/bin/domterm" --geometry=775x600+20+10 window toggle-minimize,,hide return
The hide
option prevents briefly flashing a temporary console window.
A simpler application is myhotkey. A minor disadvantage (compared to AutoHotkeys) is that you can’t hide the flash of the temporary console window.
Using standard Windows desktop shortcuts is simple and doesn’t require installing new tools. Unfortunately, they are are suspectible to multi-second delays, because of because of this issue.
One way is to do define a desktop shortcut.
(This article with screenshots as well
on this article may be helpful.)
Start by right clicking on the desktop and select New
->Shortcut
.
At Type the location of the item:
type the above wsl ...
command,
and the Next screen I suggest a name like toggle-domterm
.
This add a new entry on the desktop.
Right-click it, select Properties
->Shortcut
.
In the Shortcut key
field, type T
which is converted to Ctrl + Alt + T
(or use some other key you prefer).
In the Run
field, select Minimized
(to
avoid the flicker of a temporary command window).
Unfortunately, you are likely to experience a multi-second delay, because of this issue.
By default the terminal will have a default size and position,
though if you resize and move the window, it should remember the
size and position if you then hide and unhide it.
You can use a geometry specifier to give an
explicit position when it is created,
either in the Settings file, or with a --geometry
option:
domterm --geometry 775x600+20+10 window toggle-minimize