Giter Site home page Giter Site logo

lightum's Introduction

lightum - MacBook automatic light sensor daemon

© 2011-2012 Pau Oliva Fora - pof[at]eslack(.)org

Lightum is a daemon to control the keyboard brightness and screen backlight on MacBook based laptops.

By default it will run in "auto" mode, this means it will read data from the ambient light sensor (located on the iSight camera) and automatically:

  • light up or dim the keyboard brightness
  • light up or dim the the video backlight

It will also dim the keyboard brightness and screen backlight when the computer is not used for a configurable amount of seconds.

If you choose to run it in "manual" mode, it will not query the ambient light sensor, but instead it will use the brightness and backlight values you set manually using the function keys.

Configuration

When first launched lightum will create a configuration file inside the user's home directory with the default configuration values:

~/.config/lightum/lightum.conf

When launched without parameters, lightum will read the configuration from this config file, but the configuration values can be overwritten via the command line:

Usage:  lightum [OPTION]...
 -m 4..255 : maximum brightness value in auto mode (default=255)
 -n 0..3   : minimum brightness value in auto mode (default=0)
 -M 7..15  : maximum backlight value in auto mode (default=15)
 -N 1..6   : minimum backlight value in auto mode (default=1)
 -p num    : number of milliseconds between light sensor polls (default=300)
 -i num    : power off keyboard light on session idle seconds (0 to disable)
 -I num    : turn down screen backlight on session idle seconds (0 to disable)
 -w num    : 1 manage brightness, 2 manage backlight, 3 both (default:3)
 -x        : manual mode (will honor the brightness value set with Fn keys)
 -l        : fully dim the screen backlight when session is idle
 -u        : do not ignore brightness changes happening outside lightum
 -U        : ignore session information from ConsoleKit
 -s        : power off keyboard light when screen saver is active
 -f        : run in foreground (do not daemonize)
 -v        : verbose mode, useful for debugging with -f and -d
 -d num    : debug mode: 1 brightness, 2 backlight, 3 both

Ubuntu packages

Official Ubuntu packages are available in poliva/lightum-mba ppa:

 sudo add-apt-repository ppa:poliva/lightum-mba
 sudo apt-get update
 sudo apt-get install lightum

Compiling from source

(Tested on Ubuntu 13.04)

  1. Install the build-essential package: sudo apt-get install build-essential
  2. Clone the repository by running git clone https://github.com/poliva/lightum and cd into the project's directory.
  3. Install the dependencies sudo apt-get install libxss-dev libdbus-glib-1-dev
  4. Run make
  5. Run sudo make install

Indicator applet

An indicator applet is also available to control lightum from your desktop panel.

Enjoy! :)

lightum's People

Contributors

bartmassey avatar bbonamin avatar esoleyman avatar fredrikwendt avatar gaul avatar kukunin avatar mksong76 avatar poliva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lightum's Issues

issues on gnome2 with metacity

MacBook Pro 2007 (ver 3,1)
o/s: CentOS 6.2, 64 bit
desktop manager: gnome2
window manager: metacity

i was able to successfully compile lightum from source (thanks pof).

when i run it in non-daemon, verbose mode, i get this in the console:


[sid@gamma ~]$ lightum -f -v
CONFIG:
manualmode: 0
ignoreuser: 1
workmode: 3
queryscreensaver: 0
maxbrightness: 255
minbrightness: 0
maxbacklight: 15
minbacklight: 1
polltime: 300
idleoff: 5
screenidle: 30

lightum v2.0.4 running in auto mode
Error org.freedesktop.DBus.Error.UnknownMethod: Method “GetPercentage” with signature “” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “GetPercentage” with signature “” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.UnknownMethod: Method “GetPercentage” with signature “” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

light_sensor: 42 idle_time: 0.020000 auto mode brightness: 3 backlight: 9
light_sensor: 44 idle_time: 0.411000 auto mode brightness: 2 backlight: 9 -> Ignoring user brightness change, wants to set maxbrightness to 0
Error org.freedesktop.DBus.Error.UnknownMethod: Method “GetPercentage” with signature “” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “GetPercentage” with signature “” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.UnknownMethod: Method “GetPercentage” with signature “” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

