This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KDE scripted opening Konsole windows on various desktops

Tags: None
(comma "," separated)
Joe_Wulf
Registered Member
Posts
1
Karma
0
I am seeking help/insight to compose the following in a single bash shell script:
1. Open multiple KDE Plasma5 Konsole windows:
.....a. Each Konsole windows is assigned to a specific virtual desktop (I have 10)
.....b. Each Konsole window has a window size (${WinSize}) and unique geometry to open with/at
.....c. Each Konsole window has a specific number of tabs to open
..........a) Each tab either has a command to execute; or is simply to be left open/ready
...............1(a) Each tab with a command is to remain open and available one the command completes
..........b) Each tab is to remain open and available

#
WinSize="-p 'TerminalColumns=80' -p 'TerminalRows=25'

Example scenario:
KDE VirtualDesktop#1
- KonsoleWindow#1; ${WinSize} --geometry +10+100
[TAB#1] bash: cd /WorkDir1/aa; cat FileX
[TAB#2] bash: cd /WORKDIR1/bb; vi FileY
[TAB#3] bash: # no cmd - just open/ready/waiting
[TAB#4] bash: # no cmd - just open/ready/waiting

- KonsoleWindow#2; ${WinSize} --geometry +50+300
[TAB#1] bash: cd /WorkDir9/LogDir; tail -f Master.log
[TAB#2] bash: cd /WorkDir9/bb; vi FileY

- KonsoleWindow#3; ${WinSize} --geometry +90+500
[TAB#1] bash: cd /WorkDir2/scripts; vi MasterScript.sh
[TAB#2] bash: # no cmd - just open/ready/waiting

KDE VirtualDesktop#2
- KonsoleWindow#1; ${WinSize} --geometry +10+100
[TAB#1] bash: cd /Recharger/Values; vi WorkInProgress.sh
[TAB#2] bash: cd /Recharger/Basic; vi NormalValues.table
[TAB#3] bash: # no cmd - just open/ready/waiting

- KonsoleWindow#2; ${WinSize} --geometry +90+300
[TAB#1] bash: cd /Recharger/Logs; > WIP.log; tail -f WIP.log
[TAB#2] bash: cd /Recharger/Logs; tail -f Normalcy.log
[TAB#3] bash: # no cmd - just open/ready/waiting

- KonsoleWindow#3; ${WinSize} --geometry +90+500
[TAB#1] bash: cd /WorkDir7/subs; vi MasterFunctionsList.sh
[TAB#2] bash: # no cmd - just open/ready/waiting
[TAB#3] bash: # no cmd - just open/ready/waiting
[TAB#4] bash: # no cmd - just open/ready/waiting
[TAB#5] bash: cd /WorkDir2/subs; vi SecondMstrFn.sh

KDE VirtualDesktop#3
- KonsoleWindow#1; ${WinSize} --geometry +25+100
[TAB#1] bash: cd /A/B/C/D; vi scheduler.sh
[TAB#2] bash: cd /X/Y/Z/A; cat next.sh
[TAB#3] bash: # no cmd - just open/ready/waiting

- KonsoleWindow#2; ${WinSize} --geometry +75+300
[TAB#1] bash: cd /A/B/C/D/E; vi planner.table
[TAB#2] bash: # no cmd - just open/ready/waiting

- KonsoleWindow#3; ${WinSize} --geometry +88+460
[TAB#1] bash: cd /MainDataDir/Set#1; less set1.table
[TAB#2] bash: cd /MainDataDir/Set#1; vi set2.table
[TAB#3] bash: # no cmd - just open/ready/waiting


I typically use RHEL8 (KDE v5) and/or Fedora 36 (KDE v5); but do not know how to do this. Currently it is a laborous manual process that I wish to automate with a simple script.

Thank you.
R,
-Joe Wulf
Clancularius
Registered Member
Posts
50
Karma
0
I don't know whether you can do these things entirely with a script or whether you must do them that way but you can do them with a mixture of konsole profiles, window rules

1. Make a konsole profile for each instance of konsole you want to open. You can open profiles on the command line with
Code: Select all
konsole --profile <profile name>

2: When you open a konsole profile, it will show the name of the profile in the title bar. You can use window rules to match the text in the title bar and make sure the window goes to the right virtual desktop as well as specify the position, size and other options.
3. In the custom shortcuts in settings, you can set window rules. Again matching the text in the title bar and programming it when the window appears you can automate commands and keyboard input like ctrl+shift+t to open a new tab(s)
dzon
Registered Member
Posts
493
Karma
3
Yes. Although the script might work, I'd say creating separate profiles would be a better way. You could even put the profiles in a dropdown konsole application style by adding the desktop action exec konsole --profile whatever, to it. Something like this:https://imgur.com/a/L0hzMFw


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
dzon
Registered Member
Posts
493
Karma
3
I was thinking something along this: Create the several tabs files. Create the desktop action execs in ~/.local/share/applications/ ( just use the default konsole application from /usr/share/applications and add the entries). I quickly took one of your commands to give you an idea. Now, about the geometry, part of that is set in the profile. But you get the idea. In this way, you can add all those predefined konsole layouts to the konsole right click. Just an idea. https://imgur.com/a/KdkcAsR

Edit: forgot to add the "which desktop" command. It's "qdbus org.kde.KWin /KWin org.kde.KWin.setCurrentDesktop 2 x".
So, if I wanted that previous konsole profile with the given tabs on, say, virtual desktop2, it'd be: "qdbus org.kde.KWin /KWin org.kde.KWin.setCurrentDesktop 2 && konsole --tabs-from-file ~/Bureaublad/tryout-tabs --profile Carl".


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]