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-gobject
|
||||
- gmodule-export
|
||||
- libnotify
|
||||
- libappindicator3
|
||||
|
||||
## 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
|
||||
|
||||
@ -87,11 +89,9 @@ This is the daemon that runs in the background and handles all requests from bot
|
||||
|
||||
- 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
|
||||
|
||||
- Manpage
|
||||
- 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>
|
||||
<schema id="org.tuf.manager" path="/org/tuf/manager/" gettext-domain="tuf-manager">
|
||||
<key name="restore" type="b">
|
||||
<default>false</default>
|
||||
<default>true</default>
|
||||
<summary>Should TUF Manager restore previous settings when run?</summary>
|
||||
<description>
|
||||
Should TUF Manager restore previous settings when run?
|
||||
</description>
|
||||
</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">
|
||||
<default>0</default>
|
||||
<summary>Fan mode</summary>
|
||||
|
@ -30,7 +30,7 @@ Author: Chris Cromer
|
||||
|
||||
-->
|
||||
<interface domain="tuf-manager">
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<requires lib="gtk+" version="3.14"/>
|
||||
<!-- interface-license-type bsd3c -->
|
||||
<!-- interface-name TUF Manager -->
|
||||
<!-- 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="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>
|
||||
<property name="hexpand">True</property>
|
||||
@ -196,6 +199,8 @@ Author: Chris Cromer
|
||||
<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>
|
||||
<property name="hexpand">True</property>
|
||||
@ -255,10 +260,94 @@ Author: Chris Cromer
|
||||
</packing>
|
||||
</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 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>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -59,6 +59,18 @@ namespace TUFManager {
|
||||
[GtkChild]
|
||||
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
|
||||
* @param application The application used to make the GLib object
|
||||
@ -95,7 +107,12 @@ namespace TUFManager {
|
||||
print (_ ("Client version: ") + VERSION + "\n");
|
||||
print (_ ("Server version: ") + get_server_version () + "\n");
|
||||
|
||||
if (settings.get_boolean ("notifications")) {
|
||||
notifications.set_active (true);
|
||||
}
|
||||
|
||||
if (settings.get_boolean ("restore")) {
|
||||
restore_settings.set_active (true);
|
||||
restore ();
|
||||
}
|
||||
else {
|
||||
@ -264,6 +281,40 @@ namespace TUFManager {
|
||||
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')
|
||||
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)
|
||||
m_dep = meson.get_compiler('c').find_library('m', required: true)
|
||||
|
||||
|
@ -154,19 +154,16 @@ namespace TUFManager {
|
||||
|
||||
private void set_fan_balanced () {
|
||||
set_fan_mode (0);
|
||||
//show_notification (_ ("Fan set to balanced"));
|
||||
settings.set_int ("fan-mode", 0);
|
||||
}
|
||||
|
||||
private void set_fan_turbo () {
|
||||
set_fan_mode (1);
|
||||
//show_notification (_ ("Fan set to turbo"));
|
||||
settings.set_int ("fan-mode", 1);
|
||||
}
|
||||
|
||||
private void set_fan_silent () {
|
||||
set_fan_mode (2);
|
||||
//show_notification (_ ("Fan set to silenced"));
|
||||
settings.set_int ("fan-mode", 2);
|
||||
}
|
||||
|
||||
@ -210,15 +207,17 @@ namespace TUFManager {
|
||||
}
|
||||
|
||||
private void show_notification (string message) {
|
||||
try {
|
||||
close_notification ();
|
||||
notification = new Notify.Notification (_ ("TUF Manager"), message, "tuf-manager");
|
||||
notification.set_timeout (Notify.EXPIRES_DEFAULT);
|
||||
notification.add_action ("default", _ ("Details"), close_notification);
|
||||
notification.show ();
|
||||
}
|
||||
catch (Error e) {
|
||||
warning (e.message);
|
||||
if (settings.get_boolean ("notifications")) {
|
||||
try {
|
||||
close_notification ();
|
||||
notification = new Notify.Notification (_ ("TUF Manager"), message, "tuf-manager");
|
||||
notification.set_timeout (Notify.EXPIRES_DEFAULT);
|
||||
notification.add_action ("default", _ ("Details"), close_notification);
|
||||
notification.show ();
|
||||
}
|
||||
catch (Error e) {
|
||||
warning (e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user