Re: Konsole, auto start program upon opening?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Dne út 22. října 2019 Michael napsal(a):
> > Is this possible?
> >
> > Have several tabs open in Konsole.  Upon (re)login to TDE have program A
> > automatically run in tab A, program B automatically run in tab B,
> > program C automatically run in tab C?
> >
> > Thanks,
> > Michael
>

On Tuesday 22 October 2019 12:50:22 pm Dr. Nikolaus Klepp wrote:
> Not on the easy way. But you could do some shell magic. First start konsole
> with enhanced dcop capabilities: $ konsole --script
>
> Then you can send command to konsole with dcop, e.g. execute "ls -l"
> (konsole-16979 will definitly be different whan you try - and watch the
> linebreak inside the ""):
>
> $ dcop konsole-16979 session-1 feedSession "ls -l
> "

On Tuesday 22 October 2019 12:52:56 pm Slávek Banko wrote:
> in the Konsole you can create your own Sessions. Opening such a Session
> executes the command set in Session configuration. And then, when saving a
> TDE session, a Konsole will remember which Session was open on which tab.


Sessions, Profiles, oh My!  Konsole you’re just a big pita...

Nothing will restore Konsole to a perfect copy of itself, except for 
auto-restart upon logout.  If you close it, even profiles won’t get you back 
to exactly where you where.  If we could somehow use the saved session 
in .trinity/share/config/session, this would be a lot easier. (See [1] for 
how to “rescue” most of a setup from another PC.)

Since no one thing would get me where I’m trying to go I borrowed both of 
your’s code and thoughts.

Thanks to both Nik and Slávek!  I doubt I would have found all the pieces to 
get this to work otherwise.

Best All,
Michael


How to Guide to have Konsole open with exactly what you want and where.

- First completely fix up Konsole how you want it.
Everything!  Tab titles, colors, widow size and location, ...

- Then save a Profile.
Konsole > Settings > Save Sessions Profile > global
(Change ‘global’ to whatever name you like)

- Easiest to use kdcop to get Height,Width, and other information
# kdcop &

Or command line if you want to use that (I snipped much junk):

michael@local [~]# dcop | grep  kons
konsole-13221
michael@local [~]# dcop konsole-13221
konsole-mainwindow#11
michael@local [~]# dcop konsole-13221 konsole-mainwindow#11 height
633
michael@local [~]# dcop konsole-13221 konsole-mainwindow#11 width
1090
michael@local [~]# dcop konsole-13221 konsole-mainwindow#11 x
822
michael@local [~]# dcop konsole-13221 konsole-mainwindow#11 y
0

- Modify and save a copy of the shell script below.
Make it executable, and add a TDE menu item or Panel button for it as desired.
The sleep is needed (even on my AMD Ryzen 7 2700X)


Shell script:
#!/bin/bash

konsole --script --profile global &
PID=`echo $!`
# echo $PID
# dcop | grep  kons
sleep 2s

dcop "konsole-$PID" session-1 feedSession "/home/michael/common/bin/ssh01i
"
dcop "konsole-$PID" session-2 feedSession "/home/michael/common/bin/ssh03i
"
dcop "konsole-$PID" session-3 feedSession "/home/michael/common/bin/ssh04i
"
dcop "konsole-$PID" session-4 feedSession "su -
"
dcop "konsole-$PID" konsole-mainwindow#11 resize 1090 633
dcop "konsole-$PID" konsole-mainwindow#11 move 822 0

###EOF##########################

[1]
You have your perfect Konsole setup on some other machine?:
(This won’t start your prior running programs though)

- Log out of TDE (old machine)
- rsync the old machine’s .trinity/share/config directory somewhere local on 
the new machine

- Login to TDE (new machine)
- Have Konsole open
- Log out of TDE
- CTR-ALT-F1
- Log in as you
- cd  (make sure you’re in your user’s root)
- grep -i "konsole" .trinity/share/config/ksmserverrc
- copy your other machine’s konsole session file over the one listed in 
ksmserverrc *
- exit
- CTR-ALT-F7
- Log in to TDE
- Welcome to the magic of TDE restart/reload...

* Example:
(Since the filenames are so long, I added 2 blank lines between each for 
readability.)

cp

 /home/m2/michael/.trinity/share/config/session/konsole_10616e6f6e000146717061500000152190023_1564505343_595166

 /home/michael/.trinity/share/config/session/konsole_1028c1d320b210000154648525000000265210025_1565129749_505478


---------------------------------------------------------------------
To unsubscribe, e-mail: trinity-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: trinity-users-help@xxxxxxxxxxxxxxxxxxxxxxxxxx
Read list messages on the web archive: http://trinity-users.pearsoncomputing.net/
Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting





[Index of Archives]     [Trinity Devel]     [KDE]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]     [Trinity Desktop Environment]

  Powered by Linux