mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-25 07:57:20 +00:00
add additional docs to helper
This commit is contained in:
parent
0b2cc3ba79
commit
2ff76e9c8e
@ -65,7 +65,6 @@ TODO (wish list)
|
|||||||
----------------
|
----------------
|
||||||
|
|
||||||
* plasmoid helper integration
|
* plasmoid helper integration
|
||||||
* helper shell completions
|
|
||||||
* gui helper|systemd integration
|
* gui helper|systemd integration
|
||||||
* helper uid/euid check to allow use /Ctrl interface
|
* helper uid/euid check to allow use /Ctrl interface
|
||||||
* include security notes / project architecture to about window
|
* include security notes / project architecture to about window
|
||||||
|
@ -3,16 +3,20 @@
|
|||||||
netctl-gui is a graphical interface for netctl
|
netctl-gui is a graphical interface for netctl
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B netctl-gui
|
.B netctl-gui
|
||||||
[ --about ] [ --netctl-auto ] [ --settings ]
|
[ options ]
|
||||||
[ -e ESSID | --essid ESSID ] [ -o PROFILE | --open PROFILE ]
|
|
||||||
[ -s PROFILE | --select PROFILE ]
|
|
||||||
[ --config FILE ] [ -d | --debug ] [ --default ]
|
|
||||||
[ --set-opts OPTIONS ] [ -t NUM | --tab NUM ]
|
|
||||||
[ -v | --version ] [ -i | --info ] [ -h | --help]
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Graphical user interface for netctl written on C++ using Qt toolkit. Provides shared library for interaction with netctl and Plasmoid and DataEngine for KDE.
|
Graphical user interface for netctl written on C++ using Qt toolkit. Provides shared library for interaction with netctl and Plasmoid and DataEngine for KDE.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
--daemon
|
||||||
|
run as daemon
|
||||||
|
.TP
|
||||||
|
--maximized
|
||||||
|
run maximized
|
||||||
|
.TP
|
||||||
|
--minimized
|
||||||
|
run to system tray if it is available
|
||||||
|
.TP
|
||||||
--about
|
--about
|
||||||
show about window
|
show about window
|
||||||
.TP
|
.TP
|
||||||
@ -31,7 +35,7 @@ open profile PROFILE. This option will set tab to 2 automatically
|
|||||||
-s, --select PROFILE
|
-s, --select PROFILE
|
||||||
select profile PROFILE. This option will set tab to 1 automatically
|
select profile PROFILE. This option will set tab to 1 automatically
|
||||||
.TP
|
.TP
|
||||||
--config FILE
|
-c, --config FILE
|
||||||
read configuration from file FILE
|
read configuration from file FILE
|
||||||
.TP
|
.TP
|
||||||
-d, --debug
|
-d, --debug
|
||||||
|
@ -48,29 +48,7 @@ bool restoreExistSession()
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// detach from console
|
|
||||||
bool debugFlag = false;
|
|
||||||
bool daemonFlag = false;
|
|
||||||
for (int i=0; i<argc; i++)
|
|
||||||
if (QString(argv[i]) == QString("--daemon"))
|
|
||||||
daemonFlag = true;
|
|
||||||
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug")))
|
|
||||||
debugFlag = true;
|
|
||||||
if ((daemonFlag) && (!debugFlag))
|
|
||||||
daemon(0, 0);
|
|
||||||
QApplication a(argc, argv);
|
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
|
||||||
// check if exists
|
|
||||||
if (restoreExistSession())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
QMap<QString, QVariant> args = getArgs();
|
QMap<QString, QVariant> args = getArgs();
|
||||||
// translation
|
|
||||||
QString language = Language::defineLanguage(args[QString("config")].toString());
|
|
||||||
QTranslator translator;
|
|
||||||
translator.load(QString(":/translations/") + language);
|
|
||||||
a.installTranslator(&translator);
|
|
||||||
|
|
||||||
// reading
|
// reading
|
||||||
for (int i=1; i<argc; i++) {
|
for (int i=1; i<argc; i++) {
|
||||||
// windows
|
// windows
|
||||||
@ -162,6 +140,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if ((args[QString("debug")].toBool()) && (args[QString("minimized")].toInt() == 1))
|
if ((args[QString("debug")].toBool()) && (args[QString("minimized")].toInt() == 1))
|
||||||
args[QString("minimized")] = (int) 0;
|
args[QString("minimized")] = (int) 0;
|
||||||
|
else if ((args[QString("help")].toBool()) ||
|
||||||
|
(args[QString("info")].toBool()) ||
|
||||||
|
(args[QString("version")].toBool()) ||
|
||||||
|
(args[QString("error")].toBool()))
|
||||||
|
args[QString("minimized")] = (int) 0;
|
||||||
if (args[QString("essid")].toString() != QString("ESSID"))
|
if (args[QString("essid")].toString() != QString("ESSID"))
|
||||||
args[QString("tab")] = (int) 3;
|
args[QString("tab")] = (int) 3;
|
||||||
if (args[QString("open")].toString() != QString("PROFILE"))
|
if (args[QString("open")].toString() != QString("PROFILE"))
|
||||||
@ -169,10 +152,18 @@ int main(int argc, char *argv[])
|
|||||||
if (args[QString("select")].toString() != QString("PROFILE"))
|
if (args[QString("select")].toString() != QString("PROFILE"))
|
||||||
args[QString("tab")] = (int) 1;
|
args[QString("tab")] = (int) 1;
|
||||||
|
|
||||||
|
// detach from console
|
||||||
|
if (args[QString("minimized")].toInt() == 1)
|
||||||
|
daemon(0, 0);
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
|
// check if exists
|
||||||
|
if (restoreExistSession())
|
||||||
|
return 0;
|
||||||
// reread translations according to flags
|
// reread translations according to flags
|
||||||
a.removeTranslator(&translator);
|
QString language = Language::defineLanguage(args[QString("config")].toString(),
|
||||||
language = Language::defineLanguage(args[QString("config")].toString(),
|
|
||||||
args[QString("options")].toString());
|
args[QString("options")].toString());
|
||||||
|
QTranslator translator;
|
||||||
translator.load(QString(":/translations/") + language);
|
translator.load(QString(":/translations/") + language);
|
||||||
a.installTranslator(&translator);
|
a.installTranslator(&translator);
|
||||||
|
|
||||||
|
@ -10,5 +10,13 @@ set (TARGETS "")
|
|||||||
set (HEADERS "")
|
set (HEADERS "")
|
||||||
|
|
||||||
add_subdirectory (${SUBPROJECT_SOURCE_DIR})
|
add_subdirectory (${SUBPROJECT_SOURCE_DIR})
|
||||||
|
# build man
|
||||||
|
file (GLOB SUBPROJECT_MAN_IN *.1)
|
||||||
|
file (RELATIVE_PATH SUBPROJECT_MAN ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN_IN})
|
||||||
|
configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN})
|
||||||
|
|
||||||
install (FILES org.netctlgui.helper.conf DESTINATION ${DBUS_SYSTEMCONF_PATH})
|
install (FILES org.netctlgui.helper.conf DESTINATION ${DBUS_SYSTEMCONF_PATH})
|
||||||
install (FILES netctlgui-helper.service DESTINATION ${SYSTEMD_SERVICE_PATH})
|
install (FILES netctlgui-helper.service DESTINATION ${SYSTEMD_SERVICE_PATH})
|
||||||
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/)
|
||||||
|
install (FILES bash-completions DESTINATION share/bash-completion/completions/ RENAME ${SUBPROJECT})
|
||||||
|
install (FILES zsh-completions DESTINATION share/zsh/site-functions/ RENAME _${SUBPROJECT})
|
||||||
|
49
sources/helper/bash-completions
Normal file
49
sources/helper/bash-completions
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
###########################################################################
|
||||||
|
# This file is part of netctl-gui #
|
||||||
|
# #
|
||||||
|
# netctl-gui is free software: you can redistribute it and/or #
|
||||||
|
# modify it under the terms of the GNU General Public License as #
|
||||||
|
# published by the Free Software Foundation, either version 3 of the #
|
||||||
|
# License, or (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# netctl-gui is distributed in the hope that it will be useful, #
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
# GNU General Public License for more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License #
|
||||||
|
# along with netctl-gui. If not, see http://www.gnu.org/licenses/ #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# variables
|
||||||
|
_netctlgui_helper_arglist=(
|
||||||
|
'--nodaemon'
|
||||||
|
'-c'
|
||||||
|
'--config'
|
||||||
|
'-d'
|
||||||
|
'--debug'
|
||||||
|
'-v'
|
||||||
|
'--version'
|
||||||
|
'-i'
|
||||||
|
'--info'
|
||||||
|
'-h'
|
||||||
|
'--help'
|
||||||
|
)
|
||||||
|
|
||||||
|
# work block
|
||||||
|
_netctlgui_helper() {
|
||||||
|
COMPREPLY=()
|
||||||
|
wantfiles='-@(c|-config)'
|
||||||
|
_get_comp_words_by_ref cur prev words cword
|
||||||
|
|
||||||
|
if [[ $prev = $wantfiles ]]; then
|
||||||
|
_filedir
|
||||||
|
else
|
||||||
|
COMPREPLY=($(compgen -W '${_netctlgui_helper[@]}' -- "$cur"))
|
||||||
|
fi
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _netctlgui_helper netctlgui-helper
|
41
sources/helper/netctlgui-helper.1
Normal file
41
sources/helper/netctlgui-helper.1
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
.TH netctlgui-helper 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "USER COMMANDS"
|
||||||
|
.SH NAME
|
||||||
|
netctlgui-helper is a helper daemon for netctl-gui
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B netctlgui-helper
|
||||||
|
[ options ]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Qt based helper daemon which provides a DBus interface for interaction with netctl without any additional permissions.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
--nodaemon
|
||||||
|
do not run as daemon
|
||||||
|
.TP
|
||||||
|
-c, --config FILE
|
||||||
|
read configuration from file FILE
|
||||||
|
.TP
|
||||||
|
-d, --debug
|
||||||
|
print debug information
|
||||||
|
.TP
|
||||||
|
-v, --version
|
||||||
|
show version and exit
|
||||||
|
.TP
|
||||||
|
-i, --info
|
||||||
|
show build information and exit
|
||||||
|
.TP
|
||||||
|
-h, --help
|
||||||
|
show this help and exit
|
||||||
|
.SH FILES
|
||||||
|
.TP
|
||||||
|
$HOME/.config/netctl-gui.conf
|
||||||
|
Configuration file
|
||||||
|
.TP
|
||||||
|
/usr/lib/systemd/system/netctlgui-helper.service
|
||||||
|
Systemd service file
|
||||||
|
.TP
|
||||||
|
/etc/dbus-1/system.d/org.netctlgui.helper.conf
|
||||||
|
DBus policy configuration file
|
||||||
|
.SH AUTHOR
|
||||||
|
@PROJECT_AUTHOR@ <\fI@PROJECT_CONTACT@\fR>
|
||||||
|
.SH LICENSE
|
||||||
|
This software is licensed under @PROJECT_LICENSE@
|
@ -3,12 +3,12 @@
|
|||||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||||
<busconfig>
|
<busconfig>
|
||||||
|
|
||||||
<!-- Only root or user avahi can own the service -->
|
<!-- only root can own the service -->
|
||||||
<policy user="root">
|
<policy user="root">
|
||||||
<allow own="org.netctlgui.helper"/>
|
<allow own="org.netctlgui.helper"/>
|
||||||
</policy>
|
</policy>
|
||||||
|
|
||||||
<!-- Allow everything, including access to SetHostName to users of the group "users" -->
|
<!-- allow everything to users of the group "users" -->
|
||||||
<policy group="users">
|
<policy group="users">
|
||||||
<allow send_destination="org.netctlgui.helper"/>
|
<allow send_destination="org.netctlgui.helper"/>
|
||||||
<allow receive_sender="org.netctlgui.helper"/>
|
<allow receive_sender="org.netctlgui.helper"/>
|
||||||
|
@ -47,24 +47,6 @@ bool checkExistSession()
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// detach from console
|
|
||||||
bool debugFlag = false;
|
|
||||||
bool daemonFlag = true;
|
|
||||||
for (int i=0; i<argc; i++)
|
|
||||||
if (QString(argv[i]) == QString("--nodaemon"))
|
|
||||||
daemonFlag = false;
|
|
||||||
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug")))
|
|
||||||
debugFlag = true;
|
|
||||||
if ((daemonFlag) && (!debugFlag))
|
|
||||||
daemon(0, 0);
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QCoreApplication::setSetuidAllowed(true);
|
|
||||||
#endif
|
|
||||||
QCoreApplication a(argc, argv);
|
|
||||||
// check if exists
|
|
||||||
if (checkExistSession())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
QMap<QString, QVariant> args = getArgs();
|
QMap<QString, QVariant> args = getArgs();
|
||||||
// reading
|
// reading
|
||||||
for (int i=1; i<argc; i++) {
|
for (int i=1; i<argc; i++) {
|
||||||
@ -98,7 +80,7 @@ int main(int argc, char *argv[])
|
|||||||
args[QString("error")] = true;
|
args[QString("error")] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((args[QString("debug")].toBool()) && (!args[QString("nodaemon")].toBool()))
|
if (args[QString("debug")].toBool())
|
||||||
args[QString("nodaemon")] = true;
|
args[QString("nodaemon")] = true;
|
||||||
|
|
||||||
// running
|
// running
|
||||||
@ -120,6 +102,18 @@ int main(int argc, char *argv[])
|
|||||||
cout << versionMessage().toUtf8().data();
|
cout << versionMessage().toUtf8().data();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// detach from console
|
||||||
|
if (!args[QString("nodaemon")].toBool())
|
||||||
|
daemon(0, 0);
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
QCoreApplication::setSetuidAllowed(true);
|
||||||
|
#endif
|
||||||
|
QCoreApplication a(argc, argv);
|
||||||
|
// check if exists
|
||||||
|
if (checkExistSession())
|
||||||
|
return 0;
|
||||||
|
|
||||||
NetctlHelper w(0, args);
|
NetctlHelper w(0, args);
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
44
sources/helper/zsh-completions
Normal file
44
sources/helper/zsh-completions
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#compdef netctlgui-helper
|
||||||
|
###########################################################################
|
||||||
|
# This file is part of netctl-gui #
|
||||||
|
# #
|
||||||
|
# netctl-gui is free software: you can redistribute it and/or #
|
||||||
|
# modify it under the terms of the GNU General Public License as #
|
||||||
|
# published by the Free Software Foundation, either version 3 of the #
|
||||||
|
# License, or (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# netctl-gui is distributed in the hope that it will be useful, #
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
# GNU General Public License for more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License #
|
||||||
|
# along with netctl-gui. If not, see http://www.gnu.org/licenses/ #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# variables
|
||||||
|
_netctlgui_helper_arglist=(
|
||||||
|
{'--nodaemon','--nodaemon'}'[do not start as daemon]'
|
||||||
|
{'(--config)-c','(-c)--config'}'[read configuration from this file]:select file:->files'
|
||||||
|
{'(--debug)-d','(-d)--debug'}'[print debug information]'
|
||||||
|
{'(--version)-v','(-v)--version'}'[show version and exit]'
|
||||||
|
{'(--info)-i','(-i)--info'}'[show build information and exit]'
|
||||||
|
{'(--help)-h','(-h)--help'}'[show help and exit]'
|
||||||
|
)
|
||||||
|
|
||||||
|
# work block
|
||||||
|
_netctlgui_helper() {
|
||||||
|
_arguments $_netctlgui_helper_arglist
|
||||||
|
case "$state" in
|
||||||
|
files)
|
||||||
|
_files
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$service" in
|
||||||
|
netctlgui-helper)
|
||||||
|
_netctlgui_helper "$@" && return 0
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in New Issue
Block a user