MauiKit Terminal

Session.h
1/*
2 This file is part of Konsole, an X terminal.
3
4 SPDX-FileCopyrightText: 2007 Robert Knight <robertknight@gmail.com>
5 SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de>
6
7 Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
8
9 SPDX-License-Identifier: GPL-2.0-or-later
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20*/
21
22#ifndef SESSION_H
23#define SESSION_H
24
25#include <QStringList>
26#include <QWidget>
27
28#include "Emulation.h"
29#include "History.h"
30#include "ProcessInfo.h"
31
32class KProcess;
33
34namespace Konsole
35{
36
37class Emulation;
38class Pty;
39class TerminalDisplay;
40// class ZModemDialog;
41
42/**
43 * Represents a terminal session consisting of a pseudo-teletype and a terminal emulation.
44 * The pseudo-teletype (or PTY) handles I/O between the terminal process and Konsole.
45 * The terminal emulation ( Emulation and subclasses ) processes the output stream from the
46 * PTY and produces a character image which is then shown on views connected to the session.
47 *
48 * Each Session can be connected to one or more views by using the addView() method.
49 * The attached views can then display output from the program running in the terminal
50 * or send input to the program in the terminal in the form of keypresses and mouse
51 * activity.
52 */
53class Session : public QObject
54{
56
57public:
59 Q_PROPERTY(int processId READ processId)
60 Q_PROPERTY(QString keyBindings READ keyBindings WRITE setKeyBindings)
61 Q_PROPERTY(QSize size READ size WRITE setSize)
62
63 /**
64 * Constructs a new session.
65 *
66 * To start the terminal process, call the run() method,
67 * after specifying the program and arguments
68 * using setProgram() and setArguments()
69 *
70 * If no program or arguments are specified explicitly, the Session
71 * falls back to using the program specified in the SHELL environment
72 * variable.
73 */
74 Session(QObject *parent = nullptr);
75 ~Session() override;
76
77 /**
78 * Returns true if the session is currently running. This will be true
79 * after run() has been called successfully.
80 */
81 bool isRunning() const;
82
83 /**
84 * Sets the profile associated with this session.
85 *
86 * @param profileKey A key which can be used to obtain the current
87 * profile settings from the SessionManager
88 */
89 void setProfileKey(const QString &profileKey);
90 /**
91 * Returns the profile key associated with this session.
92 * This can be passed to the SessionManager to obtain the current
93 * profile settings.
94 */
95 QString profileKey() const;
96
97 /**
98 * Adds a new view for this session.
99 *
100 * The viewing widget will display the output from the terminal and
101 * input from the viewing widget (key presses, mouse activity etc.)
102 * will be sent to the terminal.
103 *
104 * Views can be removed using removeView(). The session is automatically
105 * closed when the last view is removed.
106 */
107 void setView(TerminalDisplay *widget);
108 /**
109 * Removes a view from this session. When the last view is removed,
110 * the session will be closed automatically.
111 *
112 * @p widget will no longer display output from or send input
113 * to the terminal
114 */
115 void removeView(TerminalDisplay *widget);
116
117 /**
118 * Returns the view connected to this session
119 */
120 TerminalDisplay *view() const;
121
122 /**
123 * Returns the terminal emulation instance being used to encode / decode
124 * characters to / from the process.
125 */
126 Emulation *emulation() const;
127
128 /**
129 * Returns the environment of this session as a list of strings like
130 * VARIABLE=VALUE
131 */
132 QStringList environment() const;
133 /**
134 * Sets the environment for this session.
135 * @p environment should be a list of strings like
136 * VARIABLE=VALUE
137 */
139
140 /** Returns the unique ID for this session. */
141 int sessionId() const;
142
143 /**
144 * Return the session title set by the user (ie. the program running
145 * in the terminal), or an empty string if the user has not set a custom title
146 */
147 QString userTitle() const;
148
149 /**
150 * This enum describes the contexts for which separate
151 * tab title formats may be specified.
152 */
154 /** Default tab title format */
156 /**
157 * Tab title format used session currently contains
158 * a connection to a remote computer (via SSH)
159 */
161 };
162 /**
163 * Sets the format used by this session for tab titles.
164 *
165 * @param context The context whoose format should be set.
166 * @param format The tab title format. This may be a mixture
167 * of plain text and dynamic elements denoted by a '%' character
168 * followed by a letter. (eg. %d for directory). The dynamic
169 * elements available depend on the @p context
170 */
171 void setTabTitleFormat(TabTitleContext context, const QString &format);
172 /** Returns the format used by this session for tab titles. */
174
175 /** Returns the arguments passed to the shell process when run() is called. */
176 QStringList arguments() const;
177 /** Returns the program name of the shell process started when run() is called. */
178 QString program() const;
179
180 /**
181 * Sets the command line arguments which the session's program will be passed when
182 * run() is called.
183 */
185 /** Sets the program to be executed when run() is called. */
186 void setProgram(const QString &program);
187
188 /** Returns the session's current working directory. */
190 {
191 return _initialWorkingDir;
192 }
193
194 /**
195 * Sets the initial working directory for the session when it is run
196 * This has no effect once the session has been started.
197 */
198 void setInitialWorkingDirectory(const QString &dir);
199
200 /**
201 * Sets the type of history store used by this session.
202 * Lines of output produced by the terminal are added
203 * to the history store. The type of history store
204 * used affects the number of lines which can be
205 * remembered before they are lost and the storage
206 * (in memory, on-disk etc.) used.
207 */
208 void setHistoryType(const HistoryType &type);
209 /**
210 * Returns the type of history store used by this session.
211 */
212 const HistoryType &historyType() const;
213 /**
214 * Clears the history store used by this session.
215 */
216 void clearHistory();
217
218 /**
219 * Enables monitoring for activity in the session.
220 * This will cause notifySessionState() to be emitted
221 * with the NOTIFYACTIVITY state flag when output is
222 * received from the terminal.
223 */
224 void setMonitorActivity(bool);
225 /** Returns true if monitoring for activity is enabled. */
226 bool isMonitorActivity() const;
227
228 /**
229 * Enables monitoring for silence in the session.
230 * This will cause notifySessionState() to be emitted
231 * with the NOTIFYSILENCE state flag when output is not
232 * received from the terminal for a certain period of
233 * time, specified with setMonitorSilenceSeconds()
234 */
235 void setMonitorSilence(bool);
236 /**
237 * Returns true if monitoring for inactivity (silence)
238 * in the session is enabled.
239 */
240 bool isMonitorSilence() const;
241 /** See setMonitorSilence() */
242 void setMonitorSilenceSeconds(int seconds);
243
244 /**
245 * Sets the key bindings used by this session. The bindings
246 * specify how input key sequences are translated into
247 * the character stream which is sent to the terminal.
248 *
249 * @param id The name of the key bindings to use. The
250 * names of available key bindings can be determined using the
251 * KeyboardTranslatorManager class.
252 */
253 void setKeyBindings(const QString &id);
254 /** Returns the name of the key bindings used by this session. */
255 QString keyBindings() const;
256
257 /**
258 * This enum describes the available title roles.
259 */
261 /** The name of the session. */
263 /** The title of the session which is displayed in tabs etc. */
265 };
266
267 /** Sets the session's title for the specified @p role to @p title. */
268 void setTitle(TitleRole role, const QString &title);
269 /** Returns the session's title for the specified @p role. */
270 QString title(TitleRole role) const;
271 /** Convenience method used to read the name property. Returns title(Session::NameRole). */
273 {
274 return title(Session::NameRole);
275 }
276
277 /** Sets the name of the icon associated with this session. */
278 void setIconName(const QString &iconName);
279 /** Returns the name of the icon associated with this session. */
280 QString iconName() const;
281
282 /** Sets the text of the icon associated with this session. */
283 void setIconText(const QString &iconText);
284 /** Returns the text of the icon associated with this session. */
285 QString iconText() const;
286
287 /** Flag if the title/icon was changed by user/shell. */
288 bool isTitleChanged() const;
289
290 /** Specifies whether a utmp entry should be created for the pty used by this session. */
291 void setAddToUtmp(bool);
292
293 /** Sends the specified @p signal to the terminal process. */
294 bool sendSignal(int signal);
295
296 /**
297 * Specifies whether to close the session automatically when the terminal
298 * process terminates.
299 */
300 void setAutoClose(bool b)
301 {
302 _autoClose = b;
303 }
304
305 /**
306 * Sets whether flow control is enabled for this terminal
307 * session.
308 */
309 void setFlowControlEnabled(bool enabled);
310
311 /** Returns whether flow control is enabled for this terminal session. */
312 bool flowControlEnabled() const;
313
314 /**
315 * Sends @p text to the current foreground terminal program.
316 */
317 void sendText(const QString &text) const;
318
319 void sendKeyEvent(QKeyEvent *e) const;
320
321 /**
322 * Returns the process id of the terminal process.
323 * This is the id used by the system API to refer to the process.
324 */
325 int processId() const;
326
327 /**
328 * Returns the process id of the terminal's foreground process.
329 * This is initially the same as processId() but can change
330 * as the user starts other programs inside the terminal.
331 */
332 int foregroundProcessId() const;
333
334 /**
335 * Returns the name of the terminal's foreground process.
336 */
338
339 /**
340 * Returns the current working directory of the process.
341 */
343
344 /** Returns the terminal session's window size in lines and columns. */
345 QSize size();
346 /**
347 * Emits a request to resize the session to accommodate
348 * the specified window size.
349 *
350 * @param size The size in lines and columns to request.
351 */
352 void setSize(const QSize &size);
353
354 /** Sets the text codec used by this session's terminal emulation. */
355 void setCodec(QTextCodec *codec) const;
356
357 /**
358 * Sets whether the session has a dark background or not. The session
359 * uses this information to set the COLORFGBG variable in the process's
360 * environment, which allows the programs running in the terminal to determine
361 * whether the background is light or dark and use appropriate colors by default.
362 *
363 * This has no effect once the session is running.
364 */
365 void setDarkBackground(bool darkBackground);
366 /**
367 * Returns true if the session has a dark background.
368 * See setDarkBackground()
369 */
370 bool hasDarkBackground() const;
371
372 /**
373 * Attempts to get the shell program to redraw the current display area.
374 * This can be used after clearing the screen, for example, to get the
375 * shell to redraw the prompt line.
376 */
377 void refresh();
378
379 // void startZModem(const QString &rz, const QString &dir, const QStringList &list);
380 // void cancelZModem();
381 // bool isZModemBusy() { return _zmodemBusy; }
382
383 /**
384 * Returns a pty slave file descriptor.
385 * This can be used for display and control
386 * a remote terminal.
387 */
388 int getPtySlaveFd() const;
389
390public Q_SLOTS:
391
392 /**
393 * Starts the terminal session.
394 *
395 * This creates the terminal process and connects the teletype to it.
396 */
397 void run();
398
399 /**
400 * Starts the terminal session for "as is" PTY
401 * (without the direction a data to internal terminal process).
402 * It can be used for control or display a remote/external terminal.
403 */
404 void runEmptyPTY();
405
406 /**
407 * Closes the terminal session. This sends a hangup signal
408 * (SIGHUP) to the terminal process and causes the done(Session*)
409 * signal to be emitted.
410 */
411 void close();
412
413 /**
414 * Changes the session title or other customizable aspects of the terminal
415 * emulation display. For a list of what may be changed see the
416 * Emulation::titleChanged() signal.
417 */
418 void setUserTitle(int, const QString &caption);
419
421
422 /** Emitted when the terminal process starts. */
423 void started();
424
425 /**
426 * Emitted when the terminal process exits.
427 */
428 void finished();
429
430 /**
431 * Emitted when output is received from the terminal process.
432 */
433 void receivedData(const QString &text);
434
435 /** Emitted when the session's title has changed. */
437
438 /** Emitted when the session's profile has changed. */
439 void profileChanged(const QString &profile);
440
441 /**
442 * Emitted when the activity state of this session changes.
443 *
444 * @param state The new state of the session. This may be one
445 * of NOTIFYNORMAL, NOTIFYSILENCE or NOTIFYACTIVITY
446 */
447 void stateChanged(int state);
448
449 /** Emitted when a bell event occurs in the session. */
450 void bellRequest(const QString &message);
451
452 /**
453 * Requests that the color the text for any tabs associated with
454 * this session should be changed;
455 *
456 * TODO: Document what the parameter does
457 */
459
460 /**
461 * Requests that the background color of views on this session
462 * should be changed.
463 */
465
466 /** TODO: Document me. */
467 void openUrlRequest(const QString &url);
468
469 /** TODO: Document me. */
470 // void zmodemDetected();
471
472 /**
473 * Emitted when the terminal process requests a change
474 * in the size of the terminal window.
475 *
476 * @param size The requested window size in terms of lines and columns.
477 */
478 void resizeRequest(const QSize &size);
479
480 /**
481 * Emitted when a profile change command is received from the terminal.
482 *
483 * @param text The text of the command. This is a string of the form
484 * "PropertyName=Value;PropertyName=Value ..."
485 */
487
488 /**
489 * Emitted when the flow control state changes.
490 *
491 * @param enabled True if flow control is enabled or false otherwise.
492 */
493 void flowControlEnabledChanged(bool enabled);
494
495 /**
496 * Broker for Emulation::cursorChanged() signal
497 */
498 void cursorChanged(Emulation::KeyboardCursorShape cursorShape, bool blinkingCursorEnabled);
499
500 void silence();
501 void activity();
502
503private Q_SLOTS:
504 void done(int);
505
506 // void fireZModemDetected();
507
508 void onReceiveBlock(const char *buffer, int len);
509 void monitorTimerDone();
510
511 void onViewSizeChange(int height, int width);
512 void onEmulationSizeChange(QSize);
513
514 void activityStateSet(int);
515
516 // automatically detach views from sessions when view is destroyed
517 void viewDestroyed(QObject *view);
518
519 // void zmodemReadStatus();
520 // void zmodemReadAndSendBlock();
521 // void zmodemRcvBlock(const char *data, int len);
522 // void zmodemFinished();
523
524private:
525 void updateTerminalSize();
526 bool updateForegroundProcessInfo();
527 WId windowId() const;
528
529 int _uniqueIdentifier;
530
531 std::unique_ptr<Pty> _shellProcess;
532 std::unique_ptr<Emulation> _emulation;
533
534 TerminalDisplay *_view = nullptr;
535
536 bool _monitorActivity;
537 bool _monitorSilence;
538 bool _notifiedActivity;
539 bool _masterMode;
540 bool _autoClose;
541 bool _wantedClose;
542 QTimer *_monitorTimer;
543
544 int _silenceSeconds;
545
546 QString _nameTitle;
547 QString _displayTitle;
548 QString _userTitle;
549
550 QString _localTabTitleFormat;
551 QString _remoteTabTitleFormat;
552
553 QString _iconName;
554 QString _iconText; // as set by: echo -en '\033]1;IconText\007
555 bool _isTitleChanged; ///< flag if the title/icon was changed by user
556 bool _addToUtmp;
557 bool _flowControl;
558 bool _fullScripting;
559
560 QString _program;
561 QStringList _arguments;
562
563 QStringList _environment;
564 int _sessionId;
565
566 QString _initialWorkingDir;
567
568 // ZModem
569 // bool _zmodemBusy;
570 // KProcess* _zmodemProc;
571 // ZModemDialog* _zmodemProgress;
572
573 // Color/Font Changes by ESC Sequences
574
575 QColor _modifiedBackground; // as set by: echo -en '\033]11;Color\007
576
577 QString _profileKey;
578
579 bool _hasDarkBackground;
580
581 std::unique_ptr<ProcessInfo> _foregroundProcessInfo;
582 int _foregroundPid;
583 static int lastSessionId;
584 int ptySlaveFd;
585};
586
587/**
588 * Provides a group of sessions which is divided into master and slave sessions.
589 * Activity in master sessions can be propagated to all sessions within the group.
590 * The type of activity which is propagated and method of propagation is controlled
591 * by the masterMode() flags.
592 */
593class SessionGroup : public QObject
594{
596
597public:
598 /** Constructs an empty session group. */
599 SessionGroup();
600 /** Destroys the session group and removes all connections between master and slave sessions. */
601 ~SessionGroup() override;
602
603 /** Adds a session to the group. */
604 void addSession(Session *session);
605 /** Removes a session from the group. */
606 void removeSession(Session *session);
607
608 /** Returns the list of sessions currently in the group. */
610
611 /**
612 * Sets whether a particular session is a master within the group.
613 * Changes or activity in the group's master sessions may be propagated
614 * to all the sessions in the group, depending on the current masterMode()
615 *
616 * @param session The session whoose master status should be changed.
617 * @param master True to make this session a master or false otherwise
618 */
619 void setMasterStatus(Session *session, bool master);
620 /** Returns the master status of a session. See setMasterStatus() */
621 bool masterStatus(Session *session) const;
622
623 /**
624 * This enum describes the options for propagating certain activity or
625 * changes in the group's master sessions to all sessions in the group.
626 */
628 /**
629 * Any input key presses in the master sessions are sent to all
630 * sessions in the group.
631 */
633 };
634
635 /**
636 * Specifies which activity in the group's master sessions is propagated
637 * to all sessions in the group.
638 *
639 * @param mode A bitwise OR of MasterMode flags.
640 */
641 void setMasterMode(int mode);
642 /**
643 * Returns a bitwise OR of the active MasterMode flags for this group.
644 * See setMasterMode()
645 */
646 int masterMode() const;
647
648private:
649 void connectPair(Session *master, Session *other) const;
650 void disconnectPair(Session *master, Session *other) const;
651 void connectAll(bool connect);
652 QList<Session *> masters() const;
653
654 // maps sessions to their master status
655 QHash<Session *, bool> _sessions;
656
657 int _masterMode;
658};
659
660}
661
662#endif
Base class for terminal emulation back-ends.
Definition Emulation.h:120
KeyboardCursorShape
This enum describes the available shapes for the keyboard cursor.
Definition Emulation.h:128
Provides a group of sessions which is divided into master and slave sessions.
Definition Session.h:594
SessionGroup()
Constructs an empty session group.
Definition Session.cpp:802
void setMasterStatus(Session *session, bool master)
Sets whether a particular session is a master within the group.
Definition Session.cpp:877
QList< Session * > sessions() const
Returns the list of sessions currently in the group.
Definition Session.cpp:815
MasterMode
This enum describes the options for propagating certain activity or changes in the group's master ses...
Definition Session.h:627
@ CopyInputToAll
Any input key presses in the master sessions are sent to all sessions in the group.
Definition Session.h:632
~SessionGroup() override
Destroys the session group and removes all connections between master and slave sessions.
Definition Session.cpp:806
void removeSession(Session *session)
Removes a session from the group.
Definition Session.cpp:834
void addSession(Session *session)
Adds a session to the group.
Definition Session.cpp:824
void setMasterMode(int mode)
Specifies which activity in the group's master sessions is propagated to all sessions in the group.
Definition Session.cpp:846
bool masterStatus(Session *session) const
Returns the master status of a session.
Definition Session.cpp:819
int masterMode() const
Returns a bitwise OR of the active MasterMode flags for this group.
Definition Session.cpp:811
Represents a terminal session consisting of a pseudo-teletype and a terminal emulation.
Definition Session.h:54
QString tabTitleFormat(TabTitleContext context) const
Returns the format used by this session for tab titles.
Definition Session.cpp:382
void started()
Emitted when the terminal process starts.
QString title(TitleRole role) const
Returns the session's title for the specified role.
Definition Session.cpp:592
void receivedData(const QString &text)
Emitted when output is received from the terminal process.
bool isRunning() const
Returns true if the session is currently running.
Definition Session.cpp:125
void setIconName(const QString &iconName)
Sets the name of the icon associated with this session.
Definition Session.cpp:603
void close()
Closes the terminal session.
Definition Session.cpp:489
int sessionId() const
Returns the unique ID for this session.
Definition Session.cpp:569
void setAutoClose(bool b)
Specifies whether to close the session automatically when the terminal process terminates.
Definition Session.h:300
bool flowControlEnabled() const
Returns whether flow control is enabled for this terminal session.
Definition Session.cpp:719
TabTitleContext
This enum describes the contexts for which separate tab title formats may be specified.
Definition Session.h:153
@ LocalTabTitle
Default tab title format.
Definition Session.h:155
@ RemoteTabTitle
Tab title format used session currently contains a connection to a remote computer (via SSH)
Definition Session.h:160
void setMonitorSilenceSeconds(int seconds)
See setMonitorSilence()
Definition Session.cpp:692
void run()
Starts the terminal session.
Definition Session.cpp:220
void setProgram(const QString &program)
Sets the program to be executed when run() is called.
Definition Session.cpp:135
QString userTitle() const
Return the session title set by the user (ie.
Definition Session.cpp:369
QString foregroundProcessName()
Returns the name of the terminal's foreground process.
Definition Session.cpp:748
QString profileKey() const
Returns the profile key associated with this session.
Definition Session.cpp:517
bool isMonitorSilence() const
Returns true if monitoring for inactivity (silence) in the session is enabled.
Definition Session.cpp:663
QString initialWorkingDirectory()
Returns the session's current working directory.
Definition Session.h:189
void finished()
Emitted when the terminal process exits.
void setCodec(QTextCodec *codec) const
Sets the text codec used by this session's terminal emulation.
Definition Session.cpp:130
void setHistoryType(const HistoryType &type)
Sets the type of history store used by this session.
Definition Session.cpp:632
QString iconName() const
Returns the name of the icon associated with this session.
Definition Session.cpp:617
void setDarkBackground(bool darkBackground)
Sets whether the session has a dark background or not.
Definition Session.cpp:117
void setIconText(const QString &iconText)
Sets the text of the icon associated with this session.
Definition Session.cpp:611
void setArguments(const QStringList &arguments)
Sets the command line arguments which the session's program will be passed when run() is called.
Definition Session.cpp:143
Emulation * emulation() const
Returns the terminal emulation instance being used to encode / decode characters to / from the proces...
Definition Session.cpp:549
void flowControlEnabledChanged(bool enabled)
Emitted when the flow control state changes.
void profileChanged(const QString &profile)
Emitted when the session's profile has changed.
void clearHistory()
Clears the history store used by this session.
Definition Session.cpp:642
QStringList environment() const
Returns the environment of this session as a list of strings like VARIABLE=VALUE.
Definition Session.cpp:559
void setTabTitleFormat(TabTitleContext context, const QString &format)
Sets the format used by this session for tab titles.
Definition Session.cpp:374
void titleChanged()
Emitted when the session's title has changed.
void openUrlRequest(const QString &url)
TODO: Document me.
void removeView(TerminalDisplay *widget)
Removes a view from this session.
Definition Session.cpp:197
const HistoryType & historyType() const
Returns the type of history store used by this session.
Definition Session.cpp:637
QString currentDir()
Returns the current working directory of the process.
Definition Session.cpp:762
bool sendSignal(int signal)
Sends the specified signal to the terminal process.
Definition Session.cpp:478
void setMonitorSilence(bool)
Enables monitoring for silence in the session.
Definition Session.cpp:676
void changeTabTextColorRequest(int)
Requests that the color the text for any tabs associated with this session should be changed;.
void stateChanged(int state)
Emitted when the activity state of this session changes.
void runEmptyPTY()
Starts the terminal session for "as is" PTY (without the direction a data to internal terminal proces...
Definition Session.cpp:283
int getPtySlaveFd() const
Returns a pty slave file descriptor.
Definition Session.cpp:797
void setProfileKey(const QString &profileKey)
Sets the profile associated with this session.
Definition Session.cpp:511
void setFlowControlEnabled(bool enabled)
Sets whether flow control is enabled for this terminal session.
Definition Session.cpp:705
void changeBackgroundColorRequest(const QColor &)
Requests that the background color of views on this session should be changed.
void setTitle(TitleRole role, const QString &title)
Sets the session's title for the specified role to title.
Definition Session.cpp:579
void setAddToUtmp(bool)
Specifies whether a utmp entry should be created for the pty used by this session.
Definition Session.cpp:700
void setInitialWorkingDirectory(const QString &dir)
Sets the initial working directory for the session when it is run This has no effect once the session...
Definition Session.cpp:139
bool hasDarkBackground() const
Returns true if the session has a dark background.
Definition Session.cpp:121
void cursorChanged(Emulation::KeyboardCursorShape cursorShape, bool blinkingCursorEnabled)
Broker for Emulation::cursorChanged() signal.
bool isMonitorActivity() const
Returns true if monitoring for activity is enabled.
Definition Session.cpp:658
void setView(TerminalDisplay *widget)
Adds a new view for this session.
Definition Session.cpp:153
QString nameTitle() const
Convenience method used to read the name property.
Definition Session.h:272
void setUserTitle(int, const QString &caption)
Changes the session title or other customizable aspects of the terminal emulation display.
Definition Session.cpp:295
void setEnvironment(const QStringList &environment)
Sets the environment for this session.
Definition Session.cpp:564
TerminalDisplay * view() const
Returns the view connected to this session.
Definition Session.cpp:148
void resizeRequest(const QSize &size)
TODO: Document me.
void refresh()
Attempts to get the shell program to redraw the current display area.
Definition Session.cpp:456
QString program() const
Returns the program name of the shell process started when run() is called.
Definition Session.cpp:652
QStringList arguments() const
Returns the arguments passed to the shell process when run() is called.
Definition Session.cpp:647
TitleRole
This enum describes the available title roles.
Definition Session.h:260
@ NameRole
The name of the session.
Definition Session.h:262
@ DisplayedTitleRole
The title of the session which is displayed in tabs etc.
Definition Session.h:264
void bellRequest(const QString &message)
Emitted when a bell event occurs in the session.
void setKeyBindings(const QString &id)
Sets the key bindings used by this session.
Definition Session.cpp:574
void profileChangeCommandReceived(const QString &text)
Emitted when a profile change command is received from the terminal.
void sendText(const QString &text) const
Sends text to the current foreground terminal program.
Definition Session.cpp:499
void setMonitorActivity(bool)
Enables monitoring for activity in the session.
Definition Session.cpp:668
QString iconText() const
Returns the text of the icon associated with this session.
Definition Session.cpp:622
Session(QObject *parent=nullptr)
Constructs a new session.
Definition Session.cpp:52
bool isTitleChanged() const
Flag if the title/icon was changed by user/shell.
Definition Session.cpp:627
int foregroundProcessId() const
Returns the process id of the terminal's foreground process.
Definition Session.cpp:743
void setSize(const QSize &size)
Emits a request to resize the session to accommodate the specified window size.
Definition Session.cpp:735
A widget which displays output from a terminal emulation and sends input keypresses and mouse activit...
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:57:30 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.