Improved an applet. Care to test?

Get involved, create or participate in a project.
Post Reply
User avatar
Drugwash
Level 4
Level 4
Posts: 237
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO

Improved an applet. Care to test?

Post by Drugwash »

First of all I don't understand why there's no specific section on this board for generic code talk. No idea where to ask certain code-related questions or publish things like this one here.

Practically I felt bored one day and since I had just installed a new applet that does what the built-in commands should do but don't some ideas popped to mind. Someone on its specific page was asking ironically what this does that an older similar one doesn't. Well, for starters it doesn't ask the user to install an extra mandatory library. I like that.

Before continuing someone might ask why not go to github and interact directly with the developer/maintainer. Hell no. That place - besides belonging to Micro$oft - is so weirdly structured that I just can't understand it. And even if I took one week or one month to try and grasp its concepts I'd forget everything within a couple days due to my bad memory. Not to mention the whole login procedure, which is unacceptable in either variant. So no github. If the current maintainer @cardsurf happens to be passing by I'll gladly have a chat.

OK, so the applet is called Brightness and Gamma Applet. Its official Spices page is here.
What have I done? First of all added a tooltip. I hate it when a tray icon doesn't tell me what it's doing there, more so when its icon is ugly-symbolic and ambiguous. So now it displays a nice tooltip with details on the screen and displays it's enabled for, the Mode (talk about that right away), and the percentual levels for Brightness and RGB. Tooltip gets updated in real time when scrolling mouse wheel over icon to adjust brightness.

Then I added a Mode switch upon middle-click that cycles through three different modes: Day, Night and Custom. For now only Brightness can be set to different values for each mode. It's more like a proof of concept, a test. If/when I feel again like messing with code I may improve it even further. Oh and there's also a brief popup notification when cycling through modes so the user knows exactly what was chosen since the tray icon does not (yet?) reflect current mode.

There are many other things to do, like saving/loading all custom values for all modes; for now they are hardcoded (for brightness only). Or options to choose specific icons for the popup notifications (and tray icon maybe, at some point). Other ideas would be welcome.

This mod has only been tested in Mint Cinnamon 19.2. Hopefully it works in other older or newer versions but that's for you to test and report back, if you want to.
Installation is as simple as unpacking the contents of the archive (folder included) in ~/.local/share/cinnamon/applets.
If already installed choose to overwrite all files. Of course, backup the existing applet's folder before overwriting, just in case.
a) If applet is already enabled and running, open Looking Glass (right-click panel > Troubleshoot > Looking Glass), select the Extensions tab,
find Brightness and gamma applet in the list, right-click it and choose Reload Code.
If it doesn't show back up in the tray switch to the Log tab and look at the bottom for any related error messages. Then please copy/paste here hoping it can be fixed. But hopefully there won't be any errors.
b) If applet was not previously installed you will have to open the Applets GUI (Main Menu > Preferences > Applets) and enable it there.
At the same place it can later on be disabled or uninstalled if so desired.

Anyway, here you are v1.1.2.1 based on official v1.1.2: Enjoy! 8)
dorsetUK
Level 5
Level 5
Posts: 532
Joined: Thu Sep 19, 2019 4:40 am

Re: Improved an applet. Care to test?

Post by dorsetUK »

Drugwash wrote:
Mon Feb 01, 2021 5:15 pm
OK, so the applet is called Brightness and Gamma Applet.
Hi Drugwash.

I've been using the original applet for ages and have now updated to your version and it's great - it does what you say it does.

Thanks.
User avatar
Drugwash
Level 4
Level 4
Posts: 237
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO

Re: Improved an applet. Care to test?

Post by Drugwash »

Thank you so much for your feedback! I was really wondering if anyone would ever say something, anything, after all downloads.

I already have a slightly improved version here which changes tray icon to reflect current mode but have been waiting for some feedback on a Panel/Cinnamon issue with tooltips that I posted about on GitHub recently. No feedback there either. :?

There is also something else I've been working on separately with the intent of implementing the idea here in this applet. It's about a fourth mode, automatic, that gradually decreases/increases brightness/gamma based on current geographical location and time of the day. Large part of the code is done but still needs to be worked on. Currently I'm a bit sidetracked by a Pale Moon add-on but hopefully will manage to fix it this week, then get back to this applet.

Here's the slightly improved version, in the mean time: If you need to modify the brightness defaults for Day and Night there are two values in applet.js that can be changed:

Code: Select all

this.brightness_day = 95;
this.brightness_night = 60; 
Values should be in the maximum range of [0-100] theoretically but a value below 50 or 40 would already be unusable.
After modifying and saving the file, code should be reloaded as explained above.
Post Reply

Return to “Community Projects”