Scrolling through Linux & Windows Virtual Desktops with your mouse

Sean Nicholas
2 min readApr 23, 2020

--

If you follow me, you might know that I’m using Linux as my primary OS. Starting my journey I chose Pop!_OS as my distribution and never changed my mind since. It has a beautiful design & is super stable.

Coming from Mac I always used multiple virtual desktops and often switched back and forth between them. GNOME (comes with Pop!_OS) has also support for virtual desktops. The thing is: Switching between them is quite tedious. You need to move your mouse in the upper left corner, back it up a little and then you can use your mouse wheel to scroll between desktops.

Linux

I wanted to have a simpler way to switch desktops. Using the keyboard was not an options because it was to slow to find and press the correct keys. Moving your hand from your mouse to the keyboard or using a acrobatic one hand shortcut wasn’t cutting it. Luckily I found a wonderful GNOME Extension called Top Panel Workspace Scroll.

It works like this: GNOME has a menu bar just like the task bar in Windows but it is at the top of the screen instead. After you installed Top Panel Workspace Scroll you can move your mouse over the menu bar give your mouse wheel a gentle push and you scroll through all your virtual desktops. Its super quick and precise. Beautiful solution 😍

Windows

Now it happened that I started working for a company that uses Windows. Obviously with virtual desktop support but no scrolling — only keyboard shortcuts. I searched the whole internet to find a little tool that would replicate the Linux experience but I couldn’t find one. So I created my own.

As a JavaScript developer I wanted to create a little Node.js tool but it turns out there is no easy solution to detect scrolling at the OS level. Well, back to a language that never disappointed me when it comes to niche libs: Python.

A quick search and I found pynput — a fantastic and very easy to use library. Crafting the little script was done in about half an hour. Here it is:

scroll.py

You can find the repo with a bit more information here: https://github.com/sean-nicholas/scroll-windows-v-desktops

The script detects if the mouse wheel is turned. If the mouse pointer is within predefined coordinates (read from the config.json file) it will simulate the shortcut to move to the next or previous virtual desktop.

I created a .exe from this script with Pyinstaller and put it in my Autostart. Now I have the same experience as with Linux. BTW: At first I used the task bar as my scrolling area but later changed to the top 4 pixels because I wanted to use the same muscle memory on my Linux and Windows computers.

It works like a charm and I can’t understand how someone can work without this simple litte feature 😁

--

--