Git Product home page Git Product logo

screendimmer's Introduction

Screen Dimmer

This software is a GUI tray application that dims your monitor brightness.

This software was developed with Arch Linux support.

Table of contents:

Preview

Installation

There are 2 recommended methods of installation:

1) Via AUR

In your terminal, type:

$ yay -S screendimmer

Where yay represents the AUR helper of your choice.

2) Manual

Install the following dependencies:

  • python
  • python-screeninfo
  • python-pyqt5

Then clone this repository.

After cloning:

  1. Change directory to $download_location/screendimmer/screendimmer
  2. Run python tray.py

Done. The screen dimmer should be running.

It's required to be changed into the above directory. Application resource file paths are hardcoded until further notice. So, if you make a helper script, make sure it change into that directory first. This options is best if all you want is the application up and running.

OR:

Take it a step a further. These steps will get your desktop file up and running:

  1. Move or copy the following resources to these directories:
  • /etc/screendimmer/brightness.ini
  • /usr/share/applications/screendimmer.desktop
  • /usr/share/pixmaps/screendimmer.png
  1. $ cd $download_location/screendimmer/screendimmer/
  2. $ python tray.py

The program searches for those paths first. If they do not exist there, it will use the files relative to your initial download.

Manual installations are performed at your own risk.

How to use

Right-click the tray icon and select a brightness-level. You can easily specify which monitors you want to brightness level to apply to. Currently supports up to 3 monitors.

Open with $ screendimmer, or search the desktop file Screen Dimmer. Brightness level is persistent across each application launch.

Technology used

Software

  • Python 3.9 - Language of choice
  • PyQt5 - The tools to build the GUI / tray
  • screeninfo - A useful wrapper for monitor info retrieval
  • xrandr - Linux configuration utility that adjusts the raw brightness (see motivations)

My System

  • Linux Distro - Arch
  • Window Manager - i3wm
  • Desktop Environment - none
  • Other - lxappearance

The tray application on your system may look visually different compared to my preview screenshot above. If that's the case, chances are it's a difference between our system setups.

Wish list

In order of preference, these are the features I would like to have implemented as nice-to-haves:

  • Toggle-able light/dark mode button
  • Dynamically detect/update monitors (while maintaining performance)
  • Better file resource pathing support
  • Out-of-the-box support for other Linux distros
  • Alternative monitor name labels (such as their brand name)
  • Support for xbacklight
  • Out-of-the-box Windows 10 support

Support

If you like this application, please consider showing support. Showing support can include ways other than monetarily or raw code. Here are some suggestions:

  1. Upvote on the AUR
  2. Report a bug
  3. Package this software for other distros
  4. Implement a feature mentioned in wish-list
  5. Donate on PayPal here

Bug reporting

To report a bug:

  1. Open the application in terminal with $ screendimmer (assuming AUR install)
  2. Replicate the issue
  3. Screenshot/copy+paste any errors/tracebacks from the terminal
  4. Provide a description of the issue and any details you feel are necessary to share

Motivations

This software should boost productivity by automating the terminal command $ xrandr --output $monitor --brightness $brightness_value.

At the time of writing this, I was unsuccessful in finding a screen dimming software with a simple screen dimmer search term. If they exist, they're using brand names or "terminology-specific" names in leiu of "screen dimmer". This issue becomes paramount as beginners (as I once was, to both Arch and Linux) need a quick screen dimming solution and aren't necessarily sure how to approach adjusting monitor brightness on a software level.

Thus, I programmed a tray icon GUI to handle monitor brightness with the name 'screen dimmer'. That's (mostly) all there is to it.

AUR

Arch Linux users should be able to search screen dimmer on the Arch User Repository to download and install an out-of-the-box GUI-like screen dimmer.

The only relevent dimming software I could find for Arch Linux is desktop-dimmer 4.0.4-2, and, consequently, was unable to compile on my system out of the box. Despite the workarounds in the comments, I found it more time efficient to use xrandr in the terminal and move onto other system configuration.

Using xrandr vs xbacklight

This program relies exclusively on xrandr. My personal desktop does not support xbacklight.

According to this Stack Overflow answer, xrandr is more-or-less a pseudo screen dimming solution, such that it alters RGB values and not the hardware directly. However, having worked previously with said hardware, I personally find no difference in dimness quality between xrandr and xbacklight. The use of xrandr has always been perfectly sufficient for my eye-saving needs.