light_sensor: 67 idle_time: 1.147000 auto mode brightness: 1 backlight: 13 -> Ignoring user brightness change, wants to set maxbrightness to 0
Error org.freedesktop.DBus.Error.UnknownMethod: Method “GetPercentage” with signature “” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system
Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can’t manage screen backlight on this system

the result of calling dbus-send:


[sid@gamma ~]$ dbus-send –session –print-reply –dest=”org.gnome.SettingsDaemon” /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.SetPercentage uint32:100

Error org.freedesktop.DBus.Error.UnknownMethod: Method “SetPercentage” with signature “u” on interface “org.gnome.SettingsDaemon.Power.Screen” doesn’t exist

result of calling qbus:


[root@gamma sid]# qdbus org.gnome.SettingsDaemon /org/gnome/SettingsDaemon/Power
Could not connect to D-Bus server: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

further, on my 64-bit system, this folder doesn't exist:


/usr/lib/gnome-settings-daemon/gsd-backlight-helper

i have instead this folder, with contents listed:


[root@gamma sid]# /usr/lib/gnome-settings-daemon/gsd-backlight-helper--get-max-brightness
bash: /usr/lib/gnome-settings-daemon/gsd-backlight-helper: No such file or directory
[root@gamma sid]# /usr/lib
lib/     lib64/   libexec/ 
[root@gamma sid]# ls -l /usr/lib64/gnome-settings-daemon-2.0/
total 676
-rw-r--r--. 1 root root   6906 Nov 11  2010 a11y-keyboard.gnome-settings-plugin
-rw-r--r--. 1 root root   4479 Nov 11  2010 background.gnome-settings-plugin
-rw-r--r--. 1 root root   4991 Nov 11  2010 clipboard.gnome-settings-plugin
-rw-r--r--. 1 root root   4521 Nov 11  2010 font.gnome-settings-plugin
-rw-r--r--. 1 root root    264 Nov 11  2010 housekeeping.gnome-settings-plugin
-rw-r--r--. 1 root root   5235 Nov 11  2010 keybindings.gnome-settings-plugin
-rw-r--r--. 1 root root   4969 Nov 11  2010 keyboard.gnome-settings-plugin
-rwxr-xr-x. 1 root root  40872 Nov 11  2010 liba11y-keyboard.so
-rwxr-xr-x. 1 root root  17232 Nov 11  2010 libbackground.so
-rwxr-xr-x. 1 root root  24160 Nov 11  2010 libclipboard.so
-rwxr-xr-x. 1 root root  19952 Nov 11  2010 libfont.so
-rwxr-xr-x. 1 root root  49832 Nov 11  2010 libhousekeeping.so
-rwxr-xr-x. 1 root root  32592 Nov 11  2010 libkeybindings.so
-rwxr-xr-x. 1 root root  37096 Nov 11  2010 libkeyboard.so
-rwxr-xr-x. 1 root root 133848 Nov 11  2010 libmedia-keys.so
-rwxr-xr-x. 1 root root  26184 Nov 11  2010 libmouse.so
-rwxr-xr-x. 1 root root  37520 Nov 11  2010 libsmartcard.so
-rwxr-xr-x. 1 root root  17072 Nov 11  2010 libsound.so
-rwxr-xr-x. 1 root root  13632 Nov 11  2010 libtyping-break.so
-rwxr-xr-x. 1 root root  41472 Nov 11  2010 libxrandr.so
-rwxr-xr-x. 1 root root  19808 Nov 11  2010 libxrdb.so
-rwxr-xr-x. 1 root root  41832 Nov 11  2010 libxsettings.so
-rw-r--r--. 1 root root   5329 Nov 11  2010 media-keys.gnome-settings-plugin
-rw-r--r--. 1 root root   4061 Nov 11  2010 mouse.gnome-settings-plugin
-rw-r--r--. 1 root root    162 Nov 11  2010 smartcard.gnome-settings-plugin
-rw-r--r--. 1 root root    760 Nov 11  2010 sound.gnome-settings-plugin
-rw-r--r--. 1 root root   6231 Nov 11  2010 typing-break.gnome-settings-plugin
-rw-r--r--. 1 root root   6043 Nov 11  2010 xrandr.gnome-settings-plugin
-rw-r--r--. 1 root root   6562 Nov 11  2010 xrdb.gnome-settings-plugin
-rw-r--r--. 1 root root   5158 Nov 11  2010 xsettings.gnome-settings-plugin

