2017-08-18 1 views

Antwort

1

Das folgende Skript die tty der vordersten Terminal-Fenster zurückzugibt, oder die leere Zeichenkette, wenn alle diese Fenster minimieren/versteckt:

#!/usr/bin/env osascript 

tell application "Terminal" 
    if frontmost is true 
    repeat with w in windows 
     if (frontmost of w) is true then 
     set t to (selected tab of w) 
     return (tty of t) as string 
     end if 
    end repeat 
    end if 
end tell 

Verbrauch:

$ frontmost-tty 
/dev/ttys001 
$ tty 
/dev/ttys001 
$ sleep 5 ; frontmost-tty # switch Terminals 
/dev/ttys000 
+0

Als Skript: https://github.com/ithinkihaveacat/dotfiles/blob/master/fish/functions/terminal-frontmost.fish – mjs

Verwandte Themen