Jump to content

Switching desktop with a script


Recommended Posts

Have tried both of your suggestions and each does the trick. Many thanks. :thumbs:

Now, with that problem solved, I have just a niggle; when I start an app from a script - e.g. gnumeric - a series of messages appears (errors?) in the konsole running the script, which I would like to suppress. I've tried using '>' but bash ignores that. Any ideas? Thanks.

Edited by satelliteuser083
Link to comment
Share on other sites

Have tried both of your suggestions and each does the trick. Many thanks. :thumbs:

Now, with that problem solved, I have just a niggle; when I start an app from a script - e.g. gnumeric - a series of messages appears (errors?) in the konsole running the script, which I would like to suppress. I've tried using '>' but bash ignores that. Any ideas? Thanks.

Try using the &.
Link to comment
Share on other sites

Was a bit confused, nexus, 'cos substituting '>' with '&' didn't work. However, I found the following site, where all became clear (at least, the bit about stderr did B) )

http://www.cpqlinux.com/redirect.html

Now, using 'gnumeric filename 2>err.txt', there's no error-output. Thanks. :thumbs:

Edited by satelliteuser083
Link to comment
Share on other sites

Was a bit confused, nexus, 'cos substituting '>' with '&' didn't work. However, I found the following site, where all became clear (at least, the bit about stderr did B) )

http://www.cpqlinux.com/redirect.html

Now, using 'gnumeric filename 2>err.txt', there's no error-output. Thanks. :thumbs:

I just thought backgrounding it would surpress any console output. Glad you've got it sorted. :) If you don't need the err.txt file would it not be better to pipe the output to /dev/null? Edited by {BBI}Nexus{BBI}
Link to comment
Share on other sites

Yes, you're correct, of course; '2>/dev/null' works well. Thanks. :D

 

And, following on with this topic, I've come up against another problem. I want to start two apps in different workspaces but the workspace-selection is completed much faster than the app start-up, the result being that they both end up in the same (second) workspace. My script looks like this:

wmctrl -s2
gnumeric filename1 &
wmctrl -s3
kpdf filename2 &

Does anyone know of a way of delaying the execution of 'wmctrl -s3' until gnumeric has completed start-up (or any other way of ensuring that the script acts as desired)? Thanks.

Edited by satelliteuser083
Link to comment
Share on other sites

When I perform the following command in a konsole, it works:

[lawrence@localhost ~]$ dcop kwin KWinInterface currentDesktop
4

The same thing in a script, in an attempt to assign this value to a variable

curws=dcop kwin KWinInterface currentDesktop

fails, with the message

kwin: Unexpected argument 'KWinInterface'

.

I assume that this is a basic script-syntax problem, but I can't see it. Can anyone help me out? Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks, spinynorman, that worked well; just knew it was syntax. ;)

 

And, pmpatrick, 'wait' doesn't do quite what I want; I think that it does wait, but right up until gnumeric is terminated and not (as I want) until the latter is up and running, i.e ready to accept input. I'm now playing with 'sleep'; doesn't work just yet but will report when/if it does.

 

Many thanks to you both. :thumbs: :thumbs:

Link to comment
Share on other sites

I'm not at my linux box at the moment, but you might try something similar to this:

wmctrl -s2
gnumeric filename1 &
while [ $(wmctrl -l | grep gnumeric) -eq '' ]
do
sleep
done
wmctrl -s3
kpdf filename2 &

Edited by Steve Scrimpshire
Link to comment
Share on other sites

It is indeed not available in urpmi, but it is really easy and fast to compile. I suggest you install "checkinstall" first, then install wmctl by replacing the "make install" command with the "checkinstall" command: this will auto-create a RPM for you :)

 

Yves.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...