lightum crashed on startup

On a MacBook Air 2013, running ArchLinux-amd64.

$ uname -a
Linux athena.barrera.io 3.19.0-1-ARCH #1 SMP PREEMPT Mon Feb 9 07:08:20 CET 2015 x86_64 GNU/Linux

kbdlight and xbacklight work fine on this system, so it would seem that all the modules to handle keyboard backlighting and screen brightness are in place.

$ lightum -fw 2        
lightum v2.3.1 running in auto mode 
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can't manage screen backlight on this system.
Please disable backlight with config option 'workmode='1' or command line switch '-w 1'.
If you believe this is an error, open a bug report: https://github.com/poliva/lightum/issues

With more debugging:

$ lightum -fvd 2 -w 2
CONFIG:
        manualmode: 0
        ignoreuser: 1
        ignoresession: 0
        workmode: 2
        queryscreensaver: 0
        maxbrightness: 255
        minbrightness: 0
        maxbacklight: 15
        minbacklight: 1
        polltime: 300
        idleoff: 5
        screenidle: 30
        fulldim: 0

lightum v2.3.1 running in auto mode 
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can't manage screen backlight on this system.
Please disable backlight with config option 'workmode='1' or command line switch '-w 1'.
If you believe this is an error, open a bug report: https://github.com/poliva/lightum/issues

$ lightum -fw 1        
lightum v2.3.1 running in auto mode 

** (lightum:4416): WARNING **: GetCurrentSession failed: The name org.freedesktop.ConsoleKit was not provided by any .service files
[1]    4416 segmentation fault (core dumped)  lightum -fw 1

With more debugging:

$ lightum -fvd 1 -w 1
CONFIG:
        manualmode: 0
        ignoreuser: 1
        ignoresession: 0
        workmode: 1
        queryscreensaver: 0
        maxbrightness: 255
        minbrightness: 0
        maxbacklight: 15
        minbacklight: 1
        polltime: 300
        idleoff: 5
        screenidle: 30
        fulldim: 0

lightum v2.3.1 running in auto mode 

** (lightum:4809): WARNING **: GetCurrentSession failed: The name org.freedesktop.ConsoleKit was not provided by any .service files
[1]    4809 segmentation fault (core dumped)  lightum -fvd 1 -w 1

The latter seems to look for ConsoleKit, but, AFAIK, it's been deprected since circa 2012.

lightum & lightum-indicator won't work on 14.04

Your program works wonderfully in Ubuntu 12.04 and unfortunately it won't work in 14.04. I also built a deb package from source and it seemed to build fine but I get the same issue when I install that package built on 14.04.

In the middle of the process I do get dbus-session.c:119:9: warning: ‘g_type_init’ is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:667) [-Wdeprecated-declarations]
g_type_init ();).

The indicator shows up in the tray but doesn't do anything so I launched this from terminal and I get:
ubuntu@ubuntu-MacBookAir:$ lightum-indicator
lightum v2.3.1 running in auto mode forked into background
ubuntu@ubuntu-MacBookAir:
$
** (lightum:17404): WARNING **: GetCurrentSession failed: Unable to lookup session information for process '17404'

(lightum:17404): GLib-CRITICAL **: g_variant_is_object_path: assertion 'string != NULL' failed

** (lightum:17404): CRITICAL **: dbus_g_proxy_new_for_name: assertion 'g_variant_is_object_path (path)' failed

** (lightum:17404): WARNING **: Could not get dbus session proxy

So then I did this just to see if I was issued further information I could give you:
ubuntu@ubuntu-MacBookAir:~$ dbus-launch lightum
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can't manage screen backlight on this system.
Please disable backlight with config option 'workmode='1' or command line switch '-w 1'.
If you believe this is an error, open a bug report: https://github.com/poliva/lightum/issues

