first version with basic fan monitor
This commit is contained in:
@@ -1,2 +1,10 @@
|
|||||||
# Faustus-Gnome-Monitor
|
# Faustus-Gnome-Monitor
|
||||||
a fan monitor for the asus tuf faustus driver @hackbnw/faustus
|
a fan monitor for the asus tuf faustus driver https://github.com/hackbnw/faustus
|
||||||
|
this simple gnome extension will only display if your laptop support /sys/devices/platform/faustus/throttle_thermal_policy
|
||||||
|
you can check this by simply doing ```ls /sys/devices/platform/faustus/throttle_thermal_policy``` if there is no error then you are fine.
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
```
|
||||||
|
mkdir -p ~/.local/share/gnome-shell/extensions/fan_status@Marc-Pierre-Barbier.github.com
|
||||||
|
git clone https://github.com/Marc-Pierre-Barbier/Faustus-Gnome-Monitor ~/.local/share/gnome-shell/extensions/fan_status@Marc-Pierre-Barbier.github.com
|
||||||
|
```
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
// Example #1
|
||||||
|
|
||||||
|
const {St, Clutter, GLib} = imports.gi
|
||||||
|
const Main = imports.ui.main
|
||||||
|
const Mainloop = imports.mainloop
|
||||||
|
const ByteArray = imports.byteArray
|
||||||
|
|
||||||
|
let panelButton;
|
||||||
|
|
||||||
|
|
||||||
|
const statuses = ["auto","fast","silent"]
|
||||||
|
|
||||||
|
function init () {
|
||||||
|
// Create a Button with "Hello World" text
|
||||||
|
panelButton = new St.Bin({
|
||||||
|
style_class : "panel-button",
|
||||||
|
});
|
||||||
|
|
||||||
|
//Gio.monitor doesn't trigger. maybe it considier throttle_thermal_policy as a device ?
|
||||||
|
Mainloop.timeout_add(300, function () {
|
||||||
|
update()
|
||||||
|
return true
|
||||||
|
});
|
||||||
|
update()
|
||||||
|
}
|
||||||
|
|
||||||
|
function readFile() {
|
||||||
|
const array = GLib.file_get_contents("/sys/devices/platform/faustus/throttle_thermal_policy")[1]
|
||||||
|
const status = parseInt(ByteArray.toString(array))
|
||||||
|
GLib.free(array)
|
||||||
|
return status
|
||||||
|
}
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
const status = readFile();
|
||||||
|
let panelButtonText = new St.Label({
|
||||||
|
text : statuses[status],
|
||||||
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
|
});
|
||||||
|
panelButton.set_child(panelButtonText);
|
||||||
|
}
|
||||||
|
|
||||||
|
function enable () {
|
||||||
|
// Add the button to the panel
|
||||||
|
Main.panel._rightBox.insert_child_at_index(panelButton, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function disable () {
|
||||||
|
// Remove the added button from panel
|
||||||
|
Main.panel._rightBox.remove_child(panelButton);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name" : "fan_status",
|
||||||
|
"description" : "Tuf fan monitor",
|
||||||
|
"shell-version" : [
|
||||||
|
"3.36",
|
||||||
|
"40"
|
||||||
|
],
|
||||||
|
"url" : "",
|
||||||
|
"uuid" : "fan_status@Marc-Pierre-Barbier.github.com",
|
||||||
|
"version" : 1.1
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user