├── .github └── FUNDING.yml ├── LICENSE ├── README.md ├── contents ├── config │ ├── config.qml │ └── main.xml ├── tools │ └── Tools.js └── ui │ ├── ActionsMouseArea.qml │ ├── CItem.qml │ ├── PlasmaTasksModel.qml │ ├── Title.qml │ ├── config │ ├── ConfigAppearance.qml │ ├── ConfigBehavior.qml │ ├── ConfigSubstitutions.qml │ ├── IconDialog.qml │ ├── MockWidget.qml │ └── SubsBox.qml │ └── main.qml ├── install.sh └── metadata.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: dhruv8sh 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | polar: # Replace with a single Polar username 14 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Window Title Applet 2 | A Plasma 6 applet that builds on the work of [Psifidotos](https://github.com/psifidotos). 3 | 4 | ## Substitutions 5 | - %a : Application Name 6 | - %w : Windows Title 7 | - %q : Activity Name 8 | - ``..`` : Selective bold 9 | - ``..`` : Selective Italics 10 | - `
`/`

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

14 |

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

19 |

20 | 21 |

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

26 |

27 | 28 |

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

33 |

34 | 35 |

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

40 |

41 | 42 |

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

47 |

48 | 49 |

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

54 |

55 | 56 |
57 | 58 | 59 | ## Installation 60 | Either use "Add Widget functionality" or use ```plasmapkg2 -i ./``` when in the root directory of the applet 61 | 62 | or install it from the AUR [plasma6-applets-window-title](https://aur.archlinux.org/packages/plasma6-applets-window-title). 63 | -------------------------------------------------------------------------------- /contents/config/config.qml: -------------------------------------------------------------------------------- 1 | 2 | import QtQuick 3 | import org.kde.plasma.configuration 4 | 5 | ConfigModel { 6 | ConfigCategory { 7 | name: i18n("Appearance") 8 | icon: "preferences-desktop-display-color" 9 | source: "config/ConfigAppearance.qml" 10 | } 11 | ConfigCategory { 12 | name: i18n("Behavior") 13 | icon: "preferences-desktop" 14 | source: "config/ConfigBehavior.qml" 15 | } 16 | ConfigCategory { 17 | name: i18n("Substitutions") 18 | icon: "edit-find-replace" 19 | source: "config/ConfigSubstitutions.qml" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /contents/config/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 0 10 | 0 11 | 0 12 | 0 13 | 12 14 | 24 15 | 400 16 | 24 17 | 3 18 | %a - %w 19 | %q 20 | %a 21 | kde-symbolic 22 | false 23 | false 24 | false 25 | true 26 | false 27 | false 28 | true 29 | 30 | 31 | false 32 | false 33 | true 34 | true 35 | true 36 | true 37 | 38 | 39 | 40 | "Telegram Desktop","Gimp-.*","soffice.bin","Spotify.*","Kate.*" 41 | ".*",".*",".*",".*",".*" 42 | "Telegram","Gimp","LibreOffice","Spotify","Kate : %w" 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /contents/tools/Tools.js: -------------------------------------------------------------------------------- 1 | function clean(item) 2 | { 3 | if (item.length>=2 && item.indexOf('"')===0 && item.lastIndexOf('"')===item.length-1) return item.substring(1, item.length-1); 4 | else return item; 5 | } 6 | function match(pat,str){ 7 | let rgx = new RegExp(clean(pat)) 8 | return rgx.test(str) 9 | } 10 | function sub(str){ 11 | return str 12 | .replace("%a",activeTaskItem?.appName??"") 13 | .replace("%w",activeTaskItem?.title??"") 14 | .replace("%q",fullActivityInfo?.name??"") 15 | } 16 | function substitute() { 17 | let minSize = Math.min(cfg.subsMatchApp.length, cfg.subsReplace.length,cfg.subsMatchTitle.length) 18 | 19 | let appName=activeTaskItem.appName, title=activeTaskItem.title 20 | let text= appName === title ? cfg.txtSameFound : cfg.txt 21 | 22 | for(let i=0; i=0 && wheel.angleDelta.x>=0) delta = Math.max(wheel.angleDelta.y, wheel.angleDelta.x) / 8; 25 | else delta = Math.min(wheel.angleDelta.y, wheel.angleDelta.x) / 8; 26 | var ctrlPressed = (wheel.modifiers & Qt.ControlModifier); 27 | if (delta>10) { 28 | if (!ctrlPressed) windowInfoLoader.item.activateNextPrevTask(true); 29 | else if (windowInfoLoader.item.activeTaskItem && !windowInfoLoader.item.activeTaskItem.isMaximized) windowInfoLoader.item.toggleMaximized(); 30 | } else if (delta<-10) { 31 | if (!ctrlPressed) { 32 | if (windowInfoLoader.item.activeTaskItem 33 | && !windowInfoLoader.item.activeTaskItem.isMinimized 34 | && windowInfoLoader.item.activeTaskItem.isMaximized) // Maximized 35 | windowInfoLoader.item.activeTaskItem.toggleMaximized(); 36 | else if (windowInfoLoader.item.activeTaskItem 37 | && !windowInfoLoader.item.activeTaskItem.isMinimized 38 | && !windowInfoLoader.item.activeTaskItem.isMaximized) // UnMaximized 39 | windowInfoLoader.item.activeTaskItem.toggleMinimized(); 40 | } else if (windowInfoLoader.item.activeTaskItem 41 | && windowInfoLoader.item.activeTaskItem.isMaximized) 42 | windowInfoLoader.item.activeTaskItem.toggleMaximized(); 43 | } 44 | } 45 | 46 | // To open overview 47 | Plasma5Support.DataSource { 48 | id: executable 49 | engine: "executable" 50 | connectedSources: [] 51 | onNewData: (source, data) => { disconnectSource(source) } 52 | function exec(cmd) { executable.connectSource(cmd) } 53 | } 54 | 55 | // To optimize scrolling for touchpads 56 | Timer{ 57 | id: scrollDelayer 58 | interval: 200 59 | onTriggered: actionsArea.wheelIsBlocked = false; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /contents/ui/CItem.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Layouts 3 | 4 | //Custom item to make the code look cleaner 5 | Item { 6 | required property real length 7 | Layout.minimumWidth: isVertical?root.width :length 8 | Layout.maximumWidth: isVertical?root.width :length 9 | Layout.minimumHeight:!isVertical?root.height:length 10 | Layout.maximumHeight:!isVertical?root.height:length 11 | /*Rectangle{ 12 | color: "green" 13 | anchors.fill: parent 14 | border.color: "red" 15 | border.width: 1 16 | }*/ 17 | } 18 | -------------------------------------------------------------------------------- /contents/ui/PlasmaTasksModel.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQml.Models 3 | 4 | import org.kde.taskmanager as TaskManager 5 | 6 | Item { 7 | id: plasmaTasksItem 8 | readonly property bool existsWindowActive: root.activeTaskItem && tasksRepeater.count > 0 && activeTaskItem.isActive 9 | property Item activeTaskItem: null 10 | 11 | TaskManager.TasksModel { 12 | id: tasksModel 13 | sortMode: TaskManager.TasksModel.SortVirtualDesktop 14 | groupMode: TaskManager.TasksModel.GroupDisabled 15 | screenGeometry: root.screenGeometry 16 | activity: activityInfo.currentActivity 17 | virtualDesktop: virtualDesktopInfo.currentDesktop 18 | 19 | filterByScreen: plasmoid.configuration.filterByScreen 20 | filterByVirtualDesktop: true 21 | filterByActivity: true 22 | } 23 | Item{ 24 | id: taskList 25 | Repeater{ 26 | id: tasksRepeater 27 | model: tasksModel 28 | Item{ 29 | id: task 30 | readonly property string appName: modelAppName !== "" ? modelAppName : discoveredAppName 31 | readonly property bool isMinimized: IsMinimized === true ? true : false 32 | readonly property bool isMaximized: IsMaximized === true ? true : false 33 | readonly property bool isActive: IsActive === true ? true : false 34 | readonly property bool isOnAllDesktops: IsOnAllVirtualDesktops === true ? true : false 35 | property var icon: decoration 36 | 37 | readonly property string modelAppName: AppName 38 | readonly property string modelDisplay: display 39 | 40 | property string title: "" 41 | property string discoveredAppName: "" 42 | 43 | readonly property var m: model 44 | 45 | function cleanupTitle() { 46 | var text = display; 47 | var t = modelDisplay; 48 | var sep = t.lastIndexOf(" —– "); 49 | var spacer = 4; 50 | 51 | if (sep === -1) { 52 | sep = t.lastIndexOf(" -- "); 53 | spacer = 4; 54 | } 55 | 56 | if (sep === -1) { 57 | sep = t.lastIndexOf(" -- "); 58 | spacer = 4; 59 | } 60 | 61 | if (sep === -1) { 62 | sep = t.lastIndexOf(" — "); 63 | spacer = 3; 64 | } 65 | 66 | if (sep === -1) { 67 | sep = t.lastIndexOf(" - "); 68 | spacer = 3; 69 | } 70 | 71 | var dTitle = ""; 72 | var dAppName = ""; 73 | 74 | if (sep>-1) { 75 | dTitle = text.substring(0, sep); 76 | discoveredAppName = text.substring(sep+spacer, text.length); 77 | 78 | //if title starts with application name, swap the found records 79 | if (dTitle.startsWith(modelAppName)) { 80 | var firstPart = dTitle; 81 | dTitle = discoveredAppName; 82 | discoveredAppName = firstPart; 83 | } 84 | } 85 | 86 | if (sep>-1) { 87 | title = dTitle; 88 | } else { 89 | title = t; 90 | } 91 | } 92 | 93 | onIsActiveChanged: { 94 | if (isActive) { 95 | if(plasmoid.configuration.showOnlyOnMaximize && !task.isMaximized) 96 | plasmaTasksItem.activeTaskItem = null; 97 | else 98 | plasmaTasksItem.activeTaskItem = task; 99 | 100 | } 101 | } 102 | 103 | onIsMaximizedChanged: { 104 | if(plasmoid.configuration.showOnlyOnMaximize && isActive) 105 | plasmaTasksItem.activeTaskItem = task.isMaximized ? task : null; 106 | } 107 | 108 | onModelAppNameChanged: task.cleanupTitle() 109 | onModelDisplayChanged: task.cleanupTitle() 110 | Component.onCompleted: task.cleanupTitle() 111 | 112 | Component.onDestruction: { 113 | if (plasmaTasksItem.lastActiveTaskItem === task) { 114 | plasmaTasksItem.lastActiveTaskItem = null; 115 | } 116 | } 117 | 118 | function modelIndex(){ 119 | return tasksModel.makeModelIndex(index); 120 | } 121 | 122 | function toggleMaximized() { 123 | tasksModel.requestToggleMaximized(modelIndex()); 124 | } 125 | 126 | function toggleMinimized() { 127 | tasksModel.requestToggleMinimized(modelIndex()); 128 | } 129 | 130 | function requestClose() { 131 | tasksModel.requestClose(modelIndex()); 132 | } 133 | 134 | function togglePinToAllDesktops() { 135 | if (root.plasma515) { 136 | tasksModel.requestVirtualDesktops(modelIndex(), 0); 137 | } else { 138 | tasksModel.requestVirtualDesktop(modelIndex(), 0); 139 | } 140 | } 141 | 142 | function toggleKeepAbove(){ 143 | tasksModel.requestToggleKeepAbove(modelIndex()); 144 | } 145 | } 146 | } 147 | } 148 | 149 | //! Functionality 150 | 151 | function toggleMaximized() { 152 | if (activeTaskItem) { 153 | activeTaskItem.toggleMaximized(); 154 | } 155 | } 156 | 157 | function toggleMinimized() { 158 | if (activeTaskItem) 159 | activeTaskItem.toggleMinimized(); 160 | } 161 | 162 | function requestClose() { 163 | if (activeTaskItem) 164 | activeTaskItem.requestClose(); 165 | } 166 | 167 | function togglePinToAllDesktops() { 168 | if (activeTaskItem) { 169 | activeTaskItem.togglePinToAllDesktops(); 170 | } 171 | } 172 | 173 | function toggleKeepAbove(){ 174 | if (activeTaskItem) { 175 | activeTaskItem.toggleKeepAbove(); 176 | } 177 | } 178 | 179 | //! Cycle Through Tasks 180 | function activateNextPrevTask(next) { 181 | var taskIndexList = []; 182 | var activeTaskIndex = tasksModel.activeTask; 183 | 184 | for (var i = 0; i < taskList.children.length - 1; ++i) { 185 | var task = taskList.children[i]; 186 | var modelIndex = task.modelIndex(i); 187 | 188 | if (task.m.IsLauncher !== true && task.m.IsStartup !== true) { 189 | if (task.m.IsGroupParent === true) { 190 | for (var j = 0; j < tasksModel.rowCount(modelIndex); ++j) { 191 | taskIndexList.push(tasksModel.makeModelIndex(i, j)); 192 | } 193 | } else { 194 | taskIndexList.push(modelIndex); 195 | } 196 | } 197 | } 198 | 199 | if (!taskIndexList.length) { 200 | return; 201 | } 202 | 203 | var target = taskIndexList[0]; 204 | 205 | for (var i = 0; i < taskIndexList.length; ++i) { 206 | if (taskIndexList[i] === activeTaskIndex) 207 | { 208 | if (next && i < (taskIndexList.length - 1)) { 209 | target = taskIndexList[i + 1]; 210 | } else if (!next) { 211 | if (i) { 212 | target = taskIndexList[i - 1]; 213 | } else { 214 | target = taskIndexList[taskIndexList.length - 1]; 215 | } 216 | } 217 | 218 | break; 219 | } 220 | } 221 | tasksModel.requestActivate(target); 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /contents/ui/Title.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Layouts 3 | import org.kde.kirigami as Kirigami 4 | import org.kde.plasma.components as PlasmaComponents 5 | import org.kde.plasma.core as PlasmaCore 6 | import "../tools/Tools.js" as Tools 7 | 8 | GridLayout { 9 | columns: isVertical?1:6 10 | anchors.fill: parent 11 | rowSpacing: 0 12 | columnSpacing: 0 13 | Layout.maximumWidth: parent.width 14 | Layout.maximumHeight: parent.height 15 | //Calculated length for the label 16 | property real labelLen : { 17 | let neededInViewLen = cfg.firstSpace+cfg.midSpace+cfg.lastSpace+cfg.lastSpace 18 | neededInViewLen += isVertical?iconItem.height:iconItem.width 19 | return cfg.fixedLength-neededInViewLen 20 | } 21 | 22 | 23 | CItem {length: cfg.firstSpace} 24 | Item { 25 | id: iconItem 26 | Layout.minimumWidth : isVertical ? parent.width : height 27 | Layout.minimumHeight : isVertical ? width : parent.height 28 | Layout.maximumWidth : Layout.minimumWidth 29 | Layout.maximumHeight : Layout.minimumHeight 30 | visible : cfg.visible 31 | property int thickness: isVertical ? parent.width : parent.height 32 | Kirigami.Icon { 33 | anchors { 34 | fill : parent 35 | topMargin : !isVertical ? thickMargin : 0 36 | bottomMargin : !isVertical ? thickMargin : 0 37 | leftMargin : isVertical ? thickMargin : 0 38 | rightMargin : isVertical ? thickMargin : 0 39 | } 40 | source: root.icon 41 | readonly property int thickMargin: cfg.fillThickness ? 0 : (parent.thickness - iconSize) / 2 42 | readonly property int iconSize : cfg.fillThickness ? parent.thickness : Math.min(parent.thickness, cfg.customSize) 43 | } 44 | } 45 | CItem {length: cfg.midSpace} 46 | CItem{ 47 | length : { 48 | if(cfg.lengthKind == 0) return label.implicitWidth 49 | else if(cfg.lengthKind == 1) return labelLen 50 | else return Math.min(label.implicitWidth,labelLen) 51 | } 52 | clip: true 53 | PlasmaComponents.Label { 54 | id : label 55 | verticalAlignment : Text.AlignVCenter 56 | text : root.text 57 | color : Kirigami.Theme.textColor 58 | elide : Tools.getElide(cfg.elidePos) 59 | width : { 60 | if(cfg.lengthKind == 0) return label.implicitWidth 61 | else if(cfg.lengthKind == 1) return labelLen 62 | else return Math.min(label.implicitWidth,labelLen) 63 | } 64 | rotation : isVertical?plasmoid.location===PlasmaCore.Types.LeftEdge?-90:90:0 65 | anchors.centerIn : parent 66 | font { 67 | capitalization : cfg.isCaps ? Font.Capitalize : Font.MixedCase 68 | bold : cfg.isBold 69 | italic : cfg.isItalic 70 | pixelSize : cfg.fontSize 71 | } 72 | } 73 | } 74 | CItem {length:cfg.lastSpace} 75 | Item { 76 | Layout.fillWidth: true 77 | Layout.fillHeight: true 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /contents/ui/config/ConfigAppearance.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Layouts 4 | import org.kde.plasma.core as PlasmaCore 5 | import org.kde.kirigami as Kirigami 6 | import org.kde.plasma.components as PC3 7 | import org.kde.iconthemes as KIconThemes 8 | import org.kde.ksvg as KSvg 9 | 10 | import "../../tools/Tools.js" as Tools 11 | 12 | Kirigami.ScrollablePage { 13 | id: root 14 | readonly property alias cfg_firstSpace: firstSpace.value 15 | readonly property alias cfg_midSpace: midSpace.value 16 | readonly property alias cfg_lastSpace: lastSpace.value 17 | readonly property alias cfg_txt: txt.text 18 | readonly property alias cfg_altTxt: altTxt.text 19 | readonly property alias cfg_isBold: boldChk.checked 20 | readonly property alias cfg_isItalic: italicChk.checked 21 | readonly property alias cfg_isCaps: capsChk.checked 22 | readonly property alias cfg_fontSize: fontSize.value 23 | readonly property alias cfg_visible: iconChk.checked 24 | readonly property alias cfg_lengthKind: lengthKind.currentIndex 25 | readonly property alias cfg_fixedLength: fixedLength.value 26 | readonly property alias cfg_fillThickness: fillThickness.checked 27 | readonly property alias cfg_noIcon: noIcon.checked 28 | readonly property alias cfg_activityIcon: activityIcon.checked 29 | readonly property alias cfg_customIcon: iconDialog.value 30 | readonly property alias cfg_txtSameFound: txtSameFound.text 31 | readonly property alias cfg_customSize: customSize.value 32 | readonly property alias cfg_elidePos: elidePos.currentIndex 33 | 34 | header : MockWidget{} 35 | Kirigami.FormLayout { 36 | Layout.fillWidth: true 37 | Kirigami.Separator { 38 | Kirigami.FormData.isSection: true 39 | Kirigami.FormData.label: "Text" 40 | } 41 | RowLayout { 42 | Kirigami.FormData.label: i18n("When title available:") 43 | PC3.TextField { id: txt } 44 | PC3.ToolButton { 45 | icon.name: "documentinfo" 46 | PC3.ToolTip{ text: i18n("This pattern will be shown when a window is active.

