mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Support for io.elementary.terminal
This commit is contained in:
parent
f0911fbe41
commit
ca6d5122c2
4 changed files with 44 additions and 30 deletions
|
|
@ -181,8 +181,44 @@ void RemoveConsoleScripts()
|
|||
FileDelete(ff.GetPath());
|
||||
}
|
||||
}
|
||||
|
||||
String ResolveHostConsole()
|
||||
{
|
||||
String lc;
|
||||
|
||||
#ifdef PLATFORM_BSD
|
||||
static const char *term[] = {
|
||||
"/usr/local/bin/mate-terminal -x",
|
||||
"/usr/local/bin/gnome-terminal --window -x",
|
||||
"/usr/local/bin/konsole -e",
|
||||
"/usr/local/bin/lxterminal -e",
|
||||
"/usr/local/bin/io.elementary.terminal -n -x",
|
||||
"/usr/local/bin/xterm -e",
|
||||
};
|
||||
#else
|
||||
static const char *term[] = {
|
||||
"/usr/bin/mate-terminal -x",
|
||||
"/usr/bin/gnome-terminal --window -x",
|
||||
"/usr/bin/konsole -e",
|
||||
"/usr/bin/lxterminal -e",
|
||||
"/usr/bin/io.elementary.terminal -n -x",
|
||||
"/usr/bin/xterm -e",
|
||||
};
|
||||
#endif
|
||||
int ii = 0;
|
||||
for(;;) { // If (pre)defined terminal emulator is not available, try to find one
|
||||
int c = HostConsole.Find(' ');
|
||||
lc = c < 0 ? HostConsole : HostConsole.Left(c);
|
||||
if(ii >= __countof(term) || FileExists(lc))
|
||||
break;
|
||||
HostConsole = term[ii++];
|
||||
}
|
||||
return lc;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void Host::Launch(const char *_cmdline, bool console)
|
||||
{
|
||||
String cmdline = FindCommand(exedirs, _cmdline);
|
||||
|
|
@ -216,33 +252,7 @@ void Host::Launch(const char *_cmdline, bool console)
|
|||
if(console)
|
||||
cmdline = "/usr/bin/open " + script;
|
||||
#else
|
||||
String lc;
|
||||
|
||||
#ifdef PLATFORM_BSD
|
||||
static const char *term[] = {
|
||||
"/usr/local/bin/mate-terminal -x",
|
||||
"/usr/local/bin/gnome-terminal --window -x",
|
||||
"/usr/local/bin/konsole -e",
|
||||
"/usr/local/bin/lxterminal -e",
|
||||
"/usr/local/bin/xterm -e",
|
||||
};
|
||||
#else
|
||||
static const char *term[] = {
|
||||
"/usr/bin/mate-terminal -x",
|
||||
"/usr/bin/gnome-terminal --window -x",
|
||||
"/usr/bin/konsole -e",
|
||||
"/usr/bin/lxterminal -e",
|
||||
"/usr/bin/xterm -e",
|
||||
};
|
||||
#endif
|
||||
int ii = 0;
|
||||
for(;;) { // If (pre)defined terminal emulator is not available, try to find one
|
||||
int c = HostConsole.FindFirstOf(" ");
|
||||
lc = c < 0 ? HostConsole : HostConsole.Left(c);
|
||||
if(ii >= __countof(term) || FileExists(lc))
|
||||
break;
|
||||
HostConsole = term[ii++];
|
||||
}
|
||||
String lc = ResolveHostConsole();
|
||||
if(FileExists(lc))
|
||||
{
|
||||
if(console)
|
||||
|
|
|
|||
|
|
@ -50,5 +50,6 @@ private:
|
|||
};
|
||||
|
||||
#ifdef PLATFORM_POSIX
|
||||
void RemoveConsoleScripts();
|
||||
void RemoveConsoleScripts();
|
||||
String ResolveHostConsole();
|
||||
#endif
|
||||
|
|
@ -196,10 +196,13 @@ void Ide::LaunchTerminal(const char *dir)
|
|||
;
|
||||
h.Launch("/usr/bin/open " + script);
|
||||
#else
|
||||
ResolveHostConsole();
|
||||
String c = HostConsole;
|
||||
int q = c.Find(' ');
|
||||
int q = c.ReverseFind(' ');
|
||||
if(q >= 0)
|
||||
c.Trim(q);
|
||||
if(c.Find("io.elementary.terminal") >= 0) // elementary seems to ignore current dir
|
||||
c << " -w \"" << dir << "\"";
|
||||
h.Launch(Nvl(c, "/usr/bin/xterm"), false);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ file
|
|||
theide.desktop,
|
||||
Repo readonly separator,
|
||||
urepo.h,
|
||||
RepoConsole.cpp,
|
||||
RepoConsole.cpp readonly,
|
||||
RepoSync.cpp,
|
||||
Credentials.cpp,
|
||||
Diff.cpp,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue