Ubuntu Pastebin

Paste from Apteryx at Sat, 21 Nov 2015 06:48:39 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# xinput alternative to Xorg section
# A script to call from ~/.profile or whenever you want to swap your mouse
# buttons.

------------------------------

#!/bin/bash

MOUSE_NAME="Razer Razer Lachesis"

while read -r line; do
    raw_line=$(grep "$MOUSE_NAME" | grep "pointer")
    if [ ! -z "$raw_line" ]; then
        mouse_id=$(echo "$raw_line" | cut -d '=' -f2 | sed 's/\t.*//g')
        echo "Found ${MOUSE_NAME}'s id: $mouse_id"
        xinput set-button-map $mouse_id 3 2 1
        break
    fi
done < <(xinput list)
Download as text