47 | Substitutions:

48 | %a - Application Name

49 | %w - Window Title

50 | %q - Activity Info

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

Neovide - Neovide") } 60 | } 61 | } 62 | RowLayout{ 63 | Kirigami.FormData.label: i18n("When title unavailable:") 64 | PC3.TextField { 65 | id: altTxt 66 | text: "%q" 67 | } 68 | PC3.ToolButton { 69 | icon.name: "documentinfo" 70 | PC3.ToolTip{ text: i18n("This pattern will be shown when no window is active.

71 | Substitutions:

72 | %q - Activity Info

73 | Use HTML tags for bold, italic and multi-line text") } 74 | } 75 | } 76 | RowLayout { 77 | Kirigami.FormData.label: i18n("Text Formatting:") 78 | PC3.SpinBox{ 79 | id: fontSize 80 | from: 8 81 | to: 64 82 | } 83 | PC3.ToolButton{ 84 | id: boldChk 85 | checkable: true 86 | icon.name: "format-text-bold" 87 | display: AbstractButton.IconOnly 88 | text: i18n("Bold") 89 | height: Kirigami.Units.smallSpacing 90 | PC3.ToolTip{ text: i18n("Bold") } 91 | } 92 | PC3.ToolButton{ 93 | id: italicChk 94 | checkable: true 95 | display: AbstractButton.IconOnly 96 | text: i18n("Italic") 97 | icon.name: "format-text-italic" 98 | height: Kirigami.Units.smallSpacing 99 | PC3.ToolTip{ text: i18n("Italic") } 100 | } 101 | PC3.ToolButton{ 102 | id: capsChk 103 | checkable: true 104 | icon.name: "format-text-capitalize" 105 | text: i18n("Capitalize") 106 | display: AbstractButton.IconOnly 107 | height: Kirigami.Units.smallSpacing 108 | PC3.ToolTip{ text: i18n("Capitalize First Letters") } 109 | } 110 | } 111 | PC3.ComboBox { 112 | id: elidePos 113 | Kirigami.FormData.label: i18n("Elide Position:") 114 | model: ["None","Left","Middle","Right"] 115 | visible: lengthKind.currentIndex > 0 116 | } 117 | Kirigami.Separator { 118 | Kirigami.FormData.isSection: true 119 | Kirigami.FormData.label: "Icon" 120 | } 121 | PC3.CheckBox { 122 | id: iconChk 123 | Kirigami.FormData.label: i18n("Visible:") 124 | } 125 | RowLayout { 126 | Kirigami.FormData.label: i18n("Size:") 127 | RadioButton{ 128 | id: customThickness 129 | text: i18n("Custom Size") 130 | icon.name:"image-resize-symbolic" 131 | checked: !fillThickness.checked 132 | } 133 | RadioButton{ 134 | id: fillThickness 135 | text: i18n("Fill Thickness") 136 | icon.name: "panel-fit-height" 137 | } 138 | } 139 | PC3.SpinBox{ 140 | id: customSize 141 | from: 8 142 | to: 50 143 | enabled: customThickness.checked 144 | } 145 | RowLayout { 146 | Kirigami.FormData.label: i18n("Placeholder icon:") 147 | RadioButton{ 148 | id: customIcon 149 | text: i18n("Custom Icon") 150 | icon.name:"dialog-icon-preview" 151 | checked: !activityIcon.checked && !noIcon.checked 152 | } 153 | RadioButton{ 154 | id: activityIcon 155 | text: i18n("Activity Icon") 156 | icon.name: "activities" 157 | } 158 | RadioButton{ 159 | id: noIcon 160 | text: i18n("Preserve Space") 161 | icon.name: "edit-none" 162 | } 163 | } 164 | IconDialog{ 165 | id: iconDialog 166 | visible: customIcon.checked 167 | } 168 | Kirigami.Separator { 169 | Kirigami.FormData.isSection: true 170 | Kirigami.FormData.label: "Margins" 171 | } 172 | PC3.ComboBox { 173 | id:lengthKind 174 | Kirigami.FormData.label: i18n("Length:") 175 | model: ["Based on contents","Fixed Length","Maximum Length"] 176 | } 177 | RowLayout{ 178 | Kirigami.FormData.label: i18n("Custom length:") 179 | visible: lengthKind.currentIndex > 0 180 | PC3.Slider{ 181 | id:fixedLength 182 | from: 24 183 | to: 1500 184 | stepSize:1 185 | } 186 | PC3.Label{ 187 | text: fixedLength.value+" px." 188 | } 189 | } 190 | 191 | PC3.SpinBox { 192 | id: firstSpace 193 | Kirigami.FormData.label: i18n("Space before icon:") 194 | from: 0 195 | to: 999 196 | } 197 | PC3.SpinBox { 198 | id: midSpace 199 | Kirigami.FormData.label: i18n("Space between icon and text:") 200 | from: 0 201 | to: 999 202 | } 203 | PC3.SpinBox { 204 | id: lastSpace 205 | Kirigami.FormData.label: i18n("Space after text:") 206 | from: 0 207 | to: 999 208 | } 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /contents/ui/config/ConfigBehavior.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Layouts 4 | 5 | import org.kde.plasma.core as PlasmaCore 6 | import org.kde.plasma.plasmoid 7 | import org.kde.plasma.components as PC3 8 | import org.kde.kirigami as Kirigami 9 | 10 | Kirigami.ScrollablePage { 11 | readonly property alias cfg_filterByScreen: filterByScreenChk.checked 12 | readonly property alias cfg_filterByMaximized: filterByMaximizedChk.checked 13 | readonly property alias cfg_showTooltip: showTooltipChk.checked 14 | readonly property alias cfg_maxminAllowed: maxminAllowed.checked 15 | readonly property alias cfg_closeAllowed: closeAllowed.checked 16 | readonly property alias cfg_scrollAllowed: scrollAllowed.checked 17 | 18 | Kirigami.FormLayout { 19 | Kirigami.Separator { 20 | Kirigami.FormData.isSection: true 21 | Kirigami.FormData.label: "Info Filtering" 22 | } 23 | PC3.CheckBox{ 24 | id: filterByScreenChk 25 | Kirigami.FormData.label: i18n("Show only from current screen:") 26 | } 27 | PC3.CheckBox{ 28 | id: filterByMaximizedChk 29 | Kirigami.FormData.label: i18n("Show only when maximized:") 30 | } 31 | Kirigami.Separator { 32 | Kirigami.FormData.isSection: true 33 | Kirigami.FormData.label: "Gestures" 34 | } 35 | PC3.CheckBox{ 36 | id: showTooltipChk 37 | Kirigami.FormData.label: i18n("Show tooltip on hover:") 38 | } 39 | PC3.CheckBox{ 40 | id: maxminAllowed 41 | Kirigami.FormData.label: i18n("Double-Click to maximize/minimize:") 42 | } 43 | PC3.CheckBox{ 44 | id: closeAllowed 45 | Kirigami.FormData.label: i18n("Middle-Click to close:") 46 | } 47 | PC3.CheckBox{ 48 | id: scrollAllowed 49 | Kirigami.FormData.label: i18n("Scroll through tasks:") 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /contents/ui/config/ConfigSubstitutions.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Layouts 4 | import org.kde.plasma.core as PlasmaCore 5 | import org.kde.kirigami as Kirigami 6 | import org.kde.plasma.components as PC3 7 | import org.kde.iconthemes as KIconThemes 8 | import org.kde.ksvg as KSvg 9 | 10 | Kirigami.ScrollablePage { 11 | id: subsPage 12 | function textAreaToList(text) { return text.split('\n') } 13 | function listToText(list) { return list.join('\n') } 14 | readonly property alias cfg_subsMatchApp : subsPage.nameMatches 15 | readonly property alias cfg_subsMatchTitle: subsPage.titleMatches 16 | readonly property alias cfg_subsReplace : subsPage.replacements 17 | property var nameMatches 18 | property var titleMatches 19 | property var replacements 20 | header:Kirigami.InlineMessage { 21 | Layout.fillWidth: true 22 | text: i18n("Length of lists is not equal") 23 | visible: !(nameMatches.length == titleMatches.length && titleMatches.length == replacements.length) 24 | type: Kirigami.MessageType.Warning 25 | } 26 | // TODO: Clean this, not the most elegant way to handle it! 27 | RowLayout{ 28 | SubsBox{ 29 | id: nameMatch 30 | heading: i18n("Application Name Match") 31 | subsAllowed: false 32 | list: nameMatches 33 | onListChanged: nameMatches = list 34 | } 35 | SubsBox{ 36 | id: titleMatch 37 | heading: i18n("Window Title Match") 38 | subsAllowed: false 39 | list: titleMatches 40 | onListChanged: titleMatches = list 41 | } 42 | SubsBox{ 43 | id: replace 44 | heading: i18n("Replacement") 45 | list: replacements 46 | onListChanged: replacements = list 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /contents/ui/config/IconDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Layouts 4 | import org.kde.plasma.core as PlasmaCore 5 | import org.kde.kirigami as Kirigami 6 | import org.kde.plasma.components as PlasmaComponents 7 | import org.kde.iconthemes as KIconThemes 8 | import org.kde.ksvg as KSvg 9 | 10 | RowLayout { 11 | property alias value: placeHolderIcon.source 12 | Button { 13 | implicitWidth: previewFrame.width + Kirigami.Units.smallSpacing * 2 14 | implicitHeight: previewFrame.height + Kirigami.Units.smallSpacing * 2 15 | onPressed: iconMenu.opened ? iconMenu.close() : iconMenu.open() 16 | KIconThemes.IconDialog { 17 | id: iconDialog 18 | onIconNameChanged: value = iconName 19 | } 20 | KSvg.FrameSvgItem { 21 | id: previewFrame 22 | anchors.centerIn: parent 23 | imagePath: "widgets/panel-background" 24 | width: Kirigami.Units.iconSizes.large + fixedMargins.left + fixedMargins.right 25 | height: Kirigami.Units.iconSizes.large + fixedMargins.top + fixedMargins.bottom 26 | Kirigami.Icon { 27 | id: placeHolderIcon 28 | anchors.centerIn: parent 29 | width: Kirigami.Units.iconSizes.large 30 | height: width 31 | source: "kde-symbolic" 32 | } 33 | } 34 | 35 | Menu { 36 | id:iconMenu 37 | y: parent.height 38 | MenuItem { 39 | text: i18nc("@item:inmenu Open icon chooser dialog", "Choose…") 40 | icon.name: "document-open-folder" 41 | Accessible.description: i18nc("@info:whatsthis", "Choose an icon for Application Launcher") 42 | onClicked: iconDialog.open() 43 | } 44 | MenuItem { 45 | text: i18nc("@item:inmenu Reset icon to default", "Reset to default icon") 46 | icon.name: "kt-restore-defaults" 47 | onClicked: value = Tools.defaultIconName 48 | } 49 | } 50 | } 51 | PlasmaComponents.Label{ 52 | text:`"${value}"` 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /contents/ui/config/MockWidget.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Controls 3 | import QtQuick.Layouts 4 | import org.kde.plasma.core as PlasmaCore 5 | import org.kde.kirigami as Kirigami 6 | import org.kde.plasma.components as PlasmaComponents 7 | import org.kde.iconthemes as KIconThemes 8 | import org.kde.ksvg as KSvg 9 | import org.kde.plasma.plasmoid as Plasmoid 10 | import "../../tools/Tools.js" as Tools 11 | 12 | Item { 13 | id: root 14 | readonly property int floatingMargins: Kirigami.Units.largeSpacing 15 | readonly property int panelHeight: 44 16 | property bool active: true 17 | 18 | height: Math.max(20, Math.max(icon.implicitHeight,txt.implicitHeight))+26 19 | Layout.fillWidth: true 20 | KSvg.FrameSvgItem { 21 | anchors.fill: parent 22 | anchors.topMargin: -margins.top 23 | anchors.leftMargin: -margins.left 24 | anchors.rightMargin: -margins.right 25 | anchors.bottomMargin: -margins.bottom 26 | imagePath: "solid/widgets/panel-background" 27 | prefix: "shadow" 28 | } 29 | Item { 30 | height: root.panelHeight 31 | anchors.fill: root 32 | anchors.margins: root.floatingMargins 33 | clip: true 34 | KSvg.FrameSvgItem { 35 | anchors.fill: parent 36 | imagePath: "widgets/panel-background" 37 | enabledBorders: "AllBorders" 38 | } 39 | RowLayout { 40 | anchors.fill: parent 41 | anchors.leftMargin: Kirigami.Units.largeSpacing 42 | anchors.rightMargin: Kirigami.Units.largeSpacing 43 | spacing: 0 44 | Item{ 45 | Layout.minimumWidth: cfg_firstSpace 46 | Layout.maximumWidth: cfg_firstSpace 47 | } 48 | Item { 49 | id: icon 50 | Layout.minimumWidth : height 51 | Layout.minimumHeight : parent.height 52 | Layout.maximumWidth : Layout.minimumWidth 53 | Layout.maximumHeight : Layout.minimumHeight 54 | visible : cfg_visible 55 | property int thickness: parent.height 56 | 57 | Kirigami.Icon { 58 | anchors { 59 | fill : parent 60 | topMargin : thickMargin 61 | bottomMargin : thickMargin 62 | } 63 | source: root.active?"kate": 64 | cfg_noIcon?"": 65 | cfg_activityIcon?"activities":cfg_customIcon 66 | readonly property int thickMargin: cfg_fillThickness ? 0 : (parent.thickness - iconSize) / 2 67 | readonly property int iconSize : cfg_fillThickness ? parent.thickness : Math.min(parent.thickness, cfg_customSize) 68 | } 69 | } 70 | Item{ 71 | Layout.minimumWidth: cfg_midSpace 72 | Layout.maximumWidth: cfg_midSpace 73 | } 74 | PlasmaComponents.Label { 75 | id: txt 76 | text : active 77 | ? cfg_txt.replace("%a","Kate").replace("%w","main.qml").replace("%q","Default") 78 | : cfg_altTxt.replace("%q","ActivityName") 79 | color : Kirigami.Theme.textColor 80 | verticalAlignment : Text.AlignVCenter 81 | elide : Tools.getElide(cfg_elidePos) 82 | width : cfg_lengthKind>0?cfg_fixedLength:implicitWidth 83 | font { 84 | capitalization : cfg_isCaps 85 | bold : cfg_isBold 86 | italic : cfg_isItalic 87 | pixelSize : cfg_fontSize 88 | } 89 | } 90 | Item{ 91 | Layout.minimumWidth: cfg_lastSpace 92 | Layout.maximumWidth: cfg_lastSpace 93 | } 94 | Item{ 95 | Layout.fillWidth: true 96 | } 97 | PlasmaComponents.ToolButton { 98 | id: activeSwitch 99 | icon.name: "exchange-positions" 100 | PlasmaComponents.ToolTip{ text: i18n(active?"With active window":"With no active window") } 101 | onClicked: active = !active 102 | } 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /contents/ui/config/SubsBox.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Layouts 3 | import org.kde.plasma.components as PC3 4 | import org.kde.kirigami as Kirigami 5 | 6 | ColumnLayout{ 7 | required property var list 8 | property alias heading: head.text 9 | property alias subsAllowed: subsInfo.visible 10 | RowLayout{ 11 | Kirigami.Heading{ 12 | id: head 13 | level: 2 14 | } 15 | PC3.ToolButton{ 16 | id: subsInfo 17 | icon.name: "documentinfo" 18 | PC3.ToolTip { text: i18n("Substitutions allowed:

