LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-03-2010, 11:48 PM   #1
samineru
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Rep: Reputation: 0
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. So...how do I do it?
 
Old 05-04-2010, 02:16 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
you don't.
 
0 members found this post helpful.
Old 05-04-2010, 02:31 AM   #3
samineru
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Original Poster
Rep: Reputation: 0
I did more research on my own, and found the key in gconf that has the hsize of my desktop, it was:
/apps/compiz/general/screen0/options/hsize

Last edited by samineru; 05-04-2010 at 02:31 AM. Reason: Made clearer, less rude
 
Old 05-04-2010, 02:43 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by samineru View Post
I did more research on my own, and found the key in gconf that has the hsize of my desktop, it was:
/apps/compiz/general/screen0/options/hsize
If you change it does that do what you wanted?
 
0 members found this post helpful.
Old 05-04-2010, 02:54 AM   #5
samineru
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Original Poster
Rep: Reputation: 0
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
Code:
value = get foo
set foo = value-1
 
Old 05-04-2010, 03:04 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Code:
#!/bin/bash

file=/apps/compiz/general/screen0/options/hsize

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

read n_workspaces < $file
if [[ $1 = up ]]; then
    let n_workspaces++
else
    let n_workspaces--
    [[ $n_workspaces -lt 1 ]] && let n_workspaces=1
fi
echo $n_workspaces > $file
EDIT: to put the output from a command into a variable
Code:
var=$( some command 2>&1 )
The 2>&1 is only necessary if the command writes to standard error instead of standard out.

Last edited by catkin; 05-04-2010 at 03:07 AM. Reason: get->put
 
1 members found this post helpful.
Old 05-04-2010, 03:56 AM   #7
samineru
LQ Newbie
 
Registered: Apr 2010
Posts: 15

Original Poster
Rep: Reputation: 0
That's great thank you so much! One of my friends also whipped up this:
Code:
#!/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.
 
  


Reply

Tags
command line, compiz, gnome, ubuntu, workspace



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change workspaces with mouse in gnome GT_Onizuka Linux - Software 8 07-29-2007 04:30 PM
Change Partition Number, does UUID change? aragon127 Linux - Software 1 11-24-2006 12:11 PM
how to change tuner number from command line? mac1234mac Linux - Hardware 4 03-19-2006 09:34 AM
iNode number, how does it change? saudoi Solaris / OpenSolaris 4 05-22-2005 04:38 AM
change number of ttys wrat Linux - Newbie 1 06-15-2004 08:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 10:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration