pax_global_header00006660000000000000000000000064142055671440014522gustar00rootroot0000000000000052 comment=d6f4286346d32e55a482e14d98ebdab6dbaf80c3 gnome-shell-extension-appindicator-42/000077500000000000000000000000001420556714400202105ustar00rootroot00000000000000gnome-shell-extension-appindicator-42/.eslintrc.yml000066400000000000000000000001011420556714400226240ustar00rootroot00000000000000extends: - ./lint/eslintrc-gjs.yml - ./lint/eslintrc-shell.yml gnome-shell-extension-appindicator-42/.github/000077500000000000000000000000001420556714400215505ustar00rootroot00000000000000gnome-shell-extension-appindicator-42/.github/workflows/000077500000000000000000000000001420556714400236055ustar00rootroot00000000000000gnome-shell-extension-appindicator-42/.github/workflows/eslint.yaml000066400000000000000000000004071420556714400257700ustar00rootroot00000000000000name: ESLint on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: sudo npm install eslint -g - name: Run ESLint run: eslint . -f tap --ext .js,.jsx,.ts,.tsx gnome-shell-extension-appindicator-42/.gitignore000066400000000000000000000000451420556714400221770ustar00rootroot00000000000000build schemas/gschemas.compiled *.mo gnome-shell-extension-appindicator-42/AUTHORS.md000066400000000000000000000015031420556714400216560ustar00rootroot00000000000000This extension is based on [patches made by Giovanni Campagna](https://bugzilla.gnome.org/show_bug.cgi?id=652122). Authors ordered by first contribution: * Jonas Kümmerlin * Damián Nohales * Dincer Kavraal * Thomas Schaberreiter * Hugo Josefson * ozamorowski * Anthony Ruhier * Emilien Devos * Jan Niklas Hasse * Romeo Calota * JasonLG1979 * Martin Wallin * Andrea Azzarone * Marco Trevisan (Treviño) gnome-shell-extension-appindicator-42/LICENSE000066400000000000000000000432541420556714400212250ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. gnome-shell-extension-appindicator-42/README.md000066400000000000000000000074571420556714400215040ustar00rootroot00000000000000# AppIndicator/KStatusNotifierItem support for GNOME Shell This extension integrates Ubuntu AppIndicators and KStatusNotifierItems (KDE's blessed successor of the systray) into GNOME Shell. Including support for legacy tray icons. [](https://extensions.gnome.org/extension/615/appindicator-support/) ## Features * Show indicator icons in the panel. * Reveal indicator menus upon click. * Double clicking an icon will activate the application window (if implemented by the indicator). * Legacy tray icons * Middle mouse click an icon to send a 'SecondaryActivate' event to the application. Support needs to be implemented in the application. [Info 1](https://bugs.launchpad.net/unity/+bug/812933), [Info 2](https://developer.ubuntu.com/api/devel/ubuntu-13.10/c/AppIndicator3-0.1.html). ## Missing features * Tooltips: Not implemented in `libappindicator` nor in Unity and I've yet to see any indicator using it for anything relevant (KDE ones maybe?). Also, the GNOME designers decided not to have tooltips in the shell and I'd like to honor that decision. ## Known issues * ClassicMenu Indicator takes ages to load and has been reported to freeze the shell forever. This is probably caused by the insane amount of embedded PNG icons. Try at your own risk. ## Installation Normal users are recommended to get the extension from [extensions.gnome.org](https://extensions.gnome.org/extension/615/appindicator-support/). Alternatively, you can check out a version from git, compile the language files, and symlink `~/.local/share/gnome-shell/extensions/appindicatorsupport@rgcjonas.gmail.com` to your clone: ```bash git clone https://github.com/ubuntu/gnome-shell-extension-appindicator.git meson gnome-shell-extension-appindicator /tmp/g-s-appindicators-build ninja -C /tmp/g-s-appindicators-build install gnome-extensions enable appindicatorsupport@rgcjonas.gmail.com ``` Under X11, you may need to restart GNOME Shell (Alt+F2, r, ) after that. Under Wayland you need to logout and login again. ### Applications dependencies Many applications support indicators via [libappindicator](https://launchpad.net/libappindicator), (that is quite often dynamically loaded, as it happens in Electron apps), so without having this library installed in your system no icon will be shown. ## Guidelines for bug reports Unfortunately, this extension is not completely bug free and will probably never be. In order to successfully resolve remaining issues, you need to provide some data: * Your distribution, Shell version and extension version (something like "latest git" or "latest from extensions.gnome.org" is sufficient). * The indicator that caused the bug (if applicable). * Instructions how to reproduce it. **This is the single most important point**. Bugs which [cannot be reproduced](http://xkcd.com/583/) cannot be fixed. Bug reports which do not provide the necessary information may be closed as "invalid" without prior notice. ## Release process This section serves as reminder for the current maintainer and as instruction set for an eventual sucessor. * The maintainer decides when to release a new version. * Versions are tagged (and signed). Version numbers sould be kept in sync with the versions submitted to `extensions.gnome.org`. This implies that version numbers are integers which will be incremented with each release. * The maintainer will tag a new version, update the meson version and generate a zip file using `ninja -C zip-file`. * The zip file will be tested to ensure that nothing was missed when packaging it. * Only if it passed, it is uploaded to `extensions.gnome.org` and the tag is pushed. This release process has been in place since v41. gnome-shell-extension-appindicator-42/appIndicator.js000066400000000000000000000763371420556714400232030ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported AppIndicator, IconActor */ const GdkPixbuf = imports.gi.GdkPixbuf; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; const Gtk = imports.gi.Gtk; const Meta = imports.gi.Meta; const St = imports.gi.St; const Extension = imports.misc.extensionUtils.getCurrentExtension(); const Signals = imports.signals; const IconCache = Extension.imports.iconCache; const Util = Extension.imports.util; const Interfaces = Extension.imports.interfaces; const PromiseUtils = Extension.imports.promiseUtils; const SettingsManager = Extension.imports.settingsManager; PromiseUtils._promisify(Gio.File.prototype, 'read_async', 'read_finish'); PromiseUtils._promisify(Gio._LocalFilePrototype, 'read_async', 'read_finish'); PromiseUtils._promisify(GdkPixbuf.Pixbuf, 'get_file_info_async', 'get_file_info_finish'); PromiseUtils._promisify(GdkPixbuf.Pixbuf, 'new_from_stream_at_scale_async', 'new_from_stream_finish'); PromiseUtils._promisify(Gio.DBusProxy.prototype, 'init_async', 'init_finish'); const MAX_UPDATE_FREQUENCY = 100; // In ms // eslint-disable-next-line no-unused-vars const SNICategory = { APPLICATION: 'ApplicationStatus', COMMUNICATIONS: 'Communications', SYSTEM: 'SystemServices', HARDWARE: 'Hardware', }; var SNIStatus = { PASSIVE: 'Passive', ACTIVE: 'Active', NEEDS_ATTENTION: 'NeedsAttention', }; const SNIconType = { NORMAL: 0, ATTENTION: 1, OVERLAY: 2, }; /** * the AppIndicator class serves as a generic container for indicator information and functions common * for every displaying implementation (IndicatorMessageSource and IndicatorStatusIcon) */ var AppIndicator = class AppIndicatorsAppIndicator { constructor(service, busName, object) { this.busName = busName; this._uniqueId = busName + object; this._accumulatedSignals = new Set(); const interfaceInfo = Gio.DBusInterfaceInfo.new_for_xml(Interfaces.StatusNotifierItem); // HACK: we cannot use Gio.DBusProxy.makeProxyWrapper because we need // to specify G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES this._cancellable = new Gio.Cancellable(); this._proxy = new Gio.DBusProxy({ g_connection: Gio.DBus.session, g_interface_name: interfaceInfo.name, g_interface_info: interfaceInfo, g_name: busName, g_object_path: object, g_flags: Gio.DBusProxyFlags.GET_INVALIDATED_PROPERTIES }); this._setupProxy(); Util.connectSmart(this._proxy, 'g-properties-changed', this, this._onPropertiesChanged); Util.connectSmart(this._proxy, 'g-signal', this, this._onProxySignal); Util.connectSmart(this._proxy, 'notify::g-name-owner', this, this._nameOwnerChanged); if (service !== busName && service.match(Util.BUS_ADDRESS_REGEX)) { this._uniqueId = service; this._nameWatcher = new Util.NameWatcher(service); Util.connectSmart(this._nameWatcher, 'changed', this, this._nameOwnerChanged); } } async _setupProxy() { try { await this._proxy.init_async(GLib.PRIORITY_DEFAULT, this._cancellable); this._checkIfReady(); this._checkNeededProperties(); } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.warn(`While initalizing proxy for ${this._uniqueId}: ${e}`); } } _checkIfReady() { let wasReady = this.isReady; let isReady = false; if (this.hasNameOwner && this.id && this.menuPath) isReady = true; this.isReady = isReady; this._setupProxyPropertyList(); if (this.isReady && !wasReady) { if (this._delayCheck) { this._delayCheck.cancel(); delete this._delayCheck; } this.emit('ready'); return true; } return false; } async _checkNeededProperties() { if (this.id && this.menuPath) return true; const cancellable = this._cancellable; for (let checks = 0; checks < 3 && !this.isReady; ++checks) { this._delayCheck = new PromiseUtils.TimeoutSecondsPromise(1, GLib.PRIORITY_DEFAULT_IDLE, cancellable); // eslint-disable-next-line no-await-in-loop await this._delayCheck; Util.refreshPropertyOnProxy(this._proxy, 'Id'); Util.refreshPropertyOnProxy(this._proxy, 'Menu'); } return this.id && this.menuPath; } _nameOwnerChanged() { if (!this.hasNameOwner) this._checkIfReady(); else this._checkNeededProperties(); this.emit('name-owner-changed'); } _addExtraProperty(name) { if (this._proxyPropertyList.includes(name)) return; if (!(name in this._proxy)) { Object.defineProperty(this._proxy, name, { configurable: false, enumerable: true, get: () => { const v = this._proxy.get_cached_property(name); return v ? v.deep_unpack() : null; }, }); } this._proxyPropertyList.push(name); } _setupProxyPropertyList() { let interfaceProps = this._proxy.g_interface_info.properties; this._proxyPropertyList = (this._proxy.get_cached_property_names() || []).filter(p => interfaceProps.some(propinfo => propinfo.name === p)); if (this._proxyPropertyList.length) { this._addExtraProperty('XAyatanaLabel'); this._addExtraProperty('XAyatanaLabelGuide'); this._addExtraProperty('XAyatanaOrderingIndex'); this._addExtraProperty('IconAccessibleDesc'); this._addExtraProperty('AttentionAccessibleDesc'); } } // The Author of the spec didn't like the PropertiesChanged signal, so he invented his own _translateNewSignals(signal) { let prop = null; if (signal.startsWith('New')) prop = signal.substr(3); else if (signal.startsWith('XAyatanaNew')) prop = `XAyatana${signal.substr(11)}`; if (!prop) return; [prop, `${prop}Name`, `${prop}Pixmap`, `${prop}AccessibleDesc`].filter(p => this._proxyPropertyList.includes(p)).forEach(p => Util.refreshPropertyOnProxy(this._proxy, p, { skipEqualityCheck: p.endsWith('Pixmap'), }), ); } async _onProxySignal(_proxy, _sender, signal, _params) { this._accumulatedSignals.add(signal); if (this._signalsAccumulator) return; this._signalsAccumulator = new PromiseUtils.TimeoutPromise( GLib.PRIORITY_DEFAULT_IDLE, MAX_UPDATE_FREQUENCY, this._cancellable); try { await this._signalsAccumulator; this._accumulatedSignals.forEach(s => this._translateNewSignals(s)); this._accumulatedSignals.clear(); } finally { delete this._signalsAccumulator; } } // public property getters get title() { return this._proxy.Title; } get id() { return this._proxy.Id; } get uniqueId() { return this._uniqueId; } get status() { return this._proxy.Status; } get label() { return this._proxy.XAyatanaLabel; } get accessibleName() { const accessibleDesc = this.status === SNIStatus.NEEDS_ATTENTION ? this._proxy.AccessibleDesc : this._proxy.IconAccessibleDesc; return accessibleDesc || this.title; } get menuPath() { if (this._proxy.Menu === '/NO_DBUSMENU') return null; return this._proxy.Menu || '/MenuBar'; } get attentionIcon() { return [ this._proxy.AttentionIconName, this._proxy.AttentionIconPixmap, this._proxy.IconThemePath, ]; } get icon() { return [ this._proxy.IconName, this._proxy.IconPixmap, this._proxy.IconThemePath, ]; } get overlayIcon() { return [ this._proxy.OverlayIconName, this._proxy.OverlayIconPixmap, this._proxy.IconThemePath, ]; } get hasNameOwner() { return !!this._proxy.g_name_owner || this._nameWatcher && this._nameWatcher.nameOnBus; } get cancellable() { return this._cancellable; } _onPropertiesChanged(_proxy, changed, _invalidated) { let props = Object.keys(changed.unpack()); let signalsToEmit = new Set(); const checkIfReadyChanged = () => { if (checkIfReadyChanged.value === undefined) checkIfReadyChanged.value = this._checkIfReady(); return checkIfReadyChanged.value; }; props.forEach(property => { // some property changes require updates on our part, // a few need to be passed down to the displaying code if (property === 'Id') checkIfReadyChanged(); // all these can mean that the icon has to be changed if (property.startsWith('Icon') || property.startsWith('AttentionIcon')) signalsToEmit.add('icon'); // same for overlays if (property.startsWith('OverlayIcon')) signalsToEmit.add('overlay-icon'); // this may make all of our icons invalid if (property === 'IconThemePath') { signalsToEmit.add('icon'); signalsToEmit.add('overlay-icon'); } // the label will be handled elsewhere if (property === 'XAyatanaLabel') signalsToEmit.add('label'); if (property === 'Menu') { if (!checkIfReadyChanged() && this.isReady) signalsToEmit.add('menu'); } if (property === 'IconAccessibleDesc' || property === 'AttentionAccessibleDesc' || property === 'Title') signalsToEmit.add('accessible-name'); // status updates may cause the indicator to be hidden if (property === 'Status') { signalsToEmit.add('icon'); signalsToEmit.add('status'); signalsToEmit.add('accessible-name'); } }); signalsToEmit.forEach(s => this.emit(s)); } reset() { this.emit('reset'); } destroy() { this.emit('destroy'); this.disconnectAll(); this._cancellable.cancel(); Util.cancelRefreshPropertyOnProxy(this._proxy); if (this._nameWatcher) this._nameWatcher.destroy(); delete this._cancellable; delete this._proxy; delete this._nameWatcher; } open(x, y) { // we can't use WindowID because we're not able to get the x11 window id from a MetaWindow // nor can we call any X11 functions. Luckily, the Activate method usually works fine. // parameters are "an hint to the item where to show eventual windows" [sic] // ... and don't seem to have any effect. this._proxy.ActivateRemote(x, y, this._cancellable, (_, e) => { if (e && !e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.critical(`${this._indicator.id}, failed to activate: ${e.message}`); }); } secondaryActivate(timestamp, x, y) { const cancellable = this._cancellable; this._proxy.XAyatanaSecondaryActivateRemote(timestamp, cancellable, (_, e) => { if (e && e.matches(Gio.DBusError, Gio.DBusError.UNKNOWN_METHOD)) { this._proxy.SecondaryActivateRemote(x, y, cancellable, (_r, error) => { if (error && !error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.critical(`${this._indicator.id}, failed to secondary activate: ${e.message}`); }); } else if (e && !e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) { Util.Logger.critical(`${this._indicator.id}, failed to secondary activate: ${e.message}`); } }); } scroll(dx, dy) { const cancellable = this._cancellable; if (dx !== 0) { this._proxy.ScrollRemote(Math.floor(dx), 'horizontal', cancellable, (_, e) => { if (e && !e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.critical(`${this._indicator.id}, failed to scroll horizontally: ${e.message}`); }); } if (dy !== 0) { this._proxy.ScrollRemote(Math.floor(dy), 'vertical', cancellable, (_, e) => { if (e && !e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.critical(`${this._indicator.id}, failed to scroll vertically: ${e.message}`); }); } } }; Signals.addSignalMethods(AppIndicator.prototype); var IconActor = GObject.registerClass( class AppIndicatorsIconActor extends St.Icon { _init(indicator, iconSize) { super._init({ reactive: true, style_class: 'system-status-icon', fallback_icon_name: 'image-loading-symbolic', }); this.name = this.constructor.name; this.add_style_class_name('appindicator-icon'); this.add_style_class_name('status-notifier-icon'); this.set_style('padding:0'); // eslint-disable-next-line no-undef let themeContext = St.ThemeContext.get_for_stage(global.stage); this.height = iconSize * themeContext.scale_factor; this._indicator = indicator; this._customIcons = new Map(); this._iconSize = iconSize; this._iconCache = new IconCache.IconCache(); this._cancellable = new Gio.Cancellable(); this._loadingIcons = new Set(); Util.connectSmart(this._indicator, 'icon', this, this._updateIcon); Util.connectSmart(this._indicator, 'overlay-icon', this, this._updateOverlayIcon); Util.connectSmart(this._indicator, 'reset', this, this._invalidateIcon); const settings = SettingsManager.getDefaultGSettings(); Util.connectSmart(settings, 'changed::icon-size', this, this._invalidateIcon); Util.connectSmart(settings, 'changed::custom-icons', this, () => { this._updateCustomIcons(); this._invalidateIcon(); }); Util.connectSmart(themeContext, 'notify::scale-factor', this, tc => { this.height = iconSize * tc.scale_factor; this._invalidateIcon(); }); Util.connectSmart(this._indicator, 'ready', this, () => { this._updateIconClass(); this._updateCustomIcons(); this._invalidateIcon(); }); Util.connectSmart(Util.getDefaultTheme(), 'changed', this, this._invalidateIcon); if (indicator.isReady) { this._updateCustomIcons(); this._invalidateIcon(); } this.connect('destroy', () => { this._iconCache.destroy(); this._cancellable.cancel(); }); } _updateIconClass() { this.add_style_class_name( `appindicator-icon-${this._indicator.id.toLowerCase().replace(/_|\s/g, '-')}`); } _cancelLoading() { if (this._loadingIcons.size > 0) { this._cancellable.cancel(); this._cancellable = new Gio.Cancellable(); this._loadingIcons.clear(); } } // Will look the icon up in the cache, if it's found // it will return it. Otherwise, it will create it and cache it. async _cacheOrCreateIconByName(iconSize, iconName, themePath) { // eslint-disable-next-line no-undef let { scale_factor: scaleFactor } = St.ThemeContext.get_for_stage(global.stage); let id = `${iconName}@${iconSize * scaleFactor}${themePath || ''}`; let gicon = this._iconCache.get(id); if (gicon) return gicon; if (this._loadingIcons.has(id)) { Util.Logger.debug(`${this._indicator.id}, Icon ${id} Is still loading, ignoring the request`); throw new GLib.Error(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING, 'Already in progress'); } else { this._cancelLoading(); } this._loadingIcons.add(id); let path = this._getIconInfo(iconName, themePath, iconSize, scaleFactor); gicon = await this._createIconByName(path); this._loadingIcons.delete(id); if (gicon) gicon = this._iconCache.add(id, gicon); return gicon; } async _createIconByPath(path, width, height) { let file = Gio.File.new_for_path(path); try { const inputStream = await file.read_async(GLib.PRIORITY_DEFAULT, this._cancellable); const pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale_async(inputStream, height, width, true, this._cancellable); this.icon_size = width > 0 ? width : this._iconSize; return pixbuf; } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.warn(`${this._indicator.id}, Impossible to read image from path '${path}': ${e}`); throw e; } } async _createIconByName(path) { if (!path) { if (this._createIconIdle) { throw new GLib.Error(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING, 'Already in progress'); } try { this._createIconIdle = new PromiseUtils.IdlePromise(GLib.PRIORITY_DEFAULT_IDLE, this._cancellable); await this._createIconIdle; } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) logError(e); throw e; } finally { delete this._createIconIdle; } return null; } else if (this._createIconIdle) { this._createIconIdle.cancel(); delete this._createIconIdle; } try { const [format, width, height] = await GdkPixbuf.Pixbuf.get_file_info_async( path, this._cancellable); if (!format) { Util.Logger.critical(`${this._indicator.id}, Invalid image format: ${path}`); return null; } if (width >= height * 1.5) { /* Hello indicator-multiload! */ return this._createIconByPath(path, width, -1); } else { this.icon_size = this._iconSize; return new Gio.FileIcon({ file: Gio.File.new_for_path(path), }); } } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.warn(`${this._indicator.id}, Impossible to read image info from path '${path}': ${e}`); throw e; } } _getIconInfo(name, themePath, size, scale) { let path = null; if (name && name[0] === '/') { // HACK: icon is a path name. This is not specified by the api but at least inidcator-sensors uses it. path = name; } else if (name) { // we manually look up the icon instead of letting st.icon do it for us // this allows us to sneak in an indicator provided search path and to avoid ugly upscaled icons // indicator-application looks up a special "panel" variant, we just replicate that here name += '-panel'; // icon info as returned by the lookup let iconInfo = null; // we try to avoid messing with the default icon theme, so we'll create a new one if needed let iconTheme = null; const defaultTheme = Util.getDefaultTheme(); if (themePath) { iconTheme = new Gtk.IconTheme(); defaultTheme.get_search_path().forEach(p => iconTheme.append_search_path(p)); iconTheme.append_search_path(themePath); if (!Meta.is_wayland_compositor()) { const defaultScreen = imports.gi.Gdk.Screen.get_default(); if (defaultScreen) iconTheme.set_screen(defaultScreen); } } else { iconTheme = defaultTheme; } if (iconTheme) { // try to look up the icon in the icon theme iconInfo = iconTheme.lookup_icon_for_scale(name, size, scale, Gtk.IconLookupFlags.GENERIC_FALLBACK); // no icon? that's bad! if (iconInfo === null) { let msg = `${this._indicator.id}, Impossible to lookup icon for '${name}' in`; Util.Logger.warn(`${msg} ${themePath ? `path ${themePath}` : 'default theme'}`); } else { // we have an icon // get the icon path path = iconInfo.get_filename(); } } } return path; } async argbToRgba(src, cancellable) { const CHUNK_SIZE = 1024; const ops = []; const dest = new Uint8Array(src.length); for (let i = 0; i < src.length;) { const chunkSize = Math.min(CHUNK_SIZE, src.length - i); ops.push(new PromiseUtils.CancellablePromise(async resolve => { const start = i; const end = i + chunkSize; await new PromiseUtils.IdlePromise(GLib.PRIORITY_LOW, cancellable); for (let j = start; j < end; j += 4) { let srcAlpha = src[j]; dest[j] = src[j + 1]; /* red */ dest[j + 1] = src[j + 2]; /* green */ dest[j + 2] = src[j + 3]; /* blue */ dest[j + 3] = srcAlpha; /* alpha */ } resolve(); }, cancellable)); i += chunkSize; } await Promise.all(ops); return dest; } async _createIconFromPixmap(iconSize, iconPixmapArray) { // eslint-disable-next-line no-undef const { scale_factor: scaleFactor } = St.ThemeContext.get_for_stage(global.stage); iconSize *= scaleFactor; // the pixmap actually is an array of pixmaps with different sizes // we use the one that is smaller or equal the iconSize // maybe it's empty? that's bad. if (!iconPixmapArray || iconPixmapArray.length < 1) throw TypeError('Empty Icon found'); const sortedIconPixmapArray = iconPixmapArray.sort((pixmapA, pixmapB) => { // we sort smallest to biggest const areaA = pixmapA[0] * pixmapA[1]; const areaB = pixmapB[0] * pixmapB[1]; return areaA - areaB; }); const qualifiedIconPixmapArray = sortedIconPixmapArray.filter(pixmap => // we prefer any pixmap that is equal or bigger than our requested size pixmap[0] >= iconSize && pixmap[1] >= iconSize); const iconPixmap = qualifiedIconPixmapArray.length > 0 ? qualifiedIconPixmapArray[0] : sortedIconPixmapArray.pop(); const [width, height, bytes] = iconPixmap; const rowStride = width * 4; // hopefully this is correct const id = `__PIXMAP_ICON_${width}x${height}`; if (this._loadingIcons.has(id)) { Util.Logger.debug(`${this._indicator.id}, Pixmap ${width}x${height} ` + 'Is still loading, ignoring the request'); throw new GLib.Error(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING, 'Already in progress'); } else { this._cancelLoading(); } this._loadingIcons.add(id); try { return GdkPixbuf.Pixbuf.new_from_bytes( await this.argbToRgba(bytes, this._cancellable), GdkPixbuf.Colorspace.RGB, true, 8, width, height, rowStride); } catch (e) { // the image data was probably bogus. We don't really know why, but it _does_ happen. if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.warn(`${this._indicator.id}, Impossible to create image from data: ${e}`); throw e; } finally { this._loadingIcons.delete(id); } } // The .inUse flag will be set to true if the used gicon matches the cached // one (as in some cases it may be equal, but not the same object). // So when it's not need anymore we make sure to check the .inUse property // and set it to false so that it can be picked up by the garbage collector. _setGicon(iconType, gicon, iconSize) { if (iconType !== SNIconType.OVERLAY) { if (gicon) { this.gicon = new Gio.EmblemedIcon({ gicon }); if (!(gicon instanceof GdkPixbuf.Pixbuf)) gicon.inUse = this.gicon.get_icon() === gicon; this.set_icon_size(iconSize); } else { this.gicon = null; Util.Logger.critical(`unable to update icon for ${this._indicator.id}`); } } else if (gicon) { this._emblem = new Gio.Emblem({ icon: gicon }); if (!(gicon instanceof GdkPixbuf.Pixbuf)) gicon.inUse = true; } else { this._emblem = null; Util.Logger.debug(`unable to update icon emblem for ${this._indicator.id}`); } if (this.gicon) { if (!this.gicon.get_emblems().some(e => e.equal(this._emblem))) { this.gicon.clear_emblems(); if (this._emblem) this.gicon.add_emblem(this._emblem); } } } async _updateIconByType(iconType, iconSize) { let icon; switch (iconType) { case SNIconType.ATTENTION: icon = this._indicator.attentionIcon; break; case SNIconType.NORMAL: icon = this._indicator.icon; break; case SNIconType.OVERLAY: icon = this._indicator.overlayIcon; break; } const [name, pixmap, theme] = icon; let gicon = null; const commonArgs = [theme, iconType, iconSize]; if (this._customIcons.size) { let customIcon = this._customIcons.get(iconType); gicon = await this._createIcon(customIcon, null, ...commonArgs); if (!gicon) { customIcon = this._customIcons.get(SNIconType.NORMAL); gicon = await this._createIcon(customIcon, null, ...commonArgs); } } else { gicon = await this._createIcon(name, pixmap, ...commonArgs); } try { this._setGicon(iconType, gicon, iconSize); } catch (e) { logError(e, 'Setting GIcon failed'); } } // updates the base icon async _createIcon(name, pixmap, theme, iconType, iconSize) { try { if (name) { const gicon = await this._cacheOrCreateIconByName(iconSize, name, theme); if (gicon) return gicon; } if (pixmap && pixmap.length) return this._createIconFromPixmap(iconSize, pixmap, iconType); } catch (e) { /* We handle the error messages already */ if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED) && !e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING)) Util.Logger.debug(`${this._indicator.id}, Impossible to load icon: ${e}`); } return null; } // updates the base icon async _updateIcon() { if (this.gicon instanceof Gio.EmblemedIcon) { let { gicon } = this.gicon; if (gicon.inUse) gicon.inUse = false; } // we might need to use the AttentionIcon*, which have precedence over the normal icons let iconType = this._indicator.status === SNIStatus.NEEDS_ATTENTION ? SNIconType.ATTENTION : SNIconType.NORMAL; this._updateIconSize(); try { await this._updateIconByType(iconType, this._iconSize); } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED) && !e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING)) logError(e, `${this._indicator.id}: Updating icon type ${iconType} failed`); } } async _updateOverlayIcon() { if (this._emblem) { let { icon } = this._emblem; if (icon.inUse) icon.inUse = false; } // KDE hardcodes the overlay icon size to 10px (normal icon size 16px) // we approximate that ratio for other sizes, too. // our algorithms will always pick a smaller one instead of stretching it. let iconSize = Math.floor(this._iconSize / 1.6); try { await this._updateIconByType(SNIconType.OVERLAY, iconSize); } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED) && !e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.PENDING)) logError(e, `${this._indicator.id}: Updating overlay icon failed`); } } // called when the icon theme changes _invalidateIcon() { this._iconCache.clear(); this._cancelLoading(); this._updateIcon(); this._updateOverlayIcon(); } _updateIconSize() { const settings = SettingsManager.getDefaultGSettings(); const sizeValue = settings.get_int('icon-size'); if (sizeValue > 0) { if (!this._defaultIconSize) this._defaultIconSize = this._iconSize; this._iconSize = sizeValue; } else if (this._defaultIconSize) { this._iconSize = this._defaultIconSize; delete this._defaultIconSize; } } _updateCustomIcons() { const settings = SettingsManager.getDefaultGSettings(); this._customIcons.clear(); settings.get_value('custom-icons').deep_unpack().forEach(customIcons => { const [indicatorId, normalIcon, attentionIcon] = customIcons; if (this._indicator.id === indicatorId) { this._customIcons.set(SNIconType.NORMAL, normalIcon); this._customIcons.set(SNIconType.ATTENTION, attentionIcon); } }); } }); gnome-shell-extension-appindicator-42/dbusMenu.js000066400000000000000000000666131420556714400223440ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const GdkPixbuf = imports.gi.GdkPixbuf; const PopupMenu = imports.ui.popupMenu; const Signals = imports.signals; const St = imports.gi.St; const Extension = imports.misc.extensionUtils.getCurrentExtension(); const DBusInterfaces = Extension.imports.interfaces; const PromiseUtils = Extension.imports.promiseUtils; const Util = Extension.imports.util; // //////////////////////////////////////////////////////////////////////// // PART ONE: "ViewModel" backend implementation. // Both code and design are inspired by libdbusmenu // //////////////////////////////////////////////////////////////////////// /** * Saves menu property values and handles type checking and defaults */ var PropertyStore = class AppIndicatorsPropertyStore { constructor(initialProperties) { this._props = new Map(); if (initialProperties) { for (let i in initialProperties) this.set(i, initialProperties[i]); } } set(name, value) { if (name in PropertyStore.MandatedTypes && value && !value.is_of_type(PropertyStore.MandatedTypes[name])) Util.Logger.warn(`Cannot set property ${name}: type mismatch!`); else if (value) this._props.set(name, value); else this._props.delete(name); } get(name) { let prop = this._props.get(name); if (prop) return prop; else if (name in PropertyStore.DefaultValues) return PropertyStore.DefaultValues[name]; else return null; } }; // we list all the properties we know and use here, so we won' have to deal with unexpected type mismatches PropertyStore.MandatedTypes = { 'visible': GLib.VariantType.new('b'), 'enabled': GLib.VariantType.new('b'), 'label': GLib.VariantType.new('s'), 'type': GLib.VariantType.new('s'), 'children-display': GLib.VariantType.new('s'), 'icon-name': GLib.VariantType.new('s'), 'icon-data': GLib.VariantType.new('ay'), 'toggle-type': GLib.VariantType.new('s'), 'toggle-state': GLib.VariantType.new('i'), }; PropertyStore.DefaultValues = { 'visible': GLib.Variant.new_boolean(true), 'enabled': GLib.Variant.new_boolean(true), 'label': GLib.Variant.new_string(''), 'type': GLib.Variant.new_string('standard'), // elements not in here must return null }; /** * Represents a single menu item */ var DbusMenuItem = class AppIndicatorsDbusMenuItem { // will steal the properties object constructor(client, id, properties, childrenIds) { this._client = client; this._id = id; this._propStore = new PropertyStore(properties); this._children_ids = childrenIds; } propertyGet(propName) { let prop = this.propertyGetVariant(propName); return prop ? prop.get_string()[0] : null; } propertyGetVariant(propName) { return this._propStore.get(propName); } propertyGetBool(propName) { let prop = this.propertyGetVariant(propName); return prop ? prop.get_boolean() : false; } propertyGetInt(propName) { let prop = this.propertyGetVariant(propName); return prop ? prop.get_int32() : 0; } propertySet(prop, value) { this._propStore.set(prop, value); this.emit('property-changed', prop, this.propertyGetVariant(prop)); } getChildrenIds() { return this._children_ids.concat(); // clone it! } addChild(pos, childId) { this._children_ids.splice(pos, 0, childId); this.emit('child-added', this._client.getItem(childId), pos); } removeChild(childId) { // find it let pos = -1; for (let i = 0; i < this._children_ids.length; ++i) { if (this._children_ids[i] === childId) { pos = i; break; } } if (pos < 0) { Util.Logger.critical("Trying to remove child which doesn't exist"); } else { this._children_ids.splice(pos, 1); this.emit('child-removed', this._client.getItem(childId)); } } moveChild(childId, newPos) { // find the old position let oldPos = -1; for (let i = 0; i < this._children_ids.length; ++i) { if (this._children_ids[i] === childId) { oldPos = i; break; } } if (oldPos < 0) { Util.Logger.critical("tried to move child which wasn't in the list"); return; } if (oldPos !== newPos) { this._children_ids.splice(oldPos, 1); this._children_ids.splice(newPos, 0, childId); this.emit('child-moved', oldPos, newPos, this._client.getItem(childId)); } } getChildren() { return this._children_ids.map(el => this._client.getItem(el)); } handleEvent(event, data, timestamp) { if (!data) data = GLib.Variant.new_int32(0); this._client.sendEvent(this._id, event, data, timestamp); } getId() { return this._id; } sendAboutToShow() { this._client.sendAboutToShow(this._id); } }; Signals.addSignalMethods(DbusMenuItem.prototype); const BusClientProxy = Gio.DBusProxy.makeProxyWrapper(DBusInterfaces.DBusMenu); /** * The client does the heavy lifting of actually reading layouts and distributing events */ var DBusClient = class AppIndicatorsDBusClient { constructor(busName, busPath) { this._cancellable = new Gio.Cancellable(); this._proxy = new BusClientProxy(Gio.DBus.session, busName, busPath, this._clientReady.bind(this), this._cancellable); this._items = new Map([ [ 0, new DbusMenuItem(this, 0, { 'children-display': GLib.Variant.new_string('submenu'), }, []), ], ]); // will be set to true if a layout update is requested while one is already in progress // then the handler that completes the layout update will request another update this._flagLayoutUpdateRequired = false; this._flagLayoutUpdateInProgress = false; // property requests are queued this._propertiesRequestedFor = new Set(/* ids */); Util.connectSmart(this._proxy, 'notify::g-name-owner', this, () => { if (this.isReady) this._requestLayoutUpdate(); }); } get isReady() { return !!this._proxy.g_name_owner; } getRoot() { return this._items.get(0); } _requestLayoutUpdate() { if (this._flagLayoutUpdateInProgress) this._flagLayoutUpdateRequired = true; else this._beginLayoutUpdate(); } async _requestProperties(id) { this._propertiesRequestedFor.add(id); // if we don't have any requests queued, we'll need to add one if (!this._propertiesRequest || !this._propertiesRequest.pending()) { this._propertiesRequest = new PromiseUtils.IdlePromise( GLib.PRIORITY_DEFAULT_IDLE, this._cancellable); await this._propertiesRequest; this._beginRequestProperties(); } } _beginRequestProperties() { this._proxy.GetGroupPropertiesRemote( Array.from(this._propertiesRequestedFor), [], this._cancellable, this._endRequestProperties.bind(this)); this._propertiesRequestedFor.clear(); return false; } _endRequestProperties(result, error) { if (error) { if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.warn(`Could not retrieve properties: ${error}`); return; } // for some funny reason, the result array is hidden in an array result[0].forEach(([id, properties]) => { let item = this._items.get(id); if (!item) return; for (let prop in properties) item.propertySet(prop, properties[prop]); }); } // Traverses the list of cached menu items and removes everyone that is not in the list // so we don't keep alive unused items _gcItems() { let tag = new Date().getTime(); let toTraverse = [0]; while (toTraverse.length > 0) { let item = this.getItem(toTraverse.shift()); item._dbusClientGcTag = tag; Array.prototype.push.apply(toTraverse, item.getChildrenIds()); } this._items.forEach((i, id) => { if (i._dbusClientGcTag !== tag) this._items.delete(id); }); } // the original implementation will only request partial layouts if somehow possible // we try to save us from multiple kinds of race conditions by always requesting a full layout _beginLayoutUpdate() { // we only read the type property, because if the type changes after reading all properties, // the view would have to replace the item completely which we try to avoid this._proxy.GetLayoutRemote(0, -1, ['type', 'children-display'], this._cancellable, this._endLayoutUpdate.bind(this)); this._flagLayoutUpdateRequired = false; this._flagLayoutUpdateInProgress = true; } _endLayoutUpdate(result, error) { if (error) { if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.warn(`While reading menu layout on proxy ${this._proxy.g_name_owner}: ${error}`); return; } let [revision_, root] = result; this._doLayoutUpdate(root); this._gcItems(); if (this._flagLayoutUpdateRequired) this._beginLayoutUpdate(); else this._flagLayoutUpdateInProgress = false; } _doLayoutUpdate(item) { let [id, properties, children] = item; let childrenUnpacked = children.map(c => c.deep_unpack()); let childrenIds = childrenUnpacked.map(c => c[0]); // make sure all our children exist childrenUnpacked.forEach(c => this._doLayoutUpdate(c)); // make sure we exist const menuItem = this._items.get(id); if (menuItem) { // we do, update our properties if necessary for (let prop in properties) menuItem.propertySet(prop, properties[prop]); // make sure our children are all at the right place, and exist let oldChildrenIds = menuItem.getChildrenIds(); for (let i = 0; i < childrenIds.length; ++i) { // try to recycle an old child let oldChild = -1; for (let j = 0; j < oldChildrenIds.length; ++j) { if (oldChildrenIds[j] === childrenIds[i]) { oldChild = oldChildrenIds.splice(j, 1)[0]; break; } } if (oldChild < 0) { // no old child found, so create a new one! menuItem.addChild(i, childrenIds[i]); } else { // old child found, reuse it! menuItem.moveChild(childrenIds[i], i); } } // remove any old children that weren't reused oldChildrenIds.forEach(c => menuItem.removeChild(c)); } else { // we don't, so let's create us this._items.set(id, new DbusMenuItem(this, id, properties, childrenIds)); this._requestProperties(id); } return id; } _clientReady(result, error) { if (error) { if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Util.Logger.warn(`Could not initialize menu proxy: ${error}`); return; } this._requestLayoutUpdate(); // listen for updated layouts and properties this._proxy.connectSignal('LayoutUpdated', this._onLayoutUpdated.bind(this)); this._proxy.connectSignal('ItemsPropertiesUpdated', this._onPropertiesUpdated.bind(this)); } getItem(id) { let item = this._items.get(id); if (!item) Util.Logger.warn(`trying to retrieve item for non-existing id ${id} !?`); return item || null; } // we don't need to cache and burst-send that since it will not happen that frequently sendAboutToShow(id) { /* Some indicators (you, dropbox!) don't use the right signature * and don't return a boolean, so we need to support both cases */ let connection = this._proxy.get_connection(); connection.call(this._proxy.get_name(), this._proxy.get_object_path(), this._proxy.get_interface_name(), 'AboutToShow', new GLib.Variant('(i)', [id]), null, Gio.DBusCallFlags.NONE, -1, null, (proxy, res) => { try { let ret = proxy.call_finish(res); if ((ret.is_of_type(new GLib.VariantType('(b)')) && ret.get_child_value(0).get_boolean()) || ret.is_of_type(new GLib.VariantType('()'))) this._requestLayoutUpdate(); } catch (e) { Util.Logger.warn(`Impossible to send about-to-show to menu: ${e}`); } }); } sendEvent(id, event, params, timestamp) { if (!this._proxy) return; this._proxy.EventRemote(id, event, params, timestamp, this._cancellable, () => { /* we don't care */ }); } _onLayoutUpdated() { this._requestLayoutUpdate(); } _onPropertiesUpdated(proxy, name, [changed, removed]) { changed.forEach(([id, props]) => { let item = this._items.get(id); if (!item) return; for (let prop in props) item.propertySet(prop, props[prop]); }); removed.forEach(([id, propNames]) => { let item = this._items.get(id); if (!item) return; propNames.forEach(propName => item.propertySet(propName, null)); }); } destroy() { this.emit('destroy'); this._cancellable.cancel(); Signals._disconnectAll.apply(this._proxy); this._proxy = null; } }; Signals.addSignalMethods(DBusClient.prototype); // //////////////////////////////////////////////////////////////////////// // PART TWO: "View" frontend implementation. // //////////////////////////////////////////////////////////////////////// // https://bugzilla.gnome.org/show_bug.cgi?id=731514 // GNOME 3.10 and 3.12 can't open a nested submenu. // Patches have been written, but it's not clear when (if?) they will be applied. // We also don't know whether they will be backported to 3.10, so we will work around // it in the meantime. Offending versions can be clearly identified: const NEED_NESTED_SUBMENU_FIX = '_setOpenedSubMenu' in PopupMenu.PopupMenu.prototype; /** * Creates new wrapper menu items and injects methods for managing them at runtime. * * Many functions in this object will be bound to the created item and executed as event * handlers, so any `this` will refer to a menu item create in createItem */ const MenuItemFactory = { createItem(client, dbusItem) { // first, decide whether it's a submenu or not let shellItem; if (dbusItem.propertyGet('children-display') === 'submenu') shellItem = new PopupMenu.PopupSubMenuMenuItem('FIXME'); else if (dbusItem.propertyGet('type') === 'separator') shellItem = new PopupMenu.PopupSeparatorMenuItem(''); else shellItem = new PopupMenu.PopupMenuItem('FIXME'); shellItem._dbusItem = dbusItem; shellItem._dbusClient = client; if (shellItem instanceof PopupMenu.PopupMenuItem) { shellItem._icon = new St.Icon({ style_class: 'popup-menu-icon', x_align: St.Align.END }); shellItem.add_child(shellItem._icon); shellItem.label.x_expand = true; } // initialize our state MenuItemFactory._updateLabel.call(shellItem); MenuItemFactory._updateOrnament.call(shellItem); MenuItemFactory._updateImage.call(shellItem); MenuItemFactory._updateVisible.call(shellItem); MenuItemFactory._updateSensitive.call(shellItem); // initially create children if (shellItem instanceof PopupMenu.PopupSubMenuMenuItem) { dbusItem.getChildren().forEach(c => shellItem.menu.addMenuItem(MenuItemFactory.createItem(client, c))); } // now, connect various events Util.connectSmart(dbusItem, 'property-changed', shellItem, MenuItemFactory._onPropertyChanged); Util.connectSmart(dbusItem, 'child-added', shellItem, MenuItemFactory._onChildAdded); Util.connectSmart(dbusItem, 'child-removed', shellItem, MenuItemFactory._onChildRemoved); Util.connectSmart(dbusItem, 'child-moved', shellItem, MenuItemFactory._onChildMoved); Util.connectSmart(shellItem, 'activate', shellItem, MenuItemFactory._onActivate); if (shellItem.menu) { Util.connectSmart(shellItem.menu, 'open-state-changed', shellItem, MenuItemFactory._onOpenStateChanged); } return shellItem; }, _onOpenStateChanged(menu, open) { if (open) { if (NEED_NESTED_SUBMENU_FIX) { // close our own submenus if (menu._openedSubMenu) menu._openedSubMenu.close(false); // register ourselves and close sibling submenus if (menu._parent._openedSubMenu && menu._parent._openedSubMenu !== menu) menu._parent._openedSubMenu.close(true); menu._parent._openedSubMenu = menu; } this._dbusItem.handleEvent('opened', null, 0); this._dbusItem.sendAboutToShow(); } else { if (NEED_NESTED_SUBMENU_FIX) { // close our own submenus if (menu._openedSubMenu) menu._openedSubMenu.close(false); } this._dbusItem.handleEvent('closed', null, 0); } }, _onActivate() { this._dbusItem.handleEvent('clicked', GLib.Variant.new('i', 0), 0); }, _onPropertyChanged(dbusItem, prop, _value) { if (prop === 'toggle-type' || prop === 'toggle-state') MenuItemFactory._updateOrnament.call(this); else if (prop === 'label') MenuItemFactory._updateLabel.call(this); else if (prop === 'enabled') MenuItemFactory._updateSensitive.call(this); else if (prop === 'visible') MenuItemFactory._updateVisible.call(this); else if (prop === 'icon-name' || prop === 'icon-data') MenuItemFactory._updateImage.call(this); else if (prop === 'type' || prop === 'children-display') MenuItemFactory._replaceSelf.call(this); else Util.Logger.debug(`Unhandled property change: ${prop}`); }, _onChildAdded(dbusItem, child, position) { if (!(this instanceof PopupMenu.PopupSubMenuMenuItem)) { Util.Logger.warn('Tried to add a child to non-submenu item. Better recreate it as whole'); MenuItemFactory._replaceSelf.call(this); } else { this.menu.addMenuItem(MenuItemFactory.createItem(this._dbusClient, child), position); } }, _onChildRemoved(dbusItem, child) { if (!(this instanceof PopupMenu.PopupSubMenuMenuItem)) { Util.Logger.warn('Tried to remove a child from non-submenu item. Better recreate it as whole'); MenuItemFactory._replaceSelf.call(this); } else { // find it! this.menu._getMenuItems().forEach(item => { if (item._dbusItem === child) item.destroy(); }); } }, _onChildMoved(dbusItem, child, oldpos, newpos) { if (!(this instanceof PopupMenu.PopupSubMenuMenuItem)) { Util.Logger.warn('Tried to move a child in non-submenu item. Better recreate it as whole'); MenuItemFactory._replaceSelf.call(this); } else { MenuUtils.moveItemInMenu(this.menu, child, newpos); } }, _updateLabel() { let label = this._dbusItem.propertyGet('label').replace(/_([^_])/, '$1'); if (this.label) // especially on GS3.8, the separator item might not even have a hidden label this.label.set_text(label); }, _updateOrnament() { if (!this.setOrnament) return; // separators and alike might not have gotten the polyfill if (this._dbusItem.propertyGet('toggle-type') === 'checkmark' && this._dbusItem.propertyGetInt('toggle-state')) this.setOrnament(PopupMenu.Ornament.CHECK); else if (this._dbusItem.propertyGet('toggle-type') === 'radio' && this._dbusItem.propertyGetInt('toggle-state')) this.setOrnament(PopupMenu.Ornament.DOT); else this.setOrnament(PopupMenu.Ornament.NONE); }, _updateImage() { if (!this._icon) return; // might be missing on submenus / separators let iconName = this._dbusItem.propertyGet('icon-name'); let iconData = this._dbusItem.propertyGetVariant('icon-data'); if (iconName) this._icon.icon_name = iconName; else if (iconData) this._icon.gicon = GdkPixbuf.Pixbuf.new_from_stream(Gio.MemoryInputStream.new_from_bytes(iconData.get_data_as_bytes()), null); }, _updateVisible() { this.visible = this._dbusItem.propertyGetBool('visible'); }, _updateSensitive() { this.setSensitive(this._dbusItem.propertyGetBool('enabled')); }, _replaceSelf(newSelf) { // create our new self if needed if (!newSelf) newSelf = MenuItemFactory.createItem(this._dbusClient, this._dbusItem); // first, we need to find our old position let pos = -1; let family = this._parent._getMenuItems(); for (let i = 0; i < family.length; ++i) { if (family[i] === this) pos = i; } if (pos < 0) throw new Error("DBusMenu: can't replace non existing menu item"); // add our new self while we're still alive this._parent.addMenuItem(newSelf, pos); // now destroy our old self this.destroy(); }, }; /** * Utility functions not necessarily belonging into the item factory */ const MenuUtils = { moveItemInMenu(menu, dbusItem, newpos) { // HACK: we're really getting into the internals of the PopupMenu implementation // First, find our wrapper. Children tend to lie. We do not trust the old positioning. let family = menu._getMenuItems(); for (let i = 0; i < family.length; ++i) { if (family[i]._dbusItem === dbusItem) { // now, remove it menu.box.remove_child(family[i]); // and add it again somewhere else if (newpos < family.length && family[newpos] !== family[i]) menu.box.insert_child_below(family[i], family[newpos]); else menu.box.add(family[i]); // skip the rest return; } } }, }; /** * Processes DBus events, creates the menu items and handles the actions * * Something like a mini-god-object */ var Client = class AppIndicatorsClient { constructor(busName, path) { this._busName = busName; this._busPath = path; this._client = new DBusClient(busName, path); this._rootMenu = null; // the shell menu this._rootItem = null; // the DbusMenuItem for the root } get isReady() { return this._client.isReady; } // this will attach the client to an already existing menu that will be used as the root menu. // it will also connect the client to be automatically destroyed when the menu dies. attachToMenu(menu) { this._rootMenu = menu; this._rootItem = this._client.getRoot(); // cleanup: remove existing children (just in case) this._rootMenu.removeAll(); if (NEED_NESTED_SUBMENU_FIX) menu._setOpenedSubMenu = this._setOpenedSubmenu.bind(this); // connect handlers Util.connectSmart(menu, 'open-state-changed', this, this._onMenuOpened); Util.connectSmart(menu, 'destroy', this, this.destroy); Util.connectSmart(this._rootItem, 'child-added', this, this._onRootChildAdded); Util.connectSmart(this._rootItem, 'child-removed', this, this._onRootChildRemoved); Util.connectSmart(this._rootItem, 'child-moved', this, this._onRootChildMoved); // Dropbox requires us to call AboutToShow(0) first this._rootItem.sendAboutToShow(); // fill the menu for the first time this._rootItem.getChildren().forEach(child => this._rootMenu.addMenuItem(MenuItemFactory.createItem(this, child))); } _setOpenedSubmenu(submenu) { if (!submenu) return; if (submenu._parent !== this._rootMenu) return; if (submenu === this._openedSubMenu) return; if (this._openedSubMenu && this._openedSubMenu.isOpen) this._openedSubMenu.close(true); this._openedSubMenu = submenu; } _onRootChildAdded(dbusItem, child, position) { this._rootMenu.addMenuItem(MenuItemFactory.createItem(this, child), position); } _onRootChildRemoved(dbusItem, child) { // children like to play hide and seek // but we know how to find it for sure! this._rootMenu._getMenuItems().forEach(item => { if (item._dbusItem === child) item.destroy(); }); } _onRootChildMoved(dbusItem, child, oldpos, newpos) { MenuUtils.moveItemInMenu(this._rootMenu, dbusItem, newpos); } _onMenuOpened(menu, state) { if (!this._rootItem) return; if (state) { if (this._openedSubMenu && this._openedSubMenu.isOpen) this._openedSubMenu.close(); this._rootItem.handleEvent('opened', null, 0); this._rootItem.sendAboutToShow(); } else { this._rootItem.handleEvent('closed', null, 0); } } destroy() { this.emit('destroy'); if (this._client) this._client.destroy(); this._client = null; this._rootItem = null; this._rootMenu = null; } }; Signals.addSignalMethods(Client.prototype); gnome-shell-extension-appindicator-42/extension.js000066400000000000000000000055671420556714400225770ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported init, enable, disable */ const Extension = imports.misc.extensionUtils.getCurrentExtension(); const StatusNotifierWatcher = Extension.imports.statusNotifierWatcher; const TrayIconsManager = Extension.imports.trayIconsManager; const Util = Extension.imports.util; let statusNotifierWatcher = null; let isEnabled = false; let watchDog = null; function init() { watchDog = new Util.NameWatcher(StatusNotifierWatcher.WATCHER_BUS_NAME); watchDog.connect('vanished', () => maybeEnableAfterNameAvailable()); // HACK: we want to leave the watchdog alive when disabling the extension, // but if we are being reloaded, we destroy it since it could be considered // a leak and spams our log, too. /* eslint-disable no-undef */ if (typeof global['--appindicator-extension-on-reload'] === 'function') global['--appindicator-extension-on-reload'](); global['--appindicator-extension-on-reload'] = () => { Util.Logger.debug('Reload detected, destroying old watchdog'); watchDog.destroy(); }; /* eslint-enable no-undef */ } // FIXME: when entering/leaving the lock screen, the extension might be enabled/disabled rapidly. // This will create very bad side effects in case we were not done unowning the name while trying // to own it again. Since g_bus_unown_name doesn't fire any callback when it's done, we need to // monitor the bus manually to find out when the name vanished so we can reclaim it again. function maybeEnableAfterNameAvailable() { // by the time we get called whe might not be enabled if (isEnabled && (!watchDog.nameAcquired || !watchDog.nameOnBus) && statusNotifierWatcher === null) statusNotifierWatcher = new StatusNotifierWatcher.StatusNotifierWatcher(watchDog); } function enable() { isEnabled = true; maybeEnableAfterNameAvailable(); TrayIconsManager.TrayIconsManager.initialize(); } function disable() { isEnabled = false; TrayIconsManager.TrayIconsManager.destroy(); if (statusNotifierWatcher !== null) { statusNotifierWatcher.destroy(); statusNotifierWatcher = null; } } gnome-shell-extension-appindicator-42/iconCache.js000066400000000000000000000111721420556714400224240ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported IconCache */ const GLib = imports.gi.GLib; const Gio = imports.gi.Gio; const Extension = imports.misc.extensionUtils.getCurrentExtension(); const PromiseUtils = Extension.imports.promiseUtils; const Util = Extension.imports.util; // The icon cache caches icon objects in case they're reused shortly aftwerwards. // This is necessary for some indicators like skype which rapidly switch between serveral icons. // Without caching, the garbage collection would never be able to handle the amount of new icon data. // If the lifetime of an icon is over, the cache will destroy the icon. (!) // The presence of an inUse property set to true on the icon will extend the lifetime. const GC_INTERVAL = 60; // seconds const LIFETIME_TIMESPAN = 10; // seconds // how to use: see IconCache.add, IconCache.get var IconCache = class AppIndicatorsIconCache { constructor() { this._cache = new Map(); this._lifetime = new Map(); // we don't want to attach lifetime to the object } add(id, icon) { if (!(icon instanceof Gio.Icon)) { Util.Logger.critical('IconCache: Only Gio.Icons are supported'); return null; } if (!id) { Util.Logger.critical('IconCache: Invalid ID provided'); return null; } let oldIcon = this._cache.get(id); if (!oldIcon || !oldIcon.equals(icon)) { Util.Logger.debug(`IconCache: adding ${id}: ${icon}`); this._cache.set(id, icon); } else { icon = oldIcon; } this._renewLifetime(id); this._checkGC(); return icon; } _remove(id) { Util.Logger.debug(`IconCache: removing ${id}`); this._cache.delete(id); this._lifetime.delete(id); } _renewLifetime(id) { this._lifetime.set(id, new Date().getTime() + LIFETIME_TIMESPAN * 1000); } forceDestroy(id) { if (this._cache.has(id)) { this._remove(id); this._checkGC(); } } // marks all the icons as removable, if something doesn't claim them before weakClear() { this._cache.forEach(icon => (icon.inUse = false)); this._checkGC(); } // removes everything from the cache clear() { this._cache.forEach((_icon, id) => this._remove(id)); this._checkGC(); } // returns an object from the cache, or null if it can't be found. get(id) { let icon = this._cache.get(id); if (icon) { Util.Logger.debug(`IconCache: retrieving ${id}: ${icon}`); this._renewLifetime(id); return icon; } return null; } async _checkGC() { let cacheIsEmpty = this._cache.size === 0; if (!cacheIsEmpty && !this._gcTimeout) { Util.Logger.debug('IconCache: garbage collector started'); this._gcTimeout = new PromiseUtils.TimeoutSecondsPromise(GC_INTERVAL, GLib.PRIORITY_LOW); try { await this._gcTimeout; } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) logError(e, 'IconCache: garbage collector'); } } else if (cacheIsEmpty && this._gcTimeout) { Util.Logger.debug('IconCache: garbage collector stopped'); this._gcTimeout.cancel(); delete this._gcTimeout; } } _gc() { let time = new Date().getTime(); this._cache.forEach((icon, id) => { if (icon.inUse) Util.Logger.debug(`IconCache: ${id} is in use.`); else if (this._lifetime.get(id) < time) this._remove(id); else Util.Logger.debug(`IconCache: ${id} survived this round.`); }); return true; } destroy() { this.clear(); } }; gnome-shell-extension-appindicator-42/indicator-test-tool/000077500000000000000000000000001420556714400241145ustar00rootroot00000000000000gnome-shell-extension-appindicator-42/indicator-test-tool/ksni.py000077500000000000000000000054751420556714400254500ustar00rootroot00000000000000#!/usr/bin/env python2 # -*- coding: utf-8 -*- import sys from PyQt4 import Qt from PyQt4.QtCore import QObject, QString from PyKDE4.kdeui import KStatusNotifierItem, KMenu App = Qt.QApplication(sys.argv) class Notifier(QObject): def __init__(self, parent=None): QObject.__init__(self, parent) self.tray = KStatusNotifierItem("ksni-test-tool", self) self.tray.setCategory(KStatusNotifierItem.Communications) self.tray.setIconByName(QString("/usr/share/icons/oxygen/16x16/categories/applications-internet.png")) self.tray.setAttentionIconByName(QString("accessories-text-editor")) self.tray.setStatus(KStatusNotifierItem.Active) self.tray.setToolTipIconByName(QString("/usr/share/icons/oxygen/16x16/categories/applications-internet.png")) self.menu = KMenu("KSNI Test Tool") self.menu.addAction("Hello", self.onHelloClicked) self.menu.addAction("Change Status", self.toggleStatus) self.menu.addAction("Hide for some seconds", self.hideForAWhile) self.menu.addAction("Switch to pixmap icon", self.usePixmap) self.menu.addSeparator() self.menu.addAction("Set overlay pixmap", self.setOverlayPixmap) self.menu.addAction("Set overlay icon name", self.setOverlayName) self.menu.addAction("Remove overlay icon", self.removeOverlay) self.tray.setContextMenu(self.menu) self.tray.activateRequested.connect(self.onActivated) self.tray.scrollRequested.connect(self.onScroll) def onActivated(self, show, point): print "Activate() called, show="+str(show)+", point="+str(point) def onScroll(self, delta, orientation): print "Scroll() called, delta="+str(delta)+", orientation="+str(orientation) def onHelloClicked(self): print "Hello World!" def toggleStatus(self): if (self.tray.status() == KStatusNotifierItem.Active): self.tray.setStatus(KStatusNotifierItem.NeedsAttention) else: self.tray.setStatus(KStatusNotifierItem.Active) def hideForAWhile(self): self.tray.setStatus(KStatusNotifierItem.Passive) Qt.QTimer.singleShot(2000, self.toggleStatus) def usePixmap(self): self.tray.setIconByName(QString("")) self.tray.setIconByPixmap(Qt.QIcon.fromTheme("accessories-calculator")) def setOverlayPixmap(self): self.tray.setOverlayIconByName(QString("")) self.tray.setOverlayIconByPixmap(Qt.QIcon.fromTheme("dialog-information")) def setOverlayName(self): self.tray.setOverlayIconByPixmap(Qt.QIcon()) self.tray.setOverlayIconByName(QString("dialog-error")) def removeOverlay(self): self.tray.setOverlayIconByName(QString("")) self.tray.setOverlayIconByPixmap(Qt.QIcon()) if __name__ == '__main__': notifer = Notifier() App.exec_() gnome-shell-extension-appindicator-42/indicator-test-tool/testTool.js000077500000000000000000000233101420556714400262710ustar00rootroot00000000000000#!/usr/bin/gjs /* * This creates an appindicator which contains all common menu items * * Requires libappindicator3 introspection data */ imports.gi.versions.Gtk = '3.0'; const Gtk = imports.gi.Gtk; const AppIndicator = imports.gi.AppIndicator3; const GLib = imports.gi.GLib; const Gio = imports.gi.Gio; const DEFAULT_ICON = 'start-here'; const ATTENTION_ICON = 'starred'; const iconsPool = [ 'emoji-recent-symbolic', 'emoji-flags-symbolic', 'emoji-objects-symbolic', 'emoji-nature-symbolic', 'emoji-body-symbolic', 'emoji-activities-symbolic', 'emoji-people-symbolic', 'emoji-travel-symbolic', 'emoji-symbols-symbolic', 'emoji-food-symbolic', ]; const ScrollType = { UP: 0, DOWN: 1, }; (() => { var app = new Gtk.Application({ application_id: null, }); var window = null; app.connect('activate', () => { window.present(); }); app.connect('startup', () => { window = new Gtk.ApplicationWindow({ title: 'test', application: app, }); let getRandomIcon = () => iconsPool[Math.floor(Math.random() * (iconsPool.length - 1))]; let setRandomIconPath = () => { let iconName = getRandomIcon(); let iconInfo = Gtk.IconTheme.get_default().lookup_icon(iconName, 16, Gtk.IconLookupFlags.GENERIC_FALLBACK); let iconFile = Gio.File.new_for_path(iconInfo.get_filename()); let [, extension] = iconFile.get_basename().split('.'); let newName = `${iconName}-${Math.floor(Math.random() * 100)}.${extension}`; let newFile = Gio.File.new_for_path( `${GLib.dir_make_tmp('indicator-test-XXXXXX')}/${newName}`); iconFile.copy(newFile, Gio.FileCopyFlags.OVERWRITE, null, null); indicator.set_icon_theme_path(newFile.get_parent().get_path()); indicator.set_icon(newFile.get_basename()); }; var menu = new Gtk.Menu(); var item = Gtk.MenuItem.new_with_label('A standard item'); menu.append(item); item = Gtk.MenuItem.new_with_label('Foo'); menu.append(item); item = Gtk.ImageMenuItem.new_with_label('Calculator'); item.image = Gtk.Image.new_from_icon_name('gnome-calculator', Gtk.IconSize.MENU); menu.append(item); item = Gtk.CheckMenuItem.new_with_label('Check me!'); menu.append(item); item = Gtk.MenuItem.new_with_label('Blub'); let sub = new Gtk.Menu(); item.set_submenu(sub); menu.append(item); item = Gtk.MenuItem.new_with_label('Blubdablub'); sub.append(item); item = new Gtk.SeparatorMenuItem(); menu.append(item); item = Gtk.MenuItem.new_with_label('Foo'); menu.append(item); let submenu = new Gtk.Menu(); item.set_submenu(submenu); item = Gtk.MenuItem.new_with_label('Hello'); submenu.append(item); item = Gtk.MenuItem.new_with_label('Nested'); submenu.append(item); let submenu1 = new Gtk.Menu(); item.set_submenu(submenu1); item = Gtk.MenuItem.new_with_label('Another nested'); submenu.append(item); let submenu2 = new Gtk.Menu(); item.set_submenu(submenu2); item = Gtk.MenuItem.new_with_label('Some other item'); submenu1.append(item); item = Gtk.MenuItem.new_with_label('abcdefg'); submenu2.append(item); item = new Gtk.SeparatorMenuItem(); menu.append(item); var group = []; for (let i = 0; i < 5; ++i) { item = Gtk.RadioMenuItem.new_with_label(group, `Example Radio ${i}`); group = Gtk.RadioMenuItem.prototype.get_group.apply(item);// .get_group(); if (i === 1) item.set_active(true); menu.append(item); } item = new Gtk.SeparatorMenuItem(); menu.append(item); item = Gtk.MenuItem.new_with_label('Set Label'); item.connect('activate', () => { indicator.set_label(`${new Date().getTime()}`, 'Blub'); }); menu.append(item); item = Gtk.MenuItem.new_with_label('Unset Label'); item.connect('activate', () => { indicator.set_label('', ''); }); menu.append(item); item = Gtk.MenuItem.new_with_label('Autodestroy Label'); item.connect('activate', () => { let i = 30; GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => { indicator.set_label(i > 0 ? `Label timeout ${i--}` : '', ''); return i >= 0; }); }); menu.append(item); item = Gtk.MenuItem.new_with_label('Set Random icon'); item.connect('activate', () => indicator.set_icon(getRandomIcon())); menu.append(item); item = Gtk.MenuItem.new_with_label('Set Random custom theme icon'); item.connect('activate', setRandomIconPath); menu.append(item); item = Gtk.CheckMenuItem.new_with_label('Toggle Label and Icon'); item.connect('activate', it => { if (it.get_active()) { indicator.set_label(`${new Date().getTime()}`, 'Blub'); item.connect('activate', () => indicator.set_icon(getRandomIcon())); } else { indicator.set_label('', ''); indicator.set_icon(DEFAULT_ICON); } }); menu.append(item); let toggleBrandingItem = item; item = Gtk.CheckMenuItem.new_with_label('Toggle Attention'); let toggleAttentionId = item.connect('activate', () => { indicator.set_status(indicator.get_status() !== AppIndicator.IndicatorStatus.ATTENTION ? AppIndicator.IndicatorStatus.ATTENTION : AppIndicator.IndicatorStatus.ACTIVE); }); menu.append(item); let toggleAttentionItem = item; item = new Gtk.SeparatorMenuItem(); menu.append(item); /* Double separaptors test */ item = new Gtk.SeparatorMenuItem(); menu.append(item); /* Simulate similar behavior of #226 and #236 */ item = Gtk.CheckMenuItem.new_with_label('Crazy icons updates'); item.connect('activate', it => { if (it.get_active()) { item._timeoutID = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 16, () => { setRandomIconPath(); indicator.set_label(`${new Date().getSeconds()}`, ''); return GLib.SOURCE_CONTINUE; }); } else { GLib.source_remove(item._timeoutID); delete item._timeoutID; } }); menu.append(item); item = Gtk.MenuItem.new_with_label('Hide for some time'); item.connect('activate', () => { indicator.set_status(AppIndicator.IndicatorStatus.PASSIVE); GLib.timeout_add(0, 5000, () => { indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE); return false; }); }); menu.append(item); item = Gtk.MenuItem.new_with_label('Close in 5 seconds'); item.connect('activate', () => { GLib.timeout_add(0, 5000, () => { app.quit(); return false; }); }); menu.append(item); menu.show_all(); var indicator = AppIndicator.Indicator.new('Hello', 'indicator-test', AppIndicator.IndicatorCategory.APPLICATION_STATUS); indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE); indicator.set_icon(DEFAULT_ICON); indicator.set_attention_icon(ATTENTION_ICON); indicator.set_menu(menu); indicator.set_secondary_activate_target(toggleBrandingItem); indicator.connect('connection-changed', (_indicator, connected) => { print(`Signal "connection-changed" emitted. Connected: ${connected}`); }); indicator.connect('new-attention-icon', () => { print('Signal "new-attention-icon" emitted.'); }); indicator.connect('new-icon', () => { let icon = ''; if (indicator.get_status() === AppIndicator.IndicatorStatus.ATTENTION) icon = indicator.get_attention_icon(); else if (indicator.get_status() === AppIndicator.IndicatorStatus.ACTIVE) icon = indicator.get_icon(); print(`Signal "new-icon" emitted. Icon: ${icon}`); }); indicator.connect('new-icon-theme-path', (_indicator, path) => { print(`Signal "new-icon-theme-path" emitted. Path: ${path}`); }); indicator.connect('new-label', (_indicator, label, guide) => { print(`Signal "new-label" emitted. Label: ${label}, Guide: ${guide}`); }); indicator.connect('new-status', (_indicator, status) => { print(`Signal "new-status" emitted. Status: ${status}`); toggleAttentionItem.block_signal_handler(toggleAttentionId); toggleAttentionItem.set_active(status === 'NeedsAttention'); toggleAttentionItem.unblock_signal_handler(toggleAttentionId); }); indicator.connect('scroll-event', (_indicator, steps, direction) => { print(`Signal "scroll-event" emitted. Steps: ${steps}, Direction: ${direction}`); let currentIndex = iconsPool.indexOf(indicator.get_icon()); let iconIndex; if (direction === ScrollType.UP) iconIndex = (currentIndex + 1) % iconsPool.length; else iconIndex = (currentIndex <= 0 ? iconsPool.length : currentIndex) - 1; indicator.set_icon(iconsPool[iconIndex]); }); }); app.run(ARGV); })(); gnome-shell-extension-appindicator-42/indicatorStatusIcon.js000066400000000000000000000365451420556714400245540ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported IndicatorStatusIcon, IndicatorStatusTrayIcon */ const Clutter = imports.gi.Clutter; const GObject = imports.gi.GObject; const St = imports.gi.St; const AppDisplay = imports.ui.appDisplay; const Main = imports.ui.main; const Panel = imports.ui.panel; const PanelMenu = imports.ui.panelMenu; const ExtensionUtils = imports.misc.extensionUtils; const Extension = ExtensionUtils.getCurrentExtension(); const AppIndicator = Extension.imports.appIndicator; const DBusMenu = Extension.imports.dbusMenu; const Util = Extension.imports.util; const PromiseUtils = Extension.imports.promiseUtils; const SettingsManager = Extension.imports.settingsManager; const BaseStatusIcon = GObject.registerClass( class AppIndicatorsIndicatorBaseStatusIcon extends PanelMenu.Button { _init(menuAlignment, nameText, iconActor, dontCreateMenu) { super._init(menuAlignment, nameText, dontCreateMenu); const settings = SettingsManager.getDefaultGSettings(); Util.connectSmart(settings, 'changed::icon-opacity', this, this._updateOpacity); Util.connectSmart(settings, 'changed::tray-pos', this, this._showIfReady); this.connect('notify::hover', () => this._onHoverChanged()); this._setIconActor(iconActor); this._showIfReady(); } _setIconActor(icon) { if (!(icon instanceof Clutter.Actor)) throw new Error(`${icon} is not a valid actor`); if (!this._icon) { const settings = SettingsManager.getDefaultGSettings(); Util.connectSmart(settings, 'changed::icon-saturation', this, this._updateSaturation); Util.connectSmart(settings, 'changed::icon-brightness', this, this._updateBrightnessContrast); Util.connectSmart(settings, 'changed::icon-contrast', this, this._updateBrightnessContrast); } else if (this._icon !== icon) { this._icon.destroy(); } this._icon = icon; this._updateEffects(); } isReady() { throw new GObject.NotImplementedError('isReady() in %s'.format(this.constructor.name)); } get uniqueId() { throw new GObject.NotImplementedError('uniqueId in %s'.format(this.constructor.name)); } _showIfReady() { if (!this.isReady()) return; const indicatorId = `appindicator-${this.uniqueId}`; Main.panel.statusArea[indicatorId] = null; Main.panel.addToStatusArea(indicatorId, this, 1, SettingsManager.getDefaultGSettings().get_string('tray-pos')); } _onHoverChanged() { if (this.hover) { this.opacity = 255; if (this._icon) this._icon.remove_effect_by_name('desaturate'); } else { this._updateEffects(); } } _updateOpacity() { const settings = SettingsManager.getDefaultGSettings(); const userValue = settings.get_user_value('icon-opacity'); if (userValue) this.opacity = userValue.unpack(); else if (Util.versionCheck(['40'])) this.opacity = 255; else this.opacity = settings.get_int('icon-opacity'); } _updateEffects() { this._updateOpacity(); if (this._icon) { this._updateSaturation(); this._updateBrightnessContrast(); } } _updateSaturation() { const settings = SettingsManager.getDefaultGSettings(); const desaturationValue = settings.get_double('icon-saturation'); let desaturateEffect = this._icon.get_effect('desaturate'); if (desaturationValue > 0) { if (!desaturateEffect) { desaturateEffect = new Clutter.DesaturateEffect(); this._icon.add_effect_with_name('desaturate', desaturateEffect); } desaturateEffect.set_factor(desaturationValue); } else if (desaturateEffect) { this._icon.remove_effect(desaturateEffect); } } _updateBrightnessContrast() { const settings = SettingsManager.getDefaultGSettings(); const brightnessValue = settings.get_double('icon-brightness'); const contrastValue = settings.get_double('icon-contrast'); let brightnessContrastEffect = this._icon.get_effect('brightness-contrast'); if (brightnessValue !== 0 | contrastValue !== 0) { if (!brightnessContrastEffect) { brightnessContrastEffect = new Clutter.BrightnessContrastEffect(); this._icon.add_effect_with_name('brightness-contrast', brightnessContrastEffect); } brightnessContrastEffect.set_brightness(brightnessValue); brightnessContrastEffect.set_contrast(contrastValue); } else if (brightnessContrastEffect) { this._icon.remove_effect(brightnessContrastEffect); } } }); /* * IndicatorStatusIcon implements an icon in the system status area */ var IndicatorStatusIcon = GObject.registerClass( class AppIndicatorsIndicatorStatusIcon extends BaseStatusIcon { _init(indicator) { super._init(0.5, indicator.accessibleName, new AppIndicator.IconActor(indicator, Panel.PANEL_ICON_SIZE)); this._indicator = indicator; this._box = new St.BoxLayout({ style_class: 'panel-status-indicators-box' }); this._box.add_style_class_name('appindicator-box'); this.add_child(this._box); this._box.add_child(this._icon); Util.connectSmart(this._indicator, 'ready', this, this._showIfReady); Util.connectSmart(this._indicator, 'menu', this, this._updateMenu); Util.connectSmart(this._indicator, 'label', this, this._updateLabel); Util.connectSmart(this._indicator, 'status', this, this._updateStatus); Util.connectSmart(this._indicator, 'reset', this, () => { this._updateStatus(); this._updateLabel(); }); Util.connectSmart(this._indicator, 'accessible-name', this, () => this.set_accessible_name(this._indicator.accessibleName)); this.connect('destroy', () => { if (this._menuClient) { this._menuClient.destroy(); this._menuClient = null; } }); this._showIfReady(); } get uniqueId() { return this._indicator.uniqueId; } isReady() { return this._indicator && this._indicator.isReady; } _updateLabel() { var label = this._indicator.label; if (label) { if (!this._label || !this._labelBin) { this._labelBin = new St.Bin({ y_align: Util.versionCheck(['3.34']) ? St.Align.MIDDLE : Clutter.ActorAlign.CENTER, }); this._label = new St.Label(); this._labelBin.add_actor(this._label); this._box.add_actor(this._labelBin); } this._label.set_text(label); if (!this._box.contains(this._labelBin)) this._box.add_actor(this._labelBin); // FIXME: why is it suddenly necessary? } else if (this._label) { this._labelBin.destroy_all_children(); this._box.remove_actor(this._labelBin); this._labelBin.destroy(); delete this._labelBin; delete this._label; } } _updateStatus() { this.visible = this._indicator.status !== AppIndicator.SNIStatus.PASSIVE; } _updateMenu() { if (this._menuClient) { this._menuClient.destroy(); this._menuClient = null; this.menu.removeAll(); } if (this._indicator.menuPath) { this._menuClient = new DBusMenu.Client(this._indicator.busName, this._indicator.menuPath); this._menuClient.attachToMenu(this.menu); } } _showIfReady() { if (!this.isReady()) return; this._updateLabel(); this._updateStatus(); this._updateMenu(); super._showIfReady(); } vfunc_button_press_event(buttonEvent) { // if middle mouse button clicked send SecondaryActivate dbus event and do not show appindicator menu if (buttonEvent.button === 2) { Main.panel.menuManager._closeMenu(true, Main.panel.menuManager.activeMenu); this._indicator.secondaryActivate(buttonEvent.time, buttonEvent.x, buttonEvent.y); return Clutter.EVENT_STOP; } if (buttonEvent.button === 1 && buttonEvent.click_count === 2) { this._indicator.open(buttonEvent.x, buttonEvent.y); return Clutter.EVENT_STOP; } return Clutter.EVENT_PROPAGATE; } vfunc_scroll_event(scrollEvent) { // Since Clutter 1.10, clutter will always send a smooth scrolling event // with explicit deltas, no matter what input device is used // In fact, for every scroll there will be a smooth and non-smooth scroll // event, and we can choose which one we interpret. if (scrollEvent.direction === Clutter.ScrollDirection.SMOOTH) { const event = Clutter.get_current_event(); let [dx, dy] = event.get_scroll_delta(); this._indicator.scroll(dx, dy); return Clutter.EVENT_STOP; } return Clutter.EVENT_PROPAGATE; } }); var IndicatorStatusTrayIcon = GObject.registerClass( class AppIndicatorsIndicatorTrayIcon extends BaseStatusIcon { _init(icon) { super._init(0.5, icon.wm_class, icon, { dontCreateMenu: true }); Util.Logger.debug(`Adding legacy tray icon ${this.uniqueId}`); this._box = new St.BoxLayout({ style_class: 'panel-status-indicators-box' }); this._box.add_style_class_name('appindicator-trayicons-box'); this.add_child(this._box); this._box.add_child(this._icon); this.add_style_class_name('appindicator-icon'); this.add_style_class_name('tray-icon'); this.connect('button-press-event', (_actor, _event) => { this.add_style_pseudo_class('active'); return Clutter.EVENT_PROPAGATE; }); this.connect('button-release-event', (_actor, event) => { this._icon.click(event); this.remove_style_pseudo_class('active'); return Clutter.EVENT_PROPAGATE; }); this.connect('key-press-event', (_actor, event) => { this.add_style_pseudo_class('active'); this._icon.click(event); return Clutter.EVENT_PROPAGATE; }); this.connect('key-release-event', (_actor, event) => { this._icon.click(event); this.remove_style_pseudo_class('active'); return Clutter.EVENT_PROPAGATE; }); Util.connectSmart(this._icon, 'destroy', this, () => { icon.clear_effects(); this.destroy(); }); const settings = SettingsManager.getDefaultGSettings(); Util.connectSmart(settings, 'changed::icon-size', this, this._updateIconSize); // eslint-disable-next-line no-undef const themeContext = St.ThemeContext.get_for_stage(global.stage); Util.connectSmart(themeContext, 'notify::scale-factor', this, () => this._updateIconSize()); this._updateIconSize(); this.connect('destroy', () => { Util.Logger.debug(`Destroying legacy tray icon ${this.uniqueId}`); this._icon.destroy(); this._icon = null; }); } isReady() { return !!this._icon; } get uniqueId() { return `legacy:${this._icon.wm_class}:${this._icon.pid}`; } vfunc_navigate_focus(from, direction) { this.grab_key_focus(); return super.vfunc_navigate_focus(from, direction); } _getSimulatedButtonEvent(touchEvent) { const event = Clutter.Event.new(Clutter.EventType.BUTTON_RELEASE); event.set_button(1); event.set_time(touchEvent.time); event.set_flags(touchEvent.flags); event.set_stage(touchEvent.stage); event.set_source(touchEvent.source); event.set_coords(touchEvent.x, touchEvent.y); event.set_state(touchEvent.modifier_state); return event; } vfunc_touch_event(touchEvent) { // Under X11 we rely on emulated pointer events if (!imports.gi.Meta.is_wayland_compositor()) return Clutter.EVENT_PROPAGATE; const slot = touchEvent.sequence.get_slot(); if (!this._touchPressSlot && touchEvent.type === Clutter.EventType.TOUCH_BEGIN) { this.add_style_pseudo_class('active'); this._touchButtonEvent = this._getSimulatedButtonEvent(touchEvent); this._touchPressSlot = slot; this._touchDelayPromise = new PromiseUtils.TimeoutPromise( AppDisplay.MENU_POPUP_TIMEOUT); this._touchDelayPromise.then(() => { delete this._touchDelayPromise; delete this._touchPressSlot; this._touchButtonEvent.set_button(3); this._icon.click(this._touchButtonEvent); this.remove_style_pseudo_class('active'); }); } else if (touchEvent.type === Clutter.EventType.TOUCH_END && this._touchPressSlot === slot) { delete this._touchPressSlot; delete this._touchButtonEvent; if (this._touchDelayPromise) { this._touchDelayPromise.cancel(); delete this._touchDelayPromise; } this._icon.click(this._getSimulatedButtonEvent(touchEvent)); this.remove_style_pseudo_class('active'); } else if (touchEvent.type === Clutter.EventType.TOUCH_UPDATE && this._touchPressSlot === slot) { this.add_style_pseudo_class('active'); this._touchButtonEvent = this._getSimulatedButtonEvent(touchEvent); } return Clutter.EVENT_PROPAGATE; } vfunc_leave_event(crossingEvent) { this.remove_style_pseudo_class('active'); if (this._touchDelayPromise) { this._touchDelayPromise.cancel(); delete this._touchDelayPromise; } return super.vfunc_leave_event(crossingEvent); } _updateIconSize() { const settings = SettingsManager.getDefaultGSettings(); // eslint-disable-next-line no-undef const { scale_factor: scaleFactor } = St.ThemeContext.get_for_stage(global.stage); let iconSize = settings.get_int('icon-size'); if (iconSize <= 0) iconSize = Panel.PANEL_ICON_SIZE; this.height = -1; this._icon.set_height(iconSize * scaleFactor); this._icon.set_y_align(Clutter.ActorAlign.CENTER); } }); gnome-shell-extension-appindicator-42/interfaces-xml/000077500000000000000000000000001420556714400231315ustar00rootroot00000000000000gnome-shell-extension-appindicator-42/interfaces-xml/DBusMenu.xml000066400000000000000000000046331420556714400253430ustar00rootroot00000000000000 gnome-shell-extension-appindicator-42/interfaces-xml/StatusNotifierItem.xml000066400000000000000000000077351420556714400274710ustar00rootroot00000000000000 gnome-shell-extension-appindicator-42/interfaces-xml/StatusNotifierWatcher.xml000066400000000000000000000017401420556714400301560ustar00rootroot00000000000000 gnome-shell-extension-appindicator-42/interfaces.js000066400000000000000000000040661420556714400226770ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported StatusNotifierItem, StatusNotifierWatcher, DBusMenu */ var StatusNotifierItem = loadInterfaceXml('StatusNotifierItem.xml'); var StatusNotifierWatcher = loadInterfaceXml('StatusNotifierWatcher.xml'); var DBusMenu = loadInterfaceXml('DBusMenu.xml'); // loads a xml file into an in-memory string function loadInterfaceXml(filename) { const extension = imports.misc.extensionUtils.getCurrentExtension(); const interfacesDir = extension.dir.get_child('interfaces-xml'); const file = interfacesDir.get_child(filename); let [result, contents] = imports.gi.GLib.file_get_contents(file.get_path()); if (result) { // HACK: The "" + trick is important as hell because file_get_contents returns // an object (WTF?) but Gio.makeProxyWrapper requires `typeof() === "string"` // Otherwise, it will try to check `instanceof XML` and fail miserably because there // is no `XML` on very recent SpiderMonkey releases (or, if SpiderMonkey is old enough, // will spit out a TypeError soon). if (contents instanceof Uint8Array) contents = imports.byteArray.toString(contents); return `${contents}`; } else { throw new Error(`AppIndicatorSupport: Could not load file: ${filename}`); } } gnome-shell-extension-appindicator-42/lint/000077500000000000000000000000001420556714400211565ustar00rootroot00000000000000gnome-shell-extension-appindicator-42/lint/eslintrc-gjs.yml000066400000000000000000000130761420556714400243140ustar00rootroot00000000000000--- env: es6: true extends: 'eslint:recommended' rules: array-bracket-newline: - error - consistent array-bracket-spacing: - error - never array-callback-return: error arrow-parens: - error - as-needed arrow-spacing: error block-scoped-var: error block-spacing: error brace-style: error # Waiting for this to have matured a bit in eslint # camelcase: # - error # - properties: never # allow: [^vfunc_, ^on_, _instance_init] comma-dangle: - error - always-multiline comma-spacing: - error - before: false after: true comma-style: - error - last computed-property-spacing: error curly: - error - multi-or-nest - consistent dot-location: - error - property eol-last: error eqeqeq: error func-call-spacing: error func-name-matching: error func-style: - error - declaration - allowArrowFunctions: true indent: - error - 4 - ignoredNodes: # Allow not indenting the body of GObject.registerClass, since in the # future it's intended to be a decorator - 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child' # Allow dedenting chained member expressions MemberExpression: 'off' key-spacing: - error - beforeColon: false afterColon: true keyword-spacing: - error - before: true after: true linebreak-style: - error - unix lines-between-class-members: error max-nested-callbacks: error max-statements-per-line: error new-parens: error no-array-constructor: error no-await-in-loop: error no-caller: error no-constant-condition: - error - checkLoops: false no-div-regex: error no-empty: - error - allowEmptyCatch: true no-extra-bind: error no-extra-parens: - error - all - conditionalAssign: false nestedBinaryExpressions: false returnAssign: false no-implicit-coercion: - error - allow: - '!!' no-invalid-this: error no-iterator: error no-label-var: error no-lonely-if: error no-loop-func: error no-nested-ternary: error no-new-object: error no-new-wrappers: error no-octal-escape: error no-proto: error no-prototype-builtins: 'off' no-restricted-properties: - error - object: Lang property: bind message: Use arrow notation or Function.prototype.bind() - object: Lang property: Class message: Use ES6 classes - object: imports property: mainloop message: Use GLib main loops and timeouts no-restricted-syntax: - error - selector: >- MethodDefinition[key.name="_init"] > FunctionExpression[params.length=1] > BlockStatement[body.length=1] CallExpression[arguments.length=1][callee.object.type="Super"][callee.property.name="_init"] > Identifier:first-child message: _init() that only calls super._init() is unnecessary - selector: >- MethodDefinition[key.name="_init"] > FunctionExpression[params.length=0] > BlockStatement[body.length=1] CallExpression[arguments.length=0][callee.object.type="Super"][callee.property.name="_init"] message: _init() that only calls super._init() is unnecessary no-return-assign: error no-return-await: error no-self-compare: error no-shadow: error no-shadow-restricted-names: error no-spaced-func: error no-tabs: error no-template-curly-in-string: error no-throw-literal: error no-trailing-spaces: error no-undef-init: error no-unneeded-ternary: error no-unused-expressions: error no-unused-vars: - error # Vars use a suffix _ instead of a prefix because of file-scope private vars - varsIgnorePattern: (^unused|_$) argsIgnorePattern: ^(unused|_) no-useless-call: error no-useless-computed-key: error no-useless-concat: error no-useless-constructor: error no-useless-rename: error no-useless-return: error no-whitespace-before-property: error no-with: error nonblock-statement-body-position: - error - below object-curly-newline: - error - consistent: true object-curly-spacing: error object-shorthand: error operator-assignment: error operator-linebreak: error # These may be a bit controversial, we can try them out and enable them later # prefer-const: error # prefer-destructuring: error prefer-numeric-literals: error prefer-promise-reject-errors: error prefer-rest-params: error prefer-spread: error prefer-template: error quotes: - error - single - avoidEscape: true require-await: error rest-spread-spacing: error semi: - error - always semi-spacing: - error - before: false after: true semi-style: error space-before-blocks: error space-before-function-paren: - error - named: never # for `function ()` and `async () =>`, preserve space around keywords anonymous: always asyncArrow: always space-in-parens: error space-infix-ops: - error - int32Hint: false space-unary-ops: error spaced-comment: error switch-colon-spacing: error symbol-description: error template-curly-spacing: error template-tag-spacing: error unicode-bom: error valid-jsdoc: - error - requireReturn: false wrap-iife: - error - inside yield-star-spacing: error yoda: error globals: ARGV: readonly Debugger: readonly GIRepositoryGType: readonly globalThis: readonly imports: readonly Intl: readonly log: readonly logError: readonly print: readonly printerr: readonly parserOptions: ecmaVersion: 2020 gnome-shell-extension-appindicator-42/lint/eslintrc-legacy.yml000066400000000000000000000005511420556714400247670ustar00rootroot00000000000000rules: eqeqeq: off indent: - error - 4 - ignoredNodes: - 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child' CallExpression: arguments: first ArrayExpression: first ObjectExpression: first MemberExpression: off prefer-template: off quotes: off gnome-shell-extension-appindicator-42/lint/eslintrc-shell.yml000066400000000000000000000011171420556714400246310ustar00rootroot00000000000000rules: camelcase: - error - properties: never allow: [^vfunc_, ^on_] consistent-return: error key-spacing: - error - mode: minimum beforeColon: false afterColon: true object-curly-spacing: - error - always prefer-arrow-callback: error overrides: - files: js/** excludedFiles: - js/portalHelper/* globals: global: readonly _: readonly C_: readonly N_: readonly ngettext: readonly - files: subprojects/extensions-app/js/** globals: _: readonly C_: readonly N_: readonly gnome-shell-extension-appindicator-42/locale/000077500000000000000000000000001420556714400214475ustar00rootroot00000000000000gnome-shell-extension-appindicator-42/locale/AppIndicatorExtension.pot000066400000000000000000000054451420556714400264550ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the AppIndicatorExtension package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: AppIndicatorExtension\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\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" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "" #: prefs.js:212 msgid "Center" msgstr "" #: prefs.js:213 msgid "Left" msgstr "" #: prefs.js:214 msgid "Right" msgstr "" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 msgid "Icon size in pixel" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" gnome-shell-extension-appindicator-42/locale/LINGUAS000066400000000000000000000000671420556714400224770ustar00rootroot00000000000000de fr hu it ja nl pl pt_BR ru sk sr@latin sr tr zh_CN gnome-shell-extension-appindicator-42/locale/POTFILES.in000066400000000000000000000001061420556714400232210ustar00rootroot00000000000000prefs.js schemas/org.gnome.shell.extensions.appindicator.gschema.xml gnome-shell-extension-appindicator-42/locale/de.po000066400000000000000000000062451420556714400224060ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2017-08-20 12:22+0200\n" "Last-Translator: Jonatan Hatakeyama Zeidler \n" "Language-Team: \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.1\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Deckkraft (min: 0, max: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Entsättigung (min: 0.0, max: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Helligkeit (min: -1.0, max: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Kontrast (min: -1.0, max: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Symbolgröße (min: 0, max: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Horizontale Anordnung auf Leiste" #: prefs.js:212 msgid "Center" msgstr "Mitte" #: prefs.js:213 msgid "Left" msgstr "Links" #: prefs.js:214 msgid "Right" msgstr "Rechts" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Symbolgröße (min: 0, max: 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Symbolabstand (min: 0, max: 20)" #~ msgid "Tray offset" #~ msgstr "Positionsversatz" gnome-shell-extension-appindicator-42/locale/fr.po000066400000000000000000000064001420556714400224160ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2017-09-17 15:05+0200\n" "Last-Translator: \n" "Language-Team: Jimmy Scionti \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 2.0.3\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Opacité (min : 0 ; max : 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Désaturation (min : 0,0 ; max : 1,0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Luminosité (min : -1,0 ; max : 1,0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Contraste (min : -1,0 ; max : 1,0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Taille des icônes (min : 0 ; max : 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Alignement horizontal de la boîte" #: prefs.js:212 msgid "Center" msgstr "Centre" #: prefs.js:213 msgid "Left" msgstr "Gauche" #: prefs.js:214 msgid "Right" msgstr "Droite" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Taille des icônes (min : 0 ; max : 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Espacement entre les icônes (min : 0 ; max : 20)" #~ msgid "Tray offset" #~ msgstr "Décalage de la boîte" gnome-shell-extension-appindicator-42/locale/hu.po000066400000000000000000000062261420556714400224310ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2017-09-27 06:58+0200\n" "Last-Translator: Falu \n" "Language-Team: \n" "Language: hu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.1\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Átlátszóság (min: 0, max: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Telítetlenség (min: 0.0, max: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Fényesség (min: -1.0, max: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Kontraszt (min: -1.0, max: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Ikon méret (min: 0, max: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Tálca vízszintes illesztése" #: prefs.js:212 msgid "Center" msgstr "Középre" #: prefs.js:213 msgid "Left" msgstr "Balra" #: prefs.js:214 msgid "Right" msgstr "Jobbra" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Ikon méret (min: 0, max: 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Ikonok közti távolság (min: 0, max: 20)" #~ msgid "Tray offset" #~ msgstr "Tálca eltolás" gnome-shell-extension-appindicator-42/locale/it.po000066400000000000000000000064271420556714400224340ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2017-08-27 22:05+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" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Opacità (min: 0, max: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Desaturazione (min: 0.0, max: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Luminosità (min: -1.0, max: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Contrasto (min: -1.0, max: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Dimensione Icona (min: 0, max: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Allineamento orizzontale della system tray" #: prefs.js:212 msgid "Center" msgstr "Centro" #: prefs.js:213 msgid "Left" msgstr "Sinistra" #: prefs.js:214 msgid "Right" msgstr "Destra" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Dimensione Icona (min: 0, max: 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Spazio tra le icone (min: 0, max: 20)" #~ msgid "Tray offset" #~ msgstr "Posizione della system tray" gnome-shell-extension-appindicator-42/locale/ja.po000066400000000000000000000063371420556714400224120ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2017-09-17 22:19+0200\n" "Last-Translator: \n" "Language-Team: Jimmy Scionti \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.3\n" "Plural-Forms: nplurals=1; plural=0;\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "不透明度(min: 0, max: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "彩度低下(min: 0.0, max: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "明度(min: -1.0, max: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "コントラスト(min: -1.0, max: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "アイコンサイズ(min: 0, max: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "トレーポジション" #: prefs.js:212 msgid "Center" msgstr "中央" #: prefs.js:213 msgid "Left" msgstr "左" #: prefs.js:214 msgid "Right" msgstr "右" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "アイコンサイズ(min: 0, max: 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "アイコン間のスペース(min: 0, max: 20)" #~ msgid "Tray offset" #~ msgstr "トレーオフセット" gnome-shell-extension-appindicator-42/locale/meson.build000066400000000000000000000002461420556714400236130ustar00rootroot00000000000000gettext_domain = run_command(jq, '-r', '."gettext-domain"', metadata).stdout().strip() i18n.gettext(gettext_domain, preset: 'glib', install_dir: locale_dir) gnome-shell-extension-appindicator-42/locale/nl.po000066400000000000000000000063551420556714400224310ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2019-09-16 18:21+0200\n" "Last-Translator: Heimen Stoffels \n" "Language-Team: Dutch \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Lokalize 19.11.70\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Doorzichtigheid (min: 0, max: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Verzadiging (min: 0.0, max: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Helderheid (min: -1.0, max: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Contrast (min: -1.0, max: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Pictogramgrootte (min: 0, max: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Horizontale systeemvakindeling" #: prefs.js:212 msgid "Center" msgstr "Gecentreerd" #: prefs.js:213 msgid "Left" msgstr "Links" #: prefs.js:214 msgid "Right" msgstr "Rechts" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Pictogramgrootte (min: 0, max: 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Afstand tussen pictogrammen (min: 0, max: 20)" #~ msgid "Tray offset" #~ msgstr "Positie" gnome-shell-extension-appindicator-42/locale/pl.po000066400000000000000000000067501420556714400224320ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the AppIndicatorExtension package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: AppIndicatorExtension\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2022-01-12 14:32+0000\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.0\n" "Last-Translator: HydeFromT70s\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" "Language: pl\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Krycie (min: 0, max: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Desaturacja (min: 0.0, max: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Jasność (min: -1.0, max: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Kontrast (min: -1.0, max: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Rozmiar ikon (min: 0, max: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Wyśrodkowanie tacki systemowej" #: prefs.js:212 msgid "Center" msgstr "Centralnie" #: prefs.js:213 msgid "Left" msgstr "Po lewej" #: prefs.js:214 msgid "Right" msgstr "Po prawej" #: prefs.js:259 msgid "Indicator ID" msgstr "ID" #: prefs.js:260 msgid "Icon Name" msgstr "Nazwa ikony" #: prefs.js:261 msgid "Attention Icon Name" msgstr "Nazwa ikony uwagi" #: prefs.js:336 msgid "Preferences" msgstr "Ustawienia" #: prefs.js:338 msgid "Custom Icons" msgstr "Niestandardowe ikony" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "Nasycenie" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "Jasność" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "Kontrast" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "Krycie" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "Rozmiar ikony" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 msgid "Icon size in pixel" msgstr "Rozmiar ikony w pikselach" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "Odstępy ikon" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "Odstępy ikon na pasku zadań" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "Pozycja na pasku zadań" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "Ustaw, gdzie powinny pojawić się ikony na pasku zadań" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "Kolejność na pasku zadań" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "Ustaw położenie tacki z ikonami między innymi tackami" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "Niestandardowe ikony" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "Zastąp dowolne ikony niestandardowymi ikonami z motywów" gnome-shell-extension-appindicator-42/locale/pt_BR.po000066400000000000000000000066651420556714400230320ustar00rootroot00000000000000# Brazilian Portuguese translations for TopIcons-Plus package # Traduções em português brasileiro para o pacote TopIcons-Plus. # Copyright (C) 2019 THE TopIcons-Plus'S COPYRIGHT HOLDER # This file is distributed under the same license as the TopIcons-Plus package. # Rafael Fontenelle , 2019. # msgid "" msgstr "" "Project-Id-Version: TopIcons-Plus\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2019-04-17 23:02-0300\n" "Last-Translator: Rafael Fontenelle \n" "Language-Team: Brazilian Portuguese \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" "X-Generator: Gtranslator 3.32.0\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Opacidade (mín: 0, máx: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Dessaturação (mín: 0.0, máx: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Brilho (mín: -1.0, máx: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Contraste (mín: -1.0, máx: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Tamanho de ícones (mín: 0, máx: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Alinhamento horizontal da bandeja" #: prefs.js:212 msgid "Center" msgstr "Centro" #: prefs.js:213 msgid "Left" msgstr "Esquerda" #: prefs.js:214 msgid "Right" msgstr "Direita" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Tamanho de ícones (mín: 0, máx: 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Espaço entre ícones (mín: 0, máx: 20)" #~ msgid "Tray offset" #~ msgstr "Deslocamento da bandeja" gnome-shell-extension-appindicator-42/locale/ru.po000066400000000000000000000077771420556714400224570ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2022-02-08 14:04+0300\n" "Last-Translator: Aleksandr Melman \n" "Language-Team: \n" "Language: ru_RU\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.0\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Прозрачность (от 0 до 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Насыщенность (от 0.0 до +1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Яркость (от -1.0 до +1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Контрастность (от -1.0 до +1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Размер иконок (от 0 до 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Горизонтальное выравнивание" #: prefs.js:212 msgid "Center" msgstr "По центру" #: prefs.js:213 msgid "Left" msgstr "Слева" #: prefs.js:214 msgid "Right" msgstr "Справа" #: prefs.js:259 msgid "Indicator ID" msgstr "Индикатор ID" #: prefs.js:260 msgid "Icon Name" msgstr "Имя значка" #: prefs.js:261 msgid "Attention Icon Name" msgstr "Заменяемое имя значка" #: prefs.js:336 msgid "Preferences" msgstr "Параметры" #: prefs.js:338 msgid "Custom Icons" msgstr "Пользовательские значки" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "Насыщенность" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "Яркость" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "Контрастность" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "Прозрачность" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "Размер значка" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 msgid "Icon size in pixel" msgstr "Размер иконок в пикселях" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "Интервал между значками" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "Интервал между значками в трее" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "Положение в трее" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "Установить, где должен отображаться значок в трее Gnome" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "Порядок в трее" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" "Установить, где должен отображаться трей значков среди других треев" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "Пользовательские значки" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "Заменить любые значки на пользовательские значки из тем" gnome-shell-extension-appindicator-42/locale/sk.po000066400000000000000000000067401420556714400224330ustar00rootroot00000000000000# Slovak translation of gnome-shell-extension-appindicator. # Copyright (C) 2022 # This file is distributed under the same license as the AppIndicatorExtension package. # Jose Riha , 2022. # msgid "" msgstr "" "Project-Id-Version: AppIndicatorExtension\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2022-02-06 11:22+0100\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.0\n" "Last-Translator: Jose Riha \n" "Plural-Forms: nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);\n" "Language: sk\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Krytie (min: 0, max: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Odfarbenie (min: 0.0, max: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Jas (min: -1.0, max: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Kontrast (min: -1.0, max: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Veľkosť ikon (min: 0, max: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Vodorovné zarovnanie lišty" #: prefs.js:212 msgid "Center" msgstr "V strede" #: prefs.js:213 msgid "Left" msgstr "Vľavo" #: prefs.js:214 msgid "Right" msgstr "Vpravo" #: prefs.js:259 msgid "Indicator ID" msgstr "ID" #: prefs.js:260 msgid "Icon Name" msgstr "Názov ikony" #: prefs.js:261 msgid "Attention Icon Name" msgstr "Názov ikony s upozornením" #: prefs.js:336 msgid "Preferences" msgstr "Predvoľby" #: prefs.js:338 msgid "Custom Icons" msgstr "Vlastné ikony" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "Sýtosť" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "Jas" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "Kontrast" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "Krytie" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "Veľkosť ikony" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 msgid "Icon size in pixel" msgstr "Veľkosť ikony v pixeloch" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "Rozstupy medzi ikonami" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "Rozstupy medzi ikonami na lište" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "Umiestnenie na lište" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "Nastavte, kde sa majú ikony na lište zobrazovať" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "Poradie na lište" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "Nastavte, kde sa majú ikony na lište zobrazovať vzhľadom na ostatné ikony" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "Vlastné ikony" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "Nahradiť ľubovoľné ikony vlastnými ikonami z motívov" gnome-shell-extension-appindicator-42/locale/sr.po000066400000000000000000000066411420556714400224420ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2017-09-16 13:28+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 2.0.3\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Прозирност (мин: 0, макс: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Одсићење (мин: 0,0, макс: 1,0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Светлина (мин: -1,0, макс: 1,0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Контраст (мин: -1,0, макс: 1,0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Величина икона (мин: 0, макс: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Хоризонтални положај касете" #: prefs.js:212 msgid "Center" msgstr "центар" #: prefs.js:213 msgid "Left" msgstr "лево" #: prefs.js:214 msgid "Right" msgstr "десно" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Величина икона (мин: 0, макс: 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Размак између икона (мин: 0, макс: 20)" #~ msgid "Tray offset" #~ msgstr "Одступ касете" gnome-shell-extension-appindicator-42/locale/sr@latin.po000066400000000000000000000063731420556714400235740ustar00rootroot00000000000000# 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: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2017-09-16 13:28+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 2.0.3\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Prozirnost (min: 0, maks: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Odsićenje (min: 0,0, maks: 1,0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Svetlina (min: -1,0, maks: 1,0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Kontrast (min: -1,0, maks: 1,0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Veličina ikona (min: 0, maks: 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Horizontalni položaj kasete" #: prefs.js:212 msgid "Center" msgstr "centar" #: prefs.js:213 msgid "Left" msgstr "levo" #: prefs.js:214 msgid "Right" msgstr "desno" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Veličina ikona (min: 0, maks: 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Razmak između ikona (min: 0, maks: 20)" #~ msgid "Tray offset" #~ msgstr "Odstup kasete" gnome-shell-extension-appindicator-42/locale/tr.po000066400000000000000000000063311420556714400224370ustar00rootroot00000000000000# TopIcons Plus Turkish Translate. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Serdar Sağlam , 2019. # msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2019-02-09 00:28+0300\n" "Last-Translator: \n" "Language-Team: Serdar Sağlam \n" "Language: tr\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" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "Opaklık (az: 0, çok: 255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "Doygunluk (az: 0.0, çok: 1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "Parlaklık (az: -1.0, çok: 1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "Karşıtlık (az: -1.0, çok: 1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "Simge boyutu (az: 0, çok : 96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "Simgeleri yatay hizala" #: prefs.js:212 msgid "Center" msgstr "Ortala" #: prefs.js:213 msgid "Left" msgstr "Sol" #: prefs.js:214 msgid "Right" msgstr "Sağ" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "Simge boyutu (az: 0, çok : 96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "Simgeler arasında boşluk (az: 0, çok: 20)" #~ msgid "Tray offset" #~ msgstr "Simgeleri dengele" gnome-shell-extension-appindicator-42/locale/zh_CN.po000066400000000000000000000065111420556714400230130ustar00rootroot00000000000000# Chinese (China) translation for TopIcons-Plus. # Copyright (C) 2017-2017 TopIcons-Plus's COPYRIGHT HOLDER # This file is distributed under the same license as the TopIcons-Plus package. # Dingzhong Chen , 2017. # msgid "" msgstr "" "Project-Id-Version: TopIcons-Plus master\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-27 20:43+0200\n" "PO-Revision-Date: 2017-09-20 03:44+0800\n" "Last-Translator: Dingzhong Chen \n" "Language-Team: \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.3\n" "Plural-Forms: nplurals=1; plural=0;\n" #: prefs.js:67 msgid "Opacity (min: 0, max: 255)" msgstr "不透明度(最低:0,最高:255)" #: prefs.js:95 msgid "Desaturation (min: 0.0, max: 1.0)" msgstr "饱和度(最低:0.0,最高:1.0)" #: prefs.js:123 msgid "Brightness (min: -1.0, max: 1.0)" msgstr "亮度(最低:-1.0,最高:1.0)" #: prefs.js:151 msgid "Contrast (min: -1.0, max: 1.0)" msgstr "对比度(最低:-1.0,最高:1.0)" #: prefs.js:179 msgid "Icon size (min: 0, max: 96)" msgstr "图标大小(最小:0,最大:96)" #: prefs.js:207 msgid "Tray horizontal alignment" msgstr "托盘水平对齐方式" #: prefs.js:212 msgid "Center" msgstr "居中" #: prefs.js:213 msgid "Left" msgstr "左对齐" #: prefs.js:214 msgid "Right" msgstr "右对齐" #: prefs.js:259 msgid "Indicator ID" msgstr "" #: prefs.js:260 msgid "Icon Name" msgstr "" #: prefs.js:261 msgid "Attention Icon Name" msgstr "" #: prefs.js:336 msgid "Preferences" msgstr "" #: prefs.js:338 msgid "Custom Icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:5 msgid "Saturation" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:9 msgid "Brightness" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:13 msgid "Contrast" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:17 msgid "Opacity" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:21 msgid "Icon size" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:22 #, fuzzy msgid "Icon size in pixel" msgstr "图标大小(最小:0,最大:96)" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:26 msgid "Icon spacing" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:27 msgid "Icon spacing within the tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:31 msgid "Position in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:32 msgid "Set where the Icon tray should appear in Gnome tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:36 msgid "Order in tray" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:37 msgid "Set where the Icon tray should appear among other trays" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:41 msgid "Custom icons" msgstr "" #: schemas/org.gnome.shell.extensions.appindicator.gschema.xml:42 msgid "Replace any icons with custom icons from themes" msgstr "" #~ msgid "Spacing between icons (min: 0, max: 20)" #~ msgstr "图标间隔(最小:0,最大:20)" #~ msgid "Tray offset" #~ msgstr "托盘偏移量" gnome-shell-extension-appindicator-42/meson.build000066400000000000000000000046051420556714400223570ustar00rootroot00000000000000project('gnome-shell-ubuntu-appindicators', version : '42', meson_version : '>= 0.53', license: 'GPL2', ) gnome = import ('gnome') i18n = import('i18n') if get_option('local_install').auto() local_install = false if get_option('prefix') == '/usr/local' local_install = run_command(find_program('id'), '-u').stdout().strip() != '0' endif else local_install = get_option('local_install').enabled() endif sh = find_program('sh') jq = find_program('jq') metadata = files('metadata.json') uuid = run_command(jq, '-r', '.uuid', metadata).stdout().strip() if local_install prefix = run_command(sh, '-c', 'echo $HOME').stdout().strip() / '.local' else prefix = get_option('prefix') endif extension_dir = prefix / 'share' / 'gnome-shell' / 'extensions' / uuid if local_install locale_dir = extension_dir / 'locale' schema_dir = extension_dir / 'schemas' else locale_dir = prefix / get_option('localedir') schema_dir = prefix / get_option('datadir') / 'glib-2.0' / 'schemas' endif ls_cmd = ' '.join(['ls', '-1', '@0@']) js_sources = run_command(sh, '-c', ls_cmd.format('*.js')).stdout().strip().split('\n') install_data(metadata, files(js_sources), install_dir: extension_dir) install_subdir('interfaces-xml', install_dir: extension_dir) subdir('schemas') subdir('locale') eslint = find_program('eslint', required: false) if eslint.found() test('eslint', eslint, args: ['.', '-f', 'tap'], workdir: meson.source_root(), protocol: 'tap') endif if local_install run_target('zip-file', command: [ sh, '-c', ';'.join([ 'set -xe', 'tmp_path="$(mktemp -d)"', 'trap "rm -rf $tmp_path" EXIT INT', 'zip_file="$MESON_BUILD_ROOT/@0@.zip"'.format(uuid), 'env DESTDIR="$tmp_path" ninja -C $MESON_BUILD_ROOT install', 'cd "$tmp_path/@0@"'.format(extension_dir), 'rm -f "$zip_file"', 'zip -r "$zip_file" .', ]) ]) endif summary({ 'Local installation': local_install, 'Extension UUID': uuid, 'Gettext domain': gettext_domain, 'ESLint': eslint.found(), }, section: 'Configuration') summary({ 'Extension directory': extension_dir, 'GSchema directory': schema_dir, 'Locale directory': locale_dir, }, section: 'Directories') gnome-shell-extension-appindicator-42/meson_options.txt000066400000000000000000000001011420556714400236350ustar00rootroot00000000000000option('local_install', type: 'feature', value : 'auto') gnome-shell-extension-appindicator-42/metadata.json000066400000000000000000000010401420556714400226560ustar00rootroot00000000000000{ "shell-version": [ "3.33", "3.34", "3.36", "3.38", "40", "41", "42" ], "gettext-domain": "AppIndicatorExtension", "settings-schema": "org.gnome.shell.extensions.appindicator", "uuid": "appindicatorsupport@rgcjonas.gmail.com", "name": "AppIndicator and KStatusNotifierItem Support", "description": "Adds AppIndicator, KStatusNotifierItem and legacy Tray icons support to the Shell", "url": "https://github.com/ubuntu/gnome-shell-extension-appindicator" } gnome-shell-extension-appindicator-42/prefs.js000066400000000000000000000340201420556714400216640ustar00rootroot00000000000000// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- /* exported init, buildPrefsWidget */ const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; try { // eslint-disable-next-line no-unused-expressions imports.misc.extensionUtils; } catch (e) { const resource = Gio.Resource.load( '/usr/share/gnome-shell/org.gnome.Extensions.src.gresource'); resource._register(); imports.searchPath.push('resource:///org/gnome/Extensions/js'); const gtkVersion = GLib.getenv('FORCE_GTK_VERSION') || '4.0'; imports.gi.versions.Gtk = gtkVersion; imports.gi.versions.Gdk = gtkVersion; } const GObject = imports.gi.GObject; const Gtk = imports.gi.Gtk; const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Gettext = imports.gettext.domain( Me ? Me.metadata['gettext-domain'] : 'AppIndicatorExtension'); const _ = Gettext.gettext; function init() { ExtensionUtils.initTranslations(); } const AppIndicatorPreferences = GObject.registerClass( class AppIndicatorPreferences extends Gtk.Box { _init() { super._init({ orientation: Gtk.Orientation.VERTICAL, spacing: 30 }); this._settings = Me ? ExtensionUtils.getSettings() : new Gio.Settings({ schema_id: 'org.gnome.shell.extensions.appindicator' }); let label = null; let widget = null; this.preferences_vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, spacing: 8, margin_start: 30, margin_end: 30, margin_top: 30, margin_bottom: 30 }); this.custom_icons_vbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10, margin_start: 10, margin_end: 10, margin_top: 10, margin_bottom: 10 }); // Icon opacity this.opacity_hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10, margin_start: 10, margin_end: 10, margin_top: 10, margin_bottom: 10 }); label = new Gtk.Label({ label: _('Opacity (min: 0, max: 255)'), hexpand: true, halign: Gtk.Align.START, }); widget = new Gtk.SpinButton({ halign: Gtk.Align.END }); widget.set_sensitive(true); widget.set_range(0, 255); widget.set_value(this._settings.get_int('icon-opacity')); widget.set_increments(1, 2); widget.connect('value-changed', w => { this._settings.set_int('icon-opacity', w.get_value_as_int()); }); if (imports.gi.versions.Gtk === '4.0') { this.opacity_hbox.append(label); this.opacity_hbox.append(widget); } else { this.opacity_hbox.pack_start(label, true, true, 0); this.opacity_hbox.pack_start(widget, false, false, 0); } // Icon saturation this.saturation_hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10, margin_start: 10, margin_end: 10, margin_top: 10, margin_bottom: 10 }); label = new Gtk.Label({ label: _('Desaturation (min: 0.0, max: 1.0)'), hexpand: true, halign: Gtk.Align.START, }); widget = new Gtk.SpinButton({ halign: Gtk.Align.END, digits: 1 }); widget.set_sensitive(true); widget.set_range(0.0, 1.0); widget.set_value(this._settings.get_double('icon-saturation')); widget.set_increments(0.1, 0.2); widget.connect('value-changed', w => { this._settings.set_double('icon-saturation', w.get_value()); }); if (imports.gi.versions.Gtk === '4.0') { this.saturation_hbox.append(label); this.saturation_hbox.append(widget); } else { this.saturation_hbox.pack_start(label, true, true, 0); this.saturation_hbox.pack_start(widget, false, false, 0); } // Icon brightness this.brightness_hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10, margin_start: 10, margin_end: 10, margin_top: 10, margin_bottom: 10 }); label = new Gtk.Label({ label: _('Brightness (min: -1.0, max: 1.0)'), hexpand: true, halign: Gtk.Align.START, }); widget = new Gtk.SpinButton({ halign: Gtk.Align.END, digits: 1 }); widget.set_sensitive(true); widget.set_range(-1.0, 1.0); widget.set_value(this._settings.get_double('icon-brightness')); widget.set_increments(0.1, 0.2); widget.connect('value-changed', w => { this._settings.set_double('icon-brightness', w.get_value()); }); if (imports.gi.versions.Gtk === '4.0') { this.brightness_hbox.append(label); this.brightness_hbox.append(widget); } else { this.brightness_hbox.pack_start(label, true, true, 0); this.brightness_hbox.pack_start(widget, false, false, 0); } // Icon contrast this.contrast_hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10, margin_start: 10, margin_end: 10, margin_top: 10, margin_bottom: 10 }); label = new Gtk.Label({ label: _('Contrast (min: -1.0, max: 1.0)'), hexpand: true, halign: Gtk.Align.START, }); widget = new Gtk.SpinButton({ halign: Gtk.Align.END, digits: 1 }); widget.set_sensitive(true); widget.set_range(-1.0, 1.0); widget.set_value(this._settings.get_double('icon-contrast')); widget.set_increments(0.1, 0.2); widget.connect('value-changed', w => { this._settings.set_double('icon-contrast', w.get_value()); }); if (imports.gi.versions.Gtk === '4.0') { this.contrast_hbox.append(label); this.contrast_hbox.append(widget); } else { this.contrast_hbox.pack_start(label, true, true, 0); this.contrast_hbox.pack_start(widget, false, false, 0); } // Icon size this.icon_size_hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10, margin_start: 10, margin_end: 10, margin_top: 10, margin_bottom: 10 }); label = new Gtk.Label({ label: _('Icon size (min: 0, max: 96)'), hexpand: true, halign: Gtk.Align.START, }); widget = new Gtk.SpinButton({ halign: Gtk.Align.END }); widget.set_sensitive(true); widget.set_range(0, 96); widget.set_value(this._settings.get_int('icon-size')); widget.set_increments(1, 2); widget.connect('value-changed', w => { this._settings.set_int('icon-size', w.get_value_as_int()); }); if (imports.gi.versions.Gtk === '4.0') { this.icon_size_hbox.append(label); this.icon_size_hbox.append(widget); } else { this.icon_size_hbox.pack_start(label, true, true, 0); this.icon_size_hbox.pack_start(widget, false, false, 0); } // Tray position in panel this.tray_position_hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10, margin_start: 10, margin_end: 10, margin_top: 10, margin_bottom: 10 }); label = new Gtk.Label({ label: _('Tray horizontal alignment'), hexpand: true, halign: Gtk.Align.START, }); widget = new Gtk.ComboBoxText(); widget.append('center', _('Center')); widget.append('left', _('Left')); widget.append('right', _('Right')); this._settings.bind('tray-pos', widget, 'active-id', Gio.SettingsBindFlags.DEFAULT); if (imports.gi.versions.Gtk === '4.0') { this.tray_position_hbox.append(label); this.tray_position_hbox.append(widget); this.preferences_vbox.append(this.opacity_hbox); this.preferences_vbox.append(this.saturation_hbox); this.preferences_vbox.append(this.brightness_hbox); this.preferences_vbox.append(this.contrast_hbox); this.preferences_vbox.append(this.icon_size_hbox); this.preferences_vbox.append(this.tray_position_hbox); } else { this.tray_position_hbox.pack_start(label, true, true, 0); this.tray_position_hbox.pack_start(widget, false, false, 0); this.preferences_vbox.pack_start(this.opacity_hbox, true, false, 0); this.preferences_vbox.pack_start(this.saturation_hbox, true, false, 0); this.preferences_vbox.pack_start(this.brightness_hbox, true, false, 0); this.preferences_vbox.pack_start(this.contrast_hbox, true, false, 0); this.preferences_vbox.pack_start(this.icon_size_hbox, true, false, 0); this.preferences_vbox.pack_start(this.tray_position_hbox, true, false, 0); } // Custom icons section const customListStore = new Gtk.ListStore(); customListStore.set_column_types([ GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, ]); const customInitArray = this._settings.get_value('custom-icons').deep_unpack(); customInitArray.forEach(pair => { customListStore.set(customListStore.append(), [0, 1, 2], pair); }); customListStore.append(); const customTreeView = new Gtk.TreeView({ model: customListStore, hexpand: true, vexpand: true, }); const customTitles = [ _('Indicator ID'), _('Icon Name'), _('Attention Icon Name'), ]; const indicatorIdColumn = new Gtk.TreeViewColumn({ title: customTitles[0], sizing: Gtk.TreeViewColumnSizing.AUTOSIZE, }); const customIconColumn = new Gtk.TreeViewColumn({ title: customTitles[1], sizing: Gtk.TreeViewColumnSizing.AUTOSIZE, }); const customAttentionIconColumn = new Gtk.TreeViewColumn({ title: customTitles[2], sizing: Gtk.TreeViewColumnSizing.AUTOSIZE, }); const cellrenderer = new Gtk.CellRendererText({ editable: true }); indicatorIdColumn.pack_start(cellrenderer, true); customIconColumn.pack_start(cellrenderer, true); customAttentionIconColumn.pack_start(cellrenderer, true); indicatorIdColumn.add_attribute(cellrenderer, 'text', 0); customIconColumn.add_attribute(cellrenderer, 'text', 1); customAttentionIconColumn.add_attribute(cellrenderer, 'text', 2); customTreeView.insert_column(indicatorIdColumn, 0); customTreeView.insert_column(customIconColumn, 1); customTreeView.insert_column(customAttentionIconColumn, 2); customTreeView.set_grid_lines(Gtk.TreeViewGridLines.BOTH); if (imports.gi.versions.Gtk === '4.0') this.custom_icons_vbox.append(customTreeView); else this.custom_icons_vbox.pack_start(customTreeView, false, false, 0); cellrenderer.connect('edited', (w, path, text) => { this.selection = customTreeView.get_selection(); const title = customTreeView.get_cursor()[1].get_title(); const columnIndex = customTitles.indexOf(title); const selection = this.selection.get_selected(); const iter = selection[2]; const text2 = customListStore.get_value(iter, columnIndex ? 0 : 1); customListStore.set(iter, [columnIndex], [text]); const storeLength = customListStore.iter_n_children(null); const customIconArray = []; for (let i = 0; i < storeLength; i++) { const returnIter = customListStore.iter_nth_child(null, i); const [success, iterList] = returnIter; if (!success) break; if (iterList) { const id = customListStore.get_value(iterList, 0); const customIcon = customListStore.get_value(iterList, 1); const customAttentionIcon = customListStore.get_value(iterList, 2); if (id && customIcon) customIconArray.push([id, customIcon, customAttentionIcon || '']); } else { break; } } this._settings.set_value('custom-icons', new GLib.Variant( 'a(sss)', customIconArray)); if (storeLength === 1 && (text || text2)) customListStore.append(); if (storeLength > 1) { if ((!text && !text2) && (storeLength - 1 > path)) customListStore.remove(iter); if ((text || text2) && storeLength - 1 <= path) customListStore.append(); } }); this.notebook = new Gtk.Notebook(); this.notebook.append_page(this.preferences_vbox, new Gtk.Label({ label: _('Preferences') })); this.notebook.append_page(this.custom_icons_vbox, new Gtk.Label({ label: _('Custom Icons') })); if (imports.gi.versions.Gtk === '4.0') this.append(this.notebook); else this.add(this.notebook); } }); function buildPrefsWidget() { let widget = new AppIndicatorPreferences(); if (widget.show_all) widget.show_all(); return widget; } if (!Me) { GLib.setenv('GSETTINGS_SCHEMA_DIR', './schemas', true); Gtk.init(null); const loop = GLib.MainLoop.new(null, false); const win = new Gtk.Window(); if (win.set_child) { win.set_child(buildPrefsWidget()); win.connect('close-request', () => loop.quit()); } else { win.add(buildPrefsWidget()); win.connect('delete-event', () => loop.quit()); } win.present(); loop.run(); } gnome-shell-extension-appindicator-42/promiseUtils.js000066400000000000000000000265771420556714400232660ustar00rootroot00000000000000// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- /* exported CancellablePromise, SignalConnectionPromise, IdlePromise, TimeoutPromise, TimeoutSecondsPromise, MetaLaterPromise, _promisify, _promisifySignals */ const { Gio, GLib, GObject, Meta } = imports.gi; const Signals = imports.signals; var CancellablePromise = class extends Promise { constructor(executor, cancellable) { if (!(executor instanceof Function)) throw TypeError('executor is not a function'); if (cancellable && !(cancellable instanceof Gio.Cancellable)) throw TypeError('cancellable parameter is not a Gio.Cancellable'); let rejector; let resolver; super((resolve, reject) => { resolver = resolve; rejector = reject; }); this._resolver = (...args) => { resolver(...args); this._resolved = true; this._cleanup(); }; this._rejector = (...args) => { rejector(...args); this._rejected = true; this._cleanup(); }; if (!cancellable) { executor(this._resolver, this._rejector); return; } this._cancellable = cancellable; this._cancelled = cancellable.is_cancelled(); if (this._cancelled) { this._rejector(new GLib.Error(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED, 'Promise cancelled')); return; } this._cancellationId = cancellable.connect(() => { const id = this._cancellationId; this._cancellationId = 0; GLib.idle_add(GLib.PRIORITY_DEFAULT, () => cancellable.disconnect(id)); this.cancel(); }); executor(this._resolver, this._rejector); } _cleanup() { if (this._cancellationId) this._cancellable.disconnect(this._cancellationId); } get cancellable() { return this._chainRoot._cancellable || null; } get _chainRoot() { return this._root ? this._root : this; } then(...args) { const ret = super.then(...args); /* Every time we call then() on this promise we'd get a new * CancellablePromise however that won't have the properties that the * root one has set, and then it won't be possible to cancel a promise * chain from the last one. * To allow this we keep track of the root promise, make sure that * the same method on the root object is called during cancellation * or any destruction method if you want this to work. */ if (ret instanceof CancellablePromise) ret._root = this._chainRoot; return ret; } resolved() { return !!this._chainRoot._resolved; } rejected() { return !!this._chainRoot._rejected; } cancelled() { return !!this._chainRoot._cancelled; } pending() { return !this.resolved() && !this.rejected(); } cancel() { if (this._root) { this._root.cancel(); return this; } if (!this.pending()) return this; this._cancelled = true; this._rejector(new GLib.Error(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED, 'Promise cancelled')); return this; } }; var SignalConnectionPromise = class extends CancellablePromise { constructor(object, signal, cancellable) { if (arguments.length === 1 && object instanceof Function) { super(object); return; } if (!(object.connect instanceof Function)) throw new TypeError('Not a valid object'); if (object instanceof GObject.Object && !GObject.signal_lookup(signal.split(':')[0], object.constructor.$gtype)) throw new TypeError(`Signal ${signal} not found on object ${object}`); let id; let destroyId; super(resolve => { let connectSignal; if (object instanceof GObject.Object) connectSignal = (sig, cb) => GObject.signal_connect(object, sig, cb); else connectSignal = (sig, cb) => object.connect(sig, cb); id = connectSignal(signal, (_obj, ...args) => { if (!args.length) resolve(); else resolve(args.length === 1 ? args[0] : args); }); if (signal !== 'destroy' && (!(object instanceof GObject.Object) || GObject.signal_lookup('destroy', object.constructor.$gtype))) destroyId = connectSignal('destroy', () => this.cancel()); }, cancellable); this._object = object; this._id = id; this._destroyId = destroyId; } _cleanup() { if (this._id) { let disconnectSignal; if (this._object instanceof GObject.Object) disconnectSignal = id => GObject.signal_handler_disconnect(this._object, id); else disconnectSignal = id => this._object.disconnect(id); disconnectSignal(this._id); if (this._destroyId) { disconnectSignal(this._destroyId); this._destroyId = 0; } this._object = null; this._id = 0; } super._cleanup(); } get object() { return this._chainRoot._object; } }; var GSourcePromise = class extends CancellablePromise { constructor(gsource, priority, cancellable) { if (arguments.length === 1 && gsource instanceof Function) { super(gsource); return; } if (gsource.constructor.$gtype !== GLib.Source.$gtype) throw new TypeError(`gsource ${gsource} is not of type GLib.Source`); if (priority === undefined) priority = GLib.PRIORITY_DEFAULT; else if (!Number.isInteger(priority)) throw TypeError('Invalid priority'); super(resolve => { gsource.set_priority(priority); gsource.set_callback(() => { resolve(); return GLib.SOURCE_REMOVE; }); gsource.attach(null); }, cancellable); this._gsource = gsource; this._gsource.set_name(`[gnome-shell] ${this.constructor.name} ${ new Error().stack.split('\n').filter(line => !line.match(/misc\/promiseUtils\.js/))[0]}`); if (this.rejected()) this._gsource.destroy(); } get gsource() { return this._chainRoot._gsource; } _cleanup() { if (this._gsource) { this._gsource.destroy(); this._gsource = null; } super._cleanup(); } }; var IdlePromise = class extends GSourcePromise { constructor(priority, cancellable) { if (arguments.length === 1 && priority instanceof Function) { super(priority); return; } if (priority === undefined) priority = GLib.PRIORITY_DEFAULT_IDLE; super(GLib.idle_source_new(), priority, cancellable); } }; var TimeoutPromise = class extends GSourcePromise { constructor(interval, priority, cancellable) { if (arguments.length === 1 && interval instanceof Function) { super(interval); return; } if (!Number.isInteger(interval) || interval < 0) throw TypeError('Invalid interval'); super(GLib.timeout_source_new(interval), priority, cancellable); } }; var TimeoutSecondsPromise = class extends GSourcePromise { constructor(interval, priority, cancellable) { if (arguments.length === 1 && interval instanceof Function) { super(interval); return; } if (!Number.isInteger(interval) || interval < 0) throw TypeError('Invalid interval'); super(GLib.timeout_source_new_seconds(interval), priority, cancellable); } }; var MetaLaterPromise = class extends CancellablePromise { constructor(laterType, cancellable) { if (arguments.length === 1 && laterType instanceof Function) { super(laterType); return; } if (laterType && laterType.constructor.$gtype !== Meta.LaterType.$gtype) throw new TypeError(`laterType ${laterType} is not of type Meta.LaterType`); else if (!laterType) laterType = Meta.LaterType.BEFORE_REDRAW; let id; super(resolve => { id = Meta.later_add(laterType, () => { this.remove(); resolve(); return GLib.SOURCE_REMOVE; }); }, cancellable); this._id = id; } _cleanup() { if (this._id) { Meta.later_remove(this._id); this._id = 0; } super._cleanup(); } }; function _promisifySignals(proto) { if (proto.connect_once) return; proto.connect_once = function (signal, cancellable) { return new SignalConnectionPromise(this, signal, cancellable); }; } const addSignalMethods = Signals.addSignalMethods; Signals.addSignalMethods = proto => { addSignalMethods(proto); _promisifySignals(proto); }; _promisifySignals(GObject.Object.prototype); var _promisify = Gio._promisify; if (imports.system.version < 16501) { /* This is backported from upstream gjs, so that all the features are available */ _promisify = function (proto, asyncFunc, finishFunc = `${asyncFunc.replace(/_(begin|async)$/, '')}_finish`) { if (proto[asyncFunc] === undefined) throw new Error(`${proto} has no method named ${asyncFunc}`); if (proto[finishFunc] === undefined) throw new Error(`${proto} has no method named ${finishFunc}`); if (proto[`_original_${asyncFunc}`] !== undefined) return; proto[`_original_${asyncFunc}`] = proto[asyncFunc]; proto[asyncFunc] = function (...args) { if (!args.every(arg => typeof arg !== 'function')) return this[`_original_${asyncFunc}`](...args); return new Promise((resolve, reject) => { const callStack = new Error().stack.split('\n').filter(line => !line.match(/promisify/)).join('\n'); this[`_original_${asyncFunc}`](...args, (source, res) => { try { const result = source !== null && source[finishFunc] !== undefined ? source[finishFunc](res) : proto[finishFunc](res); if (Array.isArray(result) && result.length > 1 && result[0] === true) result.shift(); resolve(result); } catch (error) { if (error.stack) error.stack += `### Promise created here: ###\n${callStack}`; else error.stack = callStack; reject(error); } }); }); }; }; } if (!Promise.allSettled) { Promise.allSettled = function (promises) { let wrappedPromises = promises.map(p => Promise.resolve(p) .then( val => ({ status: 'fulfilled', value: val }), err => ({ status: 'rejected', reason: err }))); return Promise.all(wrappedPromises); }; } gnome-shell-extension-appindicator-42/schemas/000077500000000000000000000000001420556714400216335ustar00rootroot00000000000000gnome-shell-extension-appindicator-42/schemas/README000066400000000000000000000000541420556714400225120ustar00rootroot00000000000000Compile with $ glib-compile-schemas schemas gnome-shell-extension-appindicator-42/schemas/meson.build000066400000000000000000000006001420556714400237710ustar00rootroot00000000000000schema_files = [ run_command(jq, '-r', '."settings-schema"', metadata).stdout().strip() + '.gschema.xml', run_command(sh, '-c', ls_cmd.format('*.gschema.xml')).stdout().strip().split('\n'), ] install_data( files(schema_files), install_dir: schema_dir ) meson.add_install_script(sh.path(), '-c', ' '.join([ 'glib-compile-schemas $DESTDIR/@0@'.format(schema_dir), ])) gnome-shell-extension-appindicator-42/schemas/org.gnome.shell.extensions.appindicator.gschema.xml000066400000000000000000000030731420556714400336410ustar00rootroot00000000000000 0.0 Saturation 0.0 Brightness 0.0 Contrast 240 Opacity 0 Icon size Icon size in pixel 12 Icon spacing Icon spacing within the tray "right" Position in tray Set where the Icon tray should appear in Gnome tray 1 Order in tray Set where the Icon tray should appear among other trays [] Custom icons Replace any icons with custom icons from themes gnome-shell-extension-appindicator-42/settingsManager.js000066400000000000000000000027571420556714400237140ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported SettingsManager, getDefault, getDefaultGSettings */ const ExtensionUtils = imports.misc.extensionUtils; let settingsManager; class SettingsManager { static getDefault() { if (!settingsManager) settingsManager = new SettingsManager(); return settingsManager; } get gsettings() { return this._gsettings; } constructor() { if (settingsManager) throw new Error('SettingsManager is already constructed'); this._gsettings = ExtensionUtils.getSettings(); } } function getDefault() { return SettingsManager.getDefault(); } function getDefaultGSettings() { return SettingsManager.getDefault().gsettings; } gnome-shell-extension-appindicator-42/statusNotifierWatcher.js000066400000000000000000000224221420556714400251110ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported StatusNotifierWatcher */ const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const Extension = imports.misc.extensionUtils.getCurrentExtension(); const AppIndicator = Extension.imports.appIndicator; const IndicatorStatusIcon = Extension.imports.indicatorStatusIcon; const Interfaces = Extension.imports.interfaces; const PromiseUtils = Extension.imports.promiseUtils; const Util = Extension.imports.util; // TODO: replace with org.freedesktop and /org/freedesktop when approved const KDE_PREFIX = 'org.kde'; var WATCHER_BUS_NAME = `${KDE_PREFIX}.StatusNotifierWatcher`; const WATCHER_OBJECT = '/StatusNotifierWatcher'; const DEFAULT_ITEM_OBJECT_PATH = '/StatusNotifierItem'; /* * The StatusNotifierWatcher class implements the StatusNotifierWatcher dbus object */ var StatusNotifierWatcher = class AppIndicatorsStatusNotifierWatcher { constructor(watchDog) { this._watchDog = watchDog; this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(Interfaces.StatusNotifierWatcher, this); this._dbusImpl.export(Gio.DBus.session, WATCHER_OBJECT); this._cancellable = new Gio.Cancellable(); this._everAcquiredName = false; this._ownName = Gio.DBus.session.own_name(WATCHER_BUS_NAME, Gio.BusNameOwnerFlags.NONE, this._acquiredName.bind(this), this._lostName.bind(this)); this._items = new Map(); this._dbusImpl.emit_signal('StatusNotifierHostRegistered', null); this._seekStatusNotifierItems().catch(e => { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) logError(e, 'Looking for StatusNotifierItem\'s'); }); } _acquiredName() { this._everAcquiredName = true; this._watchDog.nameAcquired = true; } _lostName() { if (this._everAcquiredName) Util.Logger.debug(`Lost name${WATCHER_BUS_NAME}`); else Util.Logger.warn(`Failed to acquire ${WATCHER_BUS_NAME}`); this._watchDog.nameAcquired = false; } // create a unique index for the _items dictionary _getItemId(busName, objPath) { return busName + objPath; } async _registerItem(service, busName, objPath) { let id = this._getItemId(busName, objPath); if (this._items.has(id)) { Util.Logger.warn(`Item ${id} is already registered`); return; } Util.Logger.debug(`Registering StatusNotifierItem ${id}`); try { const indicator = new AppIndicator.AppIndicator(service, busName, objPath); this._items.set(id, indicator); indicator.connect('name-owner-changed', async () => { if (!indicator.hasNameOwner) { await new PromiseUtils.TimeoutPromise(500, GLib.PRIORITY_DEFAULT, this._cancellable); if (!indicator.hasNameOwner) this._itemVanished(id); } }); // if the desktop is not ready delay the icon creation and signal emissions await Util.waitForStartupCompletion(indicator.cancellable); const statusIcon = new IndicatorStatusIcon.IndicatorStatusIcon(indicator); indicator.connect('destroy', () => statusIcon.destroy()); this._dbusImpl.emit_signal('StatusNotifierItemRegistered', GLib.Variant.new('(s)', [indicator.uniqueId])); this._dbusImpl.emit_property_changed('RegisteredStatusNotifierItems', GLib.Variant.new('as', this.RegisteredStatusNotifierItems)); } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) logError(e); throw e; } } _ensureItemRegistered(service, busName, objPath) { let id = this._getItemId(busName, objPath); let item = this._items.get(id); if (item) { // delete the old one and add the new indicator Util.Logger.debug(`Attempting to re-register ${id}; resetting instead`); item.reset(); return; } this._registerItem(service, busName, objPath); } async _seekStatusNotifierItems() { // Some indicators (*coff*, dropbox, *coff*) do not re-register again // when the plugin is enabled/disabled, thus we need to manually look // for the objects in the session bus that implements the // StatusNotifierItem interface... However let's do it after a low // priority idle, so that it won't affect startup. const cancellable = this._cancellable; await new PromiseUtils.IdlePromise(GLib.PRIORITY_LOW, cancellable); const bus = Gio.DBus.session; const uniqueNames = await Util.getBusNames(bus, cancellable); const introspectName = async name => { const nodes = await Util.introspectBusObject(bus, name, cancellable); nodes.forEach(({ nodeInfo, path }) => { if (Util.dbusNodeImplementsInterfaces(nodeInfo, ['org.kde.StatusNotifierItem'])) { Util.Logger.debug(`Found ${name} at ${path} implementing StatusNotifierItem iface`); const id = this._getItemId(name, path); if (!this._items.has(id)) { Util.Logger.warn(`Using Brute-force mode for StatusNotifierItem ${id}`); this._registerItem(path, name, path); } } }); }; await Promise.allSettled([...uniqueNames].map(n => introspectName(n))); } async RegisterStatusNotifierItemAsync(params, invocation) { // it would be too easy if all application behaved the same // instead, ayatana patched gnome apps to send a path // while kde apps send a bus name let [service] = params; let busName, objPath; if (service.charAt(0) === '/') { // looks like a path busName = invocation.get_sender(); objPath = service; } else if (service.match(Util.BUS_ADDRESS_REGEX)) { try { busName = await Util.getUniqueBusName(invocation.get_connection(), service, this._cancellable); } catch (e) { logError(e); } objPath = DEFAULT_ITEM_OBJECT_PATH; } if (!busName || !objPath) { let error = `Impossible to register an indicator for parameters '${ service.toString()}'`; Util.Logger.warn(error); invocation.return_dbus_error('org.gnome.gjs.JSError.ValueError', error); return; } this._ensureItemRegistered(service, busName, objPath); invocation.return_value(null); } _itemVanished(id) { // FIXME: this is useless if the path name disappears while the bus stays alive (not unheard of) if (this._items.has(id)) this._remove(id); } _remove(id) { const indicator = this._items.get(id); const { uniqueId } = indicator; indicator.destroy(); this._items.delete(id); this._dbusImpl.emit_signal('StatusNotifierItemUnregistered', GLib.Variant.new('(s)', [uniqueId])); this._dbusImpl.emit_property_changed('RegisteredStatusNotifierItems', GLib.Variant.new('as', this.RegisteredStatusNotifierItems)); } RegisterStatusNotifierHostAsync(_service, invocation) { invocation.return_error_literal( Gio.DBusError, Gio.DBusError.NOT_SUPPORTED, 'Registering additional notification hosts is not supported'); } IsNotificationHostRegistered() { return true; } get RegisteredStatusNotifierItems() { return Array.from(this._items.values()).map(i => i.uniqueId); } get IsStatusNotifierHostRegistered() { return true; } get ProtocolVersion() { return 0; } destroy() { if (!this._isDestroyed) { // this doesn't do any sync operation and doesn't allow us to hook up the event of being finished // which results in our unholy debounce hack (see extension.js) Array.from(this._items.keys()).forEach(i => this._remove(i)); this._dbusImpl.emit_signal('StatusNotifierHostUnregistered', null); Gio.DBus.session.unown_name(this._ownName); this._cancellable.cancel(); this._dbusImpl.unexport(); delete this._items; this._isDestroyed = true; } } }; gnome-shell-extension-appindicator-42/trayIconsManager.js000066400000000000000000000052341420556714400240200ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported TrayIconsManager */ const Shell = imports.gi.Shell; const Main = imports.ui.main; const Signals = imports.signals; const ExtensionUtils = imports.misc.extensionUtils; const Extension = ExtensionUtils.getCurrentExtension(); const IndicatorStatusIcon = Extension.imports.indicatorStatusIcon; const Util = Extension.imports.util; let trayIconsManager; var TrayIconsManager = class TrayIconsManager { static initialize() { if (!trayIconsManager) trayIconsManager = new TrayIconsManager(); return trayIconsManager; } static destroy() { trayIconsManager.destroy(); } constructor() { if (trayIconsManager) throw new Error('TrayIconsManager is already constructed'); this._tray = new Shell.TrayManager(); Util.connectSmart(this._tray, 'tray-icon-added', this, this.onTrayIconAdded); Util.connectSmart(this._tray, 'tray-icon-removed', this, this.onTrayIconRemoved); this._tray.manage_screen(Main.panel); this._icons = []; } onTrayIconAdded(_tray, icon) { const trayIcon = new IndicatorStatusIcon.IndicatorStatusTrayIcon(icon); this._icons.push(trayIcon); trayIcon.connect('destroy', () => this._icons.splice(this._icons.indexOf(trayIcon), 1)); } onTrayIconRemoved(_tray, icon) { icon.destroy(); } destroy() { this.emit('destroy'); this._icons.forEach(i => i.destroy()); if (this._tray.unmanage_screen) { this._tray.unmanage_screen(); this._tray = null; } else { // FIXME: This is very ugly, but it's needed by old shell versions this._tray = null; imports.system.gc(); // force finalizing tray to unmanage screen } trayIconsManager = null; } }; Signals.addSignalMethods(TrayIconsManager.prototype); gnome-shell-extension-appindicator-42/util.js000066400000000000000000000314321420556714400215260ustar00rootroot00000000000000// This file is part of the AppIndicator/KStatusNotifierItem GNOME Shell extension // // 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. /* exported refreshPropertyOnProxy, getUniqueBusName, getBusNames, introspectBusObject, dbusNodeImplementsInterfaces, waitForStartupCompletion, connectSmart, versionCheck, getDefaultTheme, BUS_ADDRESS_REGEX */ const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const Gtk = imports.gi.Gtk; const Gdk = imports.gi.Gdk; const Main = imports.ui.main; const Meta = imports.gi.Meta; const GObject = imports.gi.GObject; const St = imports.gi.St; const Config = imports.misc.config; const ExtensionUtils = imports.misc.extensionUtils; const Extension = ExtensionUtils.getCurrentExtension(); const Params = imports.misc.params; const PromiseUtils = Extension.imports.promiseUtils; const Signals = imports.signals; var BUS_ADDRESS_REGEX = /([a-zA-Z0-9._-]+\.[a-zA-Z0-9.-]+)|(:[0-9]+\.[0-9]+)$/; PromiseUtils._promisify(Gio.DBusConnection.prototype, 'call', 'call_finish'); async function refreshPropertyOnProxy(proxy, propertyName, params) { if (!proxy._proxyCancellables) proxy._proxyCancellables = new Map(); params = Params.parse(params, { skipEqualityCheck: false, }); let cancellable = cancelRefreshPropertyOnProxy(proxy, { propertyName, addNew: true, }); try { const [valueVariant] = (await proxy.g_connection.call(proxy.g_name, proxy.g_object_path, 'org.freedesktop.DBus.Properties', 'Get', GLib.Variant.new('(ss)', [proxy.g_interface_name, propertyName]), GLib.VariantType.new('(v)'), Gio.DBusCallFlags.NONE, -1, cancellable)).deep_unpack(); proxy._proxyCancellables.delete(propertyName); if (!params.skipEqualityCheck && proxy.get_cached_property(propertyName).equal(valueVariant)) return; proxy.set_cached_property(propertyName, valueVariant); // synthesize a batched property changed event if (!proxy._proxyChangedProperties) proxy._proxyChangedProperties = {}; proxy._proxyChangedProperties[propertyName] = valueVariant; if (!proxy._proxyPropertiesEmit || !proxy._proxyPropertiesEmit.pending()) { proxy._proxyPropertiesEmit = new PromiseUtils.TimeoutPromise(16, GLib.PRIORITY_DEFAULT_IDLE, cancellable); await proxy._proxyPropertiesEmit; proxy.emit('g-properties-changed', GLib.Variant.new('a{sv}', proxy._proxyChangedProperties), []); delete proxy._proxyChangedProperties; } } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) { // the property may not even exist, silently ignore it Logger.debug(`While refreshing property ${propertyName}: ${e}`); proxy._proxyCancellables.delete(propertyName); delete proxy._proxyChangedProperties[propertyName]; } } } function cancelRefreshPropertyOnProxy(proxy, params) { if (!proxy._proxyCancellables) return null; params = Params.parse(params, { propertyName: undefined, addNew: false, }); if (params.propertyName !== undefined) { let cancellable = proxy._proxyCancellables.get(params.propertyName); if (cancellable) { cancellable.cancel(); if (!params.addNew) proxy._proxyCancellables.delete(params.propertyName); } if (params.addNew) { cancellable = new Gio.Cancellable(); proxy._proxyCancellables.set(params.propertyName, cancellable); return cancellable; } } else { proxy._proxyCancellables.forEach(c => c.cancel()); delete proxy._proxyChangedProperties; delete proxy._proxyCancellables; } return null; } async function getUniqueBusName(bus, name, cancellable) { if (name[0] === ':') return name; if (!bus) bus = Gio.DBus.session; const variantName = new GLib.Variant('(s)', [name]); const [unique] = (await bus.call('org.freedesktop.DBus', '/', 'org.freedesktop.DBus', 'GetNameOwner', variantName, new GLib.VariantType('(s)'), Gio.DBusCallFlags.NONE, -1, cancellable)).deep_unpack(); return unique; } async function getBusNames(bus, cancellable) { if (!bus) bus = Gio.DBus.session; const [names] = (await bus.call('org.freedesktop.DBus', '/', 'org.freedesktop.DBus', 'ListNames', null, new GLib.VariantType('(as)'), Gio.DBusCallFlags.NONE, -1, cancellable)).deep_unpack(); const uniqueNames = new Set(); const requests = names.map(name => getUniqueBusName(bus, name, cancellable)); const results = await Promise.allSettled(requests); for (let i = 0; i < results.length; i++) { const result = results[i]; if (result.status === 'fulfilled') uniqueNames.add(result.value); else if (!result.reason.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Logger.debug(`Impossible to get the unique name of ${names[i]}: ${result.reason}`); } return uniqueNames; } async function introspectBusObject(bus, name, cancellable, path = undefined) { if (!path) path = '/'; const [introspection] = (await bus.call(name, path, 'org.freedesktop.DBus.Introspectable', 'Introspect', null, new GLib.VariantType('(s)'), Gio.DBusCallFlags.NONE, -1, cancellable)).deep_unpack(); const nodeInfo = Gio.DBusNodeInfo.new_for_xml(introspection); const nodes = [{ nodeInfo, path }]; if (path === '/') path = ''; const requests = []; for (const subNodes of nodeInfo.nodes) { const subPath = `${path}/${subNodes.path}`; requests.push(introspectBusObject(bus, name, cancellable, subPath)); } for (const result of await Promise.allSettled(requests)) { if (result.status === 'fulfilled') result.value.forEach(n => nodes.push(n)); else if (!result.reason.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) Logger.debug(`Impossible to get node info: ${result.reason}`); } return nodes; } function dbusNodeImplementsInterfaces(nodeInfo, interfaces) { if (!(nodeInfo instanceof Gio.DBusNodeInfo) || !Array.isArray(interfaces)) return false; return interfaces.some(iface => nodeInfo.lookup_interface(iface)); } var NameWatcher = class AppIndicatorsNameWatcher { constructor(name) { this._watcherId = Gio.DBus.session.watch_name(name, Gio.BusNameWatcherFlags.NONE, () => { this._nameOnBus = true; Logger.debug(`Name ${name} appeared`); this.emit('changed'); this.emit('appeared'); }, () => { this._nameOnBus = false; Logger.debug(`Name ${name} vanished`); this.emit('changed'); this.emit('vanished'); }); } destroy() { this.emit('destroy'); Gio.DBus.session.unwatch_name(this._watcherId); delete this._watcherId; } get nameOnBus() { return !!this._nameOnBus; } }; Signals.addSignalMethods(NameWatcher.prototype); function connectSmart3A(src, signal, handler) { let id = src.connect(signal, handler); if (src.connect && (!(src instanceof GObject.Object) || GObject.signal_lookup('destroy', src))) { let destroyId = src.connect('destroy', () => { src.disconnect(id); src.disconnect(destroyId); }); } } function connectSmart4A(src, signal, target, method) { if (typeof method !== 'function') throw new TypeError('Unsupported function'); method = method.bind(target); const signalId = src.connect(signal, method); const onDestroy = () => { src.disconnect(signalId); if (srcDestroyId) src.disconnect(srcDestroyId); if (tgtDestroyId) target.disconnect(tgtDestroyId); }; // GObject classes might or might not have a destroy signal // JS Classes will not complain when connecting to non-existent signals const srcDestroyId = src.connect && (!(src instanceof GObject.Object) || GObject.signal_lookup('destroy', src)) ? src.connect('destroy', onDestroy) : 0; const tgtDestroyId = target.connect && (!(target instanceof GObject.Object) || GObject.signal_lookup('destroy', target)) ? target.connect('destroy', onDestroy) : 0; } // eslint-disable-next-line valid-jsdoc /** * Connect signals to slots, and remove the connection when either source or * target are destroyed * * Usage: * Util.connectSmart(srcOb, 'signal', tgtObj, 'handler') * or * Util.connectSmart(srcOb, 'signal', () => { ... }) */ function connectSmart(...args) { if (arguments.length === 4) return connectSmart4A(...args); else return connectSmart3A(...args); } function getDefaultTheme() { if (Gdk.Screen.get_default()) { const defaultTheme = Gtk.IconTheme.get_default(); if (defaultTheme) return defaultTheme; } const defaultTheme = new Gtk.IconTheme(); defaultTheme.set_custom_theme(St.Settings.get().gtk_icon_theme); return defaultTheme; } // eslint-disable-next-line valid-jsdoc /** * Helper function to wait for the system startup to be completed. * Adding widgets before the desktop is ready to accept them can result in errors. */ async function waitForStartupCompletion(cancellable) { if (Main.layoutManager._startingUp) await Main.layoutManager.connect_once('startup-complete', cancellable); const displayManager = Gdk.DisplayManager.get(); if (!Meta.is_wayland_compositor() && !displayManager.get_default_display()) await displayManager.connect_once('display-opened', cancellable); } /** * Helper class for logging stuff */ var Logger = class AppIndicatorsLogger { static _logStructured(logLevel, message, extraFields = {}) { if (!Object.values(GLib.LogLevelFlags).includes(logLevel)) { Logger._logStructured(GLib.LogLevelFlags.LEVEL_WARNING, 'logLevel is not a valid GLib.LogLevelFlags'); return; } let domain = Extension.metadata.name; let fields = { 'SYSLOG_IDENTIFIER': Extension.metadata.uuid, 'MESSAGE': `${message}`, }; let thisFile = null; let { stack } = new Error(); for (let stackLine of stack.split('\n')) { stackLine = stackLine.replace('resource:///org/gnome/Shell/', ''); let [code, line] = stackLine.split(':'); let [func, file] = code.split(/@(.+)/); if (!thisFile || thisFile === file) { thisFile = file; continue; } fields = Object.assign(fields, { 'CODE_FILE': file || '', 'CODE_LINE': line || '', 'CODE_FUNC': func || '', }); break; } GLib.log_structured(domain, logLevel, Object.assign(fields, extraFields)); } static debug(message) { Logger._logStructured(GLib.LogLevelFlags.LEVEL_DEBUG, message); } static message(message) { Logger._logStructured(GLib.LogLevelFlags.LEVEL_MESSAGE, message); } static warn(message) { Logger._logStructured(GLib.LogLevelFlags.LEVEL_WARNING, message); } static error(message) { Logger._logStructured(GLib.LogLevelFlags.LEVEL_ERROR, message); } static critical(message) { Logger._logStructured(GLib.LogLevelFlags.LEVEL_CRITICAL, message); } }; function versionCheck(required) { if (ExtensionUtils.versionCheck instanceof Function) return ExtensionUtils.versionCheck(required, Config.PACKAGE_VERSION); const current = Config.PACKAGE_VERSION; let currentArray = current.split('.'); let major = currentArray[0]; let minor = currentArray[1]; for (let i = 0; i < required.length; i++) { let requiredArray = required[i].split('.'); if (requiredArray[0] === major && (requiredArray[1] === undefined && isFinite(minor) || requiredArray[1] === minor)) return true; } return false; }