nikitabobko / AeroSpace

AeroSpace is an i3-like tiling window manager for macOS
https://nikitabobko.github.io/AeroSpace/guide
MIT License
8k stars 131 forks source link

Question: how do I run a script in iTerm/Kitty using a keybind? #607

Closed pedroandrepi closed 1 month ago

pedroandrepi commented 1 month ago

Hello, my question is really simple, although I have not found an answer. I just bought a Macbook and my former PC was a Linux machine (in which I ran i3wm). In i3 I had the following bind: "bindsym $mod+Ctrl+Shift+q exec kitty -e --hold python ~/RandomISS.py" I decided to try and run it in my mac through AeroSpace, but I can't seem to find a way to run a program and inject a script into it just like I did in i3. Is there a way to do this in AeroSpace?

I tried 'alt-shift-z = 'exec-and-forget open -n /Applications/iTerm.app python ~/RandomISS.py'', as well as 'exec-and-forget open -n /Applications/kitty.app -e python ~/RandomISS.py' (and many other variations, to no avail.

Thanks for your help.

Checklist

hwamil commented 1 month ago

I believe you can use exec-and-forget <CMD>

edit: oh nvm you already tried. I don't use the feature ;-;

bekaman7 commented 1 month ago

there are two arguments missing from your open command:

pedroandrepi commented 1 month ago

there are two arguments missing from your open command:

* first you have to add -a (you could combine with n to have -na) which actually tells open what application to open

* second, to pass arguments to an app opened with open you have to add --args and after that all the arguments that you want to pass to the actual app

@bndkkmn I tried this, but it did not work, and also with --args at the end:

alt-shift-x = 'exec-and-forget open -na --args "python3 ~/RandomISS.py" /Applications/iTerm.app'

What am I doing wrong?

bekaman7 commented 1 month ago

your order of arguments is wrong. After -a the app itself must come. And --args with the arguments to the app must come at the very end like this: open -na /Applications/iTerm.app --args "python3 ~/RandomISS.py"

And I think with Iterm you have to pass the --command argument: open -na /Applications/iTerm.app --args --command="python3 ~/RandomISS.py"

nikitabobko commented 1 month ago

Closing because it's not an AeroSpace issue. Feel free to keep the discussion

pedroandrepi commented 1 month ago

@bekaman7 @bndkknm Thank you