Build output:
ubuntu@ubuntu-MacBookAir:~/Downloads/poliva-lightum-3866c70$ dpkg-buildpackage -B
dpkg-buildpackage: source package lightum
dpkg-buildpackage: source version 2.3.1-ubuntu1
dpkg-buildpackage: source distribution precise
dpkg-buildpackage: source changed by Pau Oliva Fora (pof) [email protected]
dpkg-buildpackage: host architecture amd64
dpkg-source --before-build poliva-lightum-3866c70
fakeroot debian/rules clean
dh clean
dh_testdir
dh_auto_clean
make[1]: Entering directory /home/ubuntu/Downloads/poliva-lightum-3866c70' rm -f lightum *.o make[1]: Leaving directory/home/ubuntu/Downloads/poliva-lightum-3866c70'
dh_clean
debian/rules build-arch
dh build-arch
dh_testdir -a
dh_auto_configure -a
dh_auto_build -a
make[1]: Entering directory /home/ubuntu/Downloads/poliva-lightum-3866c70' ccpkg-config --cflags dbus-1 --cflags dbus-glib-1-Wall -Wextra -Wwrite-strings -g -O2 -c -o functions.o functions.c ccpkg-config --cflags dbus-1 --cflags dbus-glib-1-Wall -Wextra -Wwrite-strings -g -O2 -c -o dbus.o dbus.c ccpkg-config --cflags dbus-1 --cflags dbus-glib-1-Wall -Wextra -Wwrite-strings -g -O2 -c -o dbus-session.o dbus-session.c dbus-session.c: In function ‘get_dbus_connection’: dbus-session.c:119:9: warning: ‘g_type_init’ is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:667) [-Wdeprecated-declarations] g_type_init (); ^ ccpkg-config --cflags dbus-1 --cflags dbus-glib-1-Wall -Wextra -Wwrite-strings -g -O2 -c -o configfile.o configfile.c ccpkg-config --cflags dbus-1 --cflags dbus-glib-1-Wall -Wextra -Wwrite-strings -g -O2 -c -o lightum.o lightum.c ccpkg-config --cflags dbus-1 --cflags dbus-glib-1-Wall -Wextra -Wwrite-strings -g -O2 -c -o xbacklight.o xbacklight.c ccpkg-config --cflags dbus-1 --cflags dbus-glib-1-Wall -Wextra -Wwrite-strings -g -O2 functions.o dbus.o dbus-session.o configfile.o lightum.o xbacklight.opkg-config --libs dbus-1 --libs dbus-glib-1-g -O2 -lX11 -lXext -lXss -lm -o lightum make[1]: Leaving directory/home/ubuntu/Downloads/poliva-lightum-3866c70'
dh_auto_test -a
fakeroot debian/rules binary-arch
dh binary-arch
dh_testroot -a
dh_prep -a
dh_auto_install -a
make[1]: Entering directory /home/ubuntu/Downloads/poliva-lightum-3866c70' ccpkg-config --cflags dbus-1 --cflags dbus-glib-1-Wall -Wextra -Wwrite-strings -g -O2 functions.o dbus.o dbus-session.o configfile.o lightum.o xbacklight.opkg-config --libs dbus-1 --libs dbus-glib-1-g -O2 -lX11 -lXext -lXss -lm -o lightum mkdir -p /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/usr/bin /usr/bin/install -c lightum /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/usr/bin/lightum mkdir -p /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/etc/xdg/autostart/ /usr/bin/install -c -m 644 lightum.desktop /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/etc/xdg/autostart/ mkdir -p /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/usr/share/doc/lightum/ /usr/bin/install -c -m 644 ./README /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/usr/share/doc/lightum/ /usr/bin/install -c -m 644 ./LICENSE /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/usr/share/doc/lightum/ mkdir -p /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/usr/share/man/man1/ /usr/bin/install -c -m 644 ./lightum.1 /home/ubuntu/Downloads/poliva-lightum-3866c70/debian/lightum/usr/share/man/man1/ make[1]: Leaving directory/home/ubuntu/Downloads/poliva-lightum-3866c70'
dh_installdocs -a
dh_installchangelogs -a
dh_installman -a
dh_pysupport -a
dh_pysupport: This program is deprecated, you should use dh_python2 instead. Migration guide: http://deb.li/dhs2p
dh_perl -a
dh_link -a
dh_compress -a
dh_fixperms -a
dh_strip -a
dh_makeshlibs -a
dh_shlibdeps -a
dh_installdeb -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
dpkg-deb: building package lightum' in../lightum_2.3.1-ubuntu1_amd64.deb'.
dpkg-genchanges -B >../lightum_2.3.1-ubuntu1_amd64.changes
dpkg-genchanges: arch-specific upload - not including arch-independent packages
dpkg-genchanges: binary-only upload - not including any source code
dpkg-source --after-build poliva-lightum-3866c70
dpkg-buildpackage: binary only upload (no source included)

