pax_global_header00006660000000000000000000000064146514723340014523gustar00rootroot0000000000000052 comment=a6eaf5086a473919ed2fffc5d3b8d98237c2dd41 plasma6-window-title-applet-0.9.0/000077500000000000000000000000001465147233400170035ustar00rootroot00000000000000plasma6-window-title-applet-0.9.0/.github/000077500000000000000000000000001465147233400203435ustar00rootroot00000000000000plasma6-window-title-applet-0.9.0/.github/FUNDING.yml000066400000000000000000000014631465147233400221640ustar00rootroot00000000000000# These are supported funding model platforms github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: dhruv8sh tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry polar: # Replace with a single Polar username custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] plasma6-window-title-applet-0.9.0/LICENSE000066400000000000000000000432541465147233400200200ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. plasma6-window-title-applet-0.9.0/README.md000066400000000000000000000032121465147233400202600ustar00rootroot00000000000000# Window Title Applet A Plasma 6 applet that builds on the work of [Psifidotos](https://github.com/psifidotos). ## Substitutions - %a : Application Name - %w : Windows Title - %q : Activity Name - ``..`` : Selective bold - ``..`` : Selective Italics - `
`/`

` : New line ([Text will not be elided with multi-line text](https://bugreports.qt.io/browse/QTBUG-16567)) ## Images

![](https://github.com/user-attachments/assets/96c6d653-89a1-491b-b458-eb9aff219ea5)
Plasmoid with Firefox web browser open

![](https://github.com/user-attachments/assets/b6383c39-38bb-424d-8f10-b3144d72b889)
Plasmoid with multi-line title

![](https://github.com/dhruv8sh/plasma6-window-title-applet/assets/67322047/52c59b33-b278-469c-9111-9ba0a0b2ae4f)
Example of placeholder text and icon

![](https://github.com/user-attachments/assets/e79649bc-0011-4530-b482-e5cfb51e03d2)
Appearance Settings

![Screenshot_20240728_192316](https://github.com/user-attachments/assets/d7dd90f1-1164-4665-982b-48785185b6e8)
Behavior Settings

![Screenshot_20240728_192323](https://github.com/user-attachments/assets/38050897-c45d-4753-b78c-bca48ab1f13e)
Substitutions Settings

## Installation Either use "Add Widget functionality" or use ```plasmapkg2 -i ./``` when in the root directory of the applet or install it from the AUR [plasma6-applets-window-title](https://aur.archlinux.org/packages/plasma6-applets-window-title). plasma6-window-title-applet-0.9.0/contents/000077500000000000000000000000001465147233400206405ustar00rootroot00000000000000plasma6-window-title-applet-0.9.0/contents/config/000077500000000000000000000000001465147233400221055ustar00rootroot00000000000000plasma6-window-title-applet-0.9.0/contents/config/config.qml000066400000000000000000000010031465147233400240570ustar00rootroot00000000000000 import QtQuick import org.kde.plasma.configuration ConfigModel { ConfigCategory { name: i18n("Appearance") icon: "preferences-desktop-display-color" source: "config/ConfigAppearance.qml" } ConfigCategory { name: i18n("Behavior") icon: "preferences-desktop" source: "config/ConfigBehavior.qml" } ConfigCategory { name: i18n("Substitutions") icon: "edit-find-replace" source: "config/ConfigSubstitutions.qml" } } plasma6-window-title-applet-0.9.0/contents/config/main.xml000066400000000000000000000055741465147233400235660ustar00rootroot00000000000000 0 0 0 0 12 24 400 24 3 %a - %w %q %a kde-symbolic false false false true false false true false false true true true true "Telegram Desktop","Gimp-.*","soffice.bin","Spotify.*","Kate.*" ".*",".*",".*",".*",".*" "Telegram","Gimp","LibreOffice","Spotify","Kate : %w" plasma6-window-title-applet-0.9.0/contents/tools/000077500000000000000000000000001465147233400220005ustar00rootroot00000000000000plasma6-window-title-applet-0.9.0/contents/tools/Tools.js000066400000000000000000000033001465147233400234320ustar00rootroot00000000000000function clean(item) { if (item.length>=2 && item.indexOf('"')===0 && item.lastIndexOf('"')===item.length-1) return item.substring(1, item.length-1); else return item; } function match(pat,str){ let rgx = new RegExp(clean(pat)) return rgx.test(str) } function sub(str){ return str .replace("%a",activeTaskItem?.appName??"") .replace("%w",activeTaskItem?.title??"") .replace("%q",fullActivityInfo?.name??"") } function substitute() { let minSize = Math.min(cfg.subsMatchApp.length, cfg.subsReplace.length,cfg.subsMatchTitle.length) let appName=activeTaskItem.appName, title=activeTaskItem.title let text= appName === title ? cfg.txtSameFound : cfg.txt for(let i=0; i=0 && wheel.angleDelta.x>=0) delta = Math.max(wheel.angleDelta.y, wheel.angleDelta.x) / 8; else delta = Math.min(wheel.angleDelta.y, wheel.angleDelta.x) / 8; var ctrlPressed = (wheel.modifiers & Qt.ControlModifier); if (delta>10) { if (!ctrlPressed) windowInfoLoader.item.activateNextPrevTask(true); else if (windowInfoLoader.item.activeTaskItem && !windowInfoLoader.item.activeTaskItem.isMaximized) windowInfoLoader.item.toggleMaximized(); } else if (delta<-10) { if (!ctrlPressed) { if (windowInfoLoader.item.activeTaskItem && !windowInfoLoader.item.activeTaskItem.isMinimized && windowInfoLoader.item.activeTaskItem.isMaximized) // Maximized windowInfoLoader.item.activeTaskItem.toggleMaximized(); else if (windowInfoLoader.item.activeTaskItem && !windowInfoLoader.item.activeTaskItem.isMinimized && !windowInfoLoader.item.activeTaskItem.isMaximized) // UnMaximized windowInfoLoader.item.activeTaskItem.toggleMinimized(); } else if (windowInfoLoader.item.activeTaskItem && windowInfoLoader.item.activeTaskItem.isMaximized) windowInfoLoader.item.activeTaskItem.toggleMaximized(); } } // To open overview Plasma5Support.DataSource { id: executable engine: "executable" connectedSources: [] onNewData: (source, data) => { disconnectSource(source) } function exec(cmd) { executable.connectSource(cmd) } } // To optimize scrolling for touchpads Timer{ id: scrollDelayer interval: 200 onTriggered: actionsArea.wheelIsBlocked = false; } } plasma6-window-title-applet-0.9.0/contents/ui/CItem.qml000066400000000000000000000007371465147233400230000ustar00rootroot00000000000000import QtQuick import QtQuick.Layouts //Custom item to make the code look cleaner Item { required property real length Layout.minimumWidth: isVertical?root.width :length Layout.maximumWidth: isVertical?root.width :length Layout.minimumHeight:!isVertical?root.height:length Layout.maximumHeight:!isVertical?root.height:length /*Rectangle{ color: "green" anchors.fill: parent border.color: "red" border.width: 1 }*/ } plasma6-window-title-applet-0.9.0/contents/ui/PlasmaTasksModel.qml000066400000000000000000000162611465147233400252020ustar00rootroot00000000000000import QtQuick import QtQml.Models import org.kde.taskmanager as TaskManager Item { id: plasmaTasksItem readonly property bool existsWindowActive: root.activeTaskItem && tasksRepeater.count > 0 && activeTaskItem.isActive property Item activeTaskItem: null TaskManager.TasksModel { id: tasksModel sortMode: TaskManager.TasksModel.SortVirtualDesktop groupMode: TaskManager.TasksModel.GroupDisabled screenGeometry: root.screenGeometry activity: activityInfo.currentActivity virtualDesktop: virtualDesktopInfo.currentDesktop filterByScreen: plasmoid.configuration.filterByScreen filterByVirtualDesktop: true filterByActivity: true } Item{ id: taskList Repeater{ id: tasksRepeater model: tasksModel Item{ id: task readonly property string appName: modelAppName !== "" ? modelAppName : discoveredAppName readonly property bool isMinimized: IsMinimized === true ? true : false readonly property bool isMaximized: IsMaximized === true ? true : false readonly property bool isActive: IsActive === true ? true : false readonly property bool isOnAllDesktops: IsOnAllVirtualDesktops === true ? true : false property var icon: decoration readonly property string modelAppName: AppName readonly property string modelDisplay: display property string title: "" property string discoveredAppName: "" readonly property var m: model function cleanupTitle() { var text = display; var t = modelDisplay; var sep = t.lastIndexOf(" —– "); var spacer = 4; if (sep === -1) { sep = t.lastIndexOf(" -- "); spacer = 4; } if (sep === -1) { sep = t.lastIndexOf(" -- "); spacer = 4; } if (sep === -1) { sep = t.lastIndexOf(" — "); spacer = 3; } if (sep === -1) { sep = t.lastIndexOf(" - "); spacer = 3; } var dTitle = ""; var dAppName = ""; if (sep>-1) { dTitle = text.substring(0, sep); discoveredAppName = text.substring(sep+spacer, text.length); //if title starts with application name, swap the found records if (dTitle.startsWith(modelAppName)) { var firstPart = dTitle; dTitle = discoveredAppName; discoveredAppName = firstPart; } } if (sep>-1) { title = dTitle; } else { title = t; } } onIsActiveChanged: { if (isActive) { if(plasmoid.configuration.showOnlyOnMaximize && !task.isMaximized) plasmaTasksItem.activeTaskItem = null; else plasmaTasksItem.activeTaskItem = task; } } onIsMaximizedChanged: { if(plasmoid.configuration.showOnlyOnMaximize && isActive) plasmaTasksItem.activeTaskItem = task.isMaximized ? task : null; } onModelAppNameChanged: task.cleanupTitle() onModelDisplayChanged: task.cleanupTitle() Component.onCompleted: task.cleanupTitle() Component.onDestruction: { if (plasmaTasksItem.lastActiveTaskItem === task) { plasmaTasksItem.lastActiveTaskItem = null; } } function modelIndex(){ return tasksModel.makeModelIndex(index); } function toggleMaximized() { tasksModel.requestToggleMaximized(modelIndex()); } function toggleMinimized() { tasksModel.requestToggleMinimized(modelIndex()); } function requestClose() { tasksModel.requestClose(modelIndex()); } function togglePinToAllDesktops() { if (root.plasma515) { tasksModel.requestVirtualDesktops(modelIndex(), 0); } else { tasksModel.requestVirtualDesktop(modelIndex(), 0); } } function toggleKeepAbove(){ tasksModel.requestToggleKeepAbove(modelIndex()); } } } } //! Functionality function toggleMaximized() { if (activeTaskItem) { activeTaskItem.toggleMaximized(); } } function toggleMinimized() { if (activeTaskItem) activeTaskItem.toggleMinimized(); } function requestClose() { if (activeTaskItem) activeTaskItem.requestClose(); } function togglePinToAllDesktops() { if (activeTaskItem) { activeTaskItem.togglePinToAllDesktops(); } } function toggleKeepAbove(){ if (activeTaskItem) { activeTaskItem.toggleKeepAbove(); } } //! Cycle Through Tasks function activateNextPrevTask(next) { var taskIndexList = []; var activeTaskIndex = tasksModel.activeTask; for (var i = 0; i < taskList.children.length - 1; ++i) { var task = taskList.children[i]; var modelIndex = task.modelIndex(i); if (task.m.IsLauncher !== true && task.m.IsStartup !== true) { if (task.m.IsGroupParent === true) { for (var j = 0; j < tasksModel.rowCount(modelIndex); ++j) { taskIndexList.push(tasksModel.makeModelIndex(i, j)); } } else { taskIndexList.push(modelIndex); } } } if (!taskIndexList.length) { return; } var target = taskIndexList[0]; for (var i = 0; i < taskIndexList.length; ++i) { if (taskIndexList[i] === activeTaskIndex) { if (next && i < (taskIndexList.length - 1)) { target = taskIndexList[i + 1]; } else if (!next) { if (i) { target = taskIndexList[i - 1]; } else { target = taskIndexList[taskIndexList.length - 1]; } } break; } } tasksModel.requestActivate(target); } } plasma6-window-title-applet-0.9.0/contents/ui/Title.qml000066400000000000000000000060111465147233400230470ustar00rootroot00000000000000import QtQuick import QtQuick.Layouts import org.kde.kirigami as Kirigami import org.kde.plasma.components as PlasmaComponents import org.kde.plasma.core as PlasmaCore import "../tools/Tools.js" as Tools GridLayout { columns: isVertical?1:6 anchors.fill: parent rowSpacing: 0 columnSpacing: 0 Layout.maximumWidth: parent.width Layout.maximumHeight: parent.height //Calculated length for the label property real labelLen : { let neededInViewLen = cfg.firstSpace+cfg.midSpace+cfg.lastSpace+cfg.lastSpace neededInViewLen += isVertical?iconItem.height:iconItem.width return cfg.fixedLength-neededInViewLen } CItem {length: cfg.firstSpace} Item { id: iconItem Layout.minimumWidth : isVertical ? parent.width : height Layout.minimumHeight : isVertical ? width : parent.height Layout.maximumWidth : Layout.minimumWidth Layout.maximumHeight : Layout.minimumHeight visible : cfg.visible property int thickness: isVertical ? parent.width : parent.height Kirigami.Icon { anchors { fill : parent topMargin : !isVertical ? thickMargin : 0 bottomMargin : !isVertical ? thickMargin : 0 leftMargin : isVertical ? thickMargin : 0 rightMargin : isVertical ? thickMargin : 0 } source: root.icon readonly property int thickMargin: cfg.fillThickness ? 0 : (parent.thickness - iconSize) / 2 readonly property int iconSize : cfg.fillThickness ? parent.thickness : Math.min(parent.thickness, cfg.customSize) } } CItem {length: cfg.midSpace} CItem{ length : { if(cfg.lengthKind == 0) return label.implicitWidth else if(cfg.lengthKind == 1) return labelLen else return Math.min(label.implicitWidth,labelLen) } clip: true PlasmaComponents.Label { id : label verticalAlignment : Text.AlignVCenter text : root.text color : Kirigami.Theme.textColor elide : Tools.getElide(cfg.elidePos) width : { if(cfg.lengthKind == 0) return label.implicitWidth else if(cfg.lengthKind == 1) return labelLen else return Math.min(label.implicitWidth,labelLen) } rotation : isVertical?plasmoid.location===PlasmaCore.Types.LeftEdge?-90:90:0 anchors.centerIn : parent font { capitalization : cfg.isCaps ? Font.Capitalize : Font.MixedCase bold : cfg.isBold italic : cfg.isItalic pixelSize : cfg.fontSize } } } CItem {length:cfg.lastSpace} Item { Layout.fillWidth: true Layout.fillHeight: true } } plasma6-window-title-applet-0.9.0/contents/ui/config/000077500000000000000000000000001465147233400225225ustar00rootroot00000000000000plasma6-window-title-applet-0.9.0/contents/ui/config/ConfigAppearance.qml000066400000000000000000000163321465147233400264270ustar00rootroot00000000000000import QtQuick import QtQuick.Controls import QtQuick.Layouts import org.kde.plasma.core as PlasmaCore import org.kde.kirigami as Kirigami import org.kde.plasma.components as PC3 import org.kde.iconthemes as KIconThemes import org.kde.ksvg as KSvg import "../../tools/Tools.js" as Tools Kirigami.ScrollablePage { id: root readonly property alias cfg_firstSpace: firstSpace.value readonly property alias cfg_midSpace: midSpace.value readonly property alias cfg_lastSpace: lastSpace.value readonly property alias cfg_txt: txt.text readonly property alias cfg_altTxt: altTxt.text readonly property alias cfg_isBold: boldChk.checked readonly property alias cfg_isItalic: italicChk.checked readonly property alias cfg_isCaps: capsChk.checked readonly property alias cfg_fontSize: fontSize.value readonly property alias cfg_visible: iconChk.checked readonly property alias cfg_lengthKind: lengthKind.currentIndex readonly property alias cfg_fixedLength: fixedLength.value readonly property alias cfg_fillThickness: fillThickness.checked readonly property alias cfg_noIcon: noIcon.checked readonly property alias cfg_activityIcon: activityIcon.checked readonly property alias cfg_customIcon: iconDialog.value readonly property alias cfg_txtSameFound: txtSameFound.text readonly property alias cfg_customSize: customSize.value readonly property alias cfg_elidePos: elidePos.currentIndex header : MockWidget{} Kirigami.FormLayout { Layout.fillWidth: true Kirigami.Separator { Kirigami.FormData.isSection: true Kirigami.FormData.label: "Text" } RowLayout { Kirigami.FormData.label: i18n("When title available:") PC3.TextField { id: txt } PC3.ToolButton { icon.name: "documentinfo" PC3.ToolTip{ text: i18n("This pattern will be shown when a window is active.

Substitutions:

%a - Application Name

%w - Window Title

%q - Activity Info

Use HTML tags for bold, italic and multi-line text") } } } RowLayout { Kirigami.FormData.label: i18n("When Application Name and Window Title are same:") PC3.TextField { id: txtSameFound } PC3.ToolButton { icon.name: "documentinfo" PC3.ToolTip{ text: i18n("To prevent results like:

Neovide - Neovide") } } } RowLayout{ Kirigami.FormData.label: i18n("When title unavailable:") PC3.TextField { id: altTxt text: "%q" } PC3.ToolButton { icon.name: "documentinfo" PC3.ToolTip{ text: i18n("This pattern will be shown when no window is active.

Substitutions:

%q - Activity Info

Use HTML tags for bold, italic and multi-line text") } } } RowLayout { Kirigami.FormData.label: i18n("Text Formatting:") PC3.SpinBox{ id: fontSize from: 8 to: 64 } PC3.ToolButton{ id: boldChk checkable: true icon.name: "format-text-bold" display: AbstractButton.IconOnly text: i18n("Bold") height: Kirigami.Units.smallSpacing PC3.ToolTip{ text: i18n("Bold") } } PC3.ToolButton{ id: italicChk checkable: true display: AbstractButton.IconOnly text: i18n("Italic") icon.name: "format-text-italic" height: Kirigami.Units.smallSpacing PC3.ToolTip{ text: i18n("Italic") } } PC3.ToolButton{ id: capsChk checkable: true icon.name: "format-text-capitalize" text: i18n("Capitalize") display: AbstractButton.IconOnly height: Kirigami.Units.smallSpacing PC3.ToolTip{ text: i18n("Capitalize First Letters") } } } PC3.ComboBox { id: elidePos Kirigami.FormData.label: i18n("Elide Position:") model: ["None","Left","Middle","Right"] visible: lengthKind.currentIndex > 0 } Kirigami.Separator { Kirigami.FormData.isSection: true Kirigami.FormData.label: "Icon" } PC3.CheckBox { id: iconChk Kirigami.FormData.label: i18n("Visible:") } RowLayout { Kirigami.FormData.label: i18n("Size:") RadioButton{ id: customThickness text: i18n("Custom Size") icon.name:"image-resize-symbolic" checked: !fillThickness.checked } RadioButton{ id: fillThickness text: i18n("Fill Thickness") icon.name: "panel-fit-height" } } PC3.SpinBox{ id: customSize from: 8 to: 50 enabled: customThickness.checked } RowLayout { Kirigami.FormData.label: i18n("Placeholder icon:") RadioButton{ id: customIcon text: i18n("Custom Icon") icon.name:"dialog-icon-preview" checked: !activityIcon.checked && !noIcon.checked } RadioButton{ id: activityIcon text: i18n("Activity Icon") icon.name: "activities" } RadioButton{ id: noIcon text: i18n("Preserve Space") icon.name: "edit-none" } } IconDialog{ id: iconDialog visible: customIcon.checked } Kirigami.Separator { Kirigami.FormData.isSection: true Kirigami.FormData.label: "Margins" } PC3.ComboBox { id:lengthKind Kirigami.FormData.label: i18n("Length:") model: ["Based on contents","Fixed Length","Maximum Length"] } RowLayout{ Kirigami.FormData.label: i18n("Custom length:") visible: lengthKind.currentIndex > 0 PC3.Slider{ id:fixedLength from: 24 to: 1500 stepSize:1 } PC3.Label{ text: fixedLength.value+" px." } } PC3.SpinBox { id: firstSpace Kirigami.FormData.label: i18n("Space before icon:") from: 0 to: 999 } PC3.SpinBox { id: midSpace Kirigami.FormData.label: i18n("Space between icon and text:") from: 0 to: 999 } PC3.SpinBox { id: lastSpace Kirigami.FormData.label: i18n("Space after text:") from: 0 to: 999 } } } plasma6-window-title-applet-0.9.0/contents/ui/config/ConfigBehavior.qml000066400000000000000000000033711465147233400261260ustar00rootroot00000000000000import QtQuick import QtQuick.Controls import QtQuick.Layouts import org.kde.plasma.core as PlasmaCore import org.kde.plasma.plasmoid import org.kde.plasma.components as PC3 import org.kde.kirigami as Kirigami Kirigami.ScrollablePage { readonly property alias cfg_filterByScreen: filterByScreenChk.checked readonly property alias cfg_filterByMaximized: filterByMaximizedChk.checked readonly property alias cfg_showTooltip: showTooltipChk.checked readonly property alias cfg_maxminAllowed: maxminAllowed.checked readonly property alias cfg_closeAllowed: closeAllowed.checked readonly property alias cfg_scrollAllowed: scrollAllowed.checked Kirigami.FormLayout { Kirigami.Separator { Kirigami.FormData.isSection: true Kirigami.FormData.label: "Info Filtering" } PC3.CheckBox{ id: filterByScreenChk Kirigami.FormData.label: i18n("Show only from current screen:") } PC3.CheckBox{ id: filterByMaximizedChk Kirigami.FormData.label: i18n("Show only when maximized:") } Kirigami.Separator { Kirigami.FormData.isSection: true Kirigami.FormData.label: "Gestures" } PC3.CheckBox{ id: showTooltipChk Kirigami.FormData.label: i18n("Show tooltip on hover:") } PC3.CheckBox{ id: maxminAllowed Kirigami.FormData.label: i18n("Double-Click to maximize/minimize:") } PC3.CheckBox{ id: closeAllowed Kirigami.FormData.label: i18n("Middle-Click to close:") } PC3.CheckBox{ id: scrollAllowed Kirigami.FormData.label: i18n("Scroll through tasks:") } } } plasma6-window-title-applet-0.9.0/contents/ui/config/ConfigSubstitutions.qml000066400000000000000000000032001465147233400272550ustar00rootroot00000000000000import QtQuick import QtQuick.Controls import QtQuick.Layouts import org.kde.plasma.core as PlasmaCore import org.kde.kirigami as Kirigami import org.kde.plasma.components as PC3 import org.kde.iconthemes as KIconThemes import org.kde.ksvg as KSvg Kirigami.ScrollablePage { id: subsPage function textAreaToList(text) { return text.split('\n') } function listToText(list) { return list.join('\n') } readonly property alias cfg_subsMatchApp : subsPage.nameMatches readonly property alias cfg_subsMatchTitle: subsPage.titleMatches readonly property alias cfg_subsReplace : subsPage.replacements property var nameMatches property var titleMatches property var replacements header:Kirigami.InlineMessage { Layout.fillWidth: true text: i18n("Length of lists is not equal") visible: !(nameMatches.length == titleMatches.length && titleMatches.length == replacements.length) type: Kirigami.MessageType.Warning } // TODO: Clean this, not the most elegant way to handle it! RowLayout{ SubsBox{ id: nameMatch heading: i18n("Application Name Match") subsAllowed: false list: nameMatches onListChanged: nameMatches = list } SubsBox{ id: titleMatch heading: i18n("Window Title Match") subsAllowed: false list: titleMatches onListChanged: titleMatches = list } SubsBox{ id: replace heading: i18n("Replacement") list: replacements onListChanged: replacements = list } } } plasma6-window-title-applet-0.9.0/contents/ui/config/IconDialog.qml000066400000000000000000000036521465147233400252530ustar00rootroot00000000000000import QtQuick import QtQuick.Controls import QtQuick.Layouts import org.kde.plasma.core as PlasmaCore import org.kde.kirigami as Kirigami import org.kde.plasma.components as PlasmaComponents import org.kde.iconthemes as KIconThemes import org.kde.ksvg as KSvg RowLayout { property alias value: placeHolderIcon.source Button { implicitWidth: previewFrame.width + Kirigami.Units.smallSpacing * 2 implicitHeight: previewFrame.height + Kirigami.Units.smallSpacing * 2 onPressed: iconMenu.opened ? iconMenu.close() : iconMenu.open() KIconThemes.IconDialog { id: iconDialog onIconNameChanged: value = iconName } KSvg.FrameSvgItem { id: previewFrame anchors.centerIn: parent imagePath: "widgets/panel-background" width: Kirigami.Units.iconSizes.large + fixedMargins.left + fixedMargins.right height: Kirigami.Units.iconSizes.large + fixedMargins.top + fixedMargins.bottom Kirigami.Icon { id: placeHolderIcon anchors.centerIn: parent width: Kirigami.Units.iconSizes.large height: width source: "kde-symbolic" } } Menu { id:iconMenu y: parent.height MenuItem { text: i18nc("@item:inmenu Open icon chooser dialog", "Choose…") icon.name: "document-open-folder" Accessible.description: i18nc("@info:whatsthis", "Choose an icon for Application Launcher") onClicked: iconDialog.open() } MenuItem { text: i18nc("@item:inmenu Reset icon to default", "Reset to default icon") icon.name: "kt-restore-defaults" onClicked: value = Tools.defaultIconName } } } PlasmaComponents.Label{ text:`"${value}"` } } plasma6-window-title-applet-0.9.0/contents/ui/config/MockWidget.qml000066400000000000000000000077371465147233400253100ustar00rootroot00000000000000import QtQuick import QtQuick.Controls import QtQuick.Layouts import org.kde.plasma.core as PlasmaCore import org.kde.kirigami as Kirigami import org.kde.plasma.components as PlasmaComponents import org.kde.iconthemes as KIconThemes import org.kde.ksvg as KSvg import org.kde.plasma.plasmoid as Plasmoid import "../../tools/Tools.js" as Tools Item { id: root readonly property int floatingMargins: Kirigami.Units.largeSpacing readonly property int panelHeight: 44 property bool active: true height: Math.max(20, Math.max(icon.implicitHeight,txt.implicitHeight))+26 Layout.fillWidth: true KSvg.FrameSvgItem { anchors.fill: parent anchors.topMargin: -margins.top anchors.leftMargin: -margins.left anchors.rightMargin: -margins.right anchors.bottomMargin: -margins.bottom imagePath: "solid/widgets/panel-background" prefix: "shadow" } Item { height: root.panelHeight anchors.fill: root anchors.margins: root.floatingMargins clip: true KSvg.FrameSvgItem { anchors.fill: parent imagePath: "widgets/panel-background" enabledBorders: "AllBorders" } RowLayout { anchors.fill: parent anchors.leftMargin: Kirigami.Units.largeSpacing anchors.rightMargin: Kirigami.Units.largeSpacing spacing: 0 Item{ Layout.minimumWidth: cfg_firstSpace Layout.maximumWidth: cfg_firstSpace } Item { id: icon Layout.minimumWidth : height Layout.minimumHeight : parent.height Layout.maximumWidth : Layout.minimumWidth Layout.maximumHeight : Layout.minimumHeight visible : cfg_visible property int thickness: parent.height Kirigami.Icon { anchors { fill : parent topMargin : thickMargin bottomMargin : thickMargin } source: root.active?"kate": cfg_noIcon?"": cfg_activityIcon?"activities":cfg_customIcon readonly property int thickMargin: cfg_fillThickness ? 0 : (parent.thickness - iconSize) / 2 readonly property int iconSize : cfg_fillThickness ? parent.thickness : Math.min(parent.thickness, cfg_customSize) } } Item{ Layout.minimumWidth: cfg_midSpace Layout.maximumWidth: cfg_midSpace } PlasmaComponents.Label { id: txt text : active ? cfg_txt.replace("%a","Kate").replace("%w","main.qml").replace("%q","Default") : cfg_altTxt.replace("%q","ActivityName") color : Kirigami.Theme.textColor verticalAlignment : Text.AlignVCenter elide : Tools.getElide(cfg_elidePos) width : cfg_lengthKind>0?cfg_fixedLength:implicitWidth font { capitalization : cfg_isCaps bold : cfg_isBold italic : cfg_isItalic pixelSize : cfg_fontSize } } Item{ Layout.minimumWidth: cfg_lastSpace Layout.maximumWidth: cfg_lastSpace } Item{ Layout.fillWidth: true } PlasmaComponents.ToolButton { id: activeSwitch icon.name: "exchange-positions" PlasmaComponents.ToolTip{ text: i18n(active?"With active window":"With no active window") } onClicked: active = !active } } } } plasma6-window-title-applet-0.9.0/contents/ui/config/SubsBox.qml000066400000000000000000000017201465147233400246220ustar00rootroot00000000000000import QtQuick import QtQuick.Layouts import org.kde.plasma.components as PC3 import org.kde.kirigami as Kirigami ColumnLayout{ required property var list property alias heading: head.text property alias subsAllowed: subsInfo.visible RowLayout{ Kirigami.Heading{ id: head level: 2 } PC3.ToolButton{ id: subsInfo icon.name: "documentinfo" PC3.ToolTip { text: i18n("Substitutions allowed:

%a: Application Name

%w: Window Title

%q : Activity Name") } } } PC3.TextArea{ Layout.fillWidth: true Layout.fillHeight: true text: listToText(list) onTextChanged: list = textAreaToList(text) Flickable { onContentYChanged: { replace.flickableItem.contentY = flickableItem.contentY titleMatch.flickableItem.contentY = flickableItem.contentY } } } } plasma6-window-title-applet-0.9.0/contents/ui/main.qml000066400000000000000000000121611465147233400227150ustar00rootroot00000000000000import QtQuick import QtQuick.Layouts import QtQuick.Controls import org.kde.plasma.plasmoid import org.kde.plasma.core as PlasmaCore import org.kde.plasma.components as PlasmaComponents import org.kde.taskmanager as TaskManager import org.kde.kirigami as Kirigami import org.kde.activities as Activities import "../tools/Tools.js" as Tools import org.kde.plasma.private.appmenu 1.0 as AppMenuPrivate PlasmoidItem { id: root clip: true Plasmoid.constraintHints: Plasmoid.CanFillArea preferredRepresentation: fullRepresentation readonly property bool isVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical readonly property bool existsWindowActive: windowInfoLoader.item && windowInfoLoader.item.existsWindowActive readonly property bool isActiveWindowPinned: existsWindowActive && activeTaskItem.isOnAllDesktops readonly property bool isActiveWindowMaximized: existsWindowActive && activeTaskItem.isMaximized readonly property var cfg: plasmoid.configuration property Item activeTaskItem: windowInfoLoader.item.activeTaskItem property var icon: Tools.getIcon() property string text: Tools.getText() states: [ State{ name: "editMode" when: Plasmoid.containment.corona?.editMode?true:false PropertyChanges{ target: root text: "Edit Mode" icon: "document-edit" Layout.minimumWidth: isVertical?parent.width:titleLayout.implicitWidth Layout.maximumWidth: Layout.minimumWidth Layout.minimumHeight: isVertical?titleLayout.implicitHeight:parent.height Layout.maximumHeight: Layout.minimumHeight } }, State{ name: "contentsLength" when: cfg.lengthKind === 0 && !isVertical PropertyChanges{ target: root Layout.minimumWidth: titleLayout.implicitWidth Layout.maximumWidth: Layout.minimumWidth Layout.fillHeight: true } }, State{ name: "fixedLength" when: cfg.lengthKind === 1 && !isVertical PropertyChanges{ target: root Layout.minimumWidth: cfg.fixedLength Layout.maximumWidth: cfg.fixedLength Layout.fillHeight: true } }, State{ name: "maximumLength" when: cfg.lengthKind === 2 && !isVertical PropertyChanges{ target: root Layout.minimumWidth: Math.min(cfg.fixedLength,titleLayout.implicitWidth) Layout.maximumWidth: Math.min(cfg.fixedLength,titleLayout.implicitWidth) Layout.fillHeight: true } }, State{ name: "contentsLengthVert" when: cfg.lengthKind === 0 && isVertical PropertyChanges{ target: root Layout.minimumHeight: titleLayout.implicitHeight Layout.maximumHeight: Layout.minimumHeight Layout.fillWidth: true } }, State{ name: "fixedLengthVert" when: cfg.lengthKind === 1 && isVertical PropertyChanges{ target: root Layout.minimumHeight: cfg.fixedLength Layout.maximumHeight: cfg.fixedLength Layout.fillWidth: true } }, State{ name: "maximumLengthVert" when: cfg.lengthKind === 2 && isVertical PropertyChanges{ target: root Layout.minimumHeight: Math.min(cfg.fixedLength,titleLayout.implicitHeight) Layout.maximumHeight: Math.min(cfg.fixedLength,titleLayout.implicitHeight) Layout.fillWidth: true } } ] TaskManager.ActivityInfo { id: activityInfo } Activities.ActivityInfo { id: fullActivityInfo; activityId: ":current" } TaskManager.VirtualDesktopInfo { id: virtualDesktopInfo } Loader { id: windowInfoLoader sourceComponent: plasmaTasksModel Component{ id: plasmaTasksModel PlasmaTasksModel{} } } Title { id: titleLayout } ActionsMouseArea{} PlasmaCore.ToolTipArea { anchors.fill: parent active: text !== "" interactive: true location: plasmoid.location visible: cfg.showTooltip mainItem: RowLayout { spacing: Kirigami.Units.largeSpacing Layout.margins: Kirigami.Units.smallSpacing Kirigami.Icon { source: root.icon } PlasmaComponents.Label { id: fullText elide:Text.ElideRight Layout.fillWidth: true Layout.fillHeight: true verticalAlignment: Text.AlignVCenter text:root.text } } } } plasma6-window-title-applet-0.9.0/install.sh000066400000000000000000000003571465147233400210120ustar00rootroot00000000000000echo "Installing window-title-applet" rm -rf ~/.local/share/plasma/plasmoids/org.kde.windowtitle cp -r ./ ~/.local/share/plasma/plasmoids/org.kde.windowtitle systemctl --user restart plasma-plasmashell echo "Installed window-title-applet" plasma6-window-title-applet-0.9.0/metadata.json000066400000000000000000000012301465147233400214520ustar00rootroot00000000000000{ "KPackageStructure": "Plasma/Applet", "KPlugin": { "Authors": [ { "Email": "dhruv8sh@proton.me", "Name": "Dhruvesh Surolia" } ], "Category": "Windows and Tasks", "Description": "Shows the application title and icon of the active window", "Icon": "preferences-desktop", "Id": "org.kde.windowtitle", "License": "GPLv2", "Name": "Window Title", "Version": "0.9.0", "Website": "https://github.com/dhruv8sh/plasma6-window-title-applet" }, "Keyword": "window title icon", "X-Plasma-API-Minimum-Version": "6.0" }