Skip to content

Commit

Permalink
system-controls@rcalixte: Version 1.2 (linuxmint#5032)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcalixte authored Sep 16, 2023
1 parent 4950873 commit b0ae822
Show file tree
Hide file tree
Showing 15 changed files with 192 additions and 215 deletions.
19 changes: 14 additions & 5 deletions system-controls@rcalixte/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@

### 1.2

* Moved to officially support Cinnamon 5.4+
* Update `spawnCommandLine` to use `Gio.Subprocess` calls
* Switch to formal symbolic icons

### 1.1.1
* Changed icon for 'Restart Cinnamon' menu item from `system-run` to `cinnamon-symbolic`
* Improved packaged images

* Changed icon for 'Restart Cinnamon' menu item from `system-run` to `cinnamon-symbolic`
* Improved packaged images

### 1.1
* Added proper translation support
* Created dedicated changelog file

* Added proper translation support
* Created dedicated changelog file

### 1.0
* Initial release

* Initial release
34 changes: 20 additions & 14 deletions system-controls@rcalixte/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
SYSTEM CONTROLS APPLET
======================
SYSTEM CONTROLS
===============

Minimal system controls applet for Cinnamon Desktop Environment

DESCRIPTION
-----------

This is an applet that adds an icon in the panel that provides access to the
following system controls functions:
* Restart Cinnamon
* Lock Screen
* Switch User (if enabled in system settings)
* Log Out
* Suspend
* Hibernate
* Restart
* Power Off

As of now, the action executes immediately without prompt or verification.
* Restart Cinnamon
* Lock Screen
* Switch User (if enabled in system settings)
* Log Out
* Suspend
* Hibernate
* Restart
* Power Off

As of now, the menu action executes immediately without prompt or verification.

Portions of this code were adapted from the user@cinnamon.org applet created by
the Cinnamon Team.

COMPATIBILITY
-------------

This applet has been tested to be compatible with Cinnamon 5.4+.

DEPENDENCIES
------------

This applet depends on the following packages being installed:
* cinnamon-screensaver
* cinnamon-session
* systemd

* cinnamon-screensaver
* cinnamon-session
* systemd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const Lang = imports.lang;
const PopupMenu = imports.ui.popupMenu;
const ScreenSaver = imports.misc.screenSaver;
const St = imports.gi.St;
const Util = imports.misc.util;

// l10n/translation support
const UUID = "system-controls@rcalixte";
Expand Down Expand Up @@ -34,18 +33,14 @@ class SystemControlsApplet extends Applet.TextIconApplet {
this._contentSection = new PopupMenu.PopupMenuSection();
this.menu.addMenuItem(this._contentSection);

let controlsBox = new St.BoxLayout({ style_class: 'controls-box', reactive: true, vertical: false });
let launcher = new Gio.SubprocessLauncher({
flags: (Gio.SubprocessFlags.STDIN_PIPE |
Gio.SubprocessFlags.STDOUT_PIPE |
Gio.SubprocessFlags.STDERR_PIPE)
});

this._controlsIcon = new St.Bin({ style_class: 'controls-icon' });
let controlsBox = new St.BoxLayout({ style_class: 'controls-box', reactive: true, vertical: false });

this._controlsIcon.hide();
controlsBox.add(this._controlsIcon,
{
x_fill: true,
y_fill: false,
x_align: St.Align.END,
y_align: St.Align.START
});
this.controlsLabel = new St.Label(({ style_class: 'controls-label' }));
controlsBox.add(this.controlsLabel,
{
Expand All @@ -71,16 +66,16 @@ class SystemControlsApplet extends Applet.TextIconApplet {

this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());

item = new PopupMenu.PopupIconMenuItem(_("Lock Screen"), "system-lock-screen", St.IconType.SYMBOLIC);
item = new PopupMenu.PopupIconMenuItem(_("Lock Screen"), "system-lock-screen-symbolic", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
let screensaver_settings = new Gio.Settings({ schema_id: "org.cinnamon.desktop.screensaver" });
let screensaver_dialog = Gio.file_new_for_path("/usr/bin/cinnamon-screensaver-command");
if (screensaver_dialog.query_exists(null)) {
if (screensaver_settings.get_boolean("ask-for-away-message")) {
Util.spawnCommandLine("cinnamon-screensaver-lock-dialog");
launcher.spawnv(["cinnamon-screensaver-lock-dialog"]);
}
else {
Util.spawnCommandLine("cinnamon-screensaver-command --lock");
launcher.spawnv(["cinnamon-screensaver-command", "--lock"]);
}
}
else {
Expand All @@ -93,63 +88,63 @@ class SystemControlsApplet extends Applet.TextIconApplet {
if (!lockdown_settings.get_boolean('disable-user-switching')) {
if (GLib.getenv("XDG_SEAT_PATH")) {
// LightDM
item = new PopupMenu.PopupIconMenuItem(_("Switch User"), "system-switch-user", St.IconType.SYMBOLIC);
item = new PopupMenu.PopupIconMenuItem(_("Switch User"), "system-switch-user-symbolic", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
Util.spawnCommandLine("cinnamon-screensaver-command --lock");
Util.spawnCommandLine("dm-tool switch-to-greeter");
launcher.spawnv(["cinnamon-screensaver-command", "--lock"]);
launcher.spawnv(["dm-tool", "switch-to-greeter"]);
}));
this.menu.addMenuItem(item);
}
else if (GLib.file_test("/usr/bin/mdmflexiserver", GLib.FileTest.EXISTS)) {
// MDM
item = new PopupMenu.PopupIconMenuItem(_("Switch User"), "system-switch-user", St.IconType.SYMBOLIC);
item = new PopupMenu.PopupIconMenuItem(_("Switch User"), "system-switch-user-symbolic", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
Util.spawnCommandLine("mdmflexiserver");
launcher.spawnv(["mdmflexiserver"]);
}));
this.menu.addMenuItem(item);
}
else if (GLib.file_test("/usr/bin/gdmflexiserver", GLib.FileTest.EXISTS)) {
// GDM
item = new PopupMenu.PopupIconMenuItem(_("Switch User"), "system-switch-user", St.IconType.SYMBOLIC);
item = new PopupMenu.PopupIconMenuItem(_("Switch User"), "system-switch-user-symbolic", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
Util.spawnCommandLine("cinnamon-screensaver-command --lock");
Util.spawnCommandLine("gdmflexiserver");
launcher.spawnv(["cinnamon-screensaver-command", "--lock"]);
launcher.spawnv(["gdmflexiserver"]);
}));
this.menu.addMenuItem(item);
}
}

item = new PopupMenu.PopupIconMenuItem(_("Log Out"), "system-log-out", St.IconType.SYMBOLIC);
item = new PopupMenu.PopupIconMenuItem(_("Log Out"), "system-log-out-symbolic", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
Util.spawnCommandLine("cinnamon-session-quit --no-prompt");
launcher.spawnv(["cinnamon-session-quit", "--no-prompt"]);
}));
this.menu.addMenuItem(item);

