0

I'm developing extension for wingpanel-indicator-power which allows you to change the screen brightness directory from the indicator.
The the moment this is only possible by accessing the power options from switchboard.

For now it is working quite well.
But at the moment, this extension is displayed all the time, even if you are using a desktop computer, where it is not possible to change the brightness.

I want to check if user is using a notebook and only display the brightness-slider, if it is not a desktop computer.

1

What makes you think it's not possible to adjust brightness on a desktop? It may not be possible on your desktop, but that doesn't mean it isn't possible on someone else's…

You're also going to run into the problem of how you define a laptop vs. desktop (and, to take it further, a tablet). It's common to find laptop parts in desktop computers, especially all-in-one machines, NUCs, etc. The best thing I can think of is checking to see if /sys/class/power_supply/BAT* exists, but I think connecting a UPS to a desktop computer would populate that…

If I were you I would try to take a look at the API you're using to set the display brightness to see if it provides a way to check whether the display actually supports it. If so, it would probably be best to use that instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.