Compare commits

...

22 Commits

Author SHA1 Message Date
Chris Cromer 722cf24792
update to version 1.2.3 2021-09-28 14:33:31 -03:00
Chris Cromer eabd5aaf19
fix systemd unit file install for arch linux 2021-09-28 13:58:32 -03:00
Chris Cromer c40254871e
update readme 2021-03-30 19:40:13 -03:00
Chris Cromer 69bd767cd6
add pid file to systemd unit and move services to data folder 2020-08-29 11:03:49 -04:00
Chris Cromer e8d0a906a5
only install the required man pages 2020-08-16 09:31:18 -04:00
Chris Cromer a545d6b7f4
add man pages and autodetection of init system 2020-08-15 16:43:34 -04:00
Chris Cromer 0f6e7baef4
remove debugging message 2020-08-08 19:26:45 -04:00
Chris Cromer 8f0bf4a6bc
look for an init system and auto install based on what is found 2020-08-08 19:22:04 -04:00
Chris Cromer 49d5a9bbee
fix bug that caused infinite loop in cli 2020-08-07 22:41:54 -04:00
Chris Cromer ec59682d2d
update translations 2020-08-07 21:52:01 -04:00
Chris Cromer b57d61b861
add restore option to cli 2020-08-07 21:46:37 -04:00
Chris Cromer daff974690
add notes 2020-08-07 21:46:13 -04:00
Chris Cromer 68c2e3878c
update to 1.1.0 2020-08-07 20:41:36 -04:00
Chris Cromer c67b56808b
add vala documentation 2020-08-07 20:40:54 -04:00
Chris Cromer f4d2f0f689
update translations 2020-08-07 20:29:33 -04:00
Chris Cromer c69fee81b4
add configure options to gui 2020-08-07 20:21:05 -04:00
Chris Cromer ec601c8aba
reuse posix and math deps 2020-08-07 19:25:54 -04:00
Chris Cromer 3ff7c22bb7
only restore if configured 2020-08-07 19:20:56 -04:00
Chris Cromer a6e1c031c3
finish up tray icon 2020-08-07 16:17:15 -04:00
Chris Cromer 130a131214
change warning method 2020-08-07 01:15:27 -04:00
Chris Cromer bc9f3c3c49
cleanup dependencies 2020-08-07 00:41:12 -04:00
Chris Cromer 9fd83b108c
initial tray work 2020-08-07 00:32:22 -04:00
37 changed files with 1259 additions and 380 deletions

View File

@ -18,14 +18,18 @@ To build TUF Manager the following is needed:
- valadoc
- glib
- gtk3
- gio-unix
- gobject
- dbus
- 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.
## Build options
@ -45,44 +49,36 @@ Build the cli interface.
Build the gui interface.
- build-tray
Build the tray icon
- always-authenticated
Authentication is not required to use the TUF Server that runs in the background as a daemon, if this is set to false polkit is used for authentication. Setting this to false is more secure, but also makes things like auto restore of settings on login impossible to do without a password.
- openrc
Install an OpenRC init script. Ff this option is not set, the init script is still generated during build, just not installed.
- runit
Install a runit init script. If this option is not set, the init script is still generated during build, just not installed.
- s6
Install n s6 init scripts. If this option is not set, the init scripts are still generated during build, just not installed.
- system
Install a systemd unit. If this option is not set, the unit is still generated during build, just not installed.
## Usage
There are 2 programs and 1 daemon supplied by TUF Manager.
There are 3 programs and 1 daemon supplied by TUF Manager.
- tuf-cli
This allows controlling the TUF laptop functions via command line interface.
- tuf-gui
This supplies a graphical interface to control the TUF laptop.
- tuf-server
This is the daemon that runs in the background and handles all requests from both tuf-cli and tuf-gui.
## Future plans
- tuf-tray
- Manpage
- Config options for both tuf-gui and tuf-cli
- Status bar icon that allows control of the notebook
- Notifications of fan mode change via status bar
- Restore last known settings on login via status bar icon
This is the tray icon to control the TUF Manager program. It should automatically start in any desktop environment that supports xdg.
## Notes
The restore settings option saves the changes made on a per user basis. This means that for example if a different user logs in and the tray icon is running, it will restore their settings. So for example user A can have a blue keyboard and user B can have a green keyboard. Or even change keyboard colors based on the distro that is booted. For example when in linux mint a green keyboard and when in fedora a blue keyboard.
The other important use of the restore settings options is the fan mode. Normally fan mode does not survive a reboot. It is always set to "balanced" when booted. However now when the user logs in it restores the previous fan mode that was saved.

View File

@ -1,4 +0,0 @@
subdir('openrc')
subdir('runit')
subdir('s6')
subdir('systemd')

View File

@ -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>

15
data/man/meson.build Normal file
View File

@ -0,0 +1,15 @@
man_pages = files()
if build_cli
man_pages += files('tuf-cli.1')
endif
if build_gui
man_pages += files('tuf-gui.1')
endif
if build_tray
man_pages += files('tuf-tray.1')
endif
if build_cli or build_gui or build_tray
install_man(man_pages)
endif

36
data/man/tuf-cli.1 Normal file
View File

@ -0,0 +1,36 @@
.Dd August 15, 2020
.Dt tuf-cli 1 SMM
.Os TUF Manager
.Sh NAME
.Nm tuf-cli
.Nd Manage the TUF Gaming notebook
.Sh SYNOPSIS
.Nm
.Ar COMMAND
.Ar <SUBCOMMAND>
.Sh DESCRIPTION
This program allows controlling the fan modes and keyboard lighting of Asus TUF Gaming notebooks via a CLI.
.Pp
The commands are as follows:
.Bl -tag -width ".Fl lighting {static | breath | cycle | stobe}"
.It version
Print the version of tuf-cli
.It help
Show the help screen
.It info
Show the current config
.It restore
Restore saved settings
.It fan {balanced | turbo | silent}
Set the fan mode
.It lighting {static | breath | cycle | stobe}
Set the keyboard lighting
.It speed {slow | medium | fast}
Set the keyboard lighting speed
.It color \&"#XXXXXX\&"
Set the keyboard color
.Sh SEE ALSO
.Xr tuf-gui 1 ,
.Xr tuf-tray 1
.Sh AUTHORS
.An Chris Cromer <chris@cromer.cl>

16
data/man/tuf-gui.1 Normal file
View File

@ -0,0 +1,16 @@
.Dd August 15, 2020
.Dt tuf-gui 1 SMM
.Os TUF Manager
.Sh NAME
.Nm tuf-gui
.Nd Manage the TUF Gaming notebook
.Sh SYNOPSIS
.Nm
.Sh DESCRIPTION
This program allows controlling the fan modes and keyboard lighting of Asus TUF Gaming notebooks via a GUI.
There are 2 available configuration options. Restore settings which will allow settings to be restored when TUF Manager is run either from CLI, GUI, or the Tray Icon. The other setting is notifications, which if set will notify the user via tray icon that the fan mode changed.
.Sh SEE ALSO
.Xr tuf-cli 1 ,
.Xr tuf-tray 1
.Sh AUTHORS
.An Chris Cromer <chris@cromer.cl>

15
data/man/tuf-tray.1 Normal file
View File

@ -0,0 +1,15 @@
.Dd August 15, 2020
.Dt tuf-tray 1 SMM
.Os TUF Manager
.Sh NAME
.Nm tuf-tray
.Nd Manage the TUF Gaming notebook
.Sh SYNOPSIS
.Nm
.Sh DESCRIPTION
This program should be started automatically by the desktop environment. It is a tray icon that runs in the status bar and allows changing fan speeds, opening the TUF Manager GUI, and notifications about fan speed changes.
.Sh SEE ALSO
.Xr tuf-cli 1 ,
.Xr tuf-gui 1
.Sh AUTHORS
.An Chris Cromer <chris@cromer.cl>

View File

@ -7,6 +7,17 @@ if build_gui
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
)
if build_tray
i18n.merge_file(
input: 'tuf-tray.desktop.in',
output: 'tuf-tray.desktop',
po_dir: join_paths(meson.source_root(), 'po'),
type: 'desktop',
install: true,
install_dir: join_paths(get_option('sysconfdir'), 'xdg', 'autostart')
)
endif
endif
subdir('dbus')
@ -14,3 +25,8 @@ subdir('polkit')
subdir('ui')
subdir('icons')
subdir('gschema')
subdir('man')
subdir('openrc')
subdir('runit')
subdir('s6')
subdir('systemd')

View File

