changes for initial gui setup and discovery of the terminal program to use, avoid using TERM env variable
This commit is contained in:
parent
fd2a5ec290
commit
34895c1f9c
3 changed files with 30 additions and 34 deletions
|
@ -5,6 +5,7 @@ import json
|
|||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from tkinter import messagebox
|
||||
from typing import TYPE_CHECKING, Dict, List
|
||||
|
||||
import grpc
|
||||
|
@ -38,17 +39,6 @@ OBSERVERS = {
|
|||
"IPSec policies": "setkey -DP",
|
||||
}
|
||||
|
||||
DEFAULT_TERMS = {
|
||||
"xterm": "xterm -e",
|
||||
"aterm": "aterm -e",
|
||||
"eterm": "eterm -e",
|
||||
"rxvt": "rxvt -e",
|
||||
"konsole": "konsole -e",
|
||||
"lxterminal": "lxterminal -e",
|
||||
"xfce4-terminal": "xfce4-terminal -x",
|
||||
"gnome-terminal": "gnome-terminal --window --",
|
||||
}
|
||||
|
||||
|
||||
class CoreServer:
|
||||
def __init__(self, name: str, address: str, port: int):
|
||||
|
@ -571,11 +561,15 @@ class CoreClient:
|
|||
def launch_terminal(self, node_id: int):
|
||||
try:
|
||||
terminal = self.app.guiconfig["preferences"]["terminal"]
|
||||
if not terminal:
|
||||
messagebox.showerror(
|
||||
"Terminal Error",
|
||||
"No terminal set, please set within the preferences menu",
|
||||
parent=self.app,
|
||||
)
|
||||
return
|
||||
response = self.client.get_node_terminal(self.session_id, node_id)
|
||||
output = os.popen(f"echo {terminal}").read()[:-1]
|
||||
if output in DEFAULT_TERMS:
|
||||
terminal = DEFAULT_TERMS[output]
|
||||
cmd = f'{terminal} "{response.terminal}" &'
|
||||
cmd = f"{terminal} {response.terminal} &"
|
||||
logging.info("launching terminal %s", cmd)
|
||||
os.system(cmd)
|
||||
except grpc.RpcError as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue