Refactor workspace and add about page

This commit is contained in:
Stephen Horvath
2025-03-18 17:08:48 +10:00
parent 48552744b1
commit 6483e82eae
8 changed files with 62 additions and 10 deletions

19
yafi/ui/about.ui Normal file
View File

@@ -0,0 +1,19 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.94.1 -->
<interface>
<!-- interface-description The About page for YAFI -->
<!-- interface-copyright Steve-Tech -->
<requires lib="libadwaita" version="1.2"/>
<object class="AdwAboutWindow" id="about-root">
<property name="application-icon">application-default-icon</property>
<property name="application-name">Yet Another Framework Interface</property>
<property name="comments">YAFI is another GUI for the Framework Laptop Embedded Controller.
It is written in Python with a GTK3 theme, and uses the `CrOS_EC_Python` library to communicate with the EC.</property>
<property name="copyright">Copyright © 2025 Stephen Horvath</property>
<property name="developers">Stephen Horvath (Steve-Tech)</property>
<property name="issue-url">https://github.com/Steve-Tech/YAFI/issues</property>
<property name="license-type">gpl-2-0</property>
<property name="version">0.1</property>
<property name="website">https://github.com/Steve-Tech/YAFI</property>
</object>
</interface>

168
yafi/ui/battery.ui Normal file
View File

@@ -0,0 +1,168 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.94.1 -->
<interface>
<!-- interface-description The Battery page for YAFI -->
<!-- interface-authors Steve-Tech -->
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.6"/>
<object class="GtkBox" id="battery-root">
<property name="orientation">vertical</property>
<child>
<object class="GtkListBox">
<property name="margin-end">10</property>
<property name="margin-start">10</property>
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="title">Battery Limiters</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="bat-limit">
<property name="subtitle">Limit the maximum charge</property>
<property name="title">Charge Limit</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkScale" id="bat-limit-scale">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">10.0</property>
<property name="step-increment">1.0</property>
<property name="upper">100.0</property>
<property name="value">100.0</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="round-digits">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="description">Preserve the battery lifespan by gradually lowering battery charge voltage automatically if the system is connected to AC for more than the set day limit.</property>
<property name="margin-bottom">5</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="title">Battery Extender</property>
<child>
<object class="AdwSwitchRow">
<property name="title">Enable</property>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="sensitive">False</property>
<property name="subtitle">0</property>
<property name="title">Current Stage (0 to 2)</property>
<style>
<class name="property"/>
</style>
</object>
</child>
<child>
<object class="AdwSpinRow" id="bat-ext-trigger">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">5.0</property>
<property name="step-increment">1.0</property>
<property name="upper">65535.0</property>
<property name="value">5.0</property>
</object>
</property>
<property name="sensitive">False</property>
<property name="subtitle">Number of days on charge before reducing charge limit</property>
<property name="title">Trigger Days</property>
</object>
</child>
<child>
<object class="AdwSpinRow" id="bat-ext-reset">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">5.0</property>
<property name="step-increment">1.0</property>
<property name="upper">65535.0</property>
<property name="value">30.0</property>
</object>
</property>
<property name="sensitive">False</property>
<property name="subtitle">Number of minutes off charge before resetting charge limit</property>
<property name="title">Reset Minutes</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwExpanderRow">
<property name="selectable">False</property>
<property name="subtitle">These options break normal functionality</property>
<property name="title">Advanced Options</property>
<child>
<object class="AdwPreferencesGroup">
<property name="description">These options will conflict with the framework options.</property>
<property name="margin-bottom">5</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="title">ChromeOS Battery Limiter</property>
<child>
<object class="AdwActionRow" id="bat-cros-max">
<property name="title">Maximum Limit</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkScale" id="led-chg-255-scale">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">16.0</property>
<property name="step-increment">1.0</property>
<property name="upper">255.0</property>
<property name="value">255.0</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="round-digits">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="bat-cros-min">
<property name="title">Minimum Limit</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkScale" id="led-chg-255-scale_2">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">16.0</property>
<property name="step-increment">1.0</property>
<property name="upper">255.0</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="round-digits">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</interface>

84
yafi/ui/hardware.ui Normal file
View File

@@ -0,0 +1,84 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.94.1 -->
<interface>
<!-- interface-description The Hardware page for YAFI -->
<!-- interface-copyright Steve-Tech -->
<requires lib="gtk" version="4.12"/>
<requires lib="libadwaita" version="1.4"/>
<object class="GtkBox" id="hardware-root">
<property name="orientation">vertical</property>
<child>
<object class="GtkListBox">
<property name="margin-end">10</property>
<property name="margin-start">10</property>
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="title">Hardware Status</property>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="subtitle">Currently Closed</property>
<property name="title">Chassis Open Count</property>
<child>
<object class="GtkLabel">
<property name="label">0</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="subtitle">Use Privacy Switch</property>
<property name="title">Camera Enabled</property>
<child>
<object class="GtkBox">
<property name="halign">end</property>
<property name="homogeneous">True</property>
<property name="valign">center</property>
<child>
<object class="GtkSwitch">
<property name="active">True</property>
<property name="sensitive">False</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="subtitle">Use Privacy Switch</property>
<property name="title">Microphone Enabled</property>
<child>
<object class="GtkBox">
<property name="halign">end</property>
<property name="homogeneous">True</property>
<property name="valign">center</property>
<child>
<object class="GtkSwitch">
<property name="active">True</property>
<property name="sensitive">False</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwSwitchRow">
<property name="active">True</property>
<property name="title">Fingerprint Enabled</property>
</object>
</child>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</interface>

182
yafi/ui/leds.ui Normal file
View File

