diff options
Diffstat (limited to 'extensions/46/middleclickclose/src')
-rw-r--r-- | extensions/46/middleclickclose/src/extension.js | 103 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/metadata.json | 12 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/de.po | 75 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/el.po | 74 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/fr.po | 77 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/it.po | 75 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/nl.po | 74 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/pt.po | 72 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/sk.po | 75 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/sr.po | 75 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/sr@latin.po | 75 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/template.pot | 72 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/po/uk.po | 73 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/prefs.js | 108 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml | 27 | ||||
-rw-r--r-- | extensions/46/middleclickclose/src/settingsWatch.js | 87 |
16 files changed, 1154 insertions, 0 deletions
diff --git a/extensions/46/middleclickclose/src/extension.js b/extensions/46/middleclickclose/src/extension.js new file mode 100644 index 0000000..0b0d562 --- /dev/null +++ b/extensions/46/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/46/middleclickclose/src/metadata.json b/extensions/46/middleclickclose/src/metadata.json new file mode 100644 index 0000000..8802f6d --- /dev/null +++ b/extensions/46/middleclickclose/src/metadata.json @@ -0,0 +1,12 @@ +{ + "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", + "46" + ], + "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/46/middleclickclose/src/po/de.po b/extensions/46/middleclickclose/src/po/de.po new file mode 100644 index 0000000..4fb4821 --- /dev/null +++ b/extensions/46/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 <nutzer3105@gmail.com>, 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 <nutzer3105@gmail.com>\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/46/middleclickclose/src/po/el.po b/extensions/46/middleclickclose/src/po/el.po new file mode 100644 index 0000000..d032228 --- /dev/null +++ b/extensions/46/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 <gtsiam@windowslive.com>, 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 <gtsiam@windowslive.com>\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/46/middleclickclose/src/po/fr.po b/extensions/46/middleclickclose/src/po/fr.po new file mode 100644 index 0000000..e762a40 --- /dev/null +++ b/extensions/46/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 <EMAIL@ADDRESS>, 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/46/middleclickclose/src/po/it.po b/extensions/46/middleclickclose/src/po/it.po new file mode 100644 index 0000000..4b20c55 --- /dev/null +++ b/extensions/46/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 <EMAIL@ADDRESS>, 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 <jimmy.scionti@gmail.com>\n" +"Language-Team: Jimmy Scionti <jimmy.scionti@gmail.com>\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/46/middleclickclose/src/po/nl.po b/extensions/46/middleclickclose/src/po/nl.po new file mode 100644 index 0000000..fe9c6e9 --- /dev/null +++ b/extensions/46/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 <vistausss@outlook.com>, 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 <vistausss@outlook.com>\n" +"Language-Team: Dutch <kde-i18n-doc@kde.org>\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/46/middleclickclose/src/po/pt.po b/extensions/46/middleclickclose/src/po/pt.po new file mode 100644 index 0000000..7f35be1 --- /dev/null +++ b/extensions/46/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 <tomasm576@gmail.com>, 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 <tomasm576@gmail.com>\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/46/middleclickclose/src/po/sk.po b/extensions/46/middleclickclose/src/po/sk.po new file mode 100644 index 0000000..d9c250a --- /dev/null +++ b/extensions/46/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 <EMAIL@ADDRESS>, 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 <doctorjellyface@riseup.net>\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/46/middleclickclose/src/po/sr.po b/extensions/46/middleclickclose/src/po/sr.po new file mode 100644 index 0000000..514194c --- /dev/null +++ b/extensions/46/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 <srbaizoki4@tuta.io>, 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/46/middleclickclose/src/po/sr@latin.po b/extensions/46/middleclickclose/src/po/sr@latin.po new file mode 100644 index 0000000..7ec468e --- /dev/null +++ b/extensions/46/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 <srbaizoki4@tuta.io>, 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/46/middleclickclose/src/po/template.pot b/extensions/46/middleclickclose/src/po/template.pot new file mode 100644 index 0000000..02cdf11 --- /dev/null +++ b/extensions/46/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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\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/46/middleclickclose/src/po/uk.po b/extensions/46/middleclickclose/src/po/uk.po new file mode 100644 index 0000000..dedc32b --- /dev/null +++ b/extensions/46/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 <artem.prokop.dev@gmail.com>, 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 <artem.prokop.dev@gmail.com>\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/46/middleclickclose/src/prefs.js b/extensions/46/middleclickclose/src/prefs.js new file mode 100644 index 0000000..91d9f13 --- /dev/null +++ b/extensions/46/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 <http://www.gnu.org/licenses/>. +**/ + +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/46/middleclickclose/src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml b/extensions/46/middleclickclose/src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml new file mode 100644 index 0000000..ebe6dc9 --- /dev/null +++ b/extensions/46/middleclickclose/src/schemas/org.gnome.shell.extensions.middleclickclose.gschema.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<schemalist gettext-domain="org.gnome.shell.extensions.middleclickclose"> + <enum id='org.gnome.shell.extensions.middleclickclose.buttons'> + <value value='1' nick='left'/> + <value value='2' nick='middle'/> + <value value='3' nick='right'/> + <value value='4' nick='button 4'/> + <value value='5' nick='button 5'/> + <value value='6' nick='button 6'/> + <value value='7' nick='button 7'/> + <value value='8' nick='button 8'/> + <value value='9' nick='button 9'/> + </enum> + <schema id="org.gnome.shell.extensions.middleclickclose" path="/org/gnome/shell/extensions/middleclickclose/"> + <key name="close-button" enum="org.gnome.shell.extensions.middleclickclose.buttons"> + <default>'middle'</default> + <summary>Mouse button to close</summary> + <description>Which mouse button triggers closing in overview.</description> + </key> + <key type="i" name="rearrange-delay"> + <default>750</default> + <range min="0" max="5000" /> + <summary>Rearrange delay</summary> + <description>How much time must pass with the pointer not moving for windows in overview to rearrange after one was closed.</description> + </key> + </schema> +</schemalist> diff --git a/extensions/46/middleclickclose/src/settingsWatch.js b/extensions/46/middleclickclose/src/settingsWatch.js new file mode 100644 index 0000000..fd8b8bd --- /dev/null +++ b/extensions/46/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); |