%a: Application Name

%w: Window Title

%q : Activity Name") } 19 | } 20 | } 21 | PC3.TextArea{ 22 | Layout.fillWidth: true 23 | Layout.fillHeight: true 24 | text: listToText(list) 25 | onTextChanged: list = textAreaToList(text) 26 | Flickable { 27 | onContentYChanged: { 28 | replace.flickableItem.contentY = flickableItem.contentY 29 | titleMatch.flickableItem.contentY = flickableItem.contentY 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /contents/ui/main.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Layouts 3 | import QtQuick.Controls 4 | 5 | import org.kde.plasma.plasmoid 6 | import org.kde.plasma.core as PlasmaCore 7 | import org.kde.plasma.components as PlasmaComponents 8 | import org.kde.taskmanager as TaskManager 9 | import org.kde.kirigami as Kirigami 10 | import org.kde.activities as Activities 11 | import "../tools/Tools.js" as Tools 12 | import org.kde.plasma.private.appmenu 1.0 as AppMenuPrivate 13 | 14 | PlasmoidItem { 15 | id: root 16 | clip: true 17 | Plasmoid.constraintHints: Plasmoid.CanFillArea 18 | preferredRepresentation: fullRepresentation 19 | 20 | readonly property bool isVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical 21 | readonly property bool existsWindowActive: windowInfoLoader.item && windowInfoLoader.item.existsWindowActive 22 | readonly property bool isActiveWindowPinned: existsWindowActive && activeTaskItem.isOnAllDesktops 23 | readonly property bool isActiveWindowMaximized: existsWindowActive && activeTaskItem.isMaximized 24 | readonly property var cfg: plasmoid.configuration 25 | 26 | property Item activeTaskItem: windowInfoLoader.item.activeTaskItem 27 | property var icon: Tools.getIcon() 28 | property string text: Tools.getText() 29 | states: [ 30 | State{ 31 | name: "editMode" 32 | when: Plasmoid.containment.corona?.editMode?true:false 33 | PropertyChanges{ 34 | target: root 35 | text: "Edit Mode" 36 | icon: "document-edit" 37 | Layout.minimumWidth: isVertical?parent.width:titleLayout.implicitWidth 38 | Layout.maximumWidth: Layout.minimumWidth 39 | Layout.minimumHeight: isVertical?titleLayout.implicitHeight:parent.height 40 | Layout.maximumHeight: Layout.minimumHeight 41 | } 42 | }, 43 | State{ 44 | name: "contentsLength" 45 | when: cfg.lengthKind === 0 && !isVertical 46 | PropertyChanges{ 47 | target: root 48 | Layout.minimumWidth: titleLayout.implicitWidth 49 | Layout.maximumWidth: Layout.minimumWidth 50 | Layout.fillHeight: true 51 | } 52 | }, 53 | State{ 54 | name: "fixedLength" 55 | when: cfg.lengthKind === 1 && !isVertical 56 | PropertyChanges{ 57 | target: root 58 | Layout.minimumWidth: cfg.fixedLength 59 | Layout.maximumWidth: cfg.fixedLength 60 | Layout.fillHeight: true 61 | } 62 | }, 63 | State{ 64 | name: "maximumLength" 65 | when: cfg.lengthKind === 2 && !isVertical 66 | PropertyChanges{ 67 | target: root 68 | Layout.minimumWidth: Math.min(cfg.fixedLength,titleLayout.implicitWidth) 69 | Layout.maximumWidth: Math.min(cfg.fixedLength,titleLayout.implicitWidth) 70 | Layout.fillHeight: true 71 | } 72 | }, 73 | State{ 74 | name: "contentsLengthVert" 75 | when: cfg.lengthKind === 0 && isVertical 76 | PropertyChanges{ 77 | target: root 78 | Layout.minimumHeight: titleLayout.implicitHeight 79 | Layout.maximumHeight: Layout.minimumHeight 80 | Layout.fillWidth: true 81 | } 82 | }, 83 | State{ 84 | name: "fixedLengthVert" 85 | when: cfg.lengthKind === 1 && isVertical 86 | PropertyChanges{ 87 | target: root 88 | Layout.minimumHeight: cfg.fixedLength 89 | Layout.maximumHeight: cfg.fixedLength 90 | Layout.fillWidth: true 91 | } 92 | }, 93 | State{ 94 | name: "maximumLengthVert" 95 | when: cfg.lengthKind === 2 && isVertical 96 | PropertyChanges{ 97 | target: root 98 | Layout.minimumHeight: Math.min(cfg.fixedLength,titleLayout.implicitHeight) 99 | Layout.maximumHeight: Math.min(cfg.fixedLength,titleLayout.implicitHeight) 100 | Layout.fillWidth: true 101 | } 102 | } 103 | ] 104 | 105 | TaskManager.ActivityInfo { id: activityInfo } 106 | Activities.ActivityInfo { id: fullActivityInfo; activityId: ":current" } 107 | TaskManager.VirtualDesktopInfo { id: virtualDesktopInfo } 108 | Loader { 109 | id: windowInfoLoader 110 | sourceComponent: plasmaTasksModel 111 | Component{ 112 | id: plasmaTasksModel 113 | PlasmaTasksModel{} 114 | } 115 | } 116 | Title { id: titleLayout } 117 | ActionsMouseArea{} 118 | PlasmaCore.ToolTipArea { 119 | anchors.fill: parent 120 | active: text !== "" 121 | interactive: true 122 | location: plasmoid.location 123 | visible: cfg.showTooltip 124 | mainItem: RowLayout { 125 | spacing: Kirigami.Units.largeSpacing 126 | Layout.margins: Kirigami.Units.smallSpacing 127 | Kirigami.Icon { 128 | source: root.icon 129 | } 130 | PlasmaComponents.Label { 131 | id: fullText 132 | elide:Text.ElideRight 133 | Layout.fillWidth: true 134 | Layout.fillHeight: true 135 | verticalAlignment: Text.AlignVCenter 136 | text:root.text 137 | } 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | echo "Installing window-title-applet" 2 | rm -rf ~/.local/share/plasma/plasmoids/org.kde.windowtitle 3 | cp -r ./ ~/.local/share/plasma/plasmoids/org.kde.windowtitle 4 | systemctl --user restart plasma-plasmashell 5 | echo "Installed window-title-applet" 6 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "KPackageStructure": "Plasma/Applet", 3 | "KPlugin": { 4 | "Authors": [ 5 | { 6 | "Email": "dhruv8sh@proton.me", 7 | "Name": "Dhruvesh Surolia" 8 | } 9 | ], 10 | "Category": "Windows and Tasks", 11 | "Description": "Shows the application title and icon of the active window", 12 | "Icon": "preferences-desktop", 13 | "Id": "org.kde.windowtitle", 14 | "License": "GPLv2", 15 | "Name": "Window Title", 16 | "Version": "0.9.0", 17 | "Website": "https://github.com/dhruv8sh/plasma6-window-title-applet" 18 | }, 19 | "Keyword": "window title icon", 20 | "X-Plasma-API-Minimum-Version": "6.0" 21 | } 22 | --------------------------------------------------------------------------------