Workspace Switching Mouse button 6 & 7 without compiz

Share here your personal tips or creations: desktop, conky, docks, widgets or tweaks are welcomed here!
User avatar
Posts: 71
Joined: 27 Oct 2013 00:11
Location: Australia

Workspace Switching Mouse button 6 & 7 without compiz

Postby gazza » 28 Oct 2013 01:01

First off a huge thank you to GeneC for sharing his tweaks, I found some of them very useful as I'm a first time xfce user.

I have this obsession, I always get 7 button mice where button 6 & 7 are activated by tilting the scroll wheel left or right. I usually run compiz and hook these buttons to the workplace switcher, so all I need do it tilt my scroll wheel and I switch workspaces. It's the only reason I install compiz.

But since this is a fesh install of a new OS, I thought I'd try and do it without the huge overhead. This is what I did.

Install wmctrl and xbindkeys

Code: Select all

sudo apt-get install xbindkeys
sudo apt-get install wmctrl
edited a script I found on the web to switch workspaces back and forward between workspaces (it only went forward). Here is my edited script. I called it

Code: Select all

total=$(wmctrl -d | wc -l)
current=$(wmctrl -d | sed -n 's/^\([0-9]\+\) *\*.*/\1/p')
if [ -z "$total" ] || [ -z "$current" ]; then
    echo 1>&2 "$0: Could not obtain workspace information!"
    exit 2
if [ "$1" = "+" ];then
    if [ $target = $total ]; then
    wmctrl -s $target
elif [ "$1" = "-" ]; then
    if [ $target -lt 0 ]; then
    wmctrl -s $target
    echo "need - or + as a paramater to switch workspaces"
placed in my ~/bin/Scripts directory , made it exicutable obviously.

Then I made the xbindkeys default config

Code: Select all

xbindkeys --defaults > $HOME/.xbindkeysrc
made the following edits in it

Code: Select all

"/home/gazzax/bin/Scripts/ -"
"/home/gazzax/bin/Scripts/ +"
Note, I'm using button 8 & 9 as my current mouse uses them, some mice I've had use 6 & 7 , use xev to determine what your extra buttons are.
Also note the '-' and the '+' are the paramaters sent to the script, they tell it which direction you want to go.

then all I did was type

Code: Select all

in the terminal and now I can switch workspaces with a click of the mouse :D I'll be adding xbindkeys to my startup applications.

Note the askubuntu is KDE orientated so if your on kde it would be nice to get feedback if the dbus command works. ... workspaces ... xbindkeys/

Hope this helps someone :D
Don't miss the donut by looking through the hole.

Return to “Customizations”

Who is online

Users browsing this forum: No registered users and 2 guests