Répondre au commentaire

août
20

Changer d'espace de travail avec la souris

Afin de m'affranchir de Compiz Fusion j'ai recherché un moyen peu gourmand en ressources afin de changer de bureau par les boutons latéraux de ma souris.

Deux outils ont donc été nécessaires :

  • xbindkeys
  • wmctrl

Le premier permettant d'associer facilement une combinaison de touches clavier / souris à une action.

Le second apportant un contrôle en ligne de commande du Window Manager (Gestionnaire de fenêtre)

I) Créer un script de changement de worspace grâce à wmctrl

Passer à l'espace de travail suivant :

.Switch_WS_Up.sh

#!/bin/bash

#get number of workspaces
ws=$(wmctrl -d | wc -l)

#current workspace index
cws=$(wmctrl -d | awk '/\*/ {print $1}')

#work space on right
rws=$(($cws+1))

#wrap if required
if [ $rws = $ws ]; then
rws=0
fi

#change to next workspace
wmctrl -s $rws

Passer à l'espace de travail précédent :

.Switch_WS_Down.sh

#!/bin/bash

#get number of workspaces
ws=$(wmctrl -d | wc -l)

#current workspace index
cws=$(wmctrl -d | awk '/\*/ {print $1}')

#work space on left
lws=$(($cws-1))

#wrap if required
if [ $lws = -1 ]; then
lws=$(($ws-1))
fi
echo $lws

#change to next workspace
wmctrl -s $lws

II) Lancer les scripts lors du clic sur les boutons latéraux

Utilisez le GUI xbindkeys-config afin de créer les raccourcis.
Le bouton 8 lance : .Switch_WS_Up.sh
Le bouton 9 : .Switch_WS_Down.sh

Pour information, mon .xbindkeysrc :

"xbindkeys_show"
control+shift + q

#StartTerm
"gnome-terminal"
control + b:2

#SwitchWS-up
"sh .Switch_WS_Up.sh"
b:8

#SwitchWS-Down
"sh .Switch_WS_Down.sh"
b:9

Répondre