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

[Feature request] Open Qterminal with custom tab, title, cmd #1123

Open
Angell1993 opened this issue May 12, 2024 · 0 comments
Open

[Feature request] Open Qterminal with custom tab, title, cmd #1123

Angell1993 opened this issue May 12, 2024 · 0 comments

Comments

@Angell1993
Copy link

Angell1993 commented May 12, 2024

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()`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant