Skip to content

Commit

Permalink
Merge pull request linuxmint#270 from pdcurtis/nvidiaprime-3.2.1
Browse files Browse the repository at this point in the history
nvidiaprime@pdcurtis Update to version 3.2.1
  • Loading branch information
brownsr committed Apr 2, 2017
2 parents d83835f + 284ab73 commit 3803499
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 19 deletions.
6 changes: 6 additions & 0 deletions nvidiaprime@pdcurtis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ The latest version has a tick box option on the configuration screen to access e

glxsheres64 only needs to be installed if you want to use the applet to test the relative performances of the Intel and nVidia graphics processors. glxsheres64 is part of the VirtualGL package which needs to be installed from http:https://sourceforge.net/projects/virtualgl/files/VirtualGL/ - download the latest version and install using gdebi (should be the default for a right click on the downloaded file). It should run about five times faster when the nVidia GPU is active and is a very good test as to how good your cooling is for both the CPU and nVidia GPU when it is active.

## Translations and other Contributions

The internal changes required in the applet to allow translations are being implemented but no translations are available at this time. Translations are usually contributed by people fluent in the language and will be very much appreciated. Users please note I rarely be able to take responsibility for the accuracy of translations!

Although comments and suggestions are always welcome any contributions which are contemplated must follow discussion. Changes can have many unintended consequences and the integrity of the applet is paramount. Unsolicited Pull Requests will never be authorised other than for urgent and critical bug fixes from the Cinnamon Team.

## Manual Installation:

* Make sure the nVidia drivers and nVidia Prime are installed and working
Expand Down
6 changes: 6 additions & 0 deletions nvidiaprime@pdcurtis/files/nvidiaprime@pdcurtis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ The latest version has a tick box option on the configuration screen to access e

glxsheres64 only needs to be installed if you want to use the applet to test the relative performances of the Intel and nVidia graphics processors. glxsheres64 is part of the VirtualGL package which needs to be installed from http:https://sourceforge.net/projects/virtualgl/files/VirtualGL/ - download the latest version and install using gdebi (should be the default for a right click on the downloaded file). It should run about five times faster when the nVidia GPU is active and is a very good test as to how good your cooling is for both the CPU and nVidia GPU when it is active.

## Translations and other Contributions

The internal changes required in the applet to allow translations are being implemented but no translations are available at this time. Translations are usually contributed by people fluent in the language and will be very much appreciated. Users please note I rarely be able to take responsibility for the accuracy of translations!

Although comments and suggestions are always welcome any contributions which are contemplated must follow discussion. Changes can have many unintended consequences and the integrity of the applet is paramount. Unsolicited Pull Requests will never be authorised other than for urgent and critical bug fixes from the Cinnamon Team.

## Manual Installation:

* Make sure the nVidia drivers and nVidia Prime are installed and working
Expand Down
56 changes: 40 additions & 16 deletions nvidiaprime@pdcurtis/files/nvidiaprime@pdcurtis/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@ const Settings = imports.ui.settings; // ++ Needed if you use Settings Screen
const St = imports.gi.St; // ++
const PopupMenu = imports.ui.popupMenu; // ++ Needed for menus
const Lang = imports.lang; // ++ Needed for menus
const GLib = imports.gi.GLib; // ++ Needed for starting programs
const GLib = imports.gi.GLib; // ++ Needed for starting programs and translations
const Mainloop = imports.mainloop; // Needed for timer update loop

// l10n/translation support as per NikoKrause tutorial modified as UUID already used!
const Gettext = imports.gettext
const UUIDl10n = "nvidiaprime@pdcurtis"
Gettext.bindtextdomain(UUIDl10n, GLib.get_home_dir() + "/.local/share/locale")
function _(str) {
return Gettext.dgettext(UUIDl10n, str);
}


