Update to tint2-0.9. Now includes working battery monitor.
OK dcoppa_p@ and sthen@.
This commit is contained in:
parent
eeeaefc3a7
commit
2db27fd512
@ -1,14 +1,14 @@
|
||||
# $OpenBSD: Makefile,v 1.2 2009/08/11 08:42:09 ajacoutot Exp $
|
||||
# $OpenBSD: Makefile,v 1.3 2010/04/19 13:55:56 edd Exp $
|
||||
|
||||
COMMENT= lightweight freedesktop-compliant panel/taskbar/clock
|
||||
|
||||
DISTNAME= tint-0.6.0
|
||||
DISTNAME= tint2-0.9
|
||||
PKGNAME= ${DISTNAME:S/tint2/tint/}
|
||||
CATEGORIES= x11
|
||||
PKGNAME= ${DISTNAME}p0
|
||||
|
||||
HOMEPAGE= http://code.google.com/p/tint2/
|
||||
|
||||
MAINTAINER= Pierre-Emmanuel Andre <pea@raveland.org>
|
||||
MAINTAINER= Edd Barrett <edd@openbsd.org>
|
||||
|
||||
# MIT
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
@ -16,28 +16,21 @@ PERMIT_PACKAGE_FTP= Yes
|
||||
PERMIT_DISTFILES_CDROM= Yes
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
|
||||
WANTLIB= X11 Xau Xdmcp Xext Xinerama Xrender c cairo expat \
|
||||
fontconfig freetype glib-2.0 glitz gmodule-2.0 \
|
||||
gobject-2.0 m pixman-1 png z pthread-stubs xcb
|
||||
WANTLIB= X11 Xinerama Xrender c cairo glib-2.0 gobject-2.0 \
|
||||
Xcomposite Xdamage
|
||||
|
||||
MASTER_SITES= http://tint2.googlecode.com/files/
|
||||
|
||||
MODULES= devel/gettext
|
||||
|
||||
LIB_DEPENDS= Imlib2.>=2::graphics/imlib2 \
|
||||
pango-1.0,pangoft2-1.0,pangocairo-1.0::devel/pango
|
||||
pango-1.0,pangocairo-1.0::devel/pango
|
||||
|
||||
USE_X11= Yes
|
||||
USE_GMAKE= Yes
|
||||
NO_REGRESS= Yes
|
||||
|
||||
WRKDIST= ${WRKDIR}/tint
|
||||
WRKSRC= ${WRKDIST}/src
|
||||
CONFIGURE_STYLE=gnu
|
||||
CONFIGURE_ENV+= "LDFLAGS=-L${LOCALBASE}/lib -L${X11BASE}/lib"
|
||||
|
||||
ALL_TARGET= tint
|
||||
|
||||
post-install:
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/tint
|
||||
${INSTALL_DATA} ${WRKDIST}/doc/tint-0.6.* ${PREFIX}/share/doc/tint/
|
||||
FAKE_FLAGS= rcdir=${PREFIX}/share/examples/tint2
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,5 +1,5 @@
|
||||
MD5 (tint-0.6.0.tar.gz) = UKMncwQpNzoYKGsn+RX+/Q==
|
||||
RMD160 (tint-0.6.0.tar.gz) = cBWCOs7NvF0syGf+w29F/wvHAfo=
|
||||
SHA1 (tint-0.6.0.tar.gz) = diAOYtyXHYgwO9ZAh/hpFSbAtWk=
|
||||
SHA256 (tint-0.6.0.tar.gz) = 12IxHkvaFOpJ8wbLffG4N1kmpCeaSPRu5GprhqwqNgM=
|
||||
SIZE (tint-0.6.0.tar.gz) = 362794
|
||||
MD5 (tint2-0.9.tar.gz) = QR3mzLi4IImFLYyFSxLduQ==
|
||||
RMD160 (tint2-0.9.tar.gz) = lYpIUIV+K5D+pyxI0yyj1ofWvHQ=
|
||||
SHA1 (tint2-0.9.tar.gz) = +mmqqSS7WoXPp1OUbIpuvtedc9g=
|
||||
SHA256 (tint2-0.9.tar.gz) = X4sUlpx713WPY2H6rieeHQZZyb40ehKgcvjPk4VPRwM=
|
||||
SIZE (tint2-0.9.tar.gz) = 206491
|
||||
|
114
x11/tint/patches/patch-sample_tint2rc
Normal file
114
x11/tint/patches/patch-sample_tint2rc
Normal file
@ -0,0 +1,114 @@
|
||||
$OpenBSD: patch-sample_tint2rc,v 1.1 2010/04/19 13:55:56 edd Exp $
|
||||
--- sample/tint2rc.orig Thu Jan 28 11:16:34 2010
|
||||
+++ sample/tint2rc Fri Apr 16 02:22:44 2010
|
||||
@@ -1,31 +1,33 @@
|
||||
#---------------------------------------------
|
||||
# TINT2 CONFIG FILE
|
||||
+# Hacked for sensible OpenBSD defaults.
|
||||
#---------------------------------------------
|
||||
|
||||
#---------------------------------------------
|
||||
# BACKGROUND AND BORDER
|
||||
#---------------------------------------------
|
||||
-rounded = 7
|
||||
-border_width = 2
|
||||
-background_color = #000000 60
|
||||
-border_color = #ffffff 18
|
||||
|
||||
-rounded = 5
|
||||
-border_width = 0
|
||||
-background_color = #ffffff 40
|
||||
-border_color = #ffffff 50
|
||||
+# id = 0
|
||||
+# transparent
|
||||
|
||||
-rounded = 5
|
||||
+# id = 1
|
||||
+rounded = 0
|
||||
border_width = 0
|
||||
-background_color = #ffffff 18
|
||||
-border_color = #ffffff 70
|
||||
+background_color = #ffffff 5
|
||||
+border_color = #333333
|
||||
|
||||
+# id = 2
|
||||
+rounded = 0
|
||||
+border_width = 1
|
||||
+background_color = #424343
|
||||
+border_color = #333333
|
||||
+
|
||||
#---------------------------------------------
|
||||
# PANEL
|
||||
#---------------------------------------------
|
||||
panel_monitor = all
|
||||
panel_position = bottom center
|
||||
-panel_size = 94% 30
|
||||
+panel_size = 100% 30
|
||||
panel_margin = 0 0
|
||||
panel_padding = 7 0
|
||||
font_shadow = 0
|
||||
@@ -40,8 +42,8 @@ panel_layer = bottom
|
||||
#taskbar_mode = multi_desktop
|
||||
taskbar_mode = single_desktop
|
||||
taskbar_padding = 2 3 2
|
||||
-taskbar_background_id = 0
|
||||
-#taskbar_active_background_id = 0
|
||||
+taskbar_background_id = 1
|
||||
+taskbar_active_background_id = 0
|
||||
|
||||
#---------------------------------------------
|
||||
# TASKS
|
||||
@@ -51,9 +53,9 @@ task_text = 1
|
||||
task_maximum_size = 140 35
|
||||
task_centered = 1
|
||||
task_padding = 6 3
|
||||
-task_font = sans 7
|
||||
+task_font = sans 10
|
||||
task_font_color = #ffffff 70
|
||||
-task_background_id = 3
|
||||
+task_background_id = 0
|
||||
task_icon_asb = 100 0 0
|
||||
# replace STATUS by 'urgent', 'active' or 'iconfied'
|
||||
#task_STATUS_background_id = 2
|
||||
@@ -61,7 +63,7 @@ task_icon_asb = 100 0 0
|
||||
#task_STATUS_icon_asb = 100 0 0
|
||||
# example:
|
||||
task_active_background_id = 2
|
||||
-task_active_font_color = #ffffff 85
|
||||
+task_active_font_color = #ffffff
|
||||
task_active_icon_asb = 100 0 0
|
||||
urgent_nb_of_blink = 8
|
||||
|
||||
@@ -95,8 +97,8 @@ clock_rclick_command = orage
|
||||
#---------------------------------------------
|
||||
# BATTERY
|
||||
#---------------------------------------------
|
||||
-battery = 0
|
||||
-battery_hide = 98
|
||||
+battery = 1
|
||||
+battery_hide = never
|
||||
battery_low_status = 10
|
||||
battery_low_cmd = notify-send "battery low"
|
||||
bat1_font = sans 8
|
||||
@@ -105,16 +107,17 @@ battery_font_color = #ffffff 76
|
||||
battery_padding = 1 0
|
||||
battery_background_id = 0
|
||||
|
||||
+
|
||||
#---------------------------------------------
|
||||
# TOOLTIP
|
||||
#---------------------------------------------
|
||||
-tooltip = 0
|
||||
+tooltip = 1
|
||||
tooltip_padding = 2 2
|
||||
tooltip_show_timeout = 0.7
|
||||
tooltip_hide_timeout = 0.3
|
||||
-tooltip_background_id = 1
|
||||
-tooltip_font_color = #OOOOOO 80
|
||||
-tooltip_font = sans 10
|
||||
+tooltip_background_id = 2
|
||||
+tooltip_font_color = #ffffff 80
|
||||
+tooltip_font = sans 10
|
||||
|
||||
#---------------------------------------------
|
||||
# MOUSE ACTION ON TASK
|
@ -1,14 +0,0 @@
|
||||
$OpenBSD: patch-src_Makefile,v 1.1.1.1 2008/09/17 15:39:51 ajacoutot Exp $
|
||||
--- src/Makefile.orig Sat Jul 19 15:43:41 2008
|
||||
+++ src/Makefile Wed Sep 17 14:51:56 2008
|
||||
@@ -11,8 +11,8 @@ ifndef DESTDIR
|
||||
XDG_CONFIG_DIR=/etc/xdg
|
||||
endif
|
||||
else
|
||||
- BINDIR=$(DESTDIR)/usr/bin
|
||||
- XDG_CONFIG_DIR=$(DESTDIR)/etc/xdg
|
||||
+ BINDIR=$(PREFIX)/bin
|
||||
+ XDG_CONFIG_DIR=$(PREFIX)/share/examples/
|
||||
endif
|
||||
|
||||
|
12
x11/tint/patches/patch-src_Makefile_in
Normal file
12
x11/tint/patches/patch-src_Makefile_in
Normal file
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-src_Makefile_in,v 1.1 2010/04/19 13:55:56 edd Exp $
|
||||
--- src/Makefile.in.orig Tue Apr 13 23:00:33 2010
|
||||
+++ src/Makefile.in Tue Apr 13 23:00:45 2010
|
||||
@@ -158,7 +158,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
-LIBS = @PANGOCAIRO_LIBS@ @PANGO_LIBS@ @CAIRO_LIBS@ @GLIB2_LIBS@ @GOBJECT2_LIBS@ @X11_LIBS@ @XINERAMA_LIBS@ @IMLIB2_LIBS@ -lrt
|
||||
+LIBS = @PANGOCAIRO_LIBS@ @PANGO_LIBS@ @CAIRO_LIBS@ @GLIB2_LIBS@ @GOBJECT2_LIBS@ @X11_LIBS@ @XINERAMA_LIBS@ @IMLIB2_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
153
x11/tint/patches/patch-src_battery_battery_c
Normal file
153
x11/tint/patches/patch-src_battery_battery_c
Normal file
@ -0,0 +1,153 @@
|
||||
$OpenBSD: patch-src_battery_battery_c,v 1.1 2010/04/19 13:55:56 edd Exp $
|
||||
--- src/battery/battery.c.orig Tue Jan 19 19:29:28 2010
|
||||
+++ src/battery/battery.c Fri Apr 16 11:03:54 2010
|
||||
@@ -24,6 +24,13 @@
|
||||
#include <cairo-xlib.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+#include <machine/apmvar.h>
|
||||
+#include <err.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <unistd.h>
|
||||
+#endif
|
||||
+
|
||||
#include "window.h"
|
||||
#include "server.h"
|
||||
#include "area.h"
|
||||
@@ -51,6 +58,10 @@ char *path_energy_full=0;
|
||||
char *path_current_now=0;
|
||||
char *path_status=0;
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+int apm_fd = NULL;
|
||||
+#endif
|
||||
+
|
||||
void update_batterys(void* arg)
|
||||
{
|
||||
int i;
|
||||
@@ -80,6 +91,21 @@ void update_batterys(void* arg)
|
||||
|
||||
void init_battery()
|
||||
{
|
||||
+
|
||||
+#if defined(__OpenBSD__)
|
||||
+
|
||||
+ apm_fd = open("/dev/apm", O_RDONLY, "r");
|
||||
+ if (apm_fd < 0) {
|
||||
+ warn("init_battery: failed to open /dev/apm.");
|
||||
+ battery_enabled = 0;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (battery_enabled && battery_timeout==0)
|
||||
+ battery_timeout = add_timeout(10, 10000, update_batterys, 0);
|
||||
+
|
||||
+#else
|
||||
+
|
||||
// check battery
|
||||
GDir *directory = 0;
|
||||
GError *error = NULL;
|
||||
@@ -150,9 +176,8 @@ void init_battery()
|
||||
|
||||
g_free(path1);
|
||||
g_free(battery_dir);
|
||||
+#endif
|
||||
|
||||
- if (battery_enabled && battery_timeout==0)
|
||||
- battery_timeout = add_timeout(10, 10000, update_batterys, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -176,6 +201,12 @@ void cleanup_battery()
|
||||
|
||||
battery_low_cmd = path_energy_now = path_energy_full = path_current_now = path_status = 0;
|
||||
bat1_font_desc = bat2_font_desc = 0;
|
||||
+
|
||||
+#if defined(__OpenBSD__)
|
||||
+ if (close(apm_fd) == -1)
|
||||
+ warn("cannot close /dev/apm");
|
||||
+#endif
|
||||
+
|
||||
}
|
||||
|
||||
|
||||
@@ -227,8 +258,43 @@ void update_battery() {
|
||||
char tmp[25];
|
||||
int64_t energy_now = 0, energy_full = 0, current_now = 0;
|
||||
int seconds = 0;
|
||||
- int8_t new_percentage = 0;
|
||||
+ unsigned int new_percentage = 0;
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+
|
||||
+ /* OpenBSD */
|
||||
+ struct apm_power_info info;
|
||||
+ if (ioctl(apm_fd, APM_IOC_GETPOWER, &(info)) < 0)
|
||||
+ warn("power update: APM_IOC_GETPOWER");
|
||||
+
|
||||
+ /* best attempt at mapping to linux battery states */
|
||||
+ battery_state.state = BATTERY_UNKNOWN;
|
||||
+ switch (info.battery_state) {
|
||||
+ case APM_BATT_CHARGING:
|
||||
+ battery_state.state = BATTERY_CHARGING;
|
||||
+ break;
|
||||
+ default:
|
||||
+ battery_state.state = BATTERY_DISCHARGING;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (info.battery_life == 100)
|
||||
+ battery_state.state = BATTERY_FULL;
|
||||
+
|
||||
+ /* no mapping for openbsd really */
|
||||
+ energy_full = 0;
|
||||
+ energy_now = 0;
|
||||
+
|
||||
+ if (info.minutes_left != -1)
|
||||
+ seconds = info.minutes_left * 60;
|
||||
+ else
|
||||
+ seconds = -1;
|
||||
+
|
||||
+ new_percentage = info.battery_life;
|
||||
+
|
||||
+#else
|
||||
+ /* original linuxesque code */
|
||||
+
|
||||
fp = fopen(path_status, "r");
|
||||
if(fp != NULL) {
|
||||
if (fgets(tmp, sizeof tmp, fp)) {
|
||||
@@ -240,6 +306,7 @@ void update_battery() {
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
+
|
||||
fp = fopen(path_energy_now, "r");
|
||||
if(fp != NULL) {
|
||||
if (fgets(tmp, sizeof tmp, fp)) energy_now = atoi(tmp);
|
||||
@@ -272,20 +339,22 @@ void update_battery() {
|
||||
}
|
||||
} else seconds = 0;
|
||||
|
||||
+ if(energy_full > 0)
|
||||
+ new_percentage = (energy_now*100)/energy_full;
|
||||
+#endif
|
||||
+
|
||||
battery_state.time.hours = seconds / 3600;
|
||||
seconds -= 3600 * battery_state.time.hours;
|
||||
battery_state.time.minutes = seconds / 60;
|
||||
seconds -= 60 * battery_state.time.minutes;
|
||||
battery_state.time.seconds = seconds;
|
||||
|
||||
- if(energy_full > 0)
|
||||
- new_percentage = (energy_now*100)/energy_full;
|
||||
-
|
||||
if(battery_low_status > new_percentage && battery_state.state == BATTERY_DISCHARGING && !battery_low_cmd_send) {
|
||||
if (battery_low_cmd)
|
||||
if (-1 != system(battery_low_cmd))
|
||||
battery_low_cmd_send = 1;
|
||||
}
|
||||
+
|
||||
if(battery_low_status < new_percentage && battery_state.state == BATTERY_CHARGING && battery_low_cmd_send) {
|
||||
battery_low_cmd_send = 0;
|
||||
}
|
12
x11/tint/patches/patch-src_battery_battery_h
Normal file
12
x11/tint/patches/patch-src_battery_battery_h
Normal file
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-src_battery_battery_h,v 1.1 2010/04/19 13:55:56 edd Exp $
|
||||
--- src/battery/battery.h.orig Tue Jan 19 19:29:28 2010
|
||||
+++ src/battery/battery.h Fri Apr 16 01:40:55 2010
|
||||
@@ -42,7 +42,7 @@ typedef struct battime {
|
||||
} battime;
|
||||
|
||||
typedef struct batstate {
|
||||
- int percentage;
|
||||
+ unsigned int percentage;
|
||||
struct battime time;
|
||||
enum chargestate state;
|
||||
} batstate;
|
@ -1,10 +1,15 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2008/09/17 15:39:51 ajacoutot Exp $
|
||||
@bin bin/tint
|
||||
share/doc/tint/
|
||||
share/doc/tint/tint-0.6.odt
|
||||
share/doc/tint/tint-0.6.pdf
|
||||
share/examples/tint/
|
||||
@comment $OpenBSD: PLIST,v 1.2 2010/04/19 13:55:56 edd Exp $
|
||||
@bin bin/tint2
|
||||
@man man/man1/tint2.1
|
||||
share/doc/tint2/
|
||||
@sample ${SYSCONFDIR}/xdg/
|
||||
@sample ${SYSCONFDIR}/xdg/tint/
|
||||
share/examples/tint/tintrc
|
||||
@sample ${SYSCONFDIR}/xdg/tint/tintrc
|
||||
@sample ${SYSCONFDIR}/xdg/tint2/
|
||||
share/doc/tint2/AUTHORS
|
||||
share/doc/tint2/ChangeLog
|
||||
share/doc/tint2/NEWS
|
||||
share/doc/tint2/README
|
||||
share/examples/tint2/
|
||||
share/examples/tint2/tint2rc
|
||||
@sample ${SYSCONFDIR}/xdg/tint2/tint2rc
|
||||
share/tint2/
|
||||
share/tint2/default_icon.png
|
||||
|
Loading…
Reference in New Issue
Block a user