├── .ci └── build.sh ├── .editorconfig ├── .translation-update ├── AUTHORS ├── CHANGELOG ├── CMakeLists.txt ├── COPYING-CMAKE-SCRIPTS ├── LICENSE ├── LICENSE.BSD-3-clause ├── LICENSE.LGPL2+ ├── README.md ├── cmake ├── FindUtf8Proc.cmake ├── cmake_uninstall.cmake.in └── qtermwidget6-config.cmake.in ├── docs └── configuration.md ├── examples ├── README ├── cpp │ ├── RemoteTerm │ │ ├── README.md │ │ ├── RemoteTerm.pro │ │ ├── main.cpp │ │ ├── remoteterm.cpp │ │ ├── remoteterm.h │ │ └── shell-srv.py │ └── main.cpp └── pyqt │ └── main.py ├── lib ├── BlockArray.cpp ├── BlockArray.h ├── Character.h ├── CharacterColor.h ├── ColorScheme.cpp ├── ColorScheme.h ├── ColorTables.h ├── DefaultTranslatorText.h ├── Emulation.cpp ├── Emulation.h ├── ExtendedDefaultTranslator.h ├── Filter.cpp ├── Filter.h ├── History.cpp ├── History.h ├── HistorySearch.cpp ├── HistorySearch.h ├── KeyboardTranslator.cpp ├── KeyboardTranslator.h ├── LineFont.h ├── LineFont.src ├── Pty.cpp ├── Pty.h ├── Screen.cpp ├── Screen.h ├── ScreenWindow.cpp ├── ScreenWindow.h ├── SearchBar.cpp ├── SearchBar.h ├── SearchBar.ui ├── Session.cpp ├── Session.h ├── ShellCommand.cpp ├── ShellCommand.h ├── TerminalCharacterDecoder.cpp ├── TerminalCharacterDecoder.h ├── TerminalDisplay.cpp ├── TerminalDisplay.h ├── Vt102Emulation.cpp ├── Vt102Emulation.h ├── color-schemes │ ├── BlackOnLightYellow.colorscheme │ ├── BlackOnRandomLight.colorscheme │ ├── BlackOnWhite.colorscheme │ ├── BreezeModified.colorscheme │ ├── DarkPastels.colorscheme │ ├── Falcon.colorscheme │ ├── GreenOnBlack.colorscheme │ ├── Linux.colorscheme │ ├── Solarized.colorscheme │ ├── SolarizedLight.colorscheme │ ├── Tango.colorscheme │ ├── Ubuntu.colorscheme │ ├── WhiteOnBlack.colorscheme │ └── historic │ │ ├── BlackOnLightColor.schema │ │ ├── DarkPicture.schema │ │ ├── Example.Schema │ │ ├── GreenOnBlack.schema │ │ ├── GreenTint.schema │ │ ├── GreenTint_MC.schema │ │ ├── LightPicture.schema │ │ ├── Linux.schema │ │ ├── README.Schema │ │ ├── README.default.Schema │ │ ├── Transparent.schema │ │ ├── Transparent_MC.schema │ │ ├── Transparent_darkbg.schema │ │ ├── Transparent_lightbg.schema │ │ ├── XTerm.schema │ │ ├── syscolor.schema │ │ └── vim.schema ├── default.keytab ├── kb-layouts │ ├── README │ ├── default.keytab │ ├── historic │ │ ├── vt100.keytab │ │ └── x11r5.keytab │ ├── linux.keytab │ ├── macbook.keytab │ ├── solaris.keytab │ └── vt420pc.keytab ├── konsole_wcwidth.cpp ├── konsole_wcwidth.h ├── kprocess.cpp ├── kprocess.h ├── kpty.cpp ├── kpty.h ├── kpty_p.h ├── kptydevice.cpp ├── kptydevice.h ├── kptyprocess.cpp ├── kptyprocess.h ├── qtermwidget.cpp ├── qtermwidget.h ├── qtermwidget.json ├── qtermwidget_interface.h ├── qtermwidget_version.h.in ├── tools.cpp ├── tools.h └── translations │ ├── CMakeLists.txt │ ├── qtermwidget.ts │ ├── qtermwidget_ar.ts │ ├── qtermwidget_arn.ts │ ├── qtermwidget_ast.ts │ ├── qtermwidget_bg.ts │ ├── qtermwidget_ca.ts │ ├── qtermwidget_cs.ts │ ├── qtermwidget_cy.ts │ ├── qtermwidget_da.ts │ ├── qtermwidget_de.ts │ ├── qtermwidget_de_CH.ts │ ├── qtermwidget_el.ts │ ├── qtermwidget_en_GB.ts │ ├── qtermwidget_es.ts │ ├── qtermwidget_et.ts │ ├── qtermwidget_fi.ts │ ├── qtermwidget_fr.ts │ ├── qtermwidget_gl.ts │ ├── qtermwidget_he.ts │ ├── qtermwidget_hr.ts │ ├── qtermwidget_hu.ts │ ├── qtermwidget_it.ts │ ├── qtermwidget_ja.ts │ ├── qtermwidget_ka.ts │ ├── qtermwidget_kab.ts │ ├── qtermwidget_ko.ts │ ├── qtermwidget_lg.ts │ ├── qtermwidget_lt.ts │ ├── qtermwidget_nb_NO.ts │ ├── qtermwidget_nl.ts │ ├── qtermwidget_oc.ts │ ├── qtermwidget_pl.ts │ ├── qtermwidget_pt.ts │ ├── qtermwidget_pt_BR.ts │ ├── qtermwidget_ru.ts │ ├── qtermwidget_si.ts │ ├── qtermwidget_sk.ts │ ├── qtermwidget_tr.ts │ ├── qtermwidget_uk.ts │ ├── qtermwidget_zh_CN.ts │ └── qtermwidget_zh_TW.ts ├── pyqt ├── project.py ├── pyproject.toml └── sip │ └── qtermwidget.sip └── qtermwidget.spec /.ci/build.sh: -------------------------------------------------------------------------------- 1 | set -ex 2 | 3 | source shared-ci/prepare-archlinux.sh 4 | 5 | # See *depends in https://github.com/archlinuxcn/repo/blob/master/archlinuxcn/qtermwidget-git/PKGBUILD 6 | pacman -S --noconfirm --needed git cmake lxqt-build-tools qt6-tools python-pyqt6 pyqt-builder sip 7 | 8 | cmake -B build -S . \ 9 | -DBUILD_EXAMPLE=ON \ 10 | -DQTERMWIDGET_USE_UTEMPTER=ON 11 | make -C build 12 | 13 | cd pyqt 14 | CXXFLAGS="-I$PWD/../lib -I$PWD/../build/lib" LDFLAGS="-L$PWD/../build" sip-wheel --verbose --qmake=/usr/bin/qmake6 15 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 -------------------------------------------------------------------------------- /.translation-update: -------------------------------------------------------------------------------- 1 | translations='./lib' 2 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Originally forked from Konsole by 2 | 3 | Revived by Petr Vanek 4 | 5 | Contributors: 6 | 7 | Adam Treat 8 | Chris Mueller 9 | Christian Surlykke 10 | Daniel O'Neill 11 | Francisco Ballina 12 | Georg Rudoy <0xd34df00d@gmail.com> 13 | Jerome Leclanche 14 | Petr Vanek 15 | @kulti 16 | -------------------------------------------------------------------------------- /COPYING-CMAKE-SCRIPTS: -------------------------------------------------------------------------------- 1 | LICENSE.BSD-3-clause -------------------------------------------------------------------------------- /LICENSE.BSD-3-clause: -------------------------------------------------------------------------------- 1 | Copyright (c) The Regents of the University of California. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | 3. Neither the name of the University nor the names of its contributors 13 | may be used to endorse or promote products derived from this software 14 | without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 | SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /cmake/FindUtf8Proc.cmake: -------------------------------------------------------------------------------- 1 | #.rst: 2 | # FindUtf8Proc 3 | # -------- 4 | # 5 | # Find utf8proc 6 | # 7 | # Find the UTF-8 processing library 8 | # 9 | # :: 10 | # 11 | # This module defines the following variables: 12 | # UTF8PROC_FOUND - True if UTF8PROC_INCLUDE_DIR & UTF8PROC_LIBRARY are found 13 | # UTF8PROC_LIBRARIES - Set when UTF8PROC_LIBRARY is found 14 | # UTF8PROC_INCLUDE_DIRS - Set when UTF8PROC_INCLUDE_DIR is found 15 | # 16 | # 17 | # 18 | # :: 19 | # 20 | # UTF8PROC_INCLUDE_DIR - where to find utf8proc.h 21 | # UTF8PROC_LIBRARY - the utf8proc library 22 | 23 | #============================================================================= 24 | # This module is adapted from FindALSA.cmake. Below are the original license 25 | # header. 26 | #============================================================================= 27 | # Copyright 2009-2011 Kitware, Inc. 28 | # Copyright 2009-2011 Philip Lowman 29 | # 30 | # Distributed under the OSI-approved BSD License (the "License"); 31 | # see accompanying file Copyright.txt for details. 32 | # 33 | # This software is distributed WITHOUT ANY WARRANTY; without even the 34 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 35 | # See the License for more information. 36 | #============================================================================= 37 | 38 | find_path( 39 | UTF8PROC_INCLUDE_DIR NAMES utf8proc.h DOC "The utf8proc include directory" 40 | ) 41 | 42 | find_library( 43 | UTF8PROC_LIBRARY NAMES utf8proc DOC "The utf8proc library" 44 | ) 45 | 46 | # handle the QUIETLY and REQUIRED arguments and set UTF8PROC_FOUND to TRUE if 47 | # all listed variables are TRUE 48 | include(FindPackageHandleStandardArgs) 49 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( 50 | Utf8Proc 51 | FOUND_VAR Utf8Proc_FOUND 52 | REQUIRED_VARS UTF8PROC_LIBRARY UTF8PROC_INCLUDE_DIR 53 | ) 54 | 55 | if(Utf8Proc_FOUND) 56 | set( UTF8PROC_LIBRARIES ${UTF8PROC_LIBRARY} ) 57 | set( UTF8PROC_INCLUDE_DIRS ${UTF8PROC_INCLUDE_DIR} ) 58 | endif() 59 | 60 | mark_as_advanced(UTF8PROC_INCLUDE_DIR UTF8PROC_LIBRARY) 61 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | # this works on Linux, but not on mac. 6 | #FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 7 | #STRING(REGEX REPLACE "\n" ";" files "${files}") 8 | #FOREACH(file ${files}) 9 | # MESSAGE(STATUS "Uninstalling \"${file}\"") 10 | # IF(NOT EXISTS "${file}") 11 | # MESSAGE(FATAL_ERROR "File \"${file}\" does not exists.") 12 | # ENDIF(NOT EXISTS "${file}") 13 | # EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" 14 | # OUTPUT_VARIABLE rm_out 15 | # RETURN_VARIABLE rm_retval) 16 | # IF("${rm_retval}" GREATER 0) 17 | # MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") 18 | # ENDIF("${rm_retval}" GREATER 0) 19 | #ENDFOREACH(file) 20 | 21 | EXEC_PROGRAM("xargs rm < @CMAKE_BINARY_DIR@/install_manifest.txt" 22 | OUTPUT_VARIABLE rm_out 23 | RETURN_VARIABLE rm_ret) 24 | -------------------------------------------------------------------------------- /cmake/qtermwidget6-config.cmake.in: -------------------------------------------------------------------------------- 1 | # - Find the QTermWidget include and library 2 | # 3 | # Typical usage: 4 | # find_package(QTermWidget5 REQUIRED) 5 | # 6 | # add_executable(foo main.cpp) 7 | # target_link_libraries(foo qtermwidget5) 8 | 9 | @PACKAGE_INIT@ 10 | 11 | if (CMAKE_VERSION VERSION_LESS 3.0.2) 12 | message(FATAL_ERROR \"qtermwidget requires at least CMake version 3.0.2\") 13 | endif() 14 | 15 | if (NOT TARGET @QTERMWIDGET_LIBRARY_NAME@) 16 | if (POLICY CMP0024) 17 | cmake_policy(SET CMP0024 NEW) 18 | endif() 19 | include("${CMAKE_CURRENT_LIST_DIR}/@QTERMWIDGET_LIBRARY_NAME@-targets.cmake") 20 | endif() 21 | -------------------------------------------------------------------------------- /docs/configuration.md: -------------------------------------------------------------------------------- 1 | # Migration for background images 2 | 3 | How the background image is drawn has been changed since version 0.17. 4 | Intuitively, the background image is now drawn above the background color instead of below it. 5 | Technically, the background image is no longer blended with the background color. 6 | 7 | Any background image can be used but, of course, it should be chosen so that the terminal text can be easily read on it. 8 | Since an image may not be totally dark or light, you might want to use a translucent image as the background. 9 | As a result, the background image is mixed with the background color to improve readability. 10 | Opaque images can also be converted to translucent ones with a few steps. 11 | 12 | A common usage is an effect similar to previous qtermwidget versions or other terminal emulators. 13 | To achieve that, you can convert the background image to a translucent one with the transparency level matching the original terminal transparency. 14 | For example, if the original terminal transparency of qtermwidget was 25% (or 75% in some other terminal emulators), a converted image with transparency 25% will work as usual. 15 | The conversion can be done via ImageMagick, GraphicsMagick, GIMP or Krita. 16 | Here is an example command using ImageMagick: 17 | 18 | $ convert original_image.jpg -matte -channel A +level 0,25% +channel translucent_image.png 19 | 20 | You may also want to change the terminal transparency to 0% if you do not want to see another window or the desktop below the terminal. 21 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | Here are two sample programs which use QTermWidget for displaying a terminal 2 | -------------------------------------------------------------------------------- /examples/cpp/RemoteTerm/README.md: -------------------------------------------------------------------------------- 1 | A simple example showing how to use QTermWidget to control and display a remote terminal. 2 | 3 | To run this example, you should: 4 | 1. Build client-side program. In my PC, I use 'apt-get' to install the QTermWidget library. 5 | 2. Start the shell-srv.py with specific parameters.This will expose a shell via socket. 6 | 3. Start the client-side program from commandline with specific parameters. 7 | 8 | Now you will get your own remote terminal work with QTermWidget. -------------------------------------------------------------------------------- /examples/cpp/RemoteTerm/RemoteTerm.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-10-31T00:37:59 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui network 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = RemoteTerm 12 | TEMPLATE = app 13 | 14 | # The following define makes your compiler emit warnings if you use 15 | # any feature of Qt which as been marked as deprecated (the exact warnings 16 | # depend on your compiler). Please consult the documentation of the 17 | # deprecated API in order to know how to port your code away from it. 18 | DEFINES += QT_DEPRECATED_WARNINGS 19 | 20 | # You can also make your code fail to compile if you use deprecated APIs. 21 | # In order to do so, uncomment the following line. 22 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 24 | 25 | CONFIG += c++11 26 | 27 | SOURCES += \ 28 | main.cpp \ 29 | remoteterm.cpp 30 | 31 | HEADERS += \ 32 | remoteterm.h 33 | 34 | unix:!macx: LIBS += -lqtermwidget5 35 | -------------------------------------------------------------------------------- /examples/cpp/RemoteTerm/main.cpp: -------------------------------------------------------------------------------- 1 | #include "remoteterm.h" 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | if(a.arguments().size() != 3){ 9 | qDebug() << "Example(client-side) for remote terminal of QTermWidget."; 10 | qDebug() << QString("Usage: %1 ipaddr port").arg(a.arguments()[0]); 11 | return 1; 12 | } 13 | QString ipaddr = a.arguments().at(1); 14 | quint16 port = a.arguments().at(2).toUShort(); 15 | RemoteTerm w(ipaddr,port); 16 | w.show(); 17 | 18 | return a.exec(); 19 | } 20 | -------------------------------------------------------------------------------- /examples/cpp/RemoteTerm/remoteterm.cpp: -------------------------------------------------------------------------------- 1 | #include "remoteterm.h" 2 | #include 3 | #include 4 | #include 5 | 6 | RemoteTerm::RemoteTerm(const QString &ipaddr, quint16 port, QWidget *parent) 7 | : QTermWidget(0,parent) 8 | { 9 | socket = new QTcpSocket(this); 10 | 11 | // Write what we input to remote terminal via socket 12 | connect(this, &RemoteTerm::sendData,[this](const char *data, int size){ 13 | this->socket->write(data, size); 14 | }); 15 | 16 | // Read anything from remote terminal via socket and show it on widget. 17 | connect(socket,&QTcpSocket::readyRead,[this](){ 18 | QByteArray data = socket->readAll(); 19 | write(this->getPtySlaveFd(), data.data(), data.size()); 20 | }); 21 | connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(atError())); 22 | 23 | // Here we start an empty pty. 24 | this->startTerminalTeletype(); 25 | 26 | socket->connectToHost(ipaddr, port); 27 | } 28 | 29 | void RemoteTerm::atError() 30 | { 31 | qDebug() << socket->errorString(); 32 | } 33 | -------------------------------------------------------------------------------- /examples/cpp/RemoteTerm/remoteterm.h: -------------------------------------------------------------------------------- 1 | #ifndef WIDGET_H 2 | #define WIDGET_H 3 | 4 | #include 5 | 6 | class QTcpSocket; 7 | 8 | class RemoteTerm : public QTermWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | RemoteTerm(const QString &ipaddr, quint16 port, QWidget *parent = 0); 13 | public slots: 14 | void atError(); 15 | private: 16 | QTcpSocket *socket; 17 | }; 18 | 19 | #endif // WIDGET_H 20 | -------------------------------------------------------------------------------- /examples/cpp/RemoteTerm/shell-srv.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import os 5 | import socket 6 | import pty 7 | 8 | def usage(program): 9 | print "Example(server-side) for remote terminal of QTermWidget." 10 | print "Usage: %s ipaddr port" %program 11 | 12 | 13 | def main(): 14 | if len(sys.argv) != 3: 15 | usage(sys.argv[0]) 16 | sys.exit(1) 17 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 18 | try: 19 | s.bind((sys.argv[1], int(sys.argv[2]))) 20 | s.listen(0) 21 | print "[+]Start Server." 22 | except Exception as e: 23 | print "[-]Error Happened: %s" %e.message 24 | sys.exit(2) 25 | 26 | while True: 27 | c = s.accept() 28 | os.dup2(c[0].fileno(), 0) 29 | os.dup2(c[0].fileno(), 1) 30 | os.dup2(c[0].fileno(), 2) 31 | 32 | # It's important to use pty to spawn the shell. 33 | pty.spawn("/bin/sh") 34 | c[0].close() 35 | 36 | if __name__ == "__main__": 37 | main() 38 | -------------------------------------------------------------------------------- /examples/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008 e_k (e_k@users.sourceforge.net) 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "qtermwidget.h" 27 | 28 | int main(int argc, char *argv[]) 29 | { 30 | QApplication app(argc, argv); 31 | QIcon::setThemeName(QStringLiteral("oxygen")); 32 | QMainWindow *mainWindow = new QMainWindow(); 33 | 34 | QTermWidget *console = new QTermWidget(); 35 | 36 | QMenuBar *menuBar = new QMenuBar(mainWindow); 37 | QMenu *actionsMenu = new QMenu(QStringLiteral("Actions"), menuBar); 38 | menuBar->addMenu(actionsMenu); 39 | actionsMenu->addAction(QStringLiteral("Find..."), QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_F), 40 | console, &QTermWidget::toggleShowSearchBar); 41 | actionsMenu->addAction(QStringLiteral("Copy"), QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_C), 42 | console, &QTermWidget::copyClipboard); 43 | actionsMenu->addAction(QStringLiteral("Paste"), QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_V), 44 | console, &QTermWidget::pasteClipboard); 45 | actionsMenu->addAction(QStringLiteral("About Qt"), &app, &QApplication::aboutQt); 46 | mainWindow->setMenuBar(menuBar); 47 | 48 | QFont font = QApplication::font(); 49 | #ifdef Q_OS_MACOS 50 | font.setFamily(QStringLiteral("Monaco")); 51 | #elif defined(Q_WS_QWS) 52 | font.setFamily(QStringLiteral("fixed")); 53 | #else 54 | font.setFamily(QStringLiteral("Monospace")); 55 | #endif 56 | font.setPointSize(12); 57 | 58 | console->setTerminalFont(font); 59 | 60 | // console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW); 61 | console->setScrollBarPosition(QTermWidget::ScrollBarRight); 62 | 63 | const auto arguments = QApplication::arguments(); 64 | for (const QString& arg : arguments) 65 | { 66 | if (console->availableColorSchemes().contains(arg)) 67 | console->setColorScheme(arg); 68 | if (console->availableKeyBindings().contains(arg)) 69 | console->setKeyBindings(arg); 70 | } 71 | 72 | mainWindow->setCentralWidget(console); 73 | mainWindow->resize(600, 400); 74 | 75 | // info output 76 | qDebug() << "* INFO *************************"; 77 | qDebug() << " availableKeyBindings:" << console->availableKeyBindings(); 78 | qDebug() << " keyBindings:" << console->keyBindings(); 79 | qDebug() << " availableColorSchemes:" << console->availableColorSchemes(); 80 | qDebug() << "* INFO END *********************"; 81 | 82 | // real startup 83 | QObject::connect(console, &QTermWidget::finished, mainWindow, &QMainWindow::close); 84 | 85 | mainWindow->show(); 86 | return app.exec(); 87 | } 88 | -------------------------------------------------------------------------------- /examples/pyqt/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | from PyQt5 import QtWidgets 3 | from QTermWidget import QTermWidget 4 | 5 | 6 | class Terminal(QTermWidget): 7 | def __init__(self, process: str, args: list): 8 | super().__init__(0) 9 | self.finished.connect(self.close) 10 | self.setTerminalSizeHint(False) 11 | self.setColorScheme("DarkPastels") 12 | self.setShellProgram(process) 13 | self.setArgs(args) 14 | self.startShellProgram() 15 | self.show() 16 | 17 | 18 | if __name__ == "__main__": 19 | app = QtWidgets.QApplication([]) 20 | args = ["--clean", "--noplugin"] 21 | term = Terminal("vim", args) 22 | app.exec() 23 | -------------------------------------------------------------------------------- /lib/BlockArray.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Konsole, an X terminal. 3 | Copyright (C) 2000 by Stephan Kulow 4 | 5 | Rewritten for QT4 by e_k , Copyright (C)2008 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20 | 02110-1301 USA. 21 | */ 22 | 23 | #ifndef BLOCKARRAY_H 24 | #define BLOCKARRAY_H 25 | 26 | #include 27 | 28 | //#error Do not use in KDE 2.1 29 | 30 | #define QTERMWIDGET_BLOCKSIZE (1 << 12) 31 | #define ENTRIES (QTERMWIDGET_BLOCKSIZE - sizeof(size_t)) 32 | 33 | namespace Konsole { 34 | 35 | struct Block { 36 | unsigned char data[ENTRIES] = {}; 37 | size_t size = 0; 38 | }; 39 | 40 | // /////////////////////////////////////////////////////// 41 | 42 | class BlockArray { 43 | public: 44 | /** 45 | * Creates a history file for holding 46 | * maximal size blocks. If more blocks 47 | * are requested, then it drops earlier 48 | * added ones. 49 | */ 50 | BlockArray(); 51 | 52 | /// destructor 53 | ~BlockArray(); 54 | 55 | /** 56 | * adds the Block at the end of history. 57 | * This may drop other blocks. 58 | * 59 | * The ownership on the block is transferred. 60 | * An unique index number is returned for accessing 61 | * it later (if not yet dropped then) 62 | * 63 | * Note, that the block may be dropped completely 64 | * if history is turned off. 65 | */ 66 | size_t append(Block * block); 67 | 68 | /** 69 | * gets the block at the index. Function may return 70 | * 0 if the block isn't available any more. 71 | * 72 | * The returned block is strictly readonly as only 73 | * mapped in memory - and will be invalid on the next 74 | * operation on this class. 75 | */ 76 | const Block * at(size_t index); 77 | 78 | /** 79 | * reorders blocks as needed. If newsize is null, 80 | * the history is emptied completely. The indices 81 | * returned on append won't change their semantic, 82 | * but they may not be valid after this call. 83 | */ 84 | bool setHistorySize(size_t newsize); 85 | 86 | size_t newBlock(); 87 | 88 | Block * lastBlock() const; 89 | 90 | /** 91 | * Convenient function to set the size in KBytes 92 | * instead of blocks 93 | */ 94 | bool setSize(size_t newsize); 95 | 96 | size_t len() const { 97 | return length; 98 | } 99 | 100 | bool has(size_t index) const; 101 | 102 | size_t getCurrent() const { 103 | return current; 104 | } 105 | 106 | private: 107 | void unmap(); 108 | void increaseBuffer(); 109 | void decreaseBuffer(size_t newsize); 110 | 111 | size_t size; 112 | // current always shows to the last inserted block 113 | size_t current; 114 | size_t index; 115 | 116 | Block * lastmap; 117 | size_t lastmap_index; 118 | Block * lastblock; 119 | 120 | int ion; 121 | size_t length; 122 | 123 | }; 124 | 125 | } 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /lib/ColorTables.h: -------------------------------------------------------------------------------- 1 | #ifndef _COLOR_TABLE_H 2 | #define _COLOR_TABLE_H 3 | 4 | #include "CharacterColor.h" 5 | 6 | //using namespace Konsole; 7 | #if 0 8 | static const ColorEntry whiteonblack_color_table[TABLE_COLORS] = { 9 | // normal 10 | ColorEntry(QColor(0xFF,0xFF,0xFF), false ), ColorEntry( QColor(0x00,0x00,0x00), true ), // Dfore, Dback 11 | ColorEntry(QColor(0x00,0x00,0x00), false ), ColorEntry( QColor(0xB2,0x18,0x18), false ), // Black, Red 12 | ColorEntry(QColor(0x18,0xB2,0x18), false ), ColorEntry( QColor(0xB2,0x68,0x18), false ), // Green, Yellow 13 | ColorEntry(QColor(0x18,0x18,0xB2), false ), ColorEntry( QColor(0xB2,0x18,0xB2), false ), // Blue, Magenta 14 | ColorEntry(QColor(0x18,0xB2,0xB2), false ), ColorEntry( QColor(0xB2,0xB2,0xB2), false ), // Cyan, White 15 | // intensiv 16 | ColorEntry(QColor(0x00,0x00,0x00), false ), ColorEntry( QColor(0xFF,0xFF,0xFF), true ), 17 | ColorEntry(QColor(0x68,0x68,0x68), false ), ColorEntry( QColor(0xFF,0x54,0x54), false ), 18 | ColorEntry(QColor(0x54,0xFF,0x54), false ), ColorEntry( QColor(0xFF,0xFF,0x54), false ), 19 | ColorEntry(QColor(0x54,0x54,0xFF), false ), ColorEntry( QColor(0xFF,0x54,0xFF), false ), 20 | ColorEntry(QColor(0x54,0xFF,0xFF), false ), ColorEntry( QColor(0xFF,0xFF,0xFF), false ) 21 | }; 22 | 23 | static const ColorEntry greenonblack_color_table[TABLE_COLORS] = { 24 | ColorEntry(QColor( 24, 240, 24), false), ColorEntry(QColor( 0, 0, 0), true), 25 | ColorEntry(QColor( 0, 0, 0), false), ColorEntry(QColor( 178, 24, 24), false), 26 | ColorEntry(QColor( 24, 178, 24), false), ColorEntry(QColor( 178, 104, 24), false), 27 | ColorEntry(QColor( 24, 24, 178), false), ColorEntry(QColor( 178, 24, 178), false), 28 | ColorEntry(QColor( 24, 178, 178), false), ColorEntry(QColor( 178, 178, 178), false), 29 | // intensive colors 30 | ColorEntry(QColor( 24, 240, 24), false ), ColorEntry(QColor( 0, 0, 0), true ), 31 | ColorEntry(QColor( 104, 104, 104), false ), ColorEntry(QColor( 255, 84, 84), false ), 32 | ColorEntry(QColor( 84, 255, 84), false ), ColorEntry(QColor( 255, 255, 84), false ), 33 | ColorEntry(QColor( 84, 84, 255), false ), ColorEntry(QColor( 255, 84, 255), false ), 34 | ColorEntry(QColor( 84, 255, 255), false ), ColorEntry(QColor( 255, 255, 255), false ) 35 | }; 36 | 37 | static const ColorEntry blackonlightyellow_color_table[TABLE_COLORS] = { 38 | ColorEntry(QColor( 0, 0, 0), false), ColorEntry(QColor( 255, 255, 221), true), 39 | ColorEntry(QColor( 0, 0, 0), false), ColorEntry(QColor( 178, 24, 24), false), 40 | ColorEntry(QColor( 24, 178, 24), false), ColorEntry(QColor( 178, 104, 24), false), 41 | ColorEntry(QColor( 24, 24, 178), false), ColorEntry(QColor( 178, 24, 178), false), 42 | ColorEntry(QColor( 24, 178, 178), false), ColorEntry(QColor( 178, 178, 178), false), 43 | ColorEntry(QColor( 0, 0, 0), false), ColorEntry(QColor( 255, 255, 221), true), 44 | ColorEntry(QColor(104, 104, 104), false), ColorEntry(QColor( 255, 84, 84), false), 45 | ColorEntry(QColor( 84, 255, 84), false), ColorEntry(QColor( 255, 255, 84), false), 46 | ColorEntry(QColor( 84, 84, 255), false), ColorEntry(QColor( 255, 84, 255), false), 47 | ColorEntry(QColor( 84, 255, 255), false), ColorEntry(QColor( 255, 255, 255), false) 48 | }; 49 | 50 | 51 | #endif 52 | 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /lib/DefaultTranslatorText.h: -------------------------------------------------------------------------------- 1 | "keyboard \"Fallback Key Translator\"\n" 2 | "key Tab : \"\\t\" \0" 3 | -------------------------------------------------------------------------------- /lib/ExtendedDefaultTranslator.h: -------------------------------------------------------------------------------- 1 | "keyboard \"Default (XFree 4)\"" 2 | "key Escape : \"\\E\"" 3 | "key Tab -Shift : \"\\t\"\n" 4 | "key Tab +Shift+Ansi : \"\\E[Z\"\n" 5 | "key Tab +Shift-Ansi : \"\\t\"\n" 6 | "key Backtab +Ansi : \"\\E[Z\"\n" 7 | "key Backtab -Ansi : \"\\t\"\n" 8 | "key Return-Shift-NewLine : \"\\r\"\n" 9 | "key Return-Shift+NewLine : \"\\r\\n\"\n" 10 | "key Return+Shift : \"\\EOM\"\n" 11 | "key Backspace : \"\\x7f\"\n" 12 | "key Up -Shift-Ansi : \"\\EA\"\n" 13 | "key Down -Shift-Ansi : \"\\EB\"\n" 14 | "key Right-Shift-Ansi : \"\\EC\"\n" 15 | "key Left -Shift-Ansi : \"\\ED\"\n" 16 | "key Up -Shift-AnyMod+Ansi+AppCuKeys : \"\\EOA\"\n" 17 | "key Down -Shift-AnyMod+Ansi+AppCuKeys : \"\\EOB\"\n" 18 | "key Right -Shift-AnyMod+Ansi+AppCuKeys : \"\\EOC\"\n" 19 | "key Left -Shift-AnyMod+Ansi+AppCuKeys : \"\\EOD\"\n" 20 | "key Up -Shift-AnyMod+Ansi-AppCuKeys : \"\\E[A\"\n" 21 | "key Down -Shift-AnyMod+Ansi-AppCuKeys : \"\\E[B\"\n" 22 | "key Right -Shift-AnyMod+Ansi-AppCuKeys : \"\\E[C\"\n" 23 | "key Left -Shift-AnyMod+Ansi-AppCuKeys : \"\\E[D\"\n" 24 | "key Up -Shift+AnyMod+Ansi : \"\\E[1;*A\"\n" 25 | "key Down -Shift+AnyMod+Ansi : \"\\E[1;*B\"\n" 26 | "key Right -Shift+AnyMod+Ansi : \"\\E[1;*C\"\n" 27 | "key Left -Shift+AnyMod+Ansi : \"\\E[1;*D\"\n" 28 | "key Enter+NewLine : \"\\r\\n\"\n" 29 | "key Enter-NewLine : \"\\r\"\n" 30 | "key Home -AnyMod -AppCuKeys : \"\\E[H\" \n" 31 | "key End -AnyMod -AppCuKeys : \"\\E[F\" \n" 32 | "key Home -AnyMod +AppCuKeys : \"\\EOH\" \n" 33 | "key End -AnyMod +AppCuKeys : \"\\EOF\" \n" 34 | "key Home +AnyMod : \"\\E[1;*H\"\n" 35 | "key End +AnyMod : \"\\E[1;*F\"\n" 36 | "key Insert -AnyMod : \"\\E[2~\"\n" 37 | "key Delete -AnyMod : \"\\E[3~\"\n" 38 | "key Insert +AnyMod : \"\\E[2;*~\"\n" 39 | "key Delete +AnyMod : \"\\E[3;*~\"\n" 40 | "key Prior -Shift-AnyMod : \"\\E[5~\"\n" 41 | "key Next -Shift-AnyMod : \"\\E[6~\"\n" 42 | "key Prior -Shift+AnyMod : \"\\E[5;*~\"\n" 43 | "key Next -Shift+AnyMod : \"\\E[6;*~\"\n" 44 | "key F1 -AnyMod : \"\\EOP\"\n" 45 | "key F2 -AnyMod : \"\\EOQ\"\n" 46 | "key F3 -AnyMod : \"\\EOR\"\n" 47 | "key F4 -AnyMod : \"\\EOS\"\n" 48 | "key F5 -AnyMod : \"\\E[15~\"\n" 49 | "key F6 -AnyMod : \"\\E[17~\"\n" 50 | "key F7 -AnyMod : \"\\E[18~\"\n" 51 | "key F8 -AnyMod : \"\\E[19~\"\n" 52 | "key F9 -AnyMod : \"\\E[20~\"\n" 53 | "key F10 -AnyMod : \"\\E[21~\"\n" 54 | "key F11 -AnyMod : \"\\E[23~\"\n" 55 | "key F12 -AnyMod : \"\\E[24~\"\n" 56 | "key F1 +AnyMod : \"\\EO*P\"\n" 57 | "key F2 +AnyMod : \"\\EO*Q\"\n" 58 | "key F3 +AnyMod : \"\\EO*R\"\n" 59 | "key F4 +AnyMod : \"\\EO*S\"\n" 60 | "key F5 +AnyMod : \"\\E[15;*~\"\n" 61 | "key F6 +AnyMod : \"\\E[17;*~\"\n" 62 | "key F7 +AnyMod : \"\\E[18;*~\"\n" 63 | "key F8 +AnyMod : \"\\E[19;*~\"\n" 64 | "key F9 +AnyMod : \"\\E[20;*~\"\n" 65 | "key F10 +AnyMod : \"\\E[21;*~\"\n" 66 | "key F11 +AnyMod : \"\\E[23;*~\"\n" 67 | "key F12 +AnyMod : \"\\E[24;*~\"\n" 68 | "key Space +Control : \"\\x00\"\n" 69 | "key Up +Shift-AppScreen : scrollLineUp\n" 70 | "key Prior +Shift-AppScreen : scrollPageUp\n" 71 | "key Down +Shift-AppScreen : scrollLineDown\n" 72 | "key Next +Shift-AppScreen : scrollPageDown\n" 73 | "key ScrollLock : scrollLock\n" 74 | "\0" 75 | -------------------------------------------------------------------------------- /lib/HistorySearch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Christian Surlykke 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301 USA. 18 | */ 19 | #include 20 | #include 21 | #include 22 | 23 | #include "TerminalCharacterDecoder.h" 24 | #include "Emulation.h" 25 | #include "HistorySearch.h" 26 | 27 | HistorySearch::HistorySearch(EmulationPtr emulation, const QRegularExpression& regExp, 28 | bool forwards, int startColumn, int startLine, 29 | QObject* parent) : 30 | QObject(parent), 31 | m_emulation(emulation), 32 | m_regExp(regExp), 33 | m_forwards(forwards), 34 | m_startColumn(startColumn), 35 | m_startLine(startLine) { 36 | } 37 | 38 | HistorySearch::~HistorySearch() { 39 | } 40 | 41 | void HistorySearch::search() { 42 | bool found = false; 43 | 44 | if (! m_regExp.pattern().isEmpty()) 45 | { 46 | if (m_forwards) { 47 | found = search(m_startColumn, m_startLine, -1, m_emulation->lineCount()) || search(0, 0, m_startColumn, m_startLine); 48 | } else { 49 | found = search(0, 0, m_startColumn, m_startLine) || search(m_startColumn, m_startLine, -1, m_emulation->lineCount()); 50 | } 51 | 52 | if (found) { 53 | emit matchFound(m_foundStartColumn, m_foundStartLine, m_foundEndColumn, m_foundEndLine); 54 | } 55 | else { 56 | emit noMatchFound(); 57 | } 58 | } 59 | 60 | deleteLater(); 61 | } 62 | 63 | bool HistorySearch::search(int startColumn, int startLine, int endColumn, int endLine) { 64 | qDebug() << "search from" << startColumn << "," << startLine 65 | << "to" << endColumn << "," << endLine; 66 | 67 | int linesRead = 0; 68 | int linesToRead = endLine - startLine + 1; 69 | 70 | qDebug() << "linesToRead:" << linesToRead; 71 | 72 | // We read process history from (and including) startLine to (and including) endLine in 73 | // blocks of at most 10K lines so that we do not use unhealthy amounts of memory 74 | int blockSize; 75 | while ((blockSize = qMin(10000, linesToRead - linesRead)) > 0) { 76 | 77 | QString string; 78 | QTextStream searchStream(&string); 79 | PlainTextDecoder decoder; 80 | decoder.begin(&searchStream); 81 | decoder.setRecordLinePositions(true); 82 | 83 | // Calculate lines to read and read them 84 | int blockStartLine = m_forwards ? startLine + linesRead : endLine - linesRead - blockSize + 1; 85 | int chunkEndLine = blockStartLine + blockSize - 1; 86 | m_emulation->writeToStream(&decoder, blockStartLine, chunkEndLine); 87 | 88 | // We search between startColumn in the first line of the string and endColumn in the last 89 | // line of the string. First we calculate the position (in the string) of endColumn in the 90 | // last line of the string 91 | int endPosition; 92 | 93 | // The String that Emulator.writeToStream produces has a newline at the end, and so ends with an 94 | // empty line - we ignore that. 95 | int numberOfLinesInString = decoder.linePositions().size() - 1; 96 | if (numberOfLinesInString > 0 && endColumn > -1 ) 97 | { 98 | endPosition = decoder.linePositions().at(numberOfLinesInString - 1) + endColumn; 99 | } 100 | else 101 | { 102 | endPosition = string.size(); 103 | } 104 | 105 | // So now we can log for m_regExp in the string between startColumn and endPosition 106 | int matchStart; 107 | QRegularExpressionMatch match; 108 | if (m_forwards) 109 | { 110 | matchStart = string.indexOf(m_regExp, startColumn, &match); 111 | if (matchStart >= endPosition) 112 | matchStart = -1; 113 | } 114 | else 115 | { 116 | matchStart = string.lastIndexOf(m_regExp, endPosition - 1, &match); 117 | if (matchStart < startColumn) 118 | matchStart = -1; 119 | } 120 | 121 | if (matchStart > -1) 122 | { 123 | int matchEnd = matchStart + match.capturedLength() - 1; 124 | qDebug() << "Found in string from" << matchStart << "to" << matchEnd; 125 | 126 | // Translate startPos and endPos to startColum, startLine, endColumn and endLine in history. 127 | int startLineNumberInString = findLineNumberInString(decoder.linePositions(), matchStart); 128 | m_foundStartColumn = matchStart - decoder.linePositions().at(startLineNumberInString); 129 | m_foundStartLine = startLineNumberInString + startLine + linesRead; 130 | 131 | int endLineNumberInString = findLineNumberInString(decoder.linePositions(), matchEnd); 132 | m_foundEndColumn = matchEnd - decoder.linePositions().at(endLineNumberInString); 133 | m_foundEndLine = endLineNumberInString + startLine + linesRead; 134 | 135 | qDebug() << "m_foundStartColumn" << m_foundStartColumn 136 | << "m_foundStartLine" << m_foundEndLine 137 | << "m_foundEndColumn" << m_foundEndColumn 138 | << "m_foundEndLine" << m_foundEndLine; 139 | 140 | return true; 141 | } 142 | 143 | 144 | linesRead += blockSize; 145 | } 146 | 147 | qDebug() << "Not found"; 148 | return false; 149 | } 150 | 151 | 152 | int HistorySearch::findLineNumberInString(QList linePositions, int position) { 153 | int lineNum = 0; 154 | while (lineNum + 1 < linePositions.size() && linePositions[lineNum + 1] <= position) 155 | lineNum++; 156 | 157 | return lineNum; 158 | } 159 | -------------------------------------------------------------------------------- /lib/HistorySearch.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Christian Surlykke 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301 USA. 18 | */ 19 | #ifndef TASK_H 20 | #define TASK_H 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include "Emulation.h" 31 | #include "TerminalCharacterDecoder.h" 32 | 33 | using namespace Konsole; 34 | 35 | typedef QPointer EmulationPtr; 36 | 37 | class HistorySearch : public QObject 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit HistorySearch(EmulationPtr emulation, const QRegularExpression& regExp, bool forwards, 43 | int startColumn, int startLine, QObject* parent); 44 | 45 | ~HistorySearch() override; 46 | 47 | void search(); 48 | 49 | signals: 50 | void matchFound(int startColumn, int startLine, int endColumn, int endLine); 51 | void noMatchFound(); 52 | 53 | private: 54 | bool search(int startColumn, int startLine, int endColumn, int endLine); 55 | int findLineNumberInString(QList linePositions, int position); 56 | 57 | 58 | EmulationPtr m_emulation; 59 | QRegularExpression m_regExp; 60 | bool m_forwards = false; 61 | int m_startColumn = 0; 62 | int m_startLine = 0; 63 | 64 | int m_foundStartColumn = 0; 65 | int m_foundStartLine = 0; 66 | int m_foundEndColumn = 0; 67 | int m_foundEndLine = 0; 68 | }; 69 | 70 | #endif /* TASK_H */ 71 | 72 | -------------------------------------------------------------------------------- /lib/LineFont.h: -------------------------------------------------------------------------------- 1 | // WARNING: Autogenerated by "fontembedder ./linefont.src". 2 | // You probably do not want to hand-edit this! 3 | 4 | static const quint32 LineChars[] = { 5 | 0x00007c00, 0x000fffe0, 0x00421084, 0x00e739ce, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00427000, 0x004e7380, 0x00e77800, 0x00ef7bc0, 7 | 0x00421c00, 0x00439ce0, 0x00e73c00, 0x00e7bde0, 0x00007084, 0x000e7384, 0x000079ce, 0x000f7bce, 8 | 0x00001c84, 0x00039ce4, 0x00003dce, 0x0007bdee, 0x00427084, 0x004e7384, 0x004279ce, 0x00e77884, 9 | 0x00e779ce, 0x004f7bce, 0x00ef7bc4, 0x00ef7bce, 0x00421c84, 0x00439ce4, 0x00423dce, 0x00e73c84, 10 | 0x00e73dce, 0x0047bdee, 0x00e7bde4, 0x00e7bdee, 0x00427c00, 0x0043fce0, 0x004e7f80, 0x004fffe0, 11 | 0x004fffe0, 0x00e7fde0, 0x006f7fc0, 0x00efffe0, 0x00007c84, 0x0003fce4, 0x000e7f84, 0x000fffe4, 12 | 0x00007dce, 0x0007fdee, 0x000f7fce, 0x000fffee, 0x00427c84, 0x0043fce4, 0x004e7f84, 0x004fffe4, 13 | 0x00427dce, 0x00e77c84, 0x00e77dce, 0x0047fdee, 0x004e7fce, 0x00e7fde4, 0x00ef7f84, 0x004fffee, 14 | 0x00efffe4, 0x00e7fdee, 0x00ef7fce, 0x00efffee, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 15 | 0x000f83e0, 0x00a5294a, 0x004e1380, 0x00a57800, 0x00ad0bc0, 0x004390e0, 0x00a53c00, 0x00a5a1e0, 16 | 0x000e1384, 0x0000794a, 0x000f0b4a, 0x000390e4, 0x00003d4a, 0x0007a16a, 0x004e1384, 0x00a5694a, 17 | 0x00ad2b4a, 0x004390e4, 0x00a52d4a, 0x00a5a16a, 0x004f83e0, 0x00a57c00, 0x00ad83e0, 0x000f83e4, 18 | 0x00007d4a, 0x000f836a, 0x004f93e4, 0x00a57d4a, 0x00ad836a, 0x00000000, 0x00000000, 0x00000000, 19 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0x00001084, 0x00007000, 0x00421000, 20 | 0x00039ce0, 0x000039ce, 0x000e7380, 0x00e73800, 0x000e7f80, 0x00e73884, 0x0003fce0, 0x004239ce 21 | }; 22 | -------------------------------------------------------------------------------- /lib/SearchBar.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Christian Surlykke 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301 USA. 18 | */ 19 | #include 20 | #include 21 | #include 22 | 23 | #include "SearchBar.h" 24 | 25 | SearchBar::SearchBar(QWidget *parent) : QWidget(parent) 26 | { 27 | widget.setupUi(this); 28 | setAutoFillBackground(true); // make it always opaque, especially inside translucent windows 29 | connect(widget.closeButton, &QAbstractButton::clicked, this, &SearchBar::hide); 30 | connect(widget.searchTextEdit, SIGNAL(textChanged(QString)), this, SIGNAL(searchCriteriaChanged())); 31 | connect(widget.findPreviousButton, SIGNAL(clicked()), this, SIGNAL(findPrevious())); 32 | connect(widget.findNextButton, SIGNAL(clicked()), this, SIGNAL(findNext())); 33 | 34 | connect(this, SIGNAL(searchCriteriaChanged()), this, SLOT(clearBackgroundColor())); 35 | 36 | QMenu *optionsMenu = new QMenu(widget.optionsButton); 37 | widget.optionsButton->setMenu(optionsMenu); 38 | 39 | m_matchCaseMenuEntry = optionsMenu->addAction(tr("Match case")); 40 | m_matchCaseMenuEntry->setCheckable(true); 41 | m_matchCaseMenuEntry->setChecked(true); 42 | connect(m_matchCaseMenuEntry, SIGNAL(toggled(bool)), this, SIGNAL(searchCriteriaChanged())); 43 | 44 | 45 | m_useRegularExpressionMenuEntry = optionsMenu->addAction(tr("Regular expression")); 46 | m_useRegularExpressionMenuEntry->setCheckable(true); 47 | connect(m_useRegularExpressionMenuEntry, SIGNAL(toggled(bool)), this, SIGNAL(searchCriteriaChanged())); 48 | 49 | m_highlightMatchesMenuEntry = optionsMenu->addAction(tr("Highlight all matches")); 50 | m_highlightMatchesMenuEntry->setCheckable(true); 51 | m_highlightMatchesMenuEntry->setChecked(true); 52 | connect(m_highlightMatchesMenuEntry, SIGNAL(toggled(bool)), this, SIGNAL(highlightMatchesChanged(bool))); 53 | } 54 | 55 | SearchBar::~SearchBar() { 56 | } 57 | 58 | QString SearchBar::searchText() 59 | { 60 | return widget.searchTextEdit->text(); 61 | } 62 | 63 | 64 | bool SearchBar::useRegularExpression() 65 | { 66 | return m_useRegularExpressionMenuEntry->isChecked(); 67 | } 68 | 69 | bool SearchBar::matchCase() 70 | { 71 | return m_matchCaseMenuEntry->isChecked(); 72 | } 73 | 74 | bool SearchBar::highlightAllMatches() 75 | { 76 | return m_highlightMatchesMenuEntry->isChecked(); 77 | } 78 | 79 | void SearchBar::show() 80 | { 81 | QWidget::show(); 82 | widget.searchTextEdit->setFocus(); 83 | widget.searchTextEdit->selectAll(); 84 | } 85 | 86 | void SearchBar::hide() 87 | { 88 | QWidget::hide(); 89 | if (QWidget *p = parentWidget()) 90 | { 91 | p->setFocus(Qt::OtherFocusReason); // give the focus to the parent widget on hiding 92 | } 93 | } 94 | 95 | void SearchBar::noMatchFound() 96 | { 97 | QPalette palette; 98 | palette.setColor(widget.searchTextEdit->backgroundRole(), QColor(255, 128, 128)); 99 | widget.searchTextEdit->setPalette(palette); 100 | } 101 | 102 | 103 | void SearchBar::keyReleaseEvent(QKeyEvent* keyEvent) 104 | { 105 | if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) 106 | { 107 | if (keyEvent->modifiers() == Qt::ShiftModifier) 108 | { 109 | Q_EMIT findPrevious(); 110 | } 111 | else 112 | { 113 | Q_EMIT findNext(); 114 | } 115 | } 116 | else if (keyEvent->key() == Qt::Key_Escape) 117 | { 118 | hide(); 119 | } 120 | } 121 | 122 | void SearchBar::clearBackgroundColor() 123 | { 124 | widget.searchTextEdit->setPalette(QWidget::window()->palette()); 125 | 126 | } 127 | -------------------------------------------------------------------------------- /lib/SearchBar.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Christian Surlykke 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301 USA. 18 | */ 19 | #ifndef _SEARCHBAR_H 20 | #define _SEARCHBAR_H 21 | 22 | #include 23 | 24 | #include "ui_SearchBar.h" 25 | #include "HistorySearch.h" 26 | 27 | class SearchBar : public QWidget { 28 | Q_OBJECT 29 | public: 30 | SearchBar(QWidget* parent = nullptr); 31 | ~SearchBar() override; 32 | virtual void show(); 33 | QString searchText(); 34 | bool useRegularExpression(); 35 | bool matchCase(); 36 | bool highlightAllMatches(); 37 | 38 | public slots: 39 | void noMatchFound(); 40 | void hide(); 41 | 42 | signals: 43 | void searchCriteriaChanged(); 44 | void highlightMatchesChanged(bool highlightMatches); 45 | void findNext(); 46 | void findPrevious(); 47 | 48 | protected: 49 | void keyReleaseEvent(QKeyEvent* keyEvent) override; 50 | 51 | private slots: 52 | void clearBackgroundColor(); 53 | 54 | private: 55 | Ui::SearchBar widget; 56 | QAction *m_matchCaseMenuEntry; 57 | QAction *m_useRegularExpressionMenuEntry; 58 | QAction *m_highlightMatchesMenuEntry; 59 | }; 60 | 61 | #endif /* _SEARCHBAR_H */ 62 | -------------------------------------------------------------------------------- /lib/SearchBar.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SearchBar 4 | 5 | 6 | 7 | 0 8 | 0 9 | 399 10 | 40 11 | 12 | 13 | 14 | SearchBar 15 | 16 | 17 | 18 | 19 | 20 | X 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Find: 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | < 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | > 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | ... 67 | 68 | 69 | 70 | 71 | 72 | QToolButton::InstantPopup 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /lib/ShellCommand.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007 by Robert Knight 3 | 4 | Rewritten for QT4 by e_k , Copyright (C)2008 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 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 | // Own 23 | #include "ShellCommand.h" 24 | 25 | //some versions of gcc(4.3) require explicit include 26 | #include 27 | 28 | 29 | using namespace Konsole; 30 | 31 | // expands environment variables in 'text' 32 | // function copied from kdelibs/kio/kio/kurlcompletion.cpp 33 | static bool expandEnv(QString & text); 34 | 35 | ShellCommand::ShellCommand(const QString & fullCommand) 36 | { 37 | bool inQuotes = false; 38 | 39 | QString builder; 40 | 41 | for ( int i = 0 ; i < fullCommand.size() ; i++ ) { 42 | QChar ch = fullCommand[i]; 43 | 44 | const bool isLastChar = ( i == fullCommand.size() - 1 ); 45 | const bool isQuote = ( ch == QLatin1Char('\'') || ch == QLatin1Char('\"') ); 46 | 47 | if ( !isLastChar && isQuote ) { 48 | inQuotes = !inQuotes; 49 | } else { 50 | if ( (!ch.isSpace() || inQuotes) && !isQuote ) { 51 | builder.append(ch); 52 | } 53 | 54 | if ( (ch.isSpace() && !inQuotes) || ( i == fullCommand.size()-1 ) ) { 55 | _arguments << builder; 56 | builder.clear(); 57 | } 58 | } 59 | } 60 | } 61 | ShellCommand::ShellCommand(const QString & command , const QStringList & arguments) 62 | : _arguments(arguments) 63 | { 64 | if ( !_arguments.isEmpty() ) { 65 | _arguments[0] = command; 66 | } 67 | } 68 | QString ShellCommand::fullCommand() const 69 | { 70 | return _arguments.join(QLatin1Char(' ')); 71 | } 72 | QString ShellCommand::command() const 73 | { 74 | if ( !_arguments.isEmpty() ) { 75 | return _arguments[0]; 76 | } else { 77 | return QString(); 78 | } 79 | } 80 | QStringList ShellCommand::arguments() const 81 | { 82 | return _arguments; 83 | } 84 | bool ShellCommand::isRootCommand() const 85 | { 86 | Q_ASSERT(0); // not implemented yet 87 | return false; 88 | } 89 | bool ShellCommand::isAvailable() const 90 | { 91 | Q_ASSERT(0); // not implemented yet 92 | return false; 93 | } 94 | QStringList ShellCommand::expand(const QStringList & items) 95 | { 96 | QStringList result; 97 | 98 | for(const QString &item : items) { 99 | result << expand(item); 100 | } 101 | 102 | return result; 103 | } 104 | QString ShellCommand::expand(const QString & text) 105 | { 106 | QString result = text; 107 | expandEnv(result); 108 | return result; 109 | } 110 | 111 | /* 112 | * expandEnv 113 | * 114 | * Expand environment variables in text. Escaped '$' characters are ignored. 115 | * Return true if any variables were expanded 116 | */ 117 | static bool expandEnv( QString & text ) 118 | { 119 | // Find all environment variables beginning with '$' 120 | // 121 | int pos = 0; 122 | 123 | bool expanded = false; 124 | 125 | while ( (pos = text.indexOf(QLatin1Char('$'), pos)) != -1 ) { 126 | 127 | // Skip escaped '$' 128 | // 129 | if ( pos > 0 && text.at(pos-1) == QLatin1Char('\\') ) { 130 | pos++; 131 | } 132 | // Variable found => expand 133 | // 134 | else { 135 | // Find the end of the variable = next '/' or ' ' 136 | // 137 | int pos2 = text.indexOf( QLatin1Char(' '), pos+1 ); 138 | int pos_tmp = text.indexOf( QLatin1Char('/'), pos+1 ); 139 | 140 | if ( pos2 == -1 || (pos_tmp != -1 && pos_tmp < pos2) ) { 141 | pos2 = pos_tmp; 142 | } 143 | 144 | if ( pos2 == -1 ) { 145 | pos2 = text.length(); 146 | } 147 | 148 | // Replace if the variable is terminated by '/' or ' ' 149 | // and defined 150 | // 151 | if ( pos2 >= 0 ) { 152 | int len = pos2 - pos; 153 | QString key = text.mid( pos+1, len-1); 154 | QString value = 155 | QString::fromLocal8Bit( qgetenv(key.toLocal8Bit().constData()) ); 156 | 157 | if ( !value.isEmpty() ) { 158 | expanded = true; 159 | text.replace( pos, len, value ); 160 | pos = pos + value.length(); 161 | } else { 162 | pos = pos2; 163 | } 164 | } 165 | } 166 | } 167 | 168 | return expanded; 169 | } 170 | -------------------------------------------------------------------------------- /lib/ShellCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007 by Robert Knight 3 | 4 | Rewritten for QT4 by e_k , Copyright (C)2008 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 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 SHELLCOMMAND_H 23 | #define SHELLCOMMAND_H 24 | 25 | // Qt 26 | #include 27 | 28 | namespace Konsole { 29 | 30 | /** 31 | * A class to parse and extract information about shell commands. 32 | * 33 | * ShellCommand can be used to: 34 | * 35 | *
    36 | *
  • Take a command-line (eg "/bin/sh -c /path/to/my/script") and split it 37 | * into its component parts (eg. the command "/bin/sh" and the arguments 38 | * "-c","/path/to/my/script") 39 | *
  • 40 | *
  • Take a command and a list of arguments and combine them to 41 | * form a complete command line. 42 | *
  • 43 | *
  • Determine whether the binary specified by a command exists in the 44 | * user's PATH. 45 | *
  • 46 | *
  • Determine whether a command-line specifies the execution of 47 | * another command as the root user using su/sudo etc. 48 | *
  • 49 | *
