Open despin opened 4 years ago
Anything that is a binary (Programs in $PATH) opened on a terminal window. Perhaps the terminal or its additional parameters can be configurable through a configuration file.
@despin how would the command line programs run? How could I select the correct terminal to open if so?
You could maybe use NSWorkspace.shared.openFile(app.path)
, which opens the file with the default program (in this case, an executable program such as nvim should open with the Terminal).
I forked your repository and gave it a quick go, and by all means, im not familiar with swift
as a programming language but was interested if i could get something to work at least.
Hi! Perhaps I can add on preferences an optional list of additional paths to look for. What do you think?
Yeah that would be good to do. 👍
Do you have any update on this? @oNaiPs
I use the following apple script to open terminal apps in new iTerm windows. Perhaps this code could be reworked for dmenu?
on alfred_script(q)
if application "iTerm2" is running or application "iTerm" is running then
run script "
on run {q}
tell application \"iTerm\"
activate
try
create window with default profile
select first window
end try
tell the first window
tell current session to write text q
end tell
end tell
end run
" with parameters {q}
else
run script "
on run {q}
tell application \"iTerm\"
activate
try
create window with default profile
select first window
end try
tell the first window
tell current session to write text q
end tell
end tell
end run
" with parameters {q}
end if
end alfred_script
Also, I believe the following command can be used to list all valid terminal commands, functions, and aliases and the options could be passed to dmenu to launch with the apple script above.
compgen -bc
Again, not sure if this would be useful but I thought I would post it because was working on a terminal launcher like rofi for macos before I found this project. I'd love to contribute in any way that I can!
Did a little more tinkering and I can get somewhat close to the desired outcome.
compgen -bc | dmenu-mac -p "Launch" | xargs ~/.scripts/.terminal
and the .terminal
script is as follows.
#!/usr/bin/env zsh
$q=$1
osascript<<EOF
on alfred_script(q)
if application "iTerm" is running or application "iTerm" is running then
run script "
on run {q}
tell application \"iTerm\"
activate
try
create window with default profile
select first window
end try
tell the first window
tell current session to write text q
end tell
end tell
end run
" with parameters {q}
else
run script "
on run {q}
tell application \"iTerm\"
activate
try
create window with default profile
select first window
end try
tell the first window
tell current session to write text q
end tell
end tell
end run
" with parameters {q}
end if
end alfred_script
EOF
The only problem is that the command does not execute in a new iTerm window, even though this works properly in Alfred. Not sure why but it can probably be blamed on my lack of knowledge of Applescript.
I just add this because it might be interesting: https://github.com/knazarov/dotfiles/tree/master/bin
Nazarovs launcher and popup makes alacritty into a spotlight search window. Maybe it can add some ideas/inspiration.
+1 to this. I just found dmenu-mac trying to find a way to launch acme
from plan9ports without wasting a terminal on it and was disappointed to find that the program doesn't actually handle the most common use case for dmenu (dmenu_run)
@despin how would the command line programs run? How could I select the correct terminal to open if so?