diff --git a/PKGBUILD b/PKGBUILD index d673a2a..0d4723d 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -22,8 +22,8 @@ makedepends=('automoc4' 'cmake') source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}.plasmoid https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_dtengine}-${_dtver}.zip) install=${pkgname}.install -md5sums=('2a7e055aaabc8a767eccf0f0cfd03303' - 'b17aba604e5102961faf0bcdfd20744b') +md5sums=('9872eedca313768f18de0facc2fc135d' + '29a0fbc2014b0b7cacfab8186a56a1b6') build () { diff --git a/ext-sysmon-1.5.zip b/ext-sysmon-1.5.zip index 1d33b64..3203b42 100644 Binary files a/ext-sysmon-1.5.zip and b/ext-sysmon-1.5.zip differ diff --git a/ext-sysmon/CMakeLists.txt b/ext-sysmon/CMakeLists.txt index 2aaef1f..a5ed7f7 100644 --- a/ext-sysmon/CMakeLists.txt +++ b/ext-sysmon/CMakeLists.txt @@ -14,11 +14,13 @@ include_directories (${CMAKE_SOURCE_DIR} set (PLUGIN_NAME ${PROJECT_NAME}) file (GLOB PROJECT_DESKTOP *.desktop) file (GLOB PROJECT_SRCS *.cpp) +file (GLOB PROJECT_CONF *.conf) # make kde4_add_plugin (${PLUGIN_NAME} ${PROJECT_SRCS}) target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS}) # install -install(TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) +install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) +install (FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) +install (FILES ${PROJECT_CONF} DESTINATION ../etc/) diff --git a/ext-sysmon/extsysmon.conf b/ext-sysmon/extsysmon.conf new file mode 100644 index 0000000..343daec --- /dev/null +++ b/ext-sysmon/extsysmon.conf @@ -0,0 +1,13 @@ +# Configuration file for Extended Systemmonitor DataEngine (v.1.5) +# Uncomment needed lines + +# Set GPU device +# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'ignore' or 'auto' +#GPUDEV=auto + +# Set block device for hddtemp comma separated or use 'all' +#HDDDEV=all + +# Set MPD settings +#MPDADDRESS=localhost +#MPDPORT=6600 diff --git a/ext-sysmon/extsysmon.cpp b/ext-sysmon/extsysmon.cpp index 5304102..2964426 100644 --- a/ext-sysmon/extsysmon.cpp +++ b/ext-sysmon/extsysmon.cpp @@ -20,6 +20,7 @@ #include "extsysmon.h" #include +#include #include @@ -30,29 +31,7 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args) Q_UNUSED(args) setMinimumPollingInterval(333); - - FILE *f_out; - f_out = popen("lspci 2> /dev/null", "r"); - char device[256]; - QString dev; - while (fgets(device, 256, f_out) != NULL) - { - dev = QString(device); - if (dev.toLower().contains("nvidia")) - gpudev = QString("nvidia"); - else if (dev.toLower().contains("radeon")) - gpudev = QString("ati"); - } - pclose(f_out); - - f_out = popen("ls -1 /dev/sd[a-z] 2> /dev/null ; ls -1 /dev/hd[a-z] 2> /dev/null", "r"); - while (fgets(device, 256, f_out) != NULL) - { - dev = QString(device).split("\n")[0]; - if (dev[0] == '/') - hdddev.append(dev); - } - pclose(f_out); + readConfiguration(QString("/etc/extsysmon.conf")); } QStringList ExtendedSysMon::sources() const @@ -65,6 +44,80 @@ QStringList ExtendedSysMon::sources() const return source; } +bool ExtendedSysMon::readConfiguration(const QString confFileName) +{ + // pre-setup + FILE *f_out; + f_out = popen("lspci 2> /dev/null", "r"); + char device[256]; + QString dev; + while (fgets(device, 256, f_out) != NULL) + { + dev = QString(device); + if (dev.toLower().contains("nvidia")) + gpudev = QString("nvidia"); + else if (dev.toLower().contains("radeon")) + gpudev = QString("ati"); + } + pclose(f_out); + + f_out = popen("ls -1 /dev/sd[a-z] 2> /dev/null ; ls -1 /dev/hd[a-z] 2> /dev/null", "r"); + while (fgets(device, 256, f_out) != NULL) + { + dev = QString(device).split("\n")[0]; + if (dev[0] == '/') + hdddev.append(dev); + } + pclose(f_out); + + mpdAddress = QString("localhost"); + mpdPort = QString("6600"); + + QString fileStr; + QFile confFile(confFileName); + bool exists = confFile.open(QIODevice::ReadOnly); + if (!exists) + return false; + + while (true) + { + fileStr = QString(confFile.readLine()); + if (confFile.atEnd()) + break; + else if (fileStr[0] != '#') + { + if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 1) + { + if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("GPUDEV")) + { + if (fileStr.split(QString("="), QString::SkipEmptyParts)[1] == QString("ati")) + gpudev = fileStr.split(QString("="), QString::SkipEmptyParts)[1]; + else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1] == QString("nvidia")) + gpudev = fileStr.split(QString("="), QString::SkipEmptyParts)[1]; + else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1] == QString("ignore")) + gpudev = QString("ignore"); + } + else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("HDDDEV")) + { + if (fileStr.split(QString("="), QString::SkipEmptyParts)[1] != QString("all")) + { + hdddev.clear(); + for (int i=0; i