Commit Graph

204 Commits

Author SHA1 Message Date
Ilya Pominov
f7d0c2ae7d Change session Id numbering
Assign the new session Id equal to the maximum existing Id + 1.

The session Id may be displayed in the tab title. If we open 2 tabs and
then close the second one, then the next opened tab will get number 3
instead of number 2, which can be confusing for the user.

BUG: 440878
2023-11-24 15:00:36 +00:00
Petr Vanek
77755fc0cc Apply split view icons to the session context menu too. 2023-11-21 09:19:37 +00:00
Ilya Pominov
a9caaeb8fc Remove some unused includes 2023-11-19 16:53:44 +00:00
Laurent Montel
1abfaaf561 GIT_SILENT: adapt to new api 2023-11-09 06:50:52 +01:00
Christoph Cullmann
3056d6009d port from deprecated Qt event & position functions
for the dragging, we can just use the floats,
rounding doesn't make it better
2023-11-05 09:14:03 +00:00
Nicolas Fella
ccefad2839 Port to new KNotifications action API 2023-11-04 16:26:43 +00:00
Laurent Montel
a751faf02a Remove unused now qt5 code. Master is qt6 only now 2023-10-27 06:34:56 +00:00
Laurent Montel
73295a8557 Use std::as_const (we depend against c++17) 2023-10-27 05:52:51 +00:00
Waqar Ahmed
1e136d63f2 move konsole to kf6 2023-10-25 22:13:53 +05:00
Friedrich W. H. Kossebau
c11a3f668e Adapt to change of KStandardAction::name(id) return type
GIT_SILENT
2023-10-24 02:21:53 +02:00
Theodore Wang
9d34572d31 Implement unit tests for ProcessInfo
With this change, the tests which are implemented check that ProcessInfo can read attributes of a process properly.
The checked attributes are the current working directory of the process, the validity of the process and the name and arguments of the process.
2023-10-11 20:22:04 +00:00
Theodore Wang
f0ee5a1163 Implements public method ProcessInfo::refreshArguments
Instead of calling ProcessInfo::readArguments and
ProcessInfo::clearArguments in ProcessInfo::update,
encapsulate logic of refreshing ProcessInfo::_arguments
into ProcessInfo::refreshArguments and call
the method whenever ssh is detected as process.
2023-10-08 13:19:54 +00:00
Aleix Pol
475da6fb23 Make sure we don't crash if we issue a notification before showing the window
Could reproduce running `konsole -e "cat unexisting.file"`

See:
```
* 0  QWidget::windowHandle (this=0x0) at /home/apol/devel/frameworks/qt6/qtbase/src/widgets/kernel/qwidget.cpp:2498
* 1  0x00007ffff7d38070 in Konsole::Session::done (this=0x55555572cf50, exitCode=1, exitStatus=QProcess::NormalExit) at /home/apol/devel/frameworks6/konsole/src/session/Session.cpp:1099
* 2  0x00007ffff7d49b01 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<int, QProcess::ExitStatus>, void, void (Konsole::Session::*)(int, QProcess::ExitStatus)>::call (
    f=(void (Konsole::Session::*)(Konsole::Session * const, int, QProcess::ExitStatus)) 0x7ffff7d37db0 <Konsole::Session::done(int, QProcess::ExitStatus)>, o=0x55555572cf50, arg=0x7fffffffd350) at /home/apol/devel/kde6/include/QtCore/qobjectdefs_impl.h:145
* 3  0x00007ffff7d49a3d in QtPrivate::FunctionPointer<void (Konsole::Session::*)(int, QProcess::ExitStatus)>::call<QtPrivate::List<int, QProcess::ExitStatus>, void> (
    f=(void (Konsole::Session::*)(Konsole::Session * const, int, QProcess::ExitStatus)) 0x7ffff7d37db0 <Konsole::Session::done(int, QProcess::ExitStatus)>, o=0x55555572cf50, arg=0x7fffffffd350) at /home/apol/devel/kde6/include/QtCore/qobjectdefs_impl.h:182
* 4  0x00007ffff7d49965 in QtPrivate::QCallableObject<void (Konsole::Session::*)(int, QProcess::ExitStatus), QtPrivate::List<int, QProcess::ExitStatus>, void>::impl (which=1, this_=0x555555a3e2f0, r=0x55555572cf50, a=0x7fffffffd350, ret=0x0)
    at /home/apol/devel/kde6/include/QtCore/qobjectdefs_impl.h:520
* 5  0x00007ffff3fbc525 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffd350, r=0x55555572cf50, this=0x555555a3e2f0) at /home/apol/devel/frameworks/qt6/qtbase/src/corelib/kernel/qobjectdefs_impl.h:433
* 6  doActivate<false> (sender=sender@entry=0x555555a888e0, signal_index=<optimized out>, argv=<optimized out>, argv@entry=0x7fffffffd350) at /home/apol/devel/frameworks/qt6/qtbase/src/corelib/kernel/qobject.cpp:4021
* 7  0x00007ffff3fb277b in QMetaObject::activate (sender=sender@entry=0x555555a888e0, m=m@entry=0x7ffff41ce300 <QProcess::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7fffffffd350)
    at /home/apol/devel/frameworks/qt6/qtbase/src/corelib/kernel/qobject.cpp:4081
* 8  0x00007ffff4124c3a in QProcess::finished (this=this@entry=0x555555a888e0, _t1=<optimized out>, _t2=<optimized out>) at /home/apol/build-devel/qt6/qtbase/src/corelib/Core_autogen/include/moc_qprocess.cpp:503
```
2023-10-04 13:50:26 +00:00
Theodore Wang
1525ee3b5e Create separate cgroups for processes of each tab
Currently, all the processes created by the application are housed
within the application's cgroup without any futher categorisation.
This causes the entire application to be killed if a process in the
aforementioned cgroup triggers an OOM event.

