Skip to content
nxdefiant edited this page Jun 29, 2012 · 2 revisions

Notifications

I had the trouble, that viewing flash video sometimes enables my nvidia card. So I wrote a quick udev rule that sends me a notification when the nvidia module gets loaded.

The rule:

# /etc/udev/rules.d/99_bumblebee.rules
DEVPATH=="/module/nvidia", ACTION=="add", RUN+="/usr/local/sbin/nvidia_event.sh on"
DEVPATH=="/module/nvidia", ACTION=="remove", RUN+="/usr/local/sbin/nvidia_event.sh off"

The file calling notify-send:

#!/bin/sh
# /usr/local/sbin/nvidia_event.sh

USER=my_username

case $1 in
	on)
		status="turned on"
		;;
	off)
		status="turned off"
		;;
esac

su $USER -c "export DISPLAY=:0.0; notify-send nvidia \"$status\"" || exit 0
Clone this wiki locally