Xfce Forum

Sub domains
 

You are not logged in.

#1 2011-09-01 16:51:33

Marq
Member
Registered: 2011-09-01
Posts: 4

show message with display brightness

Hello,
to change the brightness of my display with shortcuts works. But there is no message that shows
how bright the display is. I´ve installed xfce4-notifyd and the actual volume is showed if I change
the sound level. So I wrote a small program to detect how bright the display is and to show this
in a xfce4-notifyd message when I execute the shortcut.
Thats the programm

#!/bin/bash

#look if the skricp is already running
if [ -f /usr/local/bin/sperren ] ; then
   # the lock file already exists, so what to do?
   if [ "$(ps -p `cat /usr/local/bin/sperren` | wc -l)" -gt 1 ]; then
     # process is still running
     echo "$0: quit at start: lingering process `cat /usr/local/bin/sperren.lock`"
     exit 0
   else
     # process not running, but lock file not deleted?
     echo " $0: orphan lock file warning. Lock file deleted."
     rm /usr/local/bin/sperren
   fi
fi

#create lockfile
lockfile-create /usr/local/bin/sperren

#get brightness and display brightness with xfce4-notifyd
FILE=/sys/class/backlight/acpi_video0/brightness
VAR=`head -n 1 $FILE`
let HELLIGKEIT=VAR*100/15
notify-send "the brightness is" $HELLIGKEIT"%" -t 2000

sleep 0.5

#remove lockfile
lockfile-remove /usr/local/bin/sperren

The problem is, that this program is executed twice if I press the shortcut a bit to long.
So I added the part with the lockfile that made it impossible for XFCE to run the programm
parallel. But XFCE remembers that the shortcut was executed twice and the popup from
xfce4-notifyd is no longer shown parallel but in series. XFCE
produces a .lk-file in the directory where the Program is when I press the shortcut a bit
to long and I think this file is liable that the popup is shown twice although I´ve created a
lockfile.
Do you have an idea how I can prevent XFCE creating this file or how I could manage to
get displaid the display brightness without this program.

Thanks

Offline

#2 2011-09-01 17:43:37

angstrom
Member
Registered: 2011-08-13
Posts: 267

Re: show message with display brightness

A workaround : install the old xfce4 power manager, version 0.8.*
This version display the brigthness of your screen when changing it. It also have some feature like auto reduce brightness after an amount of time ...


Xfce is NOT Xubuntu. Bugs in Xubuntu don't mean that Xfce is buggy ...

Offline

#3 2011-09-01 19:11:35

Marq
Member
Registered: 2011-09-01
Posts: 4

Re: show message with display brightness

Thank you for your hint. I´ve installed xfce4-power-manager-0.8.4.2-1 but when I try to start it an error occurs
"xfce4-power-manager: error while loading shared libraries: libnotify.so.1: cannot open shared object file: No such file or directory"
I use Arch Linux and there is only libnotify.so.4 available. I´ve tried it with a link "ln -s /usr/lib/libnotify.so.4.0.0 /usr/lib/libnotify.so.1"
but then I get another error when I start the Power-Manager.
I also found this thread http://sourceforge.net/mailarchive/mess … d=27901637 and if I use the command showkey
I also get two outputs so I think that it´s however not duration I´m pressing the keys but another problem that I get two messages.

Offline

#4 2011-09-01 23:22:12

angstrom
Member
Registered: 2011-08-13
Posts: 267

Re: show message with display brightness

One of the reason I have less fond of Arch linux is it updating too fast ...
I saw that there is in AUR, a libnotify1-bin 0.5.0-1. May be try to install it and see ?


Xfce is NOT Xubuntu. Bugs in Xubuntu don't mean that Xfce is buggy ...

Offline

#5 2011-09-02 12:02:32

Marq
Member
Registered: 2011-09-01
Posts: 4

Re: show message with display brightness

With libnotify1-bin 0.5.0-1 the xfce4-power-manager-0.8.4.2-1 works, but there are no messages about the display the brightness.
XFCE4-notifyd is installed, do I have something else to install ? Or should I try notify-osd ?

Offline

#6 2011-09-02 12:17:11

angstrom
Member
Registered: 2011-08-13
Posts: 267

Re: show message with display brightness

On my netbook, I have OpenSuse 11.4 and :
libnotify1  0.6.0-2.1 (from repository)
xfce4-power-manager  0.8.5-1.0 (compiled manually)

And here is what I get when changing brightness :
zz10.png

I don't know about notify-osd.

May be try to get libnotify 0.6 from other distribution or by compiling it ?

About the "twice execution" problem : I don't know ... sorry


Xfce is NOT Xubuntu. Bugs in Xubuntu don't mean that Xfce is buggy ...

Offline

#7 2011-09-02 20:22:35

Marq
Member
Registered: 2011-09-01
Posts: 4

Re: show message with display brightness

ok, thats strange. I´ve also tried xfce4-power-manager  0.8.5-1.0 but without success. And I know the icon on your screenshot, because one or two days
the brightness icon showed up. But I can´t remember exactly when it disappeared, because at this time I had other problems^^.
I always thought this was from the gnome-power-manager.I had to uninstall most of the gnome-packages because pulse-audio didn´t work on my Laptop
(I couldn´t play sound on two programs together). Then I´ve tried notify-osd also without success. I don´t have much time this weekend and it´s
the first time that I work with Linux for more than a few days, so I don´t know if I get libnotify 0.6 working but I will try it.
And if it doesn´t work its not so bad it would be nice, but I can live without it too.
Anyway, thanks for your help angstrom.

Offline

#8 2011-09-02 22:43:22

angstrom
Member
Registered: 2011-08-13
Posts: 267

Re: show message with display brightness

I think that you don't have notification is because you have libnotify version 0.5 instead of 0.6 ...
But anyway, I just tested xfce4-power-manager 0.8.5-10 on my Desktop pc which have Arch : it don't work because it depends on hal. As hal is deprecated so you have to install by AUR and bla bla bla ...
Sounds like my workaround is a bit messy (and not even sure that will work ...) on Arch linux :-(

Last edited by angstrom (2011-09-02 22:43:49)


Xfce is NOT Xubuntu. Bugs in Xubuntu don't mean that Xfce is buggy ...

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 547.49 KiB (Peak: 548.34 KiB) ]