You are not logged in.

#1 2011-12-15 10:13:17

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Dimdaemon - A simple backlight-dimming daemon for laptops

I wrote a simple and lightweight daemon that dims the backlight of our laptop and, in case, completely turn off it, after a given amount of time.
I don't have time to put the project on a service like sourceforge, github, etc...so I opened this thread.
If you have questions, doubts or if you simply want to report a bug or a feature request, please write here.
You can find the PKGBUILD on AUR here https://aur.archlinux.org/packages.php?ID=54009

So here is a summary of the configuration values :

  • environnement

    • userhome : well, the path to your home (only used to connect to eat your magic cookies connect to X)

    • displayname : choose in

      /sys/class/backlight/
    • powersupplyname : choose a battery in

      /sys/class/power_supply/
    • relative :  set to true if you want that dimdaemon dinamically dims your screen brightness; obviously undimpercent will not be used.

  • ac or battery

    • active : whether the dimdeamon will change the backlight when the computer is in this mode

    • undimpercent : brightness when user is active

    • dimtime : time before the screen gets dimmed if the comp is idle (0 will not disable this)

    • dimpercent : brightness when idle

    • turnofftime : time before turning the screen off.
      0 will not disable, set big value instead. If it is less than dimtime, will act as if it is equal to it.

Regards

Last edited by punkeroso (2012-09-18 07:57:42)

Offline

#2 2012-03-20 02:34:07

sapristi
Member
Registered: 2012-03-20
Posts: 10

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

So here is a summary of the configuration values :

  • environnement

    • userhome : well, the path to your home (only used to connect to eat your magic cookies connect to X)

    • displayname : choose in

      /sys/class/backlight/
    • powersupplyname : choose a battery in

      /sys/class/power_supply/
  • ac or battery

    • active : whether the dimdeamon will change the backlight when the computer is in this mode

    • undimpercent : brightness when user is active

    • dimtime : time before the screen gets dimmed if the comp is idle (0 will not disable this)

    • dimpercent : brightness when idle

    • turnofftime : time before turning the screen off.
      0 will not disable, set big value instead. If it is less than dimtime, will act as if it is equal to it.

This is for 0.2-1, I guess some stuff could change in later versions.

Edit : it seems like it generates many messages like this one :

ACPI Error: [\_SB_.VDRV] Namespace lookup failure, AE_NOT_FOUND (20110623/psargs-359)

and this one :

ACPI Error: Method parse/execution failed [\_SB_.PCI0.LPC0.H_EC._Q52] (Node ffff88003cdb1fc8), AE_NOT_FOUND (20110623/psparse-536)

in dmesg

Last edited by sapristi (2012-03-20 02:57:22)

Offline

#3 2012-03-20 08:01:57

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Many thanks for the summary, I appreciate it a lot!!

sapristi wrote:

Edit : it seems like it generates many messages like this one :

ACPI Error: [\_SB_.VDRV] Namespace lookup failure, AE_NOT_FOUND (20110623/psargs-359)

and this one :

ACPI Error: Method parse/execution failed [\_SB_.PCI0.LPC0.H_EC._Q52] (Node ffff88003cdb1fc8), AE_NOT_FOUND (20110623/psparse-536)

in dmesg

Searching with google, I found that this error should be related to some unmanaged acpi event. Is your bios up to date? Moreover, this should not be related to dimdaemon and you can just ignore it!

Offline

#4 2012-04-03 15:10:44

sapristi
Member
Registered: 2012-03-20
Posts: 10

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Glad you like it smile

Thanks for the information, this was happening when i was unplugging my power cable to test the daemon, but this is indeed not related with dimdeamon...

Offline

#5 2012-04-05 15:36:11

sapristi
Member
Registered: 2012-03-20
Posts: 10

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

It's strange, I reinstalled dimdeamon, and now it won't compile, seems like the #include <unistd.h> part is missing. Did you modify the code recently ?

Offline

#6 2012-04-10 10:45:12

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

sapristi wrote:

It's strange, I reinstalled dimdeamon, and now it won't compile, seems like the #include <unistd.h> part is missing. Did you modify the code recently ?

Fixed. This was caused by a change in GCC.

Offline

#7 2012-05-14 10:54:04

bennylb0
Member
From: Melbourne, Australia
Registered: 2010-05-21
Posts: 66

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Hi there,

After reading post 2 about configuration values I'm still a bit confused as to where a configration file is to set the these values. Can someone point me in right direction.

And after configuring I'm assuming it's just a matter of including this in the daemon array in rc.conf.

Thanks,

Offline

#8 2012-05-14 11:18:07

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

bennylb0 wrote:

Hi there,

After reading post 2 about configuration values I'm still a bit confused as to where a configration file is to set the these values. Can someone point me in right direction.

