From 96fe4bccb0adecf8bfa4e7ee33fe29c1e8c3145b Mon Sep 17 00:00:00 2001 From: Gabriel VLASIU Date: Mon, 8 Apr 2013 16:06:32 +0300 Subject: [PATCH] Enable classic mode. --- wmbiff/wmbiff/Makefile.am | 15 +++- wmbiff/wmbiff/mboxClient.c | 14 +++ wmbiff/wmbiff/wmbiff-classic-master-led.xpm | 128 ++++++++++++++++++++++++++++ wmbiff/wmbiff/wmbiff.1 | 11 ++- wmbiff/wmbiff/wmbiff.c | 58 ++++++++++--- 5 files changed, 210 insertions(+), 16 deletions(-) create mode 100644 wmbiff/wmbiff/wmbiff-classic-master-led.xpm diff --git a/wmbiff/wmbiff/Makefile.am b/wmbiff/wmbiff/Makefile.am index 56ec91c..86b90bc 100644 --- a/wmbiff/wmbiff/Makefile.am +++ b/wmbiff/wmbiff/Makefile.am @@ -17,9 +17,11 @@ EXTRA_test_wmbiff_SOURCES = gnutls-common.c gnutls-common.h test_wmbiff_LDADD = @LIBGCRYPT_LIBS@ man_MANS = wmbiff.1 wmbiffrc.5 skindir = $(datadir)/wmbiff/skins -skin_DATA = wmbiff-master-led.xpm wmbiff-master-contrast.xpm +skin_DATA = wmbiff-master-led.xpm wmbiff-master-contrast.xpm \ + wmbiff-classic-master-led.xpm wmbiff-classic-master-contrast.xpm -EXTRA_DIST = $(man_MANS) sample.wmbiffrc wmbiff-master-led.xpm +EXTRA_DIST = $(man_MANS) sample.wmbiffrc wmbiff-master-led.xpm \ + wmbiff-classic-master-led.xpm MAINTAINERCLEANFILES = Makefile.in @@ -48,7 +50,8 @@ indent: dist-hook-local: indent config-h-check distclean-local: - -rm -f wmbiff-master-contrast.xpm wmbiff-master.xpm + -rm -f wmbiff-master-contrast.xpm wmbiff-master.xpm \ + wmbiff-classic-master-contrast.xpm # remove colors, then substitute old colors, then repalletize # for some reason $< doesn't always work. @@ -58,6 +61,12 @@ wmbiff-master-contrast.xpm: wmbiff-master-led.xpm Makefile sed -e 's/#\([0-9A-F]\{2\}\)[0-9A-F]\{2\}\([0-9A-F]\{2\}\)[0-9A-F]\{2\}\([0-9A-F]\{2\}\)[0-9A-F]\{2\}/#\1\2\3/'\ > $@ || rm $@ +wmbiff-classic-master-contrast.xpm: wmbiff-classic-master-led.xpm Makefile + egrep -v '^"[:%][[:space:]]c #' < wmbiff-classic-master-led.xpm | \ + sed -e 's/:/./g' -e 's/%/$$/g' -e 's/ 15 / 13 /' | \ + sed -e 's/#\([0-9A-F]\{2\}\)[0-9A-F]\{2\}\([0-9A-F]\{2\}\)[0-9A-F]\{2\}\([0-9A-F]\{2\}\)[0-9A-F]\{2\}/#\1\2\3/'\ + > $@ || rm $@ + # fail if there's a .c file that doesn't include config.h config-h-check: ls *.c | sort > cfiles diff --git a/wmbiff/wmbiff/mboxClient.c b/wmbiff/wmbiff/mboxClient.c index febff7f..e5e85f3 100644 --- a/wmbiff/wmbiff/mboxClient.c +++ b/wmbiff/wmbiff/mboxClient.c @@ -48,6 +48,7 @@ static void countMessages(Pop3 pc, const char *mbox_filename) int next_from_is_start_of_header = 1; int count_from = 0, count_status = 0; int len_from = strlen(FROM_STR), len_status = strlen(STATUS_STR); + int pseudo_mail = 0; F = openMailbox(pc, mbox_filename); if (F == NULL) @@ -55,6 +56,13 @@ static void countMessages(Pop3 pc, const char *mbox_filename) /* count message */ while (fgets(buf, BUF_SIZE, F)) { + // The first message usually is automatically created by POP3/IMAP + // clients for internal record keeping and is ignored + // (not displayed) by most email clients. + if (is_header && !strncmp(buf, "X-IMAP: ", 8)) + { + pseudo_mail = 1; + } if (buf[0] == '\n') { /* a newline by itself terminates the header */ if (is_header) @@ -79,6 +87,12 @@ static void countMessages(Pop3 pc, const char *mbox_filename) } } + if (count_from && pseudo_mail) { + count_from--; + if (count_status) + count_status--; + } + DM(pc, DEBUG_INFO, "from: %d status: %d\n", count_from, count_status); pc->TotalMsgs = count_from; pc->UnreadMsgs = count_from - count_status; diff --git a/wmbiff/wmbiff/wmbiff-classic-master-led.xpm b/wmbiff/wmbiff/wmbiff-classic-master-led.xpm new file mode 100644 index 0000000..c2a6570 --- /dev/null +++ b/wmbiff/wmbiff/wmbiff-classic-master-led.xpm @@ -0,0 +1,128 @@ +/* XPM */ +static const char * wmbiff_classic_master_xpm[] = { +"160 109 15 1", +" c #00000000FFFF", +". c #208120812081", +"X c #FFFFFFFF0000", +"o c #492441030000", +"O c #79E779E70820", +"+ c #000000000000", +"@ c #C71BC30BC71B", +": c #000049244103", +"$ c #2081B2CAAEBA", +"% c #00007DF771C6", +"& c #B6DA04101861", +"* c #0000EBAD0000", +"= c #28A23CF338E3", +"- c #F7DEF3CEFFFF", +"; c #71C6E38D71C6", +" ................................................................................ ", +" ...XXX...oooO.OXXXO.OXXXO.OoooO.OXXXO.OXXXO.OXXXO.OXXXO.OXXXO................... ", +" ..X...X.o...X.o...X.o...X.X...X.X...o.X...o.o...X.X...X.X...X............X...... ", +" ..X...X.o...X.o...X.o...X.X...X.X...o.X...o.o...X.X...X.X...X..X....X....X...... ", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ..OoooO..oooO.OXXXO..XXXO.OXXXO.OXXXO.OXXXO..oooO.oXXXo.OXXXO..O....O...X....... ", +" +......................................................@ ..X...X.o...X.X...o.o...X.o...X.o...X.X...X.o...X.X...X.o...X...........X....... ", +" +..:::...:::...:::...:::...:::.......:::...:::...:::...@ ..X...X.o...X.X...o.o...X.o...X.o...X.X...X.o...X.X...X.o...X..X....X..X........ ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ ...XXX...oooX.OXXXO.OXXXO..oooO.OXXXO.OXXXO..oooO.OXXXO.OXXXO..O....O..X........ ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ ................................................................................ ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" +..:::...:::...:::...:::...:::.......:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +.:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:..@ . ", +" +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@ . ", +" +..:::...:::...:::...:::...:::...:...:::...:::...:::...@ . ", +" +......................................................@ . ", +" +......................................................@ . ", +" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ . ", +" . ", +" . ", +" . ", +" . ", +"............................................................................... ", +"..$$$...:::%.%$$$%.%$$$%.%:::%.%$$$%.%$$$%.%$$$%.:$$$%.%$$$%................... ", +".$...$.:...$.:...$.:...$.$...$.$...:.$...:.:...$.$...$.$...$............$...... .&&. .**. .==. ", +".$...$.:...$.:...$.:...$.$...$.$...:.$...:.:...$.$...$.$...$..$....$....$...... &-&& *-** ==== ", +".%:::%..:::%.%$$$%..$$$%.%$$$%.%$$$%.%$$$%..:::%.:$$$:.%$$$%..%....%...$....... &&&& **** ==== .$:; ", +".$...$.:...$.$...:.:...$.:...$.:...$.$...$.:...$.$...$.:...$...........$....... .&&. .**. .==. ", +".$...$.:...$.$...:.:...$.:...$.:...$.$...$.:...$.$...$.:...$..$....$..$........ ", +"..$$$...:::$.%$$$%.%$$$%..:::%.%$$$%.%$$$%..:::%.%$$$:.%$$$%..%....%..$........ ", +"............................................................................... ", +" ", +"................................................................................................................................................................", +".:$$$:.%$$$..%$$$%.%$$$..%$$$%.%$$$%.%$$$%.%:::%..:::%..:::%.%:::%.%:::..$:::$.%$$$..%$$$%.%$$$%.%$$$%.%$$$%.%$$$%.%$$$%.%:::%.%:::%.%:::%.%:::%.%:::%.%$$$%....", +".$...$.$...$.$...:.$...$.$...:.$...:.$...:.$...$.:...$.:...$.$...$.$...:.$$.$$.$...$.$...$.$...$.$...$.$...$.$...:.:.$.:.$...$.$...$.$...$.$...$.$...$.:...$....", +".$...$.$...$.$...:.$...$.$...:.$...:.$...:.$...$.:...$.:...$.$..$:.$...:.$.$.$.$...$.$...$.$...$.$...$.$...$.$...:.:.$.:.$...$.$...$.$...$.:$.$:.$...$.:..$:....", +".%$$$%.%$$$..%:::..%:::%.%$$$..%$$$..%:$$%.%$$$%..:::%..:::%.%$$:..%:::..%:::%.%:::%.%:::%.%$$$%.%$::%.%$$$..%$$$%..:%:..%:::%.%:::%.%:::%..:$:..%$$$%..:$:.....", +".$...$.$...$.$...:.$...$.$...:.$...:.$...$.$...$.:...$.:...$.$..$:.$...:.$...$.$...$.$...$.$...:.$.$.$.$...$.:...$.:.$.:.$...$.$...$.$.$.$.:$.$:.:...$.:$..:....", +".$...$.$...$.$...:.$...$.$...:.$...:.$...$.$...$.:...$.:...$.$...$.$...:.$...$.$...$.$...$.$...:.$..$$.$...$.:...$.:.$.:.$...$.$...$.$$.$$.$...$.:...$.$...:....", +".%:::%.%$$$..%$$$%.$$$$..%$$$%.$:::..%$$$%.%:::%..:::$.:$$$%.%:::%.%$$$:.%:::%.$:::$.%$$$%.%:::..%$$$%.%:::%.%$$$%..:%:..:$$$$..$$$..$:::$.%:::$.:$$$%.%$$$%....", +"................................................................................................................................................................", +" ", +" +......................................................@ . ", +" ..:::...:::...:::...:::...:::.......:::...:::...:::... ", +" .:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:.. ", +" .:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:.. ", +" ..:::...:::...:::...:::...:::...:...:::...:::...:::... ", +" .:...:.:...:.:...:.:...:.:...:.....:...:.:...:.:...:.. ", +" .:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:.. ", +" ..:::...:::...:::...:::...:::...:...:::...:::...:::... ", +" ...................................................... ", +" ...................................................... ", +" ", +"................................................................................................................................................................", +".oXXXo.OXXX..OXXXO.OXXX..OXXXO.OXXXO.OXXXO.OoooO..oooO..oooO.OoooO.Oooo..XoooX.OXXX..OXXXO.OXXXO.OXXXO.OXXXO.OXXXO.OXXXO.OoooO.OoooO.OoooO.OoooO.OoooO.OXXXO....", +".X...X.X...X.X...o.X...X.X...o.X...o.X...o.X...X.o...X.o...X.X...X.X...o.XX.XX.X...X.X...X.X...X.X...X.X...X.X...o.o.X.o.X...X.X...X.X...X.X...X.X...X.o...X....", +".X...X.X...X.X...o.X...X.X...o.X...o.X...o.X...X.o...X.o...X.X..Xo.X...o.X.X.X.X...X.X...X.X...X.X...X.X...X.X...o.o.X.o.X...X.X...X.X...X.oX.Xo.X...X.o..Xo....", +".OXXXO.OXXX..Oooo..OoooO.OXXX..OXXX..OoXXO.OXXXO..oooO..oooO.OXXo..Oooo..OoooO.OoooO.OoooO.OXXXO.OXooO.OXXX..OXXXO..oOo..OoooO.OoooO.OoooO..oXo..OXXXO..oXo.....", +".X...X.X...X.X...o.X...X.X...o.X...o.X...X.X...X.o...X.o...X.X..Xo.X...o.X...X.X...X.X...X.X...o.X.X.X.X...X.o...X.o.X.o.X...X.X...X.X.X.X.oX.Xo.o...X.oX..o....", +".X...X.X...X.X...o.X...X.X...o.X...o.X...X.X...X.o...X.o...X.X...X.X...o.X...X.X...X.X...X.X...o.X..XX.X...X.o...X.o.X.o.X...X.X...X.XX.XX.X...X.o...X.X...o....", +".OoooO.OXXX..OXXXO.XXXX..OXXXO.Xooo..OXXXO.OoooO..oooX.OXXXO.OoooO.OXXXo.OoooO.XoooX.OXXXO.Oooo..OXXXO.OoooO.OXXXO..oOo..oXXXX..XXX..XoooX.OoooX.oXXXO.OXXXO....", +"................................................................................................................................................................", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/wmbiff/wmbiff/wmbiff.1 b/wmbiff/wmbiff/wmbiff.1 index 97b9fec..ae89efc 100644 --- a/wmbiff/wmbiff/wmbiff.1 +++ b/wmbiff/wmbiff/wmbiff.1 @@ -13,12 +13,13 @@ WMBiff \- A dockable Mailbox Monitor .SH SYNOPSIS .B wmbiff -[-display ] [-geometry +XPOS+YPOS] [-c ] [-h] [-v] [-debug] [-fg ] [-bg ] [-hi ] [-font |default] [+w] +[-display ] [-geometry +XPOS+YPOS] [-c ] [-h] [-v] [-debug] [-fg ] [-bg ] [-hi ] [-font |default] [-o] [+w] .br .SH DESCRIPTION WMbiff displays the status of up to five mailboxes. It shows the number -of new mail messages, if any, or the total number of messages. +of new mail messages, if any, otherwise 0. In classic mode instead of 0 +it shows the total number of messages. It also has mail retrieval capabilies, and can be configured to do this automatically. At the moment, UNIX-style, maildir, POP3, APOP and IMAP4 mailboxes are supported. @@ -86,6 +87,12 @@ be careful and consider alerting your mail system administrator first. The need to use this option is a sign of server misconfiguration. .TP +.B \-o +Enable classical mode look and behaviour: shows the number of +new mail messages, if any, or the total number of messages. +This option also enables the special keyword "beep" (disabled +by default). +.TP .B \+w Do not use the "withdrawn" state: the wmbiff window will not be captured as an icon and placed in the dock, but will diff --git a/wmbiff/wmbiff/wmbiff.c b/wmbiff/wmbiff/wmbiff.c index f0b8136..8ed6429 100644 --- a/wmbiff/wmbiff/wmbiff.c +++ b/wmbiff/wmbiff/wmbiff.c @@ -41,6 +41,7 @@ #include "wmbiff-master-led.xpm" +#include "wmbiff-classic-master-led.xpm" static char wmbiff_mask_bits[64 * 64]; static const int wmbiff_mask_width = 64; // const int wmbiff_mask_height = 64; @@ -58,6 +59,7 @@ static mbox_t mbox[MAX_NUM_MAILBOXES]; /* this is the normal pixmap. */ static const char *skin_filename = "wmbiff-master-led.xpm"; +static const char *classic_skin_filename = "wmbiff-classic-master-led.xpm"; /* global notify action taken (if globalnotify option is set) */ static const char *globalnotify = NULL; @@ -73,7 +75,6 @@ const char *certificate_filename = NULL; macs and compression methods. */ const char *tls = NULL; - /* it could be argued that a better default exists. */ #define DEFAULT_FONT "-*-fixed-*-r-*-*-10-*-*-*-*-*-*-*" static const char *font = NULL; @@ -84,6 +85,9 @@ int debug_default = DEBUG_ERROR; const char *foreground = "white"; /* foreground white */ const char *background = "#505075"; /* background blue */ static const char *highlight = "red"; +const char *foreground_classic = "#21B3AF"; /* classic foreground cyan */ +const char *background_classic = "#202020"; /* classic background gray */ +static const char *highlight_classic = "yellow"; /* classic highlight color */ int SkipCertificateCheck = 0; int Relax = 0; /* be not paranoid */ static int notWithdrawn = 0; @@ -93,6 +97,7 @@ static const int x_origin = 5; static const int y_origin = 5; static int forever = 1; /* keep running. */ unsigned int custom_skin = 0; /* user has choose a custom skin */ +static int classic_mode = 0; /* use classic behaviour/theme of wmbiff */ extern Window win; extern Window iconwin; @@ -228,6 +233,11 @@ static int Read_Config_File(char *filename, int *loopinterval) char setting[BUF_SMALL], value[BUF_SIZE]; int mbox_index; unsigned int i; + char *skin = NULL; + + if (classic_mode) { + skin = strdup_ordie(skin_filename); + } if (!(fp = fopen(filename, "r"))) { DMA(DEBUG_ERROR, "Unable to open %s, no settings read: %s\n", @@ -387,6 +397,12 @@ static int Read_Config_File(char *filename, int *loopinterval) // use GnuTLS's default ciphers. tls = "NORMAL"; + if (classic_mode && skin && !strcmp(skin, skin_filename)) + skin_filename = classic_skin_filename; + + if (skin) + free(skin); + for (i = 0; i < num_mailboxes; i++) if (mbox[i].label[0] != '\0') parse_mbox_path(i); @@ -699,7 +715,7 @@ static void blitMsgCounters(unsigned int i) BlitString(mbox[i].TextStatus, 39, y_row, newmail); } else { int mailcount = - (newmail) ? mbox[i].UnreadMsgs : 0; + (newmail) ? mbox[i].UnreadMsgs : ( classic_mode ? mbox[i].TotalMsgs : 0 ); BlitNum(mailcount, 45, y_row, newmail); } } @@ -711,7 +727,9 @@ static void blitMsgCounters(unsigned int i) static void execnotify( /*@null@ */ const char *notifycmd) { if (notifycmd != NULL) { /* need to call notify() ? */ - if (!strcasecmp(notifycmd, "true")) { + if (classic_mode && !strcasecmp(notifycmd, "beep")) + XBell(display, 100); + else if (!strcasecmp(notifycmd, "true")) { /* Yes, nothing */ } else { /* Else call external notifyer, ignoring the pid */ @@ -1141,15 +1159,15 @@ static void do_biff(int argc, const char **argv) if (skin_xpm == NULL) { DMA(DEBUG_ERROR, "using built-in xpm; %s wasn't found in %s\n", skin_filename, skin_search_path); - skin_xpm = wmbiff_master_xpm; + skin_xpm = (classic_mode ? wmbiff_classic_master_xpm : wmbiff_master_xpm); } bkg_xpm = (const char **) CreateBackingXPM(wmbiff_mask_width, wmbiff_mask_height, skin_xpm); - createXBMfromXPM(wmbiff_mask_bits, bkg_xpm, + createXBMfromXPM(wmbiff_mask_bits, (const char**)bkg_xpm, wmbiff_mask_width, wmbiff_mask_height); - openXwindow(argc, argv, bkg_xpm, skin_xpm, wmbiff_mask_bits, + openXwindow(argc, argv, (const char**)bkg_xpm, skin_xpm, wmbiff_mask_bits, wmbiff_mask_width, wmbiff_mask_height, notWithdrawn); /* now that display is set, we can create the cursors @@ -1182,7 +1200,8 @@ static void do_biff(int argc, const char **argv) } while (forever); /* forever is usually true, but not when debugging with -exit */ - if (skin_xpm != NULL && skin_xpm != wmbiff_master_xpm) { + if (skin_xpm != NULL && skin_xpm != wmbiff_master_xpm + && skin_xpm != wmbiff_classic_master_xpm) { free(skin_xpm); // added 3 jul 02, appeasing valgrind } if (bkg_xpm != NULL) { @@ -1244,6 +1263,7 @@ static void printversion(void) static void parse_cmd(int argc, const char **argv, char *config_file) { int i; + int fg = 0, bg = 0, hi = 0; config_file[0] = '\0'; @@ -1258,7 +1278,8 @@ static void parse_cmd(int argc, const char **argv, char *config_file) if (strcmp(arg + 1, "bg") == 0) { if (argc > (i + 1)) { background = strdup_ordie(argv[i + 1]); - DMA(DEBUG_INFO, "new background: %s", foreground); + bg = 1; + DMA(DEBUG_INFO, "new background: '%s'\n", foreground); i++; if (font == NULL) font = DEFAULT_FONT; @@ -1279,7 +1300,8 @@ static void parse_cmd(int argc, const char **argv, char *config_file) if (strcmp(arg + 1, "fg") == 0) { if (argc > (i + 1)) { foreground = strdup_ordie(argv[i + 1]); - DMA(DEBUG_INFO, "new foreground: %s", foreground); + fg = 1; + DMA(DEBUG_INFO, "new foreground: '%s'\n", foreground); i++; if (font == NULL) font = DEFAULT_FONT; @@ -1291,7 +1313,7 @@ static void parse_cmd(int argc, const char **argv, char *config_file) } else { font = strdup_ordie(argv[i + 1]); } - DMA(DEBUG_INFO, "new font: %s", font); + DMA(DEBUG_INFO, "new font: '%s'\n", font); i++; } } else { @@ -1315,7 +1337,8 @@ static void parse_cmd(int argc, const char **argv, char *config_file) if (strcmp(arg + 1, "hi") == 0) { if (argc > (i + 1)) { highlight = strdup_ordie(argv[i + 1]); - DMA(DEBUG_INFO, "new highlight: %s", highlight); + hi = 1; + DMA(DEBUG_INFO, "new highlight: '%s'\n", highlight); i++; if (font == NULL) font = DEFAULT_FONT; @@ -1358,6 +1381,9 @@ static void parse_cmd(int argc, const char **argv, char *config_file) forever = 0; } break; + case 'o': /* use classic behaviour/theme */ + classic_mode = 1; + break; default: usage(); exit(EXIT_SUCCESS); @@ -1375,6 +1401,16 @@ static void parse_cmd(int argc, const char **argv, char *config_file) } } } + + if (classic_mode) { + /* load classic colors if user did not override them */ + if(!fg) + foreground = foreground_classic; + if(!bg) + background = background_classic; + if(!hi) + highlight = highlight_classic; + } } int main(int argc, const char *argv[]) -- 2.11.4.GIT