Getting Mac-Like Workspaces on Ubuntu 17.04

22 Apr

Intro

If you do software development on a laptop like me, you know the struggle. You’ve got the editor, the program, the project specs, a few file browsers, a dozen docs, a terminal or two, ssh, and some debug tools, but all you’ve got for displays is one tiny peephole of a screen. Buried alive in windows your work flow is more of a work farce. You can’t get any thing done like this.

What is one to do? You could use a fancy tiling window manager (you know the ones with all the key combos), But your touch typing isn’t all that great; you’re not ready to ditch the mouse. What about workspaces? Ah, now that has promise. It’s like having several monitors to spread things out. You can have all the room you need. However, you will need some way of switching between workspaces. You could use the keyboard shortcuts, but Ctr+Alt+Left and Ctr+Alt+Right are so far from the home row and they take both hands to type. Besides didn’t we just say we’re not ditching the mouse? You could put a button on the task bar. That might be okay, but it takes up screen space and you have to go and click it every time.

We can do better. If you have a multi-touch track-pad you can control your window manager with swiping gestures. MacOS already has this built in. With three fingers swiping left or right switches workspaces and a swipe up spreads the widows. In order to get the same functionality in Linux we will need to install Fusuma. Fusuma runs in the background and translates multi-touch gestures to keyboard shortcuts.

TL;DR

It can be frustrating using many windows on a small screen, but multiple workspaces can give you the space you need. Install Fusuma to help you switch between workspaces very fast.

Setting Up Workspaces

First you need to setup your workspaces. By default Ubuntu 17.04 uses 4 workspaces in a square. This will not work for us since we plan to only switch left and right not up or down. I recommend using four workspaces in a single row. To set this up just run the commands:

$ gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize 4
$ gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ vsize 1

If you want more or less workspaces just run:

$ gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize <put your number here>

Installing Fusuma

Dependencies

Fusuma needs libinput-tools to read mouse events and xdotool to generate keyboard events. Fusuma is also a ruby program and is managed with gem so you’ll need ruby as well. These can all be installed with apt:

$ sudo apt install libinput-tools xdotool ruby

Permissions

Fusuma will also need permission to read from /dev/input. You could run it with sudo but that would require a password every time. A better solution is to add yourself to the input user group.

Installation

Once you have the dependences just install Fusuma with:

$ sudo gem install fusuma

Later on you can update Fusuma with:

$ sudo gem update fusuma

Configuring Fusuma

Fusuma’s default config location is ~/.config/fusuma/config.yml. You will need to create this directory and file yourself. The quickest way to do this is:

$ mkdir ~/.config/fusuma
$ cat > ~/.config/fusuma/config.yml
<paste config text here>
^C

For your config I recommend:

swipe:
  3:
    left:
      shortcut: 'ctrl+alt+Right'
    right:
      shortcut: 'ctrl+alt+Left'
    up:
      shortcut: 'super+w'
    down:
      shortcut: 'super+w'
pinch:
  in:
    shortcut: 'ctrl+plus'
  out:
     shortcut: 'ctrl+minus'

threshold:
  swipe: 0.5
  pinch: 0.25

interval:
  swipe: 0.2
  pinch: 1

This will give you similar functionality to macOS.
If you ever edit this config you will need to restart Fusuma.

Running Fusuma

From Command Line

You can run Fusuma with the command fusuma. However this will kill Fusuma if you close the terminal. A better way is to do:

$ nohup fusuma &

This will run Fusuma as if it were a daemon and will let you close the terminal.

Automatically

In order to make Fusuma run automatically on login just add it to your startup applications with the name “Fusuma” and the command fusuma. You don’t need nohup here.

5 Replies to “Getting Mac-Like Workspaces on Ubuntu 17.04

  1. Joshua,

    Thanks for posting this. I hope you don’t mind if I share it with others. Please let me know if I can.

    Thanks again.
    JWS

  2. hello! mein does not start when login. i added it into startup applications, it runs on login in the background but not working. where is the problem? thank you.

    • There are many things that might have gone wrong, but without more information I cannot tell you which. Try running Fusuma from the command line without daemonizing it. First kill Fusuma if it is running then on the command line run:

      $ fusuma

      This might give you some error messages which could tell us what is wrong.

Leave a Reply