And after configuring I'm assuming it's just a matter of including this in the daemon array in rc.conf.

Thanks,

Hi,
the configuration file is /etc/conf.d/dimdaemon.conf.
After configuring you have just to start the daemon; if you want it to start at boot, just add it to the daemon array in rc.conf.

Offline

#9 2012-05-14 12:10:02

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Moved from AUR Issues, Discussion & PKGBUILD Requests to Community Contributions.


To know or not to know ...
... the questions remain forever.

Offline

#10 2012-05-14 12:41:15

bennylb0
Member
From: Melbourne, Australia
Registered: 2010-05-21
Posts: 66

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Thanks punkeroso I ended up viewing dimdaemon.install and found that you had already included a message that answered my question.

It's up and running and works beautifully.

Thanks for the daemon.

Offline

#11 2012-05-18 10:28:59

bennylb0
Member
From: Melbourne, Australia
Registered: 2010-05-21
Posts: 66

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Hi punkeroso,

dimdaemon stopped working on machine and I'm getting the following error in my logs:-

May 17 22:16:36 localhost kernel: [ 3872.308039] dimdaemon[579]: segfault at e0 ip 0000000000401c01 sp 00007fffcf4ddfd0 error 4 in dimdaemon[400000+4000]

Any ideas what it might be?

Thanks,

Offline

#12 2012-05-23 10:02:19

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

bennylb0 wrote:

Hi punkeroso,

dimdaemon stopped working on machine and I'm getting the following error in my logs:-

May 17 22:16:36 localhost kernel: [ 3872.308039] dimdaemon[579]: segfault at e0 ip 0000000000401c01 sp 00007fffcf4ddfd0 error 4 in dimdaemon[400000+4000]

Any ideas what it might be?

Thanks,

Are you still having this issue? I've updated the PKGBUILD with the last realease. Try it out and report here please.

Offline

#13 2012-05-23 11:27:42

bennylb0
Member
From: Melbourne, Australia
Registered: 2010-05-21
Posts: 66

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Not sure what it is. The problems seems to be intermitant. One thing I did notice is that I have 2 power supplies in /sys/class/power_supply AC and BAT0.

It somtimes runs with powersupplyname = "AC" and sometimes with powersupplyname = "BAT0"

Last edited by bennylb0 (2012-05-23 11:33:18)

Offline

#14 2012-05-23 11:43:51

bennylb0
Member
From: Melbourne, Australia
Registered: 2010-05-21
Posts: 66

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

I noticed that are very similar errors with gnome-mplayer and xcompmgr so it may not be specific to dimdaemond. I've installed the new version anyway. I'll keep track and report back later.

Offline

#15 2012-05-25 13:42:21

bennylb0
Member
From: Melbourne, Australia
Registered: 2010-05-21
Posts: 66

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

I'm still getting a segfault error but like I said there other programs with similar errors. It doesn't really seem to be a problem though the daemon is working fine.

If you need any further help testing just let me know.

Thanks,

Offline

#16 2012-08-20 17:52:27

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

New version is out with added systemd compatibility.
You can enable dimdaemon to start at boot by issuing:

# systemctl enable dimdaemon.service

Offline

#17 2012-09-14 16:14:03

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Hi!
I found your project quite interesting! Well, how did you managed to stop it while e.g. watching a movie? It is the first daemon that does such a thing!
Btw I'm using calise (from aur) to adjust my screen brightness, so i'd like, for example, that "undimpercent" could be commented, so it won't affect the screen brightness calise set previously. I tried to comment it, but it seems it will set screen brightness at 100% anyway (as default option).
I'm really interested in "dimtime" and "turnofftime" option, because i'm using xfce4 without power manager, so i lack of those features.
So, what i'd like to see implemented (i'm only asking, obviously), it's :
- If "undimpercent" is not set, leave screen brightness as it is.
- "dimpercent" could be the percentage of the previous brightness (and not an absolute value, eg: if my calise, or "undimpercent" set screen brig, to 5, and "dimpercent" is set to 20, it should not set the screen brightness to 2, but to 1).
Tell me if i'm asking anything wrong, or if i misunderstood anything please.
By the way, thanks for this software smile

Offline

#18 2012-09-15 15:35:42

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

nierro wrote:

Hi!
I found your project quite interesting! Well, how did you managed to stop it while e.g. watching a movie? It is the first daemon that does such a thing!

Hi, the daemon "stops" because uses Xlib to know the idle time. A lot of media players (e.g. mplayer) send a "fake" mouse/keyboard event every n seconds, so the idle time resets.

nierro wrote:

