mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Begin reimplement gex to use generated bindings and dbus xml
This commit is contained in:
9
.gitignore
vendored
9
.gitignore
vendored
@@ -9,3 +9,12 @@ vendor_*
|
||||
.vscode
|
||||
.~lock.*
|
||||
*.ods#
|
||||
|
||||
# gnome extension
|
||||
node-modules
|
||||
bindings/ts/*.d.ts
|
||||
bindings/ts/*.js.map
|
||||
desktop-extensions/gnome/_build
|
||||
desktop-extensions/gnome/target
|
||||
desktop-extensions/gnome/node_modules
|
||||
desktop-extensions/gnome/schemas/gschemas.compiled
|
||||
|
||||
@@ -18,6 +18,11 @@ impl SupportedFunctions {
|
||||
pub fn supported_functions(&self) -> &rog_platform::supported::SupportedFunctions {
|
||||
&self.0
|
||||
}
|
||||
|
||||
#[dbus_interface(out_args("answer", "question"))]
|
||||
fn meaning_of_life(&self) -> zbus::fdo::Result<(i32, String)> {
|
||||
Ok((42, String::from("Meaning of life")))
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
||||
@@ -65,7 +65,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
let supported = SupportedFunctions::get_supported();
|
||||
print_board_info();
|
||||
println!("{}", supported.supported_functions());
|
||||
println!("{:?}", supported.supported_functions());
|
||||
|
||||
// Start zbus server
|
||||
let mut connection = Connection::system().await?;
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
method return time=1687861003.331930 sender=:1.463 -> destination=:1.474 serial=13 reply_serial=2
|
||||
method return time=1687945851.162246 sender=:1.3354 -> destination=:1.3359 serial=8 reply_serial=2
|
||||
string "
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.asuslinux.Daemon">
|
||||
<method name="SupportedFunctions">
|
||||
<arg type="(b(b)(bb)(sbasasu)(bbbbbb))" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Peer">
|
||||
<method name="Ping">
|
||||
</method>
|
||||
@@ -15,9 +10,13 @@ method return time=1687861003.331930 sender=:1.463 -> destination=:1.474 serial=
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg type="s" direction="out"/>
|
||||
<interface name="org.asuslinux.Daemon">
|
||||
<method name="SupportedFunctions">
|
||||
<arg type="(b(b)(bb)(sbasass)(bbbbbb))" direction="out"/>
|
||||
</method>
|
||||
<method name="MeaningOfLife">
|
||||
<arg name="answer" type="i" direction="out"/>
|
||||
<arg name="question" type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Properties">
|
||||
@@ -44,5 +43,10 @@ method return time=1687861003.331930 sender=:1.463 -> destination=:1.474 serial=
|
||||
<arg name="invalidated_properties" type="as"/>
|
||||
</signal>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
"
|
||||
|
||||
96
bindings/ts/aura.js
Normal file
96
bindings/ts/aura.js
Normal file
@@ -0,0 +1,96 @@
|
||||
export var AuraModeNum;
|
||||
(function (AuraModeNum) {
|
||||
AuraModeNum["Static"] = "Static";
|
||||
AuraModeNum["Breathe"] = "Breathe";
|
||||
AuraModeNum["Strobe"] = "Strobe";
|
||||
AuraModeNum["Rainbow"] = "Rainbow";
|
||||
AuraModeNum["Star"] = "Star";
|
||||
AuraModeNum["Rain"] = "Rain";
|
||||
AuraModeNum["Highlight"] = "Highlight";
|
||||
AuraModeNum["Laser"] = "Laser";
|
||||
AuraModeNum["Ripple"] = "Ripple";
|
||||
AuraModeNum["Pulse"] = "Pulse";
|
||||
AuraModeNum["Comet"] = "Comet";
|
||||
AuraModeNum["Flash"] = "Flash";
|
||||
})(AuraModeNum || (AuraModeNum = {}));
|
||||
export var AuraZone;
|
||||
(function (AuraZone) {
|
||||
AuraZone["None"] = "None";
|
||||
AuraZone["Key1"] = "Key1";
|
||||
AuraZone["Key2"] = "Key2";
|
||||
AuraZone["Key3"] = "Key3";
|
||||
AuraZone["Key4"] = "Key4";
|
||||
AuraZone["Logo"] = "Logo";
|
||||
AuraZone["BarLeft"] = "BarLeft";
|
||||
AuraZone["BarRight"] = "BarRight";
|
||||
})(AuraZone || (AuraZone = {}));
|
||||
export var Speed;
|
||||
(function (Speed) {
|
||||
Speed["Low"] = "Low";
|
||||
Speed["Med"] = "Med";
|
||||
Speed["High"] = "High";
|
||||
})(Speed || (Speed = {}));
|
||||
export var Direction;
|
||||
(function (Direction) {
|
||||
Direction["Right"] = "Right";
|
||||
Direction["Left"] = "Left";
|
||||
Direction["Up"] = "Up";
|
||||
Direction["Down"] = "Down";
|
||||
})(Direction || (Direction = {}));
|
||||
export var AuraDevTuf;
|
||||
(function (AuraDevTuf) {
|
||||
AuraDevTuf["Boot"] = "Boot";
|
||||
AuraDevTuf["Awake"] = "Awake";
|
||||
AuraDevTuf["Sleep"] = "Sleep";
|
||||
AuraDevTuf["Keyboard"] = "Keyboard";
|
||||
})(AuraDevTuf || (AuraDevTuf = {}));
|
||||
export var AuraDevRog1;
|
||||
(function (AuraDevRog1) {
|
||||
AuraDevRog1["Awake"] = "Awake";
|
||||
AuraDevRog1["Keyboard"] = "Keyboard";
|
||||
AuraDevRog1["Lightbar"] = "Lightbar";
|
||||
AuraDevRog1["Boot"] = "Boot";
|
||||
AuraDevRog1["Sleep"] = "Sleep";
|
||||
})(AuraDevRog1 || (AuraDevRog1 = {}));
|
||||
export var AuraDevRog2;
|
||||
(function (AuraDevRog2) {
|
||||
AuraDevRog2["BootLogo"] = "BootLogo";
|
||||
AuraDevRog2["BootKeyb"] = "BootKeyb";
|
||||
AuraDevRog2["AwakeLogo"] = "AwakeLogo";
|
||||
AuraDevRog2["AwakeKeyb"] = "AwakeKeyb";
|
||||
AuraDevRog2["SleepLogo"] = "SleepLogo";
|
||||
AuraDevRog2["SleepKeyb"] = "SleepKeyb";
|
||||
AuraDevRog2["ShutdownLogo"] = "ShutdownLogo";
|
||||
AuraDevRog2["ShutdownKeyb"] = "ShutdownKeyb";
|
||||
AuraDevRog2["BootBar"] = "BootBar";
|
||||
AuraDevRog2["AwakeBar"] = "AwakeBar";
|
||||
AuraDevRog2["SleepBar"] = "SleepBar";
|
||||
AuraDevRog2["ShutdownBar"] = "ShutdownBar";
|
||||
AuraDevRog2["BootLid"] = "BootLid";
|
||||
AuraDevRog2["AwakeLid"] = "AwakeLid";
|
||||
AuraDevRog2["SleepLid"] = "SleepLid";
|
||||
AuraDevRog2["ShutdownLid"] = "ShutdownLid";
|
||||
AuraDevRog2["BootRearGlow"] = "BootRearGlow";
|
||||
AuraDevRog2["AwakeRearGlow"] = "AwakeRearGlow";
|
||||
AuraDevRog2["SleepRearGlow"] = "SleepRearGlow";
|
||||
AuraDevRog2["ShutdownRearGlow"] = "ShutdownRearGlow";
|
||||
})(AuraDevRog2 || (AuraDevRog2 = {}));
|
||||
export var LedBrightness;
|
||||
(function (LedBrightness) {
|
||||
LedBrightness["Off"] = "Off";
|
||||
LedBrightness["Low"] = "Low";
|
||||
LedBrightness["Med"] = "Med";
|
||||
LedBrightness["High"] = "High";
|
||||
})(LedBrightness || (LedBrightness = {}));
|
||||
export var AuraDevice;
|
||||
(function (AuraDevice) {
|
||||
AuraDevice["Tuf"] = "Tuf";
|
||||
AuraDevice["X1854"] = "X1854";
|
||||
AuraDevice["X1869"] = "X1869";
|
||||
AuraDevice["X1866"] = "X1866";
|
||||
AuraDevice["X18c6"] = "X18c6";
|
||||
AuraDevice["X19b6"] = "X19b6";
|
||||
AuraDevice["X1a30"] = "X1a30";
|
||||
AuraDevice["Unknown"] = "Unknown";
|
||||
})(AuraDevice || (AuraDevice = {}));
|
||||
//# sourceMappingURL=aura.js.map
|
||||
18
bindings/ts/platform.js
Normal file
18
bindings/ts/platform.js
Normal file
@@ -0,0 +1,18 @@
|
||||
export var AdvancedAura;
|
||||
(function (AdvancedAura) {
|
||||
AdvancedAura["None"] = "None";
|
||||
AdvancedAura["Zoned"] = "Zoned";
|
||||
AdvancedAura["PerKey"] = "PerKey";
|
||||
})(AdvancedAura || (AdvancedAura = {}));
|
||||
export var GpuMode;
|
||||
(function (GpuMode) {
|
||||
GpuMode["Discrete"] = "Discrete";
|
||||
GpuMode["Optimus"] = "Optimus";
|
||||
GpuMode["Integrated"] = "Integrated";
|
||||
GpuMode["Egpu"] = "Egpu";
|
||||
GpuMode["Vfio"] = "Vfio";
|
||||
GpuMode["Ultimate"] = "Ultimate";
|
||||
GpuMode["Error"] = "Error";
|
||||
GpuMode["NotSupported"] = "NotSupported";
|
||||
})(GpuMode || (GpuMode = {}));
|
||||
//# sourceMappingURL=platform.js.map
|
||||
@@ -2,6 +2,8 @@
|
||||
Generated by typeshare 1.6.0
|
||||
*/
|
||||
|
||||
import { AuraDevice, AuraModeNum, AuraZone } from "./aura";
|
||||
|
||||
export type AnimeSupportedFunctions = boolean;
|
||||
|
||||
export interface ChargeSupportedFunctions {
|
||||
|
||||
1
data/icons/scalable/anime.svg
Normal file
1
data/icons/scalable/anime.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 512 512" width="512pt" height="512pt"><defs><clipPath id="_clipPath_8C5izdJ0sH9w7nD5UuBTlpktuZWEWJn8"><rect width="512" height="512"/></clipPath></defs><g clip-path="url(#_clipPath_8C5izdJ0sH9w7nD5UuBTlpktuZWEWJn8)"><path d=" M 113.969 270.246 C 113.969 301.718 88.456 327.231 56.985 327.231 C 25.513 327.231 0 301.718 0 270.246 C 0 238.775 25.513 213.262 56.985 213.262 C 88.456 213.262 113.969 238.775 113.969 270.246 Z M 56.985 384.215 C 41.249 384.215 28.492 396.972 28.492 412.708 C 28.492 428.443 41.249 441.2 56.985 441.2 C 72.72 441.2 85.477 428.443 85.477 412.708 C 85.477 396.972 72.72 384.215 56.985 384.215 Z M 56.985 70.8 C 25.513 70.8 0 96.313 0 127.785 C 0 159.256 25.513 184.769 56.985 184.769 C 88.456 184.769 113.969 159.256 113.969 127.785 C 113.969 96.313 88.456 70.8 56.985 70.8 Z M 199.446 241.754 C 183.71 241.754 170.954 254.51 170.954 270.246 C 170.954 285.982 183.71 298.738 199.446 298.738 C 215.182 298.738 227.938 285.982 227.938 270.246 C 227.938 254.51 215.182 241.754 199.446 241.754 Z M 199.446 384.215 C 183.71 384.215 170.954 396.972 170.954 412.708 C 170.954 428.443 183.71 441.2 199.446 441.2 C 215.182 441.2 227.938 428.443 227.938 412.708 C 227.938 396.972 215.182 384.215 199.446 384.215 Z M 199.446 70.8 C 167.975 70.8 142.462 96.313 142.462 127.785 C 142.462 159.256 167.975 184.769 199.446 184.769 C 230.918 184.769 256.431 159.256 256.431 127.785 C 256.431 96.313 230.918 70.8 199.446 70.8 Z M 339.904 241.754 C 324.169 241.754 311.412 254.51 311.412 270.246 C 311.412 285.982 324.169 298.738 339.904 298.738 C 355.64 298.738 368.397 285.982 368.397 270.246 C 368.397 254.51 355.64 241.754 339.904 241.754 Z M 339.904 384.215 C 324.169 384.215 311.412 396.972 311.412 412.708 C 311.412 428.443 324.169 441.2 339.904 441.2 C 355.64 441.2 368.397 428.443 368.397 412.708 C 368.397 396.972 355.64 384.215 339.904 384.215 Z M 339.904 70.8 C 308.433 70.8 282.92 96.313 282.92 127.785 C 282.92 159.256 308.433 184.769 339.904 184.769 C 371.376 184.769 396.889 159.256 396.889 127.785 C 396.889 96.313 371.376 70.8 339.904 70.8 Z M 482.366 241.754 C 466.63 241.754 453.874 254.51 453.874 270.246 C 453.874 285.982 466.63 298.738 482.366 298.738 C 498.102 298.738 510.858 285.982 510.858 270.246 C 510.858 254.51 498.102 241.754 482.366 241.754 Z M 482.366 384.215 C 466.63 384.215 453.874 396.972 453.874 412.708 C 453.874 428.443 466.63 441.2 482.366 441.2 C 498.102 441.2 510.858 428.443 510.858 412.708 C 510.858 396.972 498.102 384.215 482.366 384.215 Z M 482.366 99.292 C 466.63 99.292 453.874 112.049 453.874 127.785 C 453.874 143.52 466.63 156.277 482.366 156.277 C 498.102 156.277 510.858 143.52 510.858 127.785 C 510.858 112.049 498.102 99.292 482.366 99.292 Z " fill="#F2F2F2"/></g></svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
1
data/icons/scalable/reboot.svg
Normal file
1
data/icons/scalable/reboot.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="141 297.96 507.339 471.04" width="507.339pt" height="471.04pt"><g><g><g><g><path d=" M 537.075 443.463 L 537.075 443.463 L 564.723 427.335 C 504.903 324.571 375.966 285.313 269.027 337.304 L 269.027 297.96 L 237.027 297.96 L 237.027 393.96 L 333.027 393.96 L 333.027 361.96 L 292.147 361.96 C 382.665 323.563 487.612 358.486 537.075 443.463 Z " fill="rgb(221,221,221)"/><path d=" M 245.027 692.775 C 170.84 632.524 151.314 527.353 198.931 444.488 L 171.187 428.488 C 116.876 523.063 137.426 642.887 220.147 713.96 L 181.027 713.96 L 181.027 745.96 L 277.027 745.96 L 277.027 649.96 L 245.027 649.96 L 245.027 692.775 L 245.027 692.775 Z " fill="rgb(221,221,221)"/><path d=" M 580.451 499.048 L 512.579 566.936 L 535.203 589.56 L 562.403 562.36 C 551.734 661.49 468.201 736.724 368.499 737 L 368.499 769 C 487.289 768.688 585.833 677.011 594.707 558.552 L 625.715 589.56 L 648.339 566.936 L 580.451 499.048 Z " fill="rgb(221,221,221)"/></g></g></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1
data/icons/scalable/rog-logo.svg
Normal file
1
data/icons/scalable/rog-logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="0 0 128 128" width="128pt" height="128pt"><defs><clipPath id="_clipPath_CHRnLOITGqiXLlZjYLaUfMylStiUiIRD"><rect width="128" height="128"/></clipPath></defs><g clip-path="url(#_clipPath_CHRnLOITGqiXLlZjYLaUfMylStiUiIRD)"><path d=" M 69.096 31.645 C 68.865 31.712 68.805 31.816 68.577 32.011 C 68.393 32.168 68.238 32.28 68.059 32.434 C 67.651 32.785 67.411 33.003 67.052 33.305 C 65.269 34.805 62.85 37.142 61.102 38.778 C 58.391 41.317 55.947 43.762 53.346 46.287 C 48.441 51.049 42.882 56.766 37.972 61.357 C 33.914 65.151 30.434 68.558 26.194 72.351 C 24.574 73.801 23.553 75.121 21.346 75.197 C 17.705 75.323 12.902 72.224 10.446 70.814 C 8.299 69.583 2.598 66.23 -0.15 66.137 L 1.864 68.903 C 3.303 71.1 5.724 75.885 6.887 78.214 C 10.881 86.213 16.273 94.589 23.136 100.161 C 24.891 101.586 26.481 102.783 28.71 104.132 C 29.687 104.723 30.685 105.215 31.778 105.834 C 32.157 106.049 34.786 107.277 35.11 107.276 C 34.39 106.554 33.649 105.673 33.064 104.985 C 30.452 101.912 24.64 95.938 22.894 92.889 C 21.428 90.329 21.091 88.761 22.72 86.192 C 24.582 83.254 28.924 79.619 31.648 77.289 C 38.277 71.62 44.256 66.485 51.191 61.102 C 54.478 58.551 57.895 55.949 61.429 53.427 C 64.896 50.954 68.381 48.57 72 46.178 L 77.465 42.7 C 77.972 42.409 82.95 39.446 83.029 39.347 L 87.9 36.66 C 89.536 35.736 91.124 34.964 92.857 34.031 C 97.94 31.294 108.035 26.833 113.82 24.792 C 115.718 24.122 117.528 23.489 119.449 22.833 L 125.205 21.03 C 124.739 20.79 118.379 20.724 117.207 20.724 C 112.491 20.723 109.598 20.855 105.095 21.211 C 101.65 21.483 95.237 22.19 92.104 22.948 C 91.54 23.084 90.872 23.142 90.304 23.292 C 89.218 23.578 87.974 23.775 86.861 24.052 C 84.567 24.623 82.484 25.271 80.328 25.914 C 78.108 26.575 76.101 27.36 74.115 28.177 C 72.942 28.659 69.397 31.029 69.096 31.645 L 69.096 31.645 Z M 115.16 43.036 L 119.345 40.899 C 120.797 40.208 122.299 39.413 123.667 38.745 C 126.441 37.389 128.04 32.995 127.999 30.179 C 127.509 30.199 125.516 31.144 124.975 31.342 C 124.603 31.479 124.259 31.596 123.911 31.744 C 121.439 32.794 118.139 34.036 115.795 35.142 C 115.115 35.463 114.457 35.729 113.769 36.024 C 113.228 36.256 112.036 36.724 111.814 36.999 C 111.07 36.962 95.925 44.467 94.037 45.443 C 91.35 46.833 87.97 48.499 85.386 49.936 C 85.08 50.106 77.204 54.275 76.891 54.676 C 76.372 54.762 70.974 57.968 70.112 58.454 C 59.43 64.482 47.599 72.065 37.367 79.004 C 34.524 80.933 30.892 83.463 28.034 85.617 L 25.739 87.329 C 25.476 87.53 25.165 87.663 25.013 87.965 C 26.033 88.843 32.791 91.628 34.403 92.209 C 43.451 95.47 51.92 97.742 61.441 99.376 L 67.483 100.3 L 72.241 100.72 L 68.366 100.378 C 69.105 100.462 69.839 100.582 70.559 100.651 C 71.624 100.753 72.679 100.84 73.776 100.949 C 75.841 101.157 78.238 101.298 80.361 101.335 C 82.999 101.381 84.453 101.516 86.617 100.603 C 88.294 99.894 89.659 99.013 90.992 97.992 C 95.957 94.187 100.375 88.235 103.899 82.849 C 107.587 77.213 110.909 70.915 113.773 64.675 C 115.231 61.498 116.599 58.182 117.888 54.804 C 118.541 53.092 119.107 51.439 119.697 49.622 C 120.023 48.617 121.212 44.945 121.302 44.125 C 119.948 44.31 96.265 57.088 94.012 58.297 C 90.956 59.938 88.029 61.647 85.064 63.258 C 82.182 64.823 79.134 66.672 76.267 68.266 C 70.441 71.504 64.575 75.11 58.757 78.479 C 57.76 79.056 50.352 83.387 50.086 83.691 C 50.584 83.611 74.07 73.525 74.639 73.29 C 75.746 72.832 98.806 62.937 99.184 62.92 C 99.052 63.454 97.624 66.118 97.264 66.901 C 96.664 68.206 95.94 69.692 95.284 70.989 C 91.565 78.346 87.529 87.178 79.411 90.439 L 78.923 90.732 C 78.488 90.742 77.299 91.225 76.775 91.369 C 75.986 91.586 75.223 91.736 74.428 91.899 C 70.686 92.665 65.028 92.266 61.129 91.656 C 56.682 90.96 53.568 90.179 49.258 89.137 C 48.229 88.889 40.792 86.799 40.362 86.516 C 40.604 86.093 44.858 83.368 45.23 83.109 C 53.46 77.389 67.13 68.983 76.02 63.925 C 76.961 63.389 77.835 62.903 78.696 62.41 C 79.411 62 80.72 61.317 81.298 60.897 L 85.457 58.616 C 86.864 57.835 88.155 57.159 89.637 56.314 C 92.438 54.716 95.275 53.376 98.032 51.823 C 98.437 51.595 114.179 43.323 115.159 43.037 L 115.16 43.036 Z " fill-rule="evenodd" fill="#F2F2F2"/></g></svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
373
desktop-extensions/gnome/LICENSE
Normal file
373
desktop-extensions/gnome/LICENSE
Normal file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
118
desktop-extensions/gnome/README.md
Normal file
118
desktop-extensions/gnome/README.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# asusctl ([-gex]: Gnome extension) -inactive(until v5.0.0)-
|
||||
|
||||
## inactive (kind of - update)
|
||||
|
||||
~~This project is currently inactive until a new maintainer wants to put some love into it and make it compatible with the newest asusctl versions.~~
|
||||
|
||||
ROG Control Center will also have it's own appindicator.
|
||||
|
||||
This extension is currently marked as inactive also on extensions.gnome.org and for users not visible anymore.
|
||||
|
||||
*UPDATE:*
|
||||
|
||||
The origin maintainer (ZaPpPeL) is back from his rabbit-hole! (I'll take care of getting this into a working-state again within the next weeks - stay tuned!)
|
||||
|
||||
---
|
||||
|
||||
Extension for visualizing [asusctl](https://gitlab.com/asus-linux/asusctl)(`asusd`) settings and status.
|
||||
|
||||
*hint:* supergfxctl GPU mode switching moved to another extension to make it platform independent: [supergfxctl-gex](https://gitlab.com/asus-linux/supergfxctl-gex)(`supergfxctl-gex`)
|
||||
|
||||
---
|
||||
|
||||
## Table of contents
|
||||
|
||||
[[_TOC_]]
|
||||
|
||||
---
|
||||
|
||||
## Extension Features
|
||||
|
||||
* Notifications:
|
||||
* Battery Charge Limit
|
||||
* Popup Menu with options to:
|
||||
* if supported by laptop model:
|
||||
* change the battery charging limit
|
||||
* change AniMe Matrix brightness
|
||||
* enable / disable AniMe Matrix
|
||||
* Extension Settings:
|
||||
* Enable / disable notifications
|
||||
* Enable debug message logging
|
||||
|
||||
### Waiting for implementation:
|
||||
|
||||
* Configuration interface (prefs)
|
||||
* bind ROG-Button to open prefs (if not `rog-control-center` is used)
|
||||
* create canvas based fan-curve editing
|
||||
|
||||
---
|
||||
|
||||
## Icons/Screenshots
|
||||
|
||||
_The screenshots below are just examples and might not represent the current used icons._
|
||||
|
||||
### Screenshot
|
||||
|
||||

|
||||
|
||||
**battery charge limit notification:**
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
* gnome >= 3.36.0
|
||||
* [asusctl](https://gitlab.com/asus-linux/asusctl) >= 4.0
|
||||
|
||||
---
|
||||
|
||||
## Build Instructions
|
||||
|
||||
### Dependencies
|
||||
|
||||
* nodejs >= 14.0.0
|
||||
* npm >= 6.14.0
|
||||
|
||||
### Building (production)
|
||||
|
||||
In a terminal enter the following commands as a user (**do NOT run as root or sudo**):
|
||||
|
||||
```bash
|
||||
git clone https://gitlab.com/asus-linux/asusctl-gex.git /tmp/asusctl-gex && cd /tmp/asusctl-gex
|
||||
npm install
|
||||
npm run build && npm run install-user
|
||||
```
|
||||
|
||||
_HINT: You will need to reload the GNOME Shell afterwards. (`Alt + F2` -> `r` on X11, `logout` on Wayland)_
|
||||
|
||||
### Building (development)
|
||||
|
||||
Instead of the
|
||||
`npm run build && npm run install-user`
|
||||
above, use this line instead:
|
||||
`npm run build && npm run install-dev`
|
||||
|
||||
This will remove any production versions and installs the development version instead.
|
||||
|
||||
_HINT: You will need to reload the GNOME Shell afterwards. (`Alt + F2` -> `r` on X11, `logout` on Wayland)_ and probably manually enable the extension again.
|
||||
|
||||
### Source debugging
|
||||
|
||||
`cd` into the directory where you've downloaded the `asusctl-gex` source code and enter the following commands:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run debug
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## License & Trademarks
|
||||
|
||||
**License:** Mozilla Public License Version 2.0 (MPL-2)
|
||||
|
||||
**Trademarks:** ASUS and ROG Trademark is either a US registered trademark or trademark of ASUSTeK Computer Inc. in the United States and/or other countries.
|
||||
Reference to any ASUS products, services, processes, or other information and/or use of ASUS Trademarks does not constitute or imply endorsement, sponsorship, or recommendation thereof by ASUS.
|
||||
The use of ROG and ASUS trademarks within this website and associated tools and libraries is only to provide a recognisable identifier to users to enable them to associate that these tools will work with ASUS ROG laptops.
|
||||
11
desktop-extensions/gnome/metadata.json
Normal file
11
desktop-extensions/gnome/metadata.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "asusctl-gex",
|
||||
"description": "asusctl-gex is a frontend for some functionalities of asusctl and supergfxctl that were born inside the asus-linux.org community.\n\nasusctl is required.\n\nTo learn more about it, please have a look at:\nhttps://gitlab.com/asus-linux/asusctl\nhttps://gitlab.com/asus-linux/asusctl-gex\n\nhttps://asus-linux.org/",
|
||||
"uuid": "asusctl-gex@asus-linux.org",
|
||||
"uuid-dev": "asusctl-gex-dev@asus-linux.org",
|
||||
"settings-schema": "org.gnome.shell.extensions.asusctl-gex",
|
||||
"version": "4.3.2",
|
||||
"shell-version": [
|
||||
"43", "44"
|
||||
]
|
||||
}
|
||||
1094
desktop-extensions/gnome/package-lock.json
generated
Normal file
1094
desktop-extensions/gnome/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
desktop-extensions/gnome/package.json
Normal file
46
desktop-extensions/gnome/package.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "asusctl-gex",
|
||||
"version": "4.7.0",
|
||||
"description": "asusctl-gex is a frontend for some functionalities of asusctl and supergfxctl that were born inside the asus-linux.org community.\n\nasusctl is required.\n\nTo learn more about it, please have a look at:\nhttps://gitlab.com/asus-linux/asusctl\nhttps://gitlab.com/asus-linux/asusctl-gex\n\nhttps://asus-linux.org/",
|
||||
"dependencies": {
|
||||
"npm-run-all": "^4.1.5",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"build:clean": "rm -rf _build _target schemas/gschemas.compiled target",
|
||||
"build:compile": "scripts/compile",
|
||||
"build:convert": "scripts/convert",
|
||||
"build:schemas": "glib-compile-schemas schemas",
|
||||
"build:transpile": "npx tsc",
|
||||
"build": "run-p build:clean && run-p build:transpile && run-p build:schemas && run-p build:convert && run-p build:compile",
|
||||
"debug:nested_shell": "run-p build && run-p install-dev && scripts/nested_shell",
|
||||
"debug": "run-p debug:nested_shell",
|
||||
"disable": "gnome-extensions disable \"asusctl-gex@asus-linux.org\"",
|
||||
"enable": "gnome-extensions enable \"asusctl-gex@asus-linux.org\"",
|
||||
"install-user": "scripts/install",
|
||||
"install-dev": "scripts/install dev",
|
||||
"uninstall-local": "scripts/uninstall",
|
||||
"zip": "scripts/zipit"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@gitlab.com/asus-linux/asusctl-gex.git"
|
||||
},
|
||||
"keywords": [
|
||||
"gnome-shell",
|
||||
"extension",
|
||||
"asusctl",
|
||||
"asus",
|
||||
"rog",
|
||||
"gnome",
|
||||
"gjs",
|
||||
"typescript"
|
||||
],
|
||||
"author": "Armas Spann, Marco Laux, Luke Jones",
|
||||
"license": "MPL-2",
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/asus-linux/asusctl/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/asus-linux/asusctl/desktop-extensions/gnome#readme"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist>
|
||||
<schema id="org.gnome.shell.extensions.asusctl-gex" path="/org/gnome/shell/extensions/asusctl-gex/" >
|
||||
<key type="b" name="mini-led-enabled">
|
||||
<default>true</default>
|
||||
<summary>enable / disable notifications</summary>
|
||||
<description>If enabled, notifications will show up on in various scenarios (when the GPU mode, power profile or charging limit is changed. Those notifications are not only triggered by the extension itself but react on DBUS signals from asusd, supergfxd and power-profiles-daemon.</description>
|
||||
</key>
|
||||
<key type="b" name="panel-od-enabled">
|
||||
<default>false</default>
|
||||
<summary>enable / disable debug messages</summary>
|
||||
<description>If enabled, various events of the extension will get logged and are available via journalctl.</description>
|
||||
</key>
|
||||
<key type="b" name="supernotice">
|
||||
<default>false</default>
|
||||
<summary>hide the supergfxctl-gex notice</summary>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
||||
11
desktop-extensions/gnome/scripts/compile
Executable file
11
desktop-extensions/gnome/scripts/compile
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
rm -rf _build
|
||||
mkdir -p _build/modules
|
||||
mkdir -p _build/bindings
|
||||
cp -r target/modules/*js _build/modules/
|
||||
cp -r target/bindings/*.js _build/bindings/
|
||||
cp -r metadata.json schemas target/*.js _build
|
||||
# cp -r icons resources *.css _build
|
||||
# cp src/prefs.ui _build/
|
||||
|
||||
exit 0;
|
||||
27
desktop-extensions/gnome/scripts/convert
Executable file
27
desktop-extensions/gnome/scripts/convert
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
find target/ -type f -print0 | while IFS= read -r -d $'\0' file; do \
|
||||
sed -i \
|
||||
-e 's#export function#function#g' \
|
||||
-e 's#export var#var#g' \
|
||||
-e 's#export const#var#g' \
|
||||
-e 's#Object.defineProperty(exports, "__esModule", { value: true });#var exports = {};#g' \
|
||||
$file; \
|
||||
|
||||
sed -i -E 's|export class (\w+)|var \1 = class \1|g' $file; \
|
||||
|
||||
sed -i -E "s|import \* as (\w+) from '..\/(\w+)\/(\w+)'|const \1 = Me.imports.\2.\3|g" $file; \
|
||||
# root
|
||||
sed -i -E "s|import \* as (\w+) from '..\/(\w+)'|const \1 = Me.imports.\2|g" $file; \
|
||||
# nested by one dir
|
||||
sed -i -E "s|import \* as (\w+) from '.\/(\w+)\/(\w+)'|const \1 = Me.imports.\2.\3|g" $file; \
|
||||
# root
|
||||
sed -i -E "s|import \* as (\w+) from '.\/(\w+)'|const \1 = Me.imports.\2|g" $file; \
|
||||
|
||||
sed -i -E "s|from '.\/modules\/(\w+)'|= Me.imports.modules.\1|g" $file; \
|
||||
|
||||
sed -i -E "s|from '.\/(\w+)'|= Me.imports.\1|g" $file; \
|
||||
|
||||
sed -i -E "s|import \{|var \{|g" $file; \
|
||||
done
|
||||
|
||||
exit 0;
|
||||
45
desktop-extensions/gnome/scripts/install
Executable file
45
desktop-extensions/gnome/scripts/install
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
isdev=false
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = "dev" ]; then
|
||||
isdev=true
|
||||
fi;
|
||||
done
|
||||
|
||||
INSTALLBASE=~/.local/share/gnome-shell/extensions
|
||||
UUID=`grep -E '^[ ]*"uuid":' _build/metadata.json | sed 's@^[ ]*"uuid":[ ]*"\(.\+\)",[ ]*@\1@'`
|
||||
UUIDDEV=`grep -E '^[ ]*"uuid-dev":' _build/metadata.json | sed 's@^[ ]*"uuid-dev":[ ]*"\(.\+\)",[ ]*@\1@'`
|
||||
GV=`gnome-shell --version | awk '{print $3}'`
|
||||
|
||||
if $isdev
|
||||
then
|
||||
sed -i "s/${UUID}/${UUIDDEV}/g" _build/metadata.json
|
||||
rm -fr "${INSTALLBASE}/${UUID}"
|
||||
UUID=$UUIDDEV
|
||||
else
|
||||
rm -fr "${INSTALLBASE}/${UUIDDEV}"
|
||||
fi
|
||||
|
||||
if [ -d "${INSTALLBASE}/${UUID}" ]; then
|
||||
rm -rf "${INSTALLBASE}/${UUID}/*"
|
||||
else
|
||||
mkdir -p "${INSTALLBASE}/${UUID}"
|
||||
fi
|
||||
|
||||
cp -r _build/* "${INSTALLBASE}/${UUID}/"
|
||||
|
||||
gnome-extensions info "${UUID}"
|
||||
INSTALLED="$?"
|
||||
|
||||
if [ "$INSTALLED" -eq 0 ]; then
|
||||
echo "reset"
|
||||
gnome-extensions reset "${UUID}"
|
||||
echo "enable"
|
||||
gnome-extensions enable "${UUID}"
|
||||
|
||||
echo "Please restart GNOME Shell if you are on X11 or logout and login again when you use Wayland."
|
||||
else
|
||||
echo "You probably install the extension for the first time. Please restart GNOME Shell or Logout and enable the extension via the Extensions app or extensions.gnome.org."
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
3
desktop-extensions/gnome/scripts/nested_shell
Executable file
3
desktop-extensions/gnome/scripts/nested_shell
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
MUTTER_DEBUG_DUMMY_MODE_SPECS=1366x768 dbus-run-session -- gnome-shell --nested --wayland
|
||||
exit 0
|
||||
8
desktop-extensions/gnome/scripts/uninstall
Executable file
8
desktop-extensions/gnome/scripts/uninstall
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
UUID=`grep -E '^[ ]*"uuid":' metadata.json | sed 's@^[ ]*"uuid":[ ]*"\(.\+\)",[ ]*@\1@'`
|
||||
INSTALLBASE=~/.local/share/gnome-shell/extensions
|
||||
|
||||
gnome-extensions disable "$UUID"
|
||||
rm -rf "$INSTALLBASE/$UUID"
|
||||
|
||||
exit 0;
|
||||
7
desktop-extensions/gnome/scripts/zipit
Executable file
7
desktop-extensions/gnome/scripts/zipit
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
UUID=`grep -E '^[ ]*"uuid":' metadata.json | sed 's@^[ ]*"uuid":[ ]*"\(.\+\)",[ ]*@\1@'`
|
||||
VSTRING=`grep -E '^[ ]*"version":' metadata.json | sed 's@^[ ]*"version":[ ]*"\(.\+\)",[ ]*@\1@'`
|
||||
rm *.zip
|
||||
cd _build && zip -qr "../$UUID.zip" .
|
||||
|
||||
exit 0;
|
||||
1
desktop-extensions/gnome/src/bindings
Symbolic link
1
desktop-extensions/gnome/src/bindings
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../bindings/ts
|
||||
158
desktop-extensions/gnome/src/extension.ts
Normal file
158
desktop-extensions/gnome/src/extension.ts
Normal file
@@ -0,0 +1,158 @@
|
||||
declare const global: any, imports: any;
|
||||
//@ts-ignore
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
|
||||
// const { GpuMode } = imports.bindings.platform;
|
||||
// REF: https://gjs.guide/extensions/development/creating.html
|
||||
|
||||
const { GObject, Gio } = imports.gi;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
|
||||
const QuickSettings = imports.ui.quickSettings;
|
||||
// This is the live instance of the Quick Settings menu
|
||||
const QuickSettingsMenu = imports.ui.main.panel.statusArea.quickSettings;
|
||||
//@ts-ignore
|
||||
const ThisModule = imports.misc.extensionUtils.getCurrentExtension();
|
||||
|
||||
// const systemConnection = Gio.DBus.system;
|
||||
// const TestProxy = Gio.DBusProxy.makeProxyWrapper(interfaceXml);
|
||||
|
||||
import * as Platform from './bindings/platform';
|
||||
|
||||
const QuickMiniLed = GObject.registerClass(
|
||||
class QuickMiniLed extends QuickSettings.QuickToggle {
|
||||
_init() {
|
||||
super._init({
|
||||
title: 'MiniLED',
|
||||
iconName: 'selection-mode-symbolic',
|
||||
toggleMode: true,
|
||||
});
|
||||
|
||||
this.label = 'MiniLED';
|
||||
|
||||
// Binding the toggle to a GSettings key
|
||||
this._settings = ExtensionUtils.getSettings();
|
||||
|
||||
this._settings.bind('mini-led-enabled',
|
||||
this, 'checked',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
}
|
||||
});
|
||||
|
||||
const IndicateMiniLed = GObject.registerClass(
|
||||
class IndicateMiniLed extends QuickSettings.SystemIndicator {
|
||||
_init() {
|
||||
super._init();
|
||||
|
||||
// Create the icon for the indicator
|
||||
this._indicator = this._addIndicator();
|
||||
this._indicator.icon_name = 'selection-mode-symbolic';
|
||||
|
||||
// Showing the indicator when the feature is enabled
|
||||
this._settings = ExtensionUtils.getSettings();
|
||||
|
||||
this._settings.bind('mini-led-enabled',
|
||||
this._indicator, 'visible',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
// Create the toggle and associate it with the indicator, being sure to
|
||||
// destroy it along with the indicator
|
||||
this.quickSettingsItems.push(new QuickMiniLed());
|
||||
|
||||
this.connect('destroy', () => {
|
||||
this.quickSettingsItems.forEach((item: { destroy: () => any; }) => item.destroy());
|
||||
});
|
||||
|
||||
// Add the indicator to the panel and the toggle to the menu
|
||||
QuickSettingsMenu._indicators.add_child(this);
|
||||
QuickSettingsMenu._addItems(this.quickSettingsItems);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const QuickPanelOd = GObject.registerClass(
|
||||
class QuickPanelOd extends QuickSettings.QuickToggle {
|
||||
_init() {
|
||||
super._init({
|
||||
title: 'Panel Overdrive',
|
||||
iconName: 'selection-mode-symbolic',
|
||||
toggleMode: true,
|
||||
});
|
||||
this.label = 'Panel Overdrive';
|
||||
this._settings = ExtensionUtils.getSettings();
|
||||
this._settings.bind('panel-od-enabled',
|
||||
this, 'checked',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
}
|
||||
});
|
||||
|
||||
const IndicatePanelOd = GObject.registerClass(
|
||||
class IndicatePanelOd extends QuickSettings.SystemIndicator {
|
||||
_init() {
|
||||
super._init();
|
||||
this._indicator = this._addIndicator();
|
||||
this._indicator.icon_name = 'selection-mode-symbolic';
|
||||
this._settings = ExtensionUtils.getSettings();
|
||||
this._settings.bind('panel-od-enabled',
|
||||
this._indicator, 'visible',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this.quickSettingsItems.push(new QuickPanelOd());
|
||||
this.connect('destroy', () => {
|
||||
this.quickSettingsItems.forEach((item: { destroy: () => any; }) => item.destroy());
|
||||
});
|
||||
QuickSettingsMenu._indicators.add_child(this);
|
||||
QuickSettingsMenu._addItems(this.quickSettingsItems);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function onNameAppeared(_connection: any, name: any, name_owner: any) {
|
||||
//@ts-ignore
|
||||
log(`The well-known name ${name} has been owned by ${name_owner}`);
|
||||
}
|
||||
|
||||
// Likewise, this will be invoked when the process that owned the name releases
|
||||
// the name.
|
||||
function onNameVanished(_connection: any, name: any) {
|
||||
//@ts-ignore
|
||||
log(`The name owner of ${name} has vanished`);
|
||||
}
|
||||
|
||||
const busWatchId = Gio.bus_watch_name(
|
||||
Gio.BusType.SESSION,
|
||||
'guide.gjs.Test',
|
||||
Gio.BusNameWatcherFlags.NONE,
|
||||
onNameAppeared,
|
||||
onNameVanished
|
||||
);
|
||||
|
||||
Gio.bus_unwatch_name(busWatchId);
|
||||
|
||||
class Extension {
|
||||
//@ts-ignore
|
||||
private _naff: Platform.GpuMode;
|
||||
private _indicateMiniLed: typeof IndicateMiniLed;
|
||||
private _indicatePanelOd: typeof IndicatePanelOd;
|
||||
constructor() {
|
||||
this._indicateMiniLed = null;
|
||||
this._indicatePanelOd = null;
|
||||
this._naff = Platform.GpuMode.Discrete;
|
||||
}
|
||||
|
||||
enable() {
|
||||
this._indicateMiniLed = new IndicateMiniLed();
|
||||
this._indicatePanelOd = new IndicatePanelOd();
|
||||
}
|
||||
|
||||
disable() {
|
||||
this._indicateMiniLed.destroy();
|
||||
this._indicateMiniLed = null;
|
||||
this._indicatePanelOd.destroy();
|
||||
this._indicatePanelOd = null;
|
||||
}
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
function init() {
|
||||
return new Extension();
|
||||
}
|
||||
122
desktop-extensions/gnome/src/modules/anime_dbus.ts
Normal file
122
desktop-extensions/gnome/src/modules/anime_dbus.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
declare const global: any, imports: any;
|
||||
declare var asusctlGexInstance: any;
|
||||
//@ts-ignore
|
||||
const ThisModule = imports.misc.extensionUtils.getCurrentExtension();
|
||||
|
||||
import * as Resources from './resources';
|
||||
|
||||
const {Gio} = imports.gi;
|
||||
|
||||
export class AnimeDbus {
|
||||
asusLinuxProxy: any = null; // type: Gio.DbusProxy (donno how to add)
|
||||
connected: boolean = false;
|
||||
state: boolean = true;
|
||||
brightness: number = 255;
|
||||
|
||||
constructor() {
|
||||
// nothing for now
|
||||
}
|
||||
|
||||
// currently there is no DBUS method because this can't be read from
|
||||
// hardware (as to @fluke).
|
||||
// https://gitlab.com/asus-linux/asusctl/-/issues/138
|
||||
|
||||
// public getOnOffState() {
|
||||
// if (this.isRunning()) {
|
||||
// try {
|
||||
// let currentState = this.asusLinuxProxy.AwakeEnabled;
|
||||
|
||||
// return currentState;
|
||||
// } catch (e) {
|
||||
// log(`Failed to fetch AniMe!`, e);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return this.state;
|
||||
// }
|
||||
|
||||
public setOnOffState(state: boolean | null) {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
// if null, toggle the current state
|
||||
state = (state == null ? !this.state : state);
|
||||
|
||||
if (this.state !== state) {
|
||||
this.state = state;
|
||||
}
|
||||
//@ts-ignore
|
||||
log(`Setting AniMe Power to ${state}`);
|
||||
return this.asusLinuxProxy.SetOnOffSync(state);
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`AniMe DBus set power failed!`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public setBrightness(brightness: number) {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
if (this.brightness !== brightness) {
|
||||
this.brightness = brightness;
|
||||
}
|
||||
//@ts-ignore
|
||||
log(`Setting AniMe Brightness to ${brightness}`);
|
||||
return this.asusLinuxProxy.SetBrightnessSync(brightness);
|
||||
// Panel.Actions.spawnCommandLine(`asusctl anime leds -b ${brightness}`);
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`AniMe DBus set brightness failed!`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isRunning(): boolean {
|
||||
return this.connected;
|
||||
}
|
||||
|
||||
async start() {
|
||||
//@ts-ignore
|
||||
log(`Starting AniMe DBus client...`);
|
||||
|
||||
try {
|
||||
// creating the proxy
|
||||
let xml = Resources.File.DBus('org-asuslinux-anime-4')
|
||||
this.asusLinuxProxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
||||
Gio.DBus.system,
|
||||
'org.asuslinux.Daemon',
|
||||
'/org/asuslinux/Anime'
|
||||
);
|
||||
|
||||
this.connected = true;
|
||||
|
||||
// currently there is no DBUS method because this can't be read from
|
||||
// hardware (as to @fluke).
|
||||
// https://gitlab.com/asus-linux/asusctl/-/issues/138
|
||||
/*
|
||||
this.asusLinuxProxy.connectSignal(
|
||||
"NotifyCharge",
|
||||
(proxy: any = null, name: string, data: string) => {
|
||||
if (proxy) {
|
||||
Log.info(`AniMe Power State has changed to ${data}% (${name}).`);
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`AniMe DBus initialization failed!`, e);
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
//@ts-ignore
|
||||
log(`Stopping AniMe DBus client...`);
|
||||
|
||||
if (this.isRunning()) {
|
||||
this.connected = false;
|
||||
this.asusLinuxProxy = null;
|
||||
this.state = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
149
desktop-extensions/gnome/src/modules/charge_dbus.ts
Normal file
149
desktop-extensions/gnome/src/modules/charge_dbus.ts
Normal file
@@ -0,0 +1,149 @@
|
||||
declare const global: any, imports: any;
|
||||
declare var asusctlGexInstance: any;
|
||||
//@ts-ignore
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
|
||||
import * as Resources from './resources';
|
||||
|
||||
const {Gio, GLib} = imports.gi;
|
||||
|
||||
export class ChargingLimit {
|
||||
asusLinuxProxy: any = null; // type: Gio.DbusProxy (donno how to add)
|
||||
connected: boolean = false;
|
||||
lastState: number = 100;
|
||||
pollerDelayTicks: number = 0;
|
||||
timeoutChargePoller: number | null = null;
|
||||
|
||||
constructor() {
|
||||
// nothing for now
|
||||
}
|
||||
|
||||
public getChargingLimit() {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
let currentState = this.asusLinuxProxy.LimitSync().toString().trim();
|
||||
|
||||
return currentState;
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Failed to fetch Charging Limit!`, e);
|
||||
}
|
||||
}
|
||||
|
||||
return this.lastState;
|
||||
}
|
||||
|
||||
public setChargingLimit(limit: number) {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
if (limit > 0 && this.lastState !== limit) {
|
||||
// update state
|
||||
this.lastState = limit;
|
||||
}
|
||||
return this.asusLinuxProxy.SetLimitSync(limit);
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Profile DBus set power profile failed!`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateChargingLimit(curState: number) {
|
||||
// return false;
|
||||
if (curState > 0 && this.lastState !== curState) {
|
||||
// disable the signal handler so we don't run in an infinite loop
|
||||
// of notifying, setting, notifying, setting...
|
||||
asusctlGexInstance.chargingLimit.chargingLimitSlider.block_signal_handler(asusctlGexInstance.chargingLimit._sliderChangedId);
|
||||
asusctlGexInstance.chargingLimit.chargingLimitSlider.value = curState/100;
|
||||
asusctlGexInstance.chargingLimit.chargingLimitSlider.unblock_signal_handler(asusctlGexInstance.chargingLimit._sliderChangedId);
|
||||
|
||||
asusctlGexInstance.chargingLimit.chargeLimitLabel.set_text(`${curState}%`);
|
||||
|
||||
// update state
|
||||
this.lastState = curState;
|
||||
}
|
||||
}
|
||||
|
||||
pollerChargingLimit() {
|
||||
if(this.isRunning() && this.pollerDelayTicks <= 0){
|
||||
try {
|
||||
let currentLimit = this.getChargingLimit();
|
||||
if (currentLimit !== this.lastState){
|
||||
this.updateChargingLimit(currentLimit);
|
||||
|
||||
// Panel.Actions.notify(
|
||||
// 'ASUS Notebook Control',
|
||||
// `Charging Limit changed to ${currentLimit}%`,
|
||||
// 'scalable/battery-symbolic.svg'
|
||||
// );
|
||||
}
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Charging Limit poller init failed!`, e);
|
||||
} finally {
|
||||
return this.isRunning() ? GLib.SOURCE_CONTINUE : GLib.SOURCE_REMOVE;
|
||||
}
|
||||
} else if (this.isRunning() && this.pollerDelayTicks > 0) {
|
||||
this.pollerDelayTicks--;
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
} else {
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
}
|
||||
|
||||
isRunning(): boolean {
|
||||
return this.connected;
|
||||
}
|
||||
|
||||
async start() {
|
||||
//@ts-ignore
|
||||
log(`Starting Charging Limit DBus client...`);
|
||||
|
||||
try {
|
||||
// creating the proxy
|
||||
let xml = Resources.File.DBus('org-asuslinux-charge-4')
|
||||
this.asusLinuxProxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
||||
Gio.DBus.system,
|
||||
'org.asuslinux.Daemon',
|
||||
'/org/asuslinux/Charge'
|
||||
);
|
||||
|
||||
this.connected = true;
|
||||
this.lastState = this.getChargingLimit();
|
||||
|
||||
this.asusLinuxProxy.connectSignal(
|
||||
"NotifyCharge",
|
||||
(proxy: any = null, name: string, data: string) => {
|
||||
if (proxy) {
|
||||
//@ts-ignore
|
||||
log(`Charging Limit has changed to ${data}% (${name}).`);
|
||||
this.updateChargingLimit(parseInt(data));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
try {
|
||||
this.timeoutChargePoller = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 5, this.pollerChargingLimit.bind(this));
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Charging Limit DBus Poller initialization failed!`, e);
|
||||
}
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Charging Limit DBus initialization failed!`, e);
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
//@ts-ignore
|
||||
log(`Stopping Charging Limit DBus client...`);
|
||||
|
||||
if (this.isRunning()) {
|
||||
this.connected = false;
|
||||
this.asusLinuxProxy = null;
|
||||
this.lastState = 100;
|
||||
GLib.Source.remove(this.timeoutChargePoller);
|
||||
this.timeoutChargePoller = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
194
desktop-extensions/gnome/src/modules/platform_dbus.ts
Normal file
194
desktop-extensions/gnome/src/modules/platform_dbus.ts
Normal file
@@ -0,0 +1,194 @@
|
||||
declare const global: any, imports: any;
|
||||
declare var asusctlGexInstance: any;
|
||||
//@ts-ignore
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
|
||||
import * as Resources from './resources';
|
||||
|
||||
const { Gio } = imports.gi;
|
||||
|
||||
export class Platform {
|
||||
asusLinuxProxy: any = null; // type: Gio.DbusProxy
|
||||
connected: boolean = false;
|
||||
lastStatePostBootSound: boolean = false;
|
||||
lastStateOverdrive: boolean = false;
|
||||
lastStateMUX: boolean = false;
|
||||
|
||||
constructor() {
|
||||
// nothing for now
|
||||
}
|
||||
|
||||
public getPostBootSound() {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
let currentState = this.asusLinuxProxy.PostBootSoundSync();
|
||||
|
||||
return parseInt(currentState) == 1 ? true : false;
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Failed to get POST Boot Sound state!`, e);
|
||||
}
|
||||
}
|
||||
|
||||
return this.lastStatePostBootSound;
|
||||
}
|
||||
|
||||
public setPostBootSound(state: boolean) {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
if (state !== this.lastStatePostBootSound) {
|
||||
this.lastStatePostBootSound = state;
|
||||
}
|
||||
|
||||
return this.asusLinuxProxy.SetPostBootSoundSync(state);
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Platform DBus set Post Boot Sound failed!`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public getMUX() {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
let currentState = this.asusLinuxProxy.GpuMuxModeSync();
|
||||
|
||||
return parseInt(currentState) == 0 ? true : false;
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Failed to get MUX state!`, e);
|
||||
}
|
||||
}
|
||||
|
||||
return this.lastStatePostBootSound;
|
||||
}
|
||||
|
||||
public setMUX(state: boolean) {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
if (!state !== this.lastStateMUX) {
|
||||
this.lastStateMUX = !state;
|
||||
}
|
||||
|
||||
return this.asusLinuxProxy.SetGpuMuxModeSync(!state);
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Switching the MUX failed!`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public getOverdrive() {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
let currentState = this.asusLinuxProxy.PanelOverdriveSync();
|
||||
|
||||
return parseInt(currentState) == 1 ? true : false;
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Failed to get Overdrive state!`, e);
|
||||
}
|
||||
}
|
||||
|
||||
return this.lastStateOverdrive;
|
||||
}
|
||||
|
||||
public setOverdrive(state: boolean) {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
if (state !== this.lastStateOverdrive) {
|
||||
this.lastStateOverdrive = state;
|
||||
}
|
||||
|
||||
return this.asusLinuxProxy.SetPanelOverdriveSync(state);
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Overdrive DBus set overdrive state failed!`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isRunning(): boolean {
|
||||
return this.connected;
|
||||
}
|
||||
|
||||
async start() {
|
||||
//@ts-ignore
|
||||
log(`Starting Platform DBus module...`);
|
||||
|
||||
try {
|
||||
let xml = Resources.File.DBus('org-asuslinus-platform-4')
|
||||
this.asusLinuxProxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
||||
Gio.DBus.system,
|
||||
'org.asuslinux.Daemon',
|
||||
'/org/asuslinux/Platform'
|
||||
);
|
||||
|
||||
this.connected = true;
|
||||
|
||||
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_toggleSound) {
|
||||
this.lastStatePostBootSound = this.getPostBootSound();
|
||||
this.asusLinuxProxy.connectSignal(
|
||||
"NotifyPostBootSound",
|
||||
(proxy: any = null, _name: string, data: boolean) => {
|
||||
if (proxy) {
|
||||
//@ts-ignore
|
||||
log(`PostBootSound changed to ${data}`);
|
||||
asusctlGexInstance.Platform.switchPostBootSound.setToggleState(this.lastStatePostBootSound);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_overdrive) {
|
||||
this.lastStateOverdrive = this.getOverdrive();
|
||||
this.asusLinuxProxy.connectSignal(
|
||||
"NotifyPanelOverdrive",
|
||||
(proxy: any = null, _name: string, data: boolean) => {
|
||||
if (proxy) {
|
||||
//@ts-ignore
|
||||
log(`Overdrive has changed to ${data}.`);
|
||||
asusctlGexInstance.Platform.overdriveSwitch.setToggleState(this.lastStateOverdrive);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (asusctlGexInstance.supported.connector.supportedAttributes.bios_toggleMUX) {
|
||||
this.lastStateMUX = this.getMUX();
|
||||
this.asusLinuxProxy.connectSignal(
|
||||
"NotifyGpuMuxMode",
|
||||
(proxy: any = null, _name: string, data: boolean) => {
|
||||
if (proxy) {
|
||||
//@ts-ignore
|
||||
log(`MUX has changed to ${data}.`);
|
||||
asusctlGexInstance.Platform.switchMUX.setToggleState(this.lastStateMUX);
|
||||
|
||||
// Panel.Actions.notify(
|
||||
// 'ASUS Notebook Control',
|
||||
// `MUX Mode has chnged. Please reboot to apply the changes.`,
|
||||
// 'scalable/reboot.svg',
|
||||
// 'reboot'
|
||||
// );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Overdrive DBus init failed!`, e);
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
//@ts-ignore
|
||||
log(`Stopping Overdrive DBus module...`);
|
||||
|
||||
if (this.isRunning()) {
|
||||
this.connected = false;
|
||||
this.asusLinuxProxy = null;
|
||||
this.lastStatePostBootSound = false;
|
||||
this.lastStateOverdrive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
desktop-extensions/gnome/src/modules/resources.ts
Normal file
21
desktop-extensions/gnome/src/modules/resources.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
declare const global: any, imports: any;
|
||||
//@ts-ignore
|
||||
const ThisModule = imports.misc.extensionUtils.getCurrentExtension();
|
||||
|
||||
const GLib = imports.gi.GLib;
|
||||
|
||||
export class File {
|
||||
public static DBus(name: string) {
|
||||
let file = `${ThisModule.path}/resources/dbus/${name}.xml`;
|
||||
try {
|
||||
let [_ok, bytes] = GLib.file_get_contents(file)
|
||||
if (!_ok)
|
||||
//@ts-ignore
|
||||
log(`Couldn't read contents of "${file}"`);
|
||||
return _ok ? imports.byteArray.toString(bytes) : null;
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Failed to load "${file}"`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
163
desktop-extensions/gnome/src/modules/supported_dbus.ts
Normal file
163
desktop-extensions/gnome/src/modules/supported_dbus.ts
Normal file
@@ -0,0 +1,163 @@
|
||||
declare const global: any, imports: any;
|
||||
//@ts-ignore
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
|
||||
import * as Resources from './resources';
|
||||
|
||||
import * as Platform from '../bindings/platform';
|
||||
import * as Aura from '../bindings/aura';
|
||||
|
||||
const { Gio } = imports.gi;
|
||||
|
||||
export class Supported {
|
||||
supportedProxy: any = null; // type: Gio.DbusProxy (donno how to add)
|
||||
connectedSupported: boolean = false;
|
||||
|
||||
// False,
|
||||
// (True,),
|
||||
// (True, True),
|
||||
// ('X19b6',
|
||||
// True,
|
||||
// ['Static',
|
||||
// 'Breathe',
|
||||
// 'Strobe',
|
||||
// 'Rainbow',
|
||||
// 'Star',
|
||||
// 'Rain',
|
||||
// 'Highlight',
|
||||
// 'Laser',
|
||||
// 'Ripple',
|
||||
// 'Pulse',
|
||||
// 'Comet',
|
||||
// 'Flash'],
|
||||
// [],
|
||||
// 2),
|
||||
// (False, True, True, True, False, True)
|
||||
|
||||
supportedAttributes: Platform.SupportedFunctions = {
|
||||
anime_ctrl: false,
|
||||
charge_ctrl: {
|
||||
charge_level_set: false
|
||||
},
|
||||
platform_profile: {
|
||||
platform_profile: false,
|
||||
fan_curves: false
|
||||
},
|
||||
keyboard_led: {
|
||||
dev_id: Aura.AuraDevice.Unknown,
|
||||
brightness: false,
|
||||
basic_modes: [],
|
||||
basic_zones: [],
|
||||
advanced_type: Platform.AdvancedAura.None
|
||||
},
|
||||
rog_bios_ctrl: {
|
||||
post_sound: false,
|
||||
gpu_mux: false,
|
||||
panel_overdrive: false,
|
||||
dgpu_disable: false,
|
||||
egpu_enable: false,
|
||||
mini_led_mode: false
|
||||
}
|
||||
};
|
||||
|
||||
constructor() {
|
||||
// nothing for now
|
||||
}
|
||||
|
||||
public getSupported() {
|
||||
if (this.isRunning()) {
|
||||
try {
|
||||
let _supportedAttributes = this.supportedProxy.SupportedFunctionsSync();
|
||||
if (_supportedAttributes.length > 0) {
|
||||
let valueString: string = '';
|
||||
|
||||
for (const [_key, value] of Object.entries(_supportedAttributes)) {
|
||||
//@ts-ignore
|
||||
valueString = value.toString();
|
||||
|
||||
switch (parseInt(_key)) {
|
||||
case 0:
|
||||
this.supportedAttributes.anime_ctrl = (valueString == 'true' ? true : false);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
this.supportedAttributes.charge_ctrl.charge_level_set = (valueString == 'true' ? true : false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
let platformArray = valueString.split(',');
|
||||
this.supportedAttributes.platform_profile.fan_curves = (platformArray[0] == 'true' ? true : false);
|
||||
this.supportedAttributes.platform_profile.platform_profile = (platformArray[1] == 'true' ? true : false);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
let ledArray = valueString.split(',');
|
||||
// let t: keyof typeof AuraDevice = ledArray[0]; // can't conevert
|
||||
this.supportedAttributes.keyboard_led.dev_id = Aura.AuraDevice[ledArray[0] as Aura.AuraDevice];
|
||||
this.supportedAttributes.keyboard_led.brightness = (ledArray[1] == 'true' ? true : false);
|
||||
this.supportedAttributes.keyboard_led.basic_modes = ledArray[2].split(',').map(function (value) {
|
||||
return Aura.AuraModeNum[value as Aura.AuraModeNum]
|
||||
});
|
||||
this.supportedAttributes.keyboard_led.basic_zones = ledArray[3].split(',').map(function (value) {
|
||||
return Aura.AuraZone[value as Aura.AuraZone]
|
||||
});
|
||||
this.supportedAttributes.keyboard_led.advanced_type = Platform.AdvancedAura[ledArray[4] as Platform.AdvancedAura];
|
||||
break;
|
||||
|
||||
case 4:
|
||||
let biosArray = valueString.split(',');
|
||||
this.supportedAttributes.rog_bios_ctrl.post_sound = (biosArray[0] == 'true' ? true : false);
|
||||
this.supportedAttributes.rog_bios_ctrl.gpu_mux = (biosArray[1] == 'true' ? true : false);
|
||||
this.supportedAttributes.rog_bios_ctrl.panel_overdrive = (biosArray[2] == 'true' ? true : false);
|
||||
this.supportedAttributes.rog_bios_ctrl.dgpu_disable = (biosArray[3] == 'true' ? true : false);
|
||||
this.supportedAttributes.rog_bios_ctrl.egpu_enable = (biosArray[4] == 'true' ? true : false);
|
||||
this.supportedAttributes.rog_bios_ctrl.mini_led_mode = (biosArray[5] == 'true' ? true : false);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Failed to fetch supported functionalities`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isRunning(): boolean {
|
||||
return this.connectedSupported;
|
||||
}
|
||||
|
||||
async start() {
|
||||
try {
|
||||
// creating the proxy
|
||||
let xml = Resources.File.DBus('org-asuslinux-supported-4');
|
||||
this.supportedProxy = new Gio.DBusProxy.makeProxyWrapper(xml)(
|
||||
Gio.DBus.system,
|
||||
'org.asuslinux.Daemon',
|
||||
'/org/asuslinux/Supported'
|
||||
);
|
||||
|
||||
this.connectedSupported = true;
|
||||
|
||||
this.getSupported();
|
||||
//@ts-ignore
|
||||
log(`Supported Daemon client started successfully.`);
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log(`Supported DBus initialization failed!`, e);
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
//@ts-ignore
|
||||
log(`Stopping Supported DBus client...`);
|
||||
|
||||
if (this.isRunning()) {
|
||||
this.connectedSupported = false;
|
||||
this.supportedProxy = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
desktop-extensions/gnome/tsconfig.json
Normal file
26
desktop-extensions/gnome/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es2019",
|
||||
// "module": "ES2015",
|
||||
// "moduleResolution": "node",
|
||||
// "rootDir": "./",
|
||||
"strict": true,
|
||||
"outDir": "./target",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"downlevelIteration": true,
|
||||
"lib": [ "es2019" ],
|
||||
"pretty": true,
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"removeComments": true,
|
||||
"incremental": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"allowJs": true
|
||||
},
|
||||
"include": [
|
||||
"src/*.ts",
|
||||
"src/**/*.ts"
|
||||
]
|
||||
}
|
||||
@@ -35,6 +35,7 @@ pub struct PlatformProfileFunctions {
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Default, Type, Debug, Clone)]
|
||||
#[zvariant(signature = "s")]
|
||||
pub enum AdvancedAura {
|
||||
#[default]
|
||||
None,
|
||||
|
||||
Reference in New Issue
Block a user