1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-02 12:08:33 +00:00

run without x11

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@79 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-08-08 01:18:52 +00:00
parent 5edfd58e18
commit fb78b0f0ca
11 changed files with 422 additions and 333 deletions

View File

@ -1,5 +1,6 @@
2005-08-07
* mpd password patch from Joshua Gerrish
* conky can run without X now, use --disable-x11 when configuring
2005-08-06
* Conky 1.2 released

View File

@ -15,13 +15,13 @@
<kdevautoproject>
<general>
<activetarget>conky</activetarget>
<useconfiguration>debug</useconfiguration>
<useconfiguration>debug-no-x</useconfiguration>
</general>
<run>
<mainprogram>conky</mainprogram>
<directoryradio>build</directoryradio>
<customdirectory>/</customdirectory>
<programargs></programargs>
<programargs/>
<terminal>false</terminal>
<autocompile>true</autocompile>
<envvars/>
@ -48,7 +48,7 @@
<f77flags/>
</optimized>
<debug>
<configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey</configargs>
<configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --enable-x11</configargs>
<builddir>debug</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
@ -64,6 +64,23 @@
<cxxflags></cxxflags>
<f77flags></f77flags>
</debug>
<debug-no-x>
<envvars/>
<configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --disable-x11</configargs>
<builddir>debug-no-x</builddir>
<topsourcedir></topsourcedir>
<cppflags></cppflags>
<ldflags></ldflags>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<ccompilerbinary></ccompilerbinary>
<cxxcompilerbinary></cxxcompilerbinary>
<f77compilerbinary></f77compilerbinary>
<cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3</cflags>
<cxxflags></cxxflags>
<f77flags></f77flags>
</debug-no-x>
</configurations>
<make>
<envvars>

View File

