Compare commits

..

12 Commits

Author SHA1 Message Date
1b5e2c7fea edited readme 2014-03-27 20:10:59 +04:00
a3a5ebf2af release 1.5.3 2014-03-27 20:09:46 +04:00
0d3aacdec7 Fixed zero swap and memory 2013-11-19 18:17:59 +04:00
5bcf76a136 Fixed pkgrel 2013-11-18 21:20:40 +04:00
29da9b43f3 Edited README 2013-11-18 21:09:03 +04:00
e2e511f083 Release pytextmonitor 1.5.2
+ added time formats
* fixed definition of conf file for dataengine
2013-11-18 21:02:55 +04:00
ccaca2a725 Edited for 1.5 ext-sysmon 2013-11-18 19:51:57 +04:00
916c32589f Release ext-sysmon 1.5
+ added configuration file
2013-11-18 19:16:38 +04:00
24325e2d3a Edited archives 2013-11-11 09:50:23 +04:00
9569400757 Edited for #6 2013-11-11 09:47:48 +04:00
4d4317150a Edited pkgbuild 2013-11-07 01:45:55 +04:00
946c0ea874 Release ext-sysmon 1.4
* fix #4
2013-11-07 01:38:32 +04:00
18 changed files with 326 additions and 162 deletions

View File

