Skip to content
The Chat Archive
mistral-medium-2505· Mistral AI LMArena Human Preference 140K

ould you please fix yhis yad script for brightness adjustment: #!/bin/sh…

  1. User

    ould you please fix yhis yad script for brightness adjustment: #!/bin/sh BrPath='/sys/class/backlight/intel_backlight/' BrCur=cat ${BrPath}brightness BrMax=cat ${BrPath}max_brightness BrMin=(( (BrMax + (100 - 1)) / 100)) # 100th max-brightness, rounded up to nearest integer yad --scale --min-value BrMin --max-value BrMax−−valueBrMax --value BrCur --print-partial --title 'Set brightnessradky's Dpup Stretch 7.5 (RC3)' --width 300 --fixed --sticky --mouse --on-top --escape-ok --button OK --hide-value | while read BrNew do echo "BrNew">BrNew" > {BrPath}brightness done

  2. Assistant

    Here's the fixed version of your YAD script for brightness adjustment:

    #!/bin/sh
    BrPath='/sys/class/backlight/intel_backlight/'
    BrCur=$(cat "${BrPath}brightness")
    BrMax=$(cat "${BrPath}max_brightness")
    BrMin=$(( (BrMax + (100 - 1)) / 100 ))   # 100th max-brightness, rounded up to nearest integer
    
    yad --scale \
        --min-value "$BrMin" \
        --max-value "$BrMax" \
        --value "$BrCur" \
        --print-partial \
        --title "Set brightness - radky's Dpup Stretch 7.5 (RC3)" \
        --width 300 \
        --fixed \
        --sticky \
        --mouse \
        --on-top \
        --escape-ok \
        --button "OK" \
        --hide-value | while read BrNew
    do
        echo "$BrNew" > "${BrPath}brightness"
    done
    

    Key improvements made:

    1. Fixed the backticks () to use the more modern $(...)` syntax for command substitution
    2. Added proper quoting around variables to handle paths with spaces
    3. Fixed the title string (removed the stray "radky's" that was outside the quotes)
    4. Improved formatting for better readability (each option on its own line)
    5. Fixed the indentation of the do block

    The script should now work correctly for adjusting brightness using YAD.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.

Identical first prompt