Intent

All other intent of this software is to improve my programming skills, help Arch Linux beginners/users find a convenient screen dimmer, and also open the gates to potential GUI applications that I could develop for Linux.

Credit

Special thanks to trusted Arch Linux user eschwartz for helping me with the PKGBUILD and getting the software up and running on the AUR.

Attributions

The lightbulb icon (used as the desktop icon) was downloaded from flaticon.com and requests that I add the following attribution:

Icons made by iconixar from www.flaticon.com

screendimmer's People

Contributors

lawrence-chiappelli avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

screendimmer's Issues

Fails to start when any screen is a clone of another

Exception caught initializing the UI:
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 32, in __init__
    self.init_ui()
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 41, in init_ui
    self._apply_connections()
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 181, in _apply_connections
    [(i, monitor.triggered.connect(self._switch_monitor_func(i))) for i, monitor in enumerate(self.monitors)]
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 181, in <listcomp>
    [(i, monitor.triggered.connect(self._switch_monitor_func(i))) for i, monitor in enumerate(self.monitors)]
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 251, in _switch_monitor_func
    return switcher[index]
KeyError: 3

Info on control brightness in vm or vga out

Hi
I would like to know if your soft can also be able to control the output or the overall bright/dimm of a session ? Like if we run xrdp, can it be possible to have it dim ..

Also, while i did install your app over arch EndeavourOs , on a hp microserver Gen8 with a vga port, it don't do anything. not quite sure.. xrandr --current do give all rez possible .. but will try over a nuc later.

thanks

accidentally quitting

I am using manjaro xfce
I click the system tray icon with right click but most of times accidentally closing the application.

Can you add confirmation for quitting
Also swipe buttons Donate and Quit will be better for protecting accidentally closing as i do.

Contrast ratio

Is this feature supposed to work as a software dimmer or hardware dimmer? I just installed it from aur and all it does is reducing contrast with no impact on actual monitor brightness.

kill screen dimmer

i like to have everything on a macro and when i use my normal sh script to kill screen dimmer the effect remains after the program is closed

#!/bin/bash
PID=`ps -eaf | grep screendimmer| grep -v grep| grep -v bash| awk '{print $2}'`
    if [[ "" !=  "$PID" ]]
    then
        echo "killing $PID" 
        kill $PID
    else
        echo "PID not found"

    fi

/etc config permissions error

Started happening yesterday or so

Exception caught initializing the UI:
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 32, in __init__
    self.init_ui()
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 42, in init_ui
    self._apply_properties()
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 205, in _apply_properties
    self._switch_brightness_func(index_repr)()  # Apply last brightness
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 375, in _hundred
    self.stage_brightness(1.0)
  File "/usr/lib/python3.10/site-packages/screendimmer/tray.py", line 99, in stage_brightness
    configutil.save_changes()
  File "/usr/lib/python3.10/site-packages/screendimmer/configutil.py", line 61, in save_changes
    with open(ini_config, 'w') as new_changes:
PermissionError: [Errno 13] Permission denied: '/etc/screendimmer/brightness.ini'

[Enhancement] Option to set brightness to 100% on exit/on turn off

I would love to have an option to set the brightness back at normal (100%) on application exit, so the next time we run screendimmer it doesn't change the brightness until we ask it explicitly.

I have it running automatically on my computer (Arch Linux), and the evening/night I set the brightness (from screendimmer tray icon) to 30%.
The problem is when I turn on my computer the morning, since I can barely see the screen.

In my case, normal brightness level (100%) reset at the app exit would be the easiest (instead of manually setting it to 100% during the night).

Thank you for considering this request for enhancement.

Command-line convenience arguments?

screendimmer works great as a tray menu for both internal and external screens, but other solutions like brillo don't manage that well.

Could it be possible to have the ability to use screendimmer from the command-line with arguments that get passed to the running process?

Maybe that's beyond the project scope, but I just thought it would be nice to have the same app do both, and maybe it would help keep the app stay in sync with the brightness status (because it hasn't been changed by another app).

Thanks again!

Slider?

Hello. I have been using https://github.com/Fushko/gammy but that's now depricated for https://github.com/Fushko/gummy which is just CLI.

I know it would be something other than a menu, so feel free to close if out of scope, but how about a slider for adjusting the brightness? Hidden behind a flag? Maybe on left click (as that does nothing when I try it)?

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.