Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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
#!/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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.