This profile is from a federated server and may be incomplete. View on remote instance

count0 ,
@count0@lemmy.dbzer0.com avatar

Soo… If we could figure out how to do the first one via DBus/from the command line, you could put both in a script and bind that to a (global or so) shortcut, and be set. (?)

What qdbus command line exactly are you using to post input to the shell within Konsole?

I’ll have a look later when I’m at my desktop again (and hopefully will remember).

count0 , (edited )
@count0@lemmy.dbzer0.com avatar

Thank you!

This is what I came up with.

  • a script that does what you need, and reads a kinda ‘config file’ which Konsole instance/window/session to use
  • another script that saves the current session into that config file

So you’d save the scripts somewhere you like, and run the useThisSession one in the session you’d like to be the target.

Then, you can run / bind to a shortcut / … the runCommand script, and it will show, raise, set Session, and run the command on the target saved earlier.

useThisSession.sh:


<span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;"># useThisSession
</span><span style="color:#323232;">
</span><span style="color:#323232;">echo MYCMD_SERVICE=$KONSOLE_DBUS_SERVICE > ~/.config/mycmdrc
</span><span style="color:#323232;">echo MYCMD_SESSION=${KONSOLE_DBUS_SESSION#/Sessions/} >> ~/.config/mycmdrc
</span><span style="color:#323232;">echo MYCMD_WINDOW=${KONSOLE_DBUS_WINDOW#/Windows/} >> ~/.config/mycmdrc
</span>

runCommand.sh:


<span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;"># runCommand
</span><span style="color:#323232;">
</span><span style="color:#323232;">. ~/.config/mycmdrc
</span><span style="color:#323232;">
</span><span style="color:#323232;">qdbus $MYCMD_SERVICE /konsole/MainWindow_$MYCMD_WINDOW showNormal
</span><span style="color:#323232;">qdbus $MYCMD_SERVICE /konsole/MainWindow_$MYCMD_WINDOW raise
</span><span style="color:#323232;">qdbus $MYCMD_SERVICE /Windows/$MYCMD_WINDOW setCurrentSession $MYCMD_SESSION
</span><span style="color:#323232;">qdbus $KONSOLE_DBUS_SERVICE /Sessions/$MYCMD_SESSION runCommand "echo cmd"
</span>

For testing purposes, I’m using “echo cmd” instead of ‘!!’ (note the different type of quotes) to not cause any… unintended… executions.

Running qdbus $MYCMD_SERVICE /konsole/MainWindow_$MYCMD_WINDOW will show you all methods available on the Window, eg, so you can pick&choose from those if you want different behaviour from show (& un-minimize) and raise.

EDIT: syntax adjusted to work in ‘regular’ bash


  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • All magazines