desktop/lxpanel: Updated for version 0.9.1.

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
This commit is contained in:
Matteo Bernardini 2016-12-09 11:03:16 +01:00 committed by Willy Sudiarto Raharjo
parent 66b27a286d
commit 64ca933a33
No known key found for this signature in database
GPG Key ID: 887B8374D7333381
6 changed files with 339 additions and 208 deletions

View File

@ -2,219 +2,167 @@
# Use preference dialog in lxpanel to adjust config when you can.
Global {
edge=bottom
allign=center
margin=0
widthtype=percent
width=95
height=26
transparent=0
tintcolor=#000000
alpha=0
setdocktype=1
setpartialstrut=1
usefontcolor=1
fontcolor=#ffffff
background=1
backgroundfile=/usr/share/lxpanel/images/background.png
edge=bottom
allign=left
margin=0
widthtype=percent
width=95
height=26
transparent=0
tintcolor=#000000
alpha=0
setdocktype=1
setpartialstrut=1
usefontcolor=1
fontcolor=#ffffff
usefontsize=0
fontsize=10
background=1
backgroundfile=/usr/share/lxpanel/images/background.png
align=center
}
Plugin {
type = space
Config {
Size=2
type=space
Config {
Size=2
}
}
Plugin {
type=menu
Config {
image=/usr/share/lxpanel/images/my-computer.png
system {
}
}
Plugin {
type = menu
Config {
image=/usr/share/lxpanel/images/my-computer.png
system {
}
separator {
}
item {
command=run
}
separator {
}
item {
image=gnome-logout
command=logout
}
separator {
}
}
Plugin {
type = launchbar
Config {
Button {
id=pcmanfm.desktop
}
Button {
id=menu://applications/Internet/mozilla-firefox.desktop
}
Button {
id=menu://applications/Internet/mozilla-thunderbird.desktop
}
Button {
id=menu://applications/System/lxterminal.desktop
}
item {
command=run
}
}
Plugin {
type = space
Config {
Size=4
separator {
}
}
Plugin {
type = wincmd
Config {
Button1=iconify
Button2=shade
item {
image=gnome-logout
command=logout
}
}
}
Plugin {
type = space
Config {
Size=4
type=launchbar
Config {
Button {
id=pcmanfm.desktop
}
}
Plugin {
type = wnckpager
}
Plugin {
type = space
Config {
Size=4
Button {
id=menu://applications/Internet/mozilla-firefox.desktop
}
}
Plugin {
type = taskbar
expand=1
Config {
tooltips=1
IconsOnly=0
AcceptSkipPager=1
ShowIconified=1
ShowMapped=1
ShowAllDesks=0
UseMouseWheel=1
UseUrgencyHint=1
FlatButton=0
MaxTaskWidth=150
spacing=1
Button {
id=menu://applications/Internet/mozilla-thunderbird.desktop
}
}
Plugin {
type = volumealsa
}
Plugin {
type = space
Config {
Size=4
Button {
id=menu://applications/System/lxterminal.desktop
}
}
}
Plugin {
type = tray
Config {
type=space
Config {
Size=2
}
}
Plugin {
type=wincmd
Config {
Button1=iconify
Button2=shade
}
}
Plugin {
type=space
Config {
Size=2
}
}
Plugin {
type=pager
Config {
}
}
Plugin {
type=space
Config {
Size=4
}
}
Plugin {
type=taskbar
expand=1
Config {
tooltips=1
IconsOnly=0
AcceptSkipPager=1
ShowIconified=1
ShowMapped=1
ShowAllDesks=0
UseMouseWheel=1
UseUrgencyHint=1
FlatButton=0
MaxTaskWidth=150
spacing=1
}
}
Plugin {
type=batt
Config {
}
}
Plugin {
type=space
Config {
Size=2
}
}
Plugin {
type=cpu
Config {
}
}
Plugin {
type=space
Config {
Size=2
}
}
Plugin {
type=tray
Config {
}
}
Plugin {
type=volume
Config {
}
}
Plugin {
type=dclock
Config {
ClockFmt=%R
TooltipFmt=%A %x
BoldFont=0
IconOnly=0
CenterText=0
}
}
Plugin {
type=space
Config {
Size=2
}
}
Plugin {
type=launchbar
Config {
Button {
id=lxde-logout.desktop
}
}
}
Plugin {
type = space
Config {
Size=4
}
}
Plugin {
type = netstatus
Config {
iface=eth0
configtool=netconfig
}
}
Plugin {
type = space
Config {
Size=4
}
}
Plugin {
type = batt
Config {
HideIfNoBattery=0
AlarmCommand=xmessage Battery low
AlarmTime=5
BackgroundColor=black
BorderWidth=1
ChargingColor1=#28f200
ChargingColor2=#22cc00
DischargingColor1=#ffee00
DischargingColor2=#d9ca00
Size=8
}
}
Plugin {
type = space
Config {
Size=4
}
}
Plugin {
type = cpu
}
Plugin {
type = space
Config {
Size=4
}
}
Plugin {
type = cpufreq
}
Plugin {
type = dclock
Config {
ClockFmt=%R
TooltipFmt=%A %x
BoldFont=0
IconOnly=0
}
}
Plugin {
type = space
Config {
Size=4
}
}
Plugin {
type = launchbar
Config {
Button {
id=lxde-logout.desktop
}
}
}

View File

@ -25,13 +25,13 @@
# Modified by Matteo Bernardini <ponce@slackbuilds.org>
PRGNAM=lxpanel
VERSION=${VERSION:-0.8.2}
VERSION=${VERSION:-0.9.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
@ -44,8 +44,8 @@ OUTPUT=${OUTPUT:-/tmp}
DOCS="AUTHORS COPYING ChangeLog README"
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
@ -73,6 +73,9 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# apply patches from upstream
for i in $CWD/patches/* ; do patch -p1 < $i ; done
sh autogen.sh || true
CFLAGS="$SLKCFLAGS" \

View File

@ -1,10 +1,10 @@
PRGNAM="lxpanel"
VERSION="0.8.2"
VERSION="0.9.1"
HOMEPAGE="http://wiki.lxde.org/en/LXPanel"
DOWNLOAD="http://downloads.sf.net/lxde/lxpanel-0.8.2.tar.xz"
MD5SUM="8d7c93c4ebb4af8bf436ef6d3aee4ea9"
DOWNLOAD="http://downloads.sf.net/lxde/lxpanel-0.9.1.tar.xz"
MD5SUM="66500a36b905a7a5c14c0a4fcce9d8da"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="lxmenu-data libfm"
REQUIRES="libfm"
MAINTAINER="Matteo Bernardini"
EMAIL="ponce@slackbuilds.org"

View File

@ -0,0 +1,115 @@
From ad0022eb8b1524b18d2b512d7dd8d2920c0f8dab Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Fri, 25 Nov 2016 01:18:47 +0200
Subject: [PATCH 1/2] Fix battery selection, it appears incompatible with 0.7.2
behavior.
See https://bugs.debian.org/845555
---
ChangeLog | 2 ++
TODO | 2 +-
plugins/batt/batt_sys.c | 30 +++++++++++++++---------------
3 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a21a14e..0abe16b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+* Fixed battery selection, it appears incompatible with 0.7.2 behavior.
+
0.9.1
-------------------------------------------------------------------------
* Fixed build failure without ALSA.
diff --git a/TODO b/TODO
index 965b17c..8d9f91f 100644
--- a/TODO
+++ b/TODO
@@ -17,7 +17,7 @@
* decide 'netstat' vs 'netstatus'
* optional libnotify support (useful for battery and volume plugins)
* pull improvements from Raspbian
-* add Most Recent support into 'menu' plugin
+* add Most Recent support into 'menu' plugin (option: ones not by Run too)
* check and use weather-* standard themed icons for weather plugin
* "Remove this Launch Button" option in launchbar context menu
* 'usb-unmount' plugin
diff --git a/plugins/batt/batt_sys.c b/plugins/batt/batt_sys.c
index 154bd3d..2482c6f 100644
--- a/plugins/batt/batt_sys.c
+++ b/plugins/batt/batt_sys.c
@@ -4,6 +4,7 @@
* Copyright 2009 Juergen Hötzel <juergen@archlinux.org>
* 2015 Henry Gebhardt <hsggebhardt@googlemail.com>
* 2015 Stanislav Kozina, Ersin <xersin@users.sf.net>
+ * 2016 Andriy Grytsenko <andrej@rep.kiev.ua>
*
* Parts shameless stolen and glibified from acpi package
* Copyright (C) 2001 Grahame Bowland <grahame@angrygoats.net>
@@ -295,15 +296,8 @@ battery *battery_get(int battery_number) {
const gchar *entry;
gchar *batt_name = NULL;
gchar *batt_path = NULL;
- GDir * dir = g_dir_open( ACPI_PATH_SYS_POWER_SUPPLY, 0, &error );
+ GDir * dir;
battery *b = NULL;
- int i;
-
- if ( dir == NULL )
- {
- g_warning( "NO ACPI/sysfs support in kernel: %s", error->message );
- return NULL;
- }
/* Try the expected path in sysfs first */
batt_name = g_strdup_printf(ACPI_BATTERY_DEVICE_NAME "%d", battery_number);
@@ -324,13 +318,20 @@ battery *battery_get(int battery_number) {
g_free(batt_path);
if (b != NULL)
- goto done;
+ return b;
/*
* We didn't find the expected path in sysfs.
- * Walk the dir and blindly return n-th entry.
+ * Walk the dir and return any battery.
*/
- i = 0;
+ dir = g_dir_open( ACPI_PATH_SYS_POWER_SUPPLY, 0, &error );
+ if ( dir == NULL )
+ {
+ g_warning( "NO ACPI/sysfs support in kernel: %s", error->message );
+ g_error_free(error);
+ return NULL;
+ }
+
while ( ( entry = g_dir_read_name (dir) ) != NULL )
{
b = battery_new();
@@ -339,9 +340,7 @@ battery *battery_get(int battery_number) {
/* We're looking for a battery with the selected ID */
if (b->type_battery == TRUE) {
- if (i == battery_number)
- break;
- i++;
+ break;
}
battery_free(b);
b = NULL;
@@ -349,9 +348,10 @@ battery *battery_get(int battery_number) {
if (b != NULL)
g_warning( "Battery entry " ACPI_BATTERY_DEVICE_NAME "%d not found, using %s",
battery_number, b->path);
+ // FIXME: update config?
else
g_warning( "Battery %d not found", battery_number );
-done:
+
g_dir_close( dir );
return b;
}
--
2.11.0

View File

@ -0,0 +1,65 @@
From 138ff9b22b45192a3b020ebbbed04e9060470a66 Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Fri, 25 Nov 2016 02:06:39 +0200
Subject: [PATCH 2/2] Fix battery percentage calculations if charge isn't
available but energy is.
Should fix https://bugs.debian.org/845555 bug.
---
ChangeLog | 4 +++-
plugins/batt/batt_sys.c | 17 ++++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0abe16b..f4e4f61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
-* Fixed battery selection, it appears incompatible with 0.7.2 behavior.
+* Fixed battery selection if battery detached but another is available.
+* Fixed battery percentage calculations if charge isn't available but
+ energy is, it appears broken in 0.9.0.
0.9.1
-------------------------------------------------------------------------
diff --git a/plugins/batt/batt_sys.c b/plugins/batt/batt_sys.c
index 2482c6f..bd01e08 100644
--- a/plugins/batt/batt_sys.c
+++ b/plugins/batt/batt_sys.c
@@ -167,6 +167,7 @@ static gboolean battery_inserted(gchar* path)
battery* battery_update(battery *b)
{
gchar *gctmp;
+ int promille;
if (b == NULL)
return NULL;
@@ -253,16 +254,18 @@ battery* battery_update(battery *b)
}
#endif
- if (b->charge_full < MIN_CAPACITY)
- b->percentage = 0;
- else {
- int promille = (b->charge_now * 1000) / b->charge_full;
- b->percentage = (promille + 5) / 10; /* round properly */
- }
+ if (b->charge_now != -1 && b->charge_full != -1)
+ promille = (b->charge_now * 1000) / b->charge_full;
+ else if (b->energy_full != -1 && b->energy_now != -1)
+ /* no charge data, let try energy instead */
+ promille = (b->energy_now * 1000) / b->energy_full;
+ else
+ promille = 0;
+
+ b->percentage = (promille + 5) / 10; /* round properly */
if (b->percentage > 100)
b->percentage = 100;
-
if (b->current_now == -1) {
//b->poststr = "rate information unavailable";
b->seconds = -1;
--
2.11.0

View File

@ -6,7 +6,7 @@
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
lxpanel: lxpanel (NETWM/EWMH compliant lightweight x11 desktop panel)
lxpanel: LXpanel (NETWM/EWMH compliant lightweight x11 desktop panel)
lxpanel:
lxpanel: Based on fbpanel, lxpanel provides an application menu generated from
lxpanel: desktop files as well as a launchbar, taskbar and various plugins.