mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-12-06 19:29:21 +01:00
[presets] update steam module
This commit is contained in:
40
presets/steam/steamos-priv-write
Executable file
40
presets/steam/steamos-priv-write
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [[ $EUID -ne 0 ]];
|
||||
then
|
||||
exec pkexec --disable-internal-agent "$0" "$@"
|
||||
fi
|
||||
|
||||
WRITE_PATH="$1"
|
||||
WRITE_VALUE="$2"
|
||||
|
||||
function CommitWrite()
|
||||
{
|
||||
echo "commit: $WRITE_VALUE -> $WRITE_PATH" | systemd-cat -t p-steamos-priv-write -p warning
|
||||
chmod a+w "$WRITE_PATH"
|
||||
echo "$WRITE_VALUE" > "$WRITE_PATH"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function DeclineWrite()
|
||||
{
|
||||
echo "decline: $WRITE_VALUE -> $WRITE_PATH" | systemd-cat -t p-steamos-priv-write -p err
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "checking: $WRITE_PATH" | systemd-cat -t p-steamos-priv-write -p warning
|
||||
if [[ "$WRITE_PATH" == /sys/class/backlight/*/brightness ]]; then
|
||||
CommitWrite
|
||||
fi
|
||||
|
||||
if [[ "$WRITE_PATH" == /sys/devices/*/*/*/*/hwmon/hwmon*/led_brightness ]]; then
|
||||
CommitWrite
|
||||
fi
|
||||
|
||||
if [[ "$WRITE_PATH" == /sys/devices/*/*/*/*/hwmon/hwmon*/content_adaptive_brightness ]]; then
|
||||
CommitWrite
|
||||
fi
|
||||
|
||||
DeclineWrite
|
||||
Reference in New Issue
Block a user