انجمن‌های فارسی اوبونتو

کمک و پشتیبانی => برنامه‌سازی => نویسنده: سید محمود رضا سجادی در 09 آذر 1390، 05:46 ب‌ظ

عنوان: script برای تغییر نور مانبتور[SOLVED - FOR ATI] [UNSOLVED -FOR NVIDIA]
ارسال شده توسط: سید محمود رضا سجادی در 09 آذر 1390، 05:46 ب‌ظ
سلام

من یه اسکریپت نوشتم که این اررور رو میده(SOLVED) :
/usr/bin/adjust-brightness: line 74: syntax error: unexpected end of file[SOLVED]دوم اینکه فقط برای ATI نوشتم . خوشحال میشم که کمکم کنید برای NVidia هم کار کنه

ممنون

متن اسکریپت :
#!/bin/sh

# Some user-defined values
GRANULARITY=27 # The approximate number of possible brightness positions allowed
FONTSIZE=70 # The size of font used by the OSD display
# Fontsize often needs to change when granularity changes

# Pull the numerical limit from the Mixer
if which xbacklight
then
  LIMIT=100
  b=`xbacklight -get`
  brightval=${b/\.*}
  case "$1" in
  up)
    xbacklight -set $(( $brightval + 20 ));;
  down)
    xbacklight -set $(( $brightval - 10 ));;
  *)
    if [ $brightval -gt 90 ]; then xbacklight -set 0; else xbacklight -set 100; fi;;
  esac
else if which aticonfig
then
  LIMIT=100
  brightval=`aticonfig --query-dispattrib=lvds,brightness|grep value|awk '{print $2}'|tr -d '[A-Za-z:,]'`
  case "$1" in
  up)
    if [ 90 -gt $brightval ]; then aticonfig --set-dispattrib=lvds,brightness:$(($brightval + 10)); fi;;
  down)
    if [ $brightval -gt -90 ]; then aticonfig --set-dispattrib=lvds,brightness:$(($brightval - 10)); fi;;
  *)
    if [ $brightval -eq 0 ]; then aticonfig --set-dispattrib=lvds,brightness:-80; else aticonfig --set-dispattrib=lvds,brightness:0; fi;;
  esac
  if [ $brightval -lt -79 ]; then
    OSDCOLOR=purple; else
    OSDCOLOR=yellow
  fi
else
  LIMIT=10
  brightval=`cat /sys/devices/virtual/backlight/acpi_video0/brightness`;
  case "$1" in
  up)
    if [ 8 -gt $brightval ]; then echo $(($brightval + 1)) > /sys/devices/virtual/backlight/acpi_video0/brightness; fi;;
  down)
    if [ $brightval -gt 0 ]; then echo $(($brightval - 1)) > /sys/devices/virtual/backlight/acpi_video0/brightness; fi;;
  *)
    if [ $brightval -eq 0 ]; then echo "6" > /sys/devices/virtual/backlight/acpi_video0/brightness; else echo "0" > /sys/devices/virtual/backlight/acpi_video0/brigh$
  esac
  if [ $brightval -eq "0" ]; then
    OSDCOLOR=purple; else
    OSDCOLOR=yellow
  fi
fi fi

let volcounter=brightval*GRANULARITY/LIMIT
if [ $volcounter -gt $GRANULARITY ]; then
   volcounter=$GRANULARITY
fi

OSDI=""

while [ $volcounter -gt 0 ]
do
   OSDI=`echo $OSDI"I"`
   let volcounter=volcounter-1
done

# Clean up any running aosd_cat processes
killall aosd_cat &> /dev/null

# Display the "I" bar
echo "Brightness : $OSDI" | aosd_cat   -n "Arial Black $FONTSIZE" -u 1000 -o 200 -R $OSDCOLOR -S none -f 0 -y -10

# END

-------پی نوشت--------
با تشکر از دوستان حل شد. فقط برای NVIDIA یکی کمک کنه ممنون میشم.
عنوان: پاسخ به: script برای تغییر نور مانبتور
ارسال شده توسط: doomhammer65ir در 09 آذر 1390، 07:45 ب‌ظ
بنده پیغام unexpected end of file رو بیشتر زمانی میگیرم که حلقه ها یا شرط ها رو درست نبسته باشم .
اسکریپت چکار مکینه ؟ صفحه رو کمی روشنتر میکنه ؟ اگر بله تو خود nvidia-setting همچه دسترسی به روشنایی نمایشگر داریم نیاز به اسکریپت و فرمان نیست
عنوان: پاسخ به: script برای تغییر نور مانبتور
ارسال شده توسط: سید محمود رضا سجادی در 10 آذر 1390، 10:38 ق‌ظ
اسکریپت چکار مکینه ؟ صفحه رو کمی روشنتر میکنه ؟ اگر بله تو خود nvidia-setting همچه دسترسی به روشنایی نمایشگر داریم نیاز به اسکریپت و فرمان نیست

بله دقیقا حق با شماست اما توی openbox یا مثل اون برای ست کردن دکمه ها نیاز به یک اسکریپت هست. نمونه بخش مورد نظر فایل کانفیگ openbox خودم ور هم اینجا میذارم

   <keybind key="XF86MonBrightnessDown">
     <action name="Execute">
       <command>adjust-brightness down</command>
     </action>
   </keybind>
   <keybind key="XF86MonBrightnessUp">
     <action name="Execute">
       <command>adjust-brightness up</command>
     </action>
   </keybind>
   <keybind key="XF86Display">
     <action name="Execute">
       <command>adjust-brightness</command>
     </action>
   </keybind>

   <keybind key="XF86AudioRaiseVolume">
     <action name="Execute">
       <command>amixer set Master 5%+ unmute</command>
     </action>
   </keybind>
   <keybind key="XF86AudioLowerVolume">
     <action name="Execute">
       <command>amixer set Master 5%- unmute</command>
     </action>
   </keybind>
   <keybind key="XF86AudioMute">
     <action name="Execute">
       <command>amixer set Master toggle</command>
     </action>
   </keybind>
   <keybind key="XF86Suspend">
     <action name="Execute">
       <command>sudo pm-suspend-hybrid</command>
     </action>
   </keybind>
  <keybind key="XF86PowerOff">
     <action name="Execute">
       <command>exitx</command>
     </action>
   </keybind>