Архив

Архив Ноябрь 2011

Как узнать какие файлы открывает программа при запуске

17 ноября 2011 Нет комментариев

strace -f -e trace=open

Categories: Linux, Без рубрики Tags:

Kubuntu KDE Переключение мониторов Lenovo ThinkPad X220

10 ноября 2011 Нет комментариев

1. Создаем обработчик события fn-f7:

echo "event=ibm/hotkey HKEY 00000080 00001007" > /etc/acpi/events/lenovo-fn-f7
echo "action=/usr/bin/autoswitch.sh" >> /etc/acpi/events/lenovo-fn-f7

2. Рестартуем ACPI

sudo service acpid restart

3. Содержимое /usr/bin/autoswitch.sh:

#!/bin/bash
#
#
# http://www.thinkwiki.org/wiki/Sample_Fn-F7_script

screen_change() {
VGA1_CONNECTED=$( $SU xrandr -q | grep "VGA1 connected" )

echo `date` ${VGA1_CONNECTED} >> /tmp/333

if [ -n "${VGA1_CONNECTED}" ]; then
echo "VGA1 is connected"
xrandr --output VGA1 --auto && xrandr --output LVDS1 --off
else
echo "VGA1 is not connected"
xrandr --output LVDS1 --auto && xrandr --output VGA1 --off
fi
}

# based on /etc/acpi/screenblank.sh (Ubuntu 7.10)
# . /usr/share/acpi-support/power-funcs # for getXuser
getXuser() {
user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
if [ x"$user" = x"" ]; then
user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
fi
if [ x"$user" != x"" ]; then
userhome=`getent passwd $user | cut -d: -f6`
export XAUTHORITY=$userhome/.Xauthority
else
export XAUTHORITY=""
fi
}
# end of getXuser from /usr/share/acpi-support/power-funcs
#
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
screen_change
fi
done

Материалы по теме:

ThinkPad fn-F7: http://www.thinkwiki.org/wiki/Sample_Fn-F7_script

xrandr -q | grep ‘VGA1 connected’ \ && xrandr —output LVDS1 —off —output VGA1 —auto \ || xrandr —output LVDS1 —auto —output VGA1 —off

Источник: Верхом на Debian GNU Linux: Простое переключение мониторов.

Еще кое-чего по теме: http://www.helplinux.ru/wiki/kb:ubuntu-eeepc-switch-display

И еще: http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

Categories: Linux Tags: , ,