You are not logged in.
Hi. I would like You guys to help me. I don't want to use fusion-icon (many complex reasons I wouldn't like to state here, just please take it for granted) and I'd like to bind a key combination for a command which would let me replace compiz with metacity and the other way round. So I think I need a script.
What I'd need:
detect if compiz is running
yes -> metacity --replace
no -> compiz --loose-binding --replace
Can You help?
Last edited by warnec (2010-06-23 19:38:46)
Offline
here's a rough, untested stab at it:
#!/bin/sh
if pgrep -x metacity &> /dev/null; then
compiz --loose-binding --replace &
else
metacity --replace &
fi
the pgrep call might need to be a bit more specific for a multi-user system
"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page
Offline
it doesn't seem to work. When I've got Compiz running and use this script, the screen flickers, but Compiz still works. I suspect
compiz --loose-binding --replace
is ran even if Compiz is running.
Offline
dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/dbus/screen0 org.freedesktop.compiz.list | wc -l
This will return 0 if compiz isn't running.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
#!/bin/bash
if pgrep compiz > /dev/null; then
metacity --replace &
else
compiz --loose-binding --replace ccp &
fi
This should work
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
The scripts by mojlac024 replaces compiz by metacity when compiz is running, but when metacity is running it doesn't bring compiz back.
How to incorporate that test:
dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/dbus/screen0 org.freedesktop.compiz.list | wc -l
into the script?
PS.:
When compiz is running, it prints 1. But when compiz is not running, it prints:
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.compiz was not provided by any .service files
0
So a simple logical test of "is this 0 or not?" won't work, I'm afraid.
Last edited by warnec (2010-06-23 17:01:44)
Offline
if [ $(dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/dbus/screen0 org.freedesktop.compiz.list 2>/dev/null | wc -l) -eq 0 ]; then
metacity --replace &
else
compiz --loose-binding --replace ccp &
fi
Offline
it just stops compiz and starts it again.
EDIT: Wait! It just noticed it works fine.
The only thing which caused me to think it wasn't working was my stupidity - in CCSM I bound Shift+F11 to the script, so the shortcut called the script only when compiz was running - with metacity, ccsm isn't working.
Thanks for all Your help, guys.
for binding shift+f11 to the script, I used xbindkeys.
Last edited by warnec (2010-06-23 19:38:31)
Offline