From: Christian Heller Date: Wed, 29 Mar 2017 17:03:32 +0000 (+0200) Subject: Provide useful W530 scripts in bin/. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/templates?a=commitdiff_plain;h=e2ec6208875a1f54b438b3495a1374a0d304d3ee;p=config Provide useful W530 scripts in bin/. --- diff --git a/bin/w530_backlight.sh b/bin/w530_backlight.sh new file mode 100755 index 0000000..bce6b30 --- /dev/null +++ b/bin/w530_backlight.sh @@ -0,0 +1,17 @@ +#!/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 diff --git a/bin/w530_startx_force_nvidia.sh b/bin/w530_startx_force_nvidia.sh new file mode 100755 index 0000000..3c3ca59 --- /dev/null +++ b/bin/w530_startx_force_nvidia.sh @@ -0,0 +1,13 @@ +#!/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 diff --git a/dotfiles/user/thinkpad/W530/startx_force_nvidia.sh b/dotfiles/user/thinkpad/W530/startx_force_nvidia.sh deleted file mode 100755 index 3c3ca59..0000000 --- a/dotfiles/user/thinkpad/W530/startx_force_nvidia.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/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