Compare commits

..

No commits in common. "master" and "1.0.0" have entirely different histories.

37 changed files with 473 additions and 1353 deletions

View File

@ -18,18 +18,14 @@ To build TUF Manager the following is needed:
- valadoc - valadoc
- glib - glib
- gtk3 - gtk3
- gio-unix
- gobject
- dbus - dbus
- polkit - polkit
- polkit-gobject - polkit-gobject
- gmodule-export - gmodule-export
- libnotify
- libappindicator3
## Other requirements ## Other requirements
This software will only work if using the [hackbnw/faustus](https://github.com/hackbnw/faustus) driver module. This software will only work if using the [faustus](https://github.com/hackbnw/faustus) driver module.
## Build options ## Build options
@ -49,36 +45,44 @@ Build the cli interface.
Build the gui interface. Build the gui interface.
- build-tray
Build the tray icon
- always-authenticated - 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. 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 ## Usage
There are 3 programs and 1 daemon supplied by TUF Manager. There are 2 programs and 1 daemon supplied by TUF Manager.
- tuf-cli - tuf-cli
This allows controlling the TUF laptop functions via command line interface. This allows controlling the TUF laptop functions via command line interface.
- tuf-gui - tuf-gui
This supplies a graphical interface to control the TUF laptop. This supplies a graphical interface to control the TUF laptop.
- tuf-server - tuf-server
This is the daemon that runs in the background and handles all requests from both tuf-cli and tuf-gui. This is the daemon that runs in the background and handles all requests from both tuf-cli and tuf-gui.
- tuf-tray ## Future plans
This is the tray icon to control the TUF Manager program. It should automatically start in any desktop environment that supports xdg. - Manpage
- Config options for both tuf-gui and tuf-cli
## Notes - Status bar icon that allows control of the notebook
- Notifications of fan mode change via status bar
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. - Restore last known settings on login via status bar icon
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.

4
contrib/meson.build Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,19 +1,12 @@
<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>true</default> <default>false</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>

View File

@ -1,15 +0,0 @@
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

View File

@ -1,36 +0,0 @@
.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>

View File

@ -1,16 +0,0 @@
.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>

View File

@ -1,15 +0,0 @@
.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,17 +7,6 @@ if build_gui
install: true, install: true,
install_dir: join_paths(get_option('datadir'), 'applications') 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 endif
subdir('dbus') subdir('dbus')
@ -25,8 +14,3 @@ subdir('polkit')
subdir('ui') subdir('ui')
subdir('icons') subdir('icons')
subdir('gschema') subdir('gschema')
subdir('man')
subdir('openrc')
subdir('runit')
subdir('s6')
subdir('systemd')

View File

@ -2,8 +2,8 @@
Type=Application Type=Application
Name=TUF Manager Name=TUF Manager
GenericName=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 Icon=tuf-manager
StartupNotify=true StartupNotify=true
Exec=tuf-gui Exec=tuf-gui
Categories=System;Settings; Categories=System;

View File

@ -1,10 +0,0 @@
[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"> <interface domain="tuf-manager">
<requires lib="gtk+" version="3.14"/> <requires lib="gtk+" version="3.10"/>
<!-- 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,9 +57,6 @@ 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>
@ -199,8 +196,6 @@ 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>
@ -260,94 +255,10 @@ Author: Chris Cromer
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkGrid"> <placeholder/>
<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">
<object class="GtkLabel"> <placeholder/>
<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>

View File

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

View File

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

View File

@ -22,15 +22,33 @@ option(
value: true, value: true,
description: 'Build the graphical user interface to TUF Manager' 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( option(
'always-authenticated', 'always-authenticated',
type : 'boolean', type : 'boolean',
value: true, value: true,
description: 'User is always authenticated, so no password is necessary' 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,11 +8,7 @@ src/main.vala.in
src/server.vala src/server.vala
src/server-interface.vala src/server-interface.vala
src/server-main.vala src/server-main.vala
src/tray.vala
src/tray-icon.vala
src/tray-main.vala
data/tuf-manager.desktop.in data/tuf-manager.desktop.in
data/tuf-tray.desktop.in
data/gschema/org.tuf.manager.gschema.xml data/gschema/org.tuf.manager.gschema.xml
data/polkit/org.tuf.manager.policy.in data/polkit/org.tuf.manager.policy.in
data/ui/tuf.manager.window.ui data/ui/tuf.manager.window.ui

285
po/es.po
View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: tuf-manager\n" "Project-Id-Version: tuf-manager\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-15 16:42-0400\n" "POT-Creation-Date: 2020-08-06 20:34-0400\n"
"PO-Revision-Date: 2020-08-07 21:51-0400\n" "PO-Revision-Date: 2020-08-06 20:37-0400\n"
"Last-Translator: Chris Cromer <chris@cromer.cl>\n" "Last-Translator: Chris Cromer <chris@cromer.cl>\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: es\n" "Language: es\n"
@ -19,140 +19,135 @@ msgstr ""
"X-Generator: Poedit 2.3\n" "X-Generator: Poedit 2.3\n"
"X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SourceCharset: UTF-8\n"
#: src/cli.vala:331 #: src/cli.vala:180 src/cli.vala:287 src/cli.vala:344 src/cli.vala:362
msgid "Invalid arguments!" #: src/cli.vala:377 src/cli.vala:406 src/cli.vala:429 src/cli.vala:451
msgstr "¡Argumentos invalidos!" #: 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:342 #: src/cli.vala:314
msgid "" msgid ""
"Restore settings is currently disabled, please enable it to use this feature!" "Invalid arguments!\n"
msgstr "" "\n"
"¡La restauración de la configuración está actualmente deshabilitada, " msgstr "¡Argumentos invalidos!\n"
"habilítela para usar esta función!"
#: src/cli.vala:348 #: src/cli.vala:320
msgid "Version: " msgid "Version: "
msgstr "Versión: " msgstr "Versión: "
#: src/cli.vala:358 src/gui-window.vala:107 #: src/cli.vala:330 src/gui-window.vala:95
msgid "Client version: " msgid "Client version: "
msgstr "Versión del cliente: " msgstr "Versión del cliente: "
#: src/cli.vala:359 src/gui-window.vala:108 #: src/cli.vala:331 src/gui-window.vala:96
msgid "Server version: " msgid "Server version: "
msgstr "Versión del servidor: " msgstr "Versión del servidor: "
#: src/cli.vala:363 src/cli.vala:366 src/cli.vala:369 src/gui-window.vala:123 #: src/cli.vala:335 src/cli.vala:338 src/cli.vala:341 src/gui-window.vala:106
#: src/gui-window.vala:177 #: src/gui-window.vala:160
msgid "Current fan mode: " msgid "Current fan mode: "
msgstr "Modo de ventilador actual: " msgstr "Modo de ventilador actual: "
#: src/cli.vala:363 #: src/cli.vala:335
msgid "Balanced\n" msgid "Balanced\n"
msgstr "Balanceada\n" msgstr "Balanceada\n"
#: src/cli.vala:366 #: src/cli.vala:338
msgid "Turbo\n" msgid "Turbo\n"
msgstr "Turbo\n" msgstr "Turbo\n"
#: src/cli.vala:369 #: src/cli.vala:341
msgid "Silent\n" msgid "Silent\n"
msgstr "Silenciosa\n" msgstr "Silenciosa\n"
#: src/cli.vala:372 src/gui-window.vala:126 #: src/cli.vala:344
msgid "Could not get current fan mode!" msgid "Could not get current fan mode!\n"
msgstr "¡No se pudo obtener el modo de ventilador actual!" msgstr "¡No se pudo obtener el modo de ventilador actual!\n"
#: src/cli.vala:378 src/cli.vala:381 src/cli.vala:384 src/cli.vala:387 #: src/cli.vala:350 src/cli.vala:353 src/cli.vala:356 src/cli.vala:359
msgid "Current keyboard lighting: " msgid "Current keyboard lighting: "
msgstr "Iluminación de teclado actual: " msgstr "Iluminación de teclado actual: "
#: src/cli.vala:378 #: src/cli.vala:350
msgid "Static\n" msgid "Static\n"
msgstr "Estática\n" msgstr "Estática\n"
#: src/cli.vala:381 #: src/cli.vala:353
msgid "Breathing\n" msgid "Breathing\n"
msgstr "Respiración\n" msgstr "Respiración\n"
#: src/cli.vala:384 #: src/cli.vala:356
msgid "Color Cycle\n" msgid "Color Cycle\n"
msgstr "Ciclo de Color\n" msgstr "Ciclo de Color\n"
#: src/cli.vala:387 #: src/cli.vala:359
msgid "Strobing\n" msgid "Strobing\n"
msgstr "Estroboscópica\n" msgstr "Estroboscópica\n"
#: src/cli.vala:390 src/gui-window.vala:142 #: src/cli.vala:362
msgid "Could not get current keyboard mode!" msgid "Could not get current keyboard mode!\n"
msgstr "¡No se pudo obtener el modo de teclado actual!" msgstr "¡No se pudo obtener el modo de teclado actual!\n"
#: src/cli.vala:396 src/cli.vala:399 src/cli.vala:402 src/gui-window.vala:149 #: src/cli.vala:368 src/cli.vala:371 src/cli.vala:374 src/gui-window.vala:132
#: src/gui-window.vala:201 #: src/gui-window.vala:184
msgid "Current keyboard speed: " msgid "Current keyboard speed: "
msgstr "Velocidad del teclado actual: " msgstr "Velocidad del teclado actual: "
#: src/cli.vala:396 #: src/cli.vala:368
msgid "Slow\n" msgid "Slow\n"
msgstr "Lenta\n" msgstr "Lenta\n"
#: src/cli.vala:399 #: src/cli.vala:371
msgid "Medium\n" msgid "Medium\n"
msgstr "Media\n" msgstr "Media\n"
#: src/cli.vala:402 #: src/cli.vala:374
msgid "Fast\n" msgid "Fast\n"
msgstr "Rapida\n" msgstr "Rapida\n"
#: src/cli.vala:405 src/gui-window.vala:152 #: src/cli.vala:377
msgid "Could not get current keyboard speed!" msgid "Could not get current keyboard speed!\n"
msgstr "¡No se pudo obtener la velocidad actual del teclado!" msgstr "¡No se pudo obtener la velocidad actual del teclado!\n"
#: src/cli.vala:414 src/gui-window.vala:158 src/gui-window.vala:210 #: src/cli.vala:386 src/gui-window.vala:141 src/gui-window.vala:193
msgid "Current keyboard color: " msgid "Current keyboard color: "
msgstr "Color de teclado actual: " msgstr "Color de teclado actual: "
#: src/cli.vala:609 #: src/cli.vala:497
msgid "Usage:" msgid "Usage:"
msgstr "Uso:" msgstr "Uso:"
#: src/cli.vala:609 #: src/cli.vala:497
msgid "COMMAND [SUBCOMMAND]" msgid "COMMAND [SUBCOMMAND]"
msgstr "COMANDO [SUBCOMANDO]" msgstr "COMANDO [SUBCOMANDO]"
#: src/cli.vala:610 #: src/cli.vala:498
msgid "Print the version of tuf-cli\n" msgid "Print the version of tuf-cli\n"
msgstr "Imprimir la versión del tuf-cli\n" msgstr "Imprimir la versión del tuf-cli\n"
#: src/cli.vala:611 #: src/cli.vala:499
msgid "Show this help screen\n" msgid "Show this help screen\n"
msgstr "Mostrar esta pantalla de ayuda\n" msgstr "Mostrar esta pantalla de ayuda\n"
#: src/cli.vala:612 #: src/cli.vala:500
msgid "Set the fan mode\n" msgid "Set the fan mode\n"
msgstr "Establecer el modo del ventilador:\n" msgstr "Establecer el modo del ventilador:\n"
#: src/cli.vala:613 #: src/cli.vala:501
msgid "Set the keyboard lighting\n" msgid "Set the keyboard lighting\n"
msgstr "Iluminación de teclado\n" msgstr "Iluminación de teclado\n"
#: src/cli.vala:614 #: src/cli.vala:502
msgid "Set the keyboard lighting speed\n" msgid "Set the keyboard lighting speed\n"
msgstr "Establecer la Iluminación de teclado\n" msgstr "Establecer la Iluminación de teclado\n"
#: src/cli.vala:615 #: src/cli.vala:503
msgid "Set the keyboard color\n" msgid "Set the keyboard color\n"
msgstr "Color del teclado\n" msgstr "Color del teclado\n"
#: src/cli.vala:616 #: src/cli.vala:504
msgid ""
"Restore saved settings\n"
"\n"
msgstr ""
"Restaurar configuraciones guardadas\n"
"\n"
#: src/cli.vala:617
msgid "" msgid ""
"Show the current config\n" "Show the current config\n"
"\n" "\n"
@ -160,37 +155,66 @@ msgstr ""
"Mostrar la configuración actual\n" "Mostrar la configuración actual\n"
"\n" "\n"
#: src/cli.vala:618 #: src/cli.vala:505
msgid "Examples:\n" msgid "Examples:\n"
msgstr "Ejemplos:\n" msgstr "Ejemplos:\n"
#: src/cli.vala:619 #: src/cli.vala:506
msgid "Silence fan:" msgid "Silence fan:"
msgstr "Silenciar ventilador:" msgstr "Silenciar ventilador:"
#: src/cli.vala:620 #: src/cli.vala:507
msgid "Change RGB color:" msgid "Change RGB color:"
msgstr "Cambiar el color RGB:" 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 #: src/common.vala:50
msgid "The server and client versions do not match!" msgid "The server and client versions do not match!"
msgstr "¡La versión del servidor y del cliente no coinciden!" msgstr "¡La versión del servidor y del cliente no coinciden!"
#: src/gui-window.vala:98 #: src/gui-window.vala:86
msgid "The current running tuf-server version doesn't match the GUI version!" 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!" msgstr "¡La versión actual de tuf-server no coincide con la versión de GUI!"
#: src/gui-window.vala:139 src/gui-window.vala:192 #: 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
msgid "Current keyboard mode: " msgid "Current keyboard mode: "
msgstr "Modo de teclado actual: " msgstr "Modo de teclado actual: "
#: src/main.vala.in:34 src/tray-main.vala:39 #: src/gui-window.vala:125
msgid "Another instance of TUF Manager is already running!" msgid "Could not get current keyboard mode!"
msgstr "¡Ya se está ejecutando otra instancia de Administrador TUF!" 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/server.vala:50 #: src/server.vala:50
msgid "Could not register service!" msgid "Could not register service!\n"
msgstr "¡No se pudo registrar el servicio!" msgstr "¡No se pudo registrar el servicio!\n"
#: src/server.vala:166 src/server.vala:238 src/server.vala:264 #: src/server.vala:166 src/server.vala:238 src/server.vala:264
#: src/server.vala:277 src/server.vala:290 src/server.vala:365 #: src/server.vala:277 src/server.vala:290 src/server.vala:365
@ -221,115 +245,64 @@ msgstr "Ejecuta el daemon en primer plano"
#: src/server-main.vala:69 #: src/server-main.vala:69
#, c-format #, c-format
msgid "Run '%s --help' to see a full list of available command line options.\n" msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr "" msgstr "Ejecute '% s --help' para ver una lista completa de las opciones de línea de comando disponibles.\n"
"Ejecute '% s --help' para ver una lista completa de las opciones de línea de "
"comando disponibles.\n"
#: src/server-main.vala:92 #: src/server-main.vala:92
msgid "Could not create pid file!" msgid "Could not create pid file!\n"
msgstr "¡No se pudo crear el archivo pid!" msgstr "¡No se pudo crear el archivo pid!\n"
#: src/server-main.vala:122 #: src/server-main.vala:122
msgid "Could not acquire bus name!" msgid "Could not acquire bus name!\n"
msgstr "¡No se pudo adquirir el bus name!" msgstr "¡No se pudo adquirir el bus name!\n"
#: src/tray-icon.vala:80 src/tray-icon.vala:117 src/tray-icon.vala:127 #: data/tuf-manager.desktop.in:4 data/tuf-manager.desktop.in:5
#: src/tray-icon.vala:276 data/tuf-manager.desktop.in:4 #: data/ui/tuf.manager.window.ui:41
#: 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" msgid "TUF Manager"
msgstr "Administrador TUF" msgstr "Administrador TUF"
#: src/tray-icon.vala:84 #: data/tuf-manager.desktop.in:6
msgid "_TUF Manager" msgid "Softare to manage the fan mode and rgb keyboard."
msgstr "_Administrador TUF" msgstr "Software para gestionar el modo ventilador y el teclado rgb."
#: 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 # Not translatable
#: data/tuf-manager.desktop.in:7 data/tuf-tray.desktop.in:6 #: data/tuf-manager.desktop.in:7
msgid "tuf-manager" msgid "tuf-manager"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:5 #: data/gschema/org.tuf.manager.gschema.xml:5
#: data/gschema/org.tuf.manager.gschema.xml:6 #: data/gschema/org.tuf.manager.gschema.xml:6
msgid "Should TUF Manager restore previous settings when run?" msgid "Should TUF Manager restore previous settings when run?"
msgstr "" msgstr "¿Debe Administrador TUF restaurar la configuración anterior cuando se ejecuta?"
"¿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: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" msgid "Fan mode"
msgstr "Modo del ventilador" msgstr "Modo del ventilador"
#: data/gschema/org.tuf.manager.gschema.xml:20 #: data/gschema/org.tuf.manager.gschema.xml:13
msgid "The saved fan mode" msgid "The saved fan mode"
msgstr "El modo de ventilador guardado" msgstr "El modo de ventilador guardado"
#: data/gschema/org.tuf.manager.gschema.xml:26 #: data/gschema/org.tuf.manager.gschema.xml:19
msgid "Keyboard mode" msgid "Keyboard mode"
msgstr "Modo del teclado" msgstr "Modo del teclado"
#: data/gschema/org.tuf.manager.gschema.xml:27 #: data/gschema/org.tuf.manager.gschema.xml:20
msgid "The saved keyboard mode" msgid "The saved keyboard mode"
msgstr "El modo de teclado guardado" msgstr "El modo de teclado guardado"
#: data/gschema/org.tuf.manager.gschema.xml:33 #: data/gschema/org.tuf.manager.gschema.xml:26
msgid "Keyboard speed" msgid "Keyboard speed"
msgstr "Velocidad del teclado" msgstr "Velocidad del teclado"
#: data/gschema/org.tuf.manager.gschema.xml:34 #: data/gschema/org.tuf.manager.gschema.xml:27
msgid "The saved keyboard speed" msgid "The saved keyboard speed"
msgstr "La velocidad del teclado guardada" msgstr "La velocidad del teclado guardada"
#: data/gschema/org.tuf.manager.gschema.xml:40 #: data/gschema/org.tuf.manager.gschema.xml:33
msgid "Keyboard color" msgid "Keyboard color"
msgstr "Color del teclado" msgstr "Color del teclado"
#: data/gschema/org.tuf.manager.gschema.xml:41 #: data/gschema/org.tuf.manager.gschema.xml:34
msgid "The saved keyboard color in RGB format" msgid "The saved keyboard color in RGB format"
msgstr "El color del teclado guardado en formato RGB" msgstr "El color del teclado guardado en formato RGB"
@ -337,74 +310,62 @@ msgstr "El color del teclado guardado en formato RGB"
msgid "Authentication is required" msgid "Authentication is required"
msgstr "Se requiere autenticación" msgstr "Se requiere autenticación"
#: data/ui/tuf.manager.window.ui:76 data/ui/tuf.manager.window.ui:217 #: data/ui/tuf.manager.window.ui:73 data/ui/tuf.manager.window.ui:212
msgid "Mode" msgid "Mode"
msgstr "Modo" msgstr "Modo"
#: data/ui/tuf.manager.window.ui:94 #: data/ui/tuf.manager.window.ui:91
msgid "Static" msgid "Static"
msgstr "Estática" msgstr "Estática"
#: data/ui/tuf.manager.window.ui:95 #: data/ui/tuf.manager.window.ui:92
msgid "Breathing" msgid "Breathing"
msgstr "Respiración" msgstr "Respiración"
#: data/ui/tuf.manager.window.ui:96 #: data/ui/tuf.manager.window.ui:93
msgid "Color Cycle" msgid "Color Cycle"
msgstr "Ciclo de Color" msgstr "Ciclo de Color"
#: data/ui/tuf.manager.window.ui:97 #: data/ui/tuf.manager.window.ui:94
msgid "Strobing" msgid "Strobing"
msgstr "Estroboscópica" msgstr "Estroboscópica"
#: data/ui/tuf.manager.window.ui:115 #: data/ui/tuf.manager.window.ui:112
msgid "Speed" msgid "Speed"
msgstr "Velocidad" msgstr "Velocidad"
#: data/ui/tuf.manager.window.ui:133 #: data/ui/tuf.manager.window.ui:130
msgid "Slow" msgid "Slow"
msgstr "Lenta" msgstr "Lenta"
#: data/ui/tuf.manager.window.ui:134 #: data/ui/tuf.manager.window.ui:131
msgid "Medium" msgid "Medium"
msgstr "Media" msgstr "Media"
#: data/ui/tuf.manager.window.ui:135 #: data/ui/tuf.manager.window.ui:132
msgid "Fast" msgid "Fast"
msgstr "Rapida" msgstr "Rapida"
#: data/ui/tuf.manager.window.ui:165 #: data/ui/tuf.manager.window.ui:162
msgid "Set color" msgid "Set color"
msgstr "Establecer color" msgstr "Establecer color"
#: data/ui/tuf.manager.window.ui:190 #: data/ui/tuf.manager.window.ui:187
msgid "Keyboard lighting" msgid "Keyboard lighting"
msgstr "Iluminación de teclado" msgstr "Iluminación de teclado"
#: data/ui/tuf.manager.window.ui:235 #: data/ui/tuf.manager.window.ui:230
msgid "Balanced" msgid "Balanced"
msgstr "Balanceada" msgstr "Balanceada"
#: data/ui/tuf.manager.window.ui:236 #: data/ui/tuf.manager.window.ui:231
msgid "Turbo" msgid "Turbo"
msgstr "Turbo" msgstr "Turbo"
#: data/ui/tuf.manager.window.ui:237 #: data/ui/tuf.manager.window.ui:232
msgid "Silent" msgid "Silent"
msgstr "Silenciosa" msgstr "Silenciosa"
#: data/ui/tuf.manager.window.ui:255 #: data/ui/tuf.manager.window.ui:250
msgid "Fan control" msgid "Fan control"
msgstr "Control de ventilador" 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 "" msgstr ""
"Project-Id-Version: tuf-manager\n" "Project-Id-Version: tuf-manager\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-15 16:42-0400\n" "POT-Creation-Date: 2020-08-06 20:34-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,171 +17,199 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: src/cli.vala:331 #: src/cli.vala:180 src/cli.vala:287 src/cli.vala:344 src/cli.vala:362
msgid "Invalid arguments!" #: 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 "" msgstr ""
#: src/cli.vala:342 #: src/cli.vala:314
msgid "" msgid ""
"Restore settings is currently disabled, please enable it to use this feature!" "Invalid arguments!\n"
msgstr ""
#: src/cli.vala:348
msgid "Version: "
msgstr ""
#: src/cli.vala:358 src/gui-window.vala:107
msgid "Client version: "
msgstr ""
#: src/cli.vala:359 src/gui-window.vala:108
msgid "Server version: "
msgstr ""
#: 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:363
msgid "Balanced\n"
msgstr ""
#: src/cli.vala:366
msgid "Turbo\n"
msgstr ""
#: src/cli.vala:369
msgid "Silent\n"
msgstr ""
#: src/cli.vala:372 src/gui-window.vala:126
msgid "Could not get current fan mode!"
msgstr ""
#: src/cli.vala:378 src/cli.vala:381 src/cli.vala:384 src/cli.vala:387
msgid "Current keyboard lighting: "
msgstr ""
#: src/cli.vala:378
msgid "Static\n"
msgstr ""
#: src/cli.vala:381
msgid "Breathing\n"
msgstr ""
#: src/cli.vala:384
msgid "Color Cycle\n"
msgstr ""
#: src/cli.vala:387
msgid "Strobing\n"
msgstr ""
#: src/cli.vala:390 src/gui-window.vala:142
msgid "Could not get current keyboard mode!"
msgstr ""
#: 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:396
msgid "Slow\n"
msgstr ""
#: src/cli.vala:399
msgid "Medium\n"
msgstr ""
#: src/cli.vala:402
msgid "Fast\n"
msgstr ""
#: src/cli.vala:405 src/gui-window.vala:152
msgid "Could not get current keyboard speed!"
msgstr ""
#: src/cli.vala:414 src/gui-window.vala:158 src/gui-window.vala:210
msgid "Current keyboard color: "
msgstr ""
#: src/cli.vala:609
msgid "Usage:"
msgstr ""
#: src/cli.vala:609
msgid "COMMAND [SUBCOMMAND]"
msgstr ""
#: src/cli.vala:610
msgid "Print the version of tuf-cli\n"
msgstr ""
#: src/cli.vala:611
msgid "Show this help screen\n"
msgstr ""
#: src/cli.vala:612
msgid "Set the fan mode\n"
msgstr ""
#: src/cli.vala:613
msgid "Set the keyboard lighting\n"
msgstr ""
#: src/cli.vala:614
msgid "Set the keyboard lighting speed\n"
msgstr ""
#: src/cli.vala:615
msgid "Set the keyboard color\n"
msgstr ""
#: src/cli.vala:616
msgid ""
"Restore saved settings\n"
"\n" "\n"
msgstr "" msgstr ""
#: src/cli.vala:617 #: src/cli.vala:320
msgid "Version: "
msgstr ""
#: src/cli.vala:330 src/gui-window.vala:95
msgid "Client version: "
msgstr ""
#: src/cli.vala:331 src/gui-window.vala:96
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
msgid "Current fan mode: "
msgstr ""
#: src/cli.vala:335
msgid "Balanced\n"
msgstr ""
#: src/cli.vala:338
msgid "Turbo\n"
msgstr ""
#: src/cli.vala:341
msgid "Silent\n"
msgstr ""
#: src/cli.vala:344
msgid "Could not get current fan mode!\n"
msgstr ""
#: src/cli.vala:350 src/cli.vala:353 src/cli.vala:356 src/cli.vala:359
msgid "Current keyboard lighting: "
msgstr ""
#: src/cli.vala:350
msgid "Static\n"
msgstr ""
#: src/cli.vala:353
msgid "Breathing\n"
msgstr ""
#: src/cli.vala:356
msgid "Color Cycle\n"
msgstr ""
#: src/cli.vala:359
msgid "Strobing\n"
msgstr ""
#: src/cli.vala:362
msgid "Could not get current keyboard mode!\n"
msgstr ""
#: src/cli.vala:368 src/cli.vala:371 src/cli.vala:374 src/gui-window.vala:132
#: src/gui-window.vala:184
msgid "Current keyboard speed: "
msgstr ""
#: src/cli.vala:368
msgid "Slow\n"
msgstr ""
#: src/cli.vala:371
msgid "Medium\n"
msgstr ""
#: src/cli.vala:374
msgid "Fast\n"
msgstr ""
#: src/cli.vala:377
msgid "Could not get current keyboard speed!\n"
msgstr ""
#: src/cli.vala:386 src/gui-window.vala:141 src/gui-window.vala:193
msgid "Current keyboard color: "
msgstr ""
#: src/cli.vala:497
msgid "Usage:"
msgstr ""
#: src/cli.vala:497
msgid "COMMAND [SUBCOMMAND]"
msgstr ""
#: src/cli.vala:498
msgid "Print the version of tuf-cli\n"
msgstr ""
#: src/cli.vala:499
msgid "Show this help screen\n"
msgstr ""
#: src/cli.vala:500
msgid "Set the fan mode\n"
msgstr ""
#: src/cli.vala:501
msgid "Set the keyboard lighting\n"
msgstr ""
#: src/cli.vala:502
msgid "Set the keyboard lighting speed\n"
msgstr ""
#: src/cli.vala:503
msgid "Set the keyboard color\n"
msgstr ""
#: src/cli.vala:504
msgid "" msgid ""
"Show the current config\n" "Show the current config\n"
"\n" "\n"
msgstr "" msgstr ""
#: src/cli.vala:618 #: src/cli.vala:505
msgid "Examples:\n" msgid "Examples:\n"
msgstr "" msgstr ""
#: src/cli.vala:619 #: src/cli.vala:506
msgid "Silence fan:" msgid "Silence fan:"
msgstr "" msgstr ""
#: src/cli.vala:620 #: src/cli.vala:507
msgid "Change RGB color:" msgid "Change RGB color:"
msgstr "" 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 #: src/common.vala:50
msgid "The server and client versions do not match!" msgid "The server and client versions do not match!"
msgstr "" msgstr ""
#: src/gui-window.vala:98 #: src/gui-window.vala:86
msgid "The current running tuf-server version doesn't match the GUI version!" msgid "The current running tuf-server version doesn't match the GUI version!"
msgstr "" msgstr ""
#: src/gui-window.vala:139 src/gui-window.vala:192 #: src/gui-window.vala:109
msgid "Could not get current fan mode!"
msgstr ""
#: src/gui-window.vala:122 src/gui-window.vala:175
msgid "Current keyboard mode: " msgid "Current keyboard mode: "
msgstr "" msgstr ""
#: src/main.vala.in:34 src/tray-main.vala:39 #: src/gui-window.vala:125
msgid "Another instance of TUF Manager is already running!" 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"
msgstr "" msgstr ""
#: src/server.vala:50 #: src/server.vala:50
msgid "Could not register service!" msgid "Could not register service!\n"
msgstr "" msgstr ""
#: src/server.vala:166 src/server.vala:238 src/server.vala:264 #: src/server.vala:166 src/server.vala:238 src/server.vala:264
@ -216,65 +244,23 @@ msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr "" msgstr ""
#: src/server-main.vala:92 #: src/server-main.vala:92
msgid "Could not create pid file!" msgid "Could not create pid file!\n"
msgstr "" msgstr ""
#: src/server-main.vala:122 #: src/server-main.vala:122
msgid "Could not acquire bus name!" msgid "Could not acquire bus name!\n"
msgstr "" msgstr ""
#: src/tray-icon.vala:80 src/tray-icon.vala:117 src/tray-icon.vala:127 #: data/tuf-manager.desktop.in:4 data/tuf-manager.desktop.in:5
#: src/tray-icon.vala:276 data/tuf-manager.desktop.in:4 #: data/ui/tuf.manager.window.ui:41
#: 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" msgid "TUF Manager"
msgstr "" msgstr ""
#: src/tray-icon.vala:84 #: data/tuf-manager.desktop.in:6
msgid "_TUF Manager" msgid "Softare to manage the fan mode and rgb keyboard."
msgstr "" msgstr ""
#: src/tray-icon.vala:89 #: data/tuf-manager.desktop.in:7
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" msgid "tuf-manager"
msgstr "" msgstr ""
@ -284,39 +270,34 @@ msgid "Should TUF Manager restore previous settings when run?"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:12 #: data/gschema/org.tuf.manager.gschema.xml:12
#: data/gschema/org.tuf.manager.gschema.xml:13
msgid "Should TUF Manager show notifications?"
msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:19
msgid "Fan mode" msgid "Fan mode"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:20 #: data/gschema/org.tuf.manager.gschema.xml:13
msgid "The saved fan mode" msgid "The saved fan mode"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:26 #: data/gschema/org.tuf.manager.gschema.xml:19
msgid "Keyboard mode" msgid "Keyboard mode"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:27 #: data/gschema/org.tuf.manager.gschema.xml:20
msgid "The saved keyboard mode" msgid "The saved keyboard mode"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:33 #: data/gschema/org.tuf.manager.gschema.xml:26
msgid "Keyboard speed" msgid "Keyboard speed"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:34 #: data/gschema/org.tuf.manager.gschema.xml:27
msgid "The saved keyboard speed" msgid "The saved keyboard speed"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:40 #: data/gschema/org.tuf.manager.gschema.xml:33
msgid "Keyboard color" msgid "Keyboard color"
msgstr "" msgstr ""
#: data/gschema/org.tuf.manager.gschema.xml:41 #: data/gschema/org.tuf.manager.gschema.xml:34
msgid "The saved keyboard color in RGB format" msgid "The saved keyboard color in RGB format"
msgstr "" msgstr ""
@ -324,74 +305,62 @@ msgstr ""
msgid "Authentication is required" msgid "Authentication is required"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:76 data/ui/tuf.manager.window.ui:217 #: data/ui/tuf.manager.window.ui:73 data/ui/tuf.manager.window.ui:212
msgid "Mode" msgid "Mode"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:94 #: data/ui/tuf.manager.window.ui:91
msgid "Static" msgid "Static"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:95 #: data/ui/tuf.manager.window.ui:92
msgid "Breathing" msgid "Breathing"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:96 #: data/ui/tuf.manager.window.ui:93
msgid "Color Cycle" msgid "Color Cycle"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:97 #: data/ui/tuf.manager.window.ui:94
msgid "Strobing" msgid "Strobing"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:115 #: data/ui/tuf.manager.window.ui:112
msgid "Speed" msgid "Speed"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:133 #: data/ui/tuf.manager.window.ui:130
msgid "Slow" msgid "Slow"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:134 #: data/ui/tuf.manager.window.ui:131
msgid "Medium" msgid "Medium"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:135 #: data/ui/tuf.manager.window.ui:132
msgid "Fast" msgid "Fast"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:165 #: data/ui/tuf.manager.window.ui:162
msgid "Set color" msgid "Set color"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:190 #: data/ui/tuf.manager.window.ui:187
msgid "Keyboard lighting" msgid "Keyboard lighting"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:235 #: data/ui/tuf.manager.window.ui:230
msgid "Balanced" msgid "Balanced"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:236 #: data/ui/tuf.manager.window.ui:231
msgid "Turbo" msgid "Turbo"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:237 #: data/ui/tuf.manager.window.ui:232
msgid "Silent" msgid "Silent"
msgstr "" msgstr ""
#: data/ui/tuf.manager.window.ui:255 #: data/ui/tuf.manager.window.ui:250
msgid "Fan control" msgid "Fan control"
msgstr "" 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 * This class contains the app that runs on the command line
*/ */
public class TUFManagerApp : Gtk.Application { public class TUFManagerApp : Application {
#if ALWAYS_AUTHENTICATED #if ALWAYS_AUTHENTICATED
#else #else
/** /**
@ -95,11 +95,6 @@ namespace TUFManager {
*/ */
private bool invalid = false; 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 * This flag is set if the user wants to see help
*/ */
@ -183,14 +178,11 @@ namespace TUFManager {
* @return Returns 0 on success or an error code if failure * @return Returns 0 on success or an error code if failure
*/ */
private int _command_line (ApplicationCommandLine command_line) { private int _command_line (ApplicationCommandLine command_line) {
settings = new Settings ("org.tuf.manager");
try { try {
connect_tuf_server (); connect_tuf_server ();
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); command_line.printerr (_ ("Error: ") + e.message + "\n");
this.release ();
return 1;
} }
string[] args = command_line.get_arguments (); string[] args = command_line.get_arguments ();
@ -210,10 +202,6 @@ namespace TUFManager {
help = true; help = true;
check_second_argument (args); check_second_argument (args);
break; break;
case "restore":
restore = true;
check_second_argument (args);
break;
case "info": case "info":
info = true; info = true;
check_second_argument (args); check_second_argument (args);
@ -301,7 +289,7 @@ namespace TUFManager {
} }
} }
catch (RegexError e) { catch (RegexError e) {
warning (e.message); command_line.printerr (_ ("Error: ") + e.message + "\n");
} }
finally { finally {
rgba = Gdk.RGBA (); rgba = Gdk.RGBA ();
@ -328,22 +316,11 @@ namespace TUFManager {
} }
if (invalid) { if (invalid) {
warning (_ ("Invalid arguments!")); command_line.printerr (_ ("Invalid arguments!\n\n"));
print_usage (command_line); print_usage (command_line);
release_cli (); release_cli ();
return 1; 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) { else if (version) {
command_line.print (_ ("Version: ") + VERSION + "\n"); command_line.print (_ ("Version: ") + VERSION + "\n");
release_cli (); release_cli ();
@ -369,7 +346,7 @@ namespace TUFManager {
command_line.print (_ ("Current fan mode: ") + _ ("Silent\n")); command_line.print (_ ("Current fan mode: ") + _ ("Silent\n"));
break; break;
default: default:
warning (_ ("Could not get current fan mode!")); command_line.printerr (_ ("Error: ") + _ ("Could not get current fan mode!\n"));
break; break;
} }
current_setting = get_keyboard_mode (); current_setting = get_keyboard_mode ();
@ -387,7 +364,7 @@ namespace TUFManager {
command_line.print (_ ("Current keyboard lighting: ") + _ ("Strobing\n")); command_line.print (_ ("Current keyboard lighting: ") + _ ("Strobing\n"));
break; break;
default: default:
warning (_ ("Could not get current keyboard mode!")); command_line.printerr (_ ("Error: ") + _ ("Could not get current keyboard mode!\n"));
break; break;
} }
current_setting = get_keyboard_speed (); current_setting = get_keyboard_speed ();
@ -402,7 +379,7 @@ namespace TUFManager {
command_line.print (_ ("Current keyboard speed: ") + _ ("Fast\n")); command_line.print (_ ("Current keyboard speed: ") + _ ("Fast\n"));
break; break;
default: default:
warning (_ ("Could not get current keyboard speed!")); command_line.printerr (_ ("Error: ") + _ ("Could not get current keyboard speed!\n"));
break; break;
} }
var current_color = get_keyboard_color (); var current_color = get_keyboard_color ();
@ -424,7 +401,7 @@ namespace TUFManager {
#else #else
try { try {
pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE); pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE);
Timeout.add_seconds (10, () => { Timeout.add (200, () => {
int mode = fan_mode; int mode = fan_mode;
tuf_server.procedure_finished.connect (release_cli); tuf_server.procedure_finished.connect (release_cli);
set_fan_mode (mode); set_fan_mode (mode);
@ -433,7 +410,7 @@ namespace TUFManager {
}); });
} }
catch (Error e) { catch (Error e) {
warning (e.message); command_line.printerr (_ ("Error: ") + e.message + "\n");
} }
#endif #endif
@ -449,7 +426,7 @@ namespace TUFManager {
try { try {
pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE); pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE);
Timeout.add_seconds (10, () => { Timeout.add (200, () => {
int mode = keyboard_mode; int mode = keyboard_mode;
tuf_server.procedure_finished.connect (release_cli); tuf_server.procedure_finished.connect (release_cli);
set_keyboard_mode (mode); set_keyboard_mode (mode);
@ -458,7 +435,7 @@ namespace TUFManager {
}); });
} }
catch (Error e) { catch (Error e) {
warning (e.message); command_line.printerr (_ ("Error: ") + e.message + "\n");
} }
#endif #endif
return 0; return 0;
@ -470,20 +447,20 @@ namespace TUFManager {
set_keyboard_speed (set_speed); set_keyboard_speed (set_speed);
settings.set_int ("keyboard-speed", set_speed); settings.set_int ("keyboard-speed", set_speed);
#else #else
try { try {
pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE); pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE);
Timeout.add_seconds (10, () => { Timeout.add (200, () => {
int set_speed = keyboard_speed; int set_speed = keyboard_speed;
tuf_server.procedure_finished.connect (release_cli); tuf_server.procedure_finished.connect (release_cli);
set_keyboard_speed (set_speed); set_keyboard_speed (set_speed);
settings.set_int ("keyboard-speed", set_speed); settings.set_int ("keyboard-speed", set_speed);
return false; return false;
}); });
} }
catch (Error e) { catch (Error e) {
warning (e.message); command_line.printerr (_ ("Error: ") + e.message + "\n");
} }
#endif #endif
return 0; return 0;
} }
@ -496,7 +473,7 @@ namespace TUFManager {
try { try {
pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE); pkttyagent = new Subprocess.newv ({"pkttyagent"}, SubprocessFlags.NONE);
Timeout.add_seconds (10, () => { Timeout.add (200, () => {
tuf_server.procedure_finished.connect (release_cli); tuf_server.procedure_finished.connect (release_cli);
set_keyboard_color (rgba); set_keyboard_color (rgba);
settings.set_string ("keyboard-color", rgba.to_string ()); settings.set_string ("keyboard-color", rgba.to_string ());
@ -504,7 +481,7 @@ namespace TUFManager {
}); });
} }
catch (Error e) { catch (Error e) {
warning (e.message); command_line.printerr (_ ("Error: ") + e.message + "\n");
} }
#endif #endif
return 0; return 0;
@ -512,82 +489,6 @@ namespace TUFManager {
return 0; 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 * If there are more arguments than there should be we need to invalidate
* TODO: Change this to something better later * TODO: Change this to something better later
@ -613,7 +514,6 @@ namespace TUFManager {
command_line.print (" lighting [static, breath, cycle, stobe] " + _ ("Set the keyboard lighting\n")); 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 (" speed [slow, medium, fast] " + _ ("Set the keyboard lighting speed\n"));
command_line.print (" color [\"#XXXXXX\"] " + _ ("Set the keyboard color\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 (" info " + _ ("Show the current config\n\n"));
command_line.print (_ ("Examples:\n")); command_line.print (_ ("Examples:\n"));
command_line.print (" " + _ ("Silence fan:") + " tuf-cli fan silent\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"); tuf_server = Bus.get_proxy_sync (BusType.SYSTEM, "org.tuf.manager.server", "/org/tuf/manager/server");
} }
catch (IOError e) { catch (IOError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
string? server_version = get_server_version (); string? server_version = get_server_version ();
@ -61,7 +61,7 @@ namespace TUFManager {
return tuf_server.get_server_version (); return tuf_server.get_server_version ();
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
return null; return null;
} }
@ -76,10 +76,10 @@ namespace TUFManager {
return tuf_server.get_fan_mode (); return tuf_server.get_fan_mode ();
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
return -3; return -3;
} }
@ -94,10 +94,10 @@ namespace TUFManager {
tuf_server.set_fan_mode (mode, bus_name); tuf_server.set_fan_mode (mode, bus_name);
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
} }
@ -111,10 +111,10 @@ namespace TUFManager {
return tuf_server.get_keyboard_color (); return tuf_server.get_keyboard_color ();
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
return Gdk.RGBA (); return Gdk.RGBA ();
} }
@ -129,10 +129,10 @@ namespace TUFManager {
tuf_server.set_keyboard_color (color, bus_name); tuf_server.set_keyboard_color (color, bus_name);
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
} }
@ -146,10 +146,10 @@ namespace TUFManager {
return tuf_server.get_keyboard_mode (); return tuf_server.get_keyboard_mode ();
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
return -3; return -3;
} }
@ -164,10 +164,10 @@ namespace TUFManager {
tuf_server.set_keyboard_mode (mode, bus_name); tuf_server.set_keyboard_mode (mode, bus_name);
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
} }
@ -181,10 +181,10 @@ namespace TUFManager {
return tuf_server.get_keyboard_speed (); return tuf_server.get_keyboard_speed ();
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
return -3; return -3;
} }
@ -199,10 +199,10 @@ namespace TUFManager {
tuf_server.set_keyboard_speed (speed, bus_name); tuf_server.set_keyboard_speed (speed, bus_name);
} }
catch (TUFError e) { catch (TUFError e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
catch (Error e) { catch (Error e) {
warning (e.message); stderr.printf (_ ("Error: %s\n"), e.message);
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,311 +0,0 @@
/*
* 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");
}
}
}
}

View File

@ -1,45 +0,0 @@
/*
* 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 ();
}
}
}

View File

@ -1,55 +0,0 @@
/*
* 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 ();
}
}
}
}