@ -1,5 +1,3 @@
openrc = get_option('openrc')
openrc_config_data = configuration_data()
openrc_config_data.set('SBINDIR', join_paths(get_option('prefix'), get_option('sbindir')))
openrc_config_data.set('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name()))
@ -10,7 +8,9 @@ openrc_config_data_file = configure_file(
configuration: openrc_config_data
)
if openrc
openrc = find_program ('openrc', required: false)
if openrc.found()
install_data(
openrc_config_data_file,
install_dir: join_paths(get_option('sysconfdir'), 'init.d')

View File

@ -1,5 +1,3 @@
runit = get_option('runit')
runit_config_data = configuration_data()
runit_config_data.set('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name()))
@ -9,7 +7,9 @@ runit_config_data_file = configure_file(
configuration: runit_config_data
)
if runit
runit = find_program ('runit', required: false)
if runit.found()
install_data(
runit_config_data_file,
install_dir: join_paths(get_option('sysconfdir'), 'runit', 'sv', 'tufmanager')

View File

@ -1,5 +1,3 @@
s6 = get_option('s6')
s6_config_data = configuration_data()
s6_config_data.set('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name()))
@ -9,7 +7,9 @@ s6_config_data_file = configure_file(
configuration: s6_config_data
)
if s6
s6 = find_program ('s6-init', required: false)
if s6.found()
install_data(
[s6_config_data_file, 'type', 'dependencies'],
install_dir: join_paths(get_option('sysconfdir'), 's6', 'sv', 'tufmanager')

View File

@ -1,5 +1,3 @@
systemd = get_option('systemd')
systemd_config_data = configuration_data()
systemd_config_data.set('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name()))
@ -9,7 +7,9 @@ systemd_config_data_file = configure_file(
configuration: systemd_config_data
)
if systemd
systemd = find_program ('systemctl', required: false)
if systemd.found()
install_data(
systemd_config_data_file,
install_dir: join_paths(get_option('prefix'), 'lib', 'systemd', 'system')

View File

@ -3,6 +3,7 @@ Description=TUF Manager Server
[Service]
Type=forking
PIDFile=/run/tufmanager/pid
ExecStart=@LIBEXECDIR@/tuf-server
[Install]

View File

@ -2,8 +2,8 @@
Type=Application
Name=TUF Manager
GenericName=TUF Manager
Comment=Softare to manage the fan mode and rgb keyboard.
Comment=Softare to manage the fan mode and rgb keyboard
Icon=tuf-manager
StartupNotify=true
Exec=tuf-gui
Categories=System;
Categories=System;Settings;

10
data/tuf-tray.desktop.in Normal file
View File

@ -0,0 +1,10 @@
[Desktop Entry]
Name=TUF Manager
GenericName=TUF Manager
Comment=Softare to manage the fan mode and rgb keyboard
Icon=tuf-manager
Categories=System;Settings;
Exec=/usr/bin/tuf-tray
Type=Application
StartupNotify=true
Terminal=false

View File

@ -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>

View File

@ -7,6 +7,9 @@ if docs_enabled
endif
if build_gui
vala_doc_sources += gui_vala_sources
if build_tray
vala_doc_sources += tray_vala_sources
endif
endif
vala_doc_sources += error_vala_sources
vala_doc_sources += config_data_file
@ -14,7 +17,9 @@ if docs_enabled
docs_deps = [
'--pkg=polkit-gobject-1',
'--pkg=posix',
'--pkg=gtk+-3.0'
'--pkg=gtk+-3.0',
'--pkg=libnotify',
'--pkg=appindicator3-0.1'
]
if valadocs_deps
docs_deps += ['--deps']

View File

@ -4,7 +4,7 @@ project(
'c',
'vala'
],
version: '1.0.1',
version: '1.2.3',
license: 'BSD-3',
default_options:
[
@ -21,10 +21,10 @@ add_global_arguments(
always_authenticated = get_option('always-authenticated')
build_cli = get_option('build-cli')
build_gui = get_option('build-gui')
build_tray = get_option('build-tray')
subdir('po')
subdir('data')
subdir('src')
subdir('docs')
subdir('script')
subdir('contrib')

View File

@ -22,33 +22,15 @@ option(
value: true,
description: 'Build the graphical user interface to TUF Manager'
)
option(
'build-tray',
type : 'boolean',
value: true,
description: 'Build the tray icon, this option depends on build-gui'
)
option(
'always-authenticated',
type : 'boolean',
value: true,
description: 'User is always authenticated, so no password is necessary'
)
option(
'openrc',
type : 'boolean',
value: false,
description: 'Install OpenRC script'
)
option(
'runit',
type : 'boolean',
value: false,
description: 'Install runit script'
)
option(
's6',
type : 'boolean',
value: false,
description: 'Install s6 scripts'
)
option(
'systemd',
type : 'boolean',
value: false,
description: 'Install systemd unit'
)

View File

@ -8,7 +8,11 @@ src/main.vala.in
src/server.vala
src/server-interface.vala
src/server-main.vala
src/tray.vala
src/tray-icon.vala
src/tray-main.vala
data/tuf-manager.desktop.in
data/tuf-tray.desktop.in
data/gschema/org.tuf.manager.gschema.xml
data/polkit/org.tuf.manager.policy.in
data/ui/tuf.manager.window.ui

285
po/es.po
View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: tuf-manager\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-06 20:34-0400\n"
"PO-Revision-Date: 2020-08-06 20:37-0400\n"
"POT-Creation-Date: 2020-08-15 16:42-0400\n"
"PO-Revision-Date: 2020-08-07 21:51-0400\n"
"Last-Translator: Chris Cromer <chris@cromer.cl>\n"
"Language-Team: none\n"
"Language: es\n"
@ -19,135 +19,140 @@ msgstr ""
"X-Generator: Poedit 2.3\n"
"X-Poedit-SourceCharset: UTF-8\n"
#: src/cli.vala:180 src/cli.vala:287 src/cli.vala:344 src/cli.vala:362
#: src/cli.vala:377 src/cli.vala:406 src/cli.vala:429 src/cli.vala:451
#: src/cli.vala:471 src/gui-window.vala:109 src/gui-window.vala:125
#: src/gui-window.vala:135 src/main.vala.in:34 src/server.vala:50
#: src/server-main.vala:92 src/server-main.vala:122
msgid "Error: "
msgstr "Error: "
#: src/cli.vala:331
msgid "Invalid arguments!"
msgstr "¡Argumentos invalidos!"
#: src/cli.vala:314
#: src/cli.vala:342
msgid ""
"Invalid arguments!\n"
"\n"
msgstr "¡Argumentos invalidos!\n"
"Restore settings is currently disabled, please enable it to use this feature!"
msgstr ""
"¡La restauración de la configuración está actualmente deshabilitada, "
"habilítela para usar esta función!"
#: src/cli.vala:320
#: src/cli.vala:348
msgid "Version: "
msgstr "Versión: "
#: src/cli.vala:330 src/gui-window.vala:95
#: src/cli.vala:358 src/gui-window.vala:107
msgid "Client version: "
msgstr "Versión del cliente: "
#: src/cli.vala:331 src/gui-window.vala:96
#: src/cli.vala:359 src/gui-window.vala:108
msgid "Server version: "
msgstr "Versión del servidor: "
#: src/cli.vala:335 src/cli.vala:338 src/cli.vala:341 src/gui-window.vala:106
#: src/gui-window.vala:160
#: src/cli.vala:363 src/cli.vala:366 src/cli.vala:369 src/gui-window.vala:123
#: src/gui-window.vala:177
msgid "Current fan mode: "
msgstr "Modo de ventilador actual: "
#: src/cli.vala:335
#: src/cli.vala:363
msgid "Balanced\n"
msgstr "Balanceada\n"
#: src/cli.vala:338
#: src/cli.vala:366
msgid "Turbo\n"
msgstr "Turbo\n"
#: src/cli.vala:341
#: src/cli.vala:369
msgid "Silent\n"
msgstr "Silenciosa\n"
#: src/cli.vala:344
msgid "Could not get current fan mode!\n"
msgstr "¡No se pudo obtener el modo de ventilador actual!\n"
#: src/cli.vala:372 src/gui-window.vala:126
msgid "Could not get current fan mode!"
msgstr "¡No se pudo obtener el modo de ventilador actual!"
#: src/cli.vala:350 src/cli.vala:353 src/cli.vala:356 src/cli.vala:359
#: src/cli.vala:378 src/cli.vala:381 src/cli.vala:384 src/cli.vala:387
msgid "Current keyboard lighting: "
msgstr "Iluminación de teclado actual: "
#: src/cli.vala:350
#: src/cli.vala:378
msgid "Static\n"
msgstr "Estática\n"
#: src/cli.vala:353
#: src/cli.vala:381
msgid "Breathing\n"
msgstr "Respiración\n"
#: src/cli.vala:356
#: src/cli.vala:384
msgid "Color Cycle\n"
msgstr "Ciclo de Color\n"
#: src/cli.vala:359
#: src/cli.vala:387
msgid "Strobing\n"
msgstr "Estroboscópica\n"
#: src/cli.vala:362
msgid "Could not get current keyboard mode!\n"
msgstr "¡No se pudo obtener el modo de teclado actual!\n"
#: src/cli.vala:390 src/gui-window.vala:142
msgid "Could not get current keyboard mode!"
msgstr "¡No se pudo obtener el modo de teclado actual!"
#: src/cli.vala:368 src/cli.vala:371 src/cli.vala:374 src/gui-window.vala:132
#: src/gui-window.vala:184
#: src/cli.vala:396 src/cli.vala:399 src/cli.vala:402 src/gui-window.vala:149
#: src/gui-window.vala:201
msgid "Current keyboard speed: "
msgstr "Velocidad del teclado actual: "
#: src/cli.vala:368
#: src/cli.vala:396
msgid "Slow\n"
msgstr "Lenta\n"
#: src/cli.vala:371
#: src/cli.vala:399
msgid "Medium\n"
msgstr "Media\n"
#: src/cli.vala:374
#: src/cli.vala:402
msgid "Fast\n"
msgstr "Rapida\n"
#: src/cli.vala:377
msgid "Could not get current keyboard speed!\n"
msgstr "¡No se pudo obtener la velocidad actual del teclado!\n"
#: src/cli.vala:405 src/gui-window.vala:152
msgid "Could not get current keyboard speed!"
msgstr "¡No se pudo obtener la velocidad actual del teclado!"
#: src/cli.vala:386 src/gui-window.vala:141 src/gui-window.vala:193
#: src/cli.vala:414 src/gui-window.vala:158 src/gui-window.vala:210
msgid "Current keyboard color: "
msgstr "Color de teclado actual: "
#: src/cli.vala:497
#: src/cli.vala:609
msgid "Usage:"
msgstr "Uso:"
#: src/cli.vala:497
#: src/cli.vala:609
msgid "COMMAND [SUBCOMMAND]"
msgstr "COMANDO [SUBCOMANDO]"
#: src/cli.vala:498
#: src/cli.vala:610
msgid "Print the version of tuf-cli\n"
msgstr "Imprimir la versión del tuf-cli\n"
#: src/cli.vala:499
#: src/cli.vala:611
msgid "Show this help screen\n"
msgstr "Mostrar esta pantalla de ayuda\n"
#: src/cli.vala:500
#: src/cli.vala:612
msgid "Set the fan mode\n"
msgstr "Establecer el modo del ventilador:\n"
#: src/cli.vala:501
#: src/cli.vala:613
msgid "Set the keyboard lighting\n"
msgstr "Iluminación de teclado\n"
#: src/cli.vala:502
#: src/cli.vala:614
msgid "Set the keyboard lighting speed\n"
msgstr "Establecer la Iluminación de teclado\n"
#: src/cli.vala:503
#: src/cli.vala:615
msgid "Set the keyboard color\n"
msgstr "Color del teclado\n"
#: src/cli.vala:504
#: src/cli.vala:616
msgid ""
"Restore saved settings\n"
"\n"
msgstr ""
"Restaurar configuraciones guardadas\n"
"\n"
#: src/cli.vala:617
msgid ""
"Show the current config\n"
"\n"
@ -155,66 +160,37 @@ msgstr ""
"Mostrar la configuración actual\n"
"\n"
#: src/cli.vala:505
#: src/cli.vala:618
msgid "Examples:\n"
msgstr "Ejemplos:\n"
#: src/cli.vala:506
#: src/cli.vala:619
msgid "Silence fan:"
msgstr "Silenciar ventilador:"
#: src/cli.vala:507
#: src/cli.vala:620
msgid "Change RGB color:"
msgstr "Cambiar el color RGB:"
#: src/common.vala:41 src/common.vala:64 src/common.vala:79 src/common.vala:82
#: src/common.vala:97 src/common.vala:100 src/common.vala:114
#: src/common.vala:117 src/common.vala:132 src/common.vala:135
#: src/common.vala:149 src/common.vala:152 src/common.vala:167
#: src/common.vala:170 src/common.vala:184 src/common.vala:187
#: src/common.vala:202 src/common.vala:205 src/gui-window.vala:79
#: src/main.vala.in:31 src/server.vala:44 src/server.vala:140
#: src/server.vala:201 src/server.vala:204 src/server.vala:212
#: src/server.vala:215 src/server.vala:321 src/server.vala:324
#: src/server.vala:332 src/server.vala:335 src/server.vala:447
#: src/server.vala:450 src/server.vala:458 src/server.vala:461
#: src/server.vala:559 src/server.vala:562 src/server.vala:570
#: src/server.vala:573 src/server-main.vala:68 src/server-main.vala:88
#, c-format
msgid "Error: %s\n"
msgstr "Error: %s\n"
#: src/common.vala:50
msgid "The server and client versions do not match!"
msgstr "¡La versión del servidor y del cliente no coinciden!"
#: src/gui-window.vala:86
#: src/gui-window.vala:98
msgid "The current running tuf-server version doesn't match the GUI version!"
msgstr "¡La versión actual de tuf-server no coincide con la versión de GUI!"
#: src/gui-window.vala:109
msgid "Could not get current fan mode!"
msgstr "¡No se pudo obtener el modo de ventilador actual!"
#: src/gui-window.vala:122 src/gui-window.vala:175
#: src/gui-window.vala:139 src/gui-window.vala:192
msgid "Current keyboard mode: "
msgstr "Modo de teclado actual: "
#: src/gui-window.vala:125
msgid "Could not get current keyboard mode!"
msgstr "¡No se pudo obtener el modo de teclado actual!"
#: src/gui-window.vala:135
msgid "Could not get current keyboard speed!"
msgstr "¡No se pudo obtener la velocidad actual del teclado!"
#: src/main.vala.in:34
msgid "Another instance of TUF Manager is already running!\n"
msgstr "¡Ya se está ejecutando otra instancia de Administrador TUF!\n"
#: src/main.vala.in:34 src/tray-main.vala:39
msgid "Another instance of TUF Manager is already running!"
msgstr "¡Ya se está ejecutando otra instancia de Administrador TUF!"
#: src/server.vala:50
msgid "Could not register service!\n"
msgstr "¡No se pudo registrar el servicio!\n"
msgid "Could not register service!"
msgstr "¡No se pudo registrar el servicio!"
#: src/server.vala:166 src/server.vala:238 src/server.vala:264
#: src/server.vala:277 src/server.vala:290 src/server.vala:365
@ -245,64 +221,115 @@ msgstr "Ejecuta el daemon en primer plano"
#: src/server-main.vala:69
#, c-format
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr "Ejecute '% s --help' para ver una lista completa de las opciones de línea de comando disponibles.\n"
msgstr ""
"Ejecute '% s --help' para ver una lista completa de las opciones de línea de "
"comando disponibles.\n"
#: src/server-main.vala:92
msgid "Could not create pid file!\n"
msgstr "¡No se pudo crear el archivo pid!\n"
msgid "Could not create pid file!"
msgstr "¡No se pudo crear el archivo pid!"
#: src/server-main.vala:122
msgid "Could not acquire bus name!\n"
msgstr "¡No se pudo adquirir el bus name!\n"
msgid "Could not acquire bus name!"
msgstr "¡No se pudo adquirir el bus name!"
#: data/tuf-manager.desktop.in:4 data/tuf-manager.desktop.in:5
#: data/ui/tuf.manager.window.ui:41
#: src/tray-icon.vala:80 src/tray-icon.vala:117 src/tray-icon.vala:127
#: src/tray-icon.vala:276 data/tuf-manager.desktop.in:4
#: data/tuf-manager.desktop.in:5 data/tuf-tray.desktop.in:3
#: data/tuf-tray.desktop.in:4 data/ui/tuf.manager.window.ui:41
msgid "TUF Manager"
msgstr "Administrador TUF"
#: data/tuf-manager.desktop.in:6
msgid "Softare to manage the fan mode and rgb keyboard."
msgstr "Software para gestionar el modo ventilador y el teclado rgb."
#: src/tray-icon.vala:84
msgid "_TUF Manager"
msgstr "_Administrador TUF"
#: src/tray-icon.vala:89
msgid "_Fan"
msgstr "_Ventilador"
#: src/tray-icon.vala:95
msgid "_Balanced"
msgstr "_Balanceada"
#: src/tray-icon.vala:99
msgid "_Turbo"
msgstr "_Turbo"
#: src/tray-icon.vala:103
msgid "_Silent"
msgstr "_Silenciosa"
#: src/tray-icon.vala:108
msgid "_Quit"
msgstr "_Salir"
#: src/tray-icon.vala:172
msgid "Fan set to balanced"
msgstr "Ventilador ajustado a balanceada"
#: src/tray-icon.vala:175
msgid "Fan set to turbo"
msgstr "Ventilador ajustado a turbo"
#: src/tray-icon.vala:178
msgid "Fan set to silent"
msgstr "Ventilador ajustado a silenciosa"
#: src/tray-icon.vala:278
msgid "Close"
msgstr "Cerrar"
#: data/tuf-manager.desktop.in:6 data/tuf-tray.desktop.in:5
msgid "Softare to manage the fan mode and rgb keyboard"
msgstr "Software para gestionar el modo ventilador y el teclado rgb"
# Not translatable
#: data/tuf-manager.desktop.in:7
#: data/tuf-manager.desktop.in:7 data/tuf-tray.desktop.in:6
msgid "tuf-manager"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:5
#: data/gschema/org.tuf.manager.gschema.xml:6
msgid "Should TUF Manager restore previous settings when run?"
msgstr "¿Debe Administrador TUF restaurar la configuración anterior cuando se ejecuta?"
msgstr ""
"¿Debe Administrador TUF restaurar la configuración anterior cuando se "
"ejecuta?"
#: data/gschema/org.tuf.manager.gschema.xml:12
#: data/gschema/org.tuf.manager.gschema.xml:13
msgid "Should TUF Manager show notifications?"
msgstr "¿Debe Administrador TUF mostrar notificaciones?"
#: data/gschema/org.tuf.manager.gschema.xml:19
msgid "Fan mode"
msgstr "Modo del ventilador"
#: data/gschema/org.tuf.manager.gschema.xml:13
#: data/gschema/org.tuf.manager.gschema.xml:20
msgid "The saved fan mode"
msgstr "El modo de ventilador guardado"
#: data/gschema/org.tuf.manager.gschema.xml:19
#: data/gschema/org.tuf.manager.gschema.xml:26
msgid "Keyboard mode"
msgstr "Modo del teclado"
#: data/gschema/org.tuf.manager.gschema.xml:20
#: data/gschema/org.tuf.manager.gschema.xml:27
msgid "The saved keyboard mode"
msgstr "El modo de teclado guardado"
#: data/gschema/org.tuf.manager.gschema.xml:26
#: data/gschema/org.tuf.manager.gschema.xml:33
msgid "Keyboard speed"
msgstr "Velocidad del teclado"
#: data/gschema/org.tuf.manager.gschema.xml:27
#: data/gschema/org.tuf.manager.gschema.xml:34
msgid "The saved keyboard speed"
msgstr "La velocidad del teclado guardada"
#: data/gschema/org.tuf.manager.gschema.xml:33
#: data/gschema/org.tuf.manager.gschema.xml:40
msgid "Keyboard color"
msgstr "Color del teclado"
#: data/gschema/org.tuf.manager.gschema.xml:34
#: data/gschema/org.tuf.manager.gschema.xml:41
msgid "The saved keyboard color in RGB format"
msgstr "El color del teclado guardado en formato RGB"
@ -310,62 +337,74 @@ msgstr "El color del teclado guardado en formato RGB"
msgid "Authentication is required"
msgstr "Se requiere autenticación"
#: data/ui/tuf.manager.window.ui:73 data/ui/tuf.manager.window.ui:212
#: data/ui/tuf.manager.window.ui:76 data/ui/tuf.manager.window.ui:217
msgid "Mode"
msgstr "Modo"
#: data/ui/tuf.manager.window.ui:91
#: data/ui/tuf.manager.window.ui:94
msgid "Static"
msgstr "Estática"
#: data/ui/tuf.manager.window.ui:92
#: data/ui/tuf.manager.window.ui:95
msgid "Breathing"
msgstr "Respiración"
#: data/ui/tuf.manager.window.ui:93
#: data/ui/tuf.manager.window.ui:96
msgid "Color Cycle"
msgstr "Ciclo de Color"
#: data/ui/tuf.manager.window.ui:94
#: data/ui/tuf.manager.window.ui:97
msgid "Strobing"
msgstr "Estroboscópica"
#: data/ui/tuf.manager.window.ui:112
#: data/ui/tuf.manager.window.ui:115
msgid "Speed"
msgstr "Velocidad"
#: data/ui/tuf.manager.window.ui:130
#: data/ui/tuf.manager.window.ui:133
msgid "Slow"
msgstr "Lenta"
#: data/ui/tuf.manager.window.ui:131
#: data/ui/tuf.manager.window.ui:134
msgid "Medium"
msgstr "Media"
#: data/ui/tuf.manager.window.ui:132
#: data/ui/tuf.manager.window.ui:135
msgid "Fast"
msgstr "Rapida"
#: data/ui/tuf.manager.window.ui:162
#: data/ui/tuf.manager.window.ui:165
msgid "Set color"
msgstr "Establecer color"
#: data/ui/tuf.manager.window.ui:187
#: data/ui/tuf.manager.window.ui:190
msgid "Keyboard lighting"
msgstr "Iluminación de teclado"
#: data/ui/tuf.manager.window.ui:230
#: data/ui/tuf.manager.window.ui:235
msgid "Balanced"
msgstr "Balanceada"
#: data/ui/tuf.manager.window.ui:231
#: data/ui/tuf.manager.window.ui:236
msgid "Turbo"
msgstr "Turbo"
#: data/ui/tuf.manager.window.ui:232
#: data/ui/tuf.manager.window.ui:237
msgid "Silent"
msgstr "Silenciosa"
#: data/ui/tuf.manager.window.ui:250
#: data/ui/tuf.manager.window.ui:255
msgid "Fan control"
msgstr "Control de ventilador"
#: data/ui/tuf.manager.window.ui:281
msgid "Restore on start"
msgstr "Restaurar al iniciar"
#: data/ui/tuf.manager.window.ui:313
msgid "Notifications"
msgstr "Notificaciones"
#: data/ui/tuf.manager.window.ui:345
msgid "Settings"
msgstr "Configuración"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tuf-manager\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-06 20:34-0400\n"
"POT-Creation-Date: 2020-08-15 16:42-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,199 +17,171 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/cli.vala:180 src/cli.vala:287 src/cli.vala:344 src/cli.vala:362
#: src/cli.vala:377 src/cli.vala:406 src/cli.vala:429 src/cli.vala:451
#: src/cli.vala:471 src/gui-window.vala:109 src/gui-window.vala:125
#: src/gui-window.vala:135 src/main.vala.in:34 src/server.vala:50
#: src/server-main.vala:92 src/server-main.vala:122
msgid "Error: "
#: src/cli.vala:331
msgid "Invalid arguments!"
msgstr ""
#: src/cli.vala:314
#: src/cli.vala:342
msgid ""
"Invalid arguments!\n"
"\n"
"Restore settings is currently disabled, please enable it to use this feature!"
msgstr ""
#: src/cli.vala:320
#: src/cli.vala:348
msgid "Version: "
msgstr ""
#: src/cli.vala:330 src/gui-window.vala:95
#: src/cli.vala:358 src/gui-window.vala:107
msgid "Client version: "
msgstr ""
#: src/cli.vala:331 src/gui-window.vala:96
#: src/cli.vala:359 src/gui-window.vala:108
msgid "Server version: "
msgstr ""
#: src/cli.vala:335 src/cli.vala:338 src/cli.vala:341 src/gui-window.vala:106
#: src/gui-window.vala:160
#: src/cli.vala:363 src/cli.vala:366 src/cli.vala:369 src/gui-window.vala:123
#: src/gui-window.vala:177
msgid "Current fan mode: "
msgstr ""
#: src/cli.vala:335
#: src/cli.vala:363
msgid "Balanced\n"
msgstr ""
#: src/cli.vala:338
#: src/cli.vala:366
msgid "Turbo\n"
msgstr ""
#: src/cli.vala:341
#: src/cli.vala:369
msgid "Silent\n"
msgstr ""
#: src/cli.vala:344
msgid "Could not get current fan mode!\n"
#: src/cli.vala:372 src/gui-window.vala:126
msgid "Could not get current fan mode!"
msgstr ""
#: src/cli.vala:350 src/cli.vala:353 src/cli.vala:356 src/cli.vala:359
#: src/cli.vala:378 src/cli.vala:381 src/cli.vala:384 src/cli.vala:387
msgid "Current keyboard lighting: "
msgstr ""
#: src/cli.vala:350
#: src/cli.vala:378
msgid "Static\n"
msgstr ""
#: src/cli.vala:353
#: src/cli.vala:381
msgid "Breathing\n"
msgstr ""
#: src/cli.vala:356
#: src/cli.vala:384
msgid "Color Cycle\n"
msgstr ""
#: src/cli.vala:359
#: src/cli.vala:387
msgid "Strobing\n"
msgstr ""
#: src/cli.vala:362
msgid "Could not get current keyboard mode!\n"
#: src/cli.vala:390 src/gui-window.vala:142
msgid "Could not get current keyboard mode!"
msgstr ""
#: src/cli.vala:368 src/cli.vala:371 src/cli.vala:374 src/gui-window.vala:132
#: src/gui-window.vala:184
#: src/cli.vala:396 src/cli.vala:399 src/cli.vala:402 src/gui-window.vala:149
#: src/gui-window.vala:201
msgid "Current keyboard speed: "
msgstr ""
#: src/cli.vala:368
#: src/cli.vala:396
msgid "Slow\n"
msgstr ""
#: src/cli.vala:371
#: src/cli.vala:399
msgid "Medium\n"
msgstr ""
#: src/cli.vala:374
#: src/cli.vala:402
msgid "Fast\n"
msgstr ""
#: src/cli.vala:377
msgid "Could not get current keyboard speed!\n"
#: src/cli.vala:405 src/gui-window.vala:152
msgid "Could not get current keyboard speed!"
msgstr ""
#: src/cli.vala:386 src/gui-window.vala:141 src/gui-window.vala:193
#: src/cli.vala:414 src/gui-window.vala:158 src/gui-window.vala:210
msgid "Current keyboard color: "
msgstr ""
#: src/cli.vala:497
#: src/cli.vala:609
msgid "Usage:"
msgstr ""
#: src/cli.vala:497
#: src/cli.vala:609
msgid "COMMAND [SUBCOMMAND]"
msgstr ""
#: src/cli.vala:498
#: src/cli.vala:610
msgid "Print the version of tuf-cli\n"
msgstr ""
#: src/cli.vala:499
#: src/cli.vala:611
msgid "Show this help screen\n"
msgstr ""
#: src/cli.vala:500
#: src/cli.vala:612
msgid "Set the fan mode\n"
msgstr ""
#: src/cli.vala:501
#: src/cli.vala:613
msgid "Set the keyboard lighting\n"
msgstr ""
#: src/cli.vala:502
#: src/cli.vala:614
msgid "Set the keyboard lighting speed\n"
msgstr ""
#: src/cli.vala:503
#: src/cli.vala:615
msgid "Set the keyboard color\n"
msgstr ""
#: src/cli.vala:504
#: src/cli.vala:616
msgid ""
"Restore saved settings\n"
"\n"
msgstr ""
#: src/cli.vala:617
msgid ""
"Show the current config\n"
"\n"
msgstr ""
#: src/cli.vala:505
#: src/cli.vala:618
msgid "Examples:\n"
msgstr ""
#: src/cli.vala:506
#: src/cli.vala:619
msgid "Silence fan:"
msgstr ""
#: src/cli.vala:507
#: src/cli.vala:620
msgid "Change RGB color:"
msgstr ""
#: src/common.vala:41 src/common.vala:64 src/common.vala:79 src/common.vala:82
#: src/common.vala:97 src/common.vala:100 src/common.vala:114
#: src/common.vala:117 src/common.vala:132 src/common.vala:135
#: src/common.vala:149 src/common.vala:152 src/common.vala:167
#: src/common.vala:170 src/common.vala:184 src/common.vala:187
#: src/common.vala:202 src/common.vala:205 src/gui-window.vala:79
#: src/main.vala.in:31 src/server.vala:44 src/server.vala:140
#: src/server.vala:201 src/server.vala:204 src/server.vala:212
#: src/server.vala:215 src/server.vala:321 src/server.vala:324
#: src/server.vala:332 src/server.vala:335 src/server.vala:447
#: src/server.vala:450 src/server.vala:458 src/server.vala:461
#: src/server.vala:559 src/server.vala:562 src/server.vala:570
#: src/server.vala:573 src/server-main.vala:68 src/server-main.vala:88
#, c-format
msgid "Error: %s\n"
msgstr ""
#: src/common.vala:50
msgid "The server and client versions do not match!"
msgstr ""
#: src/gui-window.vala:86
#: src/gui-window.vala:98
msgid "The current running tuf-server version doesn't match the GUI version!"
msgstr ""
#: src/gui-window.vala:109
msgid "Could not get current fan mode!"
msgstr ""
#: src/gui-window.vala:122 src/gui-window.vala:175
#: src/gui-window.vala:139 src/gui-window.vala:192
msgid "Current keyboard mode: "
msgstr ""
#: src/gui-window.vala:125
msgid "Could not get current keyboard mode!"
msgstr ""
#: src/gui-window.vala:135
msgid "Could not get current keyboard speed!"
msgstr ""
#: src/main.vala.in:34
msgid "Another instance of TUF Manager is already running!\n"
#: src/main.vala.in:34 src/tray-main.vala:39
msgid "Another instance of TUF Manager is already running!"
msgstr ""
#: src/server.vala:50
msgid "Could not register service!\n"
msgid "Could not register service!"
msgstr ""
#: src/server.vala:166 src/server.vala:238 src/server.vala:264
@ -244,23 +216,65 @@ msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
#: src/server-main.vala:92
msgid "Could not create pid file!\n"
msgid "Could not create pid file!"
msgstr ""
#: src/server-main.vala:122
msgid "Could not acquire bus name!\n"
msgid "Could not acquire bus name!"
msgstr ""
#: data/tuf-manager.desktop.in:4 data/tuf-manager.desktop.in:5
#: data/ui/tuf.manager.window.ui:41
#: src/tray-icon.vala:80 src/tray-icon.vala:117 src/tray-icon.vala:127
#: src/tray-icon.vala:276 data/tuf-manager.desktop.in:4
#: data/tuf-manager.desktop.in:5 data/tuf-tray.desktop.in:3
#: data/tuf-tray.desktop.in:4 data/ui/tuf.manager.window.ui:41
msgid "TUF Manager"
msgstr ""
#: data/tuf-manager.desktop.in:6
msgid "Softare to manage the fan mode and rgb keyboard."
#: src/tray-icon.vala:84
msgid "_TUF Manager"
msgstr ""
#: data/tuf-manager.desktop.in:7
#: src/tray-icon.vala:89
msgid "_Fan"
msgstr ""
#: src/tray-icon.vala:95
msgid "_Balanced"
msgstr ""
#: src/tray-icon.vala:99
msgid "_Turbo"
msgstr ""
#: src/tray-icon.vala:103
msgid "_Silent"
msgstr ""
#: src/tray-icon.vala:108
msgid "_Quit"
msgstr ""
#: src/tray-icon.vala:172
msgid "Fan set to balanced"
msgstr ""
#: src/tray-icon.vala:175
msgid "Fan set to turbo"
msgstr ""
#: src/tray-icon.vala:178
msgid "Fan set to silent"
msgstr ""
#: src/tray-icon.vala:278
msgid "Close"
msgstr ""
#: data/tuf-manager.desktop.in:6 data/tuf-tray.desktop.in:5
msgid "Softare to manage the fan mode and rgb keyboard"
msgstr ""
#: data/tuf-manager.desktop.in:7 data/tuf-tray.desktop.in:6
msgid "tuf-manager"
msgstr ""
@ -270,34 +284,39 @@ msgid "Should TUF Manager restore previous settings when run?"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:12
msgid "Fan mode"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:13
msgid "The saved fan mode"
msgid "Should TUF Manager show notifications?"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:19
msgid "Keyboard mode"
msgid "Fan mode"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:20
msgid "The saved keyboard mode"
msgid "The saved fan mode"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:26
msgid "Keyboard speed"
msgid "Keyboard mode"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:27
msgid "The saved keyboard speed"
msgid "The saved keyboard mode"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:33
msgid "Keyboard color"
msgid "Keyboard speed"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:34
msgid "The saved keyboard speed"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:40
msgid "Keyboard color"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:41
msgid "The saved keyboard color in RGB format"
msgstr ""
@ -305,62 +324,74 @@ msgstr ""
msgid "Authentication is required"
msgstr ""
#: data/ui/tuf.manager.window.ui:73 data/ui/tuf.manager.window.ui:212
#: data/ui/tuf.manager.window.ui:76 data/ui/tuf.manager.window.ui:217
msgid "Mode"
msgstr ""
#: data/ui/tuf.manager.window.ui:91
#: data/ui/tuf.manager.window.ui:94
msgid "Static"
msgstr ""
#: data/ui/tuf.manager.window.ui:92
#: data/ui/tuf.manager.window.ui:95
msgid "Breathing"
msgstr ""
#: data/ui/tuf.manager.window.ui:93
#: data/ui/tuf.manager.window.ui:96
msgid "Color Cycle"
msgstr ""
#: data/ui/tuf.manager.window.ui:94
#: data/ui/tuf.manager.window.ui:97
msgid "Strobing"
msgstr ""
#: data/ui/tuf.manager.window.ui:112
#: data/ui/tuf.manager.window.ui:115
msgid "Speed"
msgstr ""
#: data/ui/tuf.manager.window.ui:130
#: data/ui/tuf.manager.window.ui:133
msgid "Slow"
msgstr ""
#: data/ui/tuf.manager.window.ui:131
#: data/ui/tuf.manager.window.ui:134
msgid "Medium"
msgstr ""
#: data/ui/tuf.manager.window.ui:132
#: data/ui/tuf.manager.window.ui:135
msgid "Fast"
msgstr ""
#: data/ui/tuf.manager.window.ui:162
#: data/ui/tuf.manager.window.ui:165
msgid "Set color"
msgstr ""
#: data/ui/tuf.manager.window.ui:187
#: data/ui/tuf.manager.window.ui:190
msgid "Keyboard lighting"
msgstr ""
#: data/ui/tuf.manager.window.ui:230
#: data/ui/tuf.manager.window.ui:235
msgid "Balanced"
msgstr ""
#: data/ui/tuf.manager.window.ui:231
#: data/ui/tuf.manager.window.ui:236
msgid "Turbo"
msgstr ""
#: data/ui/tuf.manager.window.ui:232
#: data/ui/tuf.manager.window.ui:237
msgid "Silent"
msgstr ""
#: data/ui/tuf.manager.window.ui:250
#: data/ui/tuf.manager.window.ui:255
msgid "Fan control"
msgstr ""
#: data/ui/tuf.manager.window.ui:281
msgid "Restore on start"
msgstr ""
#: data/ui/tuf.manager.window.ui:313
msgid "Notifications"
msgstr ""
#: data/ui/tuf.manager.window.ui:345
msgid "Settings"
msgstr ""

View File

@ -23,7 +23,7 @@ namespace TUFManager {
/**
* This class contains the app that runs on the command line
*/
public class TUFManagerApp : Application {
public class TUFManagerApp : Gtk.Application {
#if ALWAYS_AUTHENTICATED
#else
/**
@ -95,6 +95,11 @@ namespace TUFManager {
*/
private bool invalid = false;
/**
* This flag is set if the user wants to restore saved settings
*/
private bool restore = false;
/**
* This flag is set if the user wants to see help
*/
@ -183,7 +188,9 @@ namespace TUFManager {
connect_tuf_server ();
}
catch (TUFError e) {
command_line.printerr (_ ("Error: ") + e.message + "\n");
warning (e.message);
this.release ();
return 1;
}
string[] args = command_line.get_arguments ();
@ -203,6 +210,10 @@ namespace TUFManager {
help = true;
check_second_argument (args);
break;
case "restore":
restore = true;
check_second_argument (args);
break;
case "info":
info = true;
check_second_argument (args);
@ -290,7 +301,7 @@ namespace TUFManager {
}
}
catch (RegexError e) {
command_line.printerr (_ ("Error: ") + e.message + "\n");
warning (e.message);
}
finally {
rgba = Gdk.RGBA ();
@ -317,11 +328,22 @@ namespace TUFManager {
}
if (invalid) {
command_line.printerr (_ ("Invalid arguments!\n\n"));
warning (_ ("Invalid arguments!"));
print_usage (command_line);
release_cli ();
return 1;
}
else if (restore) {
if (settings.get_boolean ("restore")) {
restore_settings ();
return 0;
}
else {
warning (_ ("Restore settings is currently disabled, please enable it to use this feature!"));
release_cli ();
return 1;
}
}
else if (version) {
command_line.print (_ ("Version: ") + VERSION + "\n");
release_cli ();
@ -347,7 +369,7 @@ namespace TUFManager {
command_line.print (_ ("Current fan mode: ") + _ ("Silent\n"));
break;
default:
command_line.printerr (_ ("Error: ") + _ ("Could not get current fan mode!\n"));
warning (_ ("Could not get current fan mode!"));
break;
}
current_setting = get_keyboard_mode ();
@ -365,7 +387,7 @@ namespace TUFManager {
command_line.print (_ ("Current keyboard lighting: ") + _ ("Strobing\n"));
break;
default:
command_line.printerr (_ ("Error: ") + _ ("Could not get current keyboard mode!\n"));
warning (_ ("Could not get current keyboard mode!"));
break;
}
current_setting = get_keyboard_speed ();
@ -380,7 +402,7 @@ namespace TUFManager {
command_line.print (_ ("Current keyboard speed: ") + _ ("Fast\n"));
break;
default:
command_line.printerr (_ ("Error: ") + _ ("Could not get current keyboard speed!\n"));
warning (_ ("Could not get current keyboard speed!"));
break;
}
var current_color = get_keyboard_color ();
@ -411,7 +433,7 @@ namespace TUFManager {
});
}
catch (Error e) {
command_line.printerr (_ ("Error: ") + e.message + "\n");
warning (e.message);
}
#endif
@ -436,7 +458,7 @@ namespace TUFManager {
});
}
catch (Error e) {
command_line.printerr (_ ("Error: ") + e.message + "\n");
warning (e.message);
}
#endif
return 0;
@ -460,7 +482,7 @@ namespace TUFManager {
});
}
catch (Error e) {
command_line.printerr (_ ("Error: ") + e.message + "\n");
warning (e.message);
}
#endif
return 0;
@ -482,7 +504,7 @@ namespace TUFManager {
});
}
catch (Error e) {
command_line.printerr (_ ("Error: ") + e.message + "\n");
warning (e.message);
}
#endif
return 0;
@ -490,6 +512,82 @@ namespace TUFManager {
return 0;
}
private void restore_settings () {
#if ALWAYS_AUTHENTICATED
var mode = settings.get_int ("fan-mode");
if (mode >= 0 && mode <= 2) {
if (get_fan_mode () != mode) {
set_fan_mode (mode);
}
}
mode = settings.get_int ("keyboard-mode");
if (mode >= 0 && mode <= 3) {
if (get_keyboard_mode () != mode) {
set_keyboard_mode (mode);
}
}
var speed = settings.get_int ("keyboard-speed");
if (speed >= 0 && speed <= 2) {
if (get_keyboard_speed () != speed) {
set_keyboard_speed (speed);
}
}
tuf_server.procedure_finished.connect (release_cli);
var color = settings.get_string ("keyboard-color");
var rgba = Gdk.RGBA ();
rgba.parse (color);
if (!get_keyboard_color ().equal (rgba)) {
set_keyboard_color (rgba);
}
else {
release_cli ();
}
#else
try {
pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE);
Timeout.add_seconds (10, () => {
tuf_server.procedure_finished.connect (release_cli);
var mode = settings.get_int ("fan-mode");
if (mode >= 0 && mode <= 2) {
if (get_fan_mode () != mode) {
set_fan_mode (mode);
}
}
mode = settings.get_int ("keyboard-mode");
if (mode >= 0 && mode <= 3) {
if (get_keyboard_mode () != mode) {
set_keyboard_mode (mode);
}
}
var speed = settings.get_int ("keyboard-speed");
if (speed >= 0 && speed <= 2) {
if (get_keyboard_speed () != speed) {
set_keyboard_speed (speed);
}
}
tuf_server.procedure_finished.connect (release_cli);
var color = settings.get_string ("keyboard-color");
var rgba = Gdk.RGBA ();
rgba.parse (color);
if (!get_keyboard_color ().equal (rgba)) {
set_keyboard_color (rgba);
}
return false;
});
}
catch (Error e) {
warning (e.message);
}
#endif
}
/**
* If there are more arguments than there should be we need to invalidate
* TODO: Change this to something better later
@ -515,6 +613,7 @@ namespace TUFManager {
command_line.print (" lighting [static, breath, cycle, stobe] " + _ ("Set the keyboard lighting\n"));
command_line.print (" speed [slow, medium, fast] " + _ ("Set the keyboard lighting speed\n"));
command_line.print (" color [\"#XXXXXX\"] " + _ ("Set the keyboard color\n"));
command_line.print (" restore " + _ ("Restore saved settings\n\n"));
command_line.print (" info " + _ ("Show the current config\n\n"));
command_line.print (_ ("Examples:\n"));
command_line.print (" " + _ ("Silence fan:") + " tuf-cli fan silent\n");

View File

@ -38,7 +38,7 @@ namespace TUFManager {
tuf_server = Bus.get_proxy_sync (BusType.SYSTEM, "org.tuf.manager.server", "/org/tuf/manager/server");
}
catch (IOError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
string? server_version = get_server_version ();
@ -61,7 +61,7 @@ namespace TUFManager {
return tuf_server.get_server_version ();
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
return null;
}
@ -76,10 +76,10 @@ namespace TUFManager {
return tuf_server.get_fan_mode ();
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
return -3;
}
@ -94,10 +94,10 @@ namespace TUFManager {
tuf_server.set_fan_mode (mode, bus_name);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
}
@ -111,10 +111,10 @@ namespace TUFManager {
return tuf_server.get_keyboard_color ();
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
return Gdk.RGBA ();
}
@ -129,10 +129,10 @@ namespace TUFManager {
tuf_server.set_keyboard_color (color, bus_name);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
}
@ -146,10 +146,10 @@ namespace TUFManager {
return tuf_server.get_keyboard_mode ();
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
return -3;
}
@ -164,10 +164,10 @@ namespace TUFManager {
tuf_server.set_keyboard_mode (mode, bus_name);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
}
@ -181,10 +181,10 @@ namespace TUFManager {
return tuf_server.get_keyboard_speed ();
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
return -3;
}
@ -199,10 +199,10 @@ namespace TUFManager {
tuf_server.set_keyboard_speed (speed, bus_name);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
}
}

View File

@ -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
@ -76,7 +88,7 @@ namespace TUFManager {
connect_tuf_server ();
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
if (e.code == TUFError.UNMATCHED_VERSIONS) {
Gtk.MessageDialog msg;
msg = new Gtk.MessageDialog (this,
@ -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 {
@ -106,7 +123,7 @@ namespace TUFManager {
print (_ ("Current fan mode: ") + fan_mode.get_active_text () + "\n");
}
else {
stderr.printf ("%s\n", _ ("Error: ") + _ ("Could not get current fan mode!"));
warning (_ ("Could not get current fan mode!"));
}
// Get the keyboard mode
@ -122,7 +139,7 @@ namespace TUFManager {
print (_ ("Current keyboard mode: ") + keyboard_mode.get_active_text () + "\n");
}
else {
stderr.printf ("%s\n", _ ("Error: ") + _ ("Could not get current keyboard mode!"));
warning (_ ("Could not get current keyboard mode!"));
}
// Get the keyboard speed
@ -132,7 +149,7 @@ namespace TUFManager {
print (_ ("Current keyboard speed: ") + keyboard_speed.get_active_text () + "\n");
}
else {
stderr.printf ("%s\n", _ ("Error: ") + _ ("Could not get current keyboard speed!"));
warning (_ ("Could not get current keyboard speed!"));
}
// Get the keyboard color
@ -149,7 +166,7 @@ namespace TUFManager {
* Used to restore the previous config from donf
* TODO: Move this to a status bar app and/or user daemon
*/
public void restore () {
private void restore () {
var mode = settings.get_int ("fan-mode");
if (mode >= 0 && mode <= 2) {
if (get_fan_mode () != mode) {
@ -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;
}
}
}
}

View File

@ -28,10 +28,10 @@ namespace TUFManager {
application.register ();
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
if (application.get_is_remote ()) {
stderr.printf (_ ("Error: ") + _ ("Another instance of TUF Manager is already running!\n"));
warning (_ ("Another instance of TUF Manager is already running!"));
return -1;
}
return application.run (args);

View File

@ -1,31 +1,60 @@
glib_dep = dependency('glib-2.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)
gio_unix_dep = dependency('gio-unix-2.0')
if not always_authenticated
polkit_gobject_dep = dependency('polkit-gobject-1')
endif
if build_gui
gobject_dep = dependency('gobject-2.0')
gmodule_dep = dependency('gmodule-2.0') # gmodule-export-2.0 is needed to connect the handlers from glade ui
if build_tray
appindicator_dep = dependency('appindicator3-0.1')
libnotify_dep = dependency('libnotify')
endif
endif
server_dependencies = [
dependency('glib-2.0'),
dependency('gio-unix-2.0'),
dependency('gtk+-3.0', version: '>=3.0.0'),
meson.get_compiler('c').find_library('m', required: true),
meson.get_compiler('vala').find_library('posix')
glib_dep,
gio_unix_dep,
gtk_dep,
m_dep,
posix_dep
]
# if not always authenticated then polkit will be used for authentication
if not always_authenticated
server_dependencies += [dependency('polkit-gobject-1')]
server_dependencies += [polkit_gobject_dep]
endif
if build_cli
cli_dependencies = [
dependency('glib-2.0'),
dependency('gtk+-3.0', version: '>=3.0.0'),
meson.get_compiler('c').find_library('m', required: true)
glib_dep,
gtk_dep,
m_dep
]
endif
if build_gui
gui_dependencies = [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('gtk+-3.0', version: '>=3.10.0'),
dependency('gmodule-2.0', version: '>=2.0') # gmodule-export-2.0 is needed to connect the handlers from glade ui
glib_dep,
gobject_dep,
gtk_dep,
gmodule_dep # gmodule-export-2.0 is needed to connect the handlers from glade ui
]
if build_tray
tray_dependencies = [
appindicator_dep,
gtk_dep,
libnotify_dep,
posix_dep
]
endif
endif
config_data = configuration_data()
@ -69,6 +98,12 @@ server_vala_sources_main = files(
'server-main.vala'
)
if build_tray
tray_vala_sources_main = files(
'tray-main.vala'
)
endif
server_vala_sources = files(
'server.vala',
'server-interface.vala'
@ -89,6 +124,15 @@ if build_gui
'server-interface.vala',
'common.vala'
)
if build_tray
tray_vala_sources = files(
'tray.vala',
'tray-icon.vala',
'server-interface.vala',
'common.vala'
)
endif
endif
server_sources = server_vala_sources
@ -109,6 +153,13 @@ if build_gui
gui_sources += error_vala_sources
gui_sources += [tuf_manager_gresource]
gui_sources += config_data_file
if build_tray
tray_sources = tray_vala_sources
tray_sources += tray_vala_sources_main
tray_sources += error_vala_sources
tray_sources += config_data_file
endif
endif
server_vala_args = []
@ -154,4 +205,13 @@ if build_gui
vala_args: gui_vala_args,
install: true
)
if build_tray
tray_exe = executable(
'tuf-tray',
tray_sources,
dependencies: tray_dependencies,
install: true
)
endif
endif

View File

@ -65,7 +65,7 @@ namespace TUFManager {
opt_context.parse (ref args);
}
catch (OptionError e) {
print (_ ("Error: %s\n"), e.message);
warning (e.message);
print (_ ("Run '%s --help' to see a full list of available command line options.\n"), args[0]);
return 1;
}
@ -85,11 +85,11 @@ namespace TUFManager {
file = null;
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
var stream = FileStream.open ("/run/tufmanager/pid", "w");
if (stream == null) {
stderr.printf (_ ("Error: ") + _ ("Could not create pid file!\n"));
warning (_ ("Could not create pid file!"));
}
else {
uint32 pidfile = pid;
@ -119,7 +119,7 @@ namespace TUFManager {
on_bus_acquired,
() => {},
() => {
stderr.printf (_ ("Error: ") + _ ("Could not acquire bus name!\n"));
warning (_ ("Could not acquire bus name!"));
});
loop = new MainLoop ();

View File

@ -41,13 +41,13 @@ namespace TUFManager {
tuf_server = new TUFManager.Server.TUFServer ();
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
try {
conn.register_object ("/org/tuf/manager/server", tuf_server);
}
catch (IOError e) {
stderr.printf (_ ("Error: ") + _ ("Could not register service!\n"));
warning (_ ("Could not register service!"));
if (loop != null) {
loop.quit ();
}
@ -137,7 +137,7 @@ namespace TUFManager {
authorized = result.get_is_authorized ();
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
return authorized;
#endif
@ -198,10 +198,10 @@ namespace TUFManager {
authorized = get_authorization.end (res);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
if (authorized) {
@ -209,10 +209,10 @@ namespace TUFManager {
set_fan_mode_authorized (mode, sender);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
}
else {
@ -318,10 +318,10 @@ namespace TUFManager {
authorized = get_authorization.end (res);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
if (authorized) {
@ -329,10 +329,10 @@ namespace TUFManager {
set_keyboard_color_authorized (color, sender);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
}
else {
@ -444,10 +444,10 @@ namespace TUFManager {
authorized = get_authorization.end (res);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
if (authorized) {
@ -455,10 +455,10 @@ namespace TUFManager {
set_keyboard_mode_authorized (mode, sender);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
}
else {
@ -556,10 +556,10 @@ namespace TUFManager {
authorized = get_authorization.end (res);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
if (authorized) {
@ -567,10 +567,10 @@ namespace TUFManager {
set_keyboard_speed_authorized (speed, sender);
}
catch (TUFError e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
catch (Error e) {
stderr.printf (_ ("Error: %s\n"), e.message);
warning (e.message);
}
}
else {

311
src/tray-icon.vala Normal file
View File

@ -0,0 +1,311 @@
/*
* Copyright 2020 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* The TUF Manager namespace
*/
namespace TUFManager {
/**
* The tray namespace handles everything related to the system tray
*/
namespace Tray {
/**
* The parent is needed to shutdown properly
*/
private TUFManagerApp parent;
/**
* Polling the fan state is launched in a background thread
*/
private Thread<void>? thread = null;
/**
* Keep polling while true
*/
private bool poll = true;
/**
* The tray icon class
*/
public class TrayIcon {
/*
* The indication shown in the taskbar
*/
private AppIndicator.Indicator indicator;
/**
* Notifications
*/
private Notify.Notification notification;
/**
* The current icon theme
*/
private Gtk.IconTheme icon_theme;
/**
* The settings object from gschema/dconf
*/
private Settings settings;
/**
* Start our tray icon
*/
public TrayIcon () {
Process.signal (ProcessSignal.INT, on_exit);
Process.signal (ProcessSignal.TERM, on_exit);
settings = new Settings ("org.tuf.manager");
try {
connect_tuf_server ();
}
catch (TUFError e) {
warning (e.message);
}
icon_theme = Gtk.IconTheme.get_default ();
icon_theme.changed.connect (on_icon_theme_changed);
indicator = new AppIndicator.Indicator (_ ("TUF Manager"), "tuf-manager", AppIndicator.IndicatorCategory.APPLICATION_STATUS);
indicator.set_status (AppIndicator.IndicatorStatus.ACTIVE);
var menu = new Gtk.Menu ();
var item = new Gtk.MenuItem.with_mnemonic (_ ("_TUF Manager"));
item.activate.connect (execute_manager);
menu.append (item);
// Submenu fan
item = new Gtk.MenuItem.with_mnemonic (_ ("_Fan"));
menu.append (item);
var submenu = new Gtk.Menu ();
item.set_submenu (submenu);
// Fan modes
var subitem = new Gtk.MenuItem.with_mnemonic (_ ("_Balanced"));
subitem.activate.connect (set_fan_balanced);
submenu.append (subitem);
subitem = new Gtk.MenuItem.with_mnemonic (_ ("_Turbo"));
subitem.activate.connect (set_fan_turbo);
submenu.append (subitem);
subitem = new Gtk.MenuItem.with_mnemonic (_ ("_Silent"));
subitem.activate.connect (set_fan_silent);
submenu.append (subitem);
// Quit
item = new Gtk.MenuItem.with_mnemonic (_ ("_Quit"));
item.activate.connect (quit);
menu.append (item);
menu.show_all ();
indicator.set_menu (menu);
indicator.set_icon_full ("tuf-manager", "tuf-manager");
indicator.set_title (_ ("TUF Manager"));
set_icon_visible (true);
Timeout.add_seconds (30, () => {
indicator.set_status (AppIndicator.IndicatorStatus.ACTIVE);
show_notification ("TUF Manager started");
close_notification ();
return false;
});
Notify.init (_ ("TUF Manager"));
if (settings.get_boolean ("restore")) {
restore ();
}
thread = new Thread<void> ("poll_fan", this.poll_fan);
}
/**
* This is called if the user clicks quit or presses q
*/
private void quit () {
on_exit (ProcessSignal.TERM);
}
/**
* Time to exit, let's cleanup first
*/
private static void on_exit (int signum) {
poll = false;
if (thread != null) {
thread.join ();
}
parent.release () ;
}
/**
* Poll the fan mode for changes, they notify user if enabled
*/
private void poll_fan () {
int ret;
Posix.pollfd[] fan_fd = {};
fan_fd += Posix.pollfd ();
fan_fd[0].fd = Posix.open (THERMAL_PATH, Posix.O_RDONLY);
fan_fd[0].events = Posix.POLLERR | Posix.POLLPRI;
Posix.read (fan_fd[0].fd, null, 1);
string content = "";
while (poll) {
ret = Posix.poll (fan_fd, 1000);
if (ret > 0) {
Posix.read (fan_fd[0].fd, content, 1);
Posix.lseek (fan_fd[0].fd, Posix.SEEK_SET, 0);
int mode = int.parse (content);
if (mode == 0) {
show_notification (_ ("Fan set to balanced"));
}
else if (mode == 1) {
show_notification (_ ("Fan set to turbo"));
}
else if (mode == 2) {
show_notification (_ ("Fan set to silent"));
}
}
}
}
/**
* Launch TUF Manager GUI if the user clicks the options or presses t
*/
private void execute_manager () {
try {
Process.spawn_command_line_async ("tuf-gui");
}
catch (SpawnError e) {
warning (e.message);
}
}
/**
* If the user clicks balanced or presses b
*/
private void set_fan_balanced () {
set_fan_mode (0);
settings.set_int ("fan-mode", 0);
}
/**
* If the user clicks turbo or presses t
*/
private void set_fan_turbo () {
set_fan_mode (1);
settings.set_int ("fan-mode", 1);
}
/**
* If the user clicks silent or presses s
*/
private void set_fan_silent () {
set_fan_mode (2);
settings.set_int ("fan-mode", 2);
}
/**
* Called to restore settings when the tray icon runs
*/
private void restore () {
var mode = settings.get_int ("fan-mode");
if (mode >= 0 && mode <= 2) {
if (get_fan_mode () != mode) {
set_fan_mode (mode);
}
}
mode = settings.get_int ("keyboard-mode");
if (mode >= 0 && mode <= 3) {
if (get_keyboard_mode () != mode) {
set_keyboard_mode (mode);
}
}
var speed = settings.get_int ("keyboard-speed");
if (speed >= 0 && speed <= 2) {
if (get_keyboard_speed () != speed) {
set_keyboard_speed (speed);
}
}
var color = settings.get_string ("keyboard-color");
var rgba = Gdk.RGBA ();
rgba.parse (color);
if (!get_keyboard_color ().equal (rgba)) {
set_keyboard_color (rgba);
}
}
/**
* Set the tray icon visible or invisible
*
* @param visible Set to true to make the icon visible
*/
private void set_icon_visible (bool visible) {
if (visible) {
indicator.set_status (AppIndicator.IndicatorStatus.ACTIVE);
}
else {
indicator.set_status (AppIndicator.IndicatorStatus.PASSIVE);
}
}
/**
* Show a notification message to the user
*
* @param message The message to show
*/
private void show_notification (string 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", _ ("Close"), close_notification);
notification.show ();
}
catch (Error e) {
warning (e.message);
}
}
}
/**
* Close the currently displayed notification
*/
private void close_notification () {
try {
if (notification != null && notification.get_closed_reason () == -1) {
notification.close ();
notification = null;
}
}
catch (Error e) {
warning (e.message);
}
}
/**
* If the user changes his icon them, update our icon accordingly
*/
private void on_icon_theme_changed () {
icon_theme = Gtk.IconTheme.get_default ();
indicator.set_icon_full ("tuf-manager", "tuf-manager");
}
}
}
}

45
src/tray-main.vala Normal file
View File

@ -0,0 +1,45 @@
/*
* Copyright 2020 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* The TUF Manager namespace
*/
namespace TUFManager {
/**
* The server namespace contains anything releated to working as a dbus daemon
* and handling root related tasks
*/
namespace Tray {
/**
* The entry point to the tray icon
*
* @param args Arguments passed from the command line
* @return Returns 0 on success
*/
public static int main (string[] args) {
var application = new Tray.TUFManagerApp ();
try {
application.register ();
}
catch (Error e) {
warning (e.message);
}
if (application.get_is_remote ()) {
warning (_ ("Another instance of TUF Manager is already running!"));
return -1;
}
return application.run ();
}
}
}

55
src/tray.vala Normal file
View File

@ -0,0 +1,55 @@
/*
* Copyright 2020 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* The TUF Manager namespace
*/
namespace TUFManager {
/**
* The tray namespace handles everything related to the system tray
*/
namespace Tray {
/**
* The tray application
*/
public class TUFManagerApp : Gtk.Application {
/**
* The tray application we set a different application_id
*/
public TUFManagerApp () {
application_id = "cl.cromer.tuf.manager.tray";
}
/**
* Activate the application
*/
public override void activate () {
parent = this;
new TrayIcon ();
}
/**
* Set the translation and hold the application until the user quits
*/
public override void startup () {
Intl.textdomain ("tuf-manager");
Intl.setlocale (LocaleCategory.ALL, "");
base.startup ();
this.hold ();
}
}
}
}