/* * Copyright (c) 2006, Lars Engels * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * Neither the name of the Free Software Foundation nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define FONT "-adobe-helvetica-bold-r-normal-*-*-320-*-*-p-*-*-*" #define POS_X 10 #define POS_Y 48 #define SLEEP 1500000 #define COLOR "green" #define SYSCTL_CPU_FREQ "dev.cpu.0.freq" #define SYSCTL_CPU_FREQ_LEVELS "dev.cpu.0.freq_levels" #define SYSCTL_BATTERY_LIFE "hw.acpi.battery.life" #define SYSCTL_BATTERY_STATE "hw.acpi.battery.state" typedef struct { int cpu_freq; /* current cpu frequency */ int cpu_freq_avail; /* was a comaptible CPU found? */ int battery_life; /* remaining battery capacity */ int battery_state; /* AC state */ int battery_state_avail; /* do we get a AC line state? */ int battery_life_avail; /* battery information available? */ char freq_levels[255]; /* string containing the number of frequency levels */ int freq_levels_avail; /* do we have different cpu frequencies? */ size_t len_int; size_t len_freq; } SYSCTL_INFO; typedef struct { char *font; char *color; int pos_x; int pos_y; double sleeptime; } CONFIG; static void get_sysctls(SYSCTL_INFO*); static void show_bars(SYSCTL_INFO*, CONFIG*); static void usage(void); static xosd *osd = NULL;