GLib-CRITICAL **: the GVariant format string '(u)' has a type of '(u)' but the given value has a type of '(s)'

i get the following error

light_sensor: 6 light_avg: 6 idle_time: 0.002000 auto mode brightness: 16/200 backlight: 6/15 
current backlight: 0
-> set screen backlight: 0 -> 6

(lightum:10777): GLib-CRITICAL **: the GVariant format string '(u)' has a type of '(u)' but the given value has a type of '(s)'

(lightum:10777): GLib-CRITICAL **: g_variant_get: assertion 'valid_format_string (format_string, TRUE, value)' failed

i'm running linux mint 18 with cinnamon

don't work in dark rooms

I use a MBA 5.1 and have a problem in dark rooms.
If there is to less light in the room, lightum don't work correct. It seems, that the sensor detects the screen light, that reflects by the user who sit before the Mac. So the sensor detects a bright room and rise the screen light. In the next step, the sensor detects more light and rise the light again. In the result I get a very bright display.
A second problem occur, if there is only a little light in the room. In this case the brightness switch continually between two steps.

Do you see a change to fix this?

Claus

Keyboard and mouse are laggy when external displays are connected

I've installed lightum a few days ago from the latest develop commit. It worked fine until I connected external monitors. Mouse freezes shortly every half a second or so. Same with keyboard when typing. When I kill the lightum process it's back to normal again. When I disconnect external monitors it's back to normal again.

I'm using Ubuntu 14.04 LTS with default configuration on MBP11.1.

Screen dims while watching videos

If I have a video open in Chrome it doesn't seem to detect that and prevent the screen from dimming. It's annoying having to move the mouse every so often while I'm trying to watch a video. Surely there's a way to fix this?

lightum doesn't start on Fedora 17

It looks like some restrictions in the system, but I'm not a guru in dbus subsystem, may be you could help?

./lightum -f
lightum v2.3.1 running in auto mode

** (lightum:2249): WARNING **: GetCurrentSession failed: Unable to lookup session information for process '2249'

(lightum:2249): GLib-CRITICAL **: g_variant_is_object_path: assertion `string != NULL' failed

** (lightum:2249): CRITICAL **: dbus_g_proxy_new_for_name: assertion `g_variant_is_object_path (path)' failed

** (lightum:2249): WARNING **: Could not get dbus session proxy

gio/gio.h fatal error

running make, I'm getting:

lightum:h:2:21: fatal_error: gio/gio.h: No such file or directory

however, /usr/include/glib-2.0/gio/gio.h is there

Doesn't work in Ubuntu 18.04 LTS

It doesn't work on Ubuntu 18.04 LTS. When I compile, I get the following error:

cc pkg-config --cflags dbus-1 --cflags glib-2.0 --cflags gio-2.0 --cflags libsystemd-login -Wall -Wextra -Wwrite-strings -g -O2 -c -o functions.o functions.c
Package libsystemd-login was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsystemd-login.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsystemd-login' found
In file included from functions.c:23:0:
lightum.h:2:10: fatal error: gio/gio.h: No such file or directory
#include <gio/gio.h>
^~~~~~~~~~~
compilation terminated.
: recipe for target 'functions.o' failed
make: *** [functions.o] Error 1

"Can't manage screen backlight on this system"

ENVIRONMENT:

MacBook Air 5,2

Lubuntu 12.04.1

    tim@fern:~$ uname -a
    Linux fern 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Current config supports manual dimming control of screen via fn-F1 and fn-F2, but for some reason I have no similar control of the keyboard lighting (fn-F5 and fn-F6).

ISSUE:

lightum will not start with out -w 1 flag:

tim@fern:~$ lightum -fv
  CONFIG:
    manualmode: 0
    ignoreuser: 1
    ignoresession: 0
    workmode: 3
    queryscreensaver: 0
    maxbrightness: 255
    minbrightness: 0
    maxbacklight: 15
    minbacklight: 1
    polltime: 300
    idleoff: 5
    screenidle: 30
    fulldim: 0

