├── CONTRIBUTING.md ├── CREDITS.md ├── LICENSE ├── README.md ├── install.sh └── src ├── LICENSE ├── application.js ├── constants.js ├── extension.js ├── metadata.json ├── prefs.js ├── schemas ├── gschemas.compiled └── org.gnome.shell.extensions.workspaces-indicator-by-open-apps.gschema.xml ├── stylesheet.css └── workspace.js /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thank you for considering contributing to this project! 4 | 5 | ## Commit Message Convention 6 | 7 | Please follow the commit message format for the commits. Each commit message should consist of a type, scope (optional), and a summary: `type(scope): summary`. 8 | 9 | - Type: `build`, `feat`, `fix`, `refactor`, `docs`, `test`, `chore` 10 | - Scope: The affected component or module: `extension` or `settings` 11 | - Summary: A brief description of the change 12 | 13 | Example: `feat(extension): add drag and drop feature` 14 | 15 | ## Code Style 16 | 17 | Please make sure to follow the existing code style and conventions when making changes to the codebase. Some guidelines: 18 | 19 | - use 2 spaces for indentation 20 | - use double quotes for strings (`"example"`) 21 | - do not use semicolons (`;`) at the end of the line 22 | - use snake case for variable and function names (`my_variable`, `my_function()`) 23 | - the name of each _"private"_ function should start with an underscore (`_my_function()`) 24 | - add a comment before each function explaining its purpose (JSDoc style) 25 | - limit the use of ternary operators (`?`) to the minimum 26 | 27 | ## Pull requests 28 | 29 | Pull requests are **always** welcome. When you are ready to submit a pull request, just open one. 30 | 31 | ## License 32 | 33 | By contributing to this project, you agree that your contributions will be licensed under the [GPLv3](LICENSE) license. 34 | -------------------------------------------------------------------------------- /CREDITS.md: -------------------------------------------------------------------------------- 1 | # Credits 2 | 3 | This GNOME shell extension was developed with inspiration _(and using code snippets)_ from various sources: 4 | 5 | - [BaBar taskbar](https://github.com/fthx/babar) by @fthx and other fthx's extensions 6 | - [TaskIcons](https://github.com/rliang/gnome-shell-extension-task-icons) by @rliang 7 | - [Improved workspace indicator](https://github.com/MichaelAquilina/improved-workspace-indicator) by @MichaelAquilina 8 | - [New workspaces shortcut](https://github.com/barnscott/newworkspaceshortcut-barnix.io) by @barnscott 9 | - [AppIndicator Support](https://github.com/ubuntu/gnome-shell-extension-appindicator) by @ubuntu 10 | - [Top Panel Workspace Scroll](https://github.com/timbertson/gnome-shell-scroll-workspaces) by @timbertson 11 | - [Focus follows forkspace](https://github.com/christopher-l/focus-follows-workspace) by @christopher-l 12 | 13 | Thanks to all the authors! 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | GNOME shell extension Workspaces by open apps 635 | Copyright (C) 2024 Luca Favini 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Workspaces by open apps Copyright (C) 2024 Luca Favini 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Workspace indicator by open apps 2 | 3 | Get it on GNOME Extensions 4 | 5 | **GNOME shell estension** to display a simple **workspace indicator** showing **icons of apps open** in it instead of classic numbers or dots. 6 | 7 | Preview 8 | 9 | ## Features 10 | 11 | - Show a simple indicator to **display workspaces** and **apps open** in it 12 | - Support for **drag and drop**: change an application workspace just dragging its icon 13 | - **Right/Left** click to focus/minimize application, **Middle click** to close 14 | - **Workspaces scrolling**: change active workspace scrolling hover the indicator 15 | - Support for **multiple monitor** _(for both static and dynamic workspaces)_ 16 | - **Rename workspaces** directly from the extension _(activate in settings)_ 17 | - Hide/show **GNOME default workspace indicator** (former activities button) 18 | 19 | ## Customization 20 | 21 | - Indicator **position** 22 | - Mouse **scroll** direction (normal or inverse) 23 | - Activate/deactivate "**middle click** to close app" 24 | - Activate/deactivate "**click on active workspace to overview**" 25 | - Activate/deactivate "**click on focused application to minimize**" 26 | - Activate/deactivate "**workspace indicator**" 27 | - Activate/deactivate "**app indicator**" 28 | - Customize indicator **color** 29 | - Activate/deactivate "**round borders**" 30 | - Show/Hide **workspaces names** 31 | - Show/Hide **empty** workspaces 32 | - Customize apps on all workspaces **text indicator** 33 | - **Desaturate** all icons 34 | - **No effect**/**Reduce opacity**/**Desaturate** for both **minimized** and **inactive** apps 35 | - **Limit icons** per workspace 36 | - **Group icons** of same application 37 | - **Ignore** applications (with regex) 38 | - **Spacing** and **Size** of applications icons and labels 39 | 40 | > [!TIP] 41 | > Customize CSS editing `stylesheet.css` file. Add more classes simply searching `css_*` variables in `extension.js`. 42 | 43 | > [!WARNING] 44 | > Centering vertically the labels independently from the font used is problematic. Tweak `.wboa-label` classes in `stylesheet.css` to adjust it. 45 | 46 | Preview 47 | 48 | Preview 49 | 50 | Preview 51 | 52 | Preview 53 | 54 | Preview 55 | 56 | Preview 57 | 58 | Preview 59 | 60 | ## Installation 61 | 62 | Available for **GNOME 45, 46, 47**: [gnome shell extensions store](https://extensions.gnome.org/extension/5967/workspaces-indicator-by-open-apps/). 63 | 64 | > [!TIP] 65 | > _Legacy versions (GNOME shell 40-44) available on gnome extensions store. These versions will not receive new updates._ 66 | 67 | ### Manual installation 68 | 69 | - Download the extension folder _(this repository)_ 70 | - Execute `./install.sh` _(requires sudo priviledges)_ 71 | 72 | ### Useful commands 73 | 74 | - Compile settings schema: `glib-compile-schemas ./schemas/` 75 | - Show (all) extension(s) logs: `journalctl /usr/bin/gnome-shell -f -o cat` 76 | - Show settings logs: `journalctl /usr/bin/gjs -f -o cat` 77 | - List settings: `dconf dump /org/gnome/shell/extensions/workspaces-indicator-by-open-apps/` 78 | - Edit manually setting: `dconf write /org/gnome/shell/extensions/workspaces-indicator-by-open-apps/ ` 79 | 80 | ## To Do 81 | 82 | _See [issues](https://github.com/Favo02/workspaces-by-open-apps/issues) page._ 83 | 84 | ## Contributions 85 | 86 | _See [CONTRIBUTING.md](CONTRIBUTING.md) file._ 87 | 88 | ## Credits 89 | 90 | _See [CREDITS.md](CREDITS.md) file._ 91 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASE_PATH="$(dirname "$(realpath "$0")")" 4 | 5 | # If XDG_DATA_HOME is not set, guess its path 6 | if [[ -z "$XDG_DATA_HOME" ]]; then 7 | XDG_DATA_HOME="$HOME/.local/share" 8 | fi 9 | 10 | ALL_EXTENSIONS_PATH="$XDG_DATA_HOME/gnome-shell/extensions" 11 | EXTENSION_NAME="workspaces-by-open-apps@favo02.github.com" 12 | EXTENSION_PATH="$ALL_EXTENSIONS_PATH/$EXTENSION_NAME" 13 | 14 | echo "Extension directory path: $EXTENSION_PATH" 15 | 16 | # Ensure that extensions directory exists 17 | if [ ! -d "$ALL_EXTENSIONS_PATH" ]; then 18 | echo "Extension directory not found. Exiting." 19 | exit 1 20 | fi 21 | 22 | echo "Removing the extension directory..." 23 | 24 | # Remove current extension version 25 | rm -rf "$EXTENSION_PATH" 26 | 27 | # If 'rm' failed, exit 28 | if [ $? -ne 0 ]; then 29 | echo "Removal of the extension directory failed. Exiting." 30 | exit 1 31 | fi 32 | 33 | echo "Copying src/ directory to the extension directory..." 34 | 35 | # Copy to extensions folder 36 | cp -r "$BASE_PATH/src" "$EXTENSION_PATH" 37 | 38 | if [ $? -ne 0 ]; then 39 | echo "Copying files failed. Exiting." 40 | exit 1 41 | fi 42 | 43 | echo "Extension updated. Please restart GNOME Shell to apply changes (logout)." 44 | -------------------------------------------------------------------------------- /src/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | GNOME shell extension Workspaces by open apps 635 | Copyright (C) 2024 Luca Favini 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Workspaces by open apps Copyright (C) 2024 Luca Favini 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /src/application.js: -------------------------------------------------------------------------------- 1 | import Clutter from "gi://Clutter" 2 | import St from "gi://St" 3 | import Shell from "gi://Shell" 4 | import GObject from "gi://GObject" 5 | import * as dnd from "resource:///org/gnome/shell/ui/dnd.js" 6 | import CONSTANTS from "./constants.js" 7 | 8 | /** 9 | * indicator for a application (with x{occurrences} label if needed) 10 | */ 11 | export default class Application extends St.BoxLayout { 12 | static { 13 | GObject.registerClass(this) 14 | } 15 | 16 | constructor(settings, index, window, occurrences, app_icon, css_inline_app, css_classes_app) { 17 | super({ 18 | style: css_inline_app, 19 | style_class: css_classes_app.join(" "), 20 | reactive: true, 21 | can_focus: true, 22 | track_hover: true 23 | }) 24 | 25 | this._settings = settings 26 | this._index = index 27 | this._window = window 28 | 29 | // setup signals 30 | this._setup_signals() 31 | 32 | // setup drag and drop 33 | this._setup_drag_and_drop() 34 | 35 | // add icon texture to icon button 36 | this.add_child(app_icon) 37 | 38 | // add x{occurrences} label to icon button (group same application) 39 | this._render_occurrences_label(occurrences, window) 40 | } 41 | 42 | /** 43 | * setup signals: click, touch 44 | */ 45 | _setup_signals() { 46 | this.connect("button-release-event", this._on_click_application.bind(this)) 47 | this.connect("touch-event", this._on_touch_application.bind(this)) 48 | } 49 | 50 | /** 51 | * setup drag and drop for workspace and application indicators 52 | */ 53 | _setup_drag_and_drop() { 54 | this._delegate = this 55 | this._draggable = dnd.makeDraggable(this, { dragActorOpacity: CONSTANTS.LOW_OPACITY }) 56 | } 57 | 58 | /** 59 | * add x{occurrences} label to icon button (group same application) 60 | * @param {Map} occurrences 61 | */ 62 | _render_occurrences_label(occurrences, window) { 63 | 64 | const css_style_text = `font-size: ${this._settings.size_labels}px` 65 | const css_classes_text = [ "wboa-label" ] 66 | 67 | if ((this._settings.icons_group === 1) && (occurrences.get(window.app_id).count > 1)) { 68 | this.add_child(new St.Label({ 69 | style: css_style_text, 70 | style_class: css_classes_text.join(" "), 71 | y_align: Clutter.ActorAlign.CENTER, 72 | text: `x${occurrences.get(window.app_id).count}` 73 | })) 74 | } 75 | } 76 | 77 | /** 78 | * click on application icon handler 79 | * @param _ actor clicked (unused) 80 | * @param event click event 81 | */ 82 | _on_click_application(_, event) { 83 | // left/right click: focus or minimize application 84 | if (event.get_button() === CONSTANTS.LEFT_CLICK || event.get_button() === CONSTANTS.RIGHT_CLICK) { 85 | 86 | // focused and setting on: minimize 87 | if (this._window.has_focus() && this._settings.click_on_focus_minimize) { 88 | this._window.minimize(Shell.Global.get().get_current_time()) 89 | } 90 | // not focused or setting off: focus 91 | else { 92 | this._window.activate(Shell.Global.get().get_current_time()) 93 | } 94 | } 95 | 96 | // middle click: close application 97 | if (this._settings.middle_click_close_app && event.get_button() === CONSTANTS.MIDDLE_CLICK) { 98 | this._window.delete(Shell.Global.get().get_current_time()) 99 | } 100 | } 101 | 102 | /** touch on application handler */ 103 | _on_touch_application() { 104 | this._window.activate(Shell.Global.get().get_current_time()) 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /src/constants.js: -------------------------------------------------------------------------------- 1 | export default { 2 | PANEL_BOX: { 3 | 0: "_leftBox", 4 | 1: "_centerBox", 5 | 2: "_rightBox" 6 | }, 7 | OFF: 0, 8 | REDUCE_OPACITY: 1, 9 | DESATURATE: 2, 10 | NO_LIMIT: 100, 11 | LOW_OPACITY: 175, 12 | LEFT_CLICK: 1, 13 | MIDDLE_CLICK: 2, 14 | RIGHT_CLICK: 3 15 | } 16 | -------------------------------------------------------------------------------- /src/extension.js: -------------------------------------------------------------------------------- 1 | import St from "gi://St" 2 | import Shell from "gi://Shell" 3 | import * as main from "resource:///org/gnome/shell/ui/main.js" 4 | import { Extension } from "resource:///org/gnome/shell/extensions/extension.js" 5 | import CONSTANTS from "./constants.js" 6 | import Workspace from "./workspace.js" 7 | 8 | // extension workspace indicator 9 | export default class WorkspacesByOpenApps extends Extension { 10 | 11 | /** 12 | * enable extension: initialize everything, connect signals and trigger first render 13 | * */ 14 | enable() { 15 | // initialize settings 16 | this._update_settings(this.getSettings(), false) // no re-render 17 | 18 | // create container and insert in panel 19 | this._container = new St.BoxLayout() 20 | const box = CONSTANTS.PANEL_BOX[this._settings.position_in_panel] 21 | main.panel[box].insert_child_at_index(this._container, this._settings.position_index) 22 | 23 | // connect signals and first render 24 | this._connect_signals() 25 | this._render() 26 | } 27 | 28 | /** 29 | * disable extension: destroy everything and disconnect signals 30 | * */ 31 | disable() { 32 | this._disconnect_signals() // disconnect signals 33 | 34 | main.panel.statusArea["activities"]?.show() // restore activities 35 | 36 | this._settings = null 37 | this._container.destroy() 38 | this._container = null 39 | } 40 | 41 | /** 42 | * update settings: update this._settings, hide/show activities button and re-render 43 | * @param {Gio.Settings} rs raw settings 44 | * @param {boolean} render if re-render is needed 45 | */ 46 | _update_settings(rs, render) { 47 | this._settings = { 48 | position_in_panel: rs.get_enum("position-in-panel"), 49 | position_index: rs.get_int("position-index"), 50 | hide_activities_button: rs.get_boolean("hide-activities-button"), 51 | 52 | scroll_enable: rs.get_boolean("scroll-enable"), 53 | scroll_wraparound: rs.get_boolean("scroll-wraparound"), 54 | scroll_inverse: rs.get_boolean("scroll-inverse"), 55 | middle_click_close_app: rs.get_boolean("middle-click-close-app"), 56 | click_on_active_overview: rs.get_boolean("click-on-active-overview"), 57 | click_on_focus_minimize: rs.get_boolean("click-on-focus-minimize"), 58 | 59 | indicator_show_active_workspace: rs.get_boolean("indicator-show-active-workspace"), 60 | indicator_show_focused_app: rs.get_boolean("indicator-show-focused-app"), 61 | indicator_color: rs.get_string("indicator-color"), 62 | indicator_round_borders: rs.get_boolean("indicator-round-borders"), 63 | indicator_swap_position: rs.get_boolean("indicator-swap-position"), 64 | 65 | indicator_show_indexes: rs.get_boolean("indicator-show-indexes"), 66 | indicator_hide_empty: rs.get_boolean("indicator-hide-empty"), 67 | indicator_all_text: rs.get_string("indicator-all-text"), 68 | indicator_use_custom_names: rs.get_boolean("indicator-use-custom-names"), 69 | 70 | apps_symbolic_icons: rs.get_boolean("apps-symbolic-icons"), 71 | apps_all_desaturate: rs.get_boolean("apps-all-desaturate"), 72 | apps_inactive_effect: rs.get_enum("apps-inactive-effect"), 73 | apps_minimized_effect: rs.get_enum("apps-minimized-effect"), 74 | 75 | icons_limit: rs.get_int("icons-limit"), 76 | icons_group: rs.get_enum("icons-group"), 77 | icons_ignored: rs.get_strv("icons-ignored"), 78 | log_apps_id: rs.get_boolean("log-apps-id"), 79 | 80 | size_app_icon: rs.get_int("size-app-icon"), 81 | size_labels: rs.get_int("size-labels"), 82 | 83 | spacing_workspace_left: rs.get_int("spacing-workspace-left"), 84 | spacing_workspace_right: rs.get_int("spacing-workspace-right"), 85 | 86 | spacing_label_left: rs.get_int("spacing-label-left"), 87 | spacing_label_right: rs.get_int("spacing-label-right"), 88 | spacing_label_top: rs.get_int("spacing-label-top"), 89 | spacing_label_bottom: rs.get_int("spacing-label-bottom"), 90 | 91 | spacing_app_left: rs.get_int("spacing-app-left"), 92 | spacing_app_right: rs.get_int("spacing-app-right") 93 | } 94 | 95 | // hide activities button 96 | if (this._settings.hide_activities_button) 97 | main.panel.statusArea["activities"]?.hide() 98 | else 99 | main.panel.statusArea["activities"]?.show() 100 | 101 | if (render) { 102 | // disabling and enabling the extension is needed for settings that change 103 | // the indicator position, such as position_in_panel and position_index 104 | this.disable() 105 | this.enable() 106 | } 107 | } 108 | 109 | /** 110 | * connect signals that triggers a re-render of indicators 111 | * */ 112 | _connect_signals() { 113 | const workspace_manager = Shell.Global.get().get_workspace_manager() 114 | this._sig_wm1 = workspace_manager.connect("active-workspace-changed", () => this._render()) 115 | this._sig_wm2 = workspace_manager.connect("showing-desktop-changed", () => this._render()) 116 | this._sig_wm3 = workspace_manager.connect("workspace-added", () => this._render()) 117 | this._sig_wm4 = workspace_manager.connect("workspace-removed", () => this._render()) 118 | this._sig_wm5 = workspace_manager.connect("workspace-switched", () => this._render()) 119 | this._sig_wm6 = workspace_manager.connect("workspaces-reordered", () => this._render()) 120 | 121 | const window_tracker = Shell.WindowTracker.get_default() 122 | this._sig_wt1 = window_tracker.connect("tracked-windows-changed", () => this._render()) 123 | 124 | const display = Shell.Global.get().get_display() 125 | this._sig_dp1 = display.connect("restacked", () => this._render()) 126 | this._sig_dp2 = display.connect("window-left-monitor", () => this._render()) 127 | this._sig_dp3 = display.connect("window-entered-monitor", () => this._render()) 128 | 129 | const raw_settings = this.getSettings() 130 | this._sig_sett = raw_settings.connect("changed", () => this._update_settings(raw_settings, true)) 131 | } 132 | 133 | /** 134 | * disconnect signals 135 | * */ 136 | _disconnect_signals() { 137 | const workspace_manager = Shell.Global.get().get_workspace_manager() 138 | workspace_manager.disconnect(this._sig_wm1) 139 | workspace_manager.disconnect(this._sig_wm2) 140 | workspace_manager.disconnect(this._sig_wm3) 141 | workspace_manager.disconnect(this._sig_wm4) 142 | workspace_manager.disconnect(this._sig_wm5) 143 | workspace_manager.disconnect(this._sig_wm6) 144 | 145 | const window_tracker = Shell.WindowTracker.get_default() 146 | window_tracker.disconnect(this._sig_wt1) 147 | 148 | const display = Shell.Global.get().get_display() 149 | display.disconnect(this._sig_dp1) 150 | display.disconnect(this._sig_dp2) 151 | display.disconnect(this._sig_dp3) 152 | 153 | const raw_settings = this.getSettings() 154 | raw_settings.disconnect(this._sig_sett) 155 | } 156 | 157 | /** 158 | * render indicators: destroy current indicators and rebuild 159 | * */ 160 | _render() { 161 | this._container.destroy_all_children() 162 | 163 | // build indicator for other monitor 164 | const other_monitor = this._render_workspace(0, true) 165 | if (other_monitor) { 166 | this._container.add_child(other_monitor) 167 | } 168 | 169 | // build normal workspaces indicators 170 | for (let i = 0; i < Shell.Global.get().get_workspace_manager().get_n_workspaces(); i++) { 171 | const workspace = this._render_workspace(i, false) 172 | if (workspace) { 173 | this._container.add_child(workspace) 174 | } 175 | } 176 | } 177 | 178 | /** 179 | * create indicator for a single workspace 180 | * @param {number} index index of workspace 181 | * @param {boolean} is_other_monitor special indicator for other monitor 182 | * @returns {Workspace} workspace indicator 183 | */ 184 | _render_workspace(index, is_other_monitor) { 185 | const workspace = Shell.Global.get().get_workspace_manager().get_workspace_by_index(index) 186 | 187 | const windows = workspace 188 | .list_windows() 189 | // filter out apps 190 | .filter(win => { 191 | // undefined window 192 | if (!win) return false 193 | 194 | // undefined app 195 | const app = Shell.WindowTracker.get_default().get_window_app(win) 196 | if (!app) return false 197 | 198 | // store app id on window 199 | win.app_id = app.get_id() 200 | 201 | // apps on all workspaces (for normal workspace indicator) 202 | if (!is_other_monitor && win.is_on_all_workspaces()) return false 203 | 204 | // apps NOT on all workspaces (for other monitor indicator) 205 | if (is_other_monitor && !win.is_on_all_workspaces()) return false 206 | 207 | // ignored in settings (regex match) 208 | const matches = this._settings.icons_ignored.filter(ignored => new RegExp(ignored, "i").test(app.get_id())) 209 | if (matches.length > 0) { 210 | // debug log ignored app id 211 | if (this._settings.log_apps_id) { 212 | console.log(`IGNORED ${app.get_id()}`) 213 | } 214 | return false 215 | } 216 | 217 | // dialogs, popovers and tooltip (only if not focused) 218 | if (!win.has_focus() && win.is_skip_taskbar()) return false 219 | 220 | // debug log app id 221 | if (this._settings.log_apps_id) { 222 | console.log(app.get_id()) 223 | } 224 | 225 | return true 226 | }) 227 | 228 | // hide other monitor indicator if no windows on all workspaces 229 | if (is_other_monitor && windows.length === 0) return 230 | 231 | const is_active = !is_other_monitor && Shell.Global.get().get_workspace_manager().get_active_workspace_index() === index 232 | 233 | // hide empty workspaces 234 | if (this._settings.indicator_hide_empty && !is_active && windows.length === 0) return 235 | 236 | const css_inline_workspace = ` 237 | border-color: ${this._settings.indicator_color}; 238 | margin-left: ${this._settings.spacing_workspace_left}px; 239 | margin-right: ${this._settings.spacing_workspace_right}px; 240 | ` 241 | 242 | const css_classes_workspace = ["wboa-workspace"] 243 | if (this._settings.indicator_swap_position) { 244 | css_classes_workspace.push("wboa-top") 245 | } else { 246 | css_classes_workspace.push("wboa-bottom") 247 | } 248 | if (is_active) css_classes_workspace.push("wboa-active") 249 | if (!this._settings.indicator_show_active_workspace) css_classes_workspace.push("wboa-no-indicator") 250 | if (this._settings.indicator_round_borders) css_classes_workspace.push("wboa-rounded") 251 | 252 | const css_classes_panel = ["panel-button", "wboa-panel-rounded"] 253 | if (!this._settings.indicator_round_borders) css_classes_panel.push("wboa-no-rounded") 254 | 255 | return new Workspace(this._settings, workspace, windows, index, is_active, is_other_monitor, css_classes_panel, css_inline_workspace, css_classes_workspace) 256 | } 257 | 258 | } 259 | -------------------------------------------------------------------------------- /src/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Workspaces indicator by open apps", 3 | "description": "Display a simple workspace indicator showing icons of apps open in it.\n\nFeatures:\n\n- Show a simple indicator to display workspaces and apps open in it\n- Support for drag and drop: change an application workspace just dragging its icon\n- Right/Left click to focus/minimize application, Middle click to close\n- Workspaces scrolling: change active workspace scrolling hover the indicator\n- Support for multiple monitor (for both static and dynamic workspaces)\n- Rename workspaces directly from the extension (activate in settings)\n- Hide/show GNOME default workspace indicator (former activities button)\n\nCustomization:\n\n- Indicator position\n- Mouse scroll direction (normal or inverse)\n- Activate/deactivate 'middle click to close app'\n- Activate/deactivate 'click on active workspace to overview'\n- Activate/deactivate 'click on focused application to minimize'\n- Activate/deactivate 'workspace indicator'\n- Activate/deactivate 'app indicator'\n- Customize indicator color\n- Activate/deactivate 'round borders'\n- Show/Hide workspaces names\n- Show/Hide empty workspaces\n- Customize apps on all workspaces text indicator\n- Desaturate all icons\n- No effect/Reduce opacity/Desaturate for both minimized and inactive apps\n- Limit icons per workspace\n- Group icons of same application\n- Ignore applications (with regex)\n- Spacing and Size of applications icons and labels", 4 | "uuid": "workspaces-by-open-apps@favo02.github.com", 5 | "settings-schema": "org.gnome.shell.extensions.workspaces-indicator-by-open-apps", 6 | "url": "https://github.com/Favo02/workspaces-by-open-apps", 7 | "version": "20", 8 | "shell-version": [ "45", "46", "47", "48" ] 9 | } 10 | -------------------------------------------------------------------------------- /src/prefs.js: -------------------------------------------------------------------------------- 1 | import Adw from "gi://Adw" 2 | import Gio from "gi://Gio" 3 | import Gtk from "gi://Gtk" 4 | import Gdk from "gi://Gdk" 5 | import { ExtensionPreferences } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js" 6 | 7 | export default class WorkspacesByOpenAppsPrefs extends ExtensionPreferences { 8 | 9 | fillPreferencesWindow(window) { 10 | window.set_search_enabled(true) 11 | window.set_default_size(1000, 800) 12 | 13 | const settings = this.getSettings() 14 | 15 | // page1: position and behavior 16 | const page1 = new Adw.PreferencesPage({ 17 | name: "page1", 18 | title: "Position and Behavior", 19 | icon_name: "preferences-other-symbolic" 20 | }) 21 | page1.add(this._page1_group1(settings)) 22 | page1.add(this._page1_group2(settings)) 23 | page1.add(this._info_label()) 24 | 25 | // page2: appearance 26 | const page2 = new Adw.PreferencesPage({ 27 | name: "page2", 28 | title: "Appearance", 29 | icon_name: "applications-graphics-symbolic" 30 | }) 31 | page2.add(this._page2_group1(settings)) 32 | page2.add(this._page2_group2(settings)) 33 | page2.add(this._page2_group3(settings)) 34 | page2.add(this._page2_group4(settings)) 35 | page2.add(this._info_label()) 36 | 37 | // page3: hide and ignore apps 38 | const page3 = new Adw.PreferencesPage({ 39 | name: "page3", 40 | title: "Hide and ignore apps", 41 | icon_name: "edit-clear-all-symbolic" 42 | }) 43 | page3.add(this._page3_group1(settings)) 44 | // these groups needs to be saved to be updated (removed and readded) when a new app is ignored 45 | let p3g2 = this._page3_group2(settings) 46 | const p3g3 = this._page3_group3(settings) 47 | const label = this._info_label() 48 | page3.add(p3g2) 49 | page3.add(p3g3) 50 | page3.add(label) 51 | settings.connect("changed::icons-ignored", () => { 52 | // remove old groups (only p3g2 needs to be update but all groups below him needs to be removed) 53 | page3.remove(p3g2) 54 | page3.remove(p3g3) 55 | page3.remove(label) 56 | 57 | // update p3g2 58 | p3g2 = this._page3_group2(settings) 59 | 60 | // readd groups (they need to be added in this order, same as before) 61 | page3.add(p3g2) 62 | page3.add(p3g3) 63 | page3.add(label) 64 | }) 65 | 66 | // page4: about 67 | const page4 = new Adw.PreferencesPage({ 68 | name: "page4", 69 | title: "About", 70 | icon_name: "help-about-symbolic" 71 | }) 72 | page4.add(this._about_page()) 73 | page4.add(this._star_label()) 74 | 75 | window.add(page1) 76 | window.add(page2) 77 | window.add(page3) 78 | window.add(page4) 79 | } 80 | 81 | _page1_group1(settings) { 82 | const group = new Adw.PreferencesGroup({ 83 | title: "Position", 84 | description: "" 85 | }) 86 | 87 | let row, widget 88 | 89 | row = new Adw.ActionRow({ 90 | title: "Panel position", 91 | subtitle: "Panel to show the indicator in" 92 | }) 93 | widget = new Gtk.ComboBoxText({ 94 | valign: Gtk.Align.CENTER 95 | }) 96 | widget.append("LEFT", "Left") 97 | widget.append("CENTER", "Center") 98 | widget.append("RIGHT", "Right") 99 | settings.bind("position-in-panel", widget, "active-id", Gio.SettingsBindFlags.DEFAULT) 100 | row.add_suffix(widget) 101 | row.activatable_widget = widget 102 | group.add(row) 103 | 104 | row = new Adw.ActionRow({ 105 | title: "Position index", 106 | subtitle: "Number of other elements in the panel before the indicator" 107 | }) 108 | widget = new Gtk.SpinButton({ 109 | valign: Gtk.Align.CENTER 110 | }) 111 | widget.set_sensitive(true) 112 | widget.set_range(0, 50) 113 | widget.set_value(settings.get_int("position-index")) 114 | widget.set_increments(1, 2) 115 | widget.connect("value-changed", w => { settings.set_int("position-index", w.get_value_as_int()) }) 116 | row.add_suffix(widget) 117 | row.activatable_widget = widget 118 | group.add(row) 119 | 120 | row = new Adw.ActionRow({ 121 | title: "Hide GNOME workspace indicator", 122 | subtitle: "Hide GNOME default workspace indicator (formerly \"Activities\" button)" 123 | }) 124 | widget = new Gtk.Switch({ 125 | valign: Gtk.Align.CENTER 126 | }) 127 | settings.bind("hide-activities-button", widget, "active", Gio.SettingsBindFlags.DEFAULT) 128 | row.add_suffix(widget) 129 | row.activatable_widget = widget 130 | group.add(row) 131 | 132 | return group 133 | } 134 | 135 | _page1_group2(settings) { 136 | const group = new Adw.PreferencesGroup({ 137 | title: "Behavior", 138 | description: "" 139 | }) 140 | 141 | let row, widget 142 | 143 | row = new Adw.ActionRow({ 144 | title: "Enable scroll", 145 | subtitle: "Change workspace by scrolling the mouse wheel (or touchpad gesture) over the indicator" 146 | }) 147 | widget = new Gtk.Switch({ 148 | valign: Gtk.Align.CENTER 149 | }) 150 | settings.bind("scroll-enable", widget, "active", Gio.SettingsBindFlags.DEFAULT) 151 | row.add_suffix(widget) 152 | row.activatable_widget = widget 153 | group.add(row) 154 | 155 | row = new Adw.ActionRow({ 156 | title: "Scroll wraparound", 157 | subtitle: "Scrolling past the last workspace will wrap around to the first one (and viceversa)" 158 | }) 159 | widget = new Gtk.Switch({ 160 | valign: Gtk.Align.CENTER 161 | }) 162 | settings.bind("scroll-wraparound", widget, "active", Gio.SettingsBindFlags.DEFAULT) 163 | row.add_suffix(widget) 164 | row.activatable_widget = widget 165 | group.add(row) 166 | 167 | row = new Adw.ActionRow({ 168 | title: "Inverse scroll", 169 | subtitle: "Invert the direction of scrolling" 170 | }) 171 | widget = new Gtk.Switch({ 172 | valign: Gtk.Align.CENTER 173 | }) 174 | settings.bind("scroll-inverse", widget, "active", Gio.SettingsBindFlags.DEFAULT) 175 | row.add_suffix(widget) 176 | row.activatable_widget = widget 177 | group.add(row) 178 | 179 | row = new Adw.ActionRow({ 180 | title: "Middle click closes app", 181 | subtitle: "Clicking with the middle mouse button on an app icon will close the app" 182 | }) 183 | widget = new Gtk.Switch({ 184 | valign: Gtk.Align.CENTER 185 | }) 186 | settings.bind("middle-click-close-app", widget, "active", Gio.SettingsBindFlags.DEFAULT) 187 | row.add_suffix(widget) 188 | row.activatable_widget = widget 189 | group.add(row) 190 | 191 | row = new Adw.ActionRow({ 192 | title: "Click on current workspace triggers overview", 193 | subtitle: "Clicking on the current active workspace will trigger the overview" 194 | }) 195 | widget = new Gtk.Switch({ 196 | valign: Gtk.Align.CENTER 197 | }) 198 | settings.bind("click-on-active-overview", widget, "active", Gio.SettingsBindFlags.DEFAULT) 199 | row.add_suffix(widget) 200 | row.activatable_widget = widget 201 | group.add(row) 202 | 203 | row = new Adw.ActionRow({ 204 | title: "Click on focused application to minimize", 205 | subtitle: "Clicking on the current focused application will minimize it" 206 | }) 207 | widget = new Gtk.Switch({ 208 | valign: Gtk.Align.CENTER 209 | }) 210 | settings.bind("click-on-focus-minimize", widget, "active", Gio.SettingsBindFlags.DEFAULT) 211 | row.add_suffix(widget) 212 | row.activatable_widget = widget 213 | group.add(row) 214 | 215 | return group 216 | } 217 | 218 | _page2_group1(settings) { 219 | const group = new Adw.PreferencesGroup({ 220 | title: "Indicator appearance", 221 | description: "" 222 | }) 223 | 224 | let row, widget 225 | 226 | row = new Adw.ActionRow({ 227 | title: "Active workspace indicator", 228 | subtitle: "Show an indicator below the current active workspace" 229 | }) 230 | widget = new Gtk.Switch({ 231 | valign: Gtk.Align.CENTER 232 | }) 233 | settings.bind("indicator-show-active-workspace", widget, "active", Gio.SettingsBindFlags.DEFAULT) 234 | row.add_suffix(widget) 235 | row.activatable_widget = widget 236 | group.add(row) 237 | 238 | row = new Adw.ActionRow({ 239 | title: "Focused app indicator", 240 | subtitle: "Show an indicator above the current focused app" 241 | }) 242 | widget = new Gtk.Switch({ 243 | valign: Gtk.Align.CENTER 244 | }) 245 | settings.bind("indicator-show-focused-app", widget, "active", Gio.SettingsBindFlags.DEFAULT) 246 | row.add_suffix(widget) 247 | row.activatable_widget = widget 248 | group.add(row) 249 | 250 | row = new Adw.ActionRow({ 251 | title: "Indicators color", 252 | subtitle: "Color of active workspace and focused app indicators" 253 | }) 254 | const rgba = new Gdk.RGBA() 255 | rgba.parse(settings.get_string("indicator-color")) 256 | widget = new Gtk.ColorButton({ 257 | rgba: rgba, 258 | show_editor: true, 259 | use_alpha: true, 260 | visible: true, 261 | valign: Gtk.Align.CENTER 262 | }) 263 | widget.connect("color-set", w => { settings.set_string("indicator-color", w.get_rgba().to_string()) }) 264 | row.add_suffix(widget) 265 | row.activatable_widget = widget 266 | group.add(row) 267 | 268 | row = new Adw.ActionRow({ 269 | title: "Round indicators borders", 270 | subtitle: "Round borders of active workspace and focused app indicators" 271 | }) 272 | widget = new Gtk.Switch({ 273 | valign: Gtk.Align.CENTER 274 | }) 275 | settings.bind("indicator-round-borders", widget, "active", Gio.SettingsBindFlags.DEFAULT) 276 | row.add_suffix(widget) 277 | row.activatable_widget = widget 278 | group.add(row) 279 | 280 | row = new Adw.ActionRow({ 281 | title: "Swap indicators position", 282 | subtitle: "Move active app indicator to bottom and active workspace to top. This could break centering of labels, fix it manually using Spacing settings below." 283 | }) 284 | widget = new Gtk.Switch({ 285 | valign: Gtk.Align.CENTER 286 | }) 287 | settings.bind("indicator-swap-position", widget, "active", Gio.SettingsBindFlags.DEFAULT) 288 | row.add_suffix(widget) 289 | row.activatable_widget = widget 290 | group.add(row) 291 | 292 | return group 293 | } 294 | 295 | _page2_group2(settings) { 296 | const group = new Adw.PreferencesGroup({ 297 | title: "Workspaces appearance", 298 | description: "" 299 | }) 300 | 301 | let row, widget 302 | 303 | row = new Adw.ActionRow({ 304 | title: "Show workspace names", 305 | subtitle: "Show the workspace names before the workspace icons" 306 | }) 307 | widget = new Gtk.Switch({ 308 | valign: Gtk.Align.CENTER 309 | }) 310 | settings.bind("indicator-show-indexes", widget, "active", Gio.SettingsBindFlags.DEFAULT) 311 | row.add_suffix(widget) 312 | row.activatable_widget = widget 313 | group.add(row) 314 | 315 | row = new Adw.ActionRow({ 316 | title: "Hide empty workspaces indicator", 317 | subtitle: "Hides the name of empty workspaces" 318 | }) 319 | widget = new Gtk.Switch({ 320 | valign: Gtk.Align.CENTER 321 | }) 322 | settings.bind("indicator-hide-empty", widget, "active", Gio.SettingsBindFlags.DEFAULT) 323 | row.add_suffix(widget) 324 | row.activatable_widget = widget 325 | group.add(row) 326 | 327 | row = new Adw.ActionRow({ 328 | title: "Apps on all workspaces indicator text", 329 | subtitle: "Text indicator to show when there are apps on all workspaces" 330 | }) 331 | widget = new Gtk.Entry({ 332 | halign: Gtk.Align.END, 333 | valign: Gtk.Align.CENTER, 334 | hexpand: true, 335 | xalign: 0, 336 | }) 337 | widget.set_text(settings.get_string("indicator-all-text")) 338 | widget.connect("changed", w => { 339 | if (w.get_text().length > 0) { 340 | settings.set_string("indicator-all-text", w.get_text()) 341 | } else { 342 | settings.set_string("indicator-all-text", "ALL") 343 | } 344 | }) 345 | row.add_suffix(widget) 346 | row.activatable_widget = widget 347 | group.add(row) 348 | 349 | row = new Adw.ActionRow({ 350 | title: "Use custom names for workspaces", 351 | subtitle: "Display custom (editable by rigth click on workspace) names instead of indexes" 352 | }) 353 | widget = new Gtk.Switch({ 354 | valign: Gtk.Align.CENTER 355 | }) 356 | settings.bind("indicator-use-custom-names", widget, "active", Gio.SettingsBindFlags.DEFAULT) 357 | row.add_suffix(widget) 358 | row.activatable_widget = widget 359 | group.add(row) 360 | 361 | return group 362 | } 363 | 364 | _page2_group3(settings) { 365 | const group = new Adw.PreferencesGroup({ 366 | title: "Icons appearance", 367 | description: "" 368 | }) 369 | 370 | let row, widget 371 | 372 | row = new Adw.ActionRow({ 373 | title: "Use symbolic icons", 374 | subtitle: "Use symbolic icons for apps" 375 | }) 376 | widget = new Gtk.Switch({ 377 | valign: Gtk.Align.CENTER 378 | }) 379 | settings.bind("apps-symbolic-icons", widget, "active", Gio.SettingsBindFlags.DEFAULT) 380 | row.add_suffix(widget) 381 | row.activatable_widget = widget 382 | group.add(row) 383 | 384 | row = new Adw.ActionRow({ 385 | title: "Desaturate all apps icons", 386 | subtitle: "Show only black and white apps icons" 387 | }) 388 | widget = new Gtk.Switch({ 389 | valign: Gtk.Align.CENTER 390 | }) 391 | settings.bind("apps-all-desaturate", widget, "active", Gio.SettingsBindFlags.DEFAULT) 392 | row.add_suffix(widget) 393 | row.activatable_widget = widget 394 | group.add(row) 395 | 396 | row = new Adw.ActionRow({ 397 | title: "Inactive apps effect", 398 | subtitle: "Effect to apply to inactive (not focused) apps icons" 399 | }) 400 | widget = new Gtk.ComboBoxText({ 401 | valign: Gtk.Align.CENTER 402 | }) 403 | widget.append("NOTHING", "Nothing") 404 | widget.append("REDUCE OPACITY", "Reduce opacity") 405 | widget.append("DESATURATE", "Desaturate") 406 | settings.bind("apps-inactive-effect", widget, "active-id", Gio.SettingsBindFlags.DEFAULT) 407 | row.add_suffix(widget) 408 | row.activatable_widget = widget 409 | group.add(row) 410 | 411 | row = new Adw.ActionRow({ 412 | title: "Minimized apps effect", 413 | subtitle: "Effect to apply to minimized apps icons" 414 | }) 415 | widget = new Gtk.ComboBoxText({ 416 | valign: Gtk.Align.CENTER 417 | }) 418 | widget.append("NOTHING", "Nothing") 419 | widget.append("REDUCE OPACITY", "Reduce opacity") 420 | widget.append("DESATURATE", "Desaturate") 421 | settings.bind("apps-minimized-effect", widget, "active-id", Gio.SettingsBindFlags.DEFAULT) 422 | row.add_suffix(widget) 423 | row.activatable_widget = widget 424 | group.add(row) 425 | 426 | return group 427 | } 428 | 429 | _page2_group4(settings) { 430 | const group = new Adw.PreferencesGroup({ 431 | title: "Size and spacing", 432 | description: "" 433 | }) 434 | 435 | let row, widget 436 | 437 | row = new Adw.ActionRow({ 438 | title: "Application icon size", 439 | subtitle: "Size of a single application icon. The icon is limited by the panel height (edit panel height with extensions like Just Perfection). Default: 20" 440 | }) 441 | widget = new Gtk.SpinButton({ 442 | valign: Gtk.Align.CENTER 443 | }) 444 | widget.set_sensitive(true) 445 | widget.set_range(1, 50) 446 | widget.set_value(settings.get_int("size-app-icon")) 447 | widget.set_increments(1, 2) 448 | widget.connect("value-changed", w => { settings.set_int("size-app-icon", w.get_value_as_int()) }) 449 | row.add_suffix(widget) 450 | row.activatable_widget = widget 451 | group.add(row) 452 | 453 | row = new Adw.ActionRow({ 454 | title: "Labels font size", 455 | subtitle: "Font sizes for all labels (workspace name, apps groups). Default: 12" 456 | }) 457 | widget = new Gtk.SpinButton({ 458 | valign: Gtk.Align.CENTER 459 | }) 460 | widget.set_sensitive(true) 461 | widget.set_range(1, 50) 462 | widget.set_value(settings.get_int("size-labels")) 463 | widget.set_increments(1, 2) 464 | widget.connect("value-changed", w => { settings.set_int("size-labels", w.get_value_as_int()) }) 465 | row.add_suffix(widget) 466 | row.activatable_widget = widget 467 | group.add(row) 468 | 469 | row = new Adw.ActionRow({ 470 | title: "Workspace spacing left", 471 | subtitle: "Left spacing for a workspace indicator. Default: 2" 472 | }) 473 | widget = new Gtk.SpinButton({ 474 | valign: Gtk.Align.CENTER 475 | }) 476 | widget.set_sensitive(true) 477 | widget.set_range(0, 50) 478 | widget.set_value(settings.get_int("spacing-workspace-left")) 479 | widget.set_increments(1, 2) 480 | widget.connect("value-changed", w => { settings.set_int("spacing-workspace-left", w.get_value_as_int()) }) 481 | row.add_suffix(widget) 482 | row.activatable_widget = widget 483 | group.add(row) 484 | 485 | row = new Adw.ActionRow({ 486 | title: "Workspace spacing right", 487 | subtitle: "Right spacing for a workspace indicator. Default: 2" 488 | }) 489 | widget = new Gtk.SpinButton({ 490 | valign: Gtk.Align.CENTER 491 | }) 492 | widget.set_sensitive(true) 493 | widget.set_range(0, 50) 494 | widget.set_value(settings.get_int("spacing-workspace-right")) 495 | widget.set_increments(1, 2) 496 | widget.connect("value-changed", w => { settings.set_int("spacing-workspace-right", w.get_value_as_int()) }) 497 | row.add_suffix(widget) 498 | row.activatable_widget = widget 499 | group.add(row) 500 | 501 | row = new Adw.ActionRow({ 502 | title: "Label spacing left", 503 | subtitle: "Left spacing for a workspace label. Default: 2" 504 | }) 505 | widget = new Gtk.SpinButton({ 506 | valign: Gtk.Align.CENTER 507 | }) 508 | widget.set_sensitive(true) 509 | widget.set_range(0, 50) 510 | widget.set_value(settings.get_int("spacing-label-left")) 511 | widget.set_increments(1, 2) 512 | widget.connect("value-changed", w => { settings.set_int("spacing-label-left", w.get_value_as_int()) }) 513 | row.add_suffix(widget) 514 | row.activatable_widget = widget 515 | group.add(row) 516 | 517 | row = new Adw.ActionRow({ 518 | title: "Label spacing right", 519 | subtitle: "Right spacing for a workspace label. Default: 2" 520 | }) 521 | widget = new Gtk.SpinButton({ 522 | valign: Gtk.Align.CENTER 523 | }) 524 | widget.set_sensitive(true) 525 | widget.set_range(0, 50) 526 | widget.set_value(settings.get_int("spacing-label-right")) 527 | widget.set_increments(1, 2) 528 | widget.connect("value-changed", w => { settings.set_int("spacing-label-right", w.get_value_as_int()) }) 529 | row.add_suffix(widget) 530 | row.activatable_widget = widget 531 | group.add(row) 532 | 533 | row = new Adw.ActionRow({ 534 | title: "Label spacing top", 535 | subtitle: "Top spacing for a workspace label. Default: 0" 536 | }) 537 | widget = new Gtk.SpinButton({ 538 | valign: Gtk.Align.CENTER 539 | }) 540 | widget.set_sensitive(true) 541 | widget.set_range(0, 50) 542 | widget.set_value(settings.get_int("spacing-label-top")) 543 | widget.set_increments(1, 2) 544 | widget.connect("value-changed", w => { settings.set_int("spacing-label-top", w.get_value_as_int()) }) 545 | row.add_suffix(widget) 546 | row.activatable_widget = widget 547 | group.add(row) 548 | 549 | row = new Adw.ActionRow({ 550 | title: "Label spacing bottom", 551 | subtitle: "Bottom spacing for a workspace label. Default: 0" 552 | }) 553 | widget = new Gtk.SpinButton({ 554 | valign: Gtk.Align.CENTER 555 | }) 556 | widget.set_sensitive(true) 557 | widget.set_range(0, 50) 558 | widget.set_value(settings.get_int("spacing-label-bottom")) 559 | widget.set_increments(1, 2) 560 | widget.connect("value-changed", w => { settings.set_int("spacing-label-bottom", w.get_value_as_int()) }) 561 | row.add_suffix(widget) 562 | row.activatable_widget = widget 563 | group.add(row) 564 | 565 | row = new Adw.ActionRow({ 566 | title: "App icon spacing left", 567 | subtitle: "Left spacing for an application icon. Default: 0" 568 | }) 569 | widget = new Gtk.SpinButton({ 570 | valign: Gtk.Align.CENTER 571 | }) 572 | widget.set_sensitive(true) 573 | widget.set_range(0, 50) 574 | widget.set_value(settings.get_int("spacing-app-left")) 575 | widget.set_increments(1, 2) 576 | widget.connect("value-changed", w => { settings.set_int("spacing-app-left", w.get_value_as_int()) }) 577 | row.add_suffix(widget) 578 | row.activatable_widget = widget 579 | group.add(row) 580 | 581 | row = new Adw.ActionRow({ 582 | title: "App icon spacing right", 583 | subtitle: "Right spacing for an application icon. Default: 0" 584 | }) 585 | widget = new Gtk.SpinButton({ 586 | valign: Gtk.Align.CENTER 587 | }) 588 | widget.set_sensitive(true) 589 | widget.set_range(0, 50) 590 | widget.set_value(settings.get_int("spacing-app-right")) 591 | widget.set_increments(1, 2) 592 | widget.connect("value-changed", w => { settings.set_int("spacing-app-right", w.get_value_as_int()) }) 593 | row.add_suffix(widget) 594 | row.activatable_widget = widget 595 | group.add(row) 596 | 597 | return group 598 | } 599 | 600 | _page3_group1(settings) { 601 | const group = new Adw.PreferencesGroup({ 602 | title: "Icons appearance", 603 | description: "" 604 | }) 605 | 606 | let row, widget 607 | 608 | row = new Adw.ActionRow({ 609 | title: "Icons limit", 610 | subtitle: "Maximum number of icons displayed in a single inactive workspace indicator. Active workspace is always unlimited. 0 = unlimited" 611 | }) 612 | widget = new Gtk.SpinButton({ 613 | valign: Gtk.Align.CENTER 614 | }) 615 | widget.set_sensitive(true) 616 | widget.set_range(0, 99) 617 | widget.set_value(settings.get_int("icons-limit")) 618 | widget.set_increments(1, 2) 619 | widget.connect("value-changed", w => { settings.set_int("icons-limit", w.get_value_as_int()) }) 620 | row.add_suffix(widget) 621 | row.activatable_widget = widget 622 | group.add(row) 623 | 624 | row = new Adw.ActionRow({ 625 | title: "Group icons of same application", 626 | subtitle: "Show only one icon for each application in the workspace indicator" 627 | }) 628 | widget = new Gtk.ComboBoxText({ 629 | valign: Gtk.Align.CENTER 630 | }) 631 | widget.append("OFF", "Off") 632 | widget.append("GROUP AND SHOW COUNT", "Group and show count") 633 | widget.append("GROUP WITHOUT COUNT", "Group without count") 634 | settings.bind("icons-group", widget, "active-id", Gio.SettingsBindFlags.DEFAULT) 635 | row.add_suffix(widget) 636 | row.activatable_widget = widget 637 | group.add(row) 638 | 639 | return group 640 | } 641 | 642 | _page3_group2(settings) { 643 | const group = new Adw.PreferencesGroup({ 644 | title: "Ignored applications", 645 | description: "List of applications currently ignored (no icons will be shown for them)" 646 | }) 647 | 648 | const ignored_apps = settings.get_strv("icons-ignored") 649 | 650 | if (ignored_apps.length === 0) { 651 | group.add(new Gtk.Label({ 652 | label: "No currently ignored apps" 653 | })) 654 | } 655 | 656 | for (const app of ignored_apps) { 657 | const row = new Adw.ActionRow({ 658 | title: app 659 | }) 660 | const widget = new Gtk.Button({ 661 | valign: Gtk.Align.CENTER, 662 | label: "Reactivate" 663 | }) 664 | widget.connect("clicked", () => { 665 | ignored_apps.splice(ignored_apps.indexOf(app), 1) 666 | settings.set_strv("icons-ignored", ignored_apps) 667 | row.get_parent().remove(row) 668 | }) 669 | row.add_suffix(widget) 670 | row.activatable_widget = widget 671 | group.add(row) 672 | } 673 | 674 | return group 675 | } 676 | 677 | _page3_group3(settings) { 678 | const group = new Adw.PreferencesGroup({ 679 | title: "Add ignored application", 680 | description: "Add an application to the list of ignored applications" 681 | }) 682 | 683 | let row, widget 684 | 685 | row = new Adw.ActionRow({ 686 | title: "Log displayed applications ids", 687 | subtitle: "Console log the ids of the applications currently running, to find the ids of the applications to ignore. Open log with \"journalctl /usr/bin/gnome-shell -f -o cat\"" 688 | }) 689 | widget = new Gtk.Switch({ 690 | valign: Gtk.Align.CENTER 691 | }) 692 | settings.bind("log-apps-id", widget, "active", Gio.SettingsBindFlags.DEFAULT) 693 | row.add_suffix(widget) 694 | row.activatable_widget = widget 695 | group.add(row) 696 | 697 | row = new Adw.ActionRow({ 698 | title: "Add application to ignore", 699 | subtitle: "Insert id of the application to ignore. Regular expressions (regex) are supported" 700 | }) 701 | widget = new Gtk.Entry({ 702 | halign: Gtk.Align.END, 703 | valign: Gtk.Align.CENTER, 704 | hexpand: true, 705 | xalign: 0, 706 | }) 707 | widget.set_width_chars(25) 708 | widget.set_placeholder_text("org.gnome.example") 709 | widget.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, "object-select-symbolic") 710 | widget.set_icon_activatable(Gtk.EntryIconPosition.SECONDARY, true) 711 | widget.connect("icon-press", w => { 712 | const ignored_apps = settings.get_strv("icons-ignored") 713 | if (w.get_text().length === 0 || ignored_apps.includes(w.get_text())) 714 | return 715 | ignored_apps.push(w.get_text()) 716 | settings.set_strv("icons-ignored", ignored_apps) 717 | }) 718 | row.add_suffix(widget) 719 | row.activatable_widget = widget 720 | group.add(row) 721 | 722 | return group 723 | } 724 | 725 | _info_label() { 726 | return new Adw.PreferencesGroup({ 727 | title: "", 728 | description: "Closing settings may be necessary to apply modifications", 729 | halign: Gtk.Align.CENTER 730 | }) 731 | } 732 | 733 | _about_page() { 734 | const group = new Adw.PreferencesGroup({ 735 | title: "Workspaces Indicator by Open Apps", 736 | description: "About this extension" 737 | }) 738 | 739 | let row, widget 740 | 741 | row = new Adw.ActionRow({ 742 | title: "Version" 743 | }) 744 | widget = new Gtk.Label({ 745 | label: ExtensionPreferences.lookupByUUID("workspaces-by-open-apps@favo02.github.com").metadata.version.toString(), 746 | valign: Gtk.Align.CENTER 747 | }) 748 | row.add_suffix(widget) 749 | group.add(row) 750 | 751 | row = new Adw.ActionRow({ 752 | title: "Source code" 753 | }) 754 | widget = new Gtk.LinkButton({ 755 | label: "Favo02/workspaces-by-open-apps on GitHub", 756 | uri: "https://github.com/Favo02/workspaces-by-open-apps", 757 | valign: Gtk.Align.CENTER, 758 | }) 759 | row.add_suffix(widget) 760 | row.activatable_widget = widget 761 | group.add(row) 762 | 763 | row = new Adw.ActionRow({ 764 | title: "Report a bug / Feature request" 765 | }) 766 | widget = new Gtk.LinkButton({ 767 | label: "Open an issue on GitHub", 768 | uri: "https://github.com/Favo02/workspaces-by-open-apps/issues", 769 | valign: Gtk.Align.CENTER, 770 | }) 771 | row.add_suffix(widget) 772 | row.activatable_widget = widget 773 | group.add(row) 774 | 775 | row = new Adw.ActionRow({ 776 | title: "GNOME extensions store" 777 | }) 778 | widget = new Gtk.LinkButton({ 779 | label: "Workspaces indicator by open apps", 780 | uri: "https://extensions.gnome.org/extension/5967/workspaces-indicator-by-open-apps/", 781 | valign: Gtk.Align.CENTER, 782 | }) 783 | row.add_suffix(widget) 784 | row.activatable_widget = widget 785 | group.add(row) 786 | 787 | return group 788 | } 789 | 790 | _star_label() { 791 | return new Adw.PreferencesGroup({ 792 | title: "", 793 | description: "Do not forget to leave a star if you like this extension!", 794 | halign: Gtk.Align.CENTER 795 | }) 796 | } 797 | } 798 | -------------------------------------------------------------------------------- /src/schemas/gschemas.compiled: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Favo02/workspaces-by-open-apps/cd67c68e6c3fc6fde8ca5183a354ba9099d79ff4/src/schemas/gschemas.compiled -------------------------------------------------------------------------------- /src/schemas/org.gnome.shell.extensions.workspaces-indicator-by-open-apps.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | "LEFT" 31 | Panel position 32 | Panel to show the indicator in 33 | 34 | 35 | 36 | 0 37 | Position index 38 | Number of other elements in the panel before the indicator 39 | 40 | 41 | 42 | true 43 | Hide GNOME workspace indicator 44 | Hide GNOME default workspace indicator (formerly "Activities" button) 45 | 46 | 47 | 48 | 49 | 50 | true 51 | Enable scroll 52 | Change workspace by scrolling the mouse wheel (or touchpad gesture) over the indicator 53 | 54 | 55 | 56 | true 57 | Scroll wraparound 58 | Scrolling past the last workspace will wrap around to the first one (and viceversa) 59 | 60 | 61 | 62 | false 63 | Inverse scroll 64 | Invert the direction of scrolling 65 | 66 | 67 | 68 | true 69 | Middle click closes app 70 | Clicking with the middle mouse button on an app icon will close the app 71 | 72 | 73 | 74 | true 75 | Click on current workspace triggers overview 76 | Clicking the active workspace triggers overview 77 | 78 | 79 | 80 | true 81 | Click on focused application to minimize 82 | Clicking on the current focused application will minimize it 83 | 84 | 85 | 86 | 87 | 88 | true 89 | Active workspace indicator 90 | Show an indicator below the current active workspace 91 | 92 | 93 | 94 | true 95 | Focused app indicator 96 | Show an indicator above the current focused app 97 | 98 | 99 | 100 | "rgba(255,255,255,1)" 101 | Indicators color 102 | Color of active workspace and focused app indicators 103 | 104 | 105 | 106 | true 107 | Round indicators borders 108 | Round borders of active workspace and focused app indicators 109 | 110 | 111 | 112 | false 113 | Swap indicators position 114 | Move active app indicator to bottom and active workspace to top. This could break centering of labels, fix it manually using Spacing settings below. 115 | 116 | 117 | 118 | 119 | 120 | true 121 | Show workspace names 122 | Show the workspace names before the workspace icons 123 | 124 | 125 | 126 | false 127 | Hide empty workspaces indicator 128 | Hides the name of empty workspaces 129 | 130 | 131 | 132 | "ALL" 133 | Apps on all workspaces indicator text 134 | Text indicator to show when there are apps on all workspaces 135 | 136 | 137 | 138 | false 139 | Use custom names for workspaces 140 | Display custom (editable by rigth click on workspace) names instead of indexes 141 | 142 | 143 | 144 | 145 | 146 | false 147 | Use symbolic icons 148 | Use symbolic icons for apps 149 | 150 | 151 | 152 | false 153 | Desaturate all apps icons 154 | Show only black and white apps icons 155 | 156 | 157 | 158 | "REDUCE OPACITY" 159 | Inactive apps effect 160 | Effect to apply to inactive (not focused) apps icons 161 | 162 | 163 | 164 | "REDUCE OPACITY" 165 | Minimized apps effect 166 | Effect to apply to minimized apps icons 167 | 168 | 169 | 170 | 171 | 172 | 20 173 | Application icon size 174 | Size of a single application icon. The icon is limited by the panel height (edit panel height with extensions like Just Perfection). Default: 20 175 | 176 | 177 | 178 | 12 179 | Labels font size 180 | Font sizes for all labels (workspace name, apps groups). Default: 12 181 | 182 | 183 | 184 | 2 185 | Workspace spacing left 186 | Left spacing for a workspace indicator. Default: 2 187 | 188 | 189 | 190 | 2 191 | Workspace spacing right 192 | Right spacing for a workspace indicator. Default: 2 193 | 194 | 195 | 196 | 2 197 | Label spacing left 198 | Left spacing for a workspace label. Default: 2 199 | 200 | 201 | 202 | 2 203 | Label spacing right 204 | Right spacing for a workspace label. Default: 2 205 | 206 | 207 | 208 | 0 209 | Label spacing top 210 | Top spacing for a workspace label. Default: 0 211 | 212 | 213 | 214 | 0 215 | Label spacing bottom 216 | Bottom spacing for a workspace label. Default: 0 217 | 218 | 219 | 220 | 0 221 | App icon spacing left 222 | Left spacing for an application icon. Default: 0 223 | 224 | 225 | 226 | 0 227 | App icon spacing right 228 | Right spacing for an application icon. Default: 0 229 | 230 | 231 | 232 | 233 | 234 | 0 235 | Icons limit 236 | Maximum number of icons displayed in a single inactive workspace indicator. Active workspace is always unlimited. 0 = unlimited 237 | 238 | 239 | 240 | "OFF" 241 | Group icons of same application 242 | Show only one icon for each application in the workspace indicator 243 | 244 | 245 | 246 | [] 247 | Ignored applications 248 | List of applications ignored (no icons will be shown for them) 249 | 250 | 251 | 252 | false 253 | Log displayed applications ids 254 | Console log the ids of the applications currently running, to find the ids of the applications to ignore. Open log with "journalctl /usr/bin/gnome-shell -f -o cat" 255 | 256 | 257 | 258 | 259 | 260 | 261 | -------------------------------------------------------------------------------- /src/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* 2 | please document margin and padding values, 3 | the hardest thing to get right in css 4 | */ 5 | 6 | /* list of available classes (all prefixed with wboa-) 7 | 8 | label: font size of labels 9 | active > label (direct child): toggle color of labels 10 | 11 | workspace: indicator spacing 12 | workspace > label (direct child): workspace label color and spacing 13 | 14 | app (:hover and :focus): app icon hover effect 15 | app > label (direct child): app group label color and spacing 16 | 17 | rounded: round borders (5px) 18 | panel-rounded: round borders (15px) 19 | no-rounded: do not round borders 20 | 21 | top: space for placing indicator at top 22 | top active (same element): indicator at top 23 | top no-indicator (same element): always disable indicator at top (add space for placing) 24 | 25 | bottom: space for placing indicator at bottom 26 | bottom active (same element): indicator at bottom 27 | bottom no-indicator (same element): always disable indicator at bottom (add space for placing) 28 | */ 29 | 30 | /* --- labels (workspace name and apps count) --- */ 31 | /* label size managed by size-workspace-label setting */ 32 | .wboa-active > .wboa-label { 33 | color: rgba(255, 255, 255, 1) !important; 34 | } 35 | 36 | /* --- workspace indicator --- */ 37 | /* workspace horizontal spacing is managed by spacing-workspace-{left, right} setttings */ 38 | .wboa-workspace { 39 | border: none; 40 | } 41 | 42 | /* --- workspace label --- */ 43 | /* workspace label spacing managed by spacing-label-{left, right, top, bottom} settings */ 44 | .wboa-workspace > .wboa-label { 45 | color: rgba(255, 255, 255, 0.5); 46 | } 47 | 48 | /* --- app icon --- */ 49 | /* app icon size managed by size-app-icon setting */ 50 | /* app icon spacing managed by spacing-app-{left, right} settings */ 51 | .wboa-app:hover, .wboa-app:focus { 52 | /* hover effect */ 53 | margin-top: -2px; 54 | } 55 | /* symbolic icon */ 56 | .wboa-symbolic-icons { 57 | -st-icon-style: symbolic; 58 | } 59 | 60 | /* --- apps group label (x2, x3, ...) --- */ 61 | .wboa-app > .wboa-label { 62 | color: rgba(255, 255, 255, 0.4); 63 | /* space horizontally app groups */ 64 | margin-right: 2px; 65 | } 66 | 67 | /* --- COMMON --- */ 68 | 69 | /* round indicator borders */ 70 | .wboa-rounded { 71 | border-radius: 5px; 72 | } 73 | /* round panel button borders */ 74 | .wboa-panel-rounded { 75 | border-radius: 15px !important; 76 | } 77 | /* do not round indicator borders */ 78 | .wboa-no-rounded { 79 | border-radius: 0px !important; 80 | } 81 | 82 | /* --- TOP indicators --- */ 83 | .wboa-top { 84 | border: none; 85 | /* simulate presence of active indicator */ 86 | margin-top: 2px; 87 | } 88 | .wboa-top.wboa-active { 89 | border-top: 2px solid white; 90 | /* disable simulation of presence of active indicator */ 91 | margin-top: 0px; 92 | } 93 | .wboa-top.wboa-no-indicator { 94 | border: none !important; 95 | /* simulate presence of active indicator */ 96 | margin-top: 2px; 97 | } 98 | 99 | /* --- BOTTOM indicators --- */ 100 | .wboa-bottom { 101 | border: none; 102 | /* simulate presence of active indicator */ 103 | margin-bottom: 2px; 104 | } 105 | .wboa-bottom.wboa-active { 106 | border-bottom: 2px solid white; 107 | /* disable simulation of presence of active indicator */ 108 | margin-bottom: 0px; 109 | } 110 | .wboa-bottom.wboa-no-indicator { 111 | border: none !important; 112 | /* simulate presence of active indicator */ 113 | margin-bottom: 2px; 114 | } 115 | -------------------------------------------------------------------------------- /src/workspace.js: -------------------------------------------------------------------------------- 1 | import Clutter from "gi://Clutter" 2 | import St from "gi://St" 3 | import Shell from "gi://Shell" 4 | import Meta from "gi://Meta" 5 | import GObject from "gi://GObject" 6 | import * as main from "resource:///org/gnome/shell/ui/main.js" 7 | import CONSTANTS from "./constants.js" 8 | import Application from "./application.js" 9 | 10 | /** 11 | * indicator for a single workspace 12 | */ 13 | export default class Workspace extends St.Bin { 14 | static { 15 | GObject.registerClass(this) 16 | } 17 | 18 | constructor(settings, workspace, windows, index, is_active, is_other_monitor, css_classes_panel, css_inline_workspace, css_classes_workspace) { 19 | super({ 20 | style_class: css_classes_panel.join(" "), 21 | reactive: true, 22 | can_focus: true, 23 | track_hover: true, 24 | child: new St.BoxLayout({ 25 | style: css_inline_workspace, 26 | style_class: css_classes_workspace.join(" "), 27 | reactive: true, 28 | can_focus: true, 29 | track_hover: true 30 | }), 31 | }) 32 | 33 | this._settings = settings 34 | this._index = index 35 | this._workspace = workspace 36 | 37 | // setup signals 38 | this._setup_signals() 39 | 40 | // setup drag and drop 41 | this._setup_drag_and_drop() 42 | 43 | // render label 44 | if (this._settings.indicator_show_indexes || is_other_monitor) { 45 | this._render_label(index, is_other_monitor) 46 | } 47 | 48 | // create apps icons 49 | this._render_applications(windows, is_active) 50 | } 51 | 52 | /** 53 | * create icons of running applications inside a workspace indicator 54 | * @param windows windows to create icons of 55 | * @param {boolean} is_active if the workspace is active 56 | */ 57 | _render_applications(windows, is_active) { 58 | 59 | // count occurrences of each application 60 | const occurrences = this._count_application_occurrences(windows) 61 | 62 | // remove duplicates (if application grouping is on) 63 | if (this._settings.icons_group !== CONSTANTS.OFF) { 64 | windows = this._remove_duplicates(windows) 65 | } 66 | 67 | // limit icons (if application limit is on) 68 | let icons_limit 69 | if (is_active || this._settings.icons_limit === 0) { 70 | icons_limit = CONSTANTS.NO_LIMIT 71 | } else { 72 | icons_limit = this._settings.icons_limit 73 | } 74 | 75 | windows 76 | .sort((w1, w2) => { // sort by focus and id 77 | if (w1.has_focus()) return -1 78 | if (w2.has_focus()) return 1 79 | return w1.get_id() - w2.get_id() 80 | }) 81 | .slice(0, icons_limit) // limit icons 82 | .sort((w1, w2) => w1.get_id() - w2.get_id()) // sort by id only 83 | .forEach(window => { 84 | // create app indicator and add to workspace 85 | const app_container = this._create_application(window, occurrences) 86 | this.get_child().add_child(app_container) 87 | }) 88 | 89 | // render + icon (for icon limit) 90 | if (windows.length > icons_limit) { 91 | const plus_icon = new St.Icon({ 92 | icon_name: "list-add-symbolic", 93 | icon_size: this._settings.size_app_icon / 2 94 | }) 95 | plus_icon.set_opacity(CONSTANTS.LOW_OPACITY) 96 | this.get_child().add_child(plus_icon) 97 | } 98 | } 99 | 100 | /** 101 | * count the occourrence, focus and minimization of each application in the workspace 102 | * if settings {icons_group} is OFF, return empty map 103 | * @param {Meta.Window[]} windows windows in workspace 104 | * @returns {Map} occurrences, focus and minimization of each application or empty map 105 | */ 106 | _count_application_occurrences(windows) { 107 | // count occurrences of each application 108 | const occurrences = new Map() 109 | 110 | if (this._settings.icons_group !== CONSTANTS.OFF) { 111 | for (const window of windows) { 112 | const id = window.app_id 113 | const get_or_default = occurrences.get(id) ?? { count: 0, focus: false, not_minimized: false } 114 | 115 | occurrences.set(id, { 116 | count: get_or_default.count + 1, 117 | focus: get_or_default.focus || window.has_focus(), 118 | not_minimized: get_or_default.not_minimized || !window.is_hidden() 119 | }) 120 | } 121 | } 122 | 123 | return occurrences 124 | } 125 | 126 | /** 127 | * remove duplicate windows based on window pid 128 | * @param {Meta.Window[]} windows windows to remove duplicates from 129 | * @returns {Meta.Window[]} windows without duplicates 130 | */ 131 | _remove_duplicates(windows) { 132 | const seen = new Set() 133 | return windows.filter(win => { 134 | if (seen.has(win.app_id)) return false 135 | seen.add(win.app_id) 136 | return true 137 | }) 138 | } 139 | 140 | /** 141 | * create an application icon, applying effects (focus, desaturation, grouping, ...) based on settings 142 | * @param {Meta.Window} window to create icon of 143 | * @param {Map} occurrences occurrences of each application 144 | * @returns {Application} application icon 145 | */ 146 | _create_application(window, occurrences) { 147 | // convert from Meta.window to Shell.app 148 | const app = Shell.WindowTracker.get_default().get_window_app(window) 149 | 150 | // create Clutter.actor 151 | const app_icon = app.create_icon_texture(this._settings.size_app_icon) 152 | 153 | // effects for not focused apps 154 | const is_focus = window.has_focus() || occurrences.get(window.app_id)?.focus 155 | if (!is_focus) { 156 | // reduce opacity 157 | if (this._settings.apps_inactive_effect === CONSTANTS.REDUCE_OPACITY) { 158 | app_icon.set_opacity(CONSTANTS.LOW_OPACITY) 159 | } 160 | // desaturate 161 | if (this._settings.apps_inactive_effect === CONSTANTS.DESATURATE) { 162 | app_icon.add_effect(new Clutter.DesaturateEffect()) 163 | } 164 | } 165 | 166 | // effects for minimized apps 167 | const is_not_minimized = !window.is_hidden() || occurrences.get(window.app_id)?.not_minimized 168 | if (!is_not_minimized) { 169 | // reduce opacity 170 | if (this._settings.apps_minimized_effect === CONSTANTS.REDUCE_OPACITY) { 171 | app_icon.set_opacity(CONSTANTS.LOW_OPACITY) 172 | } 173 | // desaturate 174 | if (this._settings.apps_minimized_effect === CONSTANTS.DESATURATE) { 175 | app_icon.add_effect(new Clutter.DesaturateEffect()) 176 | } 177 | } 178 | 179 | // desaturation effect for all apps (setting) 180 | if (this._settings.apps_all_desaturate) { 181 | app_icon.add_effect(new Clutter.DesaturateEffect()) 182 | } 183 | 184 | const css_inline_app = ` 185 | border-color: ${this._settings.indicator_color}; 186 | margin-left: ${this._settings.spacing_app_left}px; 187 | margin-right: ${this._settings.spacing_app_right}px; 188 | ` 189 | 190 | const css_classes_app = ["wboa-app"] 191 | if (this._settings.indicator_swap_position) { 192 | css_classes_app.push("wboa-bottom") 193 | } else { 194 | css_classes_app.push("wboa-top") 195 | } 196 | if (is_focus) css_classes_app.push("wboa-active") 197 | if (!this._settings.indicator_show_focused_app) css_classes_app.push("wboa-no-indicator") 198 | if (this._settings.indicator_round_borders) css_classes_app.push("wboa-rounded") 199 | if (this._settings.apps_symbolic_icons) css_classes_app.push("wboa-symbolic-icons") 200 | 201 | return new Application(this._settings, this._index, window, occurrences, app_icon, css_inline_app, css_classes_app) 202 | } 203 | 204 | /** 205 | * setup drag and drop for workspace and application indicators 206 | */ 207 | _setup_drag_and_drop() { 208 | this._delegate = this 209 | // converting this anonymous function to a lambda will break the code, 210 | // because keyword this in lambda is different keyword than this in anonymous functions 211 | this.acceptDrop = function (source) { 212 | if (source._index !== this._index) { 213 | source._window.change_workspace_by_index(this._index, false) 214 | source._window.activate(Shell.Global.get().get_current_time()) 215 | return true 216 | } 217 | return false 218 | } 219 | } 220 | 221 | /** 222 | * setup signals: click, touch, scroll 223 | */ 224 | _setup_signals() { 225 | this.connect("button-release-event", this._on_click_workspace.bind(this)) 226 | this.connect("touch-event", this._on_touch_workspace.bind(this)) 227 | if (this._settings.scroll_enable) { 228 | this.connect("scroll-event", this._on_scroll_workspace.bind(this)) 229 | } 230 | } 231 | 232 | /** 233 | * create label for a workspace indicator 234 | * @param {number} index index of workspace 235 | * @param {boolean} other_monitor if the workspace is for other monitor 236 | */ 237 | _render_label(index, other_monitor) { 238 | // text to display 239 | let indicator_text 240 | 241 | // other monitor custom text 242 | if (other_monitor) { 243 | indicator_text = this._settings.indicator_all_text 244 | } 245 | // custom workspace name 246 | else if (this._settings.indicator_use_custom_names) { 247 | indicator_text = Meta.prefs_get_workspace_name(index) 248 | } 249 | // default text: index 250 | else { 251 | indicator_text = (index + 1).toString() 252 | } 253 | 254 | const css_style_label = ` 255 | font-size: ${this._settings.size_labels}px; 256 | margin-left: ${this._settings.spacing_label_left}px; 257 | margin-right: ${this._settings.spacing_label_right}px; 258 | margin-top: ${this._settings.spacing_label_top}px; 259 | margin-bottom: ${this._settings.spacing_label_bottom}px; 260 | ` 261 | const css_classes_label = ["wboa-label"] 262 | 263 | // add label to indicator 264 | this.get_child().insert_child_at_index(new St.Label({ 265 | style: css_style_label, 266 | style_class: css_classes_label.join(" "), 267 | y_align: Clutter.ActorAlign.CENTER, 268 | text: indicator_text 269 | }), 0) 270 | } 271 | 272 | /** 273 | * click on workspace handler 274 | * @param _ actor clicked (unused) 275 | * @param event click event 276 | */ 277 | _on_click_workspace(_, event) { 278 | // left click: focus workspace or activate overview 279 | if (event.get_button() === CONSTANTS.LEFT_CLICK) { 280 | const is_active = Shell.Global.get().get_workspace_manager().get_active_workspace_index() === this._index 281 | 282 | // active and setting on: activate overview 283 | if (is_active && this._settings.click_on_active_overview) { 284 | main.overview.toggle() 285 | } 286 | // not active or setting off: focus workspace 287 | else { 288 | this._workspace.activate(Shell.Global.get().get_current_time()) 289 | } 290 | } 291 | 292 | // middle click: do nothing 293 | 294 | // right click: rename workspace 295 | if (event.get_button() === CONSTANTS.RIGHT_CLICK) { 296 | // if rename label exists, destroy it 297 | if (this._rename_workspace) { 298 | this._rename_workspace.destroy() 299 | this._rename_workspace = null 300 | return 301 | } 302 | 303 | const css_classes_label = ["wboa-label"] 304 | 305 | // create text input 306 | const entry = new St.Entry({ 307 | text: Meta.prefs_get_workspace_name(this._index), 308 | style_class: css_classes_label.join(" ") 309 | }) 310 | 311 | // connect typing event: update workspace name 312 | entry.connect("key-release-event", () => { 313 | Meta.prefs_change_workspace_name(this._index, entry.get_text()) 314 | }) 315 | 316 | // add to indicator 317 | this.get_child().insert_child_at_index(entry, 0) 318 | entry.grab_key_focus() 319 | 320 | this._rename_workspace = entry 321 | } 322 | } 323 | 324 | /** touch on workspace handler */ 325 | _on_touch_workspace() { 326 | this._workspace.activate(Shell.Global.get().get_current_time()) 327 | } 328 | 329 | /** 330 | * scroll on workspace indicator handler 331 | * @param _ actor scrolled on (unused) 332 | * @param event click event 333 | */ 334 | _on_scroll_workspace(_, event) { 335 | // scroll direction 336 | let scroll_direction = event.get_scroll_direction() 337 | 338 | // convert 2D direction to left/right 339 | let direction 340 | switch (scroll_direction) { 341 | case Clutter.ScrollDirection.LEFT: 342 | case Clutter.ScrollDirection.UP: 343 | direction = this._settings.scroll_inverse ? -1 : 1 344 | break 345 | case Clutter.ScrollDirection.RIGHT: 346 | case Clutter.ScrollDirection.DOWN: 347 | direction = this._settings.scroll_inverse ? 1 : -1 348 | break 349 | default: 350 | return Clutter.EVENT_PROPAGATE 351 | } 352 | 353 | // activate adjacent workspace on scroll 354 | const workspace_manager = Shell.Global.get().get_workspace_manager() 355 | let new_index = workspace_manager.get_active_workspace_index() + direction 356 | 357 | // modulo operator working for negative numbers 358 | const mod = (n, m) => (((n % m) + m) % m) 359 | 360 | // wrap 361 | if (this._settings.scroll_wraparound) { 362 | new_index = mod(new_index, workspace_manager.n_workspaces) 363 | } 364 | 365 | if (new_index >= 0 && new_index < workspace_manager.n_workspaces) { 366 | workspace_manager.get_workspace_by_index(new_index).activate(Shell.Global.get().get_current_time()) 367 | } 368 | } 369 | 370 | } 371 | --------------------------------------------------------------------------------