-
-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Hotkey Window #510
Comments
Thanks for trying to help @kjvdven. |
This might be what you are looking for: #296 |
Thanks! This looks like an overly complex solution. |
In case someone lands here, now that #186 was completed, I extended my own version of the script from #296 (comment) and got XMonad like scratchpad to work that's close to what you are looking for. #!/usr/bin/env bash
set -euo pipefail
APP_ID="$1"
APP_NAME="$2"
CURRENT_WORKSPACE=$(aerospace list-workspaces --focused)
get_window_id() {
aerospace list-windows --all --format "%{window-id}%{right-padding} | %{app-name}" |
grep "$APP_NAME" |
cut -d' ' -f1 |
head -n1
}
focus_app() {
local app_window_id
app_window_id=$(get_window_id)
aerospace move-node-to-workspace "$CURRENT_WORKSPACE" --window-id "$app_window_id"
aerospace focus --window-id "$app_window_id"
}
is_app_closed() {
! aerospace list-windows --all --format '%{app-name}' | grep -q "$APP_NAME"
}
move_app_to_scratchpad() {
local app_window_id
app_window_id=$(aerospace list-windows --workspace "$CURRENT_WORKSPACE" --format "%{window-id}%{right-padding} | %{app-name}" |
grep "$APP_NAME" |
cut -d' ' -f1 |
head -n1)
aerospace move-node-to-workspace NSP --window-id "$app_window_id"
}
main() {
if is_app_closed; then
open -a "$APP_NAME"
sleep 0.5
elif aerospace list-windows --workspace "$CURRENT_WORKSPACE" --format "%{app-bundle-id}" | grep -q "$APP_ID"; then
move_app_to_scratchpad
else
focus_app
fi
}
main And I configure it in cmd-shift-a = 'exec-and-forget /Users/me/.config/scratchpad/nsp.sh com.aptakube.Aptakube Aptakube'
cmd-shift-s = 'exec-and-forget /Users/me/.config/scratchpad/nsp.sh org.whispersystems.signal-desktop Signal'
cmd-shift-e = 'exec-and-forget /Users/me/.config/scratchpad/nsp.sh org.gnu.Emacs Emacs' I am quite pleased with the results and almost don't miss XMonad. |
Thanks for sharing your solution @x418. |
This is very nice @x418 . I have an issue with this; was wondering if you have a workaround (or maybe you don't face that issue). I'm using it to "toggle" my WezTerm terminal (right now, I'm doing things in Hammerspoon, which involves adjust the size of the window as well) With this script, whenever I choose to "show" the window, seems like AeroSpace first tries to fit it in the layout and then realizes I've set it to be floating, but the size stays as it was when AeroSpace tried to fit it in the layout. |
I am afraid I won't be of much help here (never used Hammerspoon). My workflow with Alacritty/WezTerm is quite simple as a one-off terminal (as I don't use any of its fancy features). If you haven't already, perhaps the callbacks maybe of use ? |
Thank you for your answer @x418 . Maybe I shouldn't have mentioned Hammerspoon as the issue here is somehow "pure" AeroSpace. I mentioned Hammerspoon only because that's what I'm using now to toggle my terminal, and I was hoping to replace it with the script you provided, but, for some reason, the window size changes when I toggle it. BUT ... as I was writing this, I gave it another try ... and:
I really wish AeroSpace allowed resizing floating windows 🙁 |
This is excellent. Saved me from uninstalling Aerospace actually. I only miss the option to add any window to scratchpad. But I don't think it's too much work on a script above to add it. But that's only 10% of my scratchpad use cases and so much more stuff to customize :) |
It would be very useful to be able to set a keybinding that activates or hides an application window on the currently aktive screen/workspace.
The goal is to achieve something like the drop down terminal Guake, or Dedicated Hotkey Windows in iTerm.
I'm aware of
exec-and-forget open <app>
andmove-node-to-workspace
, but haven't found a strategy to achieve the above with these commands.If it is already possible to achieve this with the current Aerospace feature set, consider this a question.
Otherwise consider this a feature request.
Thanks!
The text was updated successfully, but these errors were encountered: