qterminal
qterminal copied to clipboard
[Feature request] Open Qterminal with custom tab, title, cmd
I've been trying to get Qterminal to open with custom specific tabs, titles and commands, but this is as close as I'm able to get with python and dbus, it would be lovely if this could be implemented..
Set Tab/Terminal Title: Already possible by double clicking the tab/terminal title
Exec Cmd: Already possible by double clicking a bookmark
`import subprocess
from pydbus import SessionBus from gi.repository.GLib import Variant from pprint import pprint
proc = subprocess.Popen(['qterminal']) dest = 'org.lxqt.QTerminal-' + str(proc.pid)
subprocess.check_call(['gdbus', 'wait', '--session', dest])
bus = SessionBus() process = bus.get(dest, '/')['org.lxqt.QTerminal.Process'] current_window = process.getWindows()[0]
window = bus.get(dest, current_window)['org.lxqt.QTerminal.Window'] #window.title = "Terminal000"; #Missing Property
#Will add the first tab on launch then use window.newTab() for as many as you need window.newTab({'shell': Variant('s', '/bin/bash')}) #Only default shell doesn't use input window.newTab({'shell': Variant('s', '/bin/fish')}) #Only default shell doesn't use input #window.newTab({'shell': Variant('s', '/bin/bash')})
print({window}) #Will print Window object pprint(dir(window)) #Will print Window object available properties
tab000 = window.getTabs()[0] print({''}) print({tab000}) #Will print Tab/Terminal object pprint(dir(tab000)) #Will print Tab/Terminal object available properties #tab000.title = "Steam" #Read Only #tab000.cmd = "/usr/bin/steam-runtime %U -silent" #Missing Property - Should run command after shell..
tab001 = window.getTabs()[1] #tab001.title = "Scream-VM" #Read Only #tab001.cmd = "scream -m /dev/shm/scream-ivshmem" #Missing Property - Should run command after shell..
tab002 = window.getTabs()[2] #tab002.title = "Scream" #Read Only #tab002.cmd = "scream" #Missing Property - Should run command after shell..
proc.wait()`