From fa13279a81d9d1483435357f7fd42db70a6c50ac Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 8 Apr 2024 18:02:54 +0200 Subject: Adding 45/middleclickclose version 29 [c6f86c2]. Signed-off-by: Daniel Baumann --- extensions/45/middleclickclose.mk | 52 ++++ extensions/45/middleclickclose/.gitignore | 1 + extensions/45/middleclickclose/LICENSE | 339 +++++++++++++++++++++ extensions/45/middleclickclose/Makefile | 27 ++ extensions/45/middleclickclose/README.md | 29 ++ extensions/45/middleclickclose/src/extension.js | 103 +++++++ extensions/45/middleclickclose/src/metadata.json | 11 + extensions/45/middleclickclose/src/po/de.po | 75 +++++ extensions/45/middleclickclose/src/po/el.po | 74 +++++ extensions/45/middleclickclose/src/po/fr.po | 77 +++++ extensions/45/middleclickclose/src/po/it.po | 75 +++++ extensions/45/middleclickclose/src/po/nl.po | 74 +++++ extensions/45/middleclickclose/src/po/pt.po | 72 +++++ extensions/45/middleclickclose/src/po/sk.po | 75 +++++ extensions/45/middleclickclose/src/po/sr.po | 75 +++++ extensions/45/middleclickclose/src/po/sr@latin.po | 75 +++++ extensions/45/middleclickclose/src/po/template.pot | 72 +++++ extensions/45/middleclickclose/src/po/uk.po | 73 +++++ extensions/45/middleclickclose/src/prefs.js | 108 +++++++ ...e.shell.extensions.middleclickclose.gschema.xml | 27 ++ .../45/middleclickclose/src/settingsWatch.js | 87 ++++++ 21 files changed, 1601 insertions(+) create mode 100644 extensions/45/middleclickclose.mk create mode 100644 extensions/45/middleclickclose/.gitignore create mode 100644 extensions/45/middleclickclose/LICENSE create mode 100644 extensions/45/middleclickclose/Makefile create mode 100644 extensions/45/middleclickclose/README.md create mode 100644 extensions/45/middleclickclose/src/extension.js create mode 100644 extensions/45/middleclickclose/src/metadata.json create mode 100644 extensions/45/middleclickclose/src/po/de.po create mode 100644 extensions/45/middleclickclose/src/po/el.po create mode 100644 extensions/45/middleclickclose/src/po/fr.po create mode 100644 extensions/45/middleclickclose/src/po/it.po create mode 100644 extensions/45/middleclickclose/src/po/nl.po create mode 100644 extensions/45/middleclickclose/src/po/pt.po create mode 100644 extensions/45/middleclickclose/src/po/sk.po create mode 100644 extensions/45/middleclickclose/src/po/sr.po create mode 100644 extensions/45/middleclickclose/src/po/sr@latin.po create mode 100644 extensions/45/middleclickclose/src/po/template.pot create mode 100644 extensions/45/middleclickclose/src/po/uk.po create mode 100644 extensions/45/middleclickclose/src/prefs.js create mode 100644 extensions/45/middleclickclose/src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml create mode 100644 extensions/45/middleclickclose/src/settingsWatch.js (limited to 'extensions') diff --git a/extensions/45/middleclickclose.mk b/extensions/45/middleclickclose.mk new file mode 100644 index 0000000..38a3c2b --- /dev/null +++ b/extensions/45/middleclickclose.mk @@ -0,0 +1,52 @@ +# Progress Linux: gnome-shell-extensions-extra + +# Copyright (C) 2010-2023 Daniel Baumann +# +# SPDX-License-Identifier: GPL-3.0+ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Build-Depends: +# gettext libglib2.0-bin + +SHELL := sh -e + +EXTENSION := middleclickclose +UUID := $(shell awk -F\" '/"uuid": / { print $$4 }' $(EXTENSION)/*/metadata.json) + +all: + +test: + +build: + $(MAKE) -C $(EXTENSION) + +install: build + mkdir -p $(DESTDIR)/usr/share/gnome-shell/extensions + unzip $(EXTENSION)/*.zip -d $(DESTDIR)/usr/share/gnome-shell/extensions/$(UUID) + +uninstall: + rm -rf $(DESTDIR)/usr/share/gnome-shell/extensions/$(UUID) + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR) || true + +clean: + +distclean: + +reinstall: uninstall install + +upstream: + rm -rf $(EXTENSION) + git clone https://github.com/p91paul/$(EXTENSION) + rm -rf $(EXTENSION)/.git diff --git a/extensions/45/middleclickclose/.gitignore b/extensions/45/middleclickclose/.gitignore new file mode 100644 index 0000000..cf09213 --- /dev/null +++ b/extensions/45/middleclickclose/.gitignore @@ -0,0 +1 @@ +/*.shell-extension.zip diff --git a/extensions/45/middleclickclose/LICENSE b/extensions/45/middleclickclose/LICENSE new file mode 100644 index 0000000..22fbe5d --- /dev/null +++ b/extensions/45/middleclickclose/LICENSE @@ -0,0 +1,339 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. \ No newline at end of file diff --git a/extensions/45/middleclickclose/Makefile b/extensions/45/middleclickclose/Makefile new file mode 100644 index 0000000..8960c95 --- /dev/null +++ b/extensions/45/middleclickclose/Makefile @@ -0,0 +1,27 @@ +.PHONY: clean all install po pot pack + +POT_SOURCE_FILES = $(wildcard src/schemas/*.gschema.xml src/*.js) +EXTRA_SOURCE_FILES = settingsWatch.js + +all: pack + +pack: + gnome-extensions pack --force src/ $(addprefix --extra-source=, $(EXTRA_SOURCE_FILES)) + +install: pack + gnome-extensions install --force middleclickclose@paolo.tranquilli.gmail.com.shell-extension.zip + +po: $(wildcard src/po/*.po) +pot: src/po/template.pot + +clean: + rm -f middleclickclose@paolo.tranquilli.gmail.com.shell-extension.zip + rm -f src/po/template.pot + +# --- + +src/po/template.pot: $(POT_SOURCE_FILES) + xgettext -F --from-code=UTF-8 --output=src/po/template.pot $(POT_SOURCE_FILES) + +src/po/%.po: pot + msgmerge --quiet --backup off --update $@ src/po/template.pot diff --git a/extensions/45/middleclickclose/README.md b/extensions/45/middleclickclose/README.md new file mode 100644 index 0000000..bfb193b --- /dev/null +++ b/extensions/45/middleclickclose/README.md @@ -0,0 +1,29 @@ +Quick Close in Overview +================ + +Gnome shell extension for closing apps in overview with a middle (or other) click. + +All credit goes to Paolo Tranquilli (http://cs.unibo.it/~tranquil/en/hacking.html), I've merely +copied its code here to provide Gnome Shell 3.10+ compatibility + +This extension is installable from +https://extensions.gnome.org/extension/352/middle-click-to-close-in-overview/. + +Otherwise you may + +* download a [zip](https://github.com/p91paul/middleclickclose/archive/master.zip) of this extension +* extract it +* run the following command + ``` + make install +``` +* reload gnome-shell (Alt-F2, r, Enter) -> on Wayland you need to log out and log in again, there is no in-place reload +* activate it through the Gnome Extensions application. + +## Translations + +If you're interested in contributing a translation, import the translation template file under +`src/po/template.pot` to your favourite po-editing software and create a `*.po` file under `src/po`. + +To update all existing translations after changing the code, run `make po`. To regenerate only the +`template.pot` file, run `make pot` diff --git a/extensions/45/middleclickclose/src/extension.js b/extensions/45/middleclickclose/src/extension.js new file mode 100644 index 0000000..0b0d562 --- /dev/null +++ b/extensions/45/middleclickclose/src/extension.js @@ -0,0 +1,103 @@ +/* This extension is a derived work of the Gnome Shell. +* +* Copyright (c) 2013 Paolo Tranquilli +* +* This extension is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This extension is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this extension; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; + +import { Extension, InjectionManager } from 'resource:///org/gnome/shell/extensions/extension.js'; +import { Workspace } from 'resource:///org/gnome/shell/ui/workspace.js'; + +import { SettingsWatch } from './settingsWatch.js'; + +export default class MiddleClickClose extends Extension { + #settings; + #injectionManager; + + enable() { + this.#settings = new SettingsWatch(this.getSettings(), { + close_button: { get: v => v.value, }, + rearrange_delay: {}, + }); + + this.#injectionManager = new InjectionManager(); + this.#patchClickHandler(); + this.#patchWindowRepositioningDelay(); + } + + disable() { + this.#injectionManager.clear(); + this.#injectionManager = null; + + this.#settings.clear(); + this.#settings = null; + } + + #patchClickHandler() { + // Patch _addWindowClone() to override the clicked signal handler for window clones (which + // is what gnome calls window previews). + const settings = this.#settings; + this.#injectionManager.overrideMethod(Workspace.prototype, '_addWindowClone', + original => function () { + let clone = original.apply(this, arguments); + + // This relies on implementation details of both gnome and gobject. Mainly the order + // the clone's actions are defined and the order with which signal handlers are + // connected on the click action. Just pray this never breaks... Or that gnome moves + // the click handler into a named function. That'd be nice too :) + let [clickAction] = clone.get_actions(); + let id = GObject.signal_handler_find(clickAction, { signalId: 'clicked' }); + clickAction.disconnect(id); + clickAction.connect('clicked', action => { + if (action.get_button() == settings.close_button) { + clone._deleteAll(); + } else { + clone._activate(); + } + }); + + return clone; + } + ); + } + + #patchWindowRepositioningDelay() { + // It'd be nice to just change the WINDOW_REPOSITIONING_DELAY in workspace.js, but + // apparently that is impossible with the switch to ESM. Instead, we'll monkey-patch + // _doRemoveWindow() and change the timeout after the fact. + const settings = this.#settings; + const lastLayoutFrozenIds = new WeakMap(); + this.#injectionManager.overrideMethod(Workspace.prototype, '_doRemoveWindow', + original => function () { + const ret = original.apply(this, arguments); + + // Adjust the freeze delay. + if (this._layoutFrozenId > 0 + && this._layoutFrozenId != lastLayoutFrozenIds.get(this) + ) { + const source = GLib.MainContext.default().find_source_by_id(this._layoutFrozenId); + source.set_ready_time(source.get_time() + settings.rearrange_delay * 1000); + } + + // Need to keep the last id to avoid adjusting the layout freeze delay more than once. + lastLayoutFrozenIds.set(this, this._layoutFrozenId); + + return ret; + }) + } +}; diff --git a/extensions/45/middleclickclose/src/metadata.json b/extensions/45/middleclickclose/src/metadata.json new file mode 100644 index 0000000..01234b9 --- /dev/null +++ b/extensions/45/middleclickclose/src/metadata.json @@ -0,0 +1,11 @@ +{ + "name": "Quick Close in Overview", + "description": "Close windows with a button click (the middle one by default) when in overview mode", + "url": "https://github.com/p91paul/middleclickclose", + "shell-version": [ + "45" + ], + "uuid": "middleclickclose@paolo.tranquilli.gmail.com", + "settings-schema": "org.gnome.shell.extensions.middleclickclose", + "gettext-domain": "org.gnome.shell.extensions.middleclickclose" +} \ No newline at end of file diff --git a/extensions/45/middleclickclose/src/po/de.po b/extensions/45/middleclickclose/src/po/de.po new file mode 100644 index 0000000..4fb4821 --- /dev/null +++ b/extensions/45/middleclickclose/src/po/de.po @@ -0,0 +1,75 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Onno Giesmann , 2019. +# +msgid "" +msgstr "" +"Project-Id-Version: gnome-shell-extensions-middleclickclose\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-08-30 18:29+0300\n" +"PO-Revision-Date: 2019-06-17 20:44+0200\n" +"Last-Translator: Onno Giesmann \n" +"Language-Team: German <--->\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Gtranslator 3.32.1\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Linke" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Mittlere" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Rechte" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Taste 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Taste 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Taste 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Taste 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Taste 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Taste 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Maustaste zum Schließen" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Gibt an, welche Maustaste das Schließen in der Übersicht auslöst." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Verzögerung bis zur Neuanordnung" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Gibt die Zeit an, die bei stillstehender Maus vergehen muss, bevor sich die " +"Fenster in der Übersicht neu anordnen, nachdem ein Fenster geschlossen wurde." diff --git a/extensions/45/middleclickclose/src/po/el.po b/extensions/45/middleclickclose/src/po/el.po new file mode 100644 index 0000000..d032228 --- /dev/null +++ b/extensions/45/middleclickclose/src/po/el.po @@ -0,0 +1,74 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# George Tsiamasiotis , 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: gnome-shell-extensions-middleclickclose\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-08-30 18:33+0300\n" +"PO-Revision-Date: 2023-08-30 18:41+0300\n" +"Last-Translator: George Tsiamasiotis \n" +"Language-Team: \n" +"Language: el\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.3.2\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Αριστερό" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Μεσαίο" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Δεξί" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Κουμπί 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Κουμπί 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Κουμπί 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Κουμπί 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Κουμπί 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Κουμπί 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Κουμπί ποντικιού για κλείσιμο" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Ποιό κουμπί του ποντικιού κλείνει παράθυρα στην επισκόπηση." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Καθυστέρηση ανακατονομής" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Πόσος χρόνος πρέπει να περάσει με τον κέρσορα αδρανή στην επισκόπηση μετά " +"το κλείσιμο ενός παραθύρου για να γίνει ανακατανομή." diff --git a/extensions/45/middleclickclose/src/po/fr.po b/extensions/45/middleclickclose/src/po/fr.po new file mode 100644 index 0000000..e762a40 --- /dev/null +++ b/extensions/45/middleclickclose/src/po/fr.po @@ -0,0 +1,77 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: gnome-shell-extensions-middleclickclose\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-08-30 18:29+0300\n" +"PO-Revision-Date: 2015-12-30 07:08+0100\n" +"Last-Translator: DAEM Q.\n" +"Language-Team: \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.5\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Gauche" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Milieu" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Droit" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Bouton 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Bouton 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Bouton 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Bouton 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Bouton 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Bouton 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Bouton de souris pour fermer la fenêtre" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "" +"Le bouton de la souris qui déclenche la fermeture d'une fenêtre dans la Vue " +"d'ensemble." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Délai avant réarrangement" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Temps qu'il doit se passer sans que le pointeur de la souris ne bouge dans " +"la Vue d'ensemble avant réarrangement des fenêtres." diff --git a/extensions/45/middleclickclose/src/po/it.po b/extensions/45/middleclickclose/src/po/it.po new file mode 100644 index 0000000..4b20c55 --- /dev/null +++ b/extensions/45/middleclickclose/src/po/it.po @@ -0,0 +1,75 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: gnome-shell-extensions-middleclickclose\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-08-30 18:29+0300\n" +"PO-Revision-Date: 2017-04-21 10:06+0200\n" +"Last-Translator: Jimmy Scionti \n" +"Language-Team: Jimmy Scionti \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.7.1\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Sinistro" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Centrale" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Destro" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Pulsante 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Pulsante 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Pulsante 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Pulsante 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Pulsante 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Pulsante 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Pulsante del mouse per chiudere la finestra" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Seleziona quale pulsante del mouse premere per chiudere una finestra." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Ritardo del riordinamento" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Seleziona il tempo di attesa tra la chiusura di una finestra e il " +"riordinamento delle altre finestre nell'anteprima." diff --git a/extensions/45/middleclickclose/src/po/nl.po b/extensions/45/middleclickclose/src/po/nl.po new file mode 100644 index 0000000..fe9c6e9 --- /dev/null +++ b/extensions/45/middleclickclose/src/po/nl.po @@ -0,0 +1,74 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Heimen Stoffels , 2019. +msgid "" +msgstr "" +"Project-Id-Version: gnome-shell-extensions-middleclickclose\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-08-30 18:29+0300\n" +"PO-Revision-Date: 2019-09-15 20:17+0200\n" +"Last-Translator: Heimen Stoffels \n" +"Language-Team: Dutch \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.2.1\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Links" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Scrollwiel" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Rechts" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Knop 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Knop 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Knop 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Knop 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Knop 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Knop 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Muisknop om vensters mee te sluiten" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Met welke muisknop je vensters kunt sluiten op het overzicht." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Vertraging bij herschikken" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Hoeveel tijd er moet verstrijken na het sluiten van een venster voordat " +"vensters worden herschikt." diff --git a/extensions/45/middleclickclose/src/po/pt.po b/extensions/45/middleclickclose/src/po/pt.po new file mode 100644 index 0000000..7f35be1 --- /dev/null +++ b/extensions/45/middleclickclose/src/po/pt.po @@ -0,0 +1,72 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Tomás Marques , 2023 +# +msgid "" +msgstr "" +"Project-Id-Version: gnome-shell-extensions-middleclickclose\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-11 23:56+0100\n" +"PO-Revision-Date: 2023-10-11 23:56+0100\n" +"Last-Translator: Tomás Marques \n" +"Language-Team: \n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Esquerda" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Meio" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Direita" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Botão 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Botão 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Botão 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Botão 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Botão 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Botão 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Botão do meio do rato" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Qual o botão do rato que fecha uma janela na vista geral." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Duração de reorganizar" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Quanto tempo tem de passar sem que o cursor se mova para que as janelas na visão geral " +"se reorganizem depois de uma ter sido fechada." diff --git a/extensions/45/middleclickclose/src/po/sk.po b/extensions/45/middleclickclose/src/po/sk.po new file mode 100644 index 0000000..d9c250a --- /dev/null +++ b/extensions/45/middleclickclose/src/po/sk.po @@ -0,0 +1,75 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: gnome-shell-extensions-middleclickclose\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-08-30 18:29+0300\n" +"PO-Revision-Date: 2015-10-30 07:08+0100\n" +"Last-Translator: Juraj Fiala \n" +"Language-Team: \n" +"Language: sk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.5\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Ľavé" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Stredné" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Pravé" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Tlačidlo 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Tlačidlo 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Tlačidlo 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Tlačidlo 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Tlačidlo 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Tlačidlo 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Tlačidlo myši na zavretie" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Ktoré tlačidlo myši spustí zavretie v prehľade aktivít." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Oneskorenie preskúpenia" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Koľko času musí prejsť od posledného pohnutia kurzora myši aby sa okná v " +"prehľade znovu usporiadali po tom ako bolo jedno zavreté." diff --git a/extensions/45/middleclickclose/src/po/sr.po b/extensions/45/middleclickclose/src/po/sr.po new file mode 100644 index 0000000..514194c --- /dev/null +++ b/extensions/45/middleclickclose/src/po/sr.po @@ -0,0 +1,75 @@ +# Translation for gnome-shell-extension-middleclickclose in Serbian (Cyrillic). +# Copyright (C) 2023 +# This file is distributed under the same license as the gnome-shell-extension-middleclickclose package. +# Fifty Dinar , 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-09-02 18:28+0300\n" +"PO-Revision-Date: 2023-10-15 18:51+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: sr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.4\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Лево" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Средње" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Десно" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Дугме 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Дугме 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Дугме 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Дугме 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Дугме 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Дугме 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Дугме на мишу за затварање апликација" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Које дугме на мишу затвара апликацију у прегледнику." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Задршка у распоређивању" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Колико времена мора да прође приликом непомерања показивача миша за прозоре " +"апликација у прегледнику, како би се прозори распоредили након затварања " +"апликације." diff --git a/extensions/45/middleclickclose/src/po/sr@latin.po b/extensions/45/middleclickclose/src/po/sr@latin.po new file mode 100644 index 0000000..7ec468e --- /dev/null +++ b/extensions/45/middleclickclose/src/po/sr@latin.po @@ -0,0 +1,75 @@ +# Translation for gnome-shell-extension-middleclickclose in Serbian (Latin). +# Copyright (C) 2023 +# This file is distributed under the same license as the gnome-shell-extension-middleclickclose package. +# Fifty Dinar , 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-09-02 18:28+0300\n" +"PO-Revision-Date: 2023-10-15 18:52+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: sr@latin\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.4\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Levo" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Srednje" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Desno" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Dugme 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Dugme 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Dugme 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Dugme 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Dugme 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Dugme 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Dugme na mišu za zatvaranje aplikacija" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Koje dugme na mišu zatvara aplikaciju u pregledniku." + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Zadrška u raspoređivanju" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Koliko vremena mora da prođe prilikom nepomeranja pokazivača miša za " +"prozore aplikacija u pregledniku, kako bi se prozori rasporedili nakon " +"zatvaranja aplikacije." diff --git a/extensions/45/middleclickclose/src/po/template.pot b/extensions/45/middleclickclose/src/po/template.pot new file mode 100644 index 0000000..02cdf11 --- /dev/null +++ b/extensions/45/middleclickclose/src/po/template.pot @@ -0,0 +1,72 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-09-02 18:28+0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "" + +#: src/prefs.js:32 +msgid "Right" +msgstr "" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" diff --git a/extensions/45/middleclickclose/src/po/uk.po b/extensions/45/middleclickclose/src/po/uk.po new file mode 100644 index 0000000..dedc32b --- /dev/null +++ b/extensions/45/middleclickclose/src/po/uk.po @@ -0,0 +1,73 @@ +# StandWithUkraine +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Artem Prokop , 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: gnome-shell-extensions-middleclickclose\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-22 00:00+0300\n" +"PO-Revision-Date: 2023-10-22 00:00+0300\n" +"Last-Translator: Artem Prokop \n" +"Language-Team: \n" +"Language: uk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/prefs.js:30 +msgid "Left" +msgstr "Ліва" + +#: src/prefs.js:31 +msgid "Middle" +msgstr "Середня" + +#: src/prefs.js:32 +msgid "Right" +msgstr "Права" + +#: src/prefs.js:33 +msgid "Button 4" +msgstr "Кнопка 4" + +#: src/prefs.js:34 +msgid "Button 5" +msgstr "Кнопка 5" + +#: src/prefs.js:35 +msgid "Button 6" +msgstr "Кнопка 6" + +#: src/prefs.js:36 +msgid "Button 7" +msgstr "Кнопка 7" + +#: src/prefs.js:37 +msgid "Button 8" +msgstr "Кнопка 8" + +#: src/prefs.js:38 +msgid "Button 9" +msgstr "Кнопка 9" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:17 +msgid "Mouse button to close" +msgstr "Кнопка миші для закриття" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:18 +msgid "Which mouse button triggers closing in overview." +msgstr "Яка кнопка миші закриває вікно в оверв'ю" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:23 +msgid "Rearrange delay" +msgstr "Затримка перерозташування" + +#: src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml:24 +msgid "" +"How much time must pass with the pointer not moving for windows in overview " +"to rearrange after one was closed." +msgstr "" +"Скільки часу курсор має не рухатись щоб вікна в оверв'ю перерозташувалися" +" після закриття вікна." diff --git a/extensions/45/middleclickclose/src/prefs.js b/extensions/45/middleclickclose/src/prefs.js new file mode 100644 index 0000000..91d9f13 --- /dev/null +++ b/extensions/45/middleclickclose/src/prefs.js @@ -0,0 +1,108 @@ +/** + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +**/ + +import Adw from 'gi://Adw'; +import Gtk from 'gi://Gtk'; +import GLib from 'gi://GLib'; +import GObject from 'gi://GObject'; + +import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; + +export default class MiddleClickClosePreferences extends ExtensionPreferences { + getPreferencesWidget() { + let page = new Adw.PreferencesPage(); + let group = new Adw.PreferencesGroup(); + + group.add(this.buildPreference("close-button", { + nicks: { + left: _("Left"), + middle: _("Middle"), + right: _("Right"), + 'button 4': _("Button 4"), + 'button 5': _("Button 5"), + 'button 6': _("Button 6"), + 'button 7': _("Button 7"), + 'button 8': _("Button 8"), + 'button 9': _("Button 9"), + }, + })); + + group.add(this.buildPreference("rearrange-delay", { + step: 50, + })); + + page.add(group); + return page; + } + + buildPreference(key, opts) { + opts ??= {} + + const settings = this.getSettings(); + const setting = settings.create_action(key); + const schema = settings.settings_schema.get_key(key); + + opts.title ??= schema.get_summary() || schema.get_name(); + opts.subtitle ??= schema.get_description(); + + const ty = schema.get_value_type().dup_string(); + const [range_ty, range] = schema.get_range().recursiveUnpack(); + + if (range_ty == "enum") { + opts.nicks ??= {}; + let row = new Adw.ComboRow({ + title: opts.title, + subtitle: opts.subtitle, + model: new Gtk.StringList({ strings: range.map(nick => opts.nicks[nick]) }), + selected: range.indexOf(setting.state.unpack()), + }); + + row.connect('notify::selected', () => { + setting.activate(GLib.Variant.new_string(range[row.selected])); + }); + + return row; + } else if (range_ty == "range") { + opts.lower ??= range[0] + opts.upper ??= range[1] + } + + if (["i"].includes(ty)) { + let adjustment = new Gtk.Adjustment({ + lower: opts.lower, + upper: opts.upper, + step_increment: opts.step, + value: setting.state.unpack(), + }); + + let row = new Adw.SpinRow({ + title: opts.title, + subtitle: opts.subtitle, + numeric: true, + adjustment, + }); + + adjustment.connect("value-changed", adj => { + setting.activate(GLib.Variant.new_int32(adj.value)); + }); + + return row; + } + + // Yeah... I'm not gonna implement a full introspector here. Just add whatever is required + // when needed. + throw new GObject.NotImplementedError(); + } +}; diff --git a/extensions/45/middleclickclose/src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml b/extensions/45/middleclickclose/src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml new file mode 100644 index 0000000..ebe6dc9 --- /dev/null +++ b/extensions/45/middleclickclose/src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + 'middle' + Mouse button to close + Which mouse button triggers closing in overview. + + + 750 + + Rearrange delay + How much time must pass with the pointer not moving for windows in overview to rearrange after one was closed. + + + diff --git a/extensions/45/middleclickclose/src/settingsWatch.js b/extensions/45/middleclickclose/src/settingsWatch.js new file mode 100644 index 0000000..fd8b8bd --- /dev/null +++ b/extensions/45/middleclickclose/src/settingsWatch.js @@ -0,0 +1,87 @@ +export class SettingsWatch { + #settings; + #key_data = new Map(); + + constructor(settings, ...opts) { + this.#settings = settings; + + for (const opt of opts) { + if (typeof opt == 'string') { + this.#addSetting(opt, {}); + } else { + for (const [prop_name, opts] of Object.entries(opt)) { + this.#addSetting(prop_name, opts) + } + } + } + } + + #addSetting(prop_name, opts) { + let key; + if (typeof opts == 'string') { + key = opts; + opts = {}; + } else { + key = opts.key ?? prop_name.replace('_', '-'); + } + + const settings = this.#settings; + const raw_getter = opts.get_raw ?? this.#defaultRawGetter(settings, key); + const getter = opts.get ?? (x => x); + + const update_cb = () => { + let value = getter(raw_getter(settings.get_value(key))); + this.#key_data.get(prop_name).value = value; + + return value; + }; + + this.#key_data.set(prop_name, {}); + Object.defineProperty(this, prop_name, { + enumerable: true, + configurable: true, + get() { + let data = this.#key_data.get(prop_name); + if (data.value === undefined) { + data.handler_id = settings.connect('changed::' + key, update_cb); + data.value = update_cb(); + } + + return data.value; + } + }); + } + + #defaultRawGetter(settings, key) { + const schema = settings.settings_schema.get_key(key); + const [range_ty, _range] = schema.get_range().recursiveUnpack(); + + if (range_ty == "enum") { + return value => { + return { + nick: value.unpack(), + + // FIXME: remove unnecessary lookup if/when g_settings_schema_key_to_enum() + // becomes available. But for now, an extra lookup will have to do. + value: settings.get_enum(key), + }; + }; + } + + return value => value.recursiveUnpack(); + } + + clear() { + for (const [key, data] of this.#key_data.entries()) { + if (data.handler_id !== undefined) + this.#settings.disconnect(data.handler_id); + + delete this[key]; + } + + this.#key_data.clear(); + } +} + +// Allow calling clear as a static function. +SettingsWatch.clear = obj => SettingsWatch.prototype.clear.apply(obj); -- cgit v1.2.3