@ -3,13 +3,13 @@
pkgname=kdeplasma-applets-pytextmonitor pkgname=kdeplasma-applets-pytextmonitor
_pkgname=py-text-monitor _pkgname=py-text-monitor
pkgver=1.5.1 pkgver=1.5.3
pkgrel=1 pkgrel=1
_dtengine=ext-sysmon _dtengine=ext-sysmon
_dtver=1.3 _dtver=1.6
pkgdesc="Minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm" pkgdesc="Minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="https://github.com/arcan1s/pytextmonitor" url="http://arcanis.name/projects/pytextmonitor"
license=('GPL') license=('GPL')
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools' 'sysstat') depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools' 'sysstat')
optdepends=("hddtemp: for HDD temperature monitor" optdepends=("hddtemp: for HDD temperature monitor"
@ -22,24 +22,24 @@ makedepends=('automoc4' 'cmake')
source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}.plasmoid 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) https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_dtengine}-${_dtver}.zip)
install=${pkgname}.install install=${pkgname}.install
md5sums=('3ef9536493e48cd460ee3f37faa8cf58' md5sums=('7fef048a8e000ccf9a1e5f0924f59cc2'
'f7fce53d5f616891b30beac1afd99728') '74f42444a2bddce898d462045c3dbd44')
backup=('usr/share/config/extsysmon.conf')
build () build () {
{
# build dataengine # build dataengine
if [[ -d ${srcdir}/${_dtengine}/build ]]; then if [[ -d ${srcdir}/${_dtengine}/build ]]; then
rm -rf "${srcdir}/${_dtengine}/build" rm -rf "${srcdir}/${_dtengine}/build"
fi fi
mkdir "${srcdir}/${_dtengine}/build"; cd "${srcdir}/${_dtengine}/build" mkdir "${srcdir}/${_dtengine}/build"
cd "${srcdir}/${_dtengine}/build"
cmake -DCMAKE_BUILD_TYPE=Release \ cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` \ -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` \
../ ../
make make
} }
package() package() {
{
# install dataengine # install dataengine
cd "${srcdir}/${_dtengine}/build" cd "${srcdir}/${_dtengine}/build"
make DESTDIR="${pkgdir}" install make DESTDIR="${pkgdir}" install

View File

@ -8,7 +8,10 @@ PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks lik
Configuration Configuration
------------- -------------
For edited output you must open Settings window and setup output format in lines: For edited output you must open Settings window and setup output format in lines:
* label `$time` - time in long format. For example, `fri Nov 6 04:48:01 2013` * label `$time` - time in default format. For example, `fri Nov 6 04:48:01 2013`
* label `$isotime` - time in iso format
* label `$shorttime` - time in short locale format
* label `$longtime` - time in long locale format
* label `$uptime` - uptime, <i>---d--h--m</i> * label `$uptime` - uptime, <i>---d--h--m</i>
* label `$cpu` - total load cpu, <i>%</i> * label `$cpu` - total load cpu, <i>%</i>
* label `$ccpu` - load CPU for each core, <i>%</i> * label `$ccpu` - load CPU for each core, <i>%</i>
@ -28,12 +31,19 @@ For edited output you must open Settings window and setup output format in lines
* label `$bat` - battery charge, <i>%</i>. Battery device may be set below. File (`/sys/class/power_supply/BAT0/capacity` by default) must contain only battery charge in percent * label `$bat` - battery charge, <i>%</i>. Battery device may be set below. File (`/sys/class/power_supply/BAT0/capacity` by default) must contain only battery charge in percent
* label `$ac` - status AC device. Return <i>(*)</i> if AC device is online or <i>( )</i> if offline. AC device may be set below. FIle (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online * label `$ac` - status AC device. Return <i>(*)</i> if AC device is online or <i>( )</i> if offline. AC device may be set below. FIle (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online
* label `$artist` - current song artist. One of supported music players must be installed * label `$artist` - current song artist. One of supported music players must be installed
* label `$album` - current song album. One of supported music players must be installed
* label `$progress` - current song progress. One of supported music players must be installed (mpd does not support yet)
* label `$time` - current song duration. One of supported music players must be installed
* label `$title` - current song title. One of supported music players must be installed * label `$title` - current song title. One of supported music players must be installed
Label order will changed if you change slider position. HTML tags in label work normally. Label order will changed if you change slider position. HTML tags in label work normally.
**NOTE** you don't may set to show $cpu in swap label for example. <b>$cpu will work only in cpu label</b>. **NOTE** you don't may set to show $cpu in swap label for example. <b>$cpu will work only in cpu label</b>.
DataEngine configuration
------------------------
You may edit DataEngine configuration. It is `/usr/share/config/extsysmon.conf` or `$HOME/share/config/extsysmon.conf` depending on the type of installation. Uncomment needed line and edit it.
TODO (wish) list TODO (wish) list
---------------- ----------------
Tooltip (graphical information): Tooltip (graphical information):

Binary file not shown.

BIN
ext-sysmon-1.6.zip Normal file

Binary file not shown.

View File

@ -14,11 +14,13 @@ include_directories (${CMAKE_SOURCE_DIR}
set (PLUGIN_NAME ${PROJECT_NAME}) set (PLUGIN_NAME ${PROJECT_NAME})
file (GLOB PROJECT_DESKTOP *.desktop) file (GLOB PROJECT_DESKTOP *.desktop)
file (GLOB PROJECT_SRCS *.cpp) file (GLOB PROJECT_SRCS *.cpp)
file (GLOB PROJECT_CONF *.conf)
# make # make
kde4_add_plugin (${PLUGIN_NAME} ${PROJECT_SRCS}) kde4_add_plugin (${PLUGIN_NAME} ${PROJECT_SRCS})
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS}) target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
# install # install
install(TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) install (FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
install (FILES ${PROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})

13
ext-sysmon/extsysmon.conf Normal file
View File

@ -0,0 +1,13 @@
# Configuration file for Extended Systemmonitor DataEngine (v.1.6)
# 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

View File

@ -1,27 +1,30 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2013 by Evgeniy Alekseev <esalekseev@gmail.com> * * Copyright (C) 2013 by Evgeniy Alekseev <esalekseev@gmail.com> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the * * along with this program; if not, write to the *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/ ***************************************************************************/
#include "extsysmon.h" #include "extsysmon.h"
#include <Plasma/DataContainer> #include <Plasma/DataContainer>
#include <QFile>
#include <QProcess>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args) ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
@ -30,29 +33,7 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
Q_UNUSED(args) Q_UNUSED(args)
setMinimumPollingInterval(333); setMinimumPollingInterval(333);
readConfiguration();
FILE *f_out;
f_out = popen("lspci 2>&1", "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] && ls -1 /dev/hd[a-z] 2>&1", "r");
while (fgets(device, 256, f_out) != NULL)
{
dev = QString(device);
if (dev[0] == '/')
hdddev.append(dev);
}
pclose(f_out);
} }
QStringList ExtendedSysMon::sources() const QStringList ExtendedSysMon::sources() const
@ -65,6 +46,81 @@ QStringList ExtendedSysMon::sources() const
return source; return source;
} }
bool ExtendedSysMon::readConfiguration()
{
// 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;
// FIXME: define configuration file
QString confFileName = QString(getenv("HOME")) + QString("/.kde4/share/config/extsysmon.conf");
QFile confFile(confFileName);
bool exists = confFile.open(QIODevice::ReadOnly);
if (!exists) {
confFileName = QString("/usr/share/config/extsysmon.conf");
confFile.setFileName(confFileName);
exists = confFile.open(QIODevice::ReadOnly);
if (!exists)
return false;
}
while (true) {
fileStr = QString(confFile.readLine());
if (fileStr[0] != '#') {
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2) {
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("GPUDEV")) {
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] == QString("ati"))
gpuDev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] == QString("nvidia"))
gpuDev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("auto"))
gpuDev = QString("ignore");
}
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("HDDDEV")) {
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("all")) {
hddDev.clear();
for (int i=0; i<fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), \
QString::SkipEmptyParts)[0].split(QString(","), QString::SkipEmptyParts).count(); i++)
hddDev.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), \
QString::SkipEmptyParts)[0].split(QString(","), QString::SkipEmptyParts)[i]);
}
}
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("MPDADDRESS"))
mpdAddress = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("MPDPORT"))
mpdPort = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
}
}
if (confFile.atEnd())
break;
}
confFile.close();
return true;
}
bool ExtendedSysMon::sourceRequestEvent(const QString &name) bool ExtendedSysMon::sourceRequestEvent(const QString &name)
{ {
return updateSourceEvent(name); return updateSourceEvent(name);
@ -76,41 +132,35 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
QString key, out, tmp_out, value; QString key, out, tmp_out, value;
bool ok = false; bool ok = false;
char output[256], val[5]; char output[256], val[5];
if (source == QString("gpu")) if (source == QString("gpu")) {
{
key = QString("GPU"); key = QString("GPU");
if (gpudev == QString("nvidia")) if (gpuDev == QString("nvidia")) {
{
f_out = popen("nvidia-smi -q -d UTILIZATION 2> /dev/null | grep Gpu | tail -n1", "r"); f_out = popen("nvidia-smi -q -d UTILIZATION 2> /dev/null | grep Gpu | tail -n1", "r");
fgets (output, 256, f_out); fgets (output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2)) (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2]; out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2];
sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok)); sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok));
value = QString(val); value = QString(val);
} }
pclose(f_out); pclose(f_out);
} }
else if (gpudev == QString("ati")) else if (gpuDev == QString("ati")) {
{
f_out = popen("aticonfig --od-getclocks 2> /dev/null | grep load | tail -n1", "r"); f_out = popen("aticonfig --od-getclocks 2> /dev/null | grep load | tail -n1", "r");
fgets (output, 256, f_out); fgets (output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 3)) (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 3))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[3]; out = QString(output).split(QString(" "), QString::SkipEmptyParts)[3];
sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok)); sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok));
value = QString(val); value = QString(val);
} }
pclose(f_out); pclose(f_out);
} }
else else {
{
value = QString(" N\\A"); value = QString(" N\\A");
} }
if (ok == false) if (ok == false)
@ -118,41 +168,35 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
setData(source, key, value); setData(source, key, value);
} }
else if (source == QString("gputemp")) else if (source == QString("gputemp")) {
{
key = QString("GPUTemp"); key = QString("GPUTemp");
if (gpudev == QString("nvidia")) if (gpuDev == QString("nvidia")) {
{
f_out = popen("nvidia-smi -q -d TEMPERATURE 2> /dev/null | grep Gpu | tail -n1", "r"); f_out = popen("nvidia-smi -q -d TEMPERATURE 2> /dev/null | grep Gpu | tail -n1", "r");
fgets (output, 256, f_out); fgets (output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2)) (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2]; out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2];
sprintf (val, "%4.1f", out.toFloat(&ok)); sprintf (val, "%4.1f", out.toFloat(&ok));
value = QString(val); value = QString(val);
} }
pclose(f_out); pclose(f_out);
} }
else if (gpudev == QString("ati")) else if (gpuDev == QString("ati")) {
{
f_out = popen("aticonfig --od-gettemperature 2> /dev/null | grep Temperature | tail -n1", "r"); f_out = popen("aticonfig --od-gettemperature 2> /dev/null | grep Temperature | tail -n1", "r");
fgets (output, 256, f_out); fgets (output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 4)) (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 4))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[4]; out = QString(output).split(QString(" "), QString::SkipEmptyParts)[4];
sprintf (val, "%4.1f", out.toFloat(&ok)); sprintf (val, "%4.1f", out.toFloat(&ok));
value = QString(val); value = QString(val);
} }
pclose(f_out); pclose(f_out);
} }
else else {
{
value = QString(" N\\A"); value = QString(" N\\A");
} }
if (ok == false) if (ok == false)
@ -160,22 +204,19 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
setData(source, key, value); setData(source, key, value);
} }
else if (source == QString("hddtemp")) else if (source == QString("hddtemp")) {
{
char command[256], *dev; char command[256], *dev;
QByteArray qb; QByteArray qb;
for (int i=0; i<hdddev.count(); i++) for (int i=0; i<hddDev.count(); i++) {
{ qb = hddDev[i].toUtf8();
qb = hdddev[i].toUtf8();
dev = qb.data(); dev = qb.data();
sprintf(command, "hddtemp %s 2> /dev/null", dev); sprintf(command, "sudo hddtemp %s 2> /dev/null", dev);
f_out = popen(command, "r"); f_out = popen(command, "r");
fgets(output, 256, f_out); fgets(output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(":"), QString::SkipEmptyParts).count() < 3)) (QString(output).split(QString(":"), QString::SkipEmptyParts).count() < 3))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(":"), QString::SkipEmptyParts)[2]; out = QString(output).split(QString(":"), QString::SkipEmptyParts)[2];
sprintf (val, "%4.1f", out.left(out.count()-4).toFloat(&ok)); sprintf (val, "%4.1f", out.left(out.count()-4).toFloat(&ok));
value = QString(val); value = QString(val);
@ -184,71 +225,120 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
if (ok == false) if (ok == false)
value = QString(" N\\A"); value = QString(" N\\A");
value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
setData(source, hdddev[i], value); setData(source, hddDev[i], value);
} }
} }
else if (source == QString("player")) else if (source == QString("player")) {
{ QProcess player;
QString qoutput;
QString value_album, value_artist, value_progress, value_duration, qstr;
// qmmp // qmmp
output[0] = '\0'; qoutput = QString("");
value = QString("N\\A");
value_album = QString("N\\A");
value_artist = QString("N\\A");
value_progress = QString("0");
value_duration = QString("0");
player.start("qmmp --status");
player.waitForFinished(-1);
qoutput = player.readAllStandardOutput();
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ALBUM"))
value_album = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ARTIST"))
value_artist = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.at(0) == QChar('[')) {
QString time = qstr.split(QString(" "), QString::SkipEmptyParts)[2].split(QString("\n"), QString::SkipEmptyParts)[0];
value_progress = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
value_duration = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
}
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("TITLE"))
value = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
}
key = QString("qmmp_album");
setData(source, key, value_album);
key = QString("qmmp_artist"); key = QString("qmmp_artist");
f_out = popen("qmmp --nowplaying '%if(%p,%p,Unknown)' 2> /dev/null", "r"); setData(source, key, value_artist);
fgets(output, 256, f_out); key = QString("qmmp_progress");
if (output[0] == '\0') setData(source, key, value_progress);
value = QString("N\\A"); key = QString("qmmp_duration");
else setData(source, key, value_duration);
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
pclose(f_out);
setData(source, key, value);
output[0] = '\0';
key = QString("qmmp_title"); key = QString("qmmp_title");
f_out = popen("qmmp --nowplaying '%if(%t,%t,Unknown)' 2> /dev/null", "r");
fgets(output, 256, f_out);
if (output[0] == '\0')
value = QString("N\\A");
else
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
pclose(f_out);
setData(source, key, value); setData(source, key, value);
// amarok // amarok
output[0] = '\0'; qoutput = QString("");
value = QString("N\\A");
value_album = QString("N\\A");
value_artist = QString("N\\A");
value_progress = QString("0");
value_duration = QString("0");
player.start("qdbus org.kde.amarok /Player GetMetadata");
player.waitForFinished(-1);
qoutput = player.readAllStandardOutput();
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("album"))
value_album = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("artist"))
value_artist = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time"))
value_duration = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("title"))
value = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
}
player.start("qdbus org.kde.amarok /Player PositionGet");
player.waitForFinished(-1);
qoutput = player.readAllStandardOutput();
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
int time = qstr.toInt() / 1000;
value_progress = QString::number(time);
}
key = QString("amarok_album");
setData(source, key, value_album);
key = QString("amarok_artist"); key = QString("amarok_artist");
f_out = popen("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep albumartist: | cut -c14-", "r"); setData(source, key, value_artist);
fgets(output, 256, f_out); key = QString("amarok_progress");
if (output[0] == '\0') setData(source, key, value_progress);
value = QString("N\\A"); key = QString("amarok_duration");
else setData(source, key, value_duration);
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
pclose(f_out);
setData(source, key, value);
output[0] = '\0';
key = QString("amarok_title"); key = QString("amarok_title");
f_out = popen("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep title: | cut -c8-", "r");
fgets(output, 256, f_out);
if (output[0] == '\0')
value = QString("N\\A");
else
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
pclose(f_out);
setData(source, key, value); setData(source, key, value);
// mpd // mpd
QString value_artist;
value = QString("N\\A"); value = QString("N\\A");
value_album = QString("N\\A");
value_artist = QString("N\\A"); value_artist = QString("N\\A");
f_out = popen("echo 'currentsong\nclose' | curl --connect-timeout 1 -fsm 3 telnet://localhost:6600 2> /dev/null", "r"); value_progress = QString("0");
while (true) value_duration = QString("0");
{ char commandStr[512];
fgets(output, 256, f_out); sprintf (commandStr, "echo 'currentsong\nclose' | curl --connect-timeout 1 -fsm 3 telnet://%s:%s 2> /dev/null", \
if (feof (f_out)) mpdAddress.toUtf8().data(), mpdPort.toUtf8().data());
break; qoutput = QString("");
if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist")) player.start(QString(commandStr));
value_artist = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0]; player.waitForFinished(-1);
else if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title")) qoutput = player.readAllStandardOutput();
value = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0]; for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Album"))
value_album = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
value_artist = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Time"))
value_duration = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
value = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
} }
pclose(f_out); key = QString("mpd_album");
setData(source, key, value_album);
key = QString("mpd_artist"); key = QString("mpd_artist");
setData(source, key, value_artist); setData(source, key, value_artist);
key = QString("mpd_progress");
setData(source, key, value_progress);
key = QString("mpd_duration");
setData(source, key, value_duration);
key = QString("mpd_title"); key = QString("mpd_title");
setData(source, key, value); setData(source, key, value);
} }

