--- ./src/default.h.orig 2010-01-13 04:06:18.000000000 +1000 +++ ./src/default.h 2010-03-22 15:13:14.246371014 +1000 @@ -6,8 +6,8 @@ /************************************************************************************************************************************************************/ XIV(int, focusMode, 1) XIV(bool, clickFocus, true) -XIV(bool, focusOnAppRaise, false) -XIV(bool, requestFocusOnAppRaise, true) +XIV(bool, focusOnAppRaise, false) +XIV(bool, requestFocusOnAppRaise, true) XIV(bool, raiseOnFocus, true) XIV(bool, focusOnClickClient, true) XIV(bool, raiseOnClickClient, true) @@ -40,6 +40,7 @@ XIV(bool, taskBarShowClock, true) XIV(bool, taskBarShowApm, false) XIV(bool, taskBarShowApmTime, true) // mschy +XIV(bool, taskBarShowApmGraph, true) // hatred XIV(bool, taskBarShowMailboxStatus, true) XIV(bool, taskBarShowStartMenu, true) XIV(bool, taskBarShowWindowListMenu, true) @@ -149,6 +150,7 @@ XIV(int, msgBoxDefaultAction, 0) XIV(int, mailCheckDelay, 30) XIV(int, taskBarCPUSamples, 20) +XIV(int, taskBarApmGraphWidth, 10) // hatred XIV(int, focusRequestFlashTime, 0) XIV(int, focusRequestFlashInterval, 250) XIV(int, nestedThemeMenuMinNumber, 15) @@ -272,6 +274,7 @@ OBV("TaskBarShowClock", &taskBarShowClock, "Show clock on task bar"), OBV("TaskBarShowAPMStatus", &taskBarShowApm, "Show APM/ACPI/Battery/Power status monitor on task bar"), OBV("TaskBarShowAPMTime", &taskBarShowApmTime, "Show APM status on task bar in time-format"), // mschy + OBV("TaskBarShowAPMGraph", &taskBarShowApmGraph, "Show APM status in graph mode"), // hatred OBV("TaskBarShowMailboxStatus", &taskBarShowMailboxStatus, "Show mailbox status on task bar"), OBV("TaskBarMailboxStatusBeepOnNewMail", &beepOnNewMail, "Beep when new mail arrives"), OBV("TaskBarMailboxStatusCountMessages", &countMailMessages, "Count messages in mailbox"), @@ -365,6 +368,7 @@ OIV("TaskBarNetSamples", &taskBarNetSamples, 2, 1000, "Width of Net Monitor"), OIV("TaskBarNetDelay", &taskBarNetDelay, 10, (60*60*1000), "Delay between Net Monitor samples in ms"), OIV("TaskbarButtonWidthDivisor", &taskBarButtonWidthDivisor, 1, 25, "default number of tasks in taskbar"), + OIV("TaskBarApmGraphWidth", &taskBarApmGraphWidth, 1, 1000, "Width of APM Monitor"), // hatred #endif OIV("XineramaPrimaryScreen", &xineramaPrimaryScreen, 0, 63, "Primary screen for xinerama (taskbar, ...)"), --- ./src/aapm.h.orig 2009-11-09 05:24:08.000000000 +1000 +++ ./src/aapm.h 2010-03-22 15:46:59.388673820 +1000 @@ -20,7 +20,7 @@ char *name; int capacity_full; } bat_info; - + class YApm: public YWindow, public YTimerListener { public: @@ -42,6 +42,7 @@ void AcpiStr(char *s, bool Tool); void SysStr(char *s, bool Tool); void PmuStr(char *, const bool); + void ApmStr(char *s, bool Tool); int ignore_directory_bat_entry(struct dirent *de); int ignore_directory_ac_entry(struct dirent *de); @@ -49,6 +50,10 @@ static YColor *apmFg; static ref apmFont; + static YColor *apmColorOnLine; + static YColor *apmColorBattery; + static YColor *apmColorGraphBg; + // display mode: pmu, acpi or apm info enum { APM, ACPI, PMU, SYSFS } mode; //number of batteries (for apm == 1) @@ -63,6 +68,10 @@ char *acpiACName; char *fCurrentState; + // On line status and charge persent + int acIsOnLine; + double chargeStatus; + void updateState(); }; #else --- ./src/aapm.cc.orig 2010-03-22 13:26:00.969626573 +1000 +++ ./src/aapm.cc 2010-03-22 15:46:34.808668050 +1000 @@ -49,6 +49,10 @@ YColor *YApm::apmFg = 0; ref YApm::apmFont; +YColor *YApm::apmColorOnLine = 0; +YColor *YApm::apmColorBattery = 0; +YColor *YApm::apmColorGraphBg = 0; + extern ref taskbackPixmap; static YColor *taskBarBg = 0; @@ -66,7 +70,7 @@ #define BAT_FULL 3 -void ApmStr(char *s, bool Tool) { +void YApm::ApmStr(char *s, bool Tool) { #if defined(__FreeBSD__) && defined(i386) struct apm_info ai; #elif defined __NetBSD__ @@ -132,6 +136,10 @@ buf[len] = 0; + // hatred: for ApmGraph + acIsOnLine = (ACstatus == 0x1); + chargeStatus = 0; + if ((i = sscanf(buf, "%s %s 0x%x 0x%x 0x%x 0x%x %d%% %d %s", driver, apmver, &apmflags, &ACstatus, &BATstatus, &BATflag, &BATlife, @@ -151,6 +159,8 @@ if (strcmp(units, "min") != 0 && BATtime != -1) BATtime /= 60; + chargeStatus = BATlife; + if (!Tool) { if (taskBarShowApmTime) { // mschy if (BATtime == -1) { @@ -302,6 +312,11 @@ } #endif + // hatred: for ApmGraph + acIsOnLine = (ACstatus == AC_ONLINE); + chargeStatus = 0; + int batCount = 0; + int n = 0; for (i = 0; i < batteryNum; i++) { BATname = acpiBatteries[i]->name; @@ -371,7 +386,7 @@ acpifd = open(ACPIDEV, O_RDONLY); if (acpifd != -1) { union acpi_battery_ioctl_arg battio; - + battio.unit = i; if (ioctl(acpifd, ACPIIO_BATT_GET_BATTINFO, &battio) != -1) { if (battio.battinfo.state != ACPI_BATT_STAT_NOT_PRESENT) { @@ -424,9 +439,9 @@ } #else union acpi_battery_ioctl_arg battio; -#define UNKNOWN_CAP 0xffffffff -#define UNKNOWN_VOLTAGE 0xffffffff - +#define UNKNOWN_CAP 0xffffffff +#define UNKNOWN_VOLTAGE 0xffffffff + battio.unit = i; if (ioctl(acpifd, ACPIIO_BATT_GET_BIF, &battio) != -1) { if (battio.bif.dcap != UNKNOWN_CAP) @@ -449,6 +464,15 @@ close(acpifd); #endif + // hatred: for ApmGraph + if (BATpresent == BAT_PRESENT && + //did we parse the needed values successfully? + BATcapacity_remain >= 0 && BATcapacity_full >= 0) + { + chargeStatus += 100 * (double)BATcapacity_remain / BATcapacity_full; + batCount++; + } + bat_info[0] = 0; if (!Tool && taskBarShowApmTime && @@ -492,6 +516,9 @@ strcat(s, bat_info); } + // hatred: for ApmGraph + chargeStatus /= batCount; + if (ACstatus == AC_ONLINE) { if (Tool) strcat(s,_(" - Power")); @@ -550,6 +577,11 @@ } } + // hatred: for ApmGraph + acIsOnLine = (ACstatus == AC_ONLINE); + chargeStatus = 0; + int batCount = 0; + int n = 0; for (i = 0; i < batteryNum; i++) { BATname = acpiBatteries[i]->name; @@ -657,6 +689,15 @@ } acpiBatteries[i]->present = BATpresent; + // hatred: for ApmGraph + if (BATpresent == BAT_PRESENT && + //did we parse the needed values successfully? + BATcapacity_remain >= 0 && BATcapacity_full >= 0) + { + chargeStatus += 100 * (double)BATcapacity_remain / BATcapacity_full; + batCount++; + } + if (!Tool && taskBarShowApmTime && BATpresent == BAT_PRESENT && @@ -696,6 +737,9 @@ strcat(s, bat_info); } + // hatred: for ApmGraph + chargeStatus /= batCount; + if (ACstatus == AC_ONLINE) { if (Tool) strcat(s,_(" - Power")); @@ -715,7 +759,7 @@ // this is somewhat difficult, because pmu support seams to be gone return; } - + char line[80]; int power_present; while ( fgets(line, 80, fd) != NULL ) @@ -725,6 +769,11 @@ } fclose(fd); + // hatred: for ApmGraph + acIsOnLine = (power_present != 0); + chargeStatus = 0; + int batCount = 0; + char* s_end = s; for (int i=0; i < batteryNum; ++i) { char file_name[20]; @@ -757,7 +806,16 @@ if (time_in_min) rem_time /= 60; - + + // hatred: for ApmGraph + if (battery_present && + //did we parse the needed values successfully? + charge >= 0 && max_charge >= 0) + { + chargeStatus += 100.0 * (double)charge / (double)max_charge; + batCount++; + } + if (tool_tip) { if (i > 0) { strcpy(s_end, " / "); @@ -769,7 +827,7 @@ s_end += sprintf(s_end, " %d%c%02d%s", rem_time/60, time_in_min?':':'.', rem_time%60, time_in_min?"h":"m"); - + s_end += sprintf(s_end, " %.0f%% %d/%dmAh %.3fV", 100.0*charge/max_charge, charge, max_charge, voltage/1e3); @@ -798,6 +856,9 @@ } } + // hatred: for ApmGraph + chargeStatus /= batCount; + if (power_present) { if (tool_tip) strcpy(s_end, _(" - Power")); @@ -817,6 +878,9 @@ acpiACName = 0; fCurrentState = 0; + acIsOnLine = false; // hatred + chargeStatus = 0.0; + //search for acpi info first #ifndef __FreeBSD__ n = scandir("/sys/class/power_supply", &de, 0, alphasort); @@ -833,7 +897,7 @@ //scan for batteries i = 0; while (i < n && batteryNum < MAX_ACPI_BATTERY_NUM) { - if (mode == SYSFS) + if (mode == SYSFS) { strcat3(buf, "/sys/class/power_supply/", de[i]->d_name, "/online", sizeof(buf)); fd = fopen(buf, "r"); @@ -863,9 +927,9 @@ free(de); //scan for first ac_adapter - if (mode == ACPI) + if (mode == ACPI) n = scandir("/proc/acpi/ac_adapter", &de, 0, alphasort); - else if (mode == SYSFS) + else if (mode == SYSFS) n = scandir("/sys/class/power_supply", &de, 0, alphasort); if (n > 0) { i = 0; @@ -900,7 +964,7 @@ } #else int acpifd; - + acpifd = open(ACPIDEV, O_RDONLY); if (acpifd != -1) { mode = ACPI; @@ -909,7 +973,7 @@ i = 0; while (i < 64 && batteryNum < MAX_ACPI_BATTERY_NUM) { union acpi_battery_ioctl_arg battio; - + battio.unit = i; if (ioctl(acpifd, ACPIIO_BATT_GET_BATTINFO, &battio) != -1) { acpiBatteries[batteryNum] = @@ -946,12 +1010,22 @@ if (taskBarBg == 0) { taskBarBg = new YColor(clrDefaultTaskBar); } + + // hatred + if (apmColorOnLine == 0) apmColorOnLine = new YColor(clrApmLine); + if (apmColorBattery == 0) apmColorBattery = new YColor(clrApmBat); + if (apmColorGraphBg == 0) apmColorGraphBg = new YColor(clrApmGraphBg); + updateState(); apmTimer = new YTimer(1000 * batteryPollingPeriod); apmTimer->setTimerListener(this); apmTimer->startTimer(); - setSize(calcInitialWidth(), 20); + + if (taskBarShowApmGraph) + setSize(taskBarApmGraphWidth, 20); + else + setSize(calcInitialWidth(), 20); updateToolTip(); // setDND(true); } @@ -1041,7 +1115,7 @@ void YApm::paint(Graphics &g, const YRect &/*r*/) { unsigned int x = 0; int len, i; - + len = fCurrentState ? strlen(fCurrentState) : 0; //clean background of current size first, so that @@ -1074,7 +1148,20 @@ #endif //draw foreground - if (prettyClock) { + if (taskBarShowApmGraph) { + // Draw graph indicator + g.setColor(apmColorGraphBg); + g.fillRect(0, 0, taskBarApmGraphWidth, height()); + + int new_h = (int)(chargeStatus/100.0 * (double)height()); + if (acIsOnLine == true) { // onLine + g.setColor(apmColorOnLine); + } else { + g.setColor(apmColorBattery); + } + + g.fillRect(0, height() - new_h, taskBarApmGraphWidth, new_h); + } else if (prettyClock) { ref p; for (i = 0; x < new_width; i++) { --- ./src/themable.h.orig 2004-04-19 01:18:08.000000000 +1100 +++ ./src/themable.h 2010-03-22 15:40:18.925381974 +1000 @@ -5,7 +5,7 @@ #if defined(CONFIG_I18N) || 1 // maybe not such a good idea XIV(bool, prettyClock, false) -#else +#else XIV(bool, prettyClock, true) #endif XIV(bool, rolloverTitleButtons, false) @@ -127,6 +127,9 @@ XSV(const char *, clrClockText, "rgb:00/FF/00") XSV(const char *, clrApm, "rgb:00/00/00") XSV(const char *, clrApmText, "rgb:00/FF/00") +XSV(const char *, clrApmBat, "rgb:FF/FF/00") // hatred: Yellow +XSV(const char *, clrApmLine, "rgb:00/FF/00") // hatred: Green +XSV(const char *, clrApmGraphBg, "rgb:00/00/00") // hatred: Black XSV(const char *, clrInput, "rgb:FF/FF/FF") XSV(const char *, clrInputText, "rgb:00/00/00") XSV(const char *, clrInputSelection, "rgb:80/80/80") @@ -256,7 +259,7 @@ OSV("ColorMoveSizeStatus", &clrMoveSizeStatus, "Background of move/resize status window"), OSV("ColorMoveSizeStatusText", &clrMoveSizeStatusText, "Textcolor of move/resize status window"), - + OSV("ColorQuickSwitch", &clrQuickSwitch, "Background of the quick switch window"), OSV("ColorQuickSwitchText", &clrQuickSwitchText, "Textcolor in the quick switch window"), OSV("ColorQuickSwitchActive", &clrQuickSwitchActive, "Rectangle arround the active icon in the quick switch window"), @@ -296,11 +299,14 @@ #ifdef CONFIG_APPLET_CLOCK OSV("ColorClock", &clrClock, "Background of non-LCD clock, leave empty to force transparency"), OSV("ColorClockText", &clrClockText, "Background of non-LCD monitor"), -#endif +#endif #ifdef CONFIG_APPLET_APM OSV("ColorApm", &clrApm, "Background of APM monitor, leave empty to force transparency"), OSV("ColorApmText", &clrApmText, "Textcolor of APM monitor"), -#endif + OSV("ColorApmBattary", &clrApmBat, "Color of APM monitor in battary mode"), // hatred + OSV("ColorApmLine", &clrApmLine, "Color of APM monitor in line mode"), // hatred + OSV("ColorApmGraphBg", &clrApmGraphBg, "Background color for graph mode"), // hatred +#endif #ifdef CONFIG_APPLET_CPU_STATUS OSV("ColorCPUStatusUser", &clrCpuUser, "User load on the CPU monitor"), OSV("ColorCPUStatusSystem", &clrCpuSys, "System load on the CPU monitor"), @@ -309,7 +315,7 @@ OSV("ColorCPUStatusSoftIrq", &clrCpuSoftIrq, "Soft Interrupts on the CPU monitor"), OSV("ColorCPUStatusNice", &clrCpuNice, "Nice load on the CPU monitor"), OSV("ColorCPUStatusIdle", &clrCpuIdle, "Idle (non) load on the CPU monitor, leave empty to force transparency"), -#endif +#endif #ifdef CONFIG_APPLET_NET_STATUS OSV("ColorNetSend", &clrNetSend, "Outgoing load on the network monitor"), OSV("ColorNetReceive", &clrNetReceive, "Incoming load on the network monitor"),