To prevent the entire application from being killed, a new child cgroup
is created for each new tab. Child cgroups for individual tabs are
named according to this template "tab([session pid for the tab]).scope".
"Background" processes (e.g. such as the main process for running
konsole) are stored in the child cgroup "main.scope".
This restricts the OOM event to only killing the tab which contains
the offending process.

BUG: 439805


To prevent the entire application from being killed, a new child cgroup is created for each new tab.
Child cgroups for individual tabs are named according to this template "tab([session pid for the tab]).scope".
"Background" processes (e.g. such as the main process for running konsole) are stored in the child cgroup "main.scope".
This restricts the OOM event to only killing the tab which contains the offending process.

BUG: 439805
2023-08-28 23:59:16 +00:00
Kurt Hindenburg
5bda57405e Fix crashes in testTerminalInterface
Certain user profiles crash here

   from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
    this=0x5555557c8da0, name=..., visible=true)
    at src/konsole/src/session/SessionController.cpp:2206
    mode=1) at src/konsole/src/Screen.cpp:2395
    at src/konsole/src/Vt102Emulation.cpp:1071
    this=0x555555dc2a30, cc=7)
2023-08-18 20:14:16 -04:00
Nicolas Fella
f3a9066dd5 Port away from KNotification::CloseWhenWidgetActivated 2023-08-17 19:45:37 +00:00
Friedrich W. H. Kossebau
451ed33d63 Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-28 12:17:12 +00:00
Theodore Wang
09237ee02f Fixed search bar false positive after clear scrollback (and reset)
To prevent the search bar from continuing to show a match by emitting
green even after clearing scrollback and resetting, search is rerun
whenever the searchbar is opened.

BUG: 407317
2023-06-16 17:10:58 +00:00
Tobias Fella
53d473cff3 Port to KF6 2023-05-29 16:17:23 +00:00
Kurt Hindenburg
7f6b3d97d2 Fix spelling error 2023-05-23 22:12:51 -04:00
Matan Ziv-Av
b69a2b88ef Add a menu option for monitors to only notify once.
When this option is enabled, the monitors (prompt, activity, silence,
process termination) are disabled automatically after one notification.
2023-05-14 14:15:19 +00:00
Matan Ziv-Av
542a04560d Add "Monitor for Prompt" action
When semantic shell integration is enabled, Konsole will generate a
notification when a shell prompt is displayed.
2023-05-14 14:15:19 +00:00
Luis Javier Merino
6466523141 Use correct kcmshellX for QtX version - Fix typo in d962ae00c 2023-03-27 21:19:23 +00:00
Laurent Montel
d962ae00c3 Use kcmshell6 on kf6 2023-03-26 20:43:39 +02:00
Luis Javier Merino Morán
343e3f21e7 Restrict all KSandbox use to KCoreAddons 5.97
Other uses (and the include) of KSandbox are restricted to KCoreAddons
5.97, so do the same here so it compiles with earlier versions of
KCoreAddons.
2023-03-17 23:37:03 +01:00
Waqar Ahmed
e7d336e590 Use test -x exec when in flatpak 2023-03-15 11:03:57 +00:00
Waqar Ahmed
646c935892 Fix TERM env variable not being set in flatpak
If this is not set, the whole terminal experience is useless with any
non bash shell e.g., zsh
2023-03-15 02:11:00 +05:00
Waqar Ahmed
703e1c0747 Use userTitle on windows for tabTitle
Otherwise its just ": -"
2023-03-09 11:16:35 +05:00
Waqar Ahmed
ab81bd4828 Fix incorrect size being used initially 2023-03-09 11:16:35 +05:00
Waqar Ahmed
39059d3cc3 Improve process finished handling 2023-03-09 11:16:35 +05:00
Waqar Ahmed
192b3a2652 Make powershell work 2023-03-09 11:16:35 +05:00
Waqar Ahmed
b72df2372a Add conpty backend for windows 2023-03-09 11:16:35 +05:00
Waqar Ahmed
efb1686e62 Make konsole compile on windows 2023-03-09 11:16:35 +05:00
Magno Lomardo
d3fa26f65b Add the context menu options to split the view left-right and top-bottom
FEATURE: 415724
2023-03-06 22:41:41 +00:00
Matan Ziv-Av
60a534a2e7 codecNameTrigger's parameter is a QString, not QByteArray. 2023-02-26 12:28:35 +00:00
Matan Ziv-Av
0717268d03 Fix a typo in e98a6a19ff
the cases for version >= 5.103 and < 5.103 are reversed
2023-02-26 12:28:35 +00:00
Nicolas Fella
e98a6a19ff Port away from deprecated KCodecAction API 2023-02-24 01:05:24 +00:00
Matan Ziv-Av
feb44c226f Make behaviour of characters with problematic width configurable
Add a profile option to follow Unicode standard for the display width of
characters, where this width differs from glibc's wcwidth.

Currently the only character affected by this is soft hyphen (unicode 0x00ad).

Konsole generally follows wcwidth() function when determining the display
width of characters, since this is behaviour expected by libreadline, and
doing otherwise corrupts lines containing problematic characters. When such
characters are used more for display, then on the command line, following
the Unicode standard may be prefferable.

The default for this option is disabled - that is follow wcwidth().

CCBUG: 464823
2023-02-24 00:46:34 +00:00
Matan Ziv-Av
7f6f2c1cea Make keyboard selection mode independent of read only mode 2023-02-24 00:18:16 +00:00
Matan Ziv-Av
0375b56d74 Allow pressing Esc to quit keyboard selection mode 2023-02-24 00:18:16 +00:00
Waqar Ahmed
0a78bfe4ac Fix inconsistent dll linkage errors and warnings on windows 2023-02-23 23:53:26 +00:00
Nicolas Fella
f51caadf3e Fix applying default encoding from KCodecAction
Currently selecting 'Default' in the codec selector doesn't do anything

Connect to the relevant signal and apply the profile's default encoding
2023-01-02 14:52:16 +00:00
Willyanto Willyanto
c3176abb17 Perform some initializations in initialization list
Fixes some variable is assigned in constructor body. Consider performing
initialization in initialization list. (CWE-398)
2022-12-23 16:49:27 +00:00
Aleix Pol
d3c36c3419 Fix crash using yakuake
The hamburger menu seems to be null.

```
/home/apol/devel/frameworks/kconfigwidgets/src/khamburgermenu.h:97
menu=0x5580261dbe80) at
/home/apol/devel/frameworks/kconfigwidgets/src/khamburgermenu.cpp:109
Konsole::SessionController::showDisplayContextMenu (this=0x558025dfa2d0,
position=...) at
/home/apol/devel/frameworks/konsole/src/session/SessionController.cpp:1990
QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QPoint
const&>, void, void (Konsole::SessionController::*)(QPoint
const&)>::call (f=(void
(Konsole::SessionController::*)(Konsole::SessionController * const,
const QPoint &)) 0x7f728c8a1920
<Konsole::SessionController::showDisplayContextMenu(QPoint const&)>,
o=0x558025dfa2d0, arg=0x7ffdb36086c0) at
/home/apol/devel/kde5/include/QtCore/qobjectdefs_impl.h:152
```
2022-12-04 08:06:39 +00:00
Andrey Butirsky
b8325d2f18 fixup! Adopt KHamburgerMenu 2022-11-29 23:03:54 +04:00
Nate Graham
b04265e9fa Adopt KHamburgerMenu
It's amazing!

BUG: 439895
FIXED-IN: 23.04
2022-11-29 23:03:54 +04:00
Luis Javier Merino Morán
bc127dd2c1 Update foreground pgroup info before accessing it
Fixes a potential crash when opening the right mouse button context menu
just after launching some process in the shell, before konsole has had
any chance to update the foreground process group information.

BUG: 454122
BUG: 458157
2022-11-25 00:58:57 +00:00
Harald Sitter
273448af3e move shell argument manipulation to session
we need this to happen before KSandbox::makeHostContext because the
first argument is not necessarily the shell command anymore afterwards,
confusing the legacy logic inside Pty. simply move the manipulation into
Session.cpp

this should make the flatpak build work properly
2022-11-05 18:15:11 +01:00
Harald Sitter
c7c3ef323c don't lose environment variables
the resetting was nonesense, Pty appends _environment on top of the
existing environment, so concat the two for potential sandboxing (the
ksandbox class will only apply the diff to system environment anyway).
once the sandboxing was applied reset the actual process environment to
the original variable rather than emptying it, this prevents us from
losing variables when outside a sandbox

BUG: 458591
(cherry picked from commit 252eab8537)
2022-10-22 14:21:25 -04:00
Friedrich W. H. Kossebau
3213a17798 Port away from deprecated KMessageBox Yes/No API
Using "Yes" & "No" text labels on dialog buttons is discouraged by not
only the KDE HIG these days. Yet the legacy API of KMessageBox was
using Yes & No as terms in its API, conflicting with what the HIG
recommends and trapping HIG-unaware developers into thinking to use
Yes & No buttons.

New substitute API uses the term "action" instead, matching the concept
proposed by the KDE HIG.

GIT_SILENT
2022-10-16 04:11:14 +00:00