• 0 Posts
  • 17 Comments
Joined 1 year ago
cake
Cake day: June 18th, 2023

help-circle



  • 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:

    #!/bin/bash
    # useThisSession
    
    echo MYCMD_SERVICE=$KONSOLE_DBUS_SERVICE > ~/.config/mycmdrc
    echo MYCMD_SESSION=${KONSOLE_DBUS_SESSION#/Sessions/} >> ~/.config/mycmdrc
    echo MYCMD_WINDOW=${KONSOLE_DBUS_WINDOW#/Windows/} >> ~/.config/mycmdrc
    

    runCommand.sh:

    #!/bin/bash
    # runCommand
    
    . ~/.config/mycmdrc
    
    qdbus $MYCMD_SERVICE /konsole/MainWindow_$MYCMD_WINDOW showNormal
    qdbus $MYCMD_SERVICE /konsole/MainWindow_$MYCMD_WINDOW raise
    qdbus $MYCMD_SERVICE /Windows/$MYCMD_WINDOW setCurrentSession $MYCMD_SESSION
    qdbus $KONSOLE_DBUS_SERVICE /Sessions/$MYCMD_SESSION runCommand "echo cmd"
    

    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













  • count0@lemmy.dbzer0.comtoLinux@lemmy.mlIs Systemd that bad afterall?
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    edit-2
    1 year ago

    For someone coming from NeXTStep (BSD based), having worked with SCO, various BSD and mostly Linux for the last 20 years, the worst thing about systemd is documentation that’s easily accessible/readable for people used to a traditional init system.

    “How do I get it to do special use case X” was a basically unanswerable question when it got dragged into the mainstream (for reasons I can very well understand - the reasons for the dragging, that is, the bad docs, not so much).

    Maybe that’s improved in the mean time - I wouldn’t know, I had to figure it out back then and now I know its lingo when searching and such.