dot/.local/share/gnome-shell/extensions/cpupower@mko-sl.de/README.md

7.8 KiB

CPU Power Manager for Gnome Shell

Get it on GNOME Extensions
latest build release build Lastest release Gnome License PRs Welcome
Gnome-Shell Extension for intel-pstate driver

PrerequisitesInstallationTranslatingPackagingDeveloping

Prerequisites

You need to have an Intel Core i CPU of at least the second Generation (2xxx Model Number) and the following software installed to use this extension:

  • Gnome (since it's an extension)
  • Policykit (ships default with gnome)
  • intel_pstate needs to be enabled in the kernel (should be the default in almost all Distros)
  • bash

Installing via Makefile

In order to use the Makefile you need the following packages:

  • make
  • gettext

Installation

The easiest way to install this extension is by using the Gnome extensions website.

Click on the CPU icon in the top bar of your Gnome shell and follow the installation instructions. You need to enter your root password to install a policy kit rule. This rule is used to set the clock frequency of your CPU with your user.

Installing for another (admin) user

Impersonate the (admin) user, clone the git repository, and run the following command:

Note: Cloning and installing the extension while impersonating the other user, enables this user to install updates for this extension from extensions.gnome.org.

$ sudo -u username bash
$ cd /tmp
$ git clone https://github.com/martin31821/cpupower.git
$ cd cpupower
$ make install PREFIX=/home/username/.local

Restart the gnome-shell (log out and back in) to make the extension available.

The user can enable the extension in his settings and install the polkit rule and cpufreqctl tool by using the included installation guide.

Uninstalling

The user can uninstall the tools in the settings of this extension. The extension itself can be removed from withing the extension settings or with this command:

$ make uninstall PREFIX=/home/username/.local

Installing for another (non-admin) user

Impersonate the (non-admin) user, clone the git repository, and run the following command:

Note: Cloning and installing the extension while impersonating the other user, enables this user to install updates for this extension from extensions.gnome.org. However, the tool must be updated and installed by an administrator. The extension may stop working after the user installed an update and may need updating of the tool by an administrator.

$ sudo -u username bash
$ cd /tmp
$ git clone https://github.com/martin31821/cpupower.git
$ cd cpupower
$ make install PREFIX=/home/username/.local

And with an admin user run the following commands:

$ sudo make install-tool TOOL_SUFFIX=username

Note: Also, use this command to update the tool for another user in an outdated installation.

Note: Using another PREFIX than /usr in this setup might include security risks and may not work.

Restart the gnome-shell (log out and back in) to make the extension available.

The extension will work out-of-the-box for this user only!

Uninstalling

$ sudo make uninstall PREFIX=/home/username/.local
$ sudo make uninstall-tool TOOL_SUFFIX=username

Installing for all users

Clone the git repository and run the following command:

$ sudo make install install-tool

This will install the extensions, polkit rule, and the tool for all users on the system.

Uninstalling

Run the following command to uninstall:

$ sudo make uninstall uninstall-tool

Translating

In order to translate this extension you first need to install Poedit. You may use your distributions package manager to install it.

When finished, fork this project and clone like described in the linked guide.

Creating a new translation

Open Poedit and select File / New From POT/PO File... and select cpupower/locale/template.pot. Select the language you want to translate to. Now start translating.

Edit or update an existing translation

Open Poedit and select Open. Navigate to the cpupower/locale folder and select the language file (.po) you want to edit/update. Now select Catalog / Update from POT File... and select cpupower/locale/template.pot. Now, you can start updating the translation.

Saving your work

When finished save the file into the locale folder and push your changes to your fork. Now, you can create a pull request to make your translation available in the main cpupower installation.

Packaging

You are a package maintainer and looking into packaging this extension? Great! Below is a short summary of how to properly install this extension (run as root):

# make install install-tool PREFIX=/usr

This will install a polkit rule to /usr/share/polkit-1/actions/mko.cpupower.setcpufreq.policy and an executable bash script to /usr/bin/cpufreqctl. The extension is installed to /usr/share/gnome-shell/extensions/cpupower@mko-sl.de. It still includes the scripts folder, the policykit rule template in data/mko.cpupower.policy.in, a useless copy of the tool in the tool folder, and the Makefile. These are included in the distribution of the extension to enable user installation if the extension got installed over the GNOME extensions website. If you do not want to distribute those files in your package, you can safely remove them.

If you find any issues in packaging this extension, please don't hesitate to report them!

Developing

Option 1

Clone the repository and run:

$ make install PREFIX=/home/username/.local

and reload the extension by restarting your gnome-shell.

Option 2

Clone the respository to ~/.local/share/gnome-shell/extensions/cpupower@mko-sl.de and reload the extension by restarting your gnome-shell.

You can now enable the extension in your extension settings.

Viewing log output

$ journalctl /usr/bin/gnome-shell -f

Creating a new release

Only core contributors to this project can make a new release. To create one, run:

$ make release