Well, I just spent the past hour or so trying to get pygments working. All was going well until code started to run over the edge of the container.

After a lot of frustration, during which my monitor almost met an untimely death at the hands of my keyboard, sanity and logic prevailed and it turns out that pygments was using a class that was already defined in my css and used elsewhere. ( I guess that’s what happens when you neglect to read the documentation)

Just to show how my pygments configuration now works here’s a script I wrote a while ago to handle pulseaudio volume through the command line. I generally use this script with keyboard bindings.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash

# Variables
usage="Usage: $0: [-i increment] [-s sink] {up|down|mute|unmute|toggle|query}" 
increment=5
sink=0
maxVolume=65537

# Functions


getPercentage() {
	currentVolume=$(pacmd list-sinks | grep "volume: 0" | sed 's/[:%]//g' | awk '{ print $3 }' )
}

getMute() {
	muted=$(pacmd list-sinks | grep "muted" | awk '{ print $2 }')
}

stat() {
	getPercentage
	getMute
}

toggle() {
	if [ $muted == "no" ]; then
		mute;
	else
		unmute;
	fi
}

mute() {
	pacmd set-sink-mute $sink 1 > /dev/null
}
 
unmute() {
	pacmd set-sink-mute $sink 0 > /dev/null
}

query() {
	echo "Volume: $currentVolume, Muted: $muted"
}

setVolume() {
if [ $newVolume -gt $maxVolume ]; then
		newVolume=$maxVolume
	elif [ $newVolume -lt 0 ]; then
		newVolume=0
	fi
	if [ $muted == "yes" ]; then
		unmute
	fi
	pacmd set-sink-volume $sink $newVolume > /dev/null
	stat
	query
}

stat

# Main
while getopts i:s: arg
do
	case $arg in
   	i)		increment=$OPTARG
			;;
   	s)		sink=$OPTARG
			;;
	esac
	shift $(($OPTIND - 1))
done

case $* in
	up)		newVolume=$[$[$maxVolume/100] * $[$currentVolume+$increment]]
			setVolume
			;;
	down)	newVolume=$[$[$maxVolume/100] * $[$currentVolume-$increment]]
			setVolume
			;;
	toggle)	toggle
			;;
	mute)	mute
			;;
	unmute)	unmute
			;;
	query)	query
			;;
	help)	echo $usage
			;;
	*)		echo "Incorrect usage"
			echo $usage
    		exit 0;
			;;
esac

I must thank Philip Poots @pootsbook for getting my to try out pygments ( and for getting me to add an rss feed to the blog ) and for his blog which gave me a good starting point.