Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[screen-inhibit@mtwebster] v2.2.0 - Add a timer to end screen saver inhibition #6459

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v2.2.0~20241001
* Add a timer to end screen saver inhibition.

### v2.1.3~20240925
* Users can select the number of seconds (0-60) that elapse before the screen saver is disabled.

Expand Down
56 changes: 46 additions & 10 deletions screen-inhibit@mtwebster/files/screen-inhibit@mtwebster/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ class ScreenSaverInhibitor extends Applet.IconApplet {
this.settings.bind( "seconds-after-startup",
"seconds_after_startup",
null);
this.settings.bind( "end-timechooser",
"end_time",
this.on_endtime_changed);
this.settings.bind( "end-type",
"end_type",
this.on_endtime_changed);
this.settings.bind( "locktype",
"locktype",
this.loop);
Expand All @@ -92,6 +98,8 @@ class ScreenSaverInhibitor extends Applet.IconApplet {
"old_sleep_display_ac");
this.settings.bind( "old-sleep-inactive-ac-timeout",
"old_sleep_inactive_ac_timeout");
this.settings.bind( "starting-time-in-minutes",
"starting_time_in_minutes");
} catch (e) {
this.settings = null;
this.off_icon = "screen-inhibit-symbolic"; // "video-display-symbolic";
Expand Down Expand Up @@ -150,22 +158,50 @@ class ScreenSaverInhibitor extends Applet.IconApplet {
}

if (this.inhibited) {
switch (this.locktype) {
case "normal":
break;
case "aggressive1":
if (SCREENSAVER_COMMAND)
Util.spawnCommandLineAsync(SCREENSAVER_COMMAND+" -d");
break;
case "aggressive2":
if (SCREENSAVER_COMMAND)
Util.spawnCommandLineAsync(SCREENSAVER_COMMAND+" -e");
if (!this.is_end_time()) {
switch (this.locktype) {
case "normal":
this.lockinterval = 1;
break;
case "aggressive1":
if (SCREENSAVER_COMMAND)
Util.spawnCommandLineAsync(SCREENSAVER_COMMAND+" -d");
break;
case "aggressive2":
if (SCREENSAVER_COMMAND)
Util.spawnCommandLineAsync(SCREENSAVER_COMMAND+" -e");
}
} else {
this.starting_time_in_minutes = 0;
this.end_type = 0;
this.on_applet_clicked()
}
}

this.loopId = Mainloop.timeout_add(this.lockinterval * 60000, this.loop.bind(this));
}

is_end_time() {
if (this.end_type === 0)
return false;
const date = new Date;
const hour = date.getHours();
const minute = date.getMinutes();
if (this.end_type === 2 && (hour*60+minute >= this.end_time.h*60+this.end_time.m))
return true;
if (this.end_type === 1 && (hour*60+minute - this.starting_time_in_minutes <= this.end_time.h*60+this.end_time.m))
return true;
return false;
}

on_endtime_changed() {
const date = new Date;
const hour = date.getHours();
const minute = date.getMinutes();

this.starting_time_in_minutes = hour*60+minute;
}

on_inhibit_at_startup_changed() {
this.startup_menu_item._switch.setToggleState(this.inhibit_at_startup);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"uuid": "screen-inhibit@mtwebster",
"name": "Screensaver Inhibitor",
"author": "claudiux",
"version": "2.1.3"
"version": "2.2.0"
}
67 changes: 51 additions & 16 deletions screen-inhibit@mtwebster/files/screen-inhibit@mtwebster/po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: screen-inhibit@mtwebster 2.1.2\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-applets/"
"issues\n"
"POT-Creation-Date: 2024-09-25 22:35+0200\n"
"POT-Creation-Date: 2024-10-01 18:55+0200\n"
"PO-Revision-Date: 2024-09-26 03:22+0200\n"
"Last-Translator: Odyssey <[email protected]>\n"
"Language-Team: \n"
Expand All @@ -26,12 +26,12 @@ msgstr "Actualment impedint el protector de pantalla"
msgid "Currently allowing screensaver"
msgstr "Actualment permetent el protector de pantalla"

#. applet.js:126
#. applet.js:134
msgid "Screensaver settings"
msgstr "Configuració del protector de pantalla"

#. settings-schema.json->inhibit-at-startup->description
#. applet.js:130
#. applet.js:138
msgid "Inhibit screensaver at startup"
msgstr "Inhibit el protector de pantalla en arrancar"

Expand All @@ -45,10 +45,57 @@ msgstr ""
msgid "Screensaver Inhibitor"
msgstr "Inhibidor del protector de pantalla"

#. settings-schema.json->head->description
#. settings-schema.json->pGeneral->title
msgid "General"
msgstr ""

#. settings-schema.json->pIcons->title
#. settings-schema.json->sectionIcons->title
msgid "Icons"
msgstr "Icones"

#. settings-schema.json->pKeybindings->title
#. settings-schema.json->sectionKeybindings->title
msgid "Keybinding"
msgstr "Dreceres del teclat"

#. settings-schema.json->sectionStartup->title
msgid "Startup"
msgstr "Inici"

#. settings-schema.json->sectionDurationOrEndTime->title
#, fuzzy
msgid "Duration or End Time of screen saver inhibition"
msgstr "Número de segons abans de la inhibició del protector de pantalla"

#. settings-schema.json->sectionBlocking->title
msgid "Way to block the screensaver"
msgstr "Manera de blocar el protector de pantalla"

#. settings-schema.json->end-timechooser->description
msgid "Time"
msgstr ""

#. settings-schema.json->end-timechooser->tooltip
msgid "Seconds will be ignored."
msgstr ""

#. settings-schema.json->end-type->description
msgid "The time shown above is"
msgstr ""

#. settings-schema.json->end-type->options
msgid "to be disregarded"
msgstr ""

#. settings-schema.json->end-type->options
msgid "the inhibit duration"
msgstr ""

#. settings-schema.json->end-type->options
msgid "the inhibit end time"
msgstr ""

#. settings-schema.json->off-icon->description
msgid "Power management allowed icon:"
msgstr "Icona de permissió d'administració de la energia:"
Expand All @@ -66,26 +113,14 @@ msgstr "Icona d'impediment d'administració de la energia:"
msgid "Reset to default icons"
msgstr "Reiniciar a les icones per defecte"

#. settings-schema.json->head1->description
msgid "Keybinding"
msgstr "Dreceres del teclat"

#. settings-schema.json->keybinding->description
msgid "Set the keybinding for screensaver inhibit"
msgstr "Assigneu la drecera per a l'inhibidor del protector de pantalla"

#. settings-schema.json->head2->description
msgid "Startup"
msgstr "Inici"

#. settings-schema.json->seconds-after-startup->description
msgid "Number of seconds before screensaver inhibition"
msgstr "Número de segons abans de la inhibició del protector de pantalla"

#. settings-schema.json->head3->description
msgid "Way to block the screensaver"
msgstr "Manera de blocar el protector de pantalla"

#. settings-schema.json->locklabel->description
msgid "(Avoid using aggressive ways, if possible.)"
msgstr "(Si pot ser, eviteu usar maneres agressives.)"
Expand Down
67 changes: 51 additions & 16 deletions screen-inhibit@mtwebster/files/screen-inhibit@mtwebster/po/da.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-applets/"
"issues\n"
"POT-Creation-Date: 2024-09-25 22:35+0200\n"
"POT-Creation-Date: 2024-10-01 18:55+0200\n"
"PO-Revision-Date: 2017-10-01 14:17+0200\n"
"Last-Translator: Alan Mortensen <[email protected]>\n"
"Language-Team: \n"
Expand All @@ -27,12 +27,12 @@ msgstr "Pauseskærmen er aktiveret"
msgid "Currently allowing screensaver"
msgstr "Pauseskærmen er aktiveret"

#. applet.js:126
#. applet.js:134
msgid "Screensaver settings"
msgstr "Indstillinger"

#. settings-schema.json->inhibit-at-startup->description
#. applet.js:130
#. applet.js:138
msgid "Inhibit screensaver at startup"
msgstr ""

Expand All @@ -45,10 +45,57 @@ msgstr ""
msgid "Screensaver Inhibitor"
msgstr "Deaktivering af pauseskærmen"

#. settings-schema.json->head->description
#. settings-schema.json->pGeneral->title
msgid "General"
msgstr ""

#. settings-schema.json->pIcons->title
#. settings-schema.json->sectionIcons->title
msgid "Icons"
msgstr "Ikoner"

#. settings-schema.json->pKeybindings->title
#. settings-schema.json->sectionKeybindings->title
msgid "Keybinding"
msgstr "Tastegenvej"

#. settings-schema.json->sectionStartup->title
msgid "Startup"
msgstr ""

#. settings-schema.json->sectionDurationOrEndTime->title
#, fuzzy
msgid "Duration or End Time of screen saver inhibition"
msgstr "Angiv tastegenvejen for at aktivere en handling: "

#. settings-schema.json->sectionBlocking->title
msgid "Way to block the screensaver"
msgstr ""

#. settings-schema.json->end-timechooser->description
msgid "Time"
msgstr ""

#. settings-schema.json->end-timechooser->tooltip
msgid "Seconds will be ignored."
msgstr ""

#. settings-schema.json->end-type->description
msgid "The time shown above is"
msgstr ""

#. settings-schema.json->end-type->options
msgid "to be disregarded"
msgstr ""

#. settings-schema.json->end-type->options
msgid "the inhibit duration"
msgstr ""

#. settings-schema.json->end-type->options
msgid "the inhibit end time"
msgstr ""

#. settings-schema.json->off-icon->description
msgid "Power management allowed icon:"
msgstr "Ikon for aktiveret strømstyring:"
Expand All @@ -66,27 +113,15 @@ msgstr "Ikon for deaktiveret strømstyring:"
msgid "Reset to default icons"
msgstr ""

#. settings-schema.json->head1->description
msgid "Keybinding"
msgstr "Tastegenvej"

#. settings-schema.json->keybinding->description
msgid "Set the keybinding for screensaver inhibit"
msgstr "Angiv tastegenvejen for at aktivere en handling: "

#. settings-schema.json->head2->description
msgid "Startup"
msgstr ""

#. settings-schema.json->seconds-after-startup->description
#, fuzzy
msgid "Number of seconds before screensaver inhibition"
msgstr "Angiv tastegenvejen for at aktivere en handling: "

#. settings-schema.json->head3->description
msgid "Way to block the screensaver"
msgstr ""

#. settings-schema.json->locklabel->description
msgid "(Avoid using aggressive ways, if possible.)"
msgstr ""
Expand Down
Loading