View File

@ -32,9 +32,14 @@ public:
protected: protected:
bool sourceRequestEvent(const QString &name); bool sourceRequestEvent(const QString &name);
bool updateSourceEvent(const QString &source); bool updateSourceEvent(const QString &source);
QStringList hdddev; bool readConfiguration();
QString gpudev;
QStringList sources() const; QStringList sources() const;
// main configuration
QStringList hddDev;
QString gpuDev;
// configuration
QString mpdAddress;
QString mpdPort;
}; };
#endif // EXTSYSMON_H #endif // EXTSYSMON_H

View File

@ -13,7 +13,7 @@ X-Plasma-EngineName=ext-sysmon
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=ext-sysmon X-KDE-PluginInfo-Name=ext-sysmon
X-KDE-PluginInfo-Version=1.3 X-KDE-PluginInfo-Version=1.6
X-KDE-PluginInfo-Category=System Information X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-License=GPL

View File

@ -10,13 +10,16 @@ post_install()
{ {
func_update func_update
cat << EOF cat << EOF
Make sure that \`hddtemp\` can be run as non-root Make sure that \`hddtemp\` can be run with sudo without password
EOF EOF
} }
post_upgrade() post_upgrade()
{ {
func_update func_update
cat << EOF
Make sure that \`hddtemp\` can be run with sudo without password
EOF
} }
post_remove() post_remove()

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -21,6 +21,7 @@ from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript from PyKDE4 import plasmascript
import datetime
class DataEngine: class DataEngine:
@ -255,29 +256,51 @@ class DataEngine:
self.parent.label_hddtemp.setText(text) self.parent.label_hddtemp.setText(text)
elif (sourceName == "player"): elif (sourceName == "player"):
if (self.parent.player_name == 0): if (self.parent.player_name == 0):
title = str(data[QString(u'amarok_title')]) album = str(data[QString(u'amarok_album')])
artist = str(data[QString(u'amarok_artist')]) artist = str(data[QString(u'amarok_artist')])
progress = str(data[QString(u'amarok_progress')])
time = str(data[QString(u'amarok_duration')])
title = str(data[QString(u'amarok_title')])
elif (self.parent.player_name == 1): elif (self.parent.player_name == 1):
title = str(data[QString(u'mpd_title')]) album = str(data[QString(u'mpd_album')])
artist = str(data[QString(u'mpd_artist')]) artist = str(data[QString(u'mpd_artist')])
progress = str(data[QString(u'mpd_progress')])
time = str(data[QString(u'mpd_duration')])
title = str(data[QString(u'mpd_title')])
elif (self.parent.player_name == 2): elif (self.parent.player_name == 2):
title = str(data[QString(u'qmmp_title')]) album = str(data[QString(u'qmmp_album')])
artist = str(data[QString(u'qmmp_artist')]) artist = str(data[QString(u'qmmp_artist')])
if (self.parent.playerFormat.split('$artist')[0] != self.parent.playerFormat): progress = str(data[QString(u'qmmp_progress')])
if ((len(artist) + len(title)) > 10): time = str(data[QString(u'qmmp_duration')])
line = self.parent.playerFormat.split('$artist')[0] + artist[:5] + u"" + self.parent.playerFormat.split('$artist')[1] title = str(data[QString(u'qmmp_title')])
else: line = self.parent.playerFormat
line = self.parent.playerFormat.split('$artist')[0] + artist + self.parent.playerFormat.split('$artist')[1] if (line.split('$album')[0] != line):
else: line = line.split('$album')[0] + album + line.split('$album')[1]
line = self.parent.playerFormat if (line.split('$artist')[0] != line):
line = line.split('$artist')[0] + artist + line.split('$artist')[1]
if (line.split('$progress')[0] != line):
timeText = '%02i:%02i' % (int(time)/60, int(time)%60)
line = line.split('$progress')[0] + timeText + line.split('$progress')[1]
if (line.split('$time')[0] != line):
timeText = '%02i:%02i' % (int(time)/60, int(time)%60)
line = line.split('$time')[0] + timeText + line.split('$time')[1]
if (line.split('$title') != line): if (line.split('$title') != line):
line = line.split('$title')[0] + title + line.split('$title')[1] line = line.split('$title')[0] + title + line.split('$title')[1]
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
self.parent.label_player.setText(text) self.parent.label_player.setText(text)
elif (sourceName == "Local"): elif (sourceName == "Local"):
value = str(data[QString(u'DateTime')].toString().toUtf8())
if (self.parent.timeFormat.split('$time')[0] != self.parent.timeFormat): if (self.parent.timeFormat.split('$time')[0] != self.parent.timeFormat):
value = str(data[QString(u'DateTime')].toString(Qt.TextDate).toUtf8())
line = self.parent.timeFormat.split('$time')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$time')[1] line = self.parent.timeFormat.split('$time')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$time')[1]
elif (self.parent.timeFormat.split('$isotime')[0] != self.parent.timeFormat):
value = str(data[QString(u'DateTime')].toString(Qt.ISODate).toUtf8())
line = self.parent.timeFormat.split('$isotime')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$isotime')[1]
elif (self.parent.timeFormat.split('$shorttime')[0] != self.parent.timeFormat):
value = str(data[QString(u'DateTime')].toString(Qt.SystemLocaleShortDate).toUtf8())
line = self.parent.timeFormat.split('$shorttime')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$shorttime')[1]
elif (self.parent.timeFormat.split('$longtime')[0] != self.parent.timeFormat):
value = str(data[QString(u'DateTime')].toString(Qt.SystemLocaleLongDate).toUtf8())
line = self.parent.timeFormat.split('$longtime')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$longtime')[1]
else: else:
line = self.parent.timeFormat line = self.parent.timeFormat
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]

View File

@ -116,6 +116,7 @@ class pyTextWidget(plasmascript.Applet):
# setup number of cores # setup number of cores
commandOut = commands.getoutput("grep -c '^processor' /proc/cpuinfo") commandOut = commands.getoutput("grep -c '^processor' /proc/cpuinfo")
self.numCores = int(commandOut) self.numCores = int(commandOut)
self.tempdev = "tempdevice"
# create dictionaries # create dictionaries
self.dict_orders = {'6':'bat', '1':'cpu', '7':'cpuclock', '9':'gpu', 'a':'gputemp', self.dict_orders = {'6':'bat', '1':'cpu', '7':'cpuclock', '9':'gpu', 'a':'gputemp',
@ -186,8 +187,11 @@ class pyTextWidget(plasmascript.Applet):
def memText(self): def memText(self):
"""function to set mem text""" """function to set mem text"""
full = self.mem_uf + self.mem_free full = self.mem_uf + self.mem_free
mem = 100 * self.mem_used / full try:
mem = "%5s" % (str(round(mem, 1))) mem = 100 * self.mem_used / full
mem = "%5s" % (str(round(mem, 1)))
except:
mem = " N\\A"
if (self.memFormat.split('$mem')[0] != self.memFormat): if (self.memFormat.split('$mem')[0] != self.memFormat):
line = self.memFormat.split('$mem')[0] + mem + self.memFormat.split('$mem')[1] line = self.memFormat.split('$mem')[0] + mem + self.memFormat.split('$mem')[1]
else: else:
@ -199,8 +203,11 @@ class pyTextWidget(plasmascript.Applet):
def swapText(self): def swapText(self):
"""function to set swap text""" """function to set swap text"""
full = self.swap_used + self.swap_free full = self.swap_used + self.swap_free
mem = 100 * self.swap_used / full try:
mem = "%5s" % (str(round(mem, 1))) mem = 100 * self.swap_used / full
mem = "%5s" % (str(round(mem, 1)))
except:
mem = " N\\A"
if (self.swapFormat.split('$swap')[0] != self.swapFormat): if (self.swapFormat.split('$swap')[0] != self.swapFormat):
line = self.swapFormat.split('$swap')[0] + mem + self.swapFormat.split('$swap')[1] line = self.swapFormat.split('$swap')[0] + mem + self.swapFormat.split('$swap')[1]
else: else:

View File

@ -298,12 +298,17 @@ class Reinit():
self.parent.playerFormat = str(settings.get('playerFormat', '[$artist - $title]')) self.parent.playerFormat = str(settings.get('playerFormat', '[$artist - $title]'))
self.parent.player_name = settings.get('player_name', 0).toInt()[0] self.parent.player_name = settings.get('player_name', 0).toInt()[0]
self.parent.label_player = NewPlasmaLabel(self.parent.applet, self.parent) self.parent.label_player = NewPlasmaLabel(self.parent.applet, self.parent)
if (self.parent.playerFormat.split('$artist')[0] != self.parent.playerFormat): line = self.parent.playerFormat
line = self.parent.playerFormat.split('$artist')[0] + '----------' + self.parent.playerFormat.split('$artist')[1] if (line.split('$album')[0] != line):
else: line = line.split('$album')[0] + 'N\\A' + line.split('$album')[1]
line = self.parent.playerFormat if (line.split('$artist')[0] != line):
line = line.split('$artist')[0] + 'N\\A' + line.split('$artist')[1]
if (line.split('$progress')[0] != line):
line = line.split('$progress')[0] + '00:00' + line.split('$progress')[1]
if (line.split('$title') != line): if (line.split('$title') != line):
line = line.split('$title')[0] + '----------' + line.split('$title')[1] line = line.split('$title')[0] + 'N\\A' + line.split('$title')[1]
if (line.split('$time') != line):
line = line.split('$time')[0] + '00:00' + line.split('$time')[1]
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
self.parent.label_player.setText(text) self.parent.label_player.setText(text)
self.parent.layout.addItem(self.parent.label_player) self.parent.layout.addItem(self.parent.label_player)

View File

@ -63,7 +63,10 @@
<item> <item>
<widget class="QLineEdit" name="lineEdit_time"> <widget class="QLineEdit" name="lineEdit_time">
<property name="toolTip"> <property name="toolTip">
<string notr="true">$time - time</string> <string notr="true">$time - time in default format
$isotime - time in ISO format
$shorttime - time in short format
$longtime - time in log format</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -945,8 +948,11 @@ $ac - AC status</string>
<item> <item>
<widget class="QLineEdit" name="lineEdit_player"> <widget class="QLineEdit" name="lineEdit_player">
<property name="toolTip"> <property name="toolTip">
<string notr="true">$title - song title <string notr="true">$album - song album
$artist - song artist</string> $artist - song artist
$progress - song progress
$time - song duration
$title - song title</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>

View File

@ -12,7 +12,7 @@ X-Plasma-RequiredExtensions=LaunchApp,LocalIO,FileDialog
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=py-text-monitor X-KDE-PluginInfo-Name=py-text-monitor
X-KDE-PluginInfo-Version=1.5.1 X-KDE-PluginInfo-Version=1.5.3
X-KDE-PluginInfo-Website=http://kde-look.org/ X-KDE-PluginInfo-Website=http://kde-look.org/
X-KDE-PluginInfo-Category=System Information X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-Depends=