@ -37,8 +37,12 @@ if BUILD_MLDONKEY
mldonkey = mldonkey.c
endif
if BUILD_X11
x11 = x11.c
endif
conky_SOURCES = common.c fs.c top.c $(linux) mail.c mixer.c $(seti) $(mpd) \
$(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h x11.c $(metar) \
$(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h $(x11) $(metar) \
$(mldonkey)
conky_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS)
@ -59,4 +63,4 @@ EXTRA_DIST = conkyrc.sample conky.1 conky.x \
app-admin/conky/conky-1.2.ebuild
EXTRA_conky_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h
cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h x11.c

View File

@ -64,14 +64,15 @@ am__conky_SOURCES_DIST = common.c fs.c top.c linux.c mail.c mixer.c \
@BUILD_FREEBSD_TRUE@am__objects_5 = freebsd.$(OBJEXT)
@BUILD_NETBSD_TRUE@am__objects_6 = netbsd.$(OBJEXT)
@BUILD_CAIRO_TRUE@am__objects_7 = cairo.$(OBJEXT)
@BUILD_METAR_TRUE@am__objects_8 = ftp.$(OBJEXT) metarinfo.$(OBJEXT)
@BUILD_MLDONKEY_TRUE@am__objects_9 = mldonkey.$(OBJEXT)
@BUILD_X11_TRUE@am__objects_8 = x11.$(OBJEXT)
@BUILD_METAR_TRUE@am__objects_9 = ftp.$(OBJEXT) metarinfo.$(OBJEXT)
@BUILD_MLDONKEY_TRUE@am__objects_10 = mldonkey.$(OBJEXT)
am_conky_OBJECTS = common.$(OBJEXT) fs.$(OBJEXT) top.$(OBJEXT) \
$(am__objects_1) mail.$(OBJEXT) mixer.$(OBJEXT) \
$(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_5) $(am__objects_6) $(am__objects_7) \
conky.$(OBJEXT) x11.$(OBJEXT) $(am__objects_8) \
$(am__objects_9)
conky.$(OBJEXT) $(am__objects_8) $(am__objects_9) \
$(am__objects_10)
conky_OBJECTS = $(am_conky_OBJECTS)
am__DEPENDENCIES_1 =
conky_DEPENDENCIES = $(am__DEPENDENCIES_1)
@ -126,6 +127,8 @@ BUILD_SETI_FALSE = @BUILD_SETI_FALSE@
BUILD_SETI_TRUE = @BUILD_SETI_TRUE@
BUILD_SOLARIS_FALSE = @BUILD_SOLARIS_FALSE@
BUILD_SOLARIS_TRUE = @BUILD_SOLARIS_TRUE@
BUILD_X11_FALSE = @BUILD_X11_FALSE@
BUILD_X11_TRUE = @BUILD_X11_TRUE@
CAIROCONFIG = @CAIROCONFIG@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@ -206,8 +209,9 @@ target_alias = @target_alias@
@BUILD_METAR_TRUE@metar = ftp.c metarinfo.c
@BUILD_METAR_TRUE@METAR_LIBS = -lmetar
@BUILD_MLDONKEY_TRUE@mldonkey = mldonkey.c
@BUILD_X11_TRUE@x11 = x11.c
conky_SOURCES = common.c fs.c top.c $(linux) mail.c mixer.c $(seti) $(mpd) \
$(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h x11.c $(metar) \
$(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h $(x11) $(metar) \
$(mldonkey)
conky_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS)
@ -219,7 +223,7 @@ EXTRA_DIST = conkyrc.sample conky.1 conky.x \
app-admin/conky/conky-1.2.ebuild
EXTRA_conky_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h
cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h x11.c
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am

1
TODO
View File

@ -9,6 +9,7 @@ Heres a very simplified roadmap for Conky. By no means does this mean any of th
* conditional colours (ie if temp > 40C, make it red)
* think of new features to add
* max_width
* move things out of conky.c, since it's far too big
1.4
* ideas needed
1.5 (maybe in december?)

View File

@ -135,5 +135,8 @@
/* Version number of package */
#undef VERSION
/* Define if you want to use X11 */
#undef X11
/* Define if you are using Xft */
#undef XFT

355
configure vendored
View File

@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar BUILD_LINUX_TRUE BUILD_LINUX_FALSE BUILD_SOLARIS_TRUE BUILD_SOLARIS_FALSE BUILD_FREEBSD_TRUE BUILD_FREEBSD_FALSE BUILD_NETBSD_TRUE BUILD_NETBSD_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP BUILD_SETI_TRUE BUILD_SETI_FALSE BUILD_MPD_TRUE BUILD_MPD_FALSE BUILD_CAIRO_TRUE BUILD_CAIRO_FALSE CAIROCONFIG BUILD_METAR_TRUE BUILD_METAR_FALSE BUILD_MLDONKEY_TRUE BUILD_MLDONKEY_FALSE XFTCONFIG HELP2MAN HAVE_HELP2MAN_TRUE HAVE_HELP2MAN_FALSE X11_LIBS XFT_LIBS LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar BUILD_LINUX_TRUE BUILD_LINUX_FALSE BUILD_SOLARIS_TRUE BUILD_SOLARIS_FALSE BUILD_FREEBSD_TRUE BUILD_FREEBSD_FALSE BUILD_NETBSD_TRUE BUILD_NETBSD_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP BUILD_SETI_TRUE BUILD_SETI_FALSE BUILD_MPD_TRUE BUILD_MPD_FALSE BUILD_CAIRO_TRUE BUILD_CAIRO_FALSE CAIROCONFIG BUILD_METAR_TRUE BUILD_METAR_FALSE BUILD_MLDONKEY_TRUE BUILD_MLDONKEY_FALSE BUILD_X11_TRUE BUILD_X11_FALSE XFTCONFIG HELP2MAN HAVE_HELP2MAN_TRUE HAVE_HELP2MAN_FALSE X11_LIBS XFT_LIBS LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -835,10 +835,6 @@ Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
X features:
--x-includes=DIR X include files are in DIR
--x-libraries=DIR X library files are in DIR
_ACEOF
fi
@ -860,11 +856,7 @@ Optional Features:
--enable-cairo enable if you want Cairo support default=no
--enable-metar enable if you want metar stats (weather information) default=no
--enable-mldonkey enable if you want MLDonkey support default=no
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-x use the X Window System
--enable-x11 enable if you want X11 support default=yes
Some influential environment variables:
CC C compiler command
@ -4967,110 +4959,93 @@ fi
echo "$as_me:$LINENO: checking for X" >&5
echo $ECHO_N "checking for X... $ECHO_C" >&6
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
withval="$with_x"
want_x11=yes
# Check whether --enable-x11 or --disable-x11 was given.
if test "${enable_x11+set}" = set; then
enableval="$enable_x11"
want_x11="$enableval"
fi;
# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
if test "x$with_x" = xno; then
# The user explicitly disabled X.
have_x=disabled
if test x$want_x11 == xyes; then
BUILD_X11_TRUE=
BUILD_X11_FALSE='#'
else
if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
# Both variables are already set.
have_x=yes
else
if test "${ac_cv_have_x+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# One or both of the vars are not set, and there is no cached value.
ac_x_includes=no ac_x_libraries=no
rm -fr conftest.dir
if mkdir conftest.dir; then
cd conftest.dir
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
cat >Imakefile <<'_ACEOF'
acfindx:
@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
_ACEOF
if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
for ac_extension in a so sl; do
if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
test -f $ac_im_libdir/libX11.$ac_extension; then
ac_im_usrlibdir=$ac_im_libdir; break
fi
done
# Screen out bogus values from the imake configuration. They are
# bogus both because they are the default anyway, and because
# using them would break gcc on systems where it needs fixed includes.
case $ac_im_incroot in
/usr/include) ;;
*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
esac
case $ac_im_usrlibdir in
/usr/lib | /lib) ;;
*) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
esac
fi
cd ..
rm -fr conftest.dir
BUILD_X11_TRUE='#'
BUILD_X11_FALSE=
fi
# Standard set of common directories for X headers.
# Check X11 before X11Rn because it is often a symlink to the current release.
ac_x_header_dirs='
/usr/X11/include
/usr/X11R6/include
/usr/X11R5/include
/usr/X11R4/include
if test x$want_x11 == xyes; then
/usr/include/X11
/usr/include/X11R6
/usr/include/X11R5
/usr/include/X11R4
/usr/local/X11/include
/usr/local/X11R6/include
/usr/local/X11R5/include
/usr/local/X11R4/include
/usr/local/include/X11
/usr/local/include/X11R6
/usr/local/include/X11R5
/usr/local/include/X11R4
/usr/X386/include
/usr/x386/include
/usr/XFree86/include/X11
/usr/include
/usr/local/include
/usr/unsupported/include
/usr/athena/include
/usr/local/x11r5/include
/usr/lpp/Xamples/include
/usr/openwin/include
/usr/openwin/share/include'
if test "$ac_x_includes" = no; then
# Guess where to find include files, by looking for Intrinsic.h.
# First, try using that file with no special directory specified.
cat >conftest.$ac_ext <<_ACEOF
for ac_header in X11/Xlib.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <X11/Intrinsic.h>
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@ -5090,126 +5065,87 @@ else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# We can compile using X headers with no special include directory.
ac_x_includes=
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
for ac_dir in $ac_x_header_dirs; do
if test -r "$ac_dir/X11/Intrinsic.h"; then
ac_x_includes=$ac_dir
break
fi
done
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
fi # $ac_x_includes = no
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
if test "$ac_x_libraries" = no; then
# Check for the libraries.
# See if we find them without any special options.
# Don't add to $LIBS permanently.
ac_save_LIBS=$LIBS
LIBS="-lXt $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <X11/Intrinsic.h>
int
main ()
{
XtMalloc (0)
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
LIBS=$ac_save_LIBS
# We can link X programs with no special library path.
ac_x_libraries=
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------------------ ##
## Report this to the AC_PACKAGE_NAME lists. ##
## ------------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
else
X11_MISSING=yes
fi
LIBS=$ac_save_LIBS
for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
# Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
if test -r $ac_dir/libXt.$ac_extension; then
ac_x_libraries=$ac_dir
break 2
fi
done
done
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi # $ac_x_libraries = no
if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
# Didn't find X anywhere. Cache the known absence of X.
ac_cv_have_x="have_x=no"
else
# Record where we found X for the cache.
ac_cv_have_x="have_x=yes \
ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi
fi
if test "x$X11_MISSING" = xyes; then
{ { echo "$as_me:$LINENO: error: something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this" >&5
echo "$as_me: error: something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this" >&2;}
{ (exit 1); exit 1; }; }
fi
eval "$ac_cv_have_x"
fi # $with_x != no
if test "$have_x" != yes; then
echo "$as_me:$LINENO: result: $have_x" >&5
echo "${ECHO_T}$have_x" >&6
no_x=yes
else
# If each of the values was on the command line, it overrides each guess.
test "x$x_includes" = xNONE && x_includes=$ac_x_includes
test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
# Update the cache value to reflect the command line values.
ac_cv_have_x="have_x=yes \
ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
fi
cat >>confdefs.h <<\_ACEOF
#define X11 1
_ACEOF
if test $have_x != "yes"; then
echo "Sorry, X is very much needed"
exit 1
fi
cat >>confdefs.h <<\_ACEOF
#define HAVE_X11 1
_ACEOF
fi
if test "$x_libraries" != ""; then
@ -6445,6 +6381,13 @@ echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "${BUILD_X11_TRUE}" && test -z "${BUILD_X11_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"BUILD_X11\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"BUILD_X11\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "${HAVE_HELP2MAN_TRUE}" && test -z "${HAVE_HELP2MAN_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"HAVE_HELP2MAN\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@ -7043,6 +6986,8 @@ s,@BUILD_METAR_TRUE@,$BUILD_METAR_TRUE,;t t
s,@BUILD_METAR_FALSE@,$BUILD_METAR_FALSE,;t t
s,@BUILD_MLDONKEY_TRUE@,$BUILD_MLDONKEY_TRUE,;t t
s,@BUILD_MLDONKEY_FALSE@,$BUILD_MLDONKEY_FALSE,;t t
s,@BUILD_X11_TRUE@,$BUILD_X11_TRUE,;t t
s,@BUILD_X11_FALSE@,$BUILD_X11_FALSE,;t t
s,@XFTCONFIG@,$XFTCONFIG,;t t
s,@HELP2MAN@,$HELP2MAN,;t t
s,@HAVE_HELP2MAN_TRUE@,$HAVE_HELP2MAN_TRUE,;t t

View File

@ -187,12 +187,26 @@ dnl
dnl X
dnl
AC_PATH_X
if test $have_x != "yes"; then
echo "Sorry, X is very much needed"
exit 1
want_x11=yes
AC_ARG_ENABLE(x11,
[ --enable-x11 enable if you want X11 support [default=yes]],
[want_x11="$enableval"])
AM_CONDITIONAL(BUILD_X11, test x$want_x11 == xyes)
if test x$want_x11 == xyes; then
AC_CHECK_HEADERS([X11/Xlib.h], [], [X11_MISSING=yes])
if test "x$X11_MISSING" = xyes; then
AC_MSG_ERROR([something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this])
fi
AC_DEFINE(X11, 1, [Define if you want to use X11])
AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
fi
AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
dnl AC_PATH_X if test $have_x != "yes"; then
dnl echo "Sorry, X is very much needed"
dnl exit 1
dnl fi
dnl AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
dnl AC_CHECK_LIB([X11], [XOpenDisplay], [X11_LIBS="-lX11"], [], [[-L$x_libraries]])
dnl AC_CHECK_LIB([Xext], [XdbeQueryExtension], [

294
conky.c
View File

@ -23,7 +23,9 @@
#include <dirent.h>
#endif
#include <sys/time.h>
#ifdef X11
#include <X11/Xutil.h>
#endif /* X11 */
#include <sys/types.h>
#include <sys/stat.h>
@ -31,6 +33,8 @@
#define MAIL_FILE "$MAIL"
#define MAX_IF_BLOCK_DEPTH 5
#ifdef X11
/* alignments */
enum alignment {
TOP_LEFT = 1,
@ -187,19 +191,14 @@ static void load_fonts()
}
}
#endif /* X11 */
/* default config file */
static char *current_config;
/* set to 1 if you want all text to be in uppercase */
static unsigned int stuff_in_upper_case;
/* Position on the screen */
static int text_alignment;
static int gap_x, gap_y;
/* Always on bottom */
static int on_bottom;
/* Update interval */
static double update_interval;
@ -209,6 +208,17 @@ static unsigned long total_run_times;
/* fork? */
static int fork_to_background;
static int cpu_avg_samples, net_avg_samples;
#ifdef X11
/* Always on bottom */
static int on_bottom;
/* Position on the screen */
static int text_alignment;
static int gap_x, gap_y;
/* border */
static int draw_borders;
static int stippled_borders;
@ -219,8 +229,6 @@ static int border_margin, border_width;
static long default_fg_color, default_bg_color, default_out_color;
static int cpu_avg_samples, net_avg_samples;
/* create own window or draw stuff to root? */
static int own_window = 0;
@ -231,16 +239,17 @@ static int fixed_size = 0, fixed_pos = 0;
static int minimum_width, minimum_height;
/* UTF-8 */
int utf8_mode = 0;
#endif /* X11 */
/* no buffers in used memory? */
int no_buffers;
/* pad percentages to decimals? */
static int pad_percents = 0;
/* UTF-8 */
int utf8_mode = 0;
/* Text that is shown */
static char original_text[] =
"$nodename - $sysname $kernel on $machine\n"
@ -305,7 +314,7 @@ int check_mount(char *s)
}
#ifdef X11
static inline int calc_text_width(const char *s, unsigned int l)
{
#ifdef XFT
@ -323,6 +332,7 @@ static inline int calc_text_width(const char *s, unsigned int l)
return XTextWidth(fonts[selected_font].font, s, l);
}
}
#endif /* X11 */
/* formatted text to render on screen, generated in generate_text(),
* drawn in draw_stuff() */
@ -440,7 +450,6 @@ static const char *scan_bar(const char *args, int *w, int *h)
return args;
}
static char *scan_font(const char *args)
{
if (args && sizeof(args) < 127) {
@ -454,6 +463,7 @@ static char *scan_font(const char *args)
static void new_font(char *buf, char * args) {
struct special_t *s = new_special(buf, FONT);
#ifdef X11
if (!s->font_added || strcmp(args, fonts[s->font_added].name)) {
int tmp = selected_font;
selected_font = s->font_added = addfont(args);
@ -461,6 +471,7 @@ static void new_font(char *buf, char * args) {
set_font();
selected_font = tmp;
}
#endif /* X11 */
}
inline void graph_append(struct special_t *graph, double f)
@ -905,11 +916,13 @@ static void construct_text_object(const char *s, const char *arg)
#define OBJ(a, n) if (strcmp(s, #a) == 0) { obj->type = OBJ_##a; need_mask |= (1 << n); {
#define END ; } } else
if (s[0] == '#') {
#ifdef X11
if (s[0] == '#') {
obj->type = OBJ_color;
obj->data.l = get_x11_color(s);
} else
OBJ(acpitemp, 0) obj->data.i = open_acpi_temperature(arg);
#endif /* X11 */
OBJ(acpitemp, 0) obj->data.i = open_acpi_temperature(arg);
END OBJ(acpiacadapter, 0)
END OBJ(freq, 0) END OBJ(acpifan, 0) END OBJ(battery,
0) char bat[64];
@ -925,8 +938,10 @@ static void construct_text_object(const char *s, const char *arg)
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
END OBJ(cpugraph, INFO_CPU)
(void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d);
END OBJ(color, 0) obj->data.l =
arg ? get_x11_color(arg) : default_fg_color;
END OBJ(color, 0)
#ifdef X11
obj->data.l = arg ? get_x11_color(arg) : default_fg_color;
#endif /* X11 */
END
OBJ(font, 0)
obj->data.s = scan_font(arg);
@ -1283,10 +1298,16 @@ static void construct_text_object(const char *s, const char *arg)
END OBJ(processes, INFO_PROCS)
END OBJ(running_processes, INFO_RUN_PROCS)
END OBJ(shadecolor, 0)
#ifdef X11
obj->data.l = arg ? get_x11_color(arg) : default_bg_color;
#endif /* X11 */
END OBJ(outlinecolor, 0)
#ifdef X11
obj->data.l = arg ? get_x11_color(arg) : default_out_color;
END OBJ(stippled_hr, 0) int a = stippled_borders, b = 1;
#endif /* X11 */
END OBJ(stippled_hr, 0)
#ifdef X11
int a = stippled_borders, b = 1;
if (arg) {
if (sscanf(arg, "%d %d", &a, &b) != 2)
sscanf(arg, "%d", &b);
@ -1295,6 +1316,7 @@ static void construct_text_object(const char *s, const char *arg)
a = 1;
obj->data.pair.a = a;
obj->data.pair.b = b;
#endif /* X11 */
END OBJ(swap, INFO_MEM)
END OBJ(swapmax, INFO_MEM)
END OBJ(swapperc, INFO_MEM)
@ -2409,7 +2431,7 @@ static void generate_text()
}
OBJ(metar_tempf) {
if (data.temp != INT_MAX && metar_worked)
snprintf(p, n, "%3.1f",
snprintf(p, n, "%3f",
(data.temp +
40) * 9.0 / 5 - 40);
else
@ -2447,7 +2469,6 @@ static void generate_text()
else
snprintf(p, n, "-");
}
OBJ(metar_windspeed) {
if (data.winData.windSpeed != INT_MAX
&& metar_worked)
@ -2551,7 +2572,7 @@ static void generate_text()
//free(p);
}
#ifdef X11
static void set_font()
{
#ifdef XFT
@ -2579,9 +2600,15 @@ static void set_font()
static int text_start_x, text_start_y; /* text start position in window */
static int text_width, text_height;
#endif /* X11 */
static inline int get_string_width(const char *s)
{
#ifdef X11
return *s ? calc_text_width(s, strlen(s)) : 0;
#else
return strlen(s);
#endif /* X11 */
}
int fontchange = 0;
@ -2611,12 +2638,13 @@ static void text_size_updater(char *s)
else if (specials[special_index].type == OFFSET) {
w += specials[special_index].arg + get_string_width("a"); /* filthy, but works */
}
#ifdef X11
else if (specials[special_index].type == FONT) {
fontchange = specials[special_index].font_added;
selected_font = specials[special_index].font_added;
h = font_height();
}
#endif /* X11 */
special_index++;
@ -2624,6 +2652,7 @@ static void text_size_updater(char *s)
}
p++;
}
#ifdef X11
w += get_string_width(s);
if (w > text_width)
text_width = w;
@ -2632,8 +2661,10 @@ static void text_size_updater(char *s)
if (fontchange) {
selected_font = 0;
}
#endif /* X11 */
}
#ifdef X11
static void update_text_area()
{
int x, y;
@ -2714,6 +2745,7 @@ static inline void set_foreground_color(long c)
current_color = c;
XSetForeground(display, window.gc, c);
}
#endif /* X11 */
static void draw_string(const char *s)
{
@ -2730,7 +2762,9 @@ static void draw_string(const char *s)
added = 0;
char space[2];
snprintf(space, 2, " ");
#ifdef X11
max = ((text_width - width_of_s) / get_string_width(space));
#endif /* X11 */
/*
* This code looks for tabs in the text and coverts them to spaces.
* The trick is getting the correct number of spaces,
@ -2756,6 +2790,7 @@ static void draw_string(const char *s)
}
}
s = tmpstring2;
#ifdef X11
#ifdef XFT
if (use_xft) {
XColor c;
@ -2783,8 +2818,9 @@ static void draw_string(const char *s)
XDrawString(display, window.drawable, window.gc,
cur_x, cur_y, s, strlen(s));
}
memcpy(tmpstring1, s, TEXT_BUFFER_SIZE);
cur_x += width_of_s;
#endif /* X11 */
memcpy(tmpstring1, s, TEXT_BUFFER_SIZE);
}
inline unsigned long do_gradient(unsigned long first_colour, unsigned long last_colour) { /* this function returns the next colour between two colours for a gradient */
@ -2862,11 +2898,10 @@ inline unsigned long gradient_max(unsigned long first_colour, unsigned long last
return max;
}
static void draw_line(char *s)
{
#ifdef X11
char *p;
cur_x = text_start_x;
cur_y += font_ascent();
int cur_y_add = 0;
@ -3133,6 +3168,10 @@ static void draw_line(char *s)
p++;
}
#else
draw_string(s);
#endif
#ifdef X11
if (cur_y_add > 0) {
cur_y += cur_y_add;
cur_y -= font_descent();
@ -3144,10 +3183,12 @@ static void draw_line(char *s)
if (fontchange) {
selected_font = 0;
}
#endif /* X11 */
}
static void draw_text()
{
#ifdef X11
cur_y = text_start_y;
/* draw borders */
@ -3177,11 +3218,13 @@ static void draw_text()
/* draw text */
special_index = 0;
#endif /* X11 */
for_each_line(text_buffer, draw_line);
}
static void draw_stuff()
{
#ifdef X11
if (draw_shades && !draw_outline) {
text_start_x++;
text_start_y++;
@ -3210,8 +3253,9 @@ static void draw_stuff()
set_foreground_color(default_fg_color);
draw_mode = FG;
#endif /* X11 */
draw_text();
#ifdef X11
#ifdef XDBE
if (use_xdbe) {
XdbeSwapInfo swap;
@ -3234,9 +3278,9 @@ if (metar_path != NULL) {
metar_path = NULL;
}
#endif*/
#endif /* X11 */
}
#ifdef X11
static void clear_text(int exposures)
{
#ifdef XDBE
@ -3251,6 +3295,7 @@ static void clear_text(int exposures)
text_height + border_margin * 2 + 2,
exposures ? True : 0);
}
#endif /* X11 */
static int need_to_update;
@ -3258,16 +3303,22 @@ static int need_to_update;
static void update_text()
{
generate_text();
#ifdef X11
clear_text(1);
#endif /* X11 */
need_to_update = 1;
}
static void main_loop()
{
#ifdef X11
Region region = XCreateRegion();
#endif /* X11 */
info.looped = 0;
while (total_run_times == 0 || info.looped < total_run_times - 1) {
info.looped++;
#ifdef X11
XFlush(display);
/* wait for X event or timeout */
@ -3285,12 +3336,16 @@ static void main_loop()
tv.tv_sec = (long) t;
tv.tv_usec = (long) (t * 1000000) % 1000000;
FD_ZERO(&fdsr);
FD_SET(ConnectionNumber(display), &fdsr);
s = select(ConnectionNumber(display) + 1, &fdsr, 0,
0, &tv);
#else
usleep(update_interval*1000000); /* FIXME just sleep for the interval time if no X11 */
#endif /* X11 */
#ifdef X11
if (s == -1) {
if (errno != EINTR)
ERR("can't select(): %s",
@ -3298,7 +3353,9 @@ static void main_loop()
} else {
/* timeout */
if (s == 0)
#endif /* X11 */
update_text();
#ifdef X11
}
}
@ -3465,10 +3522,14 @@ static void main_loop()
if (use_xft)
XftDrawSetClip(window.xftdraw, region);
#endif
#endif /* X11 */
draw_stuff();
#ifdef X11
XDestroyRegion(region);
region = XCreateRegion();
}
#endif /* X11 */
}
}
@ -3482,8 +3543,10 @@ static void reload_handler(int a)
if (current_config) {
clear_fs_stats();
load_config_file(current_config);
#ifdef X11
load_fonts();
set_font();
#endif /* X11 */
extract_variable_text(text);
free(text);
text = NULL;
@ -3493,6 +3556,7 @@ static void reload_handler(int a)
static void clean_up()
{
#ifdef X11
#ifdef XDBE
if (use_xdbe)
XdbeDeallocateBackBufferName(display, window.back_buffer);
@ -3508,6 +3572,8 @@ static void clean_up()
}
XFreeGC(display, window.gc);
#endif /* X11 */
/* it is really pointless to free() memory at the end of program but ak|ra
* wants me to do this */
@ -3543,7 +3609,7 @@ static int string_to_bool(const char *s)
return 1;
return 0;
}
#ifdef X11
static enum alignment string_to_alignment(const char *s)
{
if (strcasecmp(s, "top_left") == 0)
@ -3565,14 +3631,12 @@ static enum alignment string_to_alignment(const char *s)
return TOP_LEFT;
}
#endif /* X11 */
static void set_default_configurations(void)
{
text_alignment = BOTTOM_LEFT;
on_bottom = 1;
fork_to_background = 0;
border_margin = 3;
border_width = 1;
total_run_times = 0;
info.cpu_avg_samples = 2;
info.net_avg_samples = 2;
@ -3584,22 +3648,33 @@ static void set_default_configurations(void)
info.mpd.port = 6600;
info.mpd.status = "Checking status...";
#endif
out_to_console = 0;
use_spacer = 0;
#ifdef X11
out_to_console = 0;
#else
out_to_console = 1;
#endif
#ifdef X11
default_fg_color = WhitePixel(display, screen);
default_bg_color = BlackPixel(display, screen);
default_out_color = BlackPixel(display, screen);
draw_borders = 0;
draw_shades = 1;
draw_outline = 0;
/*#ifdef XFT
use_xft = 1;
set_first_font("courier-12");
#endif
#else*/
set_first_font("6x10");
gap_x = 5;
gap_y = 5;
minimum_width = 5;
minimum_height = 5;
#ifdef OWN_WINDOW
own_window = 0;
#endif
stippled_borders = 0;
border_margin = 3;
border_width = 1;
text_alignment = BOTTOM_LEFT;
on_bottom = 1;
#endif /* X11 */
free(current_mail_spool);
{
@ -3609,13 +3684,7 @@ static void set_default_configurations(void)
current_mail_spool = strdup(buf);
}
minimum_width = 5;
minimum_height = 5;
no_buffers = 1;
#ifdef OWN_WINDOW
own_window = 0;
#endif
stippled_borders = 0;
update_interval = 10.0;
stuff_in_upper_case = 0;
#ifdef MLDONKEY
@ -3695,15 +3764,16 @@ static void load_config_file(const char *f)
else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
#ifdef X11
CONF2("alignment") {
if (value) {
int a = string_to_alignment(value);
if (a <= 0)
CONF_ERR;
else
text_alignment = a;
} else
CONF_ERR;
if (value) {
int a = string_to_alignment(value);
if (a <= 0)
CONF_ERR;
else
text_alignment = a;
} else
CONF_ERR;
}
CONF("on_bottom") {
if(value)
@ -3714,6 +3784,13 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
CONF("background") {
fork_to_background = string_to_bool(value);
}
#else
CONF2("background") {
fork_to_background = string_to_bool(value);
}
#endif /* X11 */
#ifdef X11
CONF("border_margin") {
if (value)
border_margin = strtol(value, 0, 0);
@ -3744,6 +3821,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
else
CONF_ERR;
}
#endif /* X11 */
#ifdef MPD
CONF("mpd_host") {
if (value)
@ -3792,14 +3870,16 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
CONF("override_utf8_locale") {
utf8_mode = string_to_bool(value);
}
#ifdef XDBE
CONF("double_buffer") {
use_xdbe = string_to_bool(value);
}
#endif
#ifdef X11
CONF("override_utf8_locale") {
utf8_mode = string_to_bool(value);
}
CONF("draw_borders") {
draw_borders = string_to_bool(value);
}
@ -3809,12 +3889,14 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
CONF("draw_outline") {
draw_outline = string_to_bool(value);
}
#endif /* X11 */
CONF("out_to_console") {
out_to_console = string_to_bool(value);
}
CONF("use_spacer") {
use_spacer = string_to_bool(value);
}
#ifdef X11
#ifdef XFT
CONF("use_xft") {
use_xft = string_to_bool(value);
@ -3865,6 +3947,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
else
CONF_ERR;
}
#endif /* X11 */
CONF("mail_spool") {
if (value) {
char buf[256];
@ -3879,6 +3962,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
} else
CONF_ERR;
}
#ifdef X11
CONF("minimum_size") {
if (value) {
if (sscanf
@ -3891,6 +3975,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
} else
CONF_ERR;
}
#endif /* X11 */
CONF("no_buffers") {
no_buffers = string_to_bool(value);
}
@ -3932,20 +4017,22 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
CONF_ERR;
}
#endif
CONF("pad_percents") {
pad_percents = atoi(value);
}
#ifdef X11
#ifdef OWN_WINDOW
CONF("own_window") {
own_window = string_to_bool(value);
}
#endif
CONF("pad_percents") {
pad_percents = atoi(value);
}
CONF("stippled_borders") {
if (value)
stippled_borders = strtol(value, 0, 0);
else
stippled_borders = 4;
}
#endif /* X11 */
CONF("temp1") {
ERR("temp1 configuration is obsolete, use ${i2c <i2c device here> temp 1}");
}
@ -4034,22 +4121,23 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
}
/* : means that character before that takes an argument */
static
const
char
*getopt_string = "vVdt:f:u:i:hc:w:x:y:a:"
static const char *getopt_string = "vVdt:f:u:i:hc:w:x:y:a:"
#ifdef X11
"x:y:w:a:f:"
#ifdef OWN_WINDOW
"o"
#endif
#ifdef XDBE
"b"
#endif
#endif /* X11 */
;
int main(int argc, char **argv)
{
/* handle command line parameters that don't change configs */
#ifdef X11
char *s;
char temp[10];
unsigned int x;
@ -4068,6 +4156,7 @@ int main(int argc, char **argv)
ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL.");
return 1;
}
#endif /* X11 */
while (1) {
int c = getopt(argc,
argv,
@ -4092,42 +4181,47 @@ int main(int argc, char **argv)
case 'h':
printf
("Usage: %s [OPTION]...\n"
"Conky is a system monitor that renders text on desktop or to own transparent\n"
"window. Command line options will override configurations defined in config\n"
"file.\n"
" -V version\n"
" -a ALIGNMENT text alignment on screen, {top,bottom}_{left,right}\n"
" -c FILE config file to load instead of "
CONFIG_FILE
"\n"
" -d daemonize, fork to background\n"
" -f FONT font to use\n"
" -h help\n"
("Usage: %s [OPTION]...\n"
"Conky is a system monitor that renders text on desktop or to own transparent\n"
"window. Command line options will override configurations defined in config\n"
"file.\n"
" -V version\n"
" -c FILE config file to load instead of "
CONFIG_FILE
"\n"
" -d daemonize, fork to background\n"
" -h help\n"
#ifdef X11
" -a ALIGNMENT text alignment on screen, {top,bottom}_{left,right}\n"
" -f FONT font to use\n"
#ifdef OWN_WINDOW
" -o create own window to draw\n"
" -o create own window to draw\n"
#endif
#ifdef XDBE
" -b double buffer (prevents flickering)\n"
" -b double buffer (prevents flickering)\n"
#endif
" -t TEXT text to render, remember single quotes, like -t '$uptime'\n"
" -u SECS update interval\n"
" -i NUM number of times to update Conky\n"
" -w WIN_ID window id to draw\n"
" -x X x position\n"
" -y Y y position\n", argv[0]);
" -w WIN_ID window id to draw\n"
" -x X x position\n"
" -y Y y position\n"
#endif /* X11 */
" -t TEXT text to render, remember single quotes, like -t '$uptime'\n"
" -u SECS update interval\n"
" -i NUM number of times to update Conky\n", argv[0]);
return 0;
#ifdef X11
case 'w':
window.window = strtol(optarg, 0, 0);
break;
#endif /* X11 */
case '?':
exit(EXIT_FAILURE);
}
}
#ifdef X11
/* initalize X BEFORE we load config. (we need to so that 'screen' is set) */
init_X11();
#endif /* X11 */
tmpstring1 = (char *)
malloc(TEXT_BUFFER_SIZE);
@ -4175,17 +4269,17 @@ int main(int argc, char **argv)
break;
switch (c) {
case 'a':
text_alignment = string_to_alignment(optarg);
break;
case 'd':
fork_to_background = 1;
break;
case 'f':
#ifdef X11
case 'f':
set_first_font(optarg);
break;
case 'a':
text_alignment = string_to_alignment(optarg);
break;
#ifdef OWN_WINDOW
case 'o':
@ -4197,7 +4291,7 @@ int main(int argc, char **argv)
use_xdbe = 1;
break;
#endif
#endif /* X11 */
case 't':
if (text != original_text)
free(text);
@ -4212,7 +4306,7 @@ int main(int argc, char **argv)
case 'i':
total_run_times = strtod(optarg, 0);
break;
#ifdef X11
case 'x':
gap_x = atoi(optarg);
break;
@ -4220,14 +4314,17 @@ int main(int argc, char **argv)
case 'y':
gap_y = atoi(optarg);
break;
#endif /* X11 */
case '?':
exit(EXIT_FAILURE);
}
}
#ifdef X11
/* load font */
load_fonts();
#endif /* X11 */
/* generate text and get initial size */
extract_variable_text(text);
@ -4239,6 +4336,7 @@ int main(int argc, char **argv)
update_uname();
generate_text();
#ifdef X11
update_text_area(); /* to get initial size of the window */
init_window
@ -4247,12 +4345,14 @@ int main(int argc, char **argv)
+ border_margin * 2 + 1, text_height + border_margin * 2 + 1, on_bottom);
update_text_area(); /* to position text/window on screen */
#endif /* X11 */
#ifdef CAIRO
/*#ifdef CAIRO
// why the fuck not?
//do_it();
#endif
#endif*/
#ifdef X11
#ifdef OWN_WINDOW
if (own_window)
XMoveWindow(display, window.window, window.x, window.y);
@ -4261,8 +4361,8 @@ int main(int argc, char **argv)
create_gc();
set_font();
draw_stuff();
#endif /* X11 */
/* fork */
if (fork_to_background) {

24
conky.h
View File

@ -9,6 +9,7 @@
#ifndef _conky_h_
#define _conky_h_
//#include <mcheck.h>
#include "config.h"
#include <sys/utsname.h>
@ -18,6 +19,7 @@
#include <langinfo.h>
#include <wchar.h>
#ifdef X11
#if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
#define CAIRO
#include <X11/Xlib.h>
@ -25,6 +27,7 @@
#include <cairo.h>
#include <cairo-xlib.h>
#endif
#endif /* X11 */
#define TOP_CPU 1
#define TOP_NAME 2
@ -160,7 +163,17 @@ struct information {
unsigned long looped;
};
int out_to_console;
int top_cpu;
int top_mem;
int use_spacer;
char *tmpstring1;
char *tmpstring2;
#ifdef X11
/* in x11.c */
#include <X11/Xlib.h>
@ -201,15 +214,6 @@ struct conky_window {
extern int use_xdbe;
#endif
int out_to_console;
int top_cpu;
int top_mem;
int use_spacer;
char *tmpstring1;
char *tmpstring2;
#ifdef XFT
extern int use_xft;
@ -230,6 +234,8 @@ void create_gc();
void set_transparent_background(Window win);
long get_x11_color(const char *);
#endif /* X11 */
/* in common.c */
/* struct that has all info */

View File

@ -167,17 +167,11 @@ void update_metar()
if (!status) {
status = 2;
iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL);
<<<<<<< metarinfo.c
} else if (status == 2) { /* thread is still running. what else can we do? */
return;
} else { /* status must be 1 */
=======
} else if (status == 2) { /* thread is still running. let's kill it and start again */
pthread_cancel(thread1);
status = 2;
iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL);
} else { /* status must be 1 */
>>>>>>> 1.9
pthread_join(thread1, NULL);
status = 2;
iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL);