--- /dev/null
+#!/bin/sh
+# A very primitive backlight setter with a hardcoded backlight path, to replace
+# xbacklight which currently does not work on my system.
+if ! echo "${1}" | egrep -q '^[0-9]+$'; then
+ echo 'Argument must be a number.'
+ exit 1
+fi
+percentage=${1}
+backlight_dir=/sys/class/backlight/intel_backlight
+max_brightness=$(cat "${backlight_dir}"/max_brightness)
+if [ "${percentage}" = '100' ]; then
+ sudo sh -c 'echo '"${max_brightness}"' > '"${backlight_dir}"'/brightness'
+else
+ fract=$(expr "${max_brightness}" / 100)
+ brightness=$(expr "${percentage}" \* "${fract}")
+ sudo sh -c 'echo '"${brightness}"' > '"${backlight_dir}"'/brightness'
+fi
--- /dev/null
+#!/bin/sh
+
+# Undo bumblebee setup.
+sudo service bumblebeed stop
+sudo modprobe nvidia-drm
+sudo update-alternatives --set glx /usr/lib/nvidia
+
+# Use special xorg.conf and pass NVIDIA_DIRECT directive to .xinitrc.
+NVIDIA_DIRECT=1 startx -- -config xorg.conf.forced_nvidia
+
+# Recreate bumblebee setup.
+sudo service bumblebeed start
+sudo update-alternatives --auto glx
+++ /dev/null
-#!/bin/sh
-
-# Undo bumblebee setup.
-sudo service bumblebeed stop
-sudo modprobe nvidia-drm
-sudo update-alternatives --set glx /usr/lib/nvidia
-
-# Use special xorg.conf and pass NVIDIA_DIRECT directive to .xinitrc.
-NVIDIA_DIRECT=1 startx -- -config xorg.conf.forced_nvidia
-
-# Recreate bumblebee setup.
-sudo service bumblebeed start
-sudo update-alternatives --auto glx