mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
Release ext-sysmon 1.5
+ added configuration file
This commit is contained in:
parent
24325e2d3a
commit
916c32589f
4
PKGBUILD
4
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 ()
|
||||
{
|
||||
|
Binary file not shown.
@ -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/)
|
||||
|
13
ext-sysmon/extsysmon.conf
Normal file
13
ext-sysmon/extsysmon.conf
Normal file
@ -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
|
@ -20,6 +20,7 @@
|
||||
#include "extsysmon.h"
|
||||
|
||||
#include <Plasma/DataContainer>
|
||||
#include <QFile>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -30,7 +31,22 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
|
||||
Q_UNUSED(args)
|
||||
|
||||
setMinimumPollingInterval(333);
|
||||
readConfiguration(QString("/etc/extsysmon.conf"));
|
||||
}
|
||||
|
||||
QStringList ExtendedSysMon::sources() const
|
||||
{
|
||||
QStringList source;
|
||||
source.append(QString("gpu"));
|
||||
source.append(QString("gputemp"));
|
||||
source.append(QString("hddtemp"));
|
||||
source.append(QString("player"));
|
||||
return source;
|
||||
}
|
||||
|
||||
bool ExtendedSysMon::readConfiguration(const QString confFileName)
|
||||
{
|
||||
// pre-setup
|
||||
FILE *f_out;
|
||||
f_out = popen("lspci 2> /dev/null", "r");
|
||||
char device[256];
|
||||
@ -38,10 +54,10 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
|
||||
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");
|
||||
if (dev.toLower().contains("nvidia"))
|
||||
gpudev = QString("nvidia");
|
||||
else if (dev.toLower().contains("radeon"))
|
||||
gpudev = QString("ati");
|
||||
}
|
||||
pclose(f_out);
|
||||
|
||||
@ -53,16 +69,53 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
|
||||
hdddev.append(dev);
|
||||
}
|
||||
pclose(f_out);
|
||||
}
|
||||
|
||||
QStringList ExtendedSysMon::sources() const
|
||||
{
|
||||
QStringList source;
|
||||
source.append(QString("gpu"));
|
||||
source.append(QString("gputemp"));
|
||||
source.append(QString("hddtemp"));
|
||||
source.append(QString("player"));
|
||||
return source;
|
||||
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<fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString(","), QString::SkipEmptyParts).count(); i++)
|
||||
hdddev.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString(","), QString::SkipEmptyParts)[i]);
|
||||
}
|
||||
}
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("MPDADDRESS"))
|
||||
mpdAddress = fileStr.split(QString("="), QString::SkipEmptyParts)[1];
|
||||
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("MPDPORT"))
|
||||
mpdPort = fileStr.split(QString("="), QString::SkipEmptyParts)[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
confFile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExtendedSysMon::sourceRequestEvent(const QString &name)
|
||||
@ -241,9 +294,9 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
fgets(output, 256, f_out);
|
||||
if (feof (f_out))
|
||||
break;
|
||||
if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString(" Artist"))
|
||||
if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
|
||||
value_artist = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString(" Title"))
|
||||
else if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
|
||||
value = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
}
|
||||
pclose(f_out);
|
||||
|
@ -32,9 +32,14 @@ public:
|
||||
protected:
|
||||
bool sourceRequestEvent(const QString &name);
|
||||
bool updateSourceEvent(const QString &source);
|
||||
bool readConfiguration(const QString confFileName);
|
||||
QStringList sources() const;
|
||||
// main configuration
|
||||
QStringList hdddev;
|
||||
QString gpudev;
|
||||
QStringList sources() const;
|
||||
// configuration
|
||||
QString mpdAddress;
|
||||
QString mpdPort;
|
||||
};
|
||||
|
||||
#endif // EXTSYSMON_H
|
||||
|
BIN
old_versions/ext-sysmon-1.4.zip
Normal file
BIN
old_versions/ext-sysmon-1.4.zip
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user