this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());

item = new PopupMenu.PopupIconMenuItem(_("Suspend"), "system-suspend", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
Util.spawnCommandLine("systemctl suspend");
launcher.spawnv(["systemctl", "suspend"]);
}));
this.menu.addMenuItem(item);

item = new PopupMenu.PopupIconMenuItem(_("Hibernate"), "system-suspend-hibernate", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
Util.spawnCommandLine("systemctl hibernate");
launcher.spawnv(["systemctl", "hibernate"]);
}));
this.menu.addMenuItem(item);

this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());

item = new PopupMenu.PopupIconMenuItem(_("Restart"), "view-refresh", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
Util.spawnCommandLine("systemctl reboot");
launcher.spawnv(["systemctl", "reboot"]);
}));
this.menu.addMenuItem(item);

item = new PopupMenu.PopupIconMenuItem(_("Power Off"), "system-shutdown", St.IconType.SYMBOLIC);
item = new PopupMenu.PopupIconMenuItem(_("Power Off"), "system-shutdown-symbolic", St.IconType.SYMBOLIC);
item.connect('activate', Lang.bind(this, function () {
Util.spawnCommandLine("systemctl poweroff");
launcher.spawnv(["systemctl", "poweroff"]);
}));
this.menu.addMenuItem(item);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
padding: .4em 1.75em;
spacing: .4em;
}
.controls-icon {
border-radius: .25em;
border: 2px solid #a5a5a5;
}
.controls-label {

.controls-label {
color: #fff;
font-size: 1em;
margin: .4em;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"description": "A simple system controls applet to restart Cinnamon, lock the screen, switch users, log off, suspend, hibernate, reboot, or power off the computer",
"uuid": "system-controls@rcalixte",
"name": "System Controls Applet",
"version": "1.1.1",
"name": "System Controls",
"version": "1.2",
"max-instances": -1
}
29 changes: 13 additions & 16 deletions system-controls@rcalixte/files/system-controls@rcalixte/po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,51 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-09 14:39-0500\n"
"PO-Revision-Date: \n"
"POT-Creation-Date: 2023-09-16 18:19-0400\n"
"PO-Revision-Date: 2023-09-16 18:20-0400\n"
"Last-Translator: \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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0.1\n"
"X-Generator: Poedit 3.3.1\n"

#: applet.js:29
#. metadata.json->name
#: 5.4/applet.js:28
msgid "System Controls"
msgstr "Systemsteuerung"

#: applet.js:66
#: 5.4/applet.js:61
msgid "Restart Cinnamon"
msgstr "Cinnamon neustarten"

#: applet.js:74
#: 5.4/applet.js:69
msgid "Lock Screen"
msgstr "Bildschirm sperren"

#: applet.js:96 applet.js:105 applet.js:113
#: 5.4/applet.js:91 5.4/applet.js:100 5.4/applet.js:108
msgid "Switch User"
msgstr "Benutzer wechseln"

#: applet.js:122
#: 5.4/applet.js:117
msgid "Log Out"
msgstr "Abmelden"

#: applet.js:130
#: 5.4/applet.js:125
msgid "Suspend"
msgstr "Bereitschaft"

#: applet.js:136
#: 5.4/applet.js:131
msgid "Hibernate"
msgstr "Ruhezustand"

#: applet.js:144
#: 5.4/applet.js:139
msgid "Restart"
msgstr "Neustarten"

#: applet.js:150
#: 5.4/applet.js:145
msgid "Power Off"
msgstr "Ausschalten"

Expand All @@ -61,7 +62,3 @@ msgstr ""
"Einfaches Systemsteuerungs-Applet, mit dem man Cinnamon neustarten, den "
"Bildschirm sperren, den Benutzer wechseln, sich abmelden und den Rechner in "
"Bereitschaft oder Ruhezustand setzen, neustarten oder ausschalten kann"

#. metadata.json->name
msgid "System Controls Applet"
msgstr "Systemsteuerung-Applet"
29 changes: 13 additions & 16 deletions system-controls@rcalixte/files/system-controls@rcalixte/po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,51 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-09 14:39-0500\n"
"PO-Revision-Date: \n"
"POT-Creation-Date: 2023-09-16 18:19-0400\n"
"PO-Revision-Date: 2023-09-16 18:20-0400\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\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.1.1\n"
"X-Generator: Poedit 3.3.1\n"

#: applet.js:29
#. metadata.json->name
#: 5.4/applet.js:28
msgid "System Controls"
msgstr "Controles del sistema"

#: applet.js:66
#: 5.4/applet.js:61
msgid "Restart Cinnamon"
msgstr "Reiniciar Cinnamon"

#: applet.js:74
#: 5.4/applet.js:69
msgid "Lock Screen"
msgstr "Bloquear pantalla"

#: applet.js:96 applet.js:105 applet.js:113
#: 5.4/applet.js:91 5.4/applet.js:100 5.4/applet.js:108
msgid "Switch User"
msgstr "Cambiar de usuario"

#: applet.js:122
#: 5.4/applet.js:117
msgid "Log Out"
msgstr "Cerrar sesión"

#: applet.js:130
#: 5.4/applet.js:125
msgid "Suspend"
msgstr "Suspender"

#: applet.js:136
#: 5.4/applet.js:131
msgid "Hibernate"
msgstr "Hibernar"

#: applet.js:144
#: 5.4/applet.js:139
msgid "Restart"
msgstr "Reiniciar"

#: applet.js:150
#: 5.4/applet.js:145
msgid "Power Off"
msgstr "Apagar"

Expand All @@ -61,7 +62,3 @@ msgstr ""
"Un sencillo applet de control del sistema para reiniciar Cinnamon, bloquear "
"la pantalla, cambiar de usuario, cerrar sesión, suspender, hibernar, "
"reiniciar o apagar el ordenador"

#. metadata.json->name
msgid "System Controls Applet"
msgstr "Applet de controles del sistema"
Loading

0 comments on commit b0ae822

Please sign in to comment.