// ++ Always needed
function MyApplet(metadata, orientation, panelHeight, instance_id) {
this._init(metadata, orientation, panelHeight, instance_id);
Expand Down Expand Up @@ -56,6 +65,7 @@ MyApplet.prototype = {
this.applet_running = true; //** New to allow applet to be fully stopped when removed from panel

// Choose Text Editor depending on whether Mint 18 with Cinnamon 3.0 and latter
// Could this be replaced by use of system editor? but "If it ain't broke don't fix it"
if (this.versionCompare( GLib.getenv('CINNAMON_VERSION') ,"3.0" ) <= 0 ){
this.textEd = "gedit";
} else {
Expand All @@ -76,7 +86,7 @@ MyApplet.prototype = {

// Finally setup to start the update loop for the applet display running
this.set_applet_label(" " ); // show nothing until system stable
this.set_applet_tooltip("Waiting for nvidia");
this.set_applet_tooltip(_("Waiting for nvidia"));
Mainloop.timeout_add_seconds(2, Lang.bind(this, this.updateLoop)); // Timer to allow prime to initiate

} catch (e) {
Expand Down Expand Up @@ -127,13 +137,13 @@ MyApplet.prototype = {
this._applet_context_menu.addMenuItem(menuitem1);
*/

let menuitem2 = new PopupMenu.PopupMenuItem("Open Power Statistics");
let menuitem2 = new PopupMenu.PopupMenuItem(_("Open Power Statistics"));
menuitem2.connect('activate', Lang.bind(this, function (event) {
GLib.spawn_command_line_async('gnome-power-statistics');
}));
this._applet_context_menu.addMenuItem(menuitem2);

this.menuitem3 = new PopupMenu.PopupMenuItem("Open System Monitor");
this.menuitem3 = new PopupMenu.PopupMenuItem(_("Open System Monitor"));
this.menuitem3.connect('activate', Lang.bind(this, function (event) {
GLib.spawn_command_line_async('gnome-system-monitor');
}));
Expand All @@ -152,16 +162,16 @@ MyApplet.prototype = {


// ++ Set up sub menu for Housekeeping Items
this.subMenu1 = new PopupMenu.PopupSubMenuMenuItem("Housekeeping Menu");
this.subMenu1 = new PopupMenu.PopupSubMenuMenuItem(_("Housekeeping Menu"));
this._applet_context_menu.addMenuItem(this.subMenu1);

this.subMenuItem1 = new PopupMenu.PopupMenuItem("View the Changelog");
this.subMenuItem1 = new PopupMenu.PopupMenuItem(_("View the Changelog"));
this.subMenuItem1.connect('activate', Lang.bind(this, function (event) {
GLib.spawn_command_line_async(this.textEd + ' ' + this.changelog);
}));
this.subMenu1.menu.addMenuItem(this.subMenuItem1); // Note this has subMenu1.menu not subMenu1._applet_context_menu as one might expect

this.subMenuItem2 = new PopupMenu.PopupMenuItem("Open the Help file");
this.subMenuItem2 = new PopupMenu.PopupMenuItem(_("Open the Help file"));
this.subMenuItem2.connect('activate', Lang.bind(this, function (event) {
GLib.spawn_command_line_async(this.textEd + ' ' + this.helpfile);
}));
Expand All @@ -184,7 +194,8 @@ MyApplet.prototype = {
try {
this.bbswitchStatus = GLib.file_get_contents("/proc/acpi/bbswitch").toString();
this.bbswitchStatus2 = this.bbswitchStatus.substr( (this.bbswitchStatus.length - 2 ),1 );
// Checking for N as last character in string ensures bbswitch is present and ON before nvidia-settings run
// Checking for N as last character in string ensures bbswitch is present and ON before nvidia-settings run
// The setting up of strings which are used as flags is probably redundant due to changes made for translations but "if it aint broke dont fix it"
if (this.bbswitchStatus2 == "N") {
this.bbst = "ON";
}
Expand All @@ -195,22 +206,23 @@ MyApplet.prototype = {
} catch (e) {
// global.logError(e); // Comment out to avoid filling error log
this.bbst = "ERROR"
this.set_applet_label("ERROR" );
this.set_applet_tooltip("Nvidia Prime is not installed so applet willl not work");
this.set_applet_label(_("ERROR"));
this.set_applet_tooltip(_("Nvidia Prime is not installed so applet willl not work"));
}
try {
if(this.bbst == "OFF") {
this.set_applet_label("GPU OFF" );
this.set_applet_tooltip("NVidia based GPU is " + this.bbst);
this.set_applet_label(_("GPU OFF") );
// this.set_applet_tooltip(_("NVidia based GPU is") + " " + this.bbst);
this.set_applet_tooltip(_("NVidia based GPU is Off"));
}
if(this.bbst == "ON") {

this.nvidiagputemp1 = GLib.file_get_contents("/tmp/.gpuTemperature").toString();
// Check we have a valid temperature returned before updating
// in case of slow response from nvidia-settings which gives null string
if(this.nvidiagputemp1.substr(5,2) > 0){ this.nvidiagputemp = this.nvidiagputemp1.substr(5,2)};
this.set_applet_label("GPU " + this.nvidiagputemp + "\u1d3cC" );
this.set_applet_tooltip("NVidia based GPU is " + this.bbst + " and Core Temperature is " + this.nvidiagputemp + "\u1d3cC" );
this.set_applet_label(_("GPU") + " " + this.nvidiagputemp + "\u1d3cC" );// this.set_applet_tooltip(_("NVidia based GPU is") + " " + this.bbst + " " + _("and Core Temperature is") + " " + this.nvidiagputemp + "\u1d3cC" );
this.set_applet_tooltip(_("NVidia based GPU is On and Core Temperature is") + " " + this.nvidiagputemp + "\u1d3cC" );
// Get temperatures via asyncronous script ready for next cycle
GLib.spawn_command_line_async('sh ' + this.gputempScript );
}
Expand Down Expand Up @@ -241,7 +253,7 @@ function main(metadata, orientation, panelHeight, instance_id) {
return myApplet;
}
/*
Version v30_3.2.0
Version 3.2.1
v30_3.0.0 Based on Bumblbee v20_0.9.8 but modified to use nVidia Prime.
Changes to work with Mint 18 and Cinnamon 3.0 -gedit -> xed
Expand All @@ -264,5 +276,17 @@ v30_3.1.5 New tick box on configuration screen to access enhanced functionality
http:https://sourceforge.net/projects/virtualgl/files/VirtualGL/
v30_3.1.6 Corrected icon.png in applet folder which is used by Add Applets
v30_3.2.0 Changed help file from help.txt to README.md
Transition to new cinnamon-spices-applets repository from github.com/pdcurtis/cinnamon-applets
v30_3.2.0 Changed help file from help.txt to README.md -can keep copies of README.md identical.
3.2.1 Version numbering harmonised with other Cinnamon applets and added to metadata.json so it shows in 'About...'
icon.png copied back into applet folder so it shows in 'About...'
Add translation support to applet.js and identify strings
Changes to remove leading and trailing spaces and replace with fixed spaces
Changes to strings to avoid mixed use of flags as strings to ease translations.
Add po folder to applet
Create batterymonitor.pot using cinnamon-json-makepot --js po/batterymonitor.pot
Version and changes information update in applet.js and changelog.txt
Update README.md (2x)
*/
16 changes: 14 additions & 2 deletions nvidiaprime@pdcurtis/files/nvidiaprime@pdcurtis/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version v30_3.2.0
Version 3.2.1

v30_3.0.0 Based on Bumblbee v20_0.9.8 but modified to use nVidia Prime.
Changes to work with Mint 18 and Cinnamon 3.0 -gedit -> xed
Expand All @@ -21,4 +21,16 @@ v30_3.1.5 New tick box on configuration screen to access enhanced functionality
http:https://sourceforge.net/projects/virtualgl/files/VirtualGL/

v30_3.1.6 Corrected icon.png in applet folder which is used by Add Applets
v30_3.2.0 Changed help file from help.txt to README.md

Transition to new cinnamon-spices-applets repository from github.com/pdcurtis/cinnamon-applets

v30_3.2.0 Changed help file from help.txt to README.md - can keep copies of README.md identical.
3.2.1 Version numbering harmonised with other Cinnamon applets and added to metadata.json so it shows in 'About...'
icon.png copied back into applet folder so it shows in 'About...'
Add translation support to applet.js and identify strings
Changes to remove leading and trailing spaces and replace with fixed spaces
Changes to strings to avoid mixed use of flags as strings to ease translations.
Add po folder to applet
Create batterymonitor.pot using cinnamon-json-makepot --js po/batterymonitor.pot
Version and changes information update in applet.js and changelog.txt
Update README.md (2x)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"dangerous": false,
"description": "Displays nVidia GPU Temperature when using Prime",
"name": "nVidia Prime GPU Display",
"uuid": "nvidiaprime@pdcurtis"
"uuid": "nvidiaprime@pdcurtis",
"version": "3.2.1"
}

109 changes: 109 additions & 0 deletions nvidiaprime@pdcurtis/files/nvidiaprime@pdcurtis/po/nvidiaprime.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-03 09:05+1200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"

#: applet.js:89
msgid "Waiting for nvidia"
msgstr ""

#: applet.js:140
msgid "Open Power Statistics"
msgstr ""

#: applet.js:146
msgid "Open System Monitor"
msgstr ""

#: applet.js:165
msgid "Housekeeping Menu"
msgstr ""

#: applet.js:168
msgid "View the Changelog"
msgstr ""

#: applet.js:174
msgid "Open the Help file"
msgstr ""

#: applet.js:209
msgid "ERROR"
msgstr ""

#: applet.js:210
msgid "Nvidia Prime is not installed so applet willl not work"
msgstr ""

#: applet.js:214
msgid "GPU OFF"
msgstr ""

#: applet.js:216
msgid "NVidia based GPU is Off"
msgstr ""

#: applet.js:224
msgid "GPU"
msgstr ""

#: applet.js:225
msgid "NVidia based GPU is On and Core Temperature is"
msgstr ""

#. nvidiaprime@pdcurtis->settings-schema.json->displayExtra->description
msgid ""
"Access enhanced functionality through Context Menu - needs Cinnamon Restart"
msgstr ""

#. nvidiaprime@pdcurtis->settings-schema.json->displayExtra->tooltip
msgid ""
"Currently adds glxspheres64 Graphics Processor Test - VirtualGL needs to be"
" installed"
msgstr ""

#. nvidiaprime@pdcurtis->settings-schema.json->head->description
msgid "General Settings for the nVidia Prime Monitoring Applet"
msgstr ""

#. nvidiaprime@pdcurtis->settings-schema.json->refreshInterval-
#. spinner->description
msgid "Refresh Interval for Display:"
msgstr ""

#. nvidiaprime@pdcurtis->settings-schema.json->refreshInterval-
#. spinner->tooltip
msgid ""
"Increase or decrease this spinner value to change the refresh interval - use"
" a slow refresh if you have a slow machine"
msgstr ""

#. nvidiaprime@pdcurtis->settings-schema.json->refreshInterval-spinner->units
msgid "seconds"
msgstr ""

#. nvidiaprime@pdcurtis->settings-schema.json->head1->description
msgid "Additional Functionality"
msgstr ""

#. nvidiaprime@pdcurtis->metadata.json->name
msgid "nVidia Prime GPU Display"
msgstr ""

#. nvidiaprime@pdcurtis->metadata.json->description
msgid "Displays nVidia GPU Temperature when using Prime"
msgstr ""

0 comments on commit 3803499

Please sign in to comment.