lightum v2.3.1 running in auto mode

Error org.freedesktop.DBus.Error.UnknownMethod: No such interface `org.gnome.SettingsDaemon.Power.Screen' on object at path /org/gnome/SettingsDaemon/Power
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files

Can't manage screen backlight on this system.
Please disable backlight with config option 'workmode='1' or command line switch '-w 1'.
If you believe this is an error, open a bug report: https://github.com/poliva/lightum/issues

The error output suggests to me that the SettingsDaemon is in the wrong place, but I am completely new to dbus. Not sure if this is a real issue but I have no /org filesystem:

tim@fern:~$ ls / | grep -E '^o.*'
    opt

tim@fern:~$ sudo find / -name *SettingsDaemon*
    /etc/dbus-1/system.d/org.gnome.SettingsDaemon.DateTimeMechanism.conf
    /usr/share/dbus-1/system-services/org.gnome.SettingsDaemon.DateTimeMechanism.service
    /usr/share/dbus-1/services/org.gnome.SettingsDaemon.service

Though some version of gnome-settings and policykit are running:

tim@fern:~$ ps ax | grep -iE 'policy|settings'
  818 ?        Sl     0:00 /usr/lib/policykit-1/polkitd --no-debug
 1707 ?        Sl     0:00 /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
 1726 ?        Sl     0:00 /usr/lib/gnome-settings-daemon/gnome-settings-daemon
 2791 pts/3    S+     0:00 grep --color=auto -E policy|settings

I'm sorry if this is not a lightum bug and turns out to be just a local config issue, but I'm running a stock lubuntu install with hardly any tweaks so far.

thanks for your time!

tim camper

Not working in Trusty?

I see the ppa hasn't been updated yet, but I'm trying to compile from source and run this in Ubuntu 14.04 and even after installing xbacklight I'm seeing this issue on a MacBookAir4,2:

./lightum
 Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files

** (lightum:30357): WARNING **: GetCurrentSession failed: The name org.freedesktop.ConsoleKit was not provided by any .service files

(lightum:30357): GLib-CRITICAL **: g_variant_is_object_path: assertion 'string != NULL' failed

** (lightum:30357): CRITICAL **: dbus_g_proxy_new_for_name: assertion 'g_variant_is_object_path (path)' failed

** (lightum:30357): WARNING **: Could not get dbus session proxy

Backlight cycles between values

Thanks for providing this - its nice to have these features. Just built 2.3.1 and was happy to see lightum can now manage the backlight too.

However, on my MacBook Air (5,2) when run in auto mode it just cycles the backlight between values, resetting it at each poll interval, thus the screen cycles bright - dim - bright. Almost working! Keyboard brightness work fine.

Any suggestions on how I might fix this? I'd live to have the backlight auto adjust.

 ~ ⮁ lightum ⮀ master ⮀ $ ⮀./lightum -f -v -w 2 -d 2 -i 3
CONFIG:
        manualmode: 0
        ignoreuser: 1
        ignoresession: 0
        workmode: 2
        queryscreensaver: 0
        maxbrightness: 255
        minbrightness: 0
        maxbacklight: 15
        minbacklight: 1
        polltime: 300
        idleoff: 3
        screenidle: 30
        fulldim: 0

lightum v2.3.1 running in auto mode 
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
light_sensor: 7 light_avg: 7 idle_time: 0.072000 auto mode backlight: 6/15 
current backlight: 15
-> set screen backlight: -1 -> 6

light_sensor: 7 light_avg: 7 idle_time: 0.620000 auto mode backlight: 6/15 
current backlight: 15
-> set screen backlight: 15 -> 6

light_sensor: 7 light_avg: 7 idle_time: 1.261000 auto mode backlight: 6/15 
current backlight: 15
-> set screen backlight: 15 -> 6

Don't work in Kubuntu 15.04

Hello. Don't work in Kubuntu 15.04, kernel 3.19.0, plasma 5.3.2, MacBook Air 2014.
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.UnknownMethod: No such method 'setBrightness' in interface 'org.kde.Solid.PowerManagement' at object path '/org/kde/Solid/PowerManagement' (signature 'i')
Can't manage screen backlight on this system.
Please disable backlight with config option 'workmode='1' or command line switch '-w 1'.

lightum doesn't work (yet) with latest MBA

On the latest MBA - the file/device for the sensor appears to have changed. When I start lightum I receive:

[ke4qqq@mba poliva-lightum-8326d25]$ ./lightum
lightum v2.3.1 running in auto mode forked into background
/sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness: No such file or directory
Can't open /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness

I don't see anything obvious in /sys/ that appears to be the sensor for keyboard brightness.

Happy to help debug, feel free to let me know how I can help.

--David

lightum stops working after suspend

I'm running lightum 1.5 on Ubuntu precise on a MBA 4,2 with default settings. After resume, the keyboard lights up, and the lights don't go off. Starting a new instance of lightum works.

Thanks for this useful program!

Brightness change triggers KDE's brightness OSD

Whenever the brightness changes ever so slightly, KDE's brightness OSD pops up (the one that shows up when you change brightness using keyboard).

On my retina MacBook Pro, the brightness changes in some situations every minute or so (bounces back-and-forth between two brightness values). This makes the whole thing really annoying.

New release?

Hi Pau,

Would you mind releasing a new version of lightum so that the consolekit dependency can be removed from various distributions? Currently, the lightum PPA installs consolekit and crashes for the first time.

Please let me know if you need any help.

Keyboard backlighting not changes consistently

Running the latest from git the keyboard backlighting behaviour is inconsistent. Either with plenty of light or in complete darkness (eg: covering the webcam with my finger) the keyboard backlight is turned off.

I noticed (before #44), that sometimes the backlight it turned back on, but have had issues reproducing it: it seemed to be rather random.

I've been running lightum -fvd 1 -w 1 -s -i 5.

I've tried the code from #44, as suggested on #45, but this did not affect the issue at all.

Covering the webcam:

$ lightum -fvd 1 -w 1 -s -i 5
CONFIG:
        manualmode: 0
        ignoreuser: 1
        ignoresession: 0
        workmode: 1
        queryscreensaver: 1
        maxbrightness: 255
        minbrightness: 0
        maxbacklight: 15
        minbacklight: 1
        polltime: 300
        idleoff: 5
        screenidle: 30
        fulldim: 0

lightum v2.3.1 running in auto mode 
light_sensor: 0 light_avg: 0 idle_time: 0.014000 auto mode screensaver: 23446000 brightness: 0/255 
current brightness: 0
-> set keyboard brightness: -1 -> 0

light_sensor: 0 light_avg: 0 idle_time: 0.236000 auto mode screensaver: 23478880 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 0.538000 auto mode screensaver: 23479552 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 0.840000 auto mode screensaver: 23446192 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 1.143000 auto mode screensaver: 23479632 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 1.446000 auto mode screensaver: 23481344 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 1.748000 auto mode screensaver: 23479024 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 2.050000 auto mode screensaver: 23479632 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 2.352000 auto mode screensaver: 23478656 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 0.150000 auto mode screensaver: 23446192 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 0.452000 auto mode screensaver: 23479632 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 0.755000 auto mode screensaver: 23483824 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 1.058000 auto mode screensaver: 23484272 brightness: 0/255 
light_sensor: 0 light_avg: 0 idle_time: 1.361000 auto mode screensaver: 23446192 brightness: 0/255 

In a very well lit environment:

$ lightum -fvd 1 -w 1 -s -i 5
CONFIG:
        manualmode: 0
        ignoreuser: 1
        ignoresession: 0
        workmode: 1
        queryscreensaver: 1
        maxbrightness: 255
        minbrightness: 0
        maxbacklight: 15
        minbacklight: 1
        polltime: 300
        idleoff: 5
        screenidle: 30
        fulldim: 0

lightum v2.3.1 running in auto mode 
light_sensor: 2 light_avg: 2 idle_time: 0.012000 auto mode screensaver: 19762448 brightness: 0/255 
current brightness: 0
-> set keyboard brightness: -1 -> 0

light_sensor: 2 light_avg: 2 idle_time: 0.252000 auto mode screensaver: 19843072 brightness: 0/255 
light_sensor: 2 light_avg: 2 idle_time: 0.555000 auto mode screensaver: 19837968 brightness: 0/255 
light_sensor: 2 light_avg: 2 idle_time: 0.005000 auto mode screensaver: 19838160 brightness: 0/255 
light_sensor: 2 light_avg: 2 idle_time: 0.282000 auto mode screensaver: 19838240 brightness: 0/255 
light_sensor: 2 light_avg: 2 idle_time: 0.006000 auto mode screensaver: 19838432 brightness: 0/255 
light_sensor: 2 light_avg: 2 idle_time: 0.009000 auto mode screensaver: 19835040 brightness: 0/255 
light_sensor: 2 light_avg: 2 idle_time: 0.007000 auto mode screensaver: 19842928 brightness: 0/255 
light_sensor: 2 light_avg: 2 idle_time: 0.002000 auto mode screensaver: 19842784 brightness: 0/255 
$ uname -a
Linux athena.barrera.io 3.19.0-1-ARCH #1 SMP PREEMPT Mon Feb 9 07:08:20 CET 2015 x86_64 GNU/Linux

deb package created for Ubuntu 14.04

I took the latest source of this posting and created a debian package that runs perfectly with 14.04 Trusty Tahr on my MBA 5,2 (2013).

https://dl.dropboxusercontent.com/u/48359498/lightum_2.3.1-ubuntu1_amd64.deb

I just have the lightum-indicator installed from https://launchpad.net/~poliva/+archive/ubuntu/lightum-mba

and it works fantastically.

Not sure how this works, but feel free to post my package elsewhere, including adding it to the repo for Trusty Tahr.

hi, initial screen is black, can increase brightness if done imediately , or stuck on black screen.

hi, initial screen is black, can increase brightness if done immediately
with f1 f2 , or stuck on black screen. fn + f5 f6 has no effect.
Automatic brightness pulses like its having a fight between system control and lightum :)

Ubuntu 16.04 macbook retina 15" with Nvidia.

Whats the best way to unistall without breaking my backlight ?

where is /bin/lightum started from and what did it replace?

thanks,

Ben

Ubuntu 16.04

The ppa doesn't seem to have Xenial packages, and I cannot compile the cloned git because of gio.h missing, any ideas?

Default value for minbacklight

Hi,
First of all thanks for this, i'm very happy that this daemon exists, it is so cool to run Linux in my Macbook Air and have all the hardware properly functioning

I'm packaging lightum for ARCH AUR repo[1]

Last package i've submited was lightum-1.5.

Now I'm in the process to build & submit 2.3, but when i made the upgrade on my own laptop, the first thing I've noticed is that my backlight turns to much dim.

If i run lightum in debug mode, I can see that light_sensor reports a 0 value (which is correct because is a cloudy day and late afternoon), but still, the backlight value is to much dim, it is anoying to me to read the screen. My first instinct was to raise backlight brightness with function keys, but that's do not work.

I know what was causing such changes, and which options set to fix it, because I've manually compiled and installed lightum, but any of the users that will upgrade their ARCH systems with "yaourt -Syua" will not notice the change untill reboot or logout ther session, and that in a laptop can happen weeks later (most peopple just use suspend).
And when they notice the changes, it will take them a lot of pain to find out that they must change values in .config/lightum/lightum.conf, maybe a file which they never touch.

So, my point is, users will upgrade their distro, and then they will find that the screen backlight is so dark, and they will think that this is a bug, because the function keys... and they even will not know that it is not a bug, and that can be easly fixed in lightum.conf.

I suggest to set a bigger minbacklight as default, I've set minbacklight =6 and things get better, but even with this value, i would prefer a higher value when light_sensor reports 0, especially when laptop is pluged-in. To not block function keys by default can be another good choice i guess.

All this in my very modest opinion, what do you think?

Regards
[1] https://aur.archlinux.org/packages.php?ID=58323

Doesn't work with MATE

I'm using Arch Linux with MATE desktop environment (Gnome 2 fork). When I launch lightum, it writes this out:

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SettingsDaemon was not provided by any .service files
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.Solid.PowerManagement was not provided by any .service files
Can't manage screen backlight on this system.
Please disable backlight with config option 'workmode='1' or command line switch '-w 1'.
If you believe this is an error, open a bug report: https://github.com/poliva/lightum/issues

Missing dependency

Package libsystemd-login-dev is needed to build but not listed in the readme.md

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.