Btw I'm using calise (from aur) to adjust my screen brightness, so i'd like, for example, that "undimpercent" could be commented, so it won't affect the screen brightness calise set previously. I tried to comment it, but it seems it will set screen brightness at 100% anyway (as default option).
I'm really interested in "dimtime" and "turnofftime" option, because i'm using xfce4 without power manager, so i lack of those features.
So, what i'd like to see implemented (i'm only asking, obviously), it's :
- If "undimpercent" is not set, leave screen brightness as it is.
- "dimpercent" could be the percentage of the previous brightness (and not an absolute value, eg: if my calise, or "undimpercent" set screen brig, to 5, and "dimpercent" is set to 20, it should not set the screen brightness to 2, but to 1).
Tell me if i'm asking anything wrong, or if i misunderstood anything please.
By the way, thanks for this software smile

I could implement what you are suggesting but, what would be the behavior of the daemon when on battery? I mean, the daemon could read the actual brightness value but then, when switching to battery, what value should set? A percentage of the actual brightness?
No question is wrong a priori, we should just clarify some aspects; I'm glad that this piece of code could be useful to someone!

Offline

#19 2012-09-15 16:44:08

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

I could implement what you are suggesting but, what would be the behavior of the daemon when on battery? I mean, the daemon could read the actual brightness value but then, when switching to battery, what value should set? A percentage of the actual brightness?
No question is wrong a priori, we should just clarify some aspects; I'm glad that this piece of code could be useful to someone!

Well, thanks smile
May be we can have eg an option that disables the alteration of screen brightness when plug in or out ac cable, in this way the backlight would remain the same, whether we're on ac or not. Then the same suggestions as above would be valid.
Practically speaking, i'd like that it won't affect the default screen brightness (because i use another software to do this), but that it lowers it when my netbook is in idle, and eventually it switches off my screen. And the only difference for me, whether i'm on ac or on battery, would be the time before dim the screen, nothing else smile
Is this reachable?
Thanks for your work by the way!

Last edited by nierro (2012-09-15 16:45:00)

Offline

#20 2012-09-16 17:16:34

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

nierro wrote:

Well, thanks smile
May be we can have eg an option that disables the alteration of screen brightness when plug in or out ac cable, in this way the backlight would remain the same, whether we're on ac or not. Then the same suggestions as above would be valid.
Practically speaking, i'd like that it won't affect the default screen brightness (because i use another software to do this), but that it lowers it when my netbook is in idle, and eventually it switches off my screen. And the only difference for me, whether i'm on ac or on battery, would be the time before dim the screen, nothing else smile
Is this reachable?
Thanks for your work by the way!

I've done the changes! Tomorrow I'll try it on my notebook and possibly release it!

Offline

#21 2012-09-16 17:20:06

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Let me tell you... Really thanks! You're a hero!! smile i' ll try it as soon as you upgrade the aur package!!may be i finally found the best solution smile
Thanks!

Offline

#22 2012-09-17 08:52:11

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

nierro wrote:

Let me tell you... Really thanks! You're a hero!! smile i' ll try it as soon as you upgrade the aur package!!may be i finally found the best solution smile
Thanks!

New version is out!
Remember to set "relative" to true in the enviroment setting as described in the dimdaemon.conf.pacnew.
Let me know if it works as expected.

Offline

#23 2012-09-17 10:36:27

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Well, it works while on ac. It won't work while on battery.
Here is my conf file:

cat /etc/conf.d/dimdaemon
# idledd configuration file

# enter time in sec
# use bool for active
# set dim in percentage of maximum screenbrightness 
# The display name is in /sys/class/backlight/
# The power supply name is in /sys/class/power_supply/
# Set relative to true if you want that dimdaemon dinamically dims your screen brightness; only an AC values will be used (but undimpercet obviously).

# eviroment
enviroment:
{
userhome = "/home/federico";
displayname = "acpi_video0";
powersupplyname = "ADP1";
relative = true;
}
# on AC
ac:
{
active = true;
undimpercent = 100;
dimtime = 10;
dimpercent = 50;
turnofftime = 240;
};
# on Battery
battery:
{
active = true;
undimpercent = 30;
dimtime = 5;
dimpercent = 10;
turnofftime = 105;
};

While on battery, dimdaemon won't dim my screen. Never. Instead, while on ac, it works perfectly. Is there a reason?
By the way, thanks!

Offline

#24 2012-09-17 10:57:27

punkeroso
Member
From: Rome, Italy
Registered: 2007-01-19
Posts: 105

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

nierro wrote:

Well, it works while on ac. It won't work while on battery.

Mhmhm...strange, here it's working fine even if on battery.
Have you restarted the daemon after editing the config file?

Offline

#25 2012-09-17 10:59:20

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: Dimdaemon - A simple backlight-dimming daemon for laptops

Yes!
And every path is correct, ie: ADP1 and acpi_video0.

Last edited by nierro (2012-09-17 11:06:24)

Offline

Board footer

Powered by FluxBB