50 | */ 51 | class ShellCommand { 52 | public: 53 | /** 54 | * Constructs a ShellCommand from a command line. 55 | * 56 | * @param fullCommand The command line to parse. 57 | */ 58 | ShellCommand(const QString & fullCommand); 59 | /** 60 | * Constructs a ShellCommand with the specified @p command and @p arguments. 61 | */ 62 | ShellCommand(const QString & command , const QStringList & arguments); 63 | 64 | /** Returns the command. */ 65 | QString command() const; 66 | /** Returns the arguments. */ 67 | QStringList arguments() const; 68 | 69 | /** 70 | * Returns the full command line. 71 | */ 72 | QString fullCommand() const; 73 | 74 | /** Returns true if this is a root command. */ 75 | bool isRootCommand() const; 76 | /** Returns true if the program specified by @p command() exists. */ 77 | bool isAvailable() const; 78 | 79 | /** Expands environment variables in @p text .*/ 80 | static QString expand(const QString & text); 81 | 82 | /** Expands environment variables in each string in @p list. */ 83 | static QStringList expand(const QStringList & items); 84 | 85 | private: 86 | QStringList _arguments; 87 | }; 88 | 89 | } 90 | 91 | #endif // SHELLCOMMAND_H 92 | 93 | -------------------------------------------------------------------------------- /lib/TerminalCharacterDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Konsole, an X terminal. 3 | 4 | Copyright 2006-2008 by Robert Knight 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 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 Lesser 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 TERMINAL_CHARACTER_DECODER_H 23 | #define TERMINAL_CHARACTER_DECODER_H 24 | 25 | #include "Character.h" 26 | 27 | #include 28 | 29 | class QTextStream; 30 | 31 | namespace Konsole 32 | { 33 | 34 | /** 35 | * Base class for terminal character decoders 36 | * 37 | * The decoder converts lines of terminal characters which consist of a unicode character, foreground 38 | * and background colours and other appearance-related properties into text strings. 39 | * 40 | * Derived classes may produce either plain text with no other colour or appearance information, or 41 | * they may produce text which incorporates these additional properties. 42 | */ 43 | class TerminalCharacterDecoder 44 | { 45 | public: 46 | virtual ~TerminalCharacterDecoder() {} 47 | 48 | /** Begin decoding characters. The resulting text is appended to @p output. */ 49 | virtual void begin(QTextStream* output) = 0; 50 | /** End decoding. */ 51 | virtual void end() = 0; 52 | 53 | /** 54 | * Converts a line of terminal characters with associated properties into a text string 55 | * and writes the string into an output QTextStream. 56 | * 57 | * @param characters An array of characters of length @p count. 58 | * @param count The number of characters 59 | * @param properties Additional properties which affect all characters in the line 60 | */ 61 | virtual void decodeLine(const Character* const characters, 62 | int count, 63 | LineProperty properties) = 0; 64 | }; 65 | 66 | /** 67 | * A terminal character decoder which produces plain text, ignoring colours and other appearance-related 68 | * properties of the original characters. 69 | */ 70 | class PlainTextDecoder : public TerminalCharacterDecoder 71 | { 72 | public: 73 | PlainTextDecoder(); 74 | 75 | /** 76 | * Set whether trailing whitespace at the end of lines should be included 77 | * in the output. 78 | * Defaults to true. 79 | */ 80 | void setTrailingWhitespace(bool enable); 81 | /** 82 | * Returns whether trailing whitespace at the end of lines is included 83 | * in the output. 84 | */ 85 | bool trailingWhitespace() const; 86 | /** 87 | * Returns of character positions in the output stream 88 | * at which new lines where added. Returns an empty if setTrackLinePositions() is false or if 89 | * the output device is not a string. 90 | */ 91 | QList linePositions() const; 92 | /** Enables recording of character positions at which new lines are added. See linePositions() */ 93 | void setRecordLinePositions(bool record); 94 | 95 | void begin(QTextStream* output) override; 96 | void end() override; 97 | 98 | void decodeLine(const Character* const characters, 99 | int count, 100 | LineProperty properties) override; 101 | 102 | 103 | private: 104 | QTextStream* _output; 105 | bool _includeTrailingWhitespace; 106 | 107 | bool _recordLinePositions; 108 | QList _linePositions; 109 | }; 110 | 111 | /** 112 | * A terminal character decoder which produces pretty HTML markup 113 | */ 114 | class HTMLDecoder : public TerminalCharacterDecoder 115 | { 116 | public: 117 | /** 118 | * Constructs an HTML decoder using a default black-on-white color scheme. 119 | */ 120 | HTMLDecoder(); 121 | 122 | /** 123 | * Sets the colour table which the decoder uses to produce the HTML colour codes in its 124 | * output 125 | */ 126 | void setColorTable( const ColorEntry* table ); 127 | 128 | void decodeLine(const Character* const characters, 129 | int count, 130 | LineProperty properties) override; 131 | 132 | void begin(QTextStream* output) override; 133 | void end() override; 134 | 135 | private: 136 | void openSpan(std::wstring& text , const QString& style); 137 | void closeSpan(std::wstring& text); 138 | 139 | QTextStream* _output; 140 | const ColorEntry* _colorTable; 141 | bool _innerSpanOpen; 142 | quint8 _lastRendition; 143 | CharacterColor _lastForeColor; 144 | CharacterColor _lastBackColor; 145 | 146 | }; 147 | 148 | } 149 | 150 | #endif 151 | -------------------------------------------------------------------------------- /lib/color-schemes/BlackOnLightYellow.colorscheme: -------------------------------------------------------------------------------- 1 | [Background] 2 | Color=255,255,221 3 | 4 | [BackgroundIntense] 5 | Color=255,255,221 6 | 7 | [BackgroundFaint] 8 | Color=255,255,221 9 | 10 | [Color0] 11 | Color=0,0,0 12 | 13 | [Color0Intense] 14 | Color=104,104,104 15 | 16 | [Color0Faint] 17 | Color=192,192,192 18 | 19 | [Color1] 20 | Color=178,24,24 21 | 22 | [Color1Intense] 23 | Color=255,84,84 24 | 25 | [Color1Faint] 26 | Color=224,142,142 27 | 28 | [Color2] 29 | Color=24,178,24 30 | 31 | [Color2Intense] 32 | Color=84,255,84 33 | 34 | [Color2Faint] 35 | Color=142,224,142 36 | 37 | [Color3] 38 | Color=178,104,24 39 | 40 | [Color3Intense] 41 | Color=255,255,84 42 | 43 | [Color3Faint] 44 | Color=224,224,142 45 | 46 | [Color4] 47 | Color=24,24,178 48 | 49 | [Color4Intense] 50 | Color=84,84,255 51 | 52 | [Color4Faint] 53 | Color=142,142,224 54 | 55 | [Color5] 56 | Color=178,24,178 57 | 58 | [Color5Intense] 59 | Color=255,84,255 60 | 61 | [Color5Faint] 62 | Color=224,142,224 63 | 64 | [Color6] 65 | Color=24,178,178 66 | 67 | [Color6Intense] 68 | Color=84,255,255 69 | 70 | [Color6Faint] 71 | Color=142,224,224 72 | 73 | [Color7] 74 | Color=178,178,178 75 | 76 | [Color7Intense] 77 | Color=255,255,255 78 | 79 | [Color7Faint] 80 | Color=142,142,142 81 | 82 | [Foreground] 83 | Color=0,0,0 84 | 85 | [ForegroundIntense] 86 | Bold=true 87 | Color=0,0,0 88 | 89 | [ForegroundFaint] 90 | Color=0,0,0 91 | 92 | [General] 93 | Description=Black on Light Yellow 94 | Opacity=1 95 | -------------------------------------------------------------------------------- /lib/color-schemes/BlackOnRandomLight.colorscheme: -------------------------------------------------------------------------------- 1 | [Background] 2 | Bold=false 3 | Color=247,247,214 4 | Transparency=true 5 | MaxRandomHue=340 6 | 7 | [BackgroundIntense] 8 | Bold=false 9 | Color=255,255,221 10 | Transparency=true 11 | 12 | [Color0] 13 | Bold=false 14 | Color=0,0,0 15 | Transparency=false 16 | 17 | [Color0Intense] 18 | Bold=false 19 | Color=104,104,104 20 | Transparency=false 21 | 22 | [Color1] 23 | Bold=false 24 | Color=178,24,24 25 | Transparency=false 26 | 27 | [Color1Intense] 28 | Bold=false 29 | Color=255,84,84 30 | Transparency=false 31 | 32 | [Color2] 33 | Bold=false 34 | Color=24,178,24 35 | Transparency=false 36 | 37 | [Color2Intense] 38 | Bold=false 39 | Color=84,255,84 40 | Transparency=false 41 | 42 | [Color3] 43 | Bold=false 44 | Color=178,104,24 45 | Transparency=false 46 | 47 | [Color3Intense] 48 | Bold=false 49 | Color=255,255,84 50 | Transparency=false 51 | 52 | [Color4] 53 | Bold=false 54 | Color=24,24,178 55 | Transparency=false 56 | 57 | [Color4Intense] 58 | Bold=false 59 | Color=84,84,255 60 | Transparency=false 61 | 62 | [Color5] 63 | Bold=false 64 | Color=178,24,178 65 | Transparency=false 66 | 67 | [Color5Intense] 68 | Bold=false 69 | Color=255,84,255 70 | Transparency=false 71 | 72 | [Color6] 73 | Bold=false 74 | Color=24,178,178 75 | Transparency=false 76 | 77 | [Color6Intense] 78 | Bold=false 79 | Color=84,255,255 80 | Transparency=false 81 | 82 | [Color7] 83 | Bold=false 84 | Color=178,178,178 85 | Transparency=false 86 | 87 | [Color7Intense] 88 | Bold=false 89 | Color=255,255,255 90 | Transparency=false 91 | 92 | [Foreground] 93 | Bold=false 94 | Color=0,0,0 95 | Transparency=false 96 | 97 | [ForegroundIntense] 98 | Bold=true 99 | Color=0,0,0 100 | Transparency=false 101 | 102 | [General] 103 | Description=Black on Random Light 104 | Opacity=1 105 | -------------------------------------------------------------------------------- /lib/color-schemes/BlackOnWhite.colorscheme: -------------------------------------------------------------------------------- 1 | [Background] 2 | Color=255,255,255 3 | 4 | [BackgroundIntense] 5 | Color=255,255,255 6 | 7 | [BackgroundFaint] 8 | Color=255,255,255 9 | 10 | [Color0] 11 | Color=0,0,0 12 | 13 | [Color0Intense] 14 | Color=104,104,104 15 | 16 | [Color0Faint] 17 | Color=192,192,192 18 | 19 | [Color1] 20 | Color=178,24,24 21 | 22 | [Color1Intense] 23 | Color=255,84,84 24 | 25 | [Color1Faint] 26 | Color=224,142,142 27 | 28 | [Color2] 29 | Color=24,178,24 30 | 31 | [Color2Intense] 32 | Color=84,255,84 33 | 34 | [Color2Faint] 35 | Color=142,224,142 36 | 37 | [Color3] 38 | Color=178,104,24 39 | 40 | [Color3Intense] 41 | Color=255,255,84 42 | 43 | [Color3Faint] 44 | Color=224,224,142 45 | 46 | [Color4] 47 | Color=24,24,178 48 | 49 | [Color4Intense] 50 | Color=84,84,255 51 | 52 | [Color4Faint] 53 | Color=142,142,224 54 | 55 | [Color5] 56 | Color=178,24,178 57 | 58 | [Color5Intense] 59 | Color=255,84,255 60 | 61 | [Color5Faint] 62 | Color=224,142,224 63 | 64 | [Color6] 65 | Color=24,178,178 66 | 67 | [Color6Intense] 68 | Color=84,255,255 69 | 70 | [Color6Faint] 71 | Color=142,224,224 72 | 73 | [Color7] 74 | Color=178,178,178 75 | 76 | [Color7Intense] 77 | Color=255,255,255 78 | 79 | [Color7Faint] 80 | Color=142,142,142 81 | 82 | [Foreground] 83 | Color=0,0,0 84 | 85 | [ForegroundIntense] 86 | Bold=true 87 | Color=0,0,0 88 | 89 | [ForegroundFaint] 90 | Color=0,0,0 91 | 92 | [General] 93 | Description=Black on White 94 | Opacity=1 95 | -------------------------------------------------------------------------------- /lib/color-schemes/BreezeModified.colorscheme: -------------------------------------------------------------------------------- 1 | [Background] 2 | Color=49,54,59 3 | 4 | [BackgroundFaint] 5 | Color=49,54,59 6 | 7 | [BackgroundIntense] 8 | Color=35,38,41 9 | 10 | [Color0] 11 | Color=7,54,66 12 | 13 | [Color0Faint] 14 | Color=32,43,54 15 | 16 | [Color0Intense] 17 | Color=255,85,0 18 | 19 | [Color1] 20 | Color=237,21,21 21 | 22 | [Color1Faint] 23 | Color=120,50,40 24 | 25 | [Color1Intense] 26 | Color=192,57,43 27 | 28 | [Color2] 29 | Color=17,209,22 30 | 31 | [Color2Faint] 32 | Color=23,162,98 33 | 34 | [Color2Intense] 35 | Color=28,220,154 36 | 37 | [Color3] 38 | Color=246,116,0 39 | 40 | [Color3Faint] 41 | Color=182,86,25 42 | 43 | [Color3Intense] 44 | Color=253,188,75 45 | 46 | [Color4] 47 | Color=29,153,243 48 | 49 | [Color4Faint] 50 | Color=27,102,143 51 | 52 | [Color4Intense] 53 | Color=61,174,233 54 | 55 | [Color5] 56 | Color=155,89,182 57 | 58 | [Color5Faint] 59 | Color=97,74,115 60 | 61 | [Color5Intense] 62 | Color=142,68,173 63 | 64 | [Color6] 65 | Color=26,188,156 66 | 67 | [Color6Faint] 68 | Color=24,108,96 69 | 70 | [Color6Intense] 71 | Color=22,160,133 72 | 73 | [Color7] 74 | Color=239,240,241 75 | 76 | [Color7Faint] 77 | Color=99,104,109 78 | 79 | [Color7Intense] 80 | Color=252,252,252 81 | 82 | [Foreground] 83 | Color=239,240,241 84 | 85 | [ForegroundFaint] 86 | Color=220,230,231 87 | 88 | [ForegroundIntense] 89 | Color=252,252,252 90 | 91 | [General] 92 | Description=BreezeModified 93 | Opacity=0.95 94 | Wallpaper= 95 | 96 | -------------------------------------------------------------------------------- /lib/color-schemes/DarkPastels.colorscheme: -------------------------------------------------------------------------------- 1 | [Background] 2 | Bold=false 3 | Color=44,44,44 4 | Transparency=false 5 | 6 | [BackgroundIntense] 7 | Bold=true 8 | Color=44,44,44 9 | Transparency=false 10 | 11 | [Color0] 12 | Bold=false 13 | Color=63,63,63 14 | Transparency=false 15 | 16 | [Color0Intense] 17 | Bold=true 18 | Color=112,144,128 19 | Transparency=false 20 | 21 | [Color1] 22 | Bold=false 23 | Color=112,80,80 24 | Transparency=false 25 | 26 | [Color1Intense] 27 | Bold=true 28 | Color=220,163,163 29 | Transparency=false 30 | 31 | [Color2] 32 | Bold=false 33 | Color=96,180,138 34 | Transparency=false 35 | 36 | [Color2Intense] 37 | Bold=true 38 | Color=114,213,163 39 | Transparency=false 40 | 41 | [Color3] 42 | Bold=false 43 | Color=223,175,143 44 | Transparency=false 45 | 46 | [Color3Intense] 47 | Bold=true 48 | Color=240,223,175 49 | Transparency=false 50 | 51 | [Color4] 52 | Bold=false 53 | Color=154,184,215 54 | Transparency=false 55 | 56 | [Color4Intense] 57 | Bold=true 58 | Color=148,191,243 59 | Transparency=false 60 | 61 | [Color5] 62 | Bold=false 63 | Color=220,140,195 64 | Transparency=false 65 | 66 | [Color5Intense] 67 | Bold=true 68 | Color=236,147,211 69 | Transparency=false 70 | 71 | [Color6] 72 | Bold=false 73 | Color=140,208,211 74 | Transparency=false 75 | 76 | [Color6Intense] 77 | Bold=true 78 | Color=147,224,227 79 | Transparency=false 80 | 81 | [Color7] 82 | Bold=false 83 | Color=220,220,204 84 | Transparency=false 85 | 86 | [Color7Intense] 87 | Bold=true 88 | Color=255,255,255 89 | Transparency=false 90 | 91 | [Foreground] 92 | Bold=false 93 | Color=220,220,204 94 | Transparency=false 95 | 96 | [ForegroundIntense] 97 | Bold=true 98 | Color=220,220,204 99 | Transparency=false 100 | 101 | [General] 102 | Description=Dark Pastels 103 | Opacity=1 104 | -------------------------------------------------------------------------------- /lib/color-schemes/Falcon.colorscheme: -------------------------------------------------------------------------------- 1 | 2 | ### GENERAL 3 | [General] 4 | Description=Falcon 5 | Author=Alberto Salvia Novella (es20490446e) 6 | Opacity=1 7 | 8 | ### BACKGROUND (#223333) 9 | [Background] 10 | Color=34,51,51 11 | Bold=false 12 | Transparency=false 13 | 14 | ### BACKGROUND INTENSE (#223333) 15 | [BackgroundIntense] 16 | Color=34,51,51 17 | Bold=true 18 | Transparency=false 19 | 20 | ### FOREGROUND (#C2C2C2) 21 | [Foreground] 22 | Color=194,194,194 23 | Bold=false 24 | Transparency=false 25 | 26 | ### FOREGROUND INTENSE (#C2C2C2) 27 | [ForegroundIntense] 28 | Color=194,194,194 29 | Bold=true 30 | Transparency=false 31 | 32 | ### BLACK (#959595) 33 | [Color0] 34 | Color=149,149,149 35 | Bold=false 36 | Transparency=false 37 | 38 | ### BLACK BOLD (#959595) 39 | [Color0Intense] 40 | Color=149,149,149 41 | Bold=true 42 | Transparency=false 43 | 44 | ### RED (#FF6565) 45 | [Color1] 46 | Color=255,101,101 47 | Bold=false 48 | Transparency=false 49 | 50 | ### RED BOLD (#FF6565) 51 | [Color1Intense] 52 | Color=255,101,101 53 | Bold=true 54 | Transparency=false 55 | 56 | ### GREEN (#84C24E) 57 | [Color2] 58 | Color=132,194,78 59 | Bold=false 60 | Transparency=false 61 | 62 | ### GREEN BOLD (#84C24E) 63 | [Color2Intense] 64 | Color=132,194,78 65 | Bold=true 66 | Transparency=false 67 | 68 | ### YELLOW (#CFBF29) 69 | [Color3] 70 | Color=207,191,41 71 | Bold=false 72 | Transparency=false 73 | 74 | ### YELLOW BOLD (#CFBF29) 75 | [Color3Intense] 76 | Color=207,191,41 77 | Bold=true 78 | Transparency=false 79 | 80 | ### BLUE (#6ED7FF) 81 | [Color4] 82 | Color=110,215,255 83 | Bold=false 84 | Transparency=false 85 | 86 | ### BLUE BOLD (#6ED7FF) 87 | [Color4Intense] 88 | Color=110,215,255 89 | Bold=true 90 | Transparency=false 91 | 92 | ### ORANGE (#FCAF3E) 93 | [Color5] 94 | Color=252,175,62 95 | Bold=false 96 | Transparency=false 97 | 98 | ### ORANGE BOLD (#FCAF3E) 99 | [Color5Intense] 100 | Color=252,175,62 101 | Bold=true 102 | Transparency=false 103 | 104 | ### PURPLE (#B7B0E8) 105 | [Color6] 106 | Color=183,176,232 107 | Bold=false 108 | Transparency=false 109 | 110 | ### PURPLE BOLD (#B7B0E8) 111 | [Color6Intense] 112 | Color=183,176,232 113 | Bold=true 114 | Transparency=false 115 | 116 | ### WHITE (#FFFFFF) 117 | [Color7] 118 | Color=255,255,255 119 | Bold=false 120 | Transparency=false 121 | 122 | ### WHITE BOLD (#FFFFFF) 123 | [Color7Intense] 124 | Color=255,255,255 125 | Bold=true 126 | Transparency=false 127 | -------------------------------------------------------------------------------- /lib/color-schemes/GreenOnBlack.colorscheme: -------------------------------------------------------------------------------- 1 | 2 | [Background] 3 | Bold=false 4 | Color=0,0,0 5 | Transparency=false 6 | 7 | [BackgroundIntense] 8 | Bold=false 9 | Color=0,0,0 10 | Transparency=false 11 | 12 | [Color0] 13 | Bold=false 14 | Color=0,0,0 15 | Transparency=false 16 | 17 | [Color0Intense] 18 | Bold=false 19 | Color=104,104,104 20 | Transparency=false 21 | 22 | [Color1] 23 | Bold=false 24 | Color=250,75,75 25 | Transparency=false 26 | 27 | [Color1Intense] 28 | Bold=false 29 | Color=255,84,84 30 | Transparency=false 31 | 32 | [Color2] 33 | Bold=false 34 | Color=24,178,24 35 | Transparency=false 36 | 37 | [Color2Intense] 38 | Bold=false 39 | Color=84,255,84 40 | Transparency=false 41 | 42 | [Color3] 43 | Bold=false 44 | Color=178,104,24 45 | Transparency=false 46 | 47 | [Color3Intense] 48 | Bold=false 49 | Color=255,255,84 50 | Transparency=false 51 | 52 | [Color4] 53 | Bold=false 54 | Color=92,167,251 55 | Transparency=false 56 | 57 | [Color4Intense] 58 | Bold=false 59 | Color=84,84,255 60 | Transparency=false 61 | 62 | [Color5] 63 | Bold=false 64 | Color=225,30,225 65 | Transparency=false 66 | 67 | [Color5Intense] 68 | Bold=false 69 | Color=255,84,255 70 | Transparency=false 71 | 72 | [Color6] 73 | Bold=false 74 | Color=24,178,178 75 | Transparency=false 76 | 77 | [Color6Intense] 78 | Bold=false 79 | Color=84,255,255 80 | Transparency=false 81 | 82 | [Color7] 83 | Bold=false 84 | Color=178,178,178 85 | Transparency=false 86 | 87 | [Color7Intense] 88 | Bold=false 89 | Color=255,255,255 90 | Transparency=false 91 | 92 | [Foreground] 93 | Bold=false 94 | Color=24,240,24 95 | Transparency=false 96 | 97 | [ForegroundIntense] 98 | Bold=true 99 | Color=24,240,24 100 | Transparency=false 101 | 102 | [General] 103 | Description=Green on Black 104 | Opacity=1 105 | -------------------------------------------------------------------------------- /lib/color-schemes/Linux.colorscheme: -------------------------------------------------------------------------------- 1 | [Background] 2 | Bold=false 3 | Color=0,0,0 4 | 5 | [BackgroundIntense] 6 | Bold=false 7 | Color=104,104,104 8 | 9 | [Color0] 10 | Bold=false 11 | Color=0,0,0 12 | 13 | 14 | [Color0Intense] 15 | Bold=false 16 | Color=104,104,104 17 | 18 | 19 | [Color1] 20 | Bold=false 21 | Color=178,24,24 22 | 23 | 24 | [Color1Intense] 25 | Bold=false 26 | Color=255,84,84 27 | 28 | 29 | [Color2] 30 | Bold=false 31 | Color=24,178,24 32 | 33 | 34 | [Color2Intense] 35 | Bold=false 36 | Color=84,255,84 37 | 38 | 39 | [Color3] 40 | Bold=false 41 | Color=178,104,24 42 | 43 | 44 | [Color3Intense] 45 | Bold=false 46 | Color=255,255,84 47 | 48 | 49 | [Color4] 50 | Bold=false 51 | Color=24,24,178 52 | 53 | 54 | [Color4Intense] 55 | Bold=false 56 | Color=84,84,255 57 | 58 | 59 | [Color5] 60 | Bold=false 61 | Color=178,24,178 62 | 63 | 64 | [Color5Intense] 65 | Bold=false 66 | Color=255,84,255 67 | 68 | 69 | [Color6] 70 | Bold=false 71 | Color=24,178,178 72 | 73 | 74 | [Color6Intense] 75 | Bold=false 76 | Color=84,255,255 77 | 78 | 79 | [Color7] 80 | Bold=false 81 | Color=178,178,178 82 | 83 | 84 | [Color7Intense] 85 | Bold=false 86 | Color=255,255,255 87 | 88 | 89 | [Foreground] 90 | Bold=false 91 | Color=178,178,178 92 | 93 | 94 | [ForegroundIntense] 95 | Bold=false 96 | Color=255,255,255 97 | 98 | 99 | [General] 100 | Description=Linux Colors 101 | -------------------------------------------------------------------------------- /lib/color-schemes/Solarized.colorscheme: -------------------------------------------------------------------------------- 1 | [Color0] 2 | Color=7,54,66 3 | 4 | [Color0Intense] 5 | Color=0,43,54 6 | 7 | [Color0Faint] 8 | Color=6,48,59 9 | 10 | [Color1] 11 | Color=220,50,47 12 | 13 | [Color1Intense] 14 | Color=203,75,22 15 | 16 | [Color1Faint] 17 | Color=147,33,31 18 | 19 | [Color2] 20 | Color=133,153,0 21 | 22 | [Color2Intense] 23 | Color=88,110,117 24 | 25 | [Color2Faint] 26 | Color=94,106,0 27 | 28 | [Color3] 29 | Color=181,137,0 30 | 31 | [Color3Intense] 32 | Color=101,123,131 33 | 34 | [Color3Faint] 35 | Color=138,103,0 36 | 37 | [Color4] 38 | Color=38,139,210 39 | 40 | [Color4Intense] 41 | Color=131,148,150 42 | 43 | [Color4Faint] 44 | Color=20,77,115 45 | 46 | [Color5] 47 | Color=211,54,130 48 | 49 | [Color5Intense] 50 | Color=108,113,196 51 | 52 | [Color5Faint] 53 | Color=120,30,75 54 | 55 | [Color6] 56 | Color=42,161,152 57 | 58 | [Color6Intense] 59 | Color=147,161,161 60 | 61 | [Color6Faint] 62 | Color=24,94,88 63 | 64 | [Color7] 65 | Color=238,232,213 66 | 67 | [Color7Intense] 68 | Color=253,246,227 69 | 70 | [Color7Faint] 71 | Color=171,167,154 72 | 73 | [Background] 74 | Color=0,43,54 75 | 76 | [BackgroundIntense] 77 | Color=7,54,66 78 | 79 | [BackgroundFaint] 80 | Color=0,43,54 81 | 82 | [Foreground] 83 | Color=131,148,150 84 | 85 | [ForegroundIntense] 86 | Color=147,161,161 87 | 88 | [ForegroundFaint] 89 | Color=106,119,121 90 | 91 | [General] 92 | Description=Solarized 93 | Opacity=1 94 | -------------------------------------------------------------------------------- /lib/color-schemes/SolarizedLight.colorscheme: -------------------------------------------------------------------------------- 1 | [Color0] 2 | Color=7,54,66 3 | 4 | [Color0Intense] 5 | Color=0,43,54 6 | 7 | [Color0Faint] 8 | Color=8,65,80 9 | 10 | [Color1] 11 | Color=220,50,47 12 | 13 | [Color1Intense] 14 | Color=203,75,22 15 | 16 | [Color1Faint] 17 | Color=222,81,81 18 | 19 | [Color2] 20 | Color=133,153,0 21 | 22 | [Color2Intense] 23 | Color=88,110,117 24 | 25 | [Color2Faint] 26 | Color=153,168,39 27 | 28 | [Color3] 29 | Color=181,137,0 30 | 31 | [Color3Intense] 32 | Color=101,123,131 33 | 34 | [Color3Faint] 35 | Color=213,170,49 36 | 37 | [Color4] 38 | Color=38,139,210 39 | 40 | [Color4Intense] 41 | Color=131,148,150 42 | 43 | [Color4Faint] 44 | Color=80,173,226 45 | 46 | [Color5] 47 | Color=211,54,130 48 | 49 | [Color5Intense] 50 | Color=108,113,196 51 | 52 | [Color5Faint] 53 | Color=223,92,158 54 | 55 | [Color6] 56 | Color=42,161,152 57 | 58 | [Color6Intense] 59 | Color=147,161,161 60 | 61 | [Color6Faint] 62 | Color=78,211,200 63 | 64 | [Color7] 65 | Color=238,232,213 66 | 67 | [Color7Intense] 68 | Color=253,246,227 69 | 70 | [Color7Faint] 71 | Color=238,232,213 72 | 73 | [Background] 74 | Color=253,246,227 75 | 76 | [BackgroundIntense] 77 | Color=238,232,213 78 | 79 | [BackgroundFaint] 80 | Color=253,246,227 81 | 82 | [Foreground] 83 | Color=101,123,131 84 | 85 | [ForegroundIntense] 86 | Color=88,110,117 87 | 88 | [ForegroundFaint] 89 | Color=141,172,182 90 | 91 | [General] 92 | Description=Solarized Light 93 | Opacity=1 94 | -------------------------------------------------------------------------------- /lib/color-schemes/Tango.colorscheme: -------------------------------------------------------------------------------- 1 | [General] 2 | Description=Tango 3 | 4 | [Background] 5 | Color=0,0,0 6 | 7 | [BackgroundIntense] 8 | Color=104,104,104 9 | 10 | [Foreground] 11 | ;Color=211,215,207 12 | Color=255,255,255 13 | 14 | [ForegroundIntense] 15 | Color=255,255,255 16 | 17 | ; black 18 | [Color0] 19 | Color=0,0,0 20 | 21 | [Color0Intense] 22 | Color=85,87,83 23 | 24 | ; red 25 | [Color1] 26 | Color=204,0,0 27 | 28 | [Color1Intense] 29 | Color=239,41,41 30 | 31 | ; green 32 | [Color2] 33 | Color=78,154,6 34 | 35 | [Color2Intense] 36 | Color=138,226,52 37 | 38 | ; yellow 39 | [Color3] 40 | Color=196,160,0 41 | 42 | [Color3Intense] 43 | Color=252,233,79 44 | 45 | ; blue 46 | [Color4] 47 | Color=52,101,164 48 | 49 | [Color4Intense] 50 | Color=114,159,207 51 | 52 | ; magenta 53 | [Color5] 54 | Color=117,80,123 55 | 56 | [Color5Intense] 57 | Color=173,127,168 58 | 59 | ; aqua 60 | [Color6] 61 | Color=6,152,154 62 | 63 | [Color6Intense] 64 | Color=52,226,226 65 | 66 | ; grey 67 | [Color7] 68 | Color=211,215,207 69 | 70 | [Color7Intense] 71 | Color=238,238,236 72 | -------------------------------------------------------------------------------- /lib/color-schemes/Ubuntu.colorscheme: -------------------------------------------------------------------------------- 1 | [General] 2 | Description=Ubuntu 3 | Opacity=1 4 | Wallpaper= 5 | 6 | [Background] 7 | Color=48,10,36 8 | MaxRandomHue=0 9 | MaxRandomSaturation=0 10 | MaxRandomValue=0 11 | 12 | [BackgroundIntense] 13 | Color=48,10,36 14 | 15 | [Color0] 16 | Color=46,52,54 17 | 18 | [Color0Intense] 19 | Color=85,87,83 20 | 21 | [Color1] 22 | Color=204,0,0 23 | 24 | [Color1Intense] 25 | Color=239,41,41 26 | 27 | [Color2] 28 | Color=78,154,6 29 | 30 | [Color2Intense] 31 | Color=138,226,52 32 | 33 | [Color3] 34 | Color=196,160,0 35 | 36 | [Color3Intense] 37 | Color=252,233,79 38 | 39 | [Color4] 40 | Color=52,101,164 41 | 42 | [Color4Intense] 43 | Color=114,159,207 44 | 45 | [Color5] 46 | Color=117,80,123 47 | 48 | [Color5Intense] 49 | Color=173,127,168 50 | 51 | [Color6] 52 | Color=6,152,154 53 | 54 | [Color6Intense] 55 | Color=52,226,226 56 | 57 | [Color7] 58 | Color=211,215,207 59 | 60 | [Color7Intense] 61 | Color=238,238,236 62 | 63 | [Foreground] 64 | Color=238,238,236 65 | 66 | [ForegroundIntense] 67 | Color=238,238,236 -------------------------------------------------------------------------------- /lib/color-schemes/WhiteOnBlack.colorscheme: -------------------------------------------------------------------------------- 1 | [Background] 2 | Color=0,0,0 3 | 4 | [BackgroundIntense] 5 | Color=0,0,0 6 | 7 | [BackgroundFaint] 8 | Color=0,0,0 9 | 10 | [Color0] 11 | Color=0,0,0 12 | 13 | [Color0Intense] 14 | Color=104,104,104 15 | 16 | [Color0Faint] 17 | Color=24,24,24 18 | 19 | [Color1] 20 | Color=178,24,24 21 | 22 | [Color1Intense] 23 | Color=255,84,84 24 | 25 | [Color1Faint] 26 | Color=101,0,0 27 | 28 | [Color2] 29 | Color=24,178,24 30 | 31 | [Color2Intense] 32 | Color=84,255,84 33 | 34 | [Color2Faint] 35 | Color=0,101,0 36 | 37 | [Color3] 38 | Color=178,104,24 39 | 40 | [Color3Intense] 41 | Color=255,255,84 42 | 43 | [Color3Faint] 44 | Color=101,74,0 45 | 46 | [Color4] 47 | Color=24,24,178 48 | 49 | [Color4Intense] 50 | Color=84,84,255 51 | 52 | [Color4Faint] 53 | Color=0,0,101 54 | 55 | [Color5] 56 | Color=178,24,178 57 | 58 | [Color5Intense] 59 | Color=255,84,255 60 | 61 | [Color5Faint] 62 | Color=95,5,95 63 | 64 | [Color6] 65 | Color=24,178,178 66 | 67 | [Color6Intense] 68 | Color=84,255,255 69 | 70 | [Color6Faint] 71 | Color=24,178,178 72 | 73 | [Color7] 74 | Color=178,178,178 75 | 76 | [Color7Intense] 77 | Color=255,255,255 78 | 79 | [Color7Faint] 80 | Color=101,101,101 81 | 82 | [Foreground] 83 | Color=255,255,255 84 | 85 | [ForegroundIntense] 86 | Bold=true 87 | Color=255,255,255 88 | 89 | [ForegroundFaint] 90 | Color=255,255,255 91 | 92 | [General] 93 | Description=White on Black 94 | Opacity=1 95 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/BlackOnLightColor.schema: -------------------------------------------------------------------------------- 1 | # example scheme for konsole 2 | 3 | # the title is to appear in the menu. 4 | 5 | title Black on Light Color 6 | 7 | # foreground colors 8 | 9 | # note that the default background color is flagged 10 | # to become transparent when an image is present. 11 | 12 | # slot transparent bold 13 | # | | | 14 | # V V--color--V V V 15 | 16 | color 0 0 0 0 0 0 # regular foreground color (Black) 17 | rcolor 1 30 255 1 0 # regular background color (Light Color) 18 | 19 | color 2 0 0 0 0 0 # regular color 0 Black 20 | color 3 178 24 24 0 0 # regular color 1 Red 21 | color 4 24 178 24 0 0 # regular color 2 Green 22 | color 5 178 104 24 0 0 # regular color 3 Yellow 23 | color 6 24 24 178 0 0 # regular color 4 Blue 24 | color 7 178 24 178 0 0 # regular color 5 Magenta 25 | color 8 24 178 178 0 0 # regular color 6 Cyan 26 | color 9 178 178 178 0 0 # regular color 7 White 27 | 28 | # intensive colors 29 | 30 | # instead of changing the colors, we've flagged the text to become bold 31 | 32 | color 10 0 0 0 0 1 # intensive foreground color 33 | color 11 255 255 221 1 0 # intensive background color 34 | 35 | color 12 104 104 104 0 0 # intensive color 0 36 | color 13 255 84 84 0 0 # intensive color 1 37 | color 14 84 255 84 0 0 # intensive color 2 38 | color 15 255 255 84 0 0 # intensive color 3 39 | color 16 84 84 255 0 0 # intensive color 4 40 | color 17 255 84 255 0 0 # intensive color 5 41 | color 18 84 255 255 0 0 # intensive color 6 42 | color 19 255 255 255 0 0 # intensive color 7 43 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/DarkPicture.schema: -------------------------------------------------------------------------------- 1 | # example scheme for konsole 2 | 3 | # the title is to appear in the menu. 4 | 5 | title Marble 6 | 7 | image tile Blkmarble.jpg 8 | 9 | # foreground colors 10 | 11 | # note that the default background color is flagged 12 | # to become transparent when an image is present. 13 | 14 | # slot transparent bold 15 | # | | | 16 | # V V--color--V V V 17 | 18 | color 0 255 255 255 0 0 # regular foreground color (White) 19 | color 1 0 0 0 1 0 # regular background color (Black) 20 | 21 | color 2 0 0 0 0 0 # regular color 0 Black 22 | color 3 178 24 24 0 0 # regular color 1 Red 23 | color 4 24 178 24 0 0 # regular color 2 Green 24 | color 5 178 104 24 0 0 # regular color 3 Yellow 25 | color 6 24 24 178 0 0 # regular color 4 Blue 26 | color 7 178 24 178 0 0 # regular color 5 Magenta 27 | color 8 24 178 178 0 0 # regular color 6 Cyan 28 | color 9 178 178 178 0 0 # regular color 7 White 29 | 30 | # intensive colors 31 | 32 | # instead of changing the colors, we've flagged the text to become bold 33 | 34 | color 10 255 255 255 0 1 # intensive foreground color 35 | color 11 0 0 0 1 0 # intensive background color 36 | 37 | color 12 104 104 104 0 0 # intensive color 0 38 | color 13 255 84 84 0 0 # intensive color 1 39 | color 14 84 255 84 0 0 # intensive color 2 40 | color 15 255 255 84 0 0 # intensive color 3 41 | color 16 84 84 255 0 0 # intensive color 4 42 | color 17 255 84 255 0 0 # intensive color 5 43 | color 18 84 255 255 0 0 # intensive color 6 44 | color 19 255 255 255 0 0 # intensive color 7 45 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/Example.Schema: -------------------------------------------------------------------------------- 1 | # example scheme for konsole 2 | 3 | # the title is to appear in the menu. 4 | 5 | title Ugly 1 6 | 7 | # add a wallpaper, if you like. Second word one of { tile,center,full } 8 | 9 | image tile /opt/kde/share/wallpapers/dancy_pants.jpg 10 | 11 | 12 | # foreground colors 13 | 14 | # note that the default background color is flagged 15 | # to become transparent when an image is present. 16 | 17 | # slot transparent bold 18 | # | | | 19 | # V V--color--V V V 20 | 21 | color 0 0 0 0 0 0 # regular foreground color (Black) 22 | color 1 255 255 255 1 0 # regular background color (White) 23 | 24 | color 2 0 0 0 0 0 # regular color 0 Black 25 | color 3 255 0 0 0 0 # regular color 1 Red 26 | color 4 0 255 0 0 0 # regular color 2 Green 27 | color 5 255 255 0 0 0 # regular color 3 Yellow 28 | color 6 0 0 255 0 0 # regular color 4 Blue 29 | color 7 255 0 255 0 0 # regular color 5 Magenta 30 | color 8 0 255 255 0 0 # regular color 6 Cyan 31 | color 9 255 255 255 0 0 # regular color 7 White 32 | 33 | # intensive colors 34 | 35 | # instead of changing the colors, we've flagged the text to become bold 36 | 37 | color 10 0 0 0 0 1 # intensive foreground color 38 | color 11 255 255 255 1 1 # intensive background color 39 | 40 | color 12 0 0 0 0 1 # intensive color 0 41 | color 13 255 0 0 0 1 # intensive color 1 42 | color 14 0 255 0 0 1 # intensive color 2 43 | color 15 255 255 0 0 1 # intensive color 3 44 | color 16 0 0 255 0 1 # intensive color 4 45 | color 17 255 0 255 0 1 # intensive color 5 46 | color 18 0 255 255 0 1 # intensive color 6 47 | color 19 255 255 255 0 1 # intensive color 7 48 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/GreenOnBlack.schema: -------------------------------------------------------------------------------- 1 | # example scheme for konsole 2 | 3 | # the title is to appear in the menu. 4 | 5 | title Green on Black 6 | 7 | # foreground colors 8 | 9 | # note that the default background color is flagged 10 | # to become transparent when an image is present. 11 | 12 | # slot transparent bold 13 | # | | | 14 | # V V--color--V V V 15 | 16 | color 0 24 240 24 0 0 # regular foreground color (Green) 17 | color 1 0 0 0 1 0 # regular background color (Black) 18 | 19 | color 2 0 0 0 0 0 # regular color 0 Black 20 | color 3 178 24 24 0 0 # regular color 1 Red 21 | color 4 24 178 24 0 0 # regular color 2 Green 22 | color 5 178 104 24 0 0 # regular color 3 Yellow 23 | color 6 24 24 178 0 0 # regular color 4 Blue 24 | color 7 178 24 178 0 0 # regular color 5 Magenta 25 | color 8 24 178 178 0 0 # regular color 6 Cyan 26 | color 9 178 178 178 0 0 # regular color 7 White 27 | 28 | # intensive colors 29 | 30 | # instead of changing the colors, we've flagged the text to become bold 31 | 32 | color 10 24 240 24 0 1 # intensive foreground color 33 | color 11 0 0 0 1 0 # intensive background color 34 | 35 | color 12 104 104 104 0 0 # intensive color 0 36 | color 13 255 84 84 0 0 # intensive color 1 37 | color 14 84 255 84 0 0 # intensive color 2 38 | color 15 255 255 84 0 0 # intensive color 3 39 | color 16 84 84 255 0 0 # intensive color 4 40 | color 17 255 84 255 0 0 # intensive color 5 41 | color 18 84 255 255 0 0 # intensive color 6 42 | color 19 255 255 255 0 0 # intensive color 7 43 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/GreenTint.schema: -------------------------------------------------------------------------------- 1 | # linux color schema for konsole 2 | 3 | title Green Tint 4 | 5 | transparency 0.3 0 150 0 6 | 7 | # FIXME 8 | # 9 | # The flaw in this schema is that "blick" comes out on the 10 | # Linux console as intensive background, really. 11 | # Since this is not used in clients you'll hardly notice 12 | # it in practice. 13 | 14 | # foreground colors 15 | 16 | # note that the default background color is flagged 17 | # to become transparent when an image is present. 18 | 19 | # slot transparent bold 20 | # | red grn blu | | 21 | # V V--color--V V V 22 | 23 | color 0 178 178 178 0 0 # regular foreground color (White) 24 | color 1 0 0 0 1 0 # regular background color (Black) 25 | 26 | color 2 0 0 0 0 0 # regular color 0 Black 27 | color 3 178 24 24 0 0 # regular color 1 Red 28 | color 4 24 178 24 0 0 # regular color 2 Green 29 | color 5 178 104 24 0 0 # regular color 3 Yellow 30 | color 6 24 24 178 0 0 # regular color 4 Blue 31 | color 7 178 24 178 0 0 # regular color 5 Magenta 32 | color 8 24 178 178 0 0 # regular color 6 Cyan 33 | color 9 178 178 178 0 0 # regular color 7 White 34 | 35 | # intensive colors 36 | 37 | # instead of changing the colors, we've flagged the text to become bold 38 | 39 | color 10 255 255 255 0 0 # intensive foreground color 40 | color 11 104 104 104 1 0 # intensive background color 41 | 42 | color 12 104 104 104 0 0 # intensive color 0 43 | color 13 255 84 84 0 0 # intensive color 1 44 | color 14 84 255 84 0 0 # intensive color 2 45 | color 15 255 255 84 0 0 # intensive color 3 46 | color 16 84 84 255 0 0 # intensive color 4 47 | color 17 255 84 255 0 0 # intensive color 5 48 | color 18 84 255 255 0 0 # intensive color 6 49 | color 19 255 255 255 0 0 # intensive color 7 50 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/GreenTint_MC.schema: -------------------------------------------------------------------------------- 1 | # linux color schema for konsole 2 | 3 | title Green Tint with Transparent MC 4 | 5 | transparency 0.3 0 150 0 6 | 7 | # FIXME 8 | # 9 | # The flaw in this schema is that "blick" comes out on the 10 | # Linux console as intensive background, really. 11 | # Since this is not used in clients you'll hardly notice 12 | # it in practice. 13 | 14 | # foreground colors 15 | 16 | # note that the default background color is flagged 17 | # to become transparent when an image is present. 18 | 19 | # slot transparent bold 20 | # | red grn blu | | 21 | # V V--color--V V V 22 | 23 | color 0 178 178 178 0 0 # regular foreground color (White) 24 | color 1 0 0 0 1 0 # regular background color (Black) 25 | 26 | color 2 0 0 0 0 0 # regular color 0 Black 27 | color 3 178 24 24 0 0 # regular color 1 Red 28 | color 4 24 178 24 0 0 # regular color 2 Green 29 | color 5 178 104 24 0 0 # regular color 3 Yellow 30 | color 6 0 0 0 1 0 # regular color 4 Blue 31 | color 7 178 24 178 0 0 # regular color 5 Magenta 32 | color 8 24 178 178 0 0 # regular color 6 Cyan 33 | color 9 178 178 178 0 0 # regular color 7 White 34 | 35 | # intensive colors 36 | 37 | # instead of changing the colors, we've flagged the text to become bold 38 | 39 | color 10 255 255 255 0 0 # intensive foreground color 40 | color 11 104 104 104 1 0 # intensive background color 41 | 42 | color 12 104 104 104 0 0 # intensive color 0 43 | color 13 255 84 84 0 0 # intensive color 1 44 | color 14 84 255 84 0 0 # intensive color 2 45 | color 15 255 255 84 0 0 # intensive color 3 46 | color 16 84 84 255 0 0 # intensive color 4 47 | color 17 255 84 255 0 0 # intensive color 5 48 | color 18 84 255 255 0 0 # intensive color 6 49 | color 19 255 255 255 0 0 # intensive color 7 50 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/LightPicture.schema: -------------------------------------------------------------------------------- 1 | # example scheme for konsole 2 | 3 | # the title is to appear in the menu. 4 | 5 | title Paper 6 | 7 | image tile Paper01.jpg 8 | 9 | # foreground colors 10 | 11 | # note that the default background color is flagged 12 | # to become transparent when an image is present. 13 | 14 | # slot transparent bold 15 | # | | | 16 | # V V--color--V V V 17 | 18 | color 0 0 0 0 0 0 # regular foreground color (Black) 19 | color 1 255 255 255 1 0 # regular background color (White) 20 | 21 | color 2 0 0 0 0 0 # regular color 0 Black 22 | color 3 178 24 24 0 0 # regular color 1 Red 23 | color 4 24 178 24 0 0 # regular color 2 Green 24 | color 5 178 104 24 0 0 # regular color 3 Yellow 25 | color 6 24 24 178 0 0 # regular color 4 Blue 26 | color 7 178 24 178 0 0 # regular color 5 Magenta 27 | color 8 24 178 178 0 0 # regular color 6 Cyan 28 | color 9 178 178 178 0 0 # regular color 7 White 29 | 30 | # intensive colors 31 | 32 | # instead of changing the colors, we've flagged the text to become bold 33 | 34 | color 10 0 0 0 0 1 # intensive foreground color 35 | color 11 255 255 255 1 0 # intensive background color 36 | 37 | color 12 104 104 104 0 0 # intensive color 0 38 | color 13 255 84 84 0 0 # intensive color 1 39 | color 14 84 255 84 0 0 # intensive color 2 40 | color 15 255 255 84 0 0 # intensive color 3 41 | color 16 84 84 255 0 0 # intensive color 4 42 | color 17 255 84 255 0 0 # intensive color 5 43 | color 18 84 255 255 0 0 # intensive color 6 44 | color 19 255 255 255 0 0 # intensive color 7 45 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/Linux.schema: -------------------------------------------------------------------------------- 1 | # linux color schema for konsole 2 | 3 | title Linux Colors 4 | 5 | # FIXME 6 | # 7 | # The flaw in this schema is that "blick" comes out on the 8 | # Linux console as intensive background, really. 9 | # Since this is not used in clients you'll hardly notice 10 | # it in practice. 11 | 12 | # foreground colors 13 | 14 | # note that the default background color is flagged 15 | # to become transparent when an image is present. 16 | 17 | # slot transparent bold 18 | # | red grn blu | | 19 | # V V--color--V V V 20 | 21 | color 0 178 178 178 0 0 # regular foreground color (White) 22 | color 1 0 0 0 1 0 # regular background color (Black) 23 | 24 | color 2 0 0 0 0 0 # regular color 0 Black 25 | color 3 178 24 24 0 0 # regular color 1 Red 26 | color 4 24 178 24 0 0 # regular color 2 Green 27 | color 5 178 104 24 0 0 # regular color 3 Yellow 28 | color 6 24 24 178 0 0 # regular color 4 Blue 29 | color 7 178 24 178 0 0 # regular color 5 Magenta 30 | color 8 24 178 178 0 0 # regular color 6 Cyan 31 | color 9 178 178 178 0 0 # regular color 7 White 32 | 33 | # intensive colors 34 | 35 | # instead of changing the colors, we've flagged the text to become bold 36 | 37 | color 10 255 255 255 0 0 # intensive foreground color 38 | color 11 104 104 104 1 0 # intensive background color 39 | 40 | color 12 104 104 104 0 0 # intensive color 0 41 | color 13 255 84 84 0 0 # intensive color 1 42 | color 14 84 255 84 0 0 # intensive color 2 43 | color 15 255 255 84 0 0 # intensive color 3 44 | color 16 84 84 255 0 0 # intensive color 4 45 | color 17 255 84 255 0 0 # intensive color 5 46 | color 18 84 255 255 0 0 # intensive color 6 47 | color 19 255 255 255 0 0 # intensive color 7 48 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/README.Schema: -------------------------------------------------------------------------------- 1 | [README.Schema] 2 | 3 | The schemata offered in the Options/Schema menu are 4 | taken from from configurations files with a *.schema 5 | pattern either located in $KDEDIR/share/apps/konsole 6 | or ~/.kde/share/apps/konsole. 7 | 8 | Schemata allow to configure the color set that konsole 9 | uses, together with some more information on rendition 10 | processing. 11 | 12 | Syntax 13 | 14 | File 15 | :: { [Line] ['#' Comment] '\n' } 16 | 17 | Line 18 | :: "title" Title 19 | :: "image" Usage PathToPictureFile 20 | :: "transparency" Fade Red Green Blue 21 | :: "color" Slot Red Green Blue Transparent Bold 22 | :: "rcolor" Slot Saturation Value Transparent Bold 23 | :: "sysfg" Slot Transparent Bold 24 | :: "sysbg" Slot Transparent Bold 25 | 26 | Meaning 27 | 28 | - Title is the text to appear in the Option/Schema menu. 29 | It should be unique among all other schemata therefore. 30 | 31 | - The "image" clause allows to place an image on the 32 | konsole's background. 33 | 34 | - Usage can be either 35 | - "tile" - the image is tilewise replicated. 36 | - "center" - the image is centered. 37 | - "full" - the image is stretched to fit the window size. 38 | 39 | - The Path of the picture can both be relative 40 | (to kde wallpapers) or absolute. 41 | 42 | When a schema uses a background image (or transparency) 43 | one has to make at least one color slot transparent to 44 | achieve any visible effect. Please read below about the 45 | "Transparent" field in color,sysbg,sysfg. 46 | 47 | - The "transparency" clause picks and uses the background 48 | of the desktop as if it where an image together with 49 | a fade effect. This effect will fade the background 50 | to the specified color. 51 | 52 | The "Fade" is a real value between 0 and 1, indicating 53 | the strength of the fade. A value of 0 will not change 54 | the image, a value of 1 will make it the fade color 55 | everywhere, and in between. This will make the "glas" 56 | of the window be of the color given in the clause and 57 | being more(1) or less(0) intransparent. 58 | 59 | - The remaining clauses (color,sysbg,sysfg) are used 60 | to setup konsoles rendition system. 61 | 62 | To this end, konsole offers 20 color slots. 63 | 64 | Slot Meaning 65 | ----- -------------------------- 66 | 0 regular foreground color 67 | 1 regular background color 68 | 2-9 regular bgr color 0-7 69 | 10 intensive foreground color 70 | 11 intensive background color 71 | 12-19 intensive bgr color 0-7 72 | 73 | The traditional meaning of the "bgr" color codes 74 | has a bitwise interpretation of an additive three 75 | primary color scheme inherited from early EGA 76 | color terminals. 77 | 78 | Color Bits Colors 79 | ----- ---- ------- 80 | 0 000 Black 81 | 1 001 Red 82 | 2 010 Green 83 | 3 011 Yellow 84 | 4 100 Blue 85 | 5 101 Magenta 86 | 6 110 Cyan 87 | 7 111 White 88 | 89 | One may or may not stick to this tradition. 90 | Konsole allows to assign colors freely to slots. 91 | 92 | The slots fall apart into two groups, regular 93 | and intensive colors. The later are used when 94 | BOLD rendition is used by the client. 95 | 96 | Each of the groups have a default fore- and 97 | background color and the said bgr colors. 98 | Normal terminal processing will simply use 99 | the default colors. 100 | 101 | The color desired for a slot is indicated 102 | in the Red Green Blue fields of the color 103 | clause. Use the sysfg or the sysbg clause 104 | to indicate the default fore and background 105 | colors of the desktop. 106 | 107 | To specify randomized color for a slot use 108 | the clause rcolor. The two parameters to it 109 | being Saturation - the amount of colour, 110 | and Value, the darkness of the colour. 111 | 112 | To use transparency/images and to simulate 113 | the behavior of the xterm, one can supply 114 | two additional tags to each slot: 115 | - Transparent (0/1) meaning to show the 116 | background picture, if any. 117 | - Bold (0/1) to render characters bold. 118 | 119 | 120 | If you know about the escape codes, you might have 121 | noticed that intensive and bold rendition are sort 122 | of confused. This is inherited by the xterm which 123 | konsole is simulating. 124 | 125 | One can use the colortest.sh script supplied 126 | with the konsole source distribution to test 127 | a schema. 128 | 129 | The schema installed with konsole are more or 130 | less demonstrations and not really beauty, 131 | beside the Linux.schema, perhaps, which is 132 | made after the VGA colors. 133 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/README.default.Schema: -------------------------------------------------------------------------------- 1 | # default scheme for konsole (only here for documentation purposes) 2 | 3 | # the title is to appear in the menu. 4 | 5 | title Konsole Defaults 6 | 7 | # image tile /opt/kde/share/wallpapers/gray2.jpg 8 | 9 | # foreground colors 10 | 11 | # note that the default background color is flagged 12 | # to become transparent when an image is present. 13 | 14 | # slot transparent bold 15 | # | | | 16 | # V V--color--V V V 17 | 18 | color 0 0 0 0 0 0 # regular foreground color (Black) 19 | color 1 255 255 255 1 0 # regular background color (White) 20 | 21 | color 2 0 0 0 0 0 # regular color 0 Black 22 | color 3 178 24 24 0 0 # regular color 1 Red 23 | color 4 24 178 24 0 0 # regular color 2 Green 24 | color 5 178 104 24 0 0 # regular color 3 Yellow 25 | color 6 24 24 178 0 0 # regular color 4 Blue 26 | color 7 178 24 178 0 0 # regular color 5 Magenta 27 | color 8 24 178 178 0 0 # regular color 6 Cyan 28 | color 9 178 178 178 0 0 # regular color 7 White 29 | 30 | # intensive colors 31 | 32 | # instead of changing the colors, we've flagged the text to become bold 33 | 34 | color 10 0 0 0 0 1 # intensive foreground color 35 | color 11 255 255 255 1 0 # intensive background color 36 | 37 | color 12 104 104 104 0 0 # intensive color 0 38 | color 13 255 84 84 0 0 # intensive color 1 39 | color 14 84 255 84 0 0 # intensive color 2 40 | color 15 255 255 84 0 0 # intensive color 3 41 | color 16 84 84 255 0 0 # intensive color 4 42 | color 17 255 84 255 0 0 # intensive color 5 43 | color 18 84 255 255 0 0 # intensive color 6 44 | color 19 255 255 255 0 0 # intensive color 7 45 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/Transparent.schema: -------------------------------------------------------------------------------- 1 | # linux color schema for konsole 2 | 3 | title Transparent Konsole 4 | 5 | transparency 0.35 0 0 0 6 | 7 | # FIXME 8 | # 9 | # The flaw in this schema is that "blick" comes out on the 10 | # Linux console as intensive background, really. 11 | # Since this is not used in clients you'll hardly notice 12 | # it in practice. 13 | 14 | # foreground colors 15 | 16 | # note that the default background color is flagged 17 | # to become transparent when an image is present. 18 | 19 | # slot transparent bold 20 | # | red grn blu | | 21 | # V V--color--V V V 22 | 23 | color 0 178 178 178 0 0 # regular foreground color (White) 24 | color 1 0 0 0 1 0 # regular background color (Black) 25 | 26 | color 2 0 0 0 0 0 # regular color 0 Black 27 | color 3 178 24 24 0 0 # regular color 1 Red 28 | color 4 24 178 24 0 0 # regular color 2 Green 29 | color 5 178 104 24 0 0 # regular color 3 Yellow 30 | color 6 24 24 178 0 0 # regular color 4 Blue 31 | color 7 178 24 178 0 0 # regular color 5 Magenta 32 | color 8 24 178 178 0 0 # regular color 6 Cyan 33 | color 9 178 178 178 0 0 # regular color 7 White 34 | 35 | # intensive colors 36 | 37 | # instead of changing the colors, we've flagged the text to become bold 38 | 39 | color 10 255 255 255 0 0 # intensive foreground color 40 | color 11 104 104 104 1 0 # intensive background color 41 | 42 | color 12 104 104 104 0 0 # intensive color 0 43 | color 13 255 84 84 0 0 # intensive color 1 44 | color 14 84 255 84 0 0 # intensive color 2 45 | color 15 255 255 84 0 0 # intensive color 3 46 | color 16 84 84 255 0 0 # intensive color 4 47 | color 17 255 84 255 0 0 # intensive color 5 48 | color 18 84 255 255 0 0 # intensive color 6 49 | color 19 255 255 255 0 0 # intensive color 7 50 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/Transparent_MC.schema: -------------------------------------------------------------------------------- 1 | # linux color schema for konsole 2 | 3 | title Transparent for MC 4 | 5 | transparency 0.35 0 0 0 6 | 7 | # FIXME 8 | # 9 | # The flaw in this schema is that "blick" comes out on the 10 | # Linux console as intensive background, really. 11 | # Since this is not used in clients you'll hardly notice 12 | # it in practice. 13 | 14 | # foreground colors 15 | 16 | # note that the default background color is flagged 17 | # to become transparent when an image is present. 18 | 19 | # slot transparent bold 20 | # | red grn blu | | 21 | # V V--color--V V V 22 | 23 | color 0 178 178 178 0 0 # regular foreground color (White) 24 | color 1 0 0 0 1 0 # regular background color (Black) 25 | 26 | color 2 0 0 0 0 0 # regular color 0 Black 27 | color 3 178 24 24 0 0 # regular color 1 Red 28 | color 4 24 178 24 0 0 # regular color 2 Green 29 | color 5 178 104 24 0 0 # regular color 3 Yellow 30 | #color 6 24 24 178 0 0 # regular color 4 Blue 31 | color 6 0 0 0 1 0 # regular color 4 Blue 32 | 33 | color 7 178 24 178 0 0 # regular color 5 Magenta 34 | color 8 24 178 178 0 0 # regular color 6 Cyan 35 | color 9 178 178 178 0 0 # regular color 7 White 36 | 37 | # intensive colors 38 | 39 | # instead of changing the colors, we've flagged the text to become bold 40 | 41 | color 10 255 255 255 0 0 # intensive foreground color 42 | color 11 104 104 104 1 0 # intensive background color 43 | 44 | color 12 104 104 104 0 0 # intensive color 0 45 | color 13 255 84 84 0 0 # intensive color 1 46 | color 14 84 255 84 0 0 # intensive color 2 47 | color 15 255 255 84 0 0 # intensive color 3 48 | color 16 84 84 255 0 0 # intensive color 4 49 | color 17 255 84 255 0 0 # intensive color 5 50 | color 18 84 255 255 0 0 # intensive color 6 51 | color 19 255 255 255 0 0 # intensive color 7 52 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/Transparent_darkbg.schema: -------------------------------------------------------------------------------- 1 | # linux color schema for konsole 2 | 3 | title Transparent, Dark Background 4 | 5 | transparency 0.75 0 0 0 6 | 7 | # foreground colors 8 | 9 | # note that the default background color is flagged 10 | # to become transparent when an image is present. 11 | 12 | # slot transparent bold 13 | # | red grn blu | | 14 | # V V--color--V V V 15 | 16 | color 0 255 255 255 0 0 # regular foreground color (White) 17 | color 1 0 0 0 1 0 # regular background color (Black) 18 | 19 | color 2 0 0 0 0 0 # regular color 0 Black 20 | color 3 178 24 24 0 0 # regular color 1 Red 21 | color 4 24 178 24 0 0 # regular color 2 Green 22 | color 5 178 104 24 0 0 # regular color 3 Yellow 23 | color 6 24 24 178 0 0 # regular color 4 Blue 24 | color 7 178 24 178 0 0 # regular color 5 Magenta 25 | color 8 24 178 178 0 0 # regular color 6 Cyan 26 | color 9 178 178 178 0 0 # regular color 7 White 27 | 28 | # intensive colors 29 | 30 | # instead of changing the colors, we've flagged the text to become bold 31 | 32 | color 10 255 255 255 0 0 # intensive foreground color 33 | color 11 104 104 104 1 0 # intensive background color 34 | 35 | color 12 104 104 104 0 0 # intensive color 0 36 | color 13 255 84 84 0 0 # intensive color 1 37 | color 14 84 255 84 0 0 # intensive color 2 38 | color 15 255 255 84 0 0 # intensive color 3 39 | color 16 84 84 255 0 0 # intensive color 4 40 | color 17 255 84 255 0 0 # intensive color 5 41 | color 18 84 255 255 0 0 # intensive color 6 42 | color 19 255 255 255 0 0 # intensive color 7 43 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/Transparent_lightbg.schema: -------------------------------------------------------------------------------- 1 | # linux color schema for konsole 2 | 3 | title Transparent, Light Background 4 | 5 | transparency 0.1 0 0 0 6 | 7 | # This is a schema for very light backgrounds. It makes some 8 | # hacks about the colors to make Midnight Commander transparent 9 | # and with suitable colors. 10 | 11 | # foreground colors 12 | 13 | # note that the default background color is flagged 14 | # to become transparent when an image is present. 15 | 16 | # slot transparent bold 17 | # | red grn blu | | 18 | # V V--color--V V V 19 | 20 | color 0 50 50 50 0 0 # regular foreground color (DarkGray) 21 | color 1 200 200 200 1 0 # regular background color (White) 22 | 23 | # color 2 0 0 0 0 0 # regular color 0 Black 24 | color 2 200 200 200 1 0 # regular background color (White) 25 | color 3 178 24 24 0 0 # regular color 1 Red 26 | color 4 24 178 24 0 0 # regular color 2 Green 27 | color 5 178 104 24 0 0 # regular color 3 Yellow 28 | #color 6 24 24 178 0 0 # regular color 4 Blue 29 | color 6 0 0 0 1 0 # regular color 4 Blue 30 | # Blue is transparent, to make MC transparent 31 | 32 | color 7 178 24 178 0 0 # regular color 5 Magenta 33 | color 8 24 178 178 0 0 # regular color 6 Cyan 34 | # color 9 178 178 178 0 0 # regular color 7 White 35 | color 9 50 50 50 0 0 # regular foreground color (DarkGray) 36 | 37 | # intensive colors 38 | 39 | # instead of changing the colors, we've flagged the text to become bold 40 | 41 | color 10 0 0 0 0 0 # intensive foreground color 42 | color 11 255 255 255 1 0 # intensive background color 43 | 44 | color 12 104 104 104 0 0 # intensive color 0 45 | color 13 255 84 84 0 0 # intensive color 1 46 | color 14 84 255 84 0 0 # intensive color 2 47 | color 15 255 255 84 0 0 # intensive color 3 48 | color 16 84 84 255 0 0 # intensive color 4 49 | color 17 255 84 255 0 0 # intensive color 5 50 | color 18 84 255 255 0 0 # intensive color 6 51 | color 19 255 255 255 0 0 # intensive color 7 52 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/XTerm.schema: -------------------------------------------------------------------------------- 1 | # xterm color schema for konsole 2 | 3 | # xterm colors can be configured (almost) like 4 | # konsole colors can. This is the uncustomized 5 | # xterm schema. 6 | # Please refer to your local xterm setup files 7 | # if this schema differs. 8 | 9 | title XTerm Colors 10 | 11 | # foreground colors ------------------------------- 12 | 13 | # note that the default background color is flagged 14 | # to become transparent when an image is present. 15 | 16 | # slot transparent bold 17 | # | red grn blu | | 18 | # V V--color--V V V 19 | 20 | color 0 0 0 0 0 0 # regular foreground color (Black) 21 | color 1 255 255 255 1 0 # regular background color (White) 22 | 23 | color 2 0 0 0 0 0 # regular color 0 Black 24 | color 3 205 0 0 0 0 # regular color 1 Red 25 | color 4 0 205 0 0 0 # regular color 2 Green 26 | color 5 205 205 0 0 0 # regular color 3 Yellow 27 | color 6 0 0 205 0 0 # regular color 4 Blue 28 | color 7 205 0 205 0 0 # regular color 5 Magenta 29 | color 8 0 205 205 0 0 # regular color 6 Cyan 30 | color 9 229 229 229 0 0 # regular color 7 White 31 | 32 | # intensive colors ------------------------------------------- 33 | 34 | # for some strange reason, intensive colors are bold, also. 35 | 36 | color 10 77 77 77 0 1 # intensive foreground color 37 | color 11 255 255 255 1 1 # intensive background color 38 | 39 | color 12 77 77 77 0 1 # intensive color 0 40 | color 13 255 0 0 0 1 # intensive color 1 41 | color 14 0 255 0 0 1 # intensive color 2 42 | color 15 255 255 0 0 1 # intensive color 3 43 | color 16 0 0 255 0 1 # intensive color 4 44 | color 17 255 0 255 0 1 # intensive color 5 45 | color 18 0 255 255 0 1 # intensive color 6 46 | color 19 255 255 255 0 1 # intensive color 7 47 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/syscolor.schema: -------------------------------------------------------------------------------- 1 | # schema that uses system colors 2 | 3 | # the title is to appear in the menu. 4 | 5 | title System Colors 6 | 7 | # image none 8 | 9 | # foreground colors 10 | 11 | # note that the default background color is flagged 12 | # to become transparent when an image is present. 13 | 14 | # slot transparent bold 15 | # | | | 16 | # V V--color--V V V 17 | 18 | sysfg 0 0 0 # regular foreground color (system) 19 | sysbg 1 1 0 # regular background color (system) 20 | 21 | color 2 0 0 0 0 0 # regular color 0 Black 22 | color 3 178 24 24 0 0 # regular color 1 Red 23 | color 4 24 178 24 0 0 # regular color 2 Green 24 | color 5 178 104 24 0 0 # regular color 3 Yellow 25 | color 6 24 24 178 0 0 # regular color 4 Blue 26 | color 7 178 24 178 0 0 # regular color 5 Magenta 27 | color 8 24 178 178 0 0 # regular color 6 Cyan 28 | color 9 178 178 178 0 0 # regular color 7 White 29 | 30 | # intensive colors 31 | 32 | # instead of changing the colors, we've flagged the text to become bold 33 | 34 | color 10 0 0 0 0 1 # intensive foreground color 35 | color 11 255 255 255 1 0 # intensive background color 36 | 37 | color 12 104 104 104 0 0 # intensive color 0 38 | color 13 255 84 84 0 0 # intensive color 1 39 | color 14 84 255 84 0 0 # intensive color 2 40 | color 15 255 255 84 0 0 # intensive color 3 41 | color 16 84 84 255 0 0 # intensive color 4 42 | color 17 255 84 255 0 0 # intensive color 5 43 | color 18 84 255 255 0 0 # intensive color 6 44 | color 19 255 255 255 0 0 # intensive color 7 45 | -------------------------------------------------------------------------------- /lib/color-schemes/historic/vim.schema: -------------------------------------------------------------------------------- 1 | # VIM-recommended color schema for konsole 2 | 3 | # VIM (VI improved) in "help xiterm" recommends these colors for xterm. 4 | 5 | title VIM Colors 6 | 7 | # foreground colors ------------------------------- 8 | 9 | # note that the default background color is flagged 10 | # to become transparent when an image is present. 11 | 12 | # slot transparent bold 13 | # | red grn blu | | 14 | # V V--color--V V V 15 | 16 | color 0 0 0 0 0 0 # regular foreground color (Black) 17 | color 1 255 255 255 1 0 # regular background color (White) 18 | 19 | color 2 0 0 0 0 0 # regular color 0 Black 20 | color 3 192 0 0 0 0 # regular color 1 Red 21 | color 4 0 128 0 0 0 # regular color 2 Green 22 | color 5 128 128 0 0 0 # regular color 3 Yellow 23 | color 6 0 0 192 0 0 # regular color 4 Blue 24 | color 7 192 0 192 0 0 # regular color 5 Magenta 25 | color 8 0 128 128 0 0 # regular color 6 Cyan 26 | color 9 192 192 192 0 0 # regular color 7 White 27 | 28 | # intensive colors ------------------------------------------- 29 | 30 | color 10 77 77 77 0 1 # intensive foreground color 31 | color 11 255 255 255 1 1 # intensive background color 32 | 33 | color 12 128 128 128 0 0 # intensive color 0 34 | color 13 255 96 96 0 0 # intensive color 1 35 | color 14 0 255 0 0 0 # intensive color 2 36 | color 15 255 255 0 0 0 # intensive color 3 37 | color 16 128 128 255 0 0 # intensive color 4 38 | color 17 255 64 255 0 0 # intensive color 5 39 | color 18 0 255 255 0 0 # intensive color 6 40 | color 19 255 255 255 0 0 # intensive color 7 41 | -------------------------------------------------------------------------------- /lib/default.keytab: -------------------------------------------------------------------------------- 1 | # [README.default.Keytab] Buildin Keyboard Table 2 | # 3 | # To customize your keyboard, copy this file to something 4 | # ending with .keytab and change it to meet you needs. 5 | # Please read the README.KeyTab and the README.keyboard 6 | # in this case. 7 | # 8 | # -------------------------------------------------------------- 9 | 10 | keyboard "Default (XFree 4)" 11 | 12 | # -------------------------------------------------------------- 13 | # 14 | # Note that this particular table is a "risc" version made to 15 | # ease customization without bothering with obsolete details. 16 | # See VT100.keytab for the more hairy stuff. 17 | # 18 | # -------------------------------------------------------------- 19 | 20 | # common keys 21 | 22 | key Escape : "\E" 23 | 24 | key Tab -Shift : "\t" 25 | key Tab +Shift+Ansi : "\E[Z" 26 | key Tab +Shift-Ansi : "\t" 27 | key Backtab +Ansi : "\E[Z" 28 | key Backtab -Ansi : "\t" 29 | 30 | key Return-Shift-NewLine : "\r" 31 | key Return-Shift+NewLine : "\r\n" 32 | 33 | key Return+Shift : "\EOM" 34 | 35 | # Backspace and Delete codes are preserving CTRL-H. 36 | 37 | key Backspace : "\x7f" 38 | 39 | # Arrow keys in VT52 mode 40 | # shift up/down are reserved for scrolling. 41 | # shift left/right are reserved for switching between tabs (this is hardcoded). 42 | 43 | key Up -Shift-Ansi : "\EA" 44 | key Down -Shift-Ansi : "\EB" 45 | key Right-Shift-Ansi : "\EC" 46 | key Left -Shift-Ansi : "\ED" 47 | 48 | # Arrow keys in ANSI mode with Application - and Normal Cursor Mode) 49 | 50 | key Up -Shift-AnyMod+Ansi+AppCuKeys : "\EOA" 51 | key Down -Shift-AnyMod+Ansi+AppCuKeys : "\EOB" 52 | key Right -Shift-AnyMod+Ansi+AppCuKeys : "\EOC" 53 | key Left -Shift-AnyMod+Ansi+AppCuKeys : "\EOD" 54 | 55 | key Up -Shift-AnyMod+Ansi-AppCuKeys : "\E[A" 56 | key Down -Shift-AnyMod+Ansi-AppCuKeys : "\E[B" 57 | key Right -Shift-AnyMod+Ansi-AppCuKeys : "\E[C" 58 | key Left -Shift-AnyMod+Ansi-AppCuKeys : "\E[D" 59 | 60 | key Up -Shift+AnyMod+Ansi : "\E[1;*A" 61 | key Down -Shift+AnyMod+Ansi : "\E[1;*B" 62 | key Right -Shift+AnyMod+Ansi : "\E[1;*C" 63 | key Left -Shift+AnyMod+Ansi : "\E[1;*D" 64 | 65 | # other grey PC keys 66 | 67 | key Enter+NewLine : "\r\n" 68 | key Enter-NewLine : "\r" 69 | 70 | key Home -AnyMod -AppCuKeys : "\E[H" 71 | key End -AnyMod -AppCuKeys : "\E[F" 72 | key Home -AnyMod +AppCuKeys : "\EOH" 73 | key End -AnyMod +AppCuKeys : "\EOF" 74 | key Home +AnyMod : "\E[1;*H" 75 | key End +AnyMod : "\E[1;*F" 76 | 77 | key Insert -AnyMod : "\E[2~" 78 | key Delete -AnyMod : "\E[3~" 79 | key Insert +AnyMod : "\E[2;*~" 80 | key Delete +AnyMod : "\E[3;*~" 81 | 82 | key Prior -Shift-AnyMod : "\E[5~" 83 | key Next -Shift-AnyMod : "\E[6~" 84 | key Prior -Shift+AnyMod : "\E[5;*~" 85 | key Next -Shift+AnyMod : "\E[6;*~" 86 | 87 | # Function keys 88 | key F1 -AnyMod : "\EOP" 89 | key F2 -AnyMod : "\EOQ" 90 | key F3 -AnyMod : "\EOR" 91 | key F4 -AnyMod : "\EOS" 92 | key F5 -AnyMod : "\E[15~" 93 | key F6 -AnyMod : "\E[17~" 94 | key F7 -AnyMod : "\E[18~" 95 | key F8 -AnyMod : "\E[19~" 96 | key F9 -AnyMod : "\E[20~" 97 | key F10 -AnyMod : "\E[21~" 98 | key F11 -AnyMod : "\E[23~" 99 | key F12 -AnyMod : "\E[24~" 100 | 101 | key F1 +AnyMod : "\EO*P" 102 | key F2 +AnyMod : "\EO*Q" 103 | key F3 +AnyMod : "\EO*R" 104 | key F4 +AnyMod : "\EO*S" 105 | key F5 +AnyMod : "\E[15;*~" 106 | key F6 +AnyMod : "\E[17;*~" 107 | key F7 +AnyMod : "\E[18;*~" 108 | key F8 +AnyMod : "\E[19;*~" 109 | key F9 +AnyMod : "\E[20;*~" 110 | key F10 +AnyMod : "\E[21;*~" 111 | key F11 +AnyMod : "\E[23;*~" 112 | key F12 +AnyMod : "\E[24;*~" 113 | 114 | # Work around dead keys 115 | 116 | key Space +Control : "\x00" 117 | 118 | # Some keys are used by konsole to cause operations. 119 | # The scroll* operations refer to the history buffer. 120 | 121 | key Up +Shift-AppScreen : scrollLineUp 122 | key Prior +Shift-AppScreen : scrollPageUp 123 | key Down +Shift-AppScreen : scrollLineDown 124 | key Next +Shift-AppScreen : scrollPageDown 125 | 126 | key ScrollLock : scrollLock 127 | 128 | # keypad characters are not offered differently by Qt. 129 | -------------------------------------------------------------------------------- /lib/kb-layouts/README: -------------------------------------------------------------------------------- 1 | [README.KeyTab] 2 | 3 | The keytabs offered in the Options/Keyboard menu are 4 | taken from from configurations files with a *.keytab 5 | pattern either located in $KDEDIR/share/apps/konsole 6 | or ~/.kde/share/apps/konsole. 7 | 8 | Keytabs allow to configure the behavior of konsole 9 | on keyboard events, especially for functions keys. 10 | Please have a look into the README.keyboard file, too. 11 | 12 | The syntax is that each entry has the form : 13 | 14 | "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) 15 | 16 | Keynames are those defined in with the 17 | "Qt::Key_" prefix removed. 18 | 19 | Mode names are: 20 | 21 | - Shift : Shift Key pressed 22 | - Alt : Alt Key pressed 23 | - Control : Control Key pressed 24 | 25 | ( The VT100 emulation has modes that can affect the 26 | sequences emitted by certain keys. These modes are 27 | under control of the client program. 28 | 29 | - Newline : effects Return and Enter key. 30 | - Application : effects Up and Down key. 31 | - Ansi : effects Up and Down key (This is for VT52, really). 32 | 33 | Since sending a state to a program that has set the state 34 | itself is positivly wrong and obsolete design, better forget 35 | about this nasty detail. I may well remove this "feature" 36 | in a future clean up round. ) 37 | 38 | A "+" preceding a Modename means the Key is pressed. 39 | A "-" preceding a Modename means the Key is not pressed. 40 | If no mode is given it means don't care. 41 | 42 | Note that the combination of Key and Modes (set/reset) 43 | has to be unique. This means, that 44 | 45 | key A + Shift : "A" 46 | key A : "a" 47 | 48 | will not accept the small letter "a" rule as expected, 49 | one has to add a "- Shift" to the last clause. Use 50 | the stdout/stderr diagnostics of konsole when modifying 51 | keytabs to find problems like this. 52 | 53 | Operations are 54 | 55 | - scrollUpLine : scroll up one line in the history log 56 | - scrollUpPage : scroll up one page in the history log 57 | - scrollDownLine : scroll down one line in the history log 58 | - scrollDownPage : scroll down one page in the history log 59 | - emitClipboard : "paste" the current clipboard 60 | - emitSelection : "paste" the current selection 61 | 62 | Strings have the syntax of C strings, 63 | one may use the following escapes: 64 | 65 | - \E - escape 66 | - \\ - backslash 67 | - \" - double quote 68 | - \t - tab 69 | - \r - return 70 | - \n - newline 71 | - \b - backspace 72 | - \xHH - where HH are two hex digits 73 | -------------------------------------------------------------------------------- /lib/kb-layouts/historic/vt100.keytab: -------------------------------------------------------------------------------- 1 | # [vt100.keytab] Konsole Keyboard Table (VT100 keys) 2 | # 3 | # -------------------------------------------------------------- 4 | 5 | keyboard "vt100 (historical)" 6 | 7 | # -------------------------------------------------------------- 8 | # 9 | # This configuration table allows to customize the 10 | # meaning of the keys. 11 | # 12 | # The syntax is that each entry has the form : 13 | # 14 | # "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) 15 | # 16 | # Keynames are those defined in with the 17 | # "Qt::Key_" removed. (We'd better insert the list here) 18 | # 19 | # Mode names are : 20 | # 21 | # - Shift 22 | # - Alt 23 | # - Control 24 | # 25 | # The VT100 emulation has two modes that can affect the 26 | # sequences emitted by certain keys. These modes are 27 | # under control of the client program. 28 | # 29 | # - Newline : effects Return and Enter key. 30 | # - Application : effects Up and Down key. 31 | # 32 | # - Ansi : effects Up and Down key (This is for VT52, really). 33 | # 34 | # Operations are 35 | # 36 | # - scrollUpLine 37 | # - scrollUpPage 38 | # - scrollDownLine 39 | # - scrollDownPage 40 | # 41 | # - emitSelection 42 | # 43 | # If the key is not found here, the text of the 44 | # key event as provided by QT is emitted, possibly 45 | # preceded by ESC if the Alt key is pressed. 46 | # 47 | # -------------------------------------------------------------- 48 | 49 | key Escape : "\E" 50 | key Tab : "\t" 51 | 52 | # VT100 can add an extra \n after return. 53 | # The NewLine mode is set by an escape sequence. 54 | 55 | key Return-NewLine : "\r" 56 | key Return+NewLine : "\r\n" 57 | 58 | # Some desperately try to save the ^H. 59 | 60 | key Backspace : "\x7f" 61 | key Delete : "\E[3~" 62 | 63 | # These codes are for the VT52 mode of VT100 64 | # The Ansi mode (i.e. VT100 mode) is set by 65 | # an escape sequence 66 | 67 | key Up -Shift-Ansi : "\EA" 68 | key Down -Shift-Ansi : "\EB" 69 | key Right-Shift-Ansi : "\EC" 70 | key Left -Shift-Ansi : "\ED" 71 | 72 | # VT100 emits a mode bit together 73 | # with the arrow keys.The AppCuKeys 74 | # mode is set by an escape sequence. 75 | 76 | key Up -Shift+Ansi+AppCuKeys : "\EOA" 77 | key Down -Shift+Ansi+AppCuKeys : "\EOB" 78 | key Right-Shift+Ansi+AppCuKeys : "\EOC" 79 | key Left -Shift+Ansi+AppCuKeys : "\EOD" 80 | 81 | key Up -Shift+Ansi-AppCuKeys : "\E[A" 82 | key Down -Shift+Ansi-AppCuKeys : "\E[B" 83 | key Right-Shift+Ansi-AppCuKeys : "\E[C" 84 | key Left -Shift+Ansi-AppCuKeys : "\E[D" 85 | 86 | # function keys (FIXME: make pf1-pf4) 87 | 88 | key F1 : "\E[11~" 89 | key F2 : "\E[12~" 90 | key F3 : "\E[13~" 91 | key F4 : "\E[14~" 92 | key F5 : "\E[15~" 93 | 94 | key F6 : "\E[17~" 95 | key F7 : "\E[18~" 96 | key F8 : "\E[19~" 97 | key F9 : "\E[20~" 98 | key F10 : "\E[21~" 99 | key F11 : "\E[23~" 100 | key F12 : "\E[24~" 101 | 102 | key Home : "\E[H" 103 | key End : "\E[F" 104 | 105 | key PgUp -Shift : "\E[5~" 106 | key PgDown -Shift : "\E[6~" 107 | key Insert -Shift : "\E[2~" 108 | 109 | # Keypad-Enter. See comment on Return above. 110 | 111 | key Enter+NewLine : "\r\n" 112 | key Enter-NewLine : "\r" 113 | 114 | key Space +Control : "\x00" 115 | 116 | # some of keys are used by konsole. 117 | 118 | key Up +Shift : scrollLineUp 119 | key PgUp +Shift : scrollPageUp 120 | key Down +Shift : scrollLineDown 121 | key PgDown +Shift : scrollPageDown 122 | 123 | key ScrollLock : scrollLock 124 | 125 | 126 | #---------------------------------------------------------- 127 | 128 | # keypad characters as offered by Qt 129 | # cannot be recognized as such. 130 | 131 | #---------------------------------------------------------- 132 | 133 | # Following other strings as emitted by konsole. 134 | -------------------------------------------------------------------------------- /lib/kb-layouts/historic/x11r5.keytab: -------------------------------------------------------------------------------- 1 | # [x11r5.Keytab] Keyboard Table for X11 R5 2 | 3 | keyboard "XTerm (XFree 3.x.x)" 4 | 5 | # -------------------------------------------------------------- 6 | # 7 | # Note that this particular table is a "risc" version made to 8 | # ease customization without bothering with obsolete details. 9 | # See VT100.keytab for the more hairy stuff. 10 | # 11 | # -------------------------------------------------------------- 12 | 13 | # common keys 14 | 15 | key Escape : "\E" 16 | key Tab : "\t" 17 | 18 | key Return : "\r" 19 | 20 | # Backspace and Delete codes are preserving CTRL-H. 21 | 22 | key Backspace : "\x7f" 23 | 24 | # cursor keys 25 | 26 | key Up -Shift : "\EOA" 27 | key Down -Shift : "\EOB" 28 | key Right -Shift : "\EOC" 29 | key Left -Shift : "\EOD" 30 | 31 | # other grey PC keys 32 | 33 | key Enter : "\r" 34 | 35 | key Home : "\E[1~" 36 | key Insert-Shift : "\E[2~" 37 | key Delete : "\E[3~" 38 | key End : "\E[4~" 39 | key PgUp -Shift : "\E[5~" 40 | key PgDown -Shift : "\E[6~" 41 | 42 | # function keys 43 | 44 | key F1 : "\E[11~" 45 | key F2 : "\E[12~" 46 | key F3 : "\E[13~" 47 | key F4 : "\E[14~" 48 | key F5 : "\E[15~" 49 | key F6 : "\E[17~" 50 | key F7 : "\E[18~" 51 | key F8 : "\E[19~" 52 | key F9 : "\E[20~" 53 | key F10 : "\E[21~" 54 | key F11 : "\E[23~" 55 | key F12 : "\E[24~" 56 | 57 | # Work around dead keys 58 | 59 | key Space +Control : "\x00" 60 | 61 | # Some keys are used by konsole to cause operations. 62 | # The scroll* operations refer to the history buffer. 63 | 64 | key Up +Shift : scrollLineUp 65 | key PgUp +Shift : scrollPageUp 66 | key Down +Shift : scrollLineDown 67 | key PgDown +Shift : scrollPageDown 68 | 69 | key ScrollLock : scrollLock 70 | 71 | # keypad characters are not offered differently by Qt. 72 | -------------------------------------------------------------------------------- /lib/kb-layouts/linux.keytab: -------------------------------------------------------------------------------- 1 | # [linux.keytab] Konsole Keyboard Table (Linux console keys) 2 | # 3 | # -------------------------------------------------------------- 4 | 5 | # NOT TESTED, MAY NEED SOME CLEANUPS 6 | keyboard "Linux console" 7 | 8 | # -------------------------------------------------------------- 9 | # 10 | # This configuration table allows to customize the 11 | # meaning of the keys. 12 | # 13 | # The syntax is that each entry has the form : 14 | # 15 | # "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) 16 | # 17 | # Keynames are those defined in with the 18 | # "Qt::Key_" removed. (We'd better insert the list here) 19 | # 20 | # Mode names are : 21 | # 22 | # - Shift 23 | # - Alt 24 | # - Control 25 | # 26 | # The VT100 emulation has two modes that can affect the 27 | # sequences emitted by certain keys. These modes are 28 | # under control of the client program. 29 | # 30 | # - Newline : effects Return and Enter key. 31 | # - Application : effects Up and Down key. 32 | # 33 | # - Ansi : effects Up and Down key (This is for VT52, really). 34 | # 35 | # Operations are 36 | # 37 | # - scrollUpLine 38 | # - scrollUpPage 39 | # - scrollDownLine 40 | # - scrollDownPage 41 | # 42 | # - emitSelection 43 | # 44 | # If the key is not found here, the text of the 45 | # key event as provided by QT is emitted, possibly 46 | # preceded by ESC if the Alt key is pressed. 47 | # 48 | # -------------------------------------------------------------- 49 | 50 | key Escape : "\E" 51 | key Tab : "\t" 52 | 53 | # VT100 can add an extra \n after return. 54 | # The NewLine mode is set by an escape sequence. 55 | 56 | key Return-NewLine : "\r" 57 | key Return+NewLine : "\r\n" 58 | 59 | # Some desperately try to save the ^H. 60 | 61 | key Backspace : "\x7f" 62 | key Delete : "\E[3~" 63 | 64 | # These codes are for the VT52 mode of VT100 65 | # The Ansi mode (i.e. VT100 mode) is set by 66 | # an escape sequence 67 | 68 | key Up -Shift-Ansi : "\EA" 69 | key Down -Shift-Ansi : "\EB" 70 | key Right-Shift-Ansi : "\EC" 71 | key Left -Shift-Ansi : "\ED" 72 | 73 | # VT100 emits a mode bit together 74 | # with the arrow keys.The AppCuKeys 75 | # mode is set by an escape sequence. 76 | 77 | key Up -Shift+Ansi+AppCuKeys : "\EOA" 78 | key Down -Shift+Ansi+AppCuKeys : "\EOB" 79 | key Right-Shift+Ansi+AppCuKeys : "\EOC" 80 | key Left -Shift+Ansi+AppCuKeys : "\EOD" 81 | 82 | key Up -Shift+Ansi-AppCuKeys : "\E[A" 83 | key Down -Shift+Ansi-AppCuKeys : "\E[B" 84 | key Right-Shift+Ansi-AppCuKeys : "\E[C" 85 | key Left -Shift+Ansi-AppCuKeys : "\E[D" 86 | 87 | key Up -Shift+AnyMod+Ansi : "\E[1;*A" 88 | key Down -Shift+AnyMod+Ansi : "\E[1;*B" 89 | key Right -Shift+AnyMod+Ansi : "\E[1;*C" 90 | key Left -Shift+AnyMod+Ansi : "\E[1;*D" 91 | 92 | # linux functions keys F1-F5 differ from xterm 93 | 94 | key F1 : "\E[[A" 95 | key F2 : "\E[[B" 96 | key F3 : "\E[[C" 97 | key F4 : "\E[[D" 98 | key F5 : "\E[[E" 99 | 100 | key F6 : "\E[17~" 101 | key F7 : "\E[18~" 102 | key F8 : "\E[19~" 103 | key F9 : "\E[20~" 104 | key F10 : "\E[21~" 105 | key F11 : "\E[23~" 106 | key F12 : "\E[24~" 107 | 108 | key Home : "\E[1~" 109 | key End : "\E[4~" 110 | 111 | key PgUp -Shift : "\E[5~" 112 | key PgDown -Shift : "\E[6~" 113 | key Insert -Shift : "\E[2~" 114 | 115 | # Keypad-Enter. See comment on Return above. 116 | 117 | key Enter+NewLine : "\r\n" 118 | key Enter-NewLine : "\r" 119 | 120 | key Space +Control : "\x00" 121 | 122 | # some of keys are used by konsole. 123 | 124 | key Up +Shift : scrollLineUp 125 | key PgUp +Shift : scrollPageUp 126 | key Down +Shift : scrollLineDown 127 | key PgDown +Shift : scrollPageDown 128 | 129 | key ScrollLock : scrollLock 130 | 131 | #---------------------------------------------------------- 132 | 133 | # keypad characters as offered by Qt 134 | # cannot be recognized as such. 135 | 136 | #---------------------------------------------------------- 137 | 138 | # Following other strings as emitted by konsole. 139 | -------------------------------------------------------------------------------- /lib/kb-layouts/solaris.keytab: -------------------------------------------------------------------------------- 1 | # [solaris.keytab] Konsole Keyboard Table 2 | # 3 | 4 | keyboard "Solaris console" 5 | 6 | # -------------------------------------------------------------- 7 | # 8 | # This configuration table allows to customize the 9 | # meaning of the keys. 10 | # 11 | # The syntax is that each entry has the form : 12 | # 13 | # "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) 14 | # 15 | # Keynames are those defined in with the 16 | # "Qt::Key_" removed. (We'd better insert the list here) 17 | # 18 | # Mode names are : 19 | # 20 | # - Shift 21 | # - Alt 22 | # - Control 23 | # 24 | # The VT100 emulation has two modes that can affect the 25 | # sequences emitted by certain keys. These modes are 26 | # under control of the client program. 27 | # 28 | # 29 | # - Newline : effects Return and Enter key. 30 | # - Application : effects Up and Down key. 31 | # 32 | # - Ansi : effects Up and Down key (This is for VT52, really). 33 | # 34 | # Operations are 35 | # 36 | # - scrollUpLine 37 | # - scrollUpPage 38 | # - scrollDownLine 39 | # - scrollDownPage 40 | # 41 | # - emitSelection 42 | # 43 | # If the key is not found here, the text of the 44 | # key event as provided by QT is emitted, possibly 45 | # preceded by ESC if the Alt key is pressed. 46 | # 47 | # -------------------------------------------------------------- 48 | 49 | key Escape : "\E" 50 | key Tab : "\t" 51 | 52 | key Return-Alt : "\r" 53 | key Return+Alt : "\E\r" 54 | 55 | # Backspace and Delete codes are preserving CTRL-H. 56 | 57 | key Backspace : "\x08" 58 | #key Delete : "\x7F" 59 | 60 | # cursor keys 61 | 62 | key Up -Shift : "\EOA" 63 | key Down -Shift : "\EOB" 64 | key Right -Shift : "\EOC" 65 | key Left -Shift : "\EOD" 66 | 67 | # other grey PC keys 68 | 69 | key Enter : "\r" 70 | 71 | key Home : "\E[1~" 72 | key Insert-Shift : "\E[2~" 73 | key Delete : "\E[3~" 74 | key End : "\E[4~" 75 | key PgUp -Shift : "\E[5~" 76 | key PgDown -Shift : "\E[6~" 77 | 78 | # function keys 79 | 80 | key F1 : "\E[11~" 81 | key F2 : "\E[12~" 82 | key F3 : "\E[13~" 83 | key F4 : "\E[14~" 84 | key F5 : "\E[15~" 85 | key F6 : "\E[17~" 86 | key F7 : "\E[18~" 87 | key F8 : "\E[19~" 88 | key F9 : "\E[20~" 89 | key F10 : "\E[21~" 90 | key F11 : "\E[23~" 91 | key F12 : "\E[24~" 92 | 93 | # Work around dead keys 94 | 95 | key Space +Control : "\x00" 96 | 97 | # Some keys are used by konsole to cause operations. 98 | # The scroll* operations refer to the history buffer. 99 | 100 | #key Left +Shift : prevSession 101 | #key Right +Shift : nextSession 102 | key Up +Shift : scrollLineUp 103 | key PgUp +Shift : scrollPageUp 104 | key Down +Shift : scrollLineDown 105 | key PgDown +Shift : scrollPageDown 106 | #key Insert+Shift : emitSelection 107 | 108 | # keypad characters are not offered differently by Qt. 109 | -------------------------------------------------------------------------------- /lib/kb-layouts/vt420pc.keytab: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: This keyboard binding is not installed because it 3 | # apparently doesn't work with actual VT420 systems 4 | # (see BUG:170220) 5 | # 6 | # [vt420pc.keytab] Konsole Keyboard Table (VT420pc keys) 7 | # adapted by ferdinand gassauer f.gassauer@aon.at 8 | # Nov 2000 9 | # 10 | ################################################################ 11 | # 12 | # The escape sequences emitted by the 13 | # keys Shift+F1 to Shift+F12 might not fit your needs 14 | # 15 | ################# IMPORTANT NOTICE ############################# 16 | # the key bindings (Kcontrol -> look and feel -> keybindgs) 17 | # overrule the settings in this file. The key bindings might be 18 | # changed by the user WITHOUT notification of the maintainer of 19 | # the keytab file. Konsole will not work as expected by 20 | # the maintainer of the keytab file. 21 | ################################################################ 22 | # 23 | # -------------------------------------------------------------- 24 | 25 | keyboard "DEC VT420 Terminal" 26 | 27 | # -------------------------------------------------------------- 28 | # 29 | # This configuration table allows to customize the 30 | # meaning of the keys. 31 | # 32 | # The syntax is that each entry has the form : 33 | # 34 | # "key" Keyname { ("+"|"-") Modename } ":" (String|Operation) 35 | # 36 | # Keynames are those defined in with the 37 | # "Qt::Key_" removed. (We'd better insert the list here) 38 | # 39 | # Mode names are : 40 | # 41 | # - Shift 42 | # - Alt 43 | # - Control 44 | # 45 | # The VT100 emulation has two modes that can affect the 46 | # sequences emitted by certain keys. These modes are 47 | # under control of the client program. 48 | # 49 | # - Newline : effects Return and Enter key. 50 | # - Application : effects Up and Down key. 51 | # 52 | # - Ansi : effects Up and Down key (This is for VT52, really). 53 | # 54 | # Operations are 55 | # 56 | # - scrollUpLine 57 | # - scrollUpPage 58 | # - scrollDownLine 59 | # - scrollDownPage 60 | # 61 | # - emitSelection 62 | # 63 | # If the key is not found here, the text of the 64 | # key event as provided by QT is emitted, possibly 65 | # preceded by ESC if the Alt key is pressed. 66 | # 67 | # -------------------------------------------------------------- 68 | 69 | key Escape : "\E" 70 | key Tab : "\t" 71 | key Backtab: "\E[Z" 72 | 73 | # VT100 can add an extra \n after return. 74 | # The NewLine mode is set by an escape sequence. 75 | 76 | key Return-NewLine : "\r" 77 | key Return+NewLine : "\r\n" 78 | 79 | # Some desperately try to save the ^H. 80 | # may be not everyone wants this 81 | 82 | key Backspace : "\x08" # Control H 83 | key Delete : "\x7f" 84 | 85 | # These codes are for the VT420pc 86 | # The Ansi mode (i.e. VT100 mode) is set by 87 | # an escape sequence 88 | 89 | key Up -Shift-Ansi : "\EA" 90 | key Down -Shift-Ansi : "\EB" 91 | key Right-Shift-Ansi : "\EC" 92 | key Left -Shift-Ansi : "\ED" 93 | 94 | # VT100 emits a mode bit together 95 | # with the arrow keys.The AppCuKeys 96 | # mode is set by an escape sequence. 97 | 98 | key Up -Shift+Ansi+AppCuKeys : "\EOA" 99 | key Down -Shift+Ansi+AppCuKeys : "\EOB" 100 | key Right-Shift+Ansi+AppCuKeys : "\EOC" 101 | key Left -Shift+Ansi+AppCuKeys : "\EOD" 102 | 103 | key Up -Shift+Ansi-AppCuKeys : "\E[A" 104 | key Down -Shift+Ansi-AppCuKeys : "\E[B" 105 | key Right-Shift+Ansi-AppCuKeys : "\E[C" 106 | key Left -Shift+Ansi-AppCuKeys : "\E[D" 107 | 108 | # function keys 109 | 110 | key F1 -Shift : "\E[11~" 111 | key F2 -Shift : "\E[12~" 112 | key F3 -Shift : "\E[13~" 113 | key F4 -Shift : "\E[14~" 114 | key F5 -Shift : "\E[15~" 115 | key F6 -Shift : "\E[17~" 116 | key F7 -Shift : "\E[18~" 117 | key F8 -Shift : "\E[19~" 118 | key F9 -Shift : "\E[20~" 119 | key F10-Shift : "\E[21~" 120 | key F11-Shift : "\E[23~" 121 | key F12-Shift : "\E[24~" 122 | # 123 | # Shift F1-F12 124 | # 125 | key F1 +Shift : "\E[11;2~" 126 | key F2 +Shift : "\E[12;2~" 127 | key F3 +Shift : "\E[13;2~" 128 | key F4 +Shift : "\E[14;2~" 129 | key F5 +Shift : "\E[15;2~" 130 | key F6 +Shift : "\E[17;2~" 131 | key F7 +Shift : "\E[18;2~" 132 | key F8 +Shift : "\E[19;2~" 133 | key F9 +Shift : "\E[20;2~" 134 | key F10+Shift : "\E[21;2~" 135 | key F11+Shift : "\E[23;2~" 136 | key F12+Shift : "\E[24;2~" 137 | 138 | key Home : "\E[H" 139 | key End : "\E[F" 140 | 141 | key PgUp -Shift : "\E[5~" 142 | key PgDown -Shift : "\E[6~" 143 | key Insert -Shift : "\E[2~" 144 | 145 | # Keypad-Enter. See comment on Return above. 146 | 147 | key Enter+NewLine : "\r\n" 148 | key Enter-NewLine : "\r" 149 | 150 | key Space +Control : "\x00" 151 | 152 | # some of keys are used by konsole. 153 | 154 | key Up +Shift : scrollLineUp 155 | key PgUp +Shift : scrollPageUp 156 | key Down +Shift : scrollLineDown 157 | key PgDown +Shift : scrollPageDown 158 | 159 | key ScrollLock : scrollLock 160 | 161 | #---------------------------------------------------------- 162 | 163 | # keypad characters as offered by Qt 164 | # cannot be recognized as such. 165 | 166 | #---------------------------------------------------------- 167 | 168 | # Following other strings as emitted by konsole. 169 | -------------------------------------------------------------------------------- /lib/konsole_wcwidth.cpp: -------------------------------------------------------------------------------- 1 | /* $XFree86: xc/programs/xterm/wcwidth.character,v 1.3 2001/07/29 22:08:16 tsi Exp $ */ 2 | /* 3 | * This is an implementation of wcwidth() and wcswidth() as defined in 4 | * "The Single UNIX Specification, Version 2, The Open Group, 1997" 5 | * 6 | * 7 | * Markus Kuhn -- 2001-01-12 -- public domain 8 | */ 9 | 10 | #include 11 | 12 | #ifdef HAVE_UTF8PROC 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include "konsole_wcwidth.h" 19 | 20 | int konsole_wcwidth(wchar_t ucs) 21 | { 22 | #ifdef HAVE_UTF8PROC 23 | utf8proc_category_t cat = utf8proc_category( ucs ); 24 | if (cat == UTF8PROC_CATEGORY_CO) { 25 | // Co: Private use area. libutf8proc makes them zero width, while tmux 26 | // assumes them to be width 1, and glibc's default width is also 1 27 | return 1; 28 | } 29 | return utf8proc_charwidth( ucs ); 30 | #else 31 | return wcwidth( ucs ); 32 | #endif 33 | } 34 | 35 | // single byte char: +1, multi byte char: +2 36 | int string_width( const std::wstring & wstr ) 37 | { 38 | int w = 0; 39 | for ( size_t i = 0; i < wstr.length(); ++i ) { 40 | w += konsole_wcwidth( wstr[ i ] ); 41 | } 42 | return w; 43 | } 44 | -------------------------------------------------------------------------------- /lib/konsole_wcwidth.h: -------------------------------------------------------------------------------- 1 | /* $XFree86: xc/programs/xterm/wcwidth.h,v 1.2 2001/06/18 19:09:27 dickey Exp $ */ 2 | 3 | /* Markus Kuhn -- 2001-01-12 -- public domain */ 4 | /* Adaptations for KDE by Waldo Bastian */ 5 | /* 6 | Rewritten for QT4 by e_k 7 | */ 8 | 9 | 10 | #ifndef _KONSOLE_WCWIDTH_H_ 11 | #define _KONSOLE_WCWIDTH_H_ 12 | 13 | // Standard 14 | #include 15 | 16 | int konsole_wcwidth(wchar_t ucs); 17 | 18 | int string_width( const std::wstring & wstr ); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /lib/kpty.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | 3 | Copyright (C) 2003,2007 Oswald Buddenhagen 4 | 5 | Rewritten for QT4 by e_k , Copyright (C)2008 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Library General Public 9 | License as published by the Free Software Foundation; either 10 | version 2 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Library General Public License for more details. 16 | 17 | You should have received a copy of the GNU Library General Public License 18 | along with this library; see the file COPYING.LIB. If not, write to 19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 | Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef kpty_h 24 | #define kpty_h 25 | 26 | #include 27 | 28 | #include 29 | 30 | class KPtyPrivate; 31 | struct termios; 32 | 33 | /** 34 | * Provides primitives for opening & closing a pseudo TTY pair, assigning the 35 | * controlling TTY, utmp registration and setting various terminal attributes. 36 | */ 37 | class KPty { 38 | Q_DECLARE_PRIVATE(KPty) 39 | 40 | public: 41 | 42 | /** 43 | * Constructor 44 | */ 45 | KPty(); 46 | 47 | /** 48 | * Destructor: 49 | * 50 | * If the pty is still open, it will be closed. Note, however, that 51 | * an utmp registration is @em not undone. 52 | */ 53 | ~KPty(); 54 | 55 | KPty(const KPty &) = delete; 56 | KPty &operator=(const KPty &) = delete; 57 | 58 | /** 59 | * Create a pty master/slave pair. 60 | * 61 | * @return true if a pty pair was successfully opened 62 | */ 63 | bool open(); 64 | 65 | bool open(int fd); 66 | 67 | /** 68 | * Close the pty master/slave pair. 69 | */ 70 | void close(); 71 | 72 | /** 73 | * Close the pty slave descriptor. 74 | * 75 | * When creating the pty, KPty also opens the slave and keeps it open. 76 | * Consequently the master will never receive an EOF notification. 77 | * Usually this is the desired behavior, as a closed pty slave can be 78 | * reopened any time - unlike a pipe or socket. However, in some cases 79 | * pipe-alike behavior might be desired. 80 | * 81 | * After this function was called, slaveFd() and setCTty() cannot be 82 | * used. 83 | */ 84 | void closeSlave(); 85 | bool openSlave(); 86 | 87 | /** 88 | * Creates a new session and process group and makes this pty the 89 | * controlling tty. 90 | */ 91 | void setCTty(); 92 | 93 | /** 94 | * Creates an utmp entry for the tty. 95 | * This function must be called after calling setCTty and 96 | * making this pty the stdin. 97 | * @param user the user to be logged on 98 | * @param remotehost the host from which the login is coming. This is 99 | * @em not the local host. For remote logins it should be the hostname 100 | * of the client. For local logins from inside an X session it should 101 | * be the name of the X display. Otherwise it should be empty. 102 | */ 103 | void login(const char * user = nullptr, const char * remotehost = nullptr); 104 | 105 | /** 106 | * Removes the utmp entry for this tty. 107 | */ 108 | void logout(); 109 | 110 | /** 111 | * Wrapper around tcgetattr(3). 112 | * 113 | * This function can be used only while the PTY is open. 114 | * You will need an #include <termios.h> to do anything useful 115 | * with it. 116 | * 117 | * @param ttmode a pointer to a termios structure. 118 | * Note: when declaring ttmode, @c struct @c ::termios must be used - 119 | * without the '::' some version of HP-UX thinks, this declares 120 | * the struct in your class, in your method. 121 | * @return @c true on success, false otherwise 122 | */ 123 | bool tcGetAttr(struct ::termios * ttmode) const; 124 | 125 | /** 126 | * Wrapper around tcsetattr(3) with mode TCSANOW. 127 | * 128 | * This function can be used only while the PTY is open. 129 | * 130 | * @param ttmode a pointer to a termios structure. 131 | * @return @c true on success, false otherwise. Note that success means 132 | * that @em at @em least @em one attribute could be set. 133 | */ 134 | bool tcSetAttr(struct ::termios * ttmode); 135 | 136 | /** 137 | * Change the logical (screen) size of the pty. 138 | * The default is 24 lines by 80 columns. 139 | * 140 | * This function can be used only while the PTY is open. 141 | * 142 | * @param lines the number of rows 143 | * @param columns the number of columns 144 | * @return @c true on success, false otherwise 145 | */ 146 | bool setWinSize(int lines, int columns); 147 | 148 | /** 149 | * Set whether the pty should echo input. 150 | * 151 | * Echo is on by default. 152 | * If the output of automatically fed (non-interactive) PTY clients 153 | * needs to be parsed, disabling echo often makes it much simpler. 154 | * 155 | * This function can be used only while the PTY is open. 156 | * 157 | * @param echo true if input should be echoed. 158 | * @return @c true on success, false otherwise 159 | */ 160 | bool setEcho(bool echo); 161 | 162 | /** 163 | * @return the name of the slave pty device. 164 | * 165 | * This function should be called only while the pty is open. 166 | */ 167 | const char * ttyName() const; 168 | 169 | /** 170 | * @return the file descriptor of the master pty 171 | * 172 | * This function should be called only while the pty is open. 173 | */ 174 | int masterFd() const; 175 | 176 | /** 177 | * @return the file descriptor of the slave pty 178 | * 179 | * This function should be called only while the pty slave is open. 180 | */ 181 | int slaveFd() const; 182 | 183 | protected: 184 | /** 185 | * @internal 186 | */ 187 | KPty(KPtyPrivate * d); 188 | 189 | /** 190 | * @internal 191 | */ 192 | std::unique_ptr const d_ptr; 193 | }; 194 | 195 | #endif 196 | 197 | -------------------------------------------------------------------------------- /lib/kpty_p.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | 3 | Copyright (C) 2003,2007 Oswald Buddenhagen 4 | 5 | Rewritten for QT4 by e_k , Copyright (C)2008 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Library General Public 9 | License as published by the Free Software Foundation; either 10 | version 2 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Library General Public License for more details. 16 | 17 | You should have received a copy of the GNU Library General Public License 18 | along with this library; see the file COPYING.LIB. If not, write to 19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 | Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef kpty_p_h 24 | #define kpty_p_h 25 | 26 | #include "kpty.h" 27 | 28 | #include 29 | 30 | class KPtyPrivate { 31 | public: 32 | 33 | Q_DECLARE_PUBLIC(KPty) 34 | 35 | KPtyPrivate(KPty* parent); 36 | virtual ~KPtyPrivate(); 37 | 38 | bool chownpty(bool grant); 39 | 40 | int masterFd; 41 | int slaveFd; 42 | bool ownMaster:1; 43 | 44 | QByteArray ttyName; 45 | 46 | KPty *q_ptr; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /lib/kptyprocess.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of QTerminal - http://gitorious.org/qterminal 3 | * 4 | * This file was un-linked from KDE and modified 5 | * by Maxim Bourmistrov 6 | * 7 | */ 8 | 9 | /* 10 | This file is part of the KDE libraries 11 | 12 | Copyright (C) 2007 Oswald Buddenhagen 13 | 14 | This library is free software; you can redistribute it and/or 15 | modify it under the terms of the GNU Library General Public 16 | License as published by the Free Software Foundation; either 17 | version 2 of the License, or (at your option) any later version. 18 | 19 | This library is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | Library General Public License for more details. 23 | 24 | You should have received a copy of the GNU Library General Public License 25 | along with this library; see the file COPYING.LIB. If not, write to 26 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 27 | Boston, MA 02110-1301, USA. 28 | */ 29 | 30 | 31 | #include "kptyprocess.h" 32 | #include "kprocess.h" 33 | #include "kptydevice.h" 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | KPtyProcess::KPtyProcess(QObject *parent) : 41 | KPtyProcess(-1, parent) 42 | { 43 | } 44 | 45 | KPtyProcess::KPtyProcess(int ptyMasterFd, QObject *parent) : 46 | KProcess(parent), 47 | d_ptr(new KPtyProcessPrivate) 48 | { 49 | Q_D(KPtyProcess); 50 | 51 | setChildProcessModifier([d]() { 52 | d->pty->setCTty(); 53 | #if 0 54 | if (d->addUtmp) { 55 | d->pty->login(KUser(KUser::UseRealUserID).loginName().toLocal8Bit().constData(), qgetenv("DISPLAY").constData()); 56 | } 57 | #endif 58 | if (d->ptyChannels & StdinChannel) { 59 | dup2(d->pty->slaveFd(), 0); 60 | } 61 | if (d->ptyChannels & StdoutChannel) { 62 | dup2(d->pty->slaveFd(), 1); 63 | } 64 | if (d->ptyChannels & StderrChannel) { 65 | dup2(d->pty->slaveFd(), 2); 66 | } 67 | }); 68 | 69 | d->pty = std::make_unique(this); 70 | 71 | if (ptyMasterFd == -1) { 72 | d->pty->open(); 73 | } else { 74 | d->pty->open(ptyMasterFd); 75 | } 76 | 77 | connect(this, &QProcess::stateChanged, this, [this](QProcess::ProcessState state) { 78 | if (state == QProcess::NotRunning && d_ptr->addUtmp) { 79 | d_ptr->pty->logout(); 80 | } 81 | }); 82 | } 83 | 84 | KPtyProcess::~KPtyProcess() 85 | { 86 | Q_D(KPtyProcess); 87 | 88 | if (state() != QProcess::NotRunning && d->addUtmp) 89 | { 90 | d->pty->logout(); 91 | disconnect(this, &QProcess::stateChanged, this, nullptr); 92 | } 93 | } 94 | 95 | void KPtyProcess::setPtyChannels(PtyChannels channels) 96 | { 97 | Q_D(KPtyProcess); 98 | 99 | d->ptyChannels = channels; 100 | } 101 | 102 | KPtyProcess::PtyChannels KPtyProcess::ptyChannels() const 103 | { 104 | Q_D(const KPtyProcess); 105 | 106 | return d->ptyChannels; 107 | } 108 | 109 | void KPtyProcess::setUseUtmp(bool value) 110 | { 111 | Q_D(KPtyProcess); 112 | 113 | d->addUtmp = value; 114 | } 115 | 116 | bool KPtyProcess::isUseUtmp() const 117 | { 118 | Q_D(const KPtyProcess); 119 | 120 | return d->addUtmp; 121 | } 122 | 123 | KPtyDevice *KPtyProcess::pty() const 124 | { 125 | Q_D(const KPtyProcess); 126 | 127 | return d->pty.get(); 128 | } 129 | 130 | //#include "kptyprocess.moc" 131 | -------------------------------------------------------------------------------- /lib/kptyprocess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of QTerminal - http://gitorious.org/qterminal 3 | * 4 | * This file was un-linked from KDE and modified 5 | * by Maxim Bourmistrov 6 | * 7 | */ 8 | 9 | /* 10 | This file is part of the KDE libraries 11 | 12 | Copyright (C) 2007 Oswald Buddenhagen 13 | 14 | This library is free software; you can redistribute it and/or 15 | modify it under the terms of the GNU Library General Public 16 | License as published by the Free Software Foundation; either 17 | version 2 of the License, or (at your option) any later version. 18 | 19 | This library is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | Library General Public License for more details. 23 | 24 | You should have received a copy of the GNU Library General Public License 25 | along with this library; see the file COPYING.LIB. If not, write to 26 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 27 | Boston, MA 02110-1301, USA. 28 | */ 29 | 30 | #ifndef KPTYPROCESS_H 31 | #define KPTYPROCESS_H 32 | 33 | #include "kprocess.h" 34 | #include "kptydevice.h" 35 | 36 | #include 37 | #include 38 | 39 | class KPtyDevice; 40 | 41 | class KPtyProcessPrivate; 42 | 43 | /** 44 | * This class extends KProcess by support for PTYs (pseudo TTYs). 45 | * 46 | * The PTY is opened as soon as the class is instantiated. Verify that 47 | * it was opened successfully by checking that pty()->masterFd() is not -1. 48 | * 49 | * The PTY is always made the process' controlling TTY. 50 | * Utmp registration and connecting the stdio handles to the PTY are optional. 51 | * 52 | * No attempt to integrate with QProcess' waitFor*() functions was made, 53 | * for it is impossible. Note that execute() does not work with the PTY, too. 54 | * Use the PTY device's waitFor*() functions or use it asynchronously. 55 | * 56 | * @author Oswald Buddenhagen 57 | */ 58 | class KPtyProcess : public KProcess 59 | { 60 | Q_OBJECT 61 | Q_DECLARE_PRIVATE(KPtyProcess) 62 | 63 | public: 64 | enum PtyChannelFlag { 65 | NoChannels = 0, /**< The PTY is not connected to any channel. */ 66 | StdinChannel = 1, /**< Connect PTY to stdin. */ 67 | StdoutChannel = 2, /**< Connect PTY to stdout. */ 68 | StderrChannel = 4, /**< Connect PTY to stderr. */ 69 | AllOutputChannels = 6, /**< Connect PTY to all output channels. */ 70 | AllChannels = 7 /**< Connect PTY to all channels. */ 71 | }; 72 | 73 | Q_DECLARE_FLAGS(PtyChannels, PtyChannelFlag) 74 | 75 | /** 76 | * Constructor 77 | */ 78 | explicit KPtyProcess(QObject *parent = nullptr); 79 | 80 | /** 81 | * Construct a process using an open pty master. 82 | * 83 | * @param ptyMasterFd an open pty master file descriptor. 84 | * The process does not take ownership of the descriptor; 85 | * it will not be automatically closed at any point. 86 | */ 87 | KPtyProcess(int ptyMasterFd, QObject *parent = nullptr); 88 | 89 | /** 90 | * Destructor 91 | */ 92 | ~KPtyProcess() override; 93 | 94 | /** 95 | * Set to which channels the PTY should be assigned. 96 | * 97 | * This function must be called before starting the process. 98 | * 99 | * @param channels the output channel handling mode 100 | */ 101 | void setPtyChannels(PtyChannels channels); 102 | 103 | bool isRunning() const 104 | { 105 | bool rval; 106 | (processId() > 0) ? rval= true : rval= false; 107 | return rval; 108 | 109 | } 110 | /** 111 | * Query to which channels the PTY is assigned. 112 | * 113 | * @return the output channel handling mode 114 | */ 115 | PtyChannels ptyChannels() const; 116 | 117 | /** 118 | * Set whether to register the process as a TTY login in utmp. 119 | * 120 | * Utmp is disabled by default. 121 | * It should enabled for interactively fed processes, like terminal 122 | * emulations. 123 | * 124 | * This function must be called before starting the process. 125 | * 126 | * @param value whether to register in utmp. 127 | */ 128 | void setUseUtmp(bool value); 129 | 130 | /** 131 | * Get whether to register the process as a TTY login in utmp. 132 | * 133 | * @return whether to register in utmp 134 | */ 135 | bool isUseUtmp() const; 136 | 137 | /** 138 | * Get the PTY device of this process. 139 | * 140 | * @return the PTY device 141 | */ 142 | KPtyDevice *pty() const; 143 | 144 | protected: 145 | 146 | private: 147 | std::unique_ptr const d_ptr; 148 | }; 149 | 150 | 151 | ////////////////// 152 | // private data // 153 | ////////////////// 154 | 155 | class KPtyProcessPrivate { 156 | public: 157 | KPtyProcessPrivate() 158 | { 159 | } 160 | 161 | std::unique_ptr pty; 162 | KPtyProcess::PtyChannels ptyChannels = KPtyProcess::NoChannels; 163 | bool addUtmp = false; 164 | }; 165 | 166 | Q_DECLARE_OPERATORS_FOR_FLAGS(KPtyProcess::PtyChannels) 167 | 168 | #endif 169 | -------------------------------------------------------------------------------- /lib/qtermwidget.json: -------------------------------------------------------------------------------- 1 | { 2 | "Name" : "QTermWidget", 3 | "Version" : "2.2.0", 4 | "Vendor" : "LXQt", 5 | "Copyright" : "(C) 2022-2025 LXQt", 6 | "Url" : "https://github.com/lxqt/qtermwidget", 7 | "License" : "GPLv2" 8 | } 9 | -------------------------------------------------------------------------------- /lib/qtermwidget_interface.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2022 Francesc Martinez (info@francescmm.com) 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | class QKeyEvent; 24 | class QAction; 25 | 26 | class QTermWidgetInterface { 27 | public: 28 | /** 29 | * This enum describes the location where the scroll bar is positioned in the display widget. 30 | */ 31 | enum ScrollBarPosition { 32 | /** Do not show the scroll bar. */ 33 | NoScrollBar = 0, 34 | /** Show the scroll bar on the left side of the display. */ 35 | ScrollBarLeft = 1, 36 | /** Show the scroll bar on the right side of the display. */ 37 | ScrollBarRight = 2 38 | }; 39 | 40 | virtual ~QTermWidgetInterface() = default; 41 | 42 | virtual void setTerminalSizeHint(bool enabled) = 0; 43 | virtual bool terminalSizeHint() = 0; 44 | virtual void startShellProgram() = 0; 45 | virtual void startTerminalTeletype() = 0; 46 | virtual int getShellPID() = 0; 47 | virtual int getForegroundProcessId() = 0; 48 | virtual void changeDir(const QString & dir) = 0; 49 | virtual void setTerminalFont(const QFont & font) = 0; 50 | virtual QFont getTerminalFont() = 0; 51 | virtual void setTerminalOpacity(qreal level) = 0; 52 | virtual void setTerminalBackgroundImage(const QString& backgroundImage) = 0; 53 | virtual void setTerminalBackgroundMode(int mode) = 0; 54 | virtual void setEnvironment(const QStringList & environment) = 0; 55 | virtual void setShellProgram(const QString & program) = 0; 56 | virtual void setWorkingDirectory(const QString & dir) = 0; 57 | virtual QString workingDirectory() = 0; 58 | virtual void setArgs(const QStringList & args) = 0; 59 | virtual void setColorScheme(const QString & name) = 0; 60 | virtual QStringList getAvailableColorSchemes() = 0; 61 | virtual void setHistorySize(int lines) = 0; 62 | virtual int historySize() const = 0; 63 | virtual void setScrollBarPosition(ScrollBarPosition) = 0; 64 | virtual void scrollToEnd() = 0; 65 | virtual void sendText(const QString & text) = 0; 66 | virtual void sendKeyEvent(QKeyEvent* e) = 0; 67 | virtual void setFlowControlEnabled(bool enabled) = 0; 68 | virtual bool flowControlEnabled(void) = 0; 69 | virtual void setFlowControlWarningEnabled(bool enabled) = 0; 70 | virtual QString keyBindings() = 0; 71 | virtual void setMotionAfterPasting(int) = 0; 72 | virtual int historyLinesCount() = 0; 73 | virtual int screenColumnsCount() = 0; 74 | virtual int screenLinesCount() = 0; 75 | virtual void setSelectionStart(int row, int column) = 0; 76 | virtual void setSelectionEnd(int row, int column) = 0; 77 | virtual void getSelectionStart(int& row, int& column) = 0; 78 | virtual void getSelectionEnd(int& row, int& column) = 0; 79 | virtual QString selectedText(bool preserveLineBreaks = true) = 0; 80 | virtual void setMonitorActivity(bool) = 0; 81 | virtual void setMonitorSilence(bool) = 0; 82 | virtual void setSilenceTimeout(int seconds) = 0; 83 | virtual QList filterActions(const QPoint& position) = 0; 84 | virtual int getPtySlaveFd() const = 0; 85 | virtual void setBlinkingCursor(bool blink) = 0; 86 | virtual void setBidiEnabled(bool enabled) = 0; 87 | virtual bool isBidiEnabled() = 0; 88 | virtual void setAutoClose(bool) = 0; 89 | virtual QString title() const = 0; 90 | virtual QString icon() const = 0; 91 | virtual bool isTitleChanged() const = 0; 92 | virtual void bracketText(QString& text) = 0; 93 | virtual void disableBracketedPasteMode(bool disable) = 0; 94 | virtual bool bracketedPasteModeIsDisabled() const = 0; 95 | virtual void setMargin(int) = 0; 96 | virtual int getMargin() const = 0; 97 | virtual void setDrawLineChars(bool drawLineChars) = 0; 98 | virtual void setBoldIntense(bool boldIntense) = 0; 99 | virtual void setConfirmMultilinePaste(bool confirmMultilinePaste) = 0; 100 | virtual void setTrimPastedTrailingNewlines(bool trimPastedTrailingNewlines) = 0; 101 | virtual QString wordCharacters() const = 0; 102 | virtual void setWordCharacters(const QString& chars) = 0; 103 | virtual QTermWidgetInterface* createWidget(int startnow) const = 0; 104 | virtual void autoHideMouseAfter(int delay) = 0; 105 | }; 106 | 107 | #define QTermWidgetInterface_iid "lxqt.qtermwidget.QTermWidgetInterface/1.5" 108 | 109 | Q_DECLARE_INTERFACE(QTermWidgetInterface, QTermWidgetInterface_iid) 110 | -------------------------------------------------------------------------------- /lib/qtermwidget_version.h.in: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2020 Axel Kittenberger (axel.kittenberger@univie.ac.at) 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef _Q_TERM_WIDGET_VERSION 21 | #define _Q_TERM_WIDGET_VERSION 22 | 23 | #include 24 | #define QTERMWIDGET_VERSION_MAJOR @QTERMWIDGET_VERSION_MAJOR@ 25 | #define QTERMWIDGET_VERSION_MINOR @QTERMWIDGET_VERSION_MINOR@ 26 | #define QTERMWIDGET_VERSION_PATCH @QTERMWIDGET_VERSION_PATCH@ 27 | #define QTERMWIDGET_VERSION QT_VERSION_CHECK(\ 28 | QTERMWIDGET_VERSION_MAJOR,\ 29 | QTERMWIDGET_VERSION_MINOR,\ 30 | QTERMWIDGET_VERSION_PATCH) 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /lib/tools.cpp: -------------------------------------------------------------------------------- 1 | #include "tools.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | Q_LOGGING_CATEGORY(qtermwidgetLogger, "qtermwidget", QtWarningMsg) 9 | 10 | /*! Helper function to get possible location of layout files. 11 | By default the KB_LAYOUT_DIR is used (linux/BSD/macports). 12 | But in some cases (apple bundle) there can be more locations). 13 | */ 14 | QString get_kb_layout_dir() 15 | { 16 | // qDebug() << __FILE__ << __FUNCTION__; 17 | 18 | QString rval = QString(); 19 | QString k(QLatin1String(KB_LAYOUT_DIR)); 20 | QDir d(k); 21 | 22 | //qDebug() << "default KB_LAYOUT_DIR: " << k; 23 | 24 | if (d.exists()) 25 | { 26 | rval = k.append(QLatin1Char('/')); 27 | return rval; 28 | } 29 | 30 | #ifdef Q_OS_MAC 31 | // subdir in the app location 32 | d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/kb-layouts/")); 33 | //qDebug() << d.path(); 34 | if (d.exists()) 35 | return QCoreApplication::applicationDirPath() + QLatin1String("/kb-layouts/"); 36 | 37 | d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/kb-layouts/")); 38 | if (d.exists()) 39 | return QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/kb-layouts/"); 40 | #endif 41 | //qDebug() << "Cannot find KB_LAYOUT_DIR. Default:" << k; 42 | return QString(); 43 | } 44 | 45 | /*! Helper function to add custom location of color schemes. 46 | */ 47 | namespace { 48 | QStringList custom_color_schemes_dirs; 49 | } 50 | void add_custom_color_scheme_dir(const QString& custom_dir) 51 | { 52 | if (!custom_color_schemes_dirs.contains(custom_dir)) 53 | custom_color_schemes_dirs << custom_dir; 54 | } 55 | 56 | /*! Helper function to get possible locations of color schemes. 57 | By default the COLORSCHEMES_DIR is used (linux/BSD/macports). 58 | But in some cases (apple bundle) there can be more locations). 59 | */ 60 | const QStringList get_color_schemes_dirs() 61 | { 62 | // qDebug() << __FILE__ << __FUNCTION__; 63 | 64 | QStringList rval; 65 | QString k(QLatin1String(COLORSCHEMES_DIR)); 66 | QDir d(k); 67 | 68 | // qDebug() << "default COLORSCHEMES_DIR: " << k; 69 | 70 | if (d.exists()) 71 | rval << k.append(QLatin1Char('/')); 72 | 73 | #ifdef Q_OS_MAC 74 | // subdir in the app location 75 | d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/color-schemes/")); 76 | //qDebug() << d.path(); 77 | if (d.exists()) 78 | { 79 | if (!rval.isEmpty()) 80 | rval.clear(); 81 | rval << (QCoreApplication::applicationDirPath() + QLatin1String("/color-schemes/")); 82 | } 83 | d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/color-schemes/")); 84 | if (d.exists()) 85 | { 86 | if (!rval.isEmpty()) 87 | rval.clear(); 88 | rval << (QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/color-schemes/")); 89 | } 90 | #endif 91 | 92 | for (const QString& custom_dir : std::as_const(custom_color_schemes_dirs)) 93 | { 94 | d.setPath(custom_dir); 95 | if (d.exists()) 96 | rval << custom_dir; 97 | } 98 | #ifdef QT_DEBUG 99 | if(!rval.isEmpty()) { 100 | qDebug() << "Using color-schemes: " << rval; 101 | } else { 102 | qDebug() << "Cannot find color-schemes in any location!"; 103 | } 104 | #endif 105 | return rval; 106 | } 107 | -------------------------------------------------------------------------------- /lib/tools.h: -------------------------------------------------------------------------------- 1 | #ifndef TOOLS_H 2 | #define TOOLS_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | QString get_kb_layout_dir(); 9 | void add_custom_color_scheme_dir(const QString& custom_dir); 10 | const QStringList get_color_schemes_dirs(); 11 | 12 | Q_DECLARE_LOGGING_CATEGORY(qtermwidgetLogger) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /lib/translations/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(qtermwidget) 2 | 3 | build_component("." "${CMAKE_INSTALL_FULL_DATADIR}/qtermwidget/translations") 4 | -------------------------------------------------------------------------------- /lib/translations/qtermwidget.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Konsole::Session 6 | 7 | 8 | Bell in session '%1' 9 | 10 | 11 | 12 | 13 | Session '%1' exited with code %2. 14 | 15 | 16 | 17 | 18 | Session '%1' crashed. 19 | 20 | 21 | 22 | 23 | Session '%1' exited unexpectedly. 24 | 25 | 26 | 27 | 28 | Konsole::TerminalDisplay 29 | 30 | 31 | Size: XXX x XXX 32 | 33 | 34 | 35 | 36 | Size: %1 x %2 37 | 38 | 39 | 40 | 41 | Paste multiline text 42 | 43 | 44 | 45 | 46 | Are you sure you want to paste this text? 47 | 48 | 49 | 50 | 51 | <qt>Output has been <a href="http://en.wikipedia.org/wiki/Flow_control">suspended</a> by pressing Ctrl+S. Press <b>Ctrl+Q</b> to resume.</qt> 52 | 53 | 54 | 55 | 56 | Konsole::Vt102Emulation 57 | 58 | 59 | No keyboard translator available. The information needed to convert key presses into characters to send to the terminal is missing. 60 | 61 | 62 | 63 | 64 | QMessageBox 65 | 66 | 67 | Show Details... 68 | 69 | 70 | 71 | 72 | QObject 73 | 74 | 75 | 76 | Un-named Color Scheme 77 | 78 | 79 | 80 | 81 | Accessible Color Scheme 82 | 83 | 84 | 85 | 86 | Open Link 87 | 88 | 89 | 90 | 91 | Copy Link Address 92 | 93 | 94 | 95 | 96 | Send Email To... 97 | 98 | 99 | 100 | 101 | Copy Email Address 102 | 103 | 104 | 105 | 106 | QTermWidget 107 | 108 | 109 | Color Scheme Error 110 | 111 | 112 | 113 | 114 | Cannot load color scheme: %1 115 | 116 | 117 | 118 | 119 | SearchBar 120 | 121 | 122 | Match case 123 | 124 | 125 | 126 | 127 | Regular expression 128 | 129 | 130 | 131 | 132 | Highlight all matches 133 | 134 | 135 | 136 | 137 | SearchBar 138 | 139 | 140 | 141 | 142 | X 143 | 144 | 145 | 146 | 147 | Find: 148 | 149 | 150 | 151 | 152 | < 153 | 154 | 155 | 156 | 157 | > 158 | 159 | 160 | 161 | 162 | ... 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /lib/translations/qtermwidget_cy.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Konsole::Session 6 | 7 | 8 | Bell in session '%1' 9 | 10 | 11 | 12 | 13 | Session '%1' exited with code %2. 14 | 15 | 16 | 17 | 18 | Session '%1' crashed. 19 | 20 | 21 | 22 | 23 | Session '%1' exited unexpectedly. 24 | 25 | 26 | 27 | 28 | Konsole::TerminalDisplay 29 | 30 | 31 | Size: XXX x XXX 32 | 33 | 34 | 35 | 36 | Size: %1 x %2 37 | 38 | 39 | 40 | 41 | Paste multiline text 42 | 43 | 44 | 45 | 46 | Are you sure you want to paste this text? 47 | 48 | 49 | 50 | 51 | <qt>Output has been <a href="http://en.wikipedia.org/wiki/Flow_control">suspended</a> by pressing Ctrl+S. Press <b>Ctrl+Q</b> to resume.</qt> 52 | 53 | 54 | 55 | 56 | Konsole::Vt102Emulation 57 | 58 | 59 | No keyboard translator available. The information needed to convert key presses into characters to send to the terminal is missing. 60 | 61 | 62 | 63 | 64 | QMessageBox 65 | 66 | 67 | Show Details... 68 | 69 | 70 | 71 | 72 | QObject 73 | 74 | 75 | 76 | Un-named Color Scheme 77 | 78 | 79 | 80 | 81 | Accessible Color Scheme 82 | 83 | 84 | 85 | 86 | Open Link 87 | 88 | 89 | 90 | 91 | Copy Link Address 92 | 93 | 94 | 95 | 96 | Send Email To... 97 | 98 | 99 | 100 | 101 | Copy Email Address 102 | 103 | 104 | 105 | 106 | QTermWidget 107 | 108 | 109 | Color Scheme Error 110 | 111 | 112 | 113 | 114 | Cannot load color scheme: %1 115 | 116 | 117 | 118 | 119 | SearchBar 120 | 121 | 122 | Match case 123 | 124 | 125 | 126 | 127 | Regular expression 128 | 129 | 130 | 131 | 132 | Highlight all matches 133 | 134 | 135 | 136 | 137 | SearchBar 138 | 139 | 140 | 141 | 142 | X 143 | 144 | 145 | 146 | 147 | Find: 148 | 149 | 150 | 151 | 152 | < 153 | 154 | 155 | 156 | 157 | > 158 | 159 | 160 | 161 | 162 | ... 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /lib/translations/qtermwidget_kab.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Konsole::Session 6 | 7 | 8 | Bell in session '%1' 9 | 10 | 11 | 12 | 13 | Session '%1' exited with code %2. 14 | 15 | 16 | 17 | 18 | Session '%1' crashed. 19 | 20 | 21 | 22 | 23 | Session '%1' exited unexpectedly. 24 | 25 | 26 | 27 | 28 | Konsole::TerminalDisplay 29 | 30 | 31 | Size: XXX x XXX 32 | 33 | 34 | 35 | 36 | Size: %1 x %2 37 | 38 | 39 | 40 | 41 | Paste multiline text 42 | 43 | 44 | 45 | 46 | Are you sure you want to paste this text? 47 | 48 | 49 | 50 | 51 | <qt>Output has been <a href="http://en.wikipedia.org/wiki/Flow_control">suspended</a> by pressing Ctrl+S. Press <b>Ctrl+Q</b> to resume.</qt> 52 | 53 | 54 | 55 | 56 | Konsole::Vt102Emulation 57 | 58 | 59 | No keyboard translator available. The information needed to convert key presses into characters to send to the terminal is missing. 60 | 61 | 62 | 63 | 64 | QMessageBox 65 | 66 | 67 | Show Details... 68 | 69 | 70 | 71 | 72 | QObject 73 | 74 | 75 | 76 | Un-named Color Scheme 77 | 78 | 79 | 80 | 81 | Accessible Color Scheme 82 | 83 | 84 | 85 | 86 | Open Link 87 | Ldi asaɣ 88 | 89 | 90 | 91 | Copy Link Address 92 | Nɣel tansa n wasaɣ 93 | 94 | 95 | 96 | Send Email To... 97 | 98 | 99 | 100 | 101 | Copy Email Address 102 | Nɣel tansa n yimayl 103 | 104 | 105 | 106 | QTermWidget 107 | 108 | 109 | Color Scheme Error 110 | 111 | 112 | 113 | 114 | Cannot load color scheme: %1 115 | 116 | 117 | 118 | 119 | SearchBar 120 | 121 | 122 | Match case 123 | 124 | 125 | 126 | 127 | Regular expression 128 | 129 | 130 | 131 | 132 | Highlight all matches 133 | 134 | 135 | 136 | 137 | SearchBar 138 | 139 | 140 | 141 | 142 | X 143 | X 144 | 145 | 146 | 147 | Find: 148 | Af-d: 149 | 150 | 151 | 152 | < 153 | < 154 | 155 | 156 | 157 | > 158 | > 159 | 160 | 161 | 162 | ... 163 | ... 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /lib/translations/qtermwidget_oc.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Konsole::Session 6 | 7 | 8 | Bell in session '%1' 9 | 10 | 11 | 12 | 13 | Session '%1' exited with code %2. 14 | 15 | 16 | 17 | 18 | Session '%1' crashed. 19 | 20 | 21 | 22 | 23 | Session '%1' exited unexpectedly. 24 | 25 | 26 | 27 | 28 | Konsole::TerminalDisplay 29 | 30 | 31 | Size: XXX x XXX 32 | Talha : XXX x XXX 33 | 34 | 35 | 36 | Size: %1 x %2 37 | Talha : %1 x %2 38 | 39 | 40 | 41 | Paste multiline text 42 | 43 | 44 | 45 | 46 | Are you sure you want to paste this text? 47 | 48 | 49 | 50 | 51 | <qt>Output has been <a href="http://en.wikipedia.org/wiki/Flow_control">suspended</a> by pressing Ctrl+S. Press <b>Ctrl+Q</b> to resume.</qt> 52 | 53 | 54 | 55 | 56 | Konsole::Vt102Emulation 57 | 58 | 59 | No keyboard translator available. The information needed to convert key presses into characters to send to the terminal is missing. 60 | 61 | 62 | 63 | 64 | QMessageBox 65 | 66 | 67 | Show Details... 68 | Veire los detalhs... 69 | 70 | 71 | 72 | QObject 73 | 74 | 75 | 76 | Un-named Color Scheme 77 | 78 | 79 | 80 | 81 | Accessible Color Scheme 82 | 83 | 84 | 85 | 86 | Open Link 87 | Dobrir lo ligam 88 | 89 | 90 | 91 | Copy Link Address 92 | Copiar l’adreça del ligam 93 | 94 | 95 | 96 | Send Email To... 97 | 98 | 99 | 100 | 101 | Copy Email Address 102 | 103 | 104 | 105 | 106 | QTermWidget 107 | 108 | 109 | Color Scheme Error 110 | 111 | 112 | 113 | 114 | Cannot load color scheme: %1 115 | 116 | 117 | 118 | 119 | SearchBar 120 | 121 | 122 | Match case 123 | 124 | 125 | 126 | 127 | Regular expression 128 | 129 | 130 | 131 | 132 | Highlight all matches 133 | 134 | 135 | 136 | 137 | SearchBar 138 | Barra de recèrca 139 | 140 | 141 | 142 | X 143 | X 144 | 145 | 146 | 147 | Find: 148 | Cercar : 149 | 150 | 151 | 152 | < 153 | < 154 | 155 | 156 | 157 | > 158 | > 159 | 160 | 161 | 162 | ... 163 | ... 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /lib/translations/qtermwidget_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Konsole::Session 6 | 7 | 8 | Bell in session '%1' 9 | 在会话中响铃 '%1' 10 | 11 | 12 | 13 | Session '%1' exited with code %2. 14 | 会话 '%1' 退出代码为 %2。 15 | 16 | 17 | 18 | Session '%1' crashed. 19 | 会话 '%1' 崩溃了。 20 | 21 | 22 | 23 | Session '%1' exited unexpectedly. 24 | 会话 '%1' 意外退出了。 25 | 26 | 27 | 28 | Konsole::TerminalDisplay 29 | 30 | 31 | Size: XXX x XXX 32 | 大小: XXX x XXX 33 | 34 | 35 | 36 | Size: %1 x %2 37 | 大小: %1 x %2 38 | 39 | 40 | 41 | Paste multiline text 42 | 粘帖多行文本 43 | 44 | 45 | 46 | Are you sure you want to paste this text? 47 | 确定你想要粘贴此文本? 48 | 49 | 50 | 51 | <qt>Output has been <a href="http://en.wikipedia.org/wiki/Flow_control">suspended</a> by pressing Ctrl+S. Press <b>Ctrl+Q</b> to resume.</qt> 52 | <qt>输出已被 Ctrl+S <a href="http://en.wikipedia.org/wiki/Flow_control">暂停</a>。按 <b>Ctrl+Q</b> 复原。</qt> 53 | 54 | 55 | 56 | Konsole::Vt102Emulation 57 | 58 | 59 | No keyboard translator available. The information needed to convert key presses into characters to send to the terminal is missing. 60 | 没有可用的键码转换表。找不到需要把按键转换至符号以传送至终端的信息。 61 | 62 | 63 | 64 | QMessageBox 65 | 66 | 67 | Show Details... 68 | 显示详情... 69 | 70 | 71 | 72 | QObject 73 | 74 | 75 | 76 | Un-named Color Scheme 77 | 未命名配色 78 | 79 | 80 | 81 | Accessible Color Scheme 82 | 可用配色 83 | 84 | 85 | 86 | Open Link 87 | 打开链接 88 | 89 | 90 | 91 | Copy Link Address 92 | 复制链接地址 93 | 94 | 95 | 96 | Send Email To... 97 | 发送邮件至... 98 | 99 | 100 | 101 | Copy Email Address 102 | 复制邮件地址 103 | 104 | 105 | 106 | QTermWidget 107 | 108 | 109 | Color Scheme Error 110 | 配色错误 111 | 112 | 113 | 114 | Cannot load color scheme: %1 115 | 无法加载配色: %1 116 | 117 | 118 | 119 | SearchBar 120 | 121 | 122 | Match case 123 | 匹配大小写 124 | 125 | 126 | 127 | Regular expression 128 | 正则表达式 129 | 130 | 131 | 132 | Highlight all matches 133 | 高亮所有匹配项 134 | 135 | 136 | 137 | SearchBar 138 | 搜索栏 139 | 140 | 141 | 142 | X 143 | 144 | 145 | 146 | 147 | Find: 148 | 寻找: 149 | 150 | 151 | 152 | < 153 | 154 | 155 | 156 | 157 | > 158 | 159 | 160 | 161 | 162 | ... 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /lib/translations/qtermwidget_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Konsole::Session 6 | 7 | 8 | Bell in session '%1' 9 | 在工作階段 '%1' 中的鈴聲 10 | 11 | 12 | 13 | Session '%1' exited with code %2. 14 | 工作階段 '%1' 已經退出,使用程式碼 '%2'。 15 | 16 | 17 | 18 | Session '%1' crashed. 19 | 工作階段 '%1' 已經崩潰。 20 | 21 | 22 | 23 | Session '%1' exited unexpectedly. 24 | 工作階段 '%1' 已經意外退出。 25 | 26 | 27 | 28 | Konsole::TerminalDisplay 29 | 30 | 31 | Size: XXX x XXX 32 | 大小: XXX x XXX 33 | 34 | 35 | 36 | Size: %1 x %2 37 | 大小: %1 x %2 38 | 39 | 40 | 41 | Paste multiline text 42 | 貼上多行文字 43 | 44 | 45 | 46 | Are you sure you want to paste this text? 47 | 確定要貼上這段文字嗎? 48 | 49 | 50 | 51 | <qt>Output has been <a href="http://en.wikipedia.org/wiki/Flow_control">suspended</a> by pressing Ctrl+S. Press <b>Ctrl+Q</b> to resume.</qt> 52 | <qt>按下 Ctrl+S 則輸出已經 <a href="http://en.wikipedia.org/wiki/Flow_control">暫停</a> 。 按下 <b>Ctrl+Q</b> 鍵重新繼續。</qt> 53 | 54 | 55 | 56 | Konsole::Vt102Emulation 57 | 58 | 59 | No keyboard translator available. The information needed to convert key presses into characters to send to the terminal is missing. 60 | 沒有可用的鍵碼轉換表。. 用來將按鍵轉換成終端機字元的資訊遺失。 61 | 62 | 63 | 64 | QMessageBox 65 | 66 | 67 | Show Details... 68 | 顯示細節… 69 | 70 | 71 | 72 | QObject 73 | 74 | 75 | 76 | Un-named Color Scheme 77 | 尚未命名的配色方案 78 | 79 | 80 | 81 | Accessible Color Scheme 82 | 可以取用的配色方案 83 | 84 | 85 | 86 | Open Link 87 | 開啟連結 88 | 89 | 90 | 91 | Copy Link Address 92 | 複製連結網址 93 | 94 | 95 | 96 | Send Email To... 97 | 傳送電子郵件至… 98 | 99 | 100 | 101 | Copy Email Address 102 | 複製電子信箱位址 103 | 104 | 105 | 106 | QTermWidget 107 | 108 | 109 | Color Scheme Error 110 | 配色方案錯誤 111 | 112 | 113 | 114 | Cannot load color scheme: %1 115 | 無法載入配色方案: %1 116 | 117 | 118 | 119 | SearchBar 120 | 121 | 122 | Match case 123 | 符合大小寫 124 | 125 | 126 | 127 | Regular expression 128 | 正規表示式 129 | 130 | 131 | 132 | Highlight all matches 133 | 強調顯示全部相符的項目 134 | 135 | 136 | 137 | SearchBar 138 | 搜尋列 139 | 140 | 141 | 142 | X 143 | X 144 | 145 | 146 | 147 | Find: 148 | 查尋: 149 | 150 | 151 | 152 | < 153 | < 154 | 155 | 156 | 157 | > 158 | > 159 | 160 | 161 | 162 | ... 163 | ... 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /pyqt/project.py: -------------------------------------------------------------------------------- 1 | from pyqtbuild import PyQtBindings, PyQtProject 2 | 3 | class QTermWidget(PyQtProject): 4 | def __init__(self): 5 | super().__init__() 6 | self.bindings_factories = [QTermWidgetBindings] 7 | 8 | class QTermWidgetBindings(PyQtBindings): 9 | def __init__(self, project): 10 | super().__init__(project, name='QTermWidget', sip_file='qtermwidget.sip', qmake_QT=['widgets']) 11 | self._project = project 12 | 13 | def apply_user_defaults(self, tool): 14 | self.libraries.append('qtermwidget6') 15 | super().apply_user_defaults(tool) 16 | -------------------------------------------------------------------------------- /pyqt/pyproject.toml: -------------------------------------------------------------------------------- 1 | # https://www.riverbankcomputing.com/static/Docs/sip/index.html 2 | 3 | [build-system] 4 | requires = ["sip", "PyQt-builder"] 5 | build-backend = "sipbuild.api" 6 | 7 | [tool.sip.metadata] 8 | name = "QTermWidget" 9 | version = "2.2.0" 10 | requires-dist = ["PyQt6"] 11 | -------------------------------------------------------------------------------- /pyqt/sip/qtermwidget.sip: -------------------------------------------------------------------------------- 1 | %Module(name=QTermWidget, use_limited_api=True) 2 | 3 | %ModuleHeaderCode 4 | #pragma GCC visibility push(default) 5 | %End 6 | 7 | %Import QtGui/QtGuimod.sip 8 | %Import QtCore/QtCoremod.sip 9 | %Import QtWidgets/QtWidgetsmod.sip 10 | 11 | class QTermWidget : QWidget { 12 | 13 | %TypeHeaderCode 14 | #include 15 | %End 16 | 17 | public: 18 | enum ScrollBarPosition 19 | { 20 | NoScrollBar=0, 21 | ScrollBarLeft=1, 22 | ScrollBarRight=2 23 | }; 24 | 25 | enum class KeyboardCursorShape 26 | { 27 | BlockCursor=0, 28 | UnderlineCursor=1, 29 | IBeamCursor=2 30 | }; 31 | 32 | QTermWidget(int startnow = 1, QWidget *parent = 0); 33 | ~QTermWidget(); 34 | void startTerminalTeletype(); 35 | QSize sizeHint() const; 36 | void setTerminalSizeHint(bool on); 37 | bool terminalSizeHint(); 38 | void startShellProgram(); 39 | int getShellPID(); 40 | int getForegroundProcessId(); 41 | void changeDir(const QString & dir); 42 | void setTerminalFont(QFont &font); 43 | QFont getTerminalFont(); 44 | void setTerminalOpacity(qreal level); 45 | void setEnvironment(const QStringList & environment); 46 | void setShellProgram(const QString & progname); 47 | void setWorkingDirectory(const QString & dir); 48 | QString workingDirectory(); 49 | void setArgs(QStringList & args); 50 | void setColorScheme(const QString & name); 51 | QStringList getAvailableColorSchemes(); 52 | static QStringList availableColorSchemes(); 53 | static void addCustomColorSchemeDir(const QString& custom_dir); 54 | void setHistorySize(int lines); 55 | void setScrollBarPosition(ScrollBarPosition); 56 | void scrollToEnd(); 57 | void sendText(QString &text); 58 | void setFlowControlEnabled(bool enabled); 59 | bool flowControlEnabled(); 60 | void setFlowControlWarningEnabled(bool enabled); 61 | static QStringList availableKeyBindings(); 62 | QString keyBindings(); 63 | void setMotionAfterPasting(int); 64 | int historyLinesCount(); 65 | int screenColumnsCount(); 66 | void setSelectionStart(int row, int column); 67 | void setSelectionEnd(int row, int column); 68 | void getSelectionStart(int& row, int& column); 69 | void getSelectionEnd(int& row, int& column); 70 | QString selectedText(bool preserveLineBreaks = true); 71 | void setMonitorActivity(bool); 72 | void setMonitorSilence(bool); 73 | void setSilenceTimeout(int seconds); 74 | int getPtySlaveFd() const; 75 | void setKeyboardCursorShape(KeyboardCursorShape shape); 76 | void setAutoClose(bool); 77 | QString title() const; 78 | QString icon() const; 79 | signals: 80 | void finished(); 81 | void copyAvailable(bool); 82 | void termGetFocus(); 83 | void termLostFocus(); 84 | void termKeyPressed(QKeyEvent *); 85 | void urlActivated(const QUrl&, bool fromContextMenu); 86 | void bell(const QString& message); 87 | void activity(); 88 | void silence(); 89 | void sendData(const char *,int); 90 | void titleChanged(); 91 | void receivedData(const QString &text); 92 | void profileChanged(const QString & profile); 93 | public slots: 94 | void copyClipboard(); 95 | void pasteClipboard(); 96 | void pasteSelection(); 97 | void zoomIn(); 98 | void zoomOut(); 99 | void setSize(const QSize &); 100 | void setKeyBindings(const QString & kb); 101 | void clear(); 102 | void toggleShowSearchBar(); 103 | protected: 104 | virtual void resizeEvent(QResizeEvent *); 105 | protected slots: 106 | void sessionFinished(); 107 | void selectionChanged(bool textSelected); 108 | private: 109 | void search(bool forwards, bool next); 110 | void setZoom(int step); 111 | void init(int startnow); 112 | private slots: 113 | void find(); 114 | void findNext(); 115 | void findPrevious(); 116 | void matchFound(int startColumn, int startLine, int endColumn, int endLine); 117 | void noMatchFound(); 118 | }; 119 | -------------------------------------------------------------------------------- /qtermwidget.spec: -------------------------------------------------------------------------------- 1 | # norootforbuild 2 | 3 | %define libname libqtermwidget0 4 | 5 | Name: qtermwidget 6 | Summary: Qt4 terminal widget 7 | Version: 0.2.0 8 | Release: 1 9 | License: GPL 10 | Source: %{name}-%{version}.tar.bz2 11 | Group: Utility 12 | URL: https://github.com/qterminal 13 | Vendor: petr@yarpen.cz 14 | 15 | 16 | %if 0%{?fedora_version} 17 | %define breq qt4-devel 18 | %define pref %{buildroot}/usr 19 | %endif 20 | %if 0%{?mandriva_version} 21 | %define breq libqt4-devel 22 | %define pref %{buildroot}/usr 23 | %endif 24 | %if 0%{?suse_version} 25 | %define breq libqt4-devel 26 | %define pref %{_prefix} 27 | %endif 28 | 29 | 30 | BuildRequires: gcc-c++, %{breq}, cmake 31 | BuildRoot: %{_tmppath}/%{name}-%{version}-build 32 | Prefix: %{_prefix} 33 | 34 | %description 35 | QTermWidget is an opensource project based on KDE4 Konsole application. The main goal of this project is to provide unicode-enabled, embeddable QT4 widget for using as a built-in console (or terminal emulation widget). 36 | Of course I`m aware about embedding abilities of original Konsole, but once I had Qt without KDE, and it was a serious problem. I decided not to rely on a chance. I could not find any interesting related project, so I had to write it. 37 | The original Konsole`s code was rewritten entirely with QT4 only; also I have to include in the project some parts of code from kde core library. All code dealing with user interface parts and session management was removed (maybe later I bring it back somehow), and the result is quite useful, I suppose. 38 | This library was compiled and tested on three linux systems, based on 2.4.32, 2.6.20, 2.6.23 kernels, x86 and amd64. There is also a sample application provided for quick start. 39 | 40 | %package -n %{libname} 41 | Summary: Qt4 terminal widget - base package 42 | Group: "Development/Libraries/C and C++" 43 | %description -n %{libname} 44 | QTermWidget is an opensource project based on KDE4 Konsole application. 45 | The main goal of this project is to provide unicode-enabled, embeddable 46 | QT4 widget for using as a built-in console (or terminal emulation widget). 47 | 48 | %package devel 49 | Summary: Qt4 terminal widget - development package 50 | Group: "Development/Libraries/C and C++" 51 | Requires: %{libname} 52 | %description devel 53 | Development package for QTermWidget. Contains headers and dev-libs. 54 | 55 | %prep 56 | %setup 57 | 58 | %build 59 | cmake \ 60 | -DCMAKE_C_FLAGS="%{optflags}" \ 61 | -DCMAKE_CXX_FLAGS="%{optflags}" \ 62 | -DCMAKE_BUILD_TYPE=Debug \ 63 | -DCMAKE_INSTALL_PREFIX=%{pref} \ 64 | %{_builddir}/%{name}-%{version} 65 | 66 | %{__make} %{?jobs:-j%jobs} 67 | 68 | 69 | %install 70 | %makeinstall 71 | 72 | 73 | %clean 74 | %{__rm} -rf %{buildroot} 75 | 76 | %post -n %{libname} 77 | ldconfig 78 | 79 | %postun -n %{libname} 80 | ldconfig 81 | 82 | %files -n %{libname} 83 | %defattr(-,root,root,-) 84 | %doc AUTHORS LICENSE Changelog INSTALL README 85 | %{_libdir}/lib%{name}.so.%{version} 86 | %{_datadir}/%{name} 87 | %{_datadir}/%{name}/* 88 | 89 | %files devel 90 | %defattr(-,root,root,-) 91 | %{_includedir}/*.h 92 | %{_libdir}/*.so 93 | %{_libdir}/*.so.0 94 | 95 | %changelog 96 | * Mon Oct 29 2010 Petr Vanek 0.2 97 | - version bump, cmake builds 98 | 99 | * Sat Jul 26 2008 TI_Eugene 0.100 100 | - Initial build 101 | --------------------------------------------------------------------------------