mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-24 11:55:43 +00:00
xmms2 patch
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@612 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
704b590071
commit
e8c9f49594
3
AUTHORS
3
AUTHORS
@ -100,6 +100,9 @@ J
|
||||
killfire
|
||||
fs_used_perc and fs_bar_free patch
|
||||
|
||||
Lassi Selander <sleipner at users dot sourceforge dot net>
|
||||
XMMS2 patch
|
||||
|
||||
Lauri Hakkarainen <b10nik at users dot sourceforge dot net>
|
||||
Some translating, web and other stuff
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
# $Id$
|
||||
|
||||
2006-03-25
|
||||
* Added XMMS2 patch 1456203 from Lassi Selander
|
||||
|
||||
2006-03-21
|
||||
* Fixed ${top(_mem)} related code on FreeBSD (with help of Petr
|
||||
Holub <hopet@users.sourceforge.net>)
|
||||
|
16
configure.in
16
configure.in
@ -304,6 +304,22 @@ if test x$want_mpd = xyes; then
|
||||
AC_DEFINE(MPD, 1, [Define if you want MPD support])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl XMMS2
|
||||
dnl
|
||||
|
||||
want_xmms2=no
|
||||
AC_ARG_ENABLE(xmms2,
|
||||
[ --enable-xmms2 enable if you want XMMS2 support [[default=no]]],
|
||||
[want_xmms2="$enableval"])
|
||||
|
||||
AM_CONDITIONAL(BUILD_XMMS2, test x$want_xmms2 = xyes)
|
||||
if test x$want_xmms2 = xyes; then
|
||||
CFLAGS="$CFLAGS `pkg-config --cflags xmms2-client`"
|
||||
LIBS="$LIBS `pkg-config --libs xmms2-client`"
|
||||
AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl PORT_MONITORS
|
||||
dnl
|
||||
|
@ -28,6 +28,10 @@ if BUILD_MPD
|
||||
mpd = mpd.c libmpdclient.c
|
||||
endif
|
||||
|
||||
if BUILD_XMMS2
|
||||
xmms2 = xmms2.c
|
||||
endif
|
||||
|
||||
if BUILD_LINUX
|
||||
linux = linux.c top.c
|
||||
PTHREAD_LIBS = -lpthread
|
||||
@ -58,9 +62,9 @@ if BUILD_X11
|
||||
x11 = x11.c
|
||||
endif
|
||||
|
||||
conky_SOURCES = common.c fs.c $(linux) mail.c mixer.c $(seti) $(mpd) $(solaris) $(freebsd) $(netbsd) $(port_monitors) conky.c conky.h $(x11) $(mldonkey) remoted.c remoted.h remotec.c remotec.h $(xmms) $(bmpx)
|
||||
conky_SOURCES = common.c fs.c $(linux) mail.c mixer.c $(seti) $(mpd) $(xmms2) $(solaris) $(freebsd) $(netbsd) $(port_monitors) conky.c conky.h $(x11) $(mldonkey) remoted.c remoted.h remotec.c remotec.h $(xmms) $(bmpx)
|
||||
|
||||
AM_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS) $(PTHREAD_LIBS) -lm
|
||||
|
||||
EXTRA_DIST = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
|
||||
libmpdclient.h top.h mldonkey.c ftp.c ftp.h x11.c
|
||||
libmpdclient.h xmms2.c top.h mldonkey.c ftp.c ftp.h x11.c
|
||||
|
@ -226,6 +226,12 @@ void update_stuff()
|
||||
if (NEED(INFO_MPD))
|
||||
update_mpd();
|
||||
#endif
|
||||
|
||||
#ifdef XMMS2
|
||||
if (NEED(INFO_XMMS2))
|
||||
update_xmms2();
|
||||
#endif
|
||||
|
||||
#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
|
||||
if (NEED(INFO_XMMS))
|
||||
update_xmms();
|
||||
|
141
src/conky.c
141
src/conky.c
@ -289,6 +289,10 @@ static char original_text[] =
|
||||
#ifdef MPD
|
||||
"${color grey}MPD: $mpd_status $mpd_artist - $mpd_title from $mpd_album at $mpd_vol\n"
|
||||
"Bitrate: $mpd_bitrate\n" "Progress: $mpd_bar\n"
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
"${color grey}XMMS2: $xmms2_status $xmms2_artist - $xmms2_title from $xmms2_album\n"
|
||||
"Progress: $xmms2_bar\n"
|
||||
#endif
|
||||
"${color grey}Name PID CPU% MEM%\n"
|
||||
" ${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}\n"
|
||||
@ -892,6 +896,24 @@ enum text_object_type {
|
||||
OBJ_mpd_percent,
|
||||
OBJ_mpd_smart,
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
OBJ_xmms2_title,
|
||||
OBJ_xmms2_artist,
|
||||
OBJ_xmms2_album,
|
||||
// OBJ_xmms2_random,
|
||||
// OBJ_xmms2_repeat,
|
||||
// OBJ_xmms2_vol,
|
||||
// OBJ_xmms2_bitrate,
|
||||
OBJ_xmms2_status,
|
||||
OBJ_xmms2_bar,
|
||||
OBJ_xmms2_elapsed,
|
||||
OBJ_xmms2_length,
|
||||
OBJ_xmms2_track,
|
||||
// OBJ_xmms2_name,
|
||||
OBJ_xmms2_file,
|
||||
OBJ_xmms2_percent,
|
||||
// OBJ_xmms2_smart,
|
||||
#endif
|
||||
#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
|
||||
OBJ_xmms_status,
|
||||
OBJ_xmms_title,
|
||||
@ -1199,6 +1221,58 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
||||
break;
|
||||
case OBJ_mpd_host:
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
case OBJ_xmms2_title:
|
||||
if (info.xmms2.title) {
|
||||
free(info.xmms2.title);
|
||||
info.xmms2.title = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_artist:
|
||||
if (info.xmms2.artist) {
|
||||
free(info.xmms2.artist);
|
||||
info.xmms2.artist = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_album:
|
||||
if (info.xmms2.album) {
|
||||
free(info.xmms2.album);
|
||||
info.xmms2.album = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_track:
|
||||
if (info.xmms2.track) {
|
||||
free(info.xmms2.track);
|
||||
info.xmms2.track = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_file:
|
||||
if (info.xmms2.file) {
|
||||
free(info.xmms2.file);
|
||||
info.xmms2.file = 0;
|
||||
}
|
||||
break;
|
||||
case OBJ_xmms2_status:
|
||||
if (info.xmms2.status) {
|
||||
free(info.xmms2.status);
|
||||
info.xmms2.status = 0;
|
||||
}
|
||||
break;
|
||||
/* case OBJ_xmms2_smart:
|
||||
if (info.xmms2.artist) {
|
||||
free(info.xmms2.artist);
|
||||
info.xmms2.artist = 0;
|
||||
}
|
||||
if (info.xmms2.title) {
|
||||
free(info.xmms2.title);
|
||||
info.xmms2.title = 0;
|
||||
}
|
||||
if (info.xmms2.file) {
|
||||
free(info.xmms2.file);
|
||||
info.xmms2.file = 0;
|
||||
}
|
||||
break;*/
|
||||
#endif
|
||||
#ifdef BMPX
|
||||
case OBJ_bmpx_title:
|
||||
case OBJ_bmpx_artist:
|
||||
@ -1914,6 +1988,21 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
|
||||
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
END OBJ(mpd_smart, INFO_MPD) END
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
OBJ(xmms2_artist, INFO_XMMS2)
|
||||
END OBJ(xmms2_title, INFO_XMMS2)
|
||||
END OBJ(xmms2_length, INFO_XMMS2)
|
||||
END OBJ(xmms2_track, INFO_XMMS2)
|
||||
END OBJ(xmms2_file, INFO_XMMS2)
|
||||
END OBJ(xmms2_album, INFO_XMMS2)
|
||||
END OBJ(xmms2_status, INFO_XMMS2)
|
||||
END OBJ(xmms2_elapsed, INFO_XMMS2)
|
||||
END OBJ(xmms2_length, INFO_XMMS2)
|
||||
END OBJ(xmms2_percent, INFO_XMMS2)
|
||||
END OBJ(xmms2_bar, INFO_XMMS2)
|
||||
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
END
|
||||
#endif
|
||||
#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
|
||||
OBJ(xmms_status, INFO_XMMS) END
|
||||
OBJ(xmms_title, INFO_XMMS) END
|
||||
@ -3209,6 +3298,47 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
OBJ(xmms2_title) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.title);
|
||||
}
|
||||
OBJ(xmms2_artist) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.artist);
|
||||
}
|
||||
OBJ(xmms2_album) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.album);
|
||||
}
|
||||
OBJ(xmms2_track) {
|
||||
snprintf(p, p_max_size, "%i", cur->xmms2.track);
|
||||
}
|
||||
OBJ(xmms2_file) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.file);
|
||||
}
|
||||
OBJ(xmms2_status) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms2.status);
|
||||
}
|
||||
OBJ(xmms2_elapsed) {
|
||||
int tmp = cur->xmms2.elapsed;
|
||||
snprintf(p, p_max_size, "%02d:%02d",
|
||||
tmp / 60000, (tmp / 1000) % 60);
|
||||
}
|
||||
OBJ(xmms2_length) {
|
||||
int tmp = cur->xmms2.length;
|
||||
snprintf(p, p_max_size, "%02d:%02d",
|
||||
tmp / 60000, (tmp / 1000) % 60);
|
||||
}
|
||||
OBJ(xmms2_percent) {
|
||||
snprintf(p, p_max_size, "%2.0f",
|
||||
cur->xmms2.progress * 100);
|
||||
}
|
||||
OBJ(xmms2_bar) {
|
||||
new_bar(p, obj->data.pair.a,
|
||||
obj->data.pair.b,
|
||||
(int) (cur->xmms2.progress *
|
||||
255.0f));
|
||||
}
|
||||
|
||||
#endif
|
||||
#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
|
||||
OBJ(xmms_status) {
|
||||
snprintf(p, p_max_size, "%s", cur->xmms.items[XMMS_STATUS]);
|
||||
@ -4839,6 +4969,17 @@ static void set_default_configurations(void)
|
||||
info.mpd.track = NULL;
|
||||
info.mpd.name = NULL;
|
||||
info.mpd.file = NULL;
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
info.xmms2.status = NULL;
|
||||
info.xmms2.artist = NULL;
|
||||
info.xmms2.album = NULL;
|
||||
info.xmms2.title = NULL;
|
||||
// info.xmms2.random = NULL;
|
||||
// info.xmms2.track = NULL;
|
||||
// info.xmms2.name = NULL;
|
||||
info.xmms2.file = NULL;
|
||||
// info.xmms2.connection = NULL;
|
||||
#endif
|
||||
use_spacer = 0;
|
||||
#ifdef X11
|
||||
|
40
src/conky.h
40
src/conky.h
@ -46,6 +46,10 @@
|
||||
#include "xmms.h"
|
||||
#endif
|
||||
|
||||
#ifdef XMMS2
|
||||
#include <xmmsclient/xmmsclient.h>
|
||||
#endif
|
||||
|
||||
#define TOP_CPU 1
|
||||
#define TOP_NAME 2
|
||||
#define TOP_PID 3
|
||||
@ -125,6 +129,25 @@ struct mpd_s {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef XMMS2
|
||||
struct xmms2_s {
|
||||
char *title;
|
||||
char *artist;
|
||||
char *album;
|
||||
char *status;
|
||||
// char *random;
|
||||
// char *repeat;
|
||||
// char *name;
|
||||
char *file;
|
||||
// int volume;
|
||||
float progress;
|
||||
int track;
|
||||
// int bitrate;
|
||||
unsigned int length;
|
||||
unsigned int elapsed;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
|
||||
struct xmms_s {
|
||||
unsigned int project_mask;
|
||||
@ -193,6 +216,9 @@ enum {
|
||||
#ifdef BMPX
|
||||
INFO_BMPX = 24,
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
INFO_XMMS2 = 25,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -236,6 +262,13 @@ struct information {
|
||||
struct mpd_s mpd;
|
||||
mpd_Connection *conn;
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
struct xmms2_s xmms2;
|
||||
int xmms2_conn_state;
|
||||
xmms_socket_t xmms2_fd;
|
||||
fd_set xmms2_fdset;
|
||||
xmmsc_connection_t *xmms2_conn;
|
||||
#endif
|
||||
#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
|
||||
struct xmms_s xmms;
|
||||
#endif
|
||||
@ -478,12 +511,17 @@ char *get_apm_adapter(void);
|
||||
char *get_apm_battery_life(void);
|
||||
char *get_apm_battery_time(void);
|
||||
#endif
|
||||
/* in mpd.c */
|
||||
|
||||
/* in mpd.c */
|
||||
#ifdef MPD
|
||||
void update_mpd();
|
||||
#endif
|
||||
|
||||
/* in xmm2.c */
|
||||
#ifdef XMMS2
|
||||
void update_xmms2();
|
||||
#endif
|
||||
|
||||
#ifdef MLDONKEY
|
||||
/* in mldonkey.c */
|
||||
typedef long long int64;
|
||||
|
Loading…
Reference in New Issue
Block a user