diff options
24 files changed, 2014 insertions, 0 deletions
diff --git a/hibernate-status/.gitignore b/hibernate-status/.gitignore new file mode 100644 index 0000000..68270f9 --- /dev/null +++ b/hibernate-status/.gitignore @@ -0,0 +1,6 @@ +**/*.compiled +*.zip +.~ +*~ +*.mo +locale/hibernate-status-button.pot diff --git a/hibernate-status/LICENSE b/hibernate-status/LICENSE new file mode 100644 index 0000000..d6a9326 --- /dev/null +++ b/hibernate-status/LICENSE @@ -0,0 +1,340 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/> + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/hibernate-status/Makefile b/hibernate-status/Makefile new file mode 100644 index 0000000..3378024 --- /dev/null +++ b/hibernate-status/Makefile @@ -0,0 +1,77 @@ +# Basic Makefile + +UUID = hibernate-status@dromi +BASE_MODULES = extension.js metadata.json confirmDialog.js LICENSE README.md +EXTRA_MODULES = prefs.js +TOLOCALIZE = confirmDialog.js prefs.js +PO_FILES := $(wildcard ./locale/*/*/*.po) +MO_FILES := $(PO_FILES:.po=.mo) + +ifeq ($(strip $(DESTDIR)),) + INSTALLTYPE = local + INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions +else + INSTALLTYPE = system + SHARE_PREFIX = $(DESTDIR)/usr/share + INSTALLBASE = $(SHARE_PREFIX)/gnome-shell/extensions +endif +INSTALLNAME = hibernate-status@dromi + +all: extension + +clean: + rm -f ./schemas/gschemas.compiled + rm -f ./**/*~ + rm -f ./locale/*/*/*.mo + rm -f ./locale/hibernate-status-button.pot + +extension: ./schemas/gschemas.compiled $(MO_FILES) + +./schemas/gschemas.compiled: ./schemas/org.gnome.shell.extensions.hibernate-status-button.gschema.xml + glib-compile-schemas ./schemas/ + +potfile: ./locale/hibernate-status-button.pot + +mergepo: potfile + for l in $(PO_FILES); do \ + msgmerge -U $$l ./locale/hibernate-status-button.pot; \ + done; + +./locale/hibernate-status-button.pot: $(TOLOCALIZE) + mkdir -p locale + xgettext -k --keyword=__ --keyword=N__ --add-comments='Translators:' -o locale/hibernate-status-button.pot --package-name "Hibernate Status Button" $(TOLOCALIZE) + +%.mo: %.po + msgfmt -c $< -o $@ + +install: install-local + +install-local: _build + rm -rf $(INSTALLBASE)/$(INSTALLNAME) + mkdir -p $(INSTALLBASE)/$(INSTALLNAME) + cp -r ./_build/* $(INSTALLBASE)/$(INSTALLNAME)/ +ifeq ($(INSTALLTYPE),system) + # system-wide settings and locale files + # rm -r $(INSTALLBASE)/$(INSTALLNAME)/schemas + rm -f $(INSTALLBASE)/$(INSTALLNAME)/schemas/*gschema.xml + rm -r $(INSTALLBASE)/$(INSTALLNAME)/locale + mkdir -p $(SHARE_PREFIX)/glib-2.0/schemas $(SHARE_PREFIX)/locale + cp -r ./schemas/*gschema.* $(SHARE_PREFIX)/glib-2.0/schemas + cp -r ./_build/locale/* $(SHARE_PREFIX)/locale +endif + -rm -fR _build + echo done + +zip-file: _build + cd _build ; zip -qr "$(UUID).zip" . -x '*.po' + mv _build/$(UUID).zip ./ + -rm -fR _build + +_build: all + -rm -fR ./_build + mkdir -p _build + cp $(BASE_MODULES) $(EXTRA_MODULES) _build + mkdir -p _build/schemas + cp schemas/*.xml _build/schemas/ + cp schemas/gschemas.compiled _build/schemas/ + cp -r locale/ _build/locale diff --git a/hibernate-status/README.md b/hibernate-status/README.md new file mode 100644 index 0000000..ff88abd --- /dev/null +++ b/hibernate-status/README.md @@ -0,0 +1,41 @@ +# gnome-shell-extension-hibernate-status + +Gnome Shell extension that adds a hibernate/hybrid suspend button in Status menu. + +Originally developed by [@arelange](https://github.com/arelange); now maintained by [@p91paul](https://github.com/p91paul). + +Supports GNOME 3.36. + +## FAQ + +### Hibernation does not work + +Try launching from your terminal + + systemctl hibernate + +If it doesn't work, it means hibernation is disabled on your system. Please see: + +https://askubuntu.com/questions/1034185/ubuntu-18-04-cant-resume-after-hibernate/1064114#1064114 + +or + +https://help.ubuntu.com/16.04/ubuntu-help/power-hibernate.html + +### Hibernation button does not show up, but systemctl hibernate works + +If you are running Ubuntu, try putting + + [Enable hibernate in upower] + Identity=unix-user:* + Action=org.freedesktop.upower.hibernate + ResultActive=yes + + [Enable hibernate in logind] + Identity=unix-user:* + Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit + ResultActive=yes + +into /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla + +Otherwise check for similar settings for your distribution. Credit: https://github.com/arelange/gnome-shell-extension-hibernate-status/issues/41#issuecomment-565883599 diff --git a/hibernate-status/buildforupload.sh b/hibernate-status/buildforupload.sh new file mode 100755 index 0000000..d2c705c --- /dev/null +++ b/hibernate-status/buildforupload.sh @@ -0,0 +1,2 @@ +#!/bin/bash +make zip-file diff --git a/hibernate-status/confirmDialog.js b/hibernate-status/confirmDialog.js new file mode 100644 index 0000000..62069e2 --- /dev/null +++ b/hibernate-status/confirmDialog.js @@ -0,0 +1,193 @@ +const Gio = imports.gi.Gio; +const GLib = imports.gi.GLib; +const GObject = imports.gi.GObject; +const Mainloop = imports.mainloop; + +const LoginManager = imports.misc.loginManager; +const Main = imports.ui.main; +const StatusSystem = imports.ui.status.system; +const PopupMenu = imports.ui.popupMenu; +const ModalDialog = imports.ui.modalDialog; +const CheckBox = imports.ui.checkBox.CheckBox; +const St = imports.gi.St; +const Clutter = imports.gi.Clutter; +const ExtensionUtils = imports.misc.extensionUtils; + +// Use __ () and N__() for the extension gettext domain, and reuse +// the shell domain with the default _() and N_() +const Gettext = imports.gettext.domain('hibernate-status-button'); +const __ = Gettext.gettext; +const N__ = function(e) { return e }; + +ExtensionUtils.initTranslations('hibernate-status-button'); + +var HibernateDialogContent = { + subject: C_("title", __("Hibernate")), + description: __("Do you really want to hibernate the system?"), + confirmButtons: [{ + signal: 'Cancel', + label: C_("button", __("Cancel")), + key: Clutter.Escape + }, + { + signal: 'ConfirmedHibernate', + label: C_("button", __("Hibernate")), + default: true + }], + iconName: 'document-save-symbolic', + iconStyleClass: 'end-session-dialog-shutdown-icon', +}; + +var SystemdMissingDialogContent = { + subject: C_("title", __("Hibernate button: Systemd Missing")), + description: __("Systemd seems to be missing and is required."), + confirmButtons: [{ + signal: 'Cancel', + label: C_("button", __("Cancel")), + key: Clutter.Escape + }, + { + signal: 'DisableExtension', + label: C_("button", __("Disable Extension")), + default: true + }], + iconName: 'document-save-symbolic', + iconStyleClass: 'end-session-dialog-shutdown-icon', +}; + + +var HibernateFailedDialogContent = { + subject: C_("title", __("Hibernate button: Hibernate failed")), + description: __("Looks like hibernation failed.\n" + + "On some linux distributions hibernation is disabled\n" + + "because not all hardware supports it well;\n" + + "please check your distribution documentation\n" + + "on how to enable it."), + checkBox: __("You are wrong, don't check this anymore!"), + confirmButtons: [{ + signal: 'Cancel', + label: C_("button", __("Cancel")), + key: Clutter.Escape + }, + { + signal: 'DisableExtension', + label: C_("button", __("Disable Extension")), + default: true + }], + iconName: 'document-save-symbolic', + iconStyleClass: 'end-session-dialog-shutdown-icon', +}; + +const _DIALOG_ICON_SIZE = 32; + +function _setLabelText(label, text) { + if (text) { + label.set_text(text); + label.show(); + } else { + label.set_text(''); + label.hide(); + } +} + +var ConfirmDialog = GObject.registerClass({ + Signals: { 'ConfirmedHibernate': { param_types: [ GObject.TYPE_BOOLEAN ] }, + 'DisableExtension': { param_types: [ GObject.TYPE_BOOLEAN ] }, + 'Cancel': { param_types: [ GObject.TYPE_BOOLEAN ] } } +}, +class ConfirmDialog extends ModalDialog.ModalDialog { + _init(dialog) { + super._init({ + styleClass: 'end-session-dialog', + destroyOnClose: true + }); + + let mainContentLayout = new St.BoxLayout({ + vertical: false, + x_expand: true , + y_expand: false + }); + this.contentLayout.add(mainContentLayout); + + this._iconBin = new St.Bin({ + x_expand: true, + y_expand: false, + x_align: St.Align.END, + y_align: St.Align.START + }); + mainContentLayout.add(this._iconBin); + + let messageLayout = new St.BoxLayout({ + vertical: true, + y_align: St.Align.START + }); + mainContentLayout.add(messageLayout); + + this._subjectLabel = new St.Label({ + style_class: 'end-session-dialog-subject', + y_expand: false, + y_align: St.Align.START + }); + + messageLayout.add(this._subjectLabel); + + this._descriptionLabel = new St.Label({ + style_class: 'end-session-dialog-description', + y_expand: true, + y_align: St.Align.START + }); + + messageLayout.add(this._descriptionLabel); + + // fill dialog + + _setLabelText(this._descriptionLabel, dialog.description); + _setLabelText(this._subjectLabel, dialog.subject); + + if (dialog.iconName) { + this._iconBin.child = new St.Icon({ + icon_name: dialog.iconName, + icon_size: _DIALOG_ICON_SIZE, + style_class: dialog.iconStyleClass + }); + } + + if (dialog.checkBox) { + this._checkBox = new CheckBox(dialog.checkBox); + mainContentLayout.add(this._checkBox.actor); + } + + let buttons = []; + for (let i = 0; i < dialog.confirmButtons.length; i++) { + let signal = dialog.confirmButtons[i].signal; + let label = dialog.confirmButtons[i].label; + let keys = dialog.confirmButtons[i].key; + buttons.push({ + action: () => { + this.close(); + let signalId = this.connect('closed', + () => { + this.disconnect(signalId); + this._confirm(signal); + }); + }, + label: label, + key: keys + }); + }; + + this.setButtons(buttons); + + } + + _confirm(signal) { + var checked; + if (this._checkBox) + checked = this._checkBox.actor.get_checked() + this.emit(signal, checked); + } + + cancel() { + this.close(); + } +}); diff --git a/hibernate-status/extension.js b/hibernate-status/extension.js new file mode 100644 index 0000000..6e0b248 --- /dev/null +++ b/hibernate-status/extension.js @@ -0,0 +1,248 @@ +const Gio = imports.gi.Gio; +const GLib = imports.gi.GLib; +const Mainloop = imports.mainloop; + +const ExtensionUtils = imports.misc.extensionUtils; +const LoginManager = imports.misc.loginManager; +const Main = imports.ui.main; +const StatusSystem = imports.ui.status.system; +const PopupMenu = imports.ui.popupMenu; +const Me = imports.misc.extensionUtils.getCurrentExtension(); +const ExtensionSystem = imports.ui.extensionSystem; +const ConfirmDialog = Me.imports.confirmDialog; +const Prefs = new Me.imports.prefs.Prefs(); + + +// Use __ () and N__() for the extension gettext domain, and reuse +// the shell domain with the default _() and N_() +const Gettext = imports.gettext.domain('hibernate-status-button'); +const __ = Gettext.gettext; +const N__ = function(e) { return e }; +ExtensionUtils.initTranslations('hibernate-status-button'); + +const HIBERNATE_CHECK_TIMEOUT = 20000; + +class Extension { + _loginManagerCanHibernate(asyncCallback) { + if (this._loginManager._proxy) { + // systemd path + this._loginManager._proxy.call("CanHibernate", + null, + Gio.DBusCallFlags.NONE, + -1, null, function (proxy, asyncResult) { + let result, error; + + try { + result = proxy.call_finish(asyncResult).deep_unpack(); + } catch (e) { + error = e; + } + + if (error) + asyncCallback(false); + else + asyncCallback(result[0] != 'no'); + }); + } else { + Mainloop.idle_add(() => { + asyncCallback(false); + return false; + }); + } + } + + _loginManagerHibernate() { + if (Prefs.getHibernateWorksCheckEnabled()) { + this._hibernateStarted = new Date(); + GLib.timeout_add(GLib.PRIORITY_DEFAULT, HIBERNATE_CHECK_TIMEOUT, + () => this._checkDidHibernate()); + } + if (this._loginManager._proxy) { + // systemd path + this._loginManager._proxy.call("Hibernate", + GLib.Variant.new('(b)', [true]), + Gio.DBusCallFlags.NONE, + -1, null, null); + } else { + // Can't do in ConsoleKit + this._loginManager.emit('prepare-for-sleep', true); + this._loginManager.emit('prepare-for-sleep', false); + } + } + + _loginManagerCanHybridSleep(asyncCallback) { + if (this._loginManager._proxy) { + // systemd path + this._loginManager._proxy.call("CanHybridSleep", + null, + Gio.DBusCallFlags.NONE, + -1, null, function (proxy, asyncResult) { + let result, error; + + try { + result = proxy.call_finish(asyncResult).deep_unpack(); + } catch (e) { + error = e; + } + + if (error) + asyncCallback(false); + else + asyncCallback(result[0] != 'no'); + }); + } else { + Mainloop.idle_add(() => { + asyncCallback(false); + return false; + }); + } + } + + _loginManagerHybridSleep() { + if (this._loginManager._proxy) { + // systemd path + this._loginManager._proxy.call("HybridSleep", + GLib.Variant.new('(b)', [true]), + Gio.DBusCallFlags.NONE, + -1, null, null); + } else { + // Can't do in ConsoleKit + this._loginManager.emit('prepare-for-sleep', true); + this._loginManager.emit('prepare-for-sleep', false); + } + } + _updateHaveHibernate() { + this._loginManagerCanHibernate((result) => { + log(`have hibernate ${result}`); + this._haveHibernate = result; + this._updateHibernate(); + }); + } + + _updateHibernate() { + this._hibernateMenuItem.visible = this._haveHibernate && !Main.sessionMode.isLocked; + } + + _updateHaveHybridSleep() { + this._loginManagerCanHybridSleep((result) => { + this._haveHybridSleep = result; + this._updateHybridSleep(); + }); + } + + _updateHybridSleep() { + this._hybridSleepMenuItem.visible = this._haveHybridSleep && !Main.sessionMode.isLocked; + } + + _onHibernateClicked() { + this.systemMenu._systemItem.menu.itemActivated(); + this._dialog = new ConfirmDialog.ConfirmDialog(ConfirmDialog.HibernateDialogContent); + this._dialog.connect('ConfirmedHibernate', () => this._loginManagerHibernate()); + this._dialog.open(); + } + + _onHybridSleepClicked() { + this.systemMenu._systemItem.menu.itemActivated(); + this._loginManagerHybridSleep(); + } + + _disableExtension() { + let enabledExtensions = global.settings.get_strv(ExtensionSystem.ENABLED_EXTENSIONS_KEY); + enabledExtensions.splice(enabledExtensions.indexOf(Me.uuid), 1); + global.settings.set_strv(ExtensionSystem.ENABLED_EXTENSIONS_KEY, enabledExtensions); + } + + _cancelDisableExtension(notAgain) { + if (notAgain) + Prefs.setHibernateWorksCheckEnabled(false); + } + + _checkRequirements() { + if (!LoginManager.haveSystemd()) { + this._dialog = new ConfirmDialog.ConfirmDialog(ConfirmDialog.SystemdMissingDialogContent); + this._dialog.connect('DisableExtension', this._disableExtension); + this._dialog.open(); + } + } + + _checkDidHibernate() { + /* This function is called HIBERNATE_CHECK_TIMEOUT ms after + * hibernate started. If it is successful, at that point the GS + * process is already frozen; so when this function is actually + * called, way more than HIBERNATE_CHECK_TIMEOUT ms are passed*/ + if (new Date() - this._hibernateStarted > HIBERNATE_CHECK_TIMEOUT + 5000) { + // hibernate succeeded + return; + } + // hibernate failed + this._dialog = new ConfirmDialog.ConfirmDialog(ConfirmDialog.HibernateFailedDialogContent); + this._dialog.connect('DisableExtension', this._disableExtension); + this._dialog.connect('Cancel', this._cancelDisableExtension); + this._dialog.open(); + } + + enable() { + this._checkRequirements(); + this._loginManager = LoginManager.getLoginManager(); + this.systemMenu = Main.panel.statusArea.quickSettings._system; + + this._hibernateMenuItem = new PopupMenu.PopupMenuItem(__('Hibernate')); + this._hibernateMenuItemId = this._hibernateMenuItem.connect('activate', () => this._onHibernateClicked()); + + this._hybridSleepMenuItem = new PopupMenu.PopupMenuItem(__('Hybrid Sleep')); + this._hybridSleepMenuItemId = this._hybridSleepMenuItem.connect('activate', () => this._onHybridSleepClicked()); + + let afterSuspendPosition = this.systemMenu._systemItem.menu.numMenuItems - 5; + + this.systemMenu._systemItem.menu.addMenuItem(this._hybridSleepMenuItem, afterSuspendPosition); + this.systemMenu._systemItem.menu.addMenuItem(this._hibernateMenuItem, afterSuspendPosition); + + this._menuOpenStateChangedId = this.systemMenu._systemItem.menu.connect('open-state-changed', + (menu, open) => { + if (!open) + return; + this._updateHaveHibernate(); + this._updateHaveHybridSleep(); + }); + } + + disable() { + if (this._menuOpenStateChangedId) { + this.systemMenu._systemItem.menu.disconnect(this._menuOpenStateChangedId); + this._menuOpenStateChangedId = 0; + } + + if (this._hybridSleepMenuItemId) { + this._hybridSleepMenuItem.disconnect(this._hybridSleepMenuItemId); + this._hybridSleepMenuItemId = 0; + } + + if (this._hibernateMenuItemId) { + this._hibernateMenuItem.disconnect(this._hibernateMenuItemId); + this._hibernateMenuItemId = 0; + } + + if (this._hybridSleepMenuItem) { + this._hybridSleepMenuItem.destroy(); + this._hybridSleepMenuItem = 0; + } + + if (this._hibernateMenuItem) { + this._hibernateMenuItem.destroy(); + this._hibernateMenuItem = 0; + } + } +} + +let extension; +function init() { + extension = new Extension(); +} + +function enable() { + extension.enable(); +} + +function disable() { + extension.disable(); +} diff --git a/hibernate-status/locale/cs/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/cs/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..32e541d --- /dev/null +++ b/hibernate-status/locale/cs/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,66 @@ +# Czech translation of hibernate-status-button +# Copyright (C) 2021 Vojtěch Perník +# This file is distributed under the same license as the hibernate-status-button package. +# Vojtěch Perník <translations@pervoj.cz>, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2021-05-06 16:15+0200\n" +"Last-Translator: Vojtěch Perník <translations@pervoj.cz>\n" +"Language-Team: Czech\n" +"Language: cs\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Uspat na disk" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Opravdu chcete systém uspat na disk?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Zrušit" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Hibernate button: Systemd není nainstalován" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "Zdá se, že Systemd není nainstalován, ale je vyžadován." + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Zakázat rozšíření" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Hibernate button: Uspání na disk se nezdařilo" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"Vypadá to, že se uspání na disk nezdařilo.\n" +"U některých linuxových distribucí je uspání na disk\n" +"zakázáno, protože ne všechny hardware ho podporují,\n" +"podívejte se prosím do dokumentace své distribuce, jak ji povolit." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Mýlíte se, už to nekontrolujte!" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Toto rozšíření nemá k dispozici žádná nastavení" diff --git a/hibernate-status/locale/de/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/de/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..3fdb8c2 --- /dev/null +++ b/hibernate-status/locale/de/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,72 @@ +# German translation of hibernate-status-button +# Copyright (C) 2022 Oskar Kirmis +# This file is distributed under the same license as the hibernate-status-button package. +# Oskar Kirmis <oskar.kirmis@posteo.de>, 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-03-28 21:00+0200\n" +"PO-Revision-Date: 2022-10-22 21:30+0200\n" +"Last-Translator: Oskar Kirmis <oskar.kirmis@posteo.de>\n" +"Language-Team: German\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.0.1\n" + +#: confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Ruhezustand" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Hybrider Standbymodus" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Wollen Sie das System wirklich in den Ruhezustand versetzen?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Abbrechen" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Hibernate button: Systemd fehlt" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "Systemd fehlt offenbar, wird jedoch benötigt." + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Erweiterung deaktivieren" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Hibernate button: Versetzen in den Ruhezustand fehlgeschlagen" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"Offenbar konnte das System nicht in den Ruhezustand versetzt werden.\n" +"Auf manchen Linuxdistributionen ist der Ruhezustand deaktiviert\n" +"weil nicht jegliche Hardware dies unterstützt;\n" +"bitte schauen Sie in der Dokumentation Ihrer\n" +"Distribution nach, wie Sie ihn aktivieren können." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Das ist falsch, bitte nicht mehr prüfen!" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Für diese Erweiterung gibt es keine Einstellungen" diff --git a/hibernate-status/locale/es/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/es/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..92c14bc --- /dev/null +++ b/hibernate-status/locale/es/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,71 @@ +# Spanish translation of hibernate-status-button +# Copyright (C) 2022 slaythrax +# This file is distributed under the same license as the hibernate-status-button package. +# slaythrax <jbustamantec@unal.edu.co>, 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2022-10-22 21:30+0200\n" +"Last-Translator: slaythrax <jbustamantec@unal.edu.co>\n" +"Language-Team: Spanish <jbustamantec@unal.edu.co>\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Hibernar" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Suspensión Híbrida" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Desea hibernar el sistema?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Cancelar" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Systemd no está instalado" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "Parece que systemd no está instalado. Systemd es necesario" + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Deshabilitar extensión" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Hibernación fallida" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"Parece que la hibernación falló\n" +"En algunas distribuciones de linux la hibernación se encuentra deshabilitada\n" +"pues no todo el hardware no la soporta correctamente;\n" +"verifique la documentación de su distribución\n" +"para habilitarla." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "No es necesario hacer esta verificación de nuevo! " + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Esta extensión no tiene ajustes disponibles" diff --git a/hibernate-status/locale/fa/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/fa/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..e4edef0 --- /dev/null +++ b/hibernate-status/locale/fa/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,72 @@ +# Persian translation of hibernate-status-button +# Copyright (C) 2021 MohammadSaleh Kamyab +# This file is distributed under the same license as the hibernate-status-button package. +# MohammadSaleh Kamyab <mskf1383@envs.net>, 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2022-06-21 13:06+0430\n" +"Last-Translator: MohammadSaleh Kamyab <mskf1383@envs.net>\n" +"Language-Team: \n" +"Language: fa\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==0 || n==1);\n" +"X-Generator: Poedit 3.1\n" + +#: confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "خواب زمستانی" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "خواب ترکیبی" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "آیا مطمئنید که میخواهید سامانه را به خواب زمستانی ببرید؟" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "لغو" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "دکمهٔ خواب زمستانی: سیستمدی یافت نشد" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "به نظر میرسد سیستمدی که لازم است، وجود ندارد." + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "از کار انداختن افزونه" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "دکمهٔ خواب زمستانی: خواب زمستانی شکست خورد" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"به نظر میرسد خواب زمستانی به شکست انجامید.\n" +"در بعضی از توزیعهای گنو/لینوکسی، خواب زمستانی از کار انداخته شده است؛\n" +"زیرا تمامی سختافزارها بهخوبی از آن پشتیبانی نمیکنند.\n" +"لطفاً مستندات توزیع خود را در مورد چگونگی به کار انداختن آن، بررسی کنید." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "اشتباه میکنید، دوباره بررسی نکنید!" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "این افزونه هیچ تنظیماتی ندارد" diff --git a/hibernate-status/locale/fr/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/fr/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..9dca80d --- /dev/null +++ b/hibernate-status/locale/fr/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,71 @@ +# French translation of hibernate-status-button +# Copyright (C) 2021 Jérôme de Bretagne +# This file is distributed under the same license as the hibernate-status-button package. +# Jérôme de Bretagne <jerome.debretagne@gmail.com>, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2021-11-13 19:34+0200\n" +"Last-Translator: Jérôme de Bretagne <jerome.debretagne@gmail.com>\n" +"Language-Team: French <jerome.debretagne@gmail.com>\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: extension.js:189 confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Mettre en veille prolongée" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Mettre en veille hybride" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Voulez-vous vraiment mettre l'appareil en veille prolongée ?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Annuler" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Extension de mise en veille prolongée : systemd manquant" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "systemd ne semble pas installé et est nécessaire." + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Désactiver l'extension" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Extension de mise en veille prolongée : échec" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"La mise en veille prolongée a échoué.\n" +"Sur certaines distributions Linux, la mise en veille prolongée est désactivée\n" +"car elle ne fonctionne pas correctement pour quelques appareils;\n" +"Veuillez vous reporter à la documentation de votre distribution\n" +"pour savoir comment l'activer." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Il n'est pas utile de cocher cette case !" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Cette extension n'a pas de paramètres" diff --git a/hibernate-status/locale/it/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/it/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..a41e5ac --- /dev/null +++ b/hibernate-status/locale/it/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,71 @@ +# Italian translation of hibernate-status-button +# Copyright (C) 2021 p91paul +# This file is distributed under the same license as the hibernate-status-button package. +# p91paul <p91paul@gmail.com>, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2022-10-22 21:30+0200\n" +"Last-Translator: p91paul <p91paul@gmail.com>\n" +"Language-Team: Italian <p91paul@gmail.com>\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Iberna" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Sospensione ibrida" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Vuoi davvero ibernare il sistema?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Cancella" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Systemd non installato" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "Systemd non è installato ed è necessario" + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Disabilita estensione" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Ibernazione fallita" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"Sembra che l'ibernazione sia fallita.\n" +"In alcune distribuzioni Linux l'ibernazione è disabilitata\n" +"perchè non ben supportata da tutte le tipologie di hardware;\n" +"Verifica la documentazione della tua distribuzione\n" +"per abilitarla." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Ti sbagli, va tutto bene, non fare più questa verifica" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Questa estensione non ha impostazioni disponibili" diff --git a/hibernate-status/locale/nl/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/nl/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..6853171 --- /dev/null +++ b/hibernate-status/locale/nl/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,68 @@ +# Nederlands translation of hibernate-status-button
+# Copyright (C) 2021 tebaranowski
+# This file is distributed under the same license as the hibernate-status-button package.
+# tebaranowski <tomasz.baranowski@int.pl>, 2021.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Hibernate Status Button\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-04-11 18:31+0200\n"
+"PO-Revision-Date: 2021-09-13 17:56+0200\n"
+"Last-Translator: Heimen Stoffels <vistausss@fastmail.com>\n"
+"Language-Team: Dutch <vistausss@fastmail.com>\n"
+"Language: nl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
+"X-Generator: Poedit 3.0\n"
+
+#: confirmDialog.js:23 confirmDialog.js:32
+msgid "Hibernate"
+msgstr "Slaapstand"
+
+#: confirmDialog.js:24
+msgid "Do you really want to hibernate the system?"
+msgstr "Weet u zeker dat u het systeem in de slaapstand wilt zetten?"
+
+#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67
+msgid "Cancel"
+msgstr "Annuleren"
+
+#: confirmDialog.js:40
+msgid "Hibernate button: Systemd Missing"
+msgstr "Slaapstandknop: Systemd ontbreekt"
+
+#: confirmDialog.js:41
+msgid "Systemd seems to be missing and is required."
+msgstr "Systemd is vereist, maar niet aangetroffen."
+
+#: confirmDialog.js:49 confirmDialog.js:72
+msgid "Disable Extension"
+msgstr "Uitbreiding uitschakelen"
+
+#: confirmDialog.js:58
+msgid "Hibernate button: Hibernate failed"
+msgstr "Slaapstandknop: slaapstand mislukt"
+
+#: confirmDialog.js:59
+msgid ""
+"Looks like hibernation failed.\n"
+"On some linux distributions hibernation is disabled\n"
+"because not all hardware supports it well;\n"
+"please check your distribution documentation\n"
+"on how to enable it."
+msgstr ""
+"Het lijkt er op dat de slaapstand niet kan worden ingeschakeld.\n"
+"Op sommige distributies is de slaapstand niet beschikbaar.\n"
+"Neem de documentatie van uw distributie door om te\n"
+"zien of u de slaapstand kunt activeren."
+
+#: confirmDialog.js:64
+msgid "You are wrong, don't check this anymore!"
+msgstr "Dit klopt niet - negeer deze controle!"
+
+#: prefs.js:99
+msgid "This extension has no settings available"
+msgstr "Deze uitbreiding bevat geen voorkeurenscherm"
diff --git a/hibernate-status/locale/oc/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/oc/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..25debf8 --- /dev/null +++ b/hibernate-status/locale/oc/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,71 @@ +# Occitan translation of hibernate-status-button +# Copyright (C) 2022 Quentin +# This file is distributed under the same license as the hibernate-status-button package. +# Quentin +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2023-01-11 17:19+0200\n" +"Last-Translator: Quentin PAGÈS <>\n" +"Language-Team: Occitan\n" +"Language: oc\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: extension.js:189 confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Metre en velha perlongada" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Metre en velha ibrida" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Volètz vertadièrament metre l'aparelh en velha perlongada ?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Anullar" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Extension de mesa en velha perlongada : systemd mancant" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "systemd sembla pas installat e es necessari." + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Desactivar l'extension" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Extension de mesa en velha perlongada : fracàs" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"La mesa en velha perlongada a fracassat.\n" +"Amb d'unas distribucions Linux, la mesa en velha perlongada es desactivada\n" +"pr'amor que fonciona pas coma cal amb d'unes aparelhs ;\n" +"Mercés de consultar la documentacion de la distribucion\n" +"per saber cossí l'activar." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Es pas necessari de marcar aquesta casa !" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Aquesta extension a pas cap de paramètres" diff --git a/hibernate-status/locale/pl/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/pl/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..57b735c --- /dev/null +++ b/hibernate-status/locale/pl/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,71 @@ +# Polish translation of hibernate-status-button
+# Copyright (C) 2022 tebaranowski
+# This file is distributed under the same license as the hibernate-status-button package.
+# tebaranowski <tomasz.baranowski@int.pl>, 2022.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Hibernate Status Button\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-04-11 18:31+0200\n"
+"PO-Revision-Date: 2022-11-01 20:31+0200\n"
+"Last-Translator: tebaranowski <tomasz.baranowski@int.pl>\n"
+"Language-Team: Polish <tomasz.baranowski@int.pl>\n"
+"Language: pl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: confirmDialog.js:23 confirmDialog.js:32
+msgid "Hibernate"
+msgstr "Hibernacja"
+
+#: extension.js:192
+msgid "Hybrid Sleep"
+msgstr "Uśpienie hybrydowe"
+
+#: confirmDialog.js:24
+msgid "Do you really want to hibernate the system?"
+msgstr "Czy na pewno chcesz zahibernować system?"
+
+#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67
+msgid "Cancel"
+msgstr "Anuluj"
+
+#: confirmDialog.js:40
+msgid "Hibernate button: Systemd Missing"
+msgstr "Nie odnaleziono systemd"
+
+#: confirmDialog.js:41
+msgid "Systemd seems to be missing and is required."
+msgstr "Brak zainstalowanego systemd, wymaganego do hibernacji"
+
+#: confirmDialog.js:49 confirmDialog.js:72
+msgid "Disable Extension"
+msgstr "Wyłącz rozszerzenie"
+
+#: confirmDialog.js:58
+msgid "Hibernate button: Hibernate failed"
+msgstr "Hibernacja nie powiodła się"
+
+#: confirmDialog.js:59
+msgid ""
+"Looks like hibernation failed.\n"
+"On some linux distributions hibernation is disabled\n"
+"because not all hardware supports it well;\n"
+"please check your distribution documentation\n"
+"on how to enable it."
+msgstr ""
+"Wygląda na to, że hibernacja się nie powiodła.\n"
+"W niektórych dystrybucjach Linuksa hibernacja jest wyłączona,\n"
+"ponieważ nie każdy sprzęt poprawnie ją obsługuje.\n"
+"Sprawdź jak ją włączyć w dokumentacji swojej\n"
+"dystrybucji."
+
+#: confirmDialog.js:64
+msgid "You are wrong, don't check this anymore!"
+msgstr "Nie sprawdzaj tego ponownie!"
+
+#: prefs.js:99
+msgid "This extension has no settings available"
+msgstr "To rozszerzenie nie posiada możliwości zmiany ustawień"
diff --git a/hibernate-status/locale/pt/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/pt/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..143129c --- /dev/null +++ b/hibernate-status/locale/pt/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,71 @@ +# Portuguese translation of hibernate-status-button +# Copyright (C) 2021 p91paul +# This file is distributed under the same license as the hibernate-status-button package. +# mantonelli <matheus.antonelli@gmail.com>, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2022-10-22 21:30+0200\n" +"Last-Translator: mantonelli <matheus.antonelli@gmail.com>\n" +"Language-Team: Portuguese <matheus.antonelli@gmail.com>\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Hibernar" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Suspensão Híbrida" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Deseja realmente hibernar o sistema?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Cancelar" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Systemd não está instalado" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "Systemd não está instalado e é necessário" + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Desabilitar extensão" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Hibernação falhou" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"Parece que a hibernação falhou.\n" +"Em algumas distribuições Linux a hibernação é desabilitada\n" +"já que nem todo hardware oferece suporte adequado à ela;\n" +"Confira a documentação de sua distribuição\n" +"para aprender como habilitá-la." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Você errou! Não selecione isso novamente!" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Essa extensão não possui configurações disponíveis" diff --git a/hibernate-status/locale/pt_BR/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/pt_BR/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..326481a --- /dev/null +++ b/hibernate-status/locale/pt_BR/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,73 @@ +# Portuguese translation of hibernate-status-button +# Copyright (C) 2021 p91paul +# This file is distributed under the same license as the hibernate-status-button package. +# mantonelli <matheus.antonelli@gmail.com>, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2022-10-22 21:30+0200\n" +"Last-Translator: Fabrício Müller <fabricio8800@gmail.com>\n" +"Language-Team: Brazilian Portuguese <fabricio8800@gmail.com>\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: Poedit 3.0.1\n" + +#: confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Hibernar" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Suspensão Híbrida" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Deseja realmente hibernar o sistema?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Cancelar" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Systemd não está instalado" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "Systemd não está instalado e é necessário." + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Desabilitar extensão" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Hibernação falhou" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"Parece que a hibernação falhou.\n" +"Em algumas distribuições Linux a hibernação é desabilitada\n" +"já que nem todo hardware oferece suporte adequado à ela;\n" +"Confira a documentação de sua distribuição\n" +"para aprender como habilitá-la." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Você errou! Não selecione isso novamente!" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Essa extensão não possui configurações disponíveis" diff --git a/hibernate-status/locale/ru/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/ru/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..c279315 --- /dev/null +++ b/hibernate-status/locale/ru/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,74 @@ +# Russian translation of hibernate-status-button +# Copyright (C) 2021 Serhii Riznychenko +# This file is distributed under the same license as the hibernate-status-button package. +# Serhii Riznychenko, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2021-11-11 02:00+0200\n" +"Last-Translator: Serhii Riznychenko\n" +"Language-Team: Russian\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"X-Generator: Poedit 3.0\n" +"X-Poedit-Basepath: .\n" + +#: extension.js:189 confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Спящий режим" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Гибридный сон" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Вы действительно хотите перевести систему в спящий режим?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Отмена" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Не обнаружено systemd" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "Кажется отсутствует systemd, необходимый для режима сна." + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Отключить расширение" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Не удалось перевести систему в сон" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"Попытка перевести систему в сон завершилась неудачей.\n" +"На некоторых дистрибутивах режим сна отключен\n" +"так как не каждое оборудование имеет поддержку,\n" +"пожалуйста обратитесь к документации своего дистрибутива\n" +"чтобы узнать как его включить." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Вы ошиблись, пожалуйста не трогайте это!" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Это расширение не содержит параметров" diff --git a/hibernate-status/locale/uk/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/uk/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..68c6b8c --- /dev/null +++ b/hibernate-status/locale/uk/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,74 @@ +# Ukrainian translation of hibernate-status-button +# Copyright (C) 2021 Serhii Riznychenko +# This file is distributed under the same license as the hibernate-status-button package. +# Serhii Riznychenko, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-04-11 18:31+0200\n" +"PO-Revision-Date: 2021-11-11 02:00+0200\n" +"Last-Translator: Serhii Riznychenko\n" +"Language-Team: Ukraine\n" +"Language: uk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" +"X-Generator: Poedit 3.0\n" +"X-Poedit-Basepath: .\n" + +#: extension.js:189 confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "Перейти в сон" + +#: extension.js:192 +msgid "Hybrid Sleep" +msgstr "Перейти в гібридний сон" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "Ви дійсно хочете перевести систему в режим сну?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "Відміна" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "Не виявлено systemd" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "Здається відсутній systemd, необхідний режиму сну." + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "Вимкнути розширення" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "Не вдалося перевести систему в сон" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "" +"Спроба перевести систему в сон завершилася невдачею.\n" +"На деяких дистрибутивах режим сну вимкнено\n" +"оскільки не кожне обладнання має його підтримку,\n" +"Будь ласка, зверніться до документації свого дистрибутива\n" +"щоб дізнатися, як його включити." + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "Ви помилилися, будь ласка, не чіпайте це!" + +#: prefs.js:99 +msgid "This extension has no settings available" +msgstr "Це розширення не містить параметрів" diff --git a/hibernate-status/locale/zh_CN/LC_MESSAGES/hibernate-status-button.po b/hibernate-status/locale/zh_CN/LC_MESSAGES/hibernate-status-button.po new file mode 100644 index 0000000..be1a6b1 --- /dev/null +++ b/hibernate-status/locale/zh_CN/LC_MESSAGES/hibernate-status-button.po @@ -0,0 +1,59 @@ +# Simplified Chinese translation of hibernate-status-button +# Copyright (C) 2019 zhmars +# This file is distributed under the same license as the hibernate-status-button package. +# zhmars <1403122061@qq.com>, 2019. +# +msgid "" +msgstr "" +"Project-Id-Version: Hibernate Status Button\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-11-22 00:08+0800\n" +"PO-Revision-Date: 2019-11-21 20:00+0800\n" +"Last-Translator: zhmars <1403122061@qq.com>\n" +"Language-Team: Chinese (Simplified) <>\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: confirmDialog.js:23 confirmDialog.js:32 +msgid "Hibernate" +msgstr "休眠" + +#: confirmDialog.js:24 +msgid "Do you really want to hibernate the system?" +msgstr "确定要休眠系统吗?" + +#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67 +msgid "Cancel" +msgstr "取消" + +#: confirmDialog.js:40 +msgid "Hibernate button: Systemd Missing" +msgstr "无法找到 Systemd" + +#: confirmDialog.js:41 +msgid "Systemd seems to be missing and is required." +msgstr "本功能依赖 Systemd,但目前无法找到。" + +#: confirmDialog.js:49 confirmDialog.js:72 +msgid "Disable Extension" +msgstr "禁用扩展" + +#: confirmDialog.js:58 +msgid "Hibernate button: Hibernate failed" +msgstr "休眠失败" + +#: confirmDialog.js:59 +msgid "" +"Looks like hibernation failed.\n" +"On some linux distributions hibernation is disabled\n" +"because not all hardware supports it well;\n" +"please check your distribution documentation\n" +"on how to enable it." +msgstr "休眠好像失败了。由于不是所有硬件都对该功能支持良好," +"某些发行版默认禁用了休眠,关于如何启用请查阅你所用的发行版文档" + +#: confirmDialog.js:64 +msgid "You are wrong, don't check this anymore!" +msgstr "忽略本项检查" diff --git a/hibernate-status/metadata.json b/hibernate-status/metadata.json new file mode 100644 index 0000000..94098fe --- /dev/null +++ b/hibernate-status/metadata.json @@ -0,0 +1,10 @@ +{ + "uuid": "hibernate-status@dromi", + "name": "Hibernate Status Button", + "url": "https://github.com/arelange/gnome-shell-extension-hibernate-status", + "description": "Adds a Hibernate button in Status menu. Using Alt modifier, you can also select Hybrid Sleep instead.", + "shell-version": [ + "43" + ], + "gettext-domain": "hibernate-status-button" +} diff --git a/hibernate-status/prefs.js b/hibernate-status/prefs.js new file mode 100644 index 0000000..cdcd50e --- /dev/null +++ b/hibernate-status/prefs.js @@ -0,0 +1,105 @@ +const Gio = imports.gi.Gio; +const Gtk = imports.gi.Gtk; +const Me = imports.misc.extensionUtils.getCurrentExtension(); +// Use __() and N__() for the extension gettext domain, and reuse +// the shell domain with the default _() and N_() +const Gettext = imports.gettext.domain('hibernate-status-button'); +const __ = Gettext.gettext; +const N__ = function(e) { return e }; +const ExtensionUtils = imports.misc.extensionUtils; + +var Prefs = class Prefs { + /** + * Creates a new Settings-object to access the settings of this extension. + * @private + */ + constructor() { + this.KEY_HIBERNATE_WORKS_CHECK = "hibernate-works-check"; + this._schemaName = "org.gnome.shell.extensions.hibernate-status-button"; + + let schemaDir = Me.dir.get_child('schemas').get_path(); + + let schemaSource = Gio.SettingsSchemaSource.new_from_directory( + schemaDir, Gio.SettingsSchemaSource.get_default(), false + ); + let schema = schemaSource.lookup(this._schemaName, false); + + this._setting = new Gio.Settings({ + settings_schema: schema + }); + } + /** + * <p>Binds the given 'callback'-function to the "changed"-signal on the given + * key.</p> + * <p>The 'callback'-function is passed an argument which holds the new + * value of 'key'. The argument is of type "GLib.Variant". Given that the + * receiver knows the internal type, use one of the get_XX()-methods to get + * it's actual value.</p> + * @see http://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/GLib.Variant.html + * @param key the key to watch for changes. + * @param callback the callback-function to call. + */ + bindKey(key, callback) { + // Validate: + if (key === undefined || key === null || typeof key !== "string") { + throw TypeError("The 'key' should be a string. Got: '" + key + "'"); + } + if (callback === undefined || callback === null || typeof callback !== "function") { + throw TypeError("'callback' needs to be a function. Got: " + callback); + } + // Bind: + this._setting.connect("changed::" + key, function (source, key) { + callback(source.get_value(key)); + }); + } + /** + * Get if check for working hibernation is enabled. The user might + * choose to disable it if we happen to be wrong. + * + * @returns bool true if we need to check if hibernation works. + */ + getHibernateWorksCheckEnabled() { + return this._setting.get_boolean(this.KEY_HIBERNATE_WORKS_CHECK); + } + /** + * Set if check for working hibernation is enabled. The user might + * choose to disable it if we happen to be wrong. + * + * @returns bool true if we need to check if hibernation works. + */ + setHibernateWorksCheckEnabled(enabled) { + let key = this.KEY_HIBERNATE_WORKS_CHECK; + if (this._setting.is_writable(key)) { + if (this._setting.set_boolean(key, enabled)) { + Gio.Settings.sync(); + } else { + throw this._errorSet(key); + } + } else { + throw this._errorWritable(key); + } + } + _errorWritable(key) { + return "The key '" + key + "' is not writable."; + } + _errorSet(key) { + return "Couldn't set the key '" + key + "'"; + } +} + +// These "preferences" aren't user accessible so define +// init() and buildPrefsWidget() to empty functions +function init() { + ExtensionUtils.initTranslations('hibernate-status-button'); +} +function buildPrefsWidget() { + let frame = new Gtk.Box({orientation: Gtk.Orientation.VERTICAL, + 'margin-top': 10, + 'margin-end': 10, + 'margin-bottom': 10, + 'margin-start': 10}); + let setting_label = new Gtk.Label({label: __("This extension has no settings available"), + xalign: 0 }); + frame.append(setting_label); + return frame; +} diff --git a/hibernate-status/schemas/org.gnome.shell.extensions.hibernate-status-button.gschema.xml b/hibernate-status/schemas/org.gnome.shell.extensions.hibernate-status-button.gschema.xml new file mode 100644 index 0000000..f29ec1c --- /dev/null +++ b/hibernate-status/schemas/org.gnome.shell.extensions.hibernate-status-button.gschema.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<schemalist gettext-domain="hibernate-status-button"> + <schema path="/org/gnome/shell/extensions/hibernate-status-button/" id="org.gnome.shell.extensions.hibernate-status-button"> + <key type="b" name="hibernate-works-check"> + <default>true</default> + </key> + </schema> +</schemalist> |