4

[Running Ubuntu 14.04, Unity]

So, I have workspaces enabled and all that jazz. I know one can set some option so that Ubuntu defaults to more than four workspaces—but that's not what I want.

Currently, I'd like a fifth workspace, but only temporarily (that is, I don't want it to be the default that five open. I just want it for today, and possibly w/e other day I need it).

Is there a way to do this?

5
  • 1
    I imagine you are using Unity (default Ubuntu flavor); better you specify this in your question, because this question is desktop-environment dependent. Using Ubuntu Gnome, for example, workspaces are dynamic --- created or destroyed on the fly. I hated it at first, now I really like it...
    – Rmano
    Aug 21, 2014 at 16:45
  • Do you have any particular way you would like to activate / deactivate the extra workspace? Nov 6, 2014 at 7:37
  • @JacobVlijm Ideally, I'd like to press a hotkey, but it doesn't matter that much to me. Nov 6, 2014 at 14:00
  • Good to see the question is still "alive". I posted my answer. Nov 6, 2014 at 15:43
  • I ran into this answer / question from a while ago. Could you tell me how it ended? Did any of the answers work? Feb 19, 2015 at 16:46

2 Answers 2

2

The script below allows you to keep two different sets of worspaces. If you place the script under a shortcurt key, you can toggle between the two sets:

normal workspaces -

enter image description here

extended workspaces -

enter image description here

How to use

  1. Copy the script below into an empty file. In the head section, define the "normal" situation in rows / columns:

    normal = (2, 2)
    

    and the "extended" situation you'd like to see in rows / columns:

    extended = (2, 4)
    
  2. Save the script as manage_workspaces.py. Test if it does want you want it to do by running the command:

    python3 /path/to/manage_workspaces.py
    

    When you run the command, the workspace setup should toggle between the two sets, and a message should appear in the notification area (see the pictures above)

  3. If all works well, add the command to run the script to a shortcut key of your choice: Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts"
    Click the "+" and add the command:

    python3 /path/to/manage_workspaces.py
    

    The script:

    #!/usr/bin/env python3
    
    import subprocess
    
    # default situation rows / columns
    normal = (2, 2)
    # extended set of workspaces
    extended = (2, 4)
    # commands to read the current state
    key = "/org/compiz/profiles/unity/plugins/core/"
    read_hor = "dconf read "+key+"hsize"; read_vert = "dconf read "+key+"vsize"
    hor = int(subprocess.check_output(["/bin/bash", "-c", read_hor]).decode("utf-8").strip())
    vert = int(subprocess.check_output(["/bin/bash", "-c", read_vert]).decode("utf-8").strip())
    # take action, depending on current state
    if (hor,vert) == normal:        
        set_h = "dconf write "+key+"hsize "+str(extended[1])
        set_v = "dconf write "+key+"vsize "+str(extended[0])
        message = "notify-send 'set to extended workspaces: "+str(extended[0])+" x "+str(extended[1])+"'"
    else:
        set_h = "dconf write "+key+"hsize "+str(normal[1])
        set_v = "dconf write "+key+"hsize "+str(normal[0])
        message = "notify-send 'set to normal workspaces: "+str(normal[0])+" x "+str(normal[1])+"'"
    for item in (set_h, set_v, message):
        subprocess.call(["/bin/bash", "-c", item])
    
0
0

I have a outdated PPA that might work but the workspace is not temporarily available. So to disable/enable you must go to the application.

PPA: deb http://ppa.launchpad.net/tualatrix/ppa/ubuntu jaunty main

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .