Setting up a Dropdown terminal #1556
paulodiovani
started this conversation in
general
Replies: 1 comment
|
I updated the config to allow Aerospace to close an existing dropdown window, if any, on # ~/.config/aerospace/aerospace.toml
# Dropdown terminal
ctrl-esc = '''exec-and-forget \
WINID=$(aerospace list-windows --all --json | jq '.[] | select(."window-title"=="Dropdown terminal") | ."window-id"')
[ -n "$WINID" ] && aerospace close --window-id "$WINID" || \
(
pgrep -x alacritty > /dev/null && \
alacritty msg create-window \
--title='Dropdown terminal' \
-o window.position.y=0 -o window.position.x=0 \
-o window.dimensions.lines=35 -o window.dimensions.columns=240 || \
open -na /Applications/Alacritty.app --args \
--title='Dropdown terminal' \
-o window.position.y=0 -o window.position.x=0 \
-o window.dimensions.lines=35 -o window.dimensions.columns=240
)
'''For this to work onmacOSs, Alacritty must have window borders. On the contrary, Aerospace cannot close the terminal. # ~/.config/alacritty/alacritty.toml
[window]
decorations = "Buttonless"Here is the full diff from my dotfiles, where I have different Alacritty configs for Linux or macOS. diff --git a/home/user/.config/aerospace/aerospace.toml b/home/user/.config/aerospace/aerospace.toml
index 6cf5687..ed72388 100644
--- a/home/user/.config/aerospace/aerospace.toml
+++ b/home/user/.config/aerospace/aerospace.toml
@@ -110,15 +110,20 @@ cmd-enter = '''exec-and-forget pgrep -x alacritty > /dev/null && \
'''
# Dropdown terminal
-ctrl-esc = '''exec-and-forget pgrep -x alacritty > /dev/null && \
- alacritty msg create-window \
- --title='Dropdown terminal' \
- -o window.position.y=0 -o window.position.x=0 \
- -o window.dimensions.lines=35 -o window.dimensions.columns=240 || \
- open -na /Applications/Alacritty.app --args \
- --title='Dropdown terminal' \
- -o window.position.y=0 -o window.position.x=0 \
- -o window.dimensions.lines=35 -o window.dimensions.columns=240
+ctrl-esc = '''exec-and-forget \
+ WINID=$(aerospace list-windows --all --json | jq '.[] | select(."window-title"=="Dropdown terminal") | ."window-id"')
+ [ -n "$WINID" ] && aerospace close --window-id "$WINID" || \
+ (
+ pgrep -x alacritty > /dev/null && \
+ alacritty msg create-window \
+ --title='Dropdown terminal' \
+ -o window.position.y=0 -o window.position.x=0 \
+ -o window.dimensions.lines=35 -o window.dimensions.columns=240 || \
+ open -na /Applications/Alacritty.app --args \
+ --title='Dropdown terminal' \
+ -o window.position.y=0 -o window.position.x=0 \
+ -o window.dimensions.lines=35 -o window.dimensions.columns=240
+ )
'''
# See: https://nikitabobko.github.io/AeroSpace/commands#layout
diff --git a/home/user/.config/alacritty/alacritty.toml b/home/user/.config/alacritty/alacritty.toml
index 9dc2a51..5f94ba5 100644
--- a/home/user/.config/alacritty/alacritty.toml
+++ b/home/user/.config/alacritty/alacritty.toml
@@ -20,9 +20,5 @@ action = "ToggleViMode"
key = "Q"
mode = "Vi"
-[window]
-decorations = "none"
-opacity = 0.95
-
[general]
import = ["~/.config/os-config/alacritty/alacritty.toml"]
diff --git a/home/user/.config/darwin-config/alacritty/alacritty.toml b/home/user/.config/darwin-config/alacritty/alacritty.toml
index cfe76fb..5556c9d 100644
--- a/home/user/.config/darwin-config/alacritty/alacritty.toml
+++ b/home/user/.config/darwin-config/alacritty/alacritty.toml
@@ -28,3 +28,7 @@ bindings = [
[selection]
save_to_clipboard = true
+
+[window]
+decorations = "Buttonless"
+opacity = 0.95
diff --git a/home/user/.config/linux-config/alacritty/alacritty.toml b/home/user/.config/linux-config/alacritty/alacritty.toml
index b3d91c6..35c162c 100644
--- a/home/user/.config/linux-config/alacritty/alacritty.toml
+++ b/home/user/.config/linux-config/alacritty/alacritty.toml
@@ -17,3 +17,7 @@ mods = "Control|Shift"
[hints.enabled.mouse]
enabled = true
mods = "Shift"
+
+[window]
+decorations = "none"
+opacity = 0.95 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to create a generic script for a Dropdown Terminal (using
Ctrl+Escin my settings) that should work with any terminal.Goals
Config attempts
Attempt 01
Fully managed by Aerospace
Aerospace can use
on-window-detectedto detect windows and make it float, but cannot move or resize floating windows.Attempt 02
Partially managed by Aerospace + Apple Script to move/resize.
Alacritty won't accept it. Neither will Kitty.
It looks like the application must be scriptable for this to work. -- I'm not quite what that means (source: https://stackoverflow.com/a/12021536).
Attempt 03
Partially managed by Aerospace + Terminal startup options to move/resize.
Most terminal emulators have command line options that allow to set window dimensions and position.
For Alacritty we can use the
windowoptions with -o.window.dimensions.linesto anything less than35the window is not positioned at the top.Partially working solution (columns and lines may change according to screen resolution):
TODO / Missing features
If anyone has an alternative solution, please share in the comments.
Updates
All reactions