Skip to content
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

support new macOS(mojave and Big Sur) #106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 22 additions & 24 deletions csshX
Original file line number Diff line number Diff line change
Expand Up @@ -516,35 +516,33 @@ sub open_window {
my $cmd = join ' ', map { s/(["'])/\\$1/g; "'$_'" } @args;

# don't exec if debugging so we can see errors
unless ($config->debug) {
if (get_shell =~ /fish$/) {
$cmd = "clear; and exec $cmd" unless $config->debug;
} else {
$cmd = "clear && exec $cmd" unless $config->debug;
}
}
$cmd = "clear && exec $cmd" unless $config->debug;

# Hide the command from any shell history
$cmd = 'history -d $(($HISTCMD-1)) && '.$cmd if get_shell =~ m{/(ba)?sh$};
# TODO - (t)csh, ksh, zsh

my $tabobj = $terminal->doScript_in_($cmd, undef) || return;

# Get the window and tab IDs from the Apple Event itself
my $tab_ed = $tabobj->qualifiedSpecifier; # Undocumented call
my $tab_id = $tab_ed->descriptorForKeyword_(OSType 'seld')->int32Value-1;
my $win_ed = $tab_ed->descriptorForKeyword_(OSType 'from');
my $win_id = $win_ed->descriptorForKeyword_(OSType 'seld')->int32Value.'';

# Create an object unless we were passed one
my $obj = ref $pack ? $pack : $pack->SUPER::new();
$obj->set_windowid($win_id);
$obj->set_tabid($tab_id);

return $obj;
my $tty = $tabobj->tty->UTF8String || return;

my $windows = $terminal->windows;
# Quickly check if the tty even exists, since the next code is REALLY slow
#return unless grep { $tty eq $_ } @{Foundation::perlRefFromObjectRef $windows->valueForKey_("tty")};
for (my $n=0; $n<$windows->count; $n++) {
my $window = $windows->objectAtIndex_($n);
my $tabs = $window->tabs;
for (my $m=0; $m<$tabs->count; $m++) {
my $tab = $tabs->objectAtIndex_($m);
if ($tab->tty && ($tab->tty->UTF8String eq $tty)) {
my $obj = ref $pack ? $pack : $pack->SUPER::new();
$obj->set_windowid("".$window->id);
$obj->set_tabid($m);
return $obj;
}
}
}
}


sub set_windowid { *{$_[0]}->{windowid} = $_[1]; }
sub windowid { *{$_[0]}->{windowid}; }

Expand Down Expand Up @@ -1189,9 +1187,9 @@ sub parse_user_host_port {

package CsshX::Launcher;

use base qw(CsshX::Socket::Selectable);
use POSIX qw(tmpnam);
use FindBin qw($Bin $Script);;
use base qw(CsshX::Socket::Selectable);
use File::Temp qw(tmpnam);
use FindBin qw($Bin $Script);;

sub new {
my ($pack) = @_;
Expand Down