-   Linux - Desktop (
-   -   Command to change number of workspaces (

samineru 05-03-2010 11:48 PM

Command to change number of workspaces
I'm currently using Ubuntu GNU/Linux with compiz.

I'd like to have a hotkey to change the number of workspaces, just by increasing the width of my desktop by adding or removing 1 workspace at a time. do I do it?

smoker 05-04-2010 02:16 AM

you don't.

samineru 05-04-2010 02:31 AM

I did more research on my own, and found the key in gconf that has the hsize of my desktop, it was:

catkin 05-04-2010 02:43 AM


Originally Posted by samineru (Post 3956499)
I did more research on my own, and found the key in gconf that has the hsize of my desktop, it was:

If you change it does that do what you wanted?

samineru 05-04-2010 02:54 AM

It does, right now I'm trying to figure out how to write a command that will increment or decrement it. I have very little experience in actual scripting...
I know I can use gconftool to get or set keys, but I don't actually know how to

value = get foo
set foo = value-1

catkin 05-04-2010 03:04 AM




case $1 in
    up | down )
    * )
        echo "Usage: ${0##*/} up | down" >&2
        builtin exit 1

read n_workspaces < $file
if [[ $1 = up ]]; then
    let n_workspaces++
    let n_workspaces--
    [[ $n_workspaces -lt 1 ]] && let n_workspaces=1
echo $n_workspaces > $file

EDIT: to put the output from a command into a variable

var=$( some command 2>&1 )
The 2>&1 is only necessary if the command writes to standard error instead of standard out.

samineru 05-04-2010 03:56 AM

That's great thank you so much! One of my friends also whipped up this:

#!/usr/bin/env bash
# the backticks tell bash to store the shell output of the enclosed command into the variable "number"
number=`gconftool --get /apps/compiz/general/screen0/options/hsize`
# the $(()) syntax apparently tells bash to do math on the stuff inside
numberInc=$(($number + 1))
# this is just running the right command, but pasting the calculated number onto the end of the command line
gconftool --type Integer --set /apps/compiz/general/screen0/options/hsize $numberInc

This one seems a little simpler, but thank you for taking the time to write that for me.

All times are GMT -5. The time now is 09:33 PM.