summarylogtreecommitdiffstats
path: root/xdm-xfreq-xdesktops
blob: 63fe4895890eafd5cc8af0d6a57a56431f9a910a (plain)
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
#!/bin/sh

if [[ $# > 0 && $# <3 ]]; then
	if [[ $# == 2 ]]; then
		X=$2
	fi
	P=$1
	if [[ $P && -d $P ]]; then
		I=1

		if [[ $X == $I ]]; then
			G="xlogin*greeting: [F1] XSession*\\040\\040\\040"
		else
			G="xlogin*greeting: [F1] XSession\\040\\040\\040"
		fi
		echo "xlogin*login.translations: #override \\" > /var/run/xdm-xfreq-xdesktops
		echo "    Ctrl<Key>R: abort-display()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    Ctrl<Key>\\: abort-session()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    Ctrl<Key>C: restart-session()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    <Key>F1: set-session-argument() finish-field()\n\\" >> /var/run/xdm-xfreq-xdesktops

		for D in $P/*.desktop
		do
			I=$((I + 1))
			N=`grep "Name=" $D | cut -d "=" -f 2`
			R=`grep -w "Exec" $D | cut -d "=" -f 2`
			if [[ $X == $I ]]; then
				A=$R
				G=$G"[F$I] ${N}*\\040\\040\\040"
			else
				G=$G"[F$I] ${N}\\040\\040\\040"
			fi
			echo "    <Key>F${I}: set-session-argument(${R}) finish-field()\n\\" >> /var/run/xdm-xfreq-xdesktops
		done

		echo "    <Key>Delete: delete-character()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    <Key>Left: move-backward-character()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    <Key>Right: move-forward-character()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    <Key>Home: move-to-begining()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    <Key>End: move-to-end()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    Ctrl<Key>KP_Enter: set-session-argument(failsafe) finish-field()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    <Key>KP_Enter: set-session-argument($A) finish-field()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    Ctrl<Key>Return: set-session-argument(failsafe) finish-field()\n\\" >> /var/run/xdm-xfreq-xdesktops
		echo "    <Key>Return: set-session-argument($A) finish-field()" >> /var/run/xdm-xfreq-xdesktops
		echo "" >> /var/run/xdm-xfreq-xdesktops
		echo $G >> /var/run/xdm-xfreq-xdesktops
	fi
fi