sawyl: (Default)
[personal profile] sawyl
Waiting on something else to complete, I spent an interesting, if ultimately fruitless, hour investigating whether I could use D-Bus to control the way konsole opens new sessions with specific profiles in a way that fits with my normal workflow.

Essentially, I want to be able use a menu option to either: (a) open a new konsole window and ssh session to a remote host if no sessions are currently open; or (b) open a new tab in a window associated with a preexisting ssh to a remote host if a session is already open. I'd hoped to do this by writing a script to interface with D-Bus to obtain the PIDs associated with each open konsole window, determine whether the PID refers to a secure shell connection to a remote host, and if it does and the remote host matches the current target, create a new tab in that window using the appropriate profile to run secure shell.

Sadly, I quickly discovered that it wasn't going to be as straightforward as I'd hoped. Firstly it seems that it's hard (not possible?) to make a particular window the target of the newSession() D-Bus call. Secondly there seems to be a bug in qdbus which prevents newSession() from accepting arguments, making it impossible to open a specific profile.

Still, it's not a complete loss. More digging might reveal a method for selecting particular windows (or moving tabs to them), while the qdbus problem might simply be a bug in the argument handling that can be worked around with the judicious use of quotes or it might be that qdbus could be replaced with a dbus-send command.

As ever, more research is needed in this area...

Profile

sawyl: (Default)
sawyl

August 2018

S M T W T F S
   123 4
5 6 7 8910 11
12131415161718
192021222324 25
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 5th, 2026 05:30 am
Powered by Dreamwidth Studios