@@ -0,0 +1,182 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.94.1 -->
<interface>
<!-- interface-description The LEDs page for YAFI -->
<!-- interface-authors Steve-Tech -->
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.6"/>
<object class="GtkBox" id="leds-root">
<property name="orientation">vertical</property>
<child>
<object class="GtkListBox">
<property name="margin-end">10</property>
<property name="margin-start">10</property>
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="title">LED Control</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="led-pwr">
<property name="title">Power Button</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkScale" id="led-pwr-scale">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="lower">1.0</property>
<property name="page-increment">1.0</property>
<property name="step-increment">1.0</property>
<property name="upper">3.0</property>
<property name="value">3.0</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="round-digits">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="led-kbd">
<property name="title">Keyboard Backlight</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkScale" id="led-kbd-scale">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">16.0</property>
<property name="step-increment">1.0</property>
<property name="upper">255.0</property>
<property name="value">255.0</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="round-digits">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwExpanderRow">
<property name="selectable">False</property>
<property name="subtitle">These options break normal functionality</property>
<property name="title">Advanced Options</property>
<child>
<object class="AdwPreferencesGroup">
<property name="description">When using these options, the power LED may not turn off with the computer.</property>
<property name="margin-bottom">5</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="title">Power Button LED</property>
<child>
<object class="AdwComboRow" id="led-pwr-colour">
<property name="model">
<object class="GtkStringList">
<items>
<item>Red</item>
<item>Green</item>
<item>Blue</item>
<item>Yellow</item>
<item>White</item>
<item>Amber</item>
</items>
</object>
</property>
<property name="selected">4</property>
<property name="subtitle">Not all devices support colours.</property>
<property name="title">Colour</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="led-pwr-255">
<property name="title">Brightness</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkScale" id="led-pwr-255-scale">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">16.0</property>
<property name="step-increment">1.0</property>
<property name="upper">255.0</property>
<property name="value">255.0</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="round-digits">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="description">When using these options, the charging indicator will no longer indicate charging.</property>
<property name="margin-bottom">5</property>
<property name="margin-end">5</property>
<property name="margin-start">5</property>
<property name="margin-top">5</property>
<property name="title">Charging Indicators</property>
<child>
<object class="AdwComboRow" id="led-chg-colour">
<property name="model">
<object class="GtkStringList">
<items>
<item>Red</item>
<item>Green</item>
<item>Blue</item>
<item>Yellow</item>
<item>White</item>
<item>Amber</item>
</items>
</object>
</property>
<property name="title">Colour</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="led-chg-255">
<property name="title">Brightness</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkScale" id="led-chg-255-scale">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">16.0</property>
<property name="step-increment">1.0</property>
<property name="upper">255.0</property>
<property name="value">255.0</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="round-digits">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</interface>

99
yafi/ui/thermals.ui Normal file
View File

@@ -0,0 +1,99 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.94.1 -->
<interface>
<!-- interface-description The Thermals page for YAFI -->
<!-- interface-authors Steve-Tech -->
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.6"/>
<object class="GtkPaned" id="thermals-root">
<property name="end-child">
<object class="GtkListBox" id="temperatures">
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="title">Temperatures</property>
</object>
</child>
</object>
</property>
<property name="start-child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkListBox">
<property name="margin-end">10</property>
<property name="margin-start">10</property>
<child>
<object class="AdwActionRow">
<property name="selectable">False</property>
<property name="title">Fan Control</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="fan-rpm">
<property name="title">Current Speed</property>
<style>
<class name="property"/>
</style>
</object>
</child>
<child>
<object class="AdwComboRow" id="fan-mode">
<property name="model">
<object class="GtkStringList">
<items>
<item>Auto</item>
<item>Percent</item>
<item>RPM</item>
</items>
</object>
</property>
<property name="title">Speed Set Mode</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="fan-set-percent">
<property name="title">Fan Speed</property>
<property name="visible">False</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkScale" id="fan-percent-scale">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">10.0</property>
<property name="step-increment">1.0</property>
<property name="upper">100.0</property>
<property name="value">100.0</property>
</object>
</property>
<property name="hexpand">True</property>
<property name="round-digits">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwSpinRow" id="fan-set-rpm">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="page-increment">1000.0</property>
<property name="step-increment">100.0</property>
<property name="upper">65535.0</property>
</object>
</property>
<property name="title">Fan RPM Target</property>
<property name="visible">False</property>
</object>
</child>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</property>
</object>
</interface>

346
yafi/ui/yafi.cmb Normal file
View File

@@ -0,0 +1,346 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd">
<cambalache-project version="0.94.0" target_tk="gtk-4.0">
<ui>
(1,None,"yafi.ui","yafi.ui","YAFI is another GUI for the Framework Laptop Embedded Controller.",None,"Steve-Tech",None,None,None,None),
(2,None,None,"thermals.ui","The Thermals page for YAFI",None,"Steve-Tech",None,None,None,None),
(3,None,None,"leds.ui","The LEDs page for YAFI",None,"Steve-Tech",None,None,None,None),
(4,None,None,"battery.ui","The Battery page for YAFI",None,"Steve-Tech",None,None,None,None),
(5,None,None,"hardware.ui","The Hardware page for YAFI","Steve-Tech",None,None,None,None,None),
(6,None,None,"about.ui","The About page for YAFI","Steve-Tech",None,None,None,None,None)
</ui>
<object>
(1,1,"AdwApplicationWindow","root",None,None,None,None,0,None,None),
(1,2,"AdwNavigationSplitView",None,1,None,None,None,0,None,None),
(1,6,"AdwNavigationPage",None,2,None,None,None,0,None,None),
(1,7,"AdwNavigationPage",None,2,None,None,None,1,None,None),
(1,10,"AdwHeaderBar",None,11,None,"top",None,0,None,None),
(1,11,"AdwToolbarView",None,7,None,None,None,0,None,None),
(1,13,"AdwToolbarView",None,6,None,None,None,0,None,None),
(1,14,"AdwHeaderBar",None,13,None,"top",None,0,None,None),
(1,16,"GtkScrolledWindow",None,13,None,None,None,1,None,None),
(1,17,"GtkListBox","navbar",16,None,None,None,0,None,None),
(1,52,"GtkBox","content",53,None,None,None,0,None,None),
(1,53,"GtkScrolledWindow",None,11,None,None,None,1,None,None),
(2,2,"GtkPaned","thermals-root",None,None,None,None,1,None,None),
(2,3,"GtkListBox","temperatures",2,None,None,None,1,None,None),
(2,4,"AdwActionRow",None,3,None,None,None,0,None,None),
(2,5,"GtkBox",None,2,None,None,None,0,None,None),
(2,6,"GtkListBox",None,5,None,None,None,0,None,None),
(2,7,"AdwActionRow",None,6,None,None,None,0,None,None),
(2,8,"AdwActionRow","fan-rpm",6,None,None,None,1,None,None),
(2,9,"AdwComboRow","fan-mode",6,None,None,None,2,None,None),
(2,10,"GtkStringList",None,9,None,None,None,0,None,None),
(2,11,"AdwActionRow","fan-set-percent",6,None,None,None,3,None,None),
(2,12,"GtkBox",None,11,None,None,None,0,None,None),
(2,13,"GtkScale","fan-percent-scale",12,None,None,None,0,None,None),
(2,14,"GtkAdjustment",None,13,None,None,None,0,None,None),
(2,15,"AdwSpinRow","fan-set-rpm",6,None,None,None,4,None,None),
(2,16,"GtkAdjustment",None,15,None,None,None,0,None,None),
(3,4,"GtkBox","leds-root",None,None,None,None,1,None,None),
(3,5,"GtkListBox",None,4,None,None,None,0,None,None),
(3,6,"AdwActionRow",None,5,None,None,None,0,None,None),
(3,10,"AdwActionRow","led-pwr",5,None,None,None,1,None,None),
(3,11,"GtkBox",None,10,None,None,None,0,None,None),
(3,12,"GtkScale","led-pwr-scale",11,None,None,None,0,None,None),
(3,13,"GtkAdjustment",None,12,None,None,None,0,None,None),
(3,14,"AdwActionRow","led-kbd",5,None,None,None,2,None,None),
(3,15,"GtkBox",None,14,None,None,None,0,None,None),
(3,16,"GtkScale","led-kbd-scale",15,None,None,None,0,None,None),
(3,17,"GtkAdjustment",None,16,None,None,None,0,None,None),
(3,18,"AdwExpanderRow",None,5,None,None,None,3,None,None),
(3,19,"AdwActionRow","led-pwr-255",31,None,None,None,1,None,None),
(3,20,"GtkBox",None,19,None,None,None,0,None,None),
(3,21,"GtkScale","led-pwr-255-scale",20,None,None,None,0,None,None),
(3,22,"GtkAdjustment",None,21,None,None,None,0,None,None),
(3,23,"AdwComboRow","led-pwr-colour",31,None,None,None,0,None,None),
(3,24,"GtkStringList",None,23,None,None,None,0,None,None),
(3,25,"AdwComboRow","led-chg-colour",32,None,None,None,0,None,None),
(3,26,"GtkStringList",None,25,None,None,None,0,None,None),
(3,27,"AdwActionRow","led-chg-255",32,None,None,None,1,None,None),
(3,28,"GtkBox",None,27,None,None,None,0,None,None),
(3,29,"GtkScale","led-chg-255-scale",28,None,None,None,0,None,None),
(3,30,"GtkAdjustment",None,29,None,None,None,0,None,None),
(3,31,"AdwPreferencesGroup",None,18,None,None,None,0,None,None),
(3,32,"AdwPreferencesGroup",None,18,None,None,None,1,None,None),
(4,1,"GtkBox","battery-root",None,None,None,None,0,None,None),
(4,2,"GtkListBox",None,1,None,None,None,0,None,None),
(4,3,"AdwActionRow",None,2,None,None,None,0,None,None),
(4,4,"AdwActionRow","bat-limit",2,None,None,None,1,None,None),
(4,5,"GtkBox",None,4,None,None,None,0,None,None),
(4,6,"GtkScale","bat-limit-scale",5,None,None,None,0,None,None),
(4,7,"GtkAdjustment",None,6,None,None,None,0,None,None),
(4,12,"AdwExpanderRow",None,2,None,None,None,3,None,None),
(4,13,"AdwPreferencesGroup",None,2,None,None,None,2,None,None),
(4,20,"AdwPreferencesGroup",None,12,None,None,None,0,None,None),
(4,23,"AdwActionRow","bat-cros-max",20,None,None,None,0,None,None),
(4,24,"GtkBox",None,23,None,None,None,0,None,None),
(4,25,"GtkScale","led-chg-255-scale",24,None,None,None,0,None,None),
(4,26,"GtkAdjustment",None,25,None,None,None,0,None,None),
(4,27,"AdwSpinRow","bat-ext-trigger",13,None,None,None,3,None,None),
(4,28,"GtkAdjustment",None,27,None,None,None,0,None,None),
(4,29,"AdwSpinRow","bat-ext-reset",13,None,None,None,4,None,None),
(4,30,"GtkAdjustment",None,29,None,None,None,0,None,None),
(4,31,"AdwActionRow",None,13,None,None,None,2,None,None),
(4,32,"AdwSwitchRow",None,13,None,None,None,1,None,None),
(4,33,"AdwActionRow","bat-cros-min",20,None,None,None,1,None,None),
(4,34,"GtkBox",None,33,None,None,None,0,None,None),
(4,35,"GtkScale","led-chg-255-scale_2",34,None,None,None,0,None,None),
(4,36,"GtkAdjustment",None,35,None,None,None,0,None,None),
(5,1,"GtkBox","hardware-root",None,None,None,None,0,None,None),
(5,2,"GtkListBox",None,1,None,None,None,0,None,None),
(5,3,"AdwActionRow",None,2,None,None,None,0,None,None),
(5,4,"AdwActionRow",None,2,None,None,None,1,None,None),
(5,5,"GtkLabel",None,4,None,None,None,0,None,None),
(5,6,"AdwActionRow",None,2,None,None,None,2,None,None),
(5,9,"AdwActionRow",None,2,None,None,None,3,None,None),
(5,11,"GtkSwitch",None,13,None,None,None,0,None,None),
(5,12,"AdwSwitchRow",None,2,None,None,None,4,None,None),
(5,13,"GtkBox",None,9,None,None,None,0,None,None),
(5,14,"GtkBox",None,6,None,None,None,0,None,None),
(5,15,"GtkSwitch",None,14,None,None,None,0,None,None),
(6,1,"AdwAboutWindow","about-root",None,None,None,None,0,None,None)
</object>
<object_property>
(1,1,"GtkWindow","default-height","500",None,None,None,None,None,None,None,None,None),
(1,1,"GtkWindow","default-width","800",None,None,None,None,None,None,None,None,None),
(1,2,"AdwNavigationSplitView","content",None,None,None,None,None,7,None,None,None,None),
(1,2,"AdwNavigationSplitView","sidebar",None,None,None,None,None,6,None,None,None,None),
(1,6,"AdwNavigationPage","title","Settings",None,None,None,None,None,None,None,None,None),
(1,7,"AdwNavigationPage","title","Yet Another Framework Interface",None,None,None,None,None,None,None,None,None),
(1,52,"GtkBox","homogeneous","True",None,None,None,None,None,None,None,None,None),
(1,52,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None),
(2,2,"GtkPaned","end-child",None,0,None,None,None,3,None,None,None,None),
(2,2,"GtkPaned","start-child",None,0,None,None,None,5,None,None,None,None),
(2,4,"AdwPreferencesRow","title","Temperatures",0,None,None,None,None,None,None,None,None),
(2,4,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(2,5,"GtkOrientable","orientation","vertical",0,None,None,None,None,None,None,None,None),
(2,6,"GtkWidget","margin-end","10",0,None,None,None,None,None,None,None,None),
(2,6,"GtkWidget","margin-start","10",0,None,None,None,None,None,None,None,None),
(2,7,"AdwPreferencesRow","title","Fan Control",0,None,None,None,None,None,None,None,None),
(2,7,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(2,8,"AdwPreferencesRow","title","Current Speed",0,None,None,None,None,None,None,None,None),
(2,9,"AdwComboRow","model",None,0,None,None,None,10,None,None,None,None),
(2,9,"AdwPreferencesRow","title","Speed Set Mode",0,None,None,None,None,None,None,None,None),
(2,11,"AdwPreferencesRow","title","Fan Speed",0,None,None,None,None,None,None,None,None),
(2,11,"GtkWidget","visible","False",0,None,None,None,None,None,None,None,None),
(2,13,"GtkRange","adjustment",None,0,None,None,None,14,None,None,None,None),
(2,13,"GtkRange","round-digits","0",0,None,None,None,None,None,None,None,None),
(2,13,"GtkWidget","hexpand","True",0,None,None,None,None,None,None,None,None),
(2,14,"GtkAdjustment","page-increment","10.0",0,None,None,None,None,None,None,None,None),
(2,14,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(2,14,"GtkAdjustment","upper","100.0",0,None,None,None,None,None,None,None,None),
(2,14,"GtkAdjustment","value","100.0",0,None,None,None,None,None,None,None,None),
(2,15,"AdwPreferencesRow","title","Fan RPM Target",0,None,None,None,None,None,None,None,None),
(2,15,"AdwSpinRow","adjustment",None,0,None,None,None,16,None,None,None,None),
(2,15,"GtkWidget","visible","False",0,None,None,None,None,None,None,None,None),
(2,16,"GtkAdjustment","page-increment","1000.0",0,None,None,None,None,None,None,None,None),
(2,16,"GtkAdjustment","step-increment","100.0",0,None,None,None,None,None,None,None,None),
(2,16,"GtkAdjustment","upper","65535.0",0,None,None,None,None,None,None,None,None),
(3,4,"GtkOrientable","orientation","vertical",0,None,None,None,None,None,None,None,None),
(3,5,"GtkWidget","margin-end","10",0,None,None,None,None,None,None,None,None),
(3,5,"GtkWidget","margin-start","10",0,None,None,None,None,None,None,None,None),
(3,6,"AdwPreferencesRow","title","LED Control",0,None,None,None,None,None,None,None,None),
(3,6,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(3,10,"AdwPreferencesRow","title","Power Button",0,None,None,None,None,None,None,None,None),
(3,12,"GtkRange","adjustment",None,0,None,None,None,13,None,None,None,None),
(3,12,"GtkRange","round-digits","0",0,None,None,None,None,None,None,None,None),
(3,12,"GtkWidget","hexpand","True",0,None,None,None,None,None,None,None,None),
(3,13,"GtkAdjustment","lower","1.0",None,None,None,None,None,None,None,None,None),
(3,13,"GtkAdjustment","page-increment","1.0",0,None,None,None,None,None,None,None,None),
(3,13,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(3,13,"GtkAdjustment","upper","3.0",0,None,None,None,None,None,None,None,None),
(3,13,"GtkAdjustment","value","3.0",0,None,None,None,None,None,None,None,None),
(3,14,"AdwPreferencesRow","title","Keyboard Backlight",0,None,None,None,None,None,None,None,None),
(3,16,"GtkRange","adjustment",None,0,None,None,None,17,None,None,None,None),
(3,16,"GtkRange","round-digits","0",0,None,None,None,None,None,None,None,None),
(3,16,"GtkWidget","hexpand","True",0,None,None,None,None,None,None,None,None),
(3,17,"GtkAdjustment","page-increment","16.0",0,None,None,None,None,None,None,None,None),
(3,17,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(3,17,"GtkAdjustment","upper","255.0",0,None,None,None,None,None,None,None,None),
(3,17,"GtkAdjustment","value","255.0",0,None,None,None,None,None,None,None,None),
(3,18,"AdwExpanderRow","subtitle","These options break normal functionality",None,None,None,None,None,None,None,None,None),
(3,18,"AdwPreferencesRow","title","Advanced Options",None,None,None,None,None,None,None,None,None),
(3,18,"GtkListBoxRow","selectable","False",None,None,None,None,None,None,None,None,None),
(3,19,"AdwPreferencesRow","title","Brightness",0,None,None,None,None,None,None,None,None),
(3,21,"GtkRange","adjustment",None,0,None,None,None,22,None,None,None,None),
(3,21,"GtkRange","round-digits","0",0,None,None,None,None,None,None,None,None),
(3,21,"GtkWidget","hexpand","True",0,None,None,None,None,None,None,None,None),
(3,22,"GtkAdjustment","page-increment","16.0",0,None,None,None,None,None,None,None,None),
(3,22,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(3,22,"GtkAdjustment","upper","255.0",0,None,None,None,None,None,None,None,None),
(3,22,"GtkAdjustment","value","255.0",0,None,None,None,None,None,None,None,None),
(3,23,"AdwActionRow","subtitle","Not all devices support colours.",None,None,None,None,None,None,None,None,None),
(3,23,"AdwComboRow","model",None,0,None,None,None,24,None,None,None,None),
(3,23,"AdwComboRow","selected","4",None,None,None,None,None,None,None,None,None),
(3,23,"AdwPreferencesRow","title","Colour",0,None,None,None,None,None,None,None,None),
(3,25,"AdwComboRow","model",None,0,None,None,None,26,None,None,None,None),
(3,25,"AdwPreferencesRow","title","Colour",0,None,None,None,None,None,None,None,None),
(3,27,"AdwPreferencesRow","title","Brightness",0,None,None,None,None,None,None,None,None),
(3,29,"GtkRange","adjustment",None,0,None,None,None,30,None,None,None,None),
(3,29,"GtkRange","round-digits","0",0,None,None,None,None,None,None,None,None),
(3,29,"GtkWidget","hexpand","True",0,None,None,None,None,None,None,None,None),
(3,30,"GtkAdjustment","page-increment","16.0",0,None,None,None,None,None,None,None,None),
(3,30,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(3,30,"GtkAdjustment","upper","255.0",0,None,None,None,None,None,None,None,None),
(3,30,"GtkAdjustment","value","255.0",0,None,None,None,None,None,None,None,None),
(3,31,"AdwPreferencesGroup","description","When using these options, the power LED may not turn off with the computer.",None,None,None,None,None,None,None,None,None),
(3,31,"AdwPreferencesGroup","title","Power Button LED",None,None,None,None,None,None,None,None,None),
(3,31,"GtkWidget","margin-bottom","5",None,None,None,None,None,None,None,None,None),
(3,31,"GtkWidget","margin-end","5",None,None,None,None,None,None,None,None,None),
(3,31,"GtkWidget","margin-start","5",None,None,None,None,None,None,None,None,None),
(3,31,"GtkWidget","margin-top","5",None,None,None,None,None,None,None,None,None),
(3,32,"AdwPreferencesGroup","description","When using these options, the charging indicator will no longer indicate charging.",None,None,None,None,None,None,None,None,None),
(3,32,"AdwPreferencesGroup","title","Charging Indicators",None,None,None,None,None,None,None,None,None),
(3,32,"GtkWidget","margin-bottom","5",None,None,None,None,None,None,None,None,None),
(3,32,"GtkWidget","margin-end","5",None,None,None,None,None,None,None,None,None),
(3,32,"GtkWidget","margin-start","5",None,None,None,None,None,None,None,None,None),
(3,32,"GtkWidget","margin-top","5",None,None,None,None,None,None,None,None,None),
(4,1,"GtkOrientable","orientation","vertical",0,None,None,None,None,None,None,None,None),
(4,2,"GtkWidget","margin-end","10",0,None,None,None,None,None,None,None,None),
(4,2,"GtkWidget","margin-start","10",0,None,None,None,None,None,None,None,None),
(4,3,"AdwPreferencesRow","title","Battery Limiters",0,None,None,None,None,None,None,None,None),
(4,3,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(4,4,"AdwActionRow","subtitle","Limit the maximum charge",None,None,None,None,None,None,None,None,None),
(4,4,"AdwPreferencesRow","title","Charge Limit",0,None,None,None,None,None,None,None,None),
(4,6,"GtkRange","adjustment",None,0,None,None,None,7,None,None,None,None),
(4,6,"GtkRange","round-digits","0",0,None,None,None,None,None,None,None,None),
(4,6,"GtkWidget","hexpand","True",0,None,None,None,None,None,None,None,None),
(4,7,"GtkAdjustment","page-increment","10.0",0,None,None,None,None,None,None,None,None),
(4,7,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(4,7,"GtkAdjustment","upper","100.0",0,None,None,None,None,None,None,None,None),
(4,7,"GtkAdjustment","value","100.0",0,None,None,None,None,None,None,None,None),
(4,12,"AdwExpanderRow","subtitle","These options break normal functionality",0,None,None,None,None,None,None,None,None),
(4,12,"AdwPreferencesRow","title","Advanced Options",0,None,None,None,None,None,None,None,None),
(4,12,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(4,13,"AdwPreferencesGroup","description","Preserve the battery lifespan by gradually lowering battery charge voltage automatically if the system is connected to AC for more than the set day limit.",0,None,None,None,None,None,None,None,None),
(4,13,"AdwPreferencesGroup","title","Battery Extender",0,None,None,None,None,None,None,None,None),
(4,13,"GtkWidget","margin-bottom","5",0,None,None,None,None,None,None,None,None),
(4,13,"GtkWidget","margin-end","5",0,None,None,None,None,None,None,None,None),
(4,13,"GtkWidget","margin-start","5",0,None,None,None,None,None,None,None,None),
(4,13,"GtkWidget","margin-top","5",0,None,None,None,None,None,None,None,None),
(4,20,"AdwPreferencesGroup","description","These options will conflict with the framework options.",0,None,None,None,None,None,None,None,None),
(4,20,"AdwPreferencesGroup","title","ChromeOS Battery Limiter",0,None,None,None,None,None,None,None,None),
(4,20,"GtkWidget","margin-bottom","5",0,None,None,None,None,None,None,None,None),
(4,20,"GtkWidget","margin-end","5",0,None,None,None,None,None,None,None,None),
(4,20,"GtkWidget","margin-start","5",0,None,None,None,None,None,None,None,None),
(4,20,"GtkWidget","margin-top","5",0,None,None,None,None,None,None,None,None),
(4,23,"AdwPreferencesRow","title","Maximum Limit",0,None,None,None,None,None,None,None,None),
(4,25,"GtkRange","adjustment",None,0,None,None,None,26,None,None,None,None),
(4,25,"GtkRange","round-digits","0",0,None,None,None,None,None,None,None,None),
(4,25,"GtkWidget","hexpand","True",0,None,None,None,None,None,None,None,None),
(4,26,"GtkAdjustment","page-increment","16.0",0,None,None,None,None,None,None,None,None),
(4,26,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(4,26,"GtkAdjustment","upper","255.0",0,None,None,None,None,None,None,None,None),
(4,26,"GtkAdjustment","value","255.0",0,None,None,None,None,None,None,None,None),
(4,27,"AdwActionRow","subtitle","Number of days on charge before reducing charge limit",None,None,None,None,None,None,None,None,None),
(4,27,"AdwPreferencesRow","title","Trigger Days",0,None,None,None,None,None,None,None,None),
(4,27,"AdwSpinRow","adjustment",None,0,None,None,None,28,None,None,None,None),
(4,27,"GtkWidget","sensitive","False",None,None,None,None,None,None,None,None,None),
(4,28,"GtkAdjustment","page-increment","5.0",0,None,None,None,None,None,None,None,None),
(4,28,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(4,28,"GtkAdjustment","upper","65535.0",0,None,None,None,None,None,None,None,None),
(4,28,"GtkAdjustment","value","5.0",None,None,None,None,None,None,None,None,None),
(4,29,"AdwActionRow","subtitle","Number of minutes off charge before resetting charge limit",0,None,None,None,None,None,None,None,None),
(4,29,"AdwPreferencesRow","title","Reset Minutes",0,None,None,None,None,None,None,None,None),
(4,29,"AdwSpinRow","adjustment",None,0,None,None,None,30,None,None,None,None),
(4,29,"GtkWidget","sensitive","False",None,None,None,None,None,None,None,None,None),
(4,30,"GtkAdjustment","page-increment","5.0",0,None,None,None,None,None,None,None,None),
(4,30,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(4,30,"GtkAdjustment","upper","65535.0",0,None,None,None,None,None,None,None,None),
(4,30,"GtkAdjustment","value","30.0",None,None,None,None,None,None,None,None,None),
(4,31,"AdwActionRow","subtitle","0",None,None,None,None,None,None,None,None,None),
(4,31,"AdwPreferencesRow","title","Current Stage (0 to 2)",0,None,None,None,None,None,None,None,None),
(4,31,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(4,31,"GtkWidget","sensitive","False",None,None,None,None,None,None,None,None,None),
(4,32,"AdwPreferencesRow","title","Enable",None,None,None,None,None,None,None,None,None),
(4,33,"AdwPreferencesRow","title","Minimum Limit",0,None,None,None,None,None,None,None,None),
(4,35,"GtkRange","adjustment",None,0,None,None,None,36,None,None,None,None),
(4,35,"GtkRange","round-digits","0",0,None,None,None,None,None,None,None,None),
(4,35,"GtkWidget","hexpand","True",0,None,None,None,None,None,None,None,None),
(4,36,"GtkAdjustment","page-increment","16.0",0,None,None,None,None,None,None,None,None),
(4,36,"GtkAdjustment","step-increment","1.0",0,None,None,None,None,None,None,None,None),
(4,36,"GtkAdjustment","upper","255.0",0,None,None,None,None,None,None,None,None),
(5,1,"GtkOrientable","orientation","vertical",0,None,None,None,None,None,None,None,None),
(5,2,"GtkWidget","margin-end","10",0,None,None,None,None,None,None,None,None),
(5,2,"GtkWidget","margin-start","10",0,None,None,None,None,None,None,None,None),
(5,3,"AdwPreferencesRow","title","Hardware Status",0,None,None,None,None,None,None,None,None),
(5,3,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(5,4,"AdwActionRow","subtitle","Currently Closed",None,None,None,None,None,None,None,None,None),
(5,4,"AdwPreferencesRow","title","Chassis Open Count",0,None,None,None,None,None,None,None,None),
(5,4,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(5,5,"GtkLabel","label","0",None,None,None,None,None,None,None,None,None),
(5,6,"AdwActionRow","subtitle","Use Privacy Switch",None,None,None,None,None,None,None,None,None),
(5,6,"AdwPreferencesRow","title","Camera Enabled",0,None,None,None,None,None,None,None,None),
(5,6,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(5,9,"AdwActionRow","subtitle","Use Privacy Switch",None,None,None,None,None,None,None,None,None),
(5,9,"AdwPreferencesRow","title","Microphone Enabled",0,None,None,None,None,None,None,None,None),
(5,9,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(5,11,"GtkSwitch","active","True",0,None,None,None,None,None,None,None,None),
(5,11,"GtkWidget","sensitive","False",0,None,None,None,None,None,None,None,None),
(5,12,"AdwPreferencesRow","title","Fingerprint Enabled",None,None,None,None,None,None,None,None,None),
(5,12,"AdwSwitchRow","active","True",None,None,None,None,None,None,None,None,None),
(5,13,"GtkBox","homogeneous","True",None,None,None,None,None,None,None,None,None),
(5,13,"GtkWidget","halign","end",None,None,None,None,None,None,None,None,None),
(5,13,"GtkWidget","valign","center",None,None,None,None,None,None,None,None,None),
(5,14,"GtkBox","homogeneous","True",0,None,None,None,None,None,None,None,None),
(5,14,"GtkWidget","halign","end",0,None,None,None,None,None,None,None,None),
(5,14,"GtkWidget","valign","center",0,None,None,None,None,None,None,None,None),
(5,15,"GtkSwitch","active","True",0,None,None,None,None,None,None,None,None),
(5,15,"GtkWidget","sensitive","False",0,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","application-icon","application-default-icon",None,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","application-name","Yet Another Framework Interface",None,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","comments","YAFI is another GUI for the Framework Laptop Embedded Controller.\nIt is written in Python with a GTK3 theme, and uses the `CrOS_EC_Python` library to communicate with the EC.",None,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","copyright","Copyright © 2025 Stephen Horvath",None,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","developers","Stephen Horvath (Steve-Tech)",None,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","issue-url","https://github.com/Steve-Tech/YAFI/issues",None,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","license-type","gpl-2-0",None,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","version","0.1",None,None,None,None,None,None,None,None,None),
(6,1,"AdwAboutWindow","website","https://github.com/Steve-Tech/YAFI",None,None,None,None,None,None,None,None,None)
</object_property>
<object_data>
(1,17,"GtkWidget",1,1,None,None,None,None,None,None),
(1,17,"GtkWidget",2,2,None,1,None,None,None,None),
(2,8,"GtkWidget",1,1,None,None,None,None,None,None),
(2,8,"GtkWidget",2,2,None,1,None,None,None,None),
(2,10,"GtkStringList",1,1,None,None,None,None,None,None),
(2,10,"GtkStringList",2,2,"Auto",1,None,0,None,None),
(2,10,"GtkStringList",2,3,"Percent",1,None,0,None,None),
(2,10,"GtkStringList",2,4,"RPM",1,None,0,None,None),
(2,6,"GtkWidget",1,1,None,None,None,None,None,None),
(2,6,"GtkWidget",2,2,None,1,None,None,None,None),
(3,5,"GtkWidget",1,1,None,None,None,None,None,None),
(3,5,"GtkWidget",2,2,None,1,None,None,None,None),
(3,24,"GtkStringList",1,1,None,None,None,None,None,None),
(3,24,"GtkStringList",2,2,"Red",1,None,0,None,None),
(3,24,"GtkStringList",2,3,"Green",1,None,0,None,None),
(3,24,"GtkStringList",2,4,"Blue",1,None,0,None,None),
(3,26,"GtkStringList",1,1,None,None,None,None,None,None),
(3,26,"GtkStringList",2,2,"Red",1,None,0,None,None),
(3,26,"GtkStringList",2,3,"Green",1,None,0,None,None),
(3,26,"GtkStringList",2,4,"Blue",1,None,0,None,None),
(3,18,"GtkWidget",2,2,None,1,None,None,None,None),
(3,24,"GtkStringList",2,5,"Yellow",1,None,None,None,None),
(3,24,"GtkStringList",2,6,"White",1,None,None,None,None),
(3,24,"GtkStringList",2,7,"Amber",1,None,None,None,None),
(3,26,"GtkStringList",2,5,"Yellow",1,None,None,None,None),
(3,26,"GtkStringList",2,6,"White",1,None,None,None,None),
(3,26,"GtkStringList",2,7,"Amber",1,None,None,None,None),
(4,2,"GtkWidget",1,1,None,None,None,None,None,None),
(4,2,"GtkWidget",2,2,None,1,None,None,None,None),
(4,31,"GtkWidget",1,1,None,None,None,None,None,None),
(4,31,"GtkWidget",2,2,None,1,None,None,None,None),
(5,2,"GtkWidget",1,1,None,None,None,None,None,None),
(5,2,"GtkWidget",2,2,None,1,None,None,None,None)
</object_data>
<object_data_arg>
(1,17,"GtkWidget",2,2,"name","navigation-sidebar"),
(2,8,"GtkWidget",2,2,"name","property"),
(2,6,"GtkWidget",2,2,"name","boxed-list"),
(3,5,"GtkWidget",2,2,"name","boxed-list"),
(3,18,"GtkWidget",2,2,"name","destructive-action"),
(4,2,"GtkWidget",2,2,"name","boxed-list"),
(4,31,"GtkWidget",2,2,"name","property"),
(5,2,"GtkWidget",2,2,"name","boxed-list")
</object_data_arg>
</cambalache-project>

62
yafi/ui/yafi.ui Normal file
View File

@@ -0,0 +1,62 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.94.1 -->
<interface>
<!-- interface-name yafi.ui -->
<!-- interface-description YAFI is another GUI for the Framework Laptop Embedded Controller. -->
<!-- interface-authors Steve-Tech -->
<requires lib="gtk" version="4.12"/>
<requires lib="libadwaita" version="1.4"/>
<object class="AdwApplicationWindow" id="root">
<property name="default-height">500</property>
<property name="default-width">800</property>
<child>
<object class="AdwNavigationSplitView">
<property name="content">
<object class="AdwNavigationPage">
<property name="title">Yet Another Framework Interface</property>
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkBox" id="content">
<property name="homogeneous">True</property>
<property name="orientation">vertical</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
<property name="sidebar">
<object class="AdwNavigationPage">
<property name="title">Settings</property>
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar"/>
</child>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkListBox" id="navbar">
<style>
<class name="navigation-sidebar"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</interface>

138
yafi/yafi.py Normal file
View File

@@ -0,0 +1,138 @@
import sys
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Adw
class YAFI(Adw.Application):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.connect('activate', self.on_activate)
def _change_page(self, builder, page):
content = builder.get_object("content")
while content_child := content.get_last_child():
content.remove(content_child)
content.append(page)
def _thermals_page(self, builder):
# Load the thermals.ui file
thermals_builder = Gtk.Builder()
thermals_builder.add_from_file("ui/thermals.ui")
# Get the root widget from the thermals.ui file
thermals_root = thermals_builder.get_object("thermals-root")
self._change_page(builder, thermals_root)
fan_rpm = thermals_builder.get_object("fan-rpm")
fan_mode = thermals_builder.get_object("fan-mode")
fan_set_rpm = thermals_builder.get_object("fan-set-rpm")
fan_set_percent = thermals_builder.get_object("fan-set-percent")
fan_percent_scale = thermals_builder.get_object("fan-percent-scale")
def handle_fan_mode(mode):
match mode:
case 0: # Auto
fan_set_rpm.set_visible(False)
fan_set_percent.set_visible(False)
case 1: # Percent
fan_set_rpm.set_visible(False)
fan_set_percent.set_visible(True)
case 2: # RPM
fan_set_rpm.set_visible(True)
fan_set_percent.set_visible(False)
fan_rpm.set_subtitle("1200 RPM")
fan_mode.connect("notify::selected", lambda combo, _: handle_fan_mode(combo.get_selected()))
fan_percent_scale.connect(
"value-changed",
lambda scale: fan_set_percent.set_subtitle(f"{int(scale.get_value())} %"),
)
temperatures = thermals_builder.get_object("temperatures")
for i in ((25.0, "Sensor 1"), (30.0, "Sensor 2"), (35.0, "Sensor 3"), (40.0, "Sensor 4")):
new_row = Adw.ActionRow(title=i[1], subtitle=f"{i[0]}°C")
new_row.add_css_class("property")
temperatures.append(new_row)
def _leds_page(self, builder):
# Load the leds.ui file
leds_builder = Gtk.Builder()
leds_builder.add_from_file("ui/leds.ui")
# Get the root widget from the leds.ui file
leds_root = leds_builder.get_object("leds-root")
self._change_page(builder, leds_root)
def _battery_page(self, builder):
# Load the battery.ui file
battery_builder = Gtk.Builder()
battery_builder.add_from_file("ui/battery.ui")
# Get the root widget from the battery.ui file
battery_root = battery_builder.get_object("battery-root")
self._change_page(builder, battery_root)
def _hardware_page(self, builder):
# Load the hardware.ui file
hardware_builder = Gtk.Builder()
hardware_builder.add_from_file("ui/hardware.ui")
# Get the root widget from the hardware.ui file
hardware_root = hardware_builder.get_object("hardware-root")
self._change_page(builder, hardware_root)
def _about_page(self, app_builder):
# Open About dialog
builder = Gtk.Builder()
builder.add_from_file("ui/about.ui")
about = builder.get_object("about-root")
about.set_modal(True)
about.set_transient_for(self.win)
# Reset the selection in the navbar
navbar = app_builder.get_object("navbar")
about.connect("close-request", lambda _: navbar.select_row(navbar.get_row_at_index(self.current_page)))
about.present()
def on_activate(self, app):
# Create a Builder
builder = Gtk.Builder()
builder.add_from_file("ui/yafi.ui")
self.current_page = 0
self._thermals_page(builder)
pages = (("Thermals", self._thermals_page), ("LEDs", self._leds_page), ("Battery", self._battery_page), ("Hardware", self._hardware_page), ("About", self._about_page))
# Build the navbar
navbar = builder.get_object("navbar")
for page in pages:
row = Gtk.ListBoxRow()
row.set_child(Gtk.Label(label=page[0]))
navbar.append(row)
def switch_page(page):
# About page is a special case
if page != len(pages) - 1:
self.current_page = page
pages[page][1](builder)
navbar.connect("row-activated", lambda box, row: switch_page(row.get_index()))
# Obtain and show the main window
self.win = builder.get_object("root")
self.win.set_application(self)
self.win.present()
app = YAFI(application_id="au.stevetech.yafi")
app.run(sys.argv)