You are not logged in.

#1 2013-06-08 11:00:45

Minsc
Member
Registered: 2012-07-16
Posts: 78

[SOLVED] Xorg does not remember screen brightness (Intel laptop)

Edit: 2014 - this appears to be fixed with the latest xorg/systemd/kernel! smile

Hello,

When xorg blanks the screen after the given time, it does not remember the current screen brightness setting.

I have tried adjusting the brightness with the function keys and also via e.g.

xbacklight -60

, but after "waking up" the screen, it defaults to max brightness.

Is there a way to ensure it remembers the current brightness, or do I need to run a script to run xbacklight upon wake?

Any advice would be appreciated.

Cheers

Last edited by Minsc (2014-06-19 01:10:29)

Offline

#2 2013-06-09 00:41:49

oboenerd
Member
From: Right behind you.
Registered: 2012-08-15
Posts: 52

Re: [SOLVED] Xorg does not remember screen brightness (Intel laptop)

What is your desktop environment like?


"I quoted myself." -oboenerd

Offline

#3 2013-06-09 02:11:04

sultanoswing
Member
Registered: 2008-07-23
Posts: 278

Re: [SOLVED] Xorg does not remember screen brightness (Intel laptop)

I had the same problem on my intel i915 laptop (HP Folio 13). Solved it by installing xbacklight, then adding "xbacklight = 70" to startup programs using gnome-session-properties in a terminal.

YMMV - the same trick didn't work on my NVIDIA-equipped Dell m1330.


Arch 4.5.1 (x86_64) w/Gnome 3.20.1
ASUS P7P55-E-Pro, Geforce GT430, i5-750, 8GB, Samsung 830 SSD | Intel NUC 5i5RYK | ASUS ux303ua | HP Folio 13

Offline

#4 2013-06-09 02:23:50

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Xorg does not remember screen brightness (Intel laptop)

sultanoswing wrote:

I had the same problem on my intel i915 laptop (HP Folio 13). Solved it by installing xbacklight, then adding "xbacklight = 70" to startup programs using gnome-session-properties in a terminal.

YMMV - the same trick didn't work on my NVIDIA-equipped Dell m1330.

This seems like a dirty hack.  So if you are going to go the hackish route, I think it would be better to make a small script that gets the current brightness level and sotres it in a variable, then reinstates that value upon wake.  Then put it in /usr/lib/systemd/system-sleep.  You can look at the systemd-sleep man page to see how that directory works.

@OP, before you put your laptop to sleep, check to see what the values of /sys/class/backlight/*/brightness are, then see if they actually change when the machine wakes.  I am wondering if the brightness is actually restored to the max value as listed in /sys/class/backlight/*/max_brightness.

Offline

#5 2013-06-09 03:08:33

Minsc
Member
Registered: 2012-07-16
Posts: 78

Re: [SOLVED] Xorg does not remember screen brightness (Intel laptop)

Hiya guys,

This is an i915 Intel laptop, and my window manager is Openbox. No desktop environment...

@sultanoswing - tried this already via ~/.xinitrc, but maybe gnome handles stuff like this? I dunno..

@WonderWoofy - I thought of this, but it seems that systemd-sleep is nonexistent. I suspect "on wake" calls could be hooked, but I've no idea how to do this. At least there's no documentation for it sad

I think a script is the way to go, I know it's hacky - but if it works - it works!

Any ideas? Cheers guys smile

Offline

#6 2013-06-09 03:22:54

Minsc
Member
Registered: 2012-07-16
Posts: 78

Re: [SOLVED] Xorg does not remember screen brightness (Intel laptop)

@OP, before you put your laptop to sleep, check to see what the values of /sys/class/backlight/*/brightness are, then see if they actually change when the machine wakes.  I am wondering if the brightness is actually restored to the max value as listed in /sys/class/backlight/*/max_brightness.

Good thinking, and I'd already checked stuff like this. The var is being changed, but as above - I need a way to ensure the current value is remembered. Even if I modify intel_backlight, xorg still defaults to max brightness.

Xorg bug??? I dunno. Hacks are most welcome smile

Offline

#7 2013-06-10 06:45:31

sultanoswing
Member
Registered: 2008-07-23
Posts: 278

Re: [SOLVED] Xorg does not remember screen brightness (Intel laptop)

@WonderWoofy:  I'm not sure why xorg-xbacklight is a dirty hack, as it's in the official repos, and this seems a reasonable use for it! I'll accept "workaround", but not "dirty hack" wink

I tried a few less hackish methods, as per the Arch backlight wiki, and tried some scripts and starting 'em as service files under systemd, but all to no success. Anyway, at least my backlight is now behaving itself smile


Arch 4.5.1 (x86_64) w/Gnome 3.20.1
ASUS P7P55-E-Pro, Geforce GT430, i5-750, 8GB, Samsung 830 SSD | Intel NUC 5i5RYK | ASUS ux303ua | HP Folio 13

Offline

#8 2013-06-10 06:59:49

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] Xorg does not remember screen brightness (Intel laptop)

Using xorg-xbacklight is not the dirty hack.  I was referring to adding the xbacklight =70 to gnome-session-properties or whatever it is.  I don't use gnome, so I'm not sure exactly what this is you are adding it to, but I am sure it is not meant to be used in this way.  Besides, it is limited to setting it to one, and only one, backlight level.  Wouldn't it be much better to have it record its level when you suspend and then reinstate that level on resume?  I think it is.

Offline

#9 2013-06-20 23:54:27

semi225599
Member
Registered: 2012-06-17
Posts: 15

Re: [SOLVED] Xorg does not remember screen brightness (Intel laptop)

You could try a systemd script as stated above: e.g.

[Unit]
Description=Lock X session using xscreensaver
Before=sleep.target

[Service]
Type=oneshot
ExecStart=/usr/bin/xuserrun /usr/bin/xscreensaver-command -lock

[Install]
WantedBy=sleep.target

(from XScreensaver documentation) Just put this file in /etc/systemd/system with a .service extension.

Just change the 'Before' to 'After' and it will run on resume.  This could work, although it's possible that since it's running as a systemd service, it has no way of interacting with Xorg and that would cause problems.
Only one way to find out.

Last edited by semi225599 (2013-06-20 23:55:13)

Offline

Board footer

Powered by FluxBB