add configure options to gui
This commit is contained in:
parent
ec601c8aba
commit
c69fee81b4
@ -22,10 +22,12 @@ To build TUF Manager the following is needed:
|
|||||||
- polkit
|
- polkit
|
||||||
- polkit-gobject
|
- polkit-gobject
|
||||||
- gmodule-export
|
- gmodule-export
|
||||||
|
- libnotify
|
||||||
|
- libappindicator3
|
||||||
|
|
||||||
## Other requirements
|
## Other requirements
|
||||||
|
|
||||||
This software will only work if using the [faustus](https://github.com/hackbnw/faustus) driver module.
|
This software will only work if using the [hackbnw/faustus](https://github.com/hackbnw/faustus) driver module. To get notifications on fan mode changes the fork of faustus at [rublag/faustus](https://github.com/rublag/faustus) should be used instead since it supports polling.
|
||||||
|
|
||||||
## Build options
|
## Build options
|
||||||
|
|
||||||
@ -87,11 +89,9 @@ This is the daemon that runs in the background and handles all requests from bot
|
|||||||
|
|
||||||
- tuf-tray
|
- tuf-tray
|
||||||
|
|
||||||
This is the tray icon to control the TUF Manager program
|
This is the tray icon to control the TUF Manager program. It should automatically start in any desktop environment that supports xdg.
|
||||||
|
|
||||||
## Future plans
|
## Future plans
|
||||||
|
|
||||||
- Manpage
|
- Manpage
|
||||||
- Config options for both tuf-gui and tuf-cli
|
- Config options for both tuf-gui and tuf-cli
|
||||||
- Notifications of fan mode change via status bar
|
|
||||||
- Restore last known settings on login via status bar icon
|
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
<schemalist>
|
<schemalist>
|
||||||
<schema id="org.tuf.manager" path="/org/tuf/manager/" gettext-domain="tuf-manager">
|
<schema id="org.tuf.manager" path="/org/tuf/manager/" gettext-domain="tuf-manager">
|
||||||
<key name="restore" type="b">
|
<key name="restore" type="b">
|
||||||
<default>false</default>
|
<default>true</default>
|
||||||
<summary>Should TUF Manager restore previous settings when run?</summary>
|
<summary>Should TUF Manager restore previous settings when run?</summary>
|
||||||
<description>
|
<description>
|
||||||
Should TUF Manager restore previous settings when run?
|
Should TUF Manager restore previous settings when run?
|
||||||
</description>
|
</description>
|
||||||
</key>
|
</key>
|
||||||
|
<key name="notifications" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Should TUF Manager show notifications?</summary>
|
||||||
|
<description>
|
||||||
|
Should TUF Manager show notifications?
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
<key name="fan-mode" type="i">
|
<key name="fan-mode" type="i">
|
||||||
<default>0</default>
|
<default>0</default>
|
||||||
<summary>Fan mode</summary>
|
<summary>Fan mode</summary>
|
||||||
|
@ -30,7 +30,7 @@ Author: Chris Cromer
|
|||||||
|
|
||||||
-->
|
-->
|
||||||
<interface domain="tuf-manager">
|
<interface domain="tuf-manager">
|
||||||
<requires lib="gtk+" version="3.10"/>
|
<requires lib="gtk+" version="3.14"/>
|
||||||
<!-- interface-license-type bsd3c -->
|
<!-- interface-license-type bsd3c -->
|
||||||
<!-- interface-name TUF Manager -->
|
<!-- interface-name TUF Manager -->
|
||||||
<!-- interface-description Software to control fans and keyboard on ASUS TUF notebooks -->
|
<!-- interface-description Software to control fans and keyboard on ASUS TUF notebooks -->
|
||||||
@ -57,6 +57,9 @@ Author: Chris Cromer
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
<property name="margin_top">5</property>
|
<property name="margin_top">5</property>
|
||||||
<property name="margin_bottom">5</property>
|
<property name="margin_bottom">5</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
@ -196,6 +199,8 @@ Author: Chris Cromer
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">start</property>
|
<property name="valign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
<property name="margin_top">5</property>
|
<property name="margin_top">5</property>
|
||||||
<property name="margin_bottom">5</property>
|
<property name="margin_bottom">5</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
@ -255,10 +260,94 @@ Author: Chris Cromer
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="label" translatable="yes">Restore on start</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="restore_settings">
|
||||||
|
<property name="name">Restore</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<signal name="state-set" handler="on_restore_settings_state_set" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="label" translatable="yes">Notifications</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="notifications">
|
||||||
|
<property name="name">Notifications</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<signal name="state-set" handler="on_notifications_state_set" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<placeholder/>
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Settings</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">2</property>
|
||||||
|
<property name="tab_fill">False</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
@ -59,6 +59,18 @@ namespace TUFManager {
|
|||||||
[GtkChild]
|
[GtkChild]
|
||||||
private Gtk.ColorChooserWidget keyboard_color;
|
private Gtk.ColorChooserWidget keyboard_color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The restore switch
|
||||||
|
*/
|
||||||
|
[GtkChild]
|
||||||
|
private Gtk.Switch restore_settings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The notifications switch
|
||||||
|
*/
|
||||||
|
[GtkChild]
|
||||||
|
private Gtk.Switch notifications;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the main window
|
* Create the main window
|
||||||
* @param application The application used to make the GLib object
|
* @param application The application used to make the GLib object
|
||||||
@ -95,7 +107,12 @@ namespace TUFManager {
|
|||||||
print (_ ("Client version: ") + VERSION + "\n");
|
print (_ ("Client version: ") + VERSION + "\n");
|
||||||
print (_ ("Server version: ") + get_server_version () + "\n");
|
print (_ ("Server version: ") + get_server_version () + "\n");
|
||||||
|
|
||||||
|
if (settings.get_boolean ("notifications")) {
|
||||||
|
notifications.set_active (true);
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.get_boolean ("restore")) {
|
if (settings.get_boolean ("restore")) {
|
||||||
|
restore_settings.set_active (true);
|
||||||
restore ();
|
restore ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -264,6 +281,40 @@ namespace TUFManager {
|
|||||||
settings.set_string ("keyboard-color", rgba.to_string ());
|
settings.set_string ("keyboard-color", rgba.to_string ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the user clicks the restore settings switch
|
||||||
|
*
|
||||||
|
* @param gtk_switch The switch that was clicked
|
||||||
|
* @param switched The new state of the switch
|
||||||
|
*/
|
||||||
|
[GtkCallback]
|
||||||
|
public bool on_restore_settings_state_set (Gtk.Switch gtk_switch, bool switched) {
|
||||||
|
if (switched) {
|
||||||
|
settings.set_boolean ("restore", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
settings.set_boolean ("restore", false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the user clicks the notifications switch
|
||||||
|
*
|
||||||
|
* @param gtk_switch The switch that was clicked
|
||||||
|
* @param switched The new state of the switch
|
||||||
|
*/
|
||||||
|
[GtkCallback]
|
||||||
|
public bool on_notifications_state_set (Gtk.Switch gtk_switch, bool switched) {
|
||||||
|
if (switched) {
|
||||||
|
settings.set_boolean ("notifications", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
settings.set_boolean ("notifications", false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
glib_dep = dependency('glib-2.0')
|
glib_dep = dependency('glib-2.0')
|
||||||
gtk_dep = dependency('gtk+-3.0', version: '>=3.10.0')
|
gtk_dep = dependency('gtk+-3.0', version: '>=3.14.0')
|
||||||
posix_dep = meson.get_compiler('vala').find_library('posix', required: true)
|
posix_dep = meson.get_compiler('vala').find_library('posix', required: true)
|
||||||
m_dep = meson.get_compiler('c').find_library('m', required: true)
|
m_dep = meson.get_compiler('c').find_library('m', required: true)
|
||||||
|
|
||||||
|
@ -154,19 +154,16 @@ namespace TUFManager {
|
|||||||
|
|
||||||
private void set_fan_balanced () {
|
private void set_fan_balanced () {
|
||||||
set_fan_mode (0);
|
set_fan_mode (0);
|
||||||
//show_notification (_ ("Fan set to balanced"));
|
|
||||||
settings.set_int ("fan-mode", 0);
|
settings.set_int ("fan-mode", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void set_fan_turbo () {
|
private void set_fan_turbo () {
|
||||||
set_fan_mode (1);
|
set_fan_mode (1);
|
||||||
//show_notification (_ ("Fan set to turbo"));
|
|
||||||
settings.set_int ("fan-mode", 1);
|
settings.set_int ("fan-mode", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void set_fan_silent () {
|
private void set_fan_silent () {
|
||||||
set_fan_mode (2);
|
set_fan_mode (2);
|
||||||
//show_notification (_ ("Fan set to silenced"));
|
|
||||||
settings.set_int ("fan-mode", 2);
|
settings.set_int ("fan-mode", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +207,7 @@ namespace TUFManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void show_notification (string message) {
|
private void show_notification (string message) {
|
||||||
|
if (settings.get_boolean ("notifications")) {
|
||||||
try {
|
try {
|
||||||
close_notification ();
|
close_notification ();
|
||||||
notification = new Notify.Notification (_ ("TUF Manager"), message, "tuf-manager");
|
notification = new Notify.Notification (_ ("TUF Manager"), message, "tuf-manager");
|
||||||
@ -221,6 +219,7 @@ namespace TUFManager {
|
|||||||
warning (e.message);
|
warning (e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void close_notification () {
|
private void close_notification () {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user