Page 20 of 20

Posted: Thu 16 Apr 2020, 07:22
by step

Battery info applet

Posted: Thu 21 May 2020, 04:53
by dr. Dan
Greetings all,
I've wanted to get more information from the battery icon in the tray for a long time, so I started adding to the fatdog-battery-applet.sh script to make it more to my liking. I don't know that much about shell scripting, but I know more now than before. The script attached below seems to work fairly well. I've tried it on Dell, Gateway/Acer, HP, and Toshiba laptops. I'd appreciate any additional brand-based evaluation.

The script wants configuration files lowbatt, criticalbatt and shutdown in ~/.config/battery_level/, and refers to an as-yet-nonexistant fatdog-power-settings.sh which I envision as being able to set a variety of battery and power usage parameters. Since it doesn't yet exist, sit ignores it.

The code could be more elegant, and I plan to improve it, or incorporate any suggestions I receive, over time. For example, I'll eventually want to simplify the tooltip section, perhaps use a single configuration file, and improve the battery health presentation.

If it is successful and practical, it could be packaged with preset parameters in the appropriate locations, but I haven't figured that bit out yet.

Any feedback is appreciated.

Dan

Posted: Thu 21 May 2020, 07:32
by step
Dan, you have a good plan in mind. I can give you some feedback and hopefully someone else will add more.
In the interest of keeping this long thread right on its topic please consider opening a new thread focused on discussing the battery script.

I would change your modifications between the lines that start with ACTION= and BATTERY_SVG= as follows

Code: Select all

 LOWBATT=15 CRITICALBATT=5 SHUTDOWN=2
 LOWBATT_ACTION='batt-low.sh low'
 CRITICALBATT_ACTION='batt-low.sh critical'  # dr. Dan
 CLICK_ACTION="Xdialog --left --title \"Battery Info\" --msgbox \"\$(cat $POWER_PATH/*/uevent | sed 's/=/:    /')\" 0 0"
 RIGHT_CLICK_ACTION="fatdog-power-settings.sh" # configuration GUI
 [ -e /etc/battery.conf ] && . /etc/battery.conf # configuration
 [ -e $FATDOG_STATE_DIR/battery.conf ] && . $FATDOG_STATE_DIR/battery.conf # user overrides --dr. Dan
 
This is a "standard" way to add user overrides to the system configuration.
1) Provide in-script defaults. That's LOWBATT=15 ...
2) Read system configuration. . /etc/battery.conf
3) Read user overrides to the system configuration. . $FATDOG_STATE_DIR/battery.conf
I replaced ~/.config/battery_level/ with $FATDOG_STATE_DIR/ because $FATDOG_STATE_DIR is guaranteed to exist and it's where fatdog-bla-bla.sh (system) scripts normally expect to find user configuration files. This is preferred Fatdog64 usage, not policy. You can use ~/.config/some_dir even in this case, if you prefer. And you should for non-Fatdog64-system scripts. In that case I would write this stanza:

Code: Select all

 USER_CONFIG=${XDG_CONFIG_HOME:-$HOME/.config}/battery_level
 mkdir -p "${USER_CONFIG%/*}"
 
which ensures Desktop.org (XDG) compliance and creates the path if needed. On well-configured systems, you can simplify to

Code: Select all

 USER_CONFIG=$HOME/.config/battery_level/battery.conf
 mkdir -p "${USER_CONFIG%/*}"
 
I noticed several lines that follow this pattern:

Code: Select all

 variable=$(cat /path/to/file | head -n 1 2>/dev/null)
 
This can almost always be improved to another pattern:

Code: Select all

 unset variable  # or set it to a default value
 [ -s /path/to/file ] && read variable < /path/to/file
 
This code runs entirely inside the shell without starting external programs. It's faster and less error-prone.

Posted: Thu 21 May 2020, 15:13
by dr. Dan
Thank you step, I'll look into all of that. If you compare this to the original, you'll see how dependent I have been of the original. :oops: The technical details will help in other efforts as well.

Dan

Posted: Thu 21 May 2020, 15:47
by step
dr. Dan wrote:Thank you step, I'll look into all of that. If you compare this to the original, you'll see how dependent I have been of the original.
That's a good thing. After all, the original script is battle-tested, something to leverage.

Posted: Sun 24 May 2020, 18:53
by don570
designed for recording a radio broadcast...
rewritten to kill arecord properly

download
23k
baconrecorder-5.0-x86_64.txz


https://drive.google.com/open?id=1-SGyO ... 4jLqbgR92r
--------------------------------------------

Nvidia Proprietary Driver (440.82)

Posted: Sun 14 Jun 2020, 16:47
by jake29
Here is the latest Nvidia Proprietary Driver (440.82), compatible with Kernel 4.19.92. Seems to work fine for me.

Filename: nvidia-440.82-810.sfs
File Size: 167mb
Download: google drive