29
submitted 8 months ago* (last edited 8 months ago) by Pantherina@feddit.de to c/kde@lemmy.kde.social

This is a small Tutorial how to convert Konsole to never, I mean never, open a new window again.

I mean, we moved away from Windows for a reason, right?

Also, I will show you how to use a different shell and add custom right-click actions for various useful things.

screenshot

No new windows

Go to Konsoles Settings, the second checkbox is "open all konsole windows in a single process". Check this, as it is needed.

Now to edit the system desktop entry, never do this in place, copy it to your user directory, entries here always overwrite system ones. (This can be used to hide apps too, use touch ~/.local/share/applications/name.desktop)

cp /usr/share/applications/konsole.desktop ~/.local/share/applications/

Now edit this file with your editor.

Replace Exec=konsole with Exec=konsole --new-tab.

Profile: Different Shell

Bash is the default and I highly advise against using chsh if you want to use fish, zsh or others.

Instead, create a new Konsole profile, set its default command to for example /usr/bin/fish and set it as default profile!

Profile: Distrobox

If you use Distrobox, you may want a profile that launches it directly. The advantage is that you can color it differently and much more.

In the settings create a new profile and set the startup command to distrobox enter Boxname.

Mine is for Fedora, while my main system is Fedora Atomic KDE.

Custom right-click actions

You can remove unneeded translations from the desktop entry to make it easier to work with.

In the Actions= line you define what you want. Below the main entry you put the actions with name, icon and command.

Here I have examples for launching the Distrobox Profile, opening a root shell and opening a remote ssh session.

The complete desktop entry (click me to expand)

[Desktop Entry]
Type=Application
TryExec=konsole
Exec=konsole --new-tab
Icon=utilities-terminal
Categories=System;TerminalEmulator;
Actions=FedoraBox;root;ssh;
X-DocPath=konsole/index.html
X-DBUS-StartupType=Unique
X-KDE-AuthorizeAction=shell_access
X-KDE-Shortcuts=Ctrl+Alt+T
StartupWMClass=konsole
Keywords=terminal;console;script;run;execute;command;command-line;commandline;cli;bash;sh;shell;zsh;cmd;command prompt
Name=Konsole
GenericName=Terminal
Comment="$GenericName"

[Desktop Action FedoraBox]
Name=Distrobox
Icon=fedora-logo-icon
Exec=konsole --new-tab --profile FedoraBox # this launches "distrobox enter FedoraBox"

[Desktop Action root]
Name=root Terminal
Icon=folder-root-symbolic
Exec=konsole --new-tab -e pkexec $SHELL #or define a shell like fish

[Desktop Action ssh]
Name=ssh to X
Icon=folder-remote-symbolic
Exec=konsole --new-tab -e ssh user@IP:PORT -i /path/to/key

Note that I removed the actions for "new tab" and "new window". For some reason Plasma shows the "open new window" always, and due to the replacement this opens a new tab instead.

Ctrl+Alt+t, opening from Dolphin and more will also open a new tab.

Btw, if somebody can help me figure out how to focus the Konsole window when opening a new tab, that would be nice. This is currently missing

top 2 comments
sorted by: hot top controversial new old
[-] LunchEnjoyer@lemmy.world 1 points 8 months ago

Thanks for sharing!

[-] harsh3466@lemmy.ml 1 points 8 months ago

This is great. Thank you!

this post was submitted on 09 Mar 2024
29 points (93.9% liked)

KDE

5391 readers
34 users here now

KDE is an international technology team creating user-friendly free and open source software for desktop and portable computing. KDE’s software runs on GNU/Linux, BSD and other operating systems, including Windows.

Plasma 6 Bugs

If you encounter a bug, proceed to https://bugs.kde.org, check whether it has been reported.

If it hasn't, report it yourself.

PLEASE THINK CAREFULLY BEFORE POSTING HERE.

Developers do not look for reports on social media, so they will not see it and all it does is clutter up the feed.

founded 1 year ago
MODERATORS