Skip to content

Posts tagged ‘Linux’

Xfce compositing and compton keyboard shortcut toggle

In a previous post we addressed a simple way of enabling and disabling compositing in Xfce using a shell script. In this post we discuss how to do the same with compton, as well as some additions made to the original script.

So, without further ado, the relevant code:

For compton:

#!/bin/sh
if [ `pidof compton` ]; then
	# Comment the line below to disable notifications
	notify-send -t 400 'Disabled compton' --icon=video-display
	# Kill compton
	killall compton
else
	# Comment the line below to disable notifications
	notify-send -t 400 'Enabled compton' --icon=video-display
	# Start compton as a daemon
	compton -b
fi
exit

The difference here is that it will send a message to the notification daemon. This line may be commented out (or deleted) by those who wish not to have that feature.

To achieve the same for XFWM4 compositing, we must change our old script to the following:

#!/bin/sh
status=$(xfconf-query -c xfwm4 -p /general/use_compositing)
xfconf-query -Tc xfwm4 -p /general/use_compositing
# Comment the lines below to disable notifications
if [ $status = "false" ]; then
	notify-send -t 400 'Enabled compositing' --icon=video-display
else
	notify-send -t 400 'Disabled compositing' --icon=video-display
fi
exit

As before, name the file whatever you wish (I named mine compositing.sh), mark it executable with chmod u+x compositing.sh and assign it as a keyboard shortcut.

Xfce – Set a keyboard shortcut for compositing toggle

I use Xfce as my primary desktop environment, and recently, I found the need to disable and enable compositing on a regular basis. This led to my search for a way to do this via keyboard shortcuts, as it was quite inconvenient to have to open the Window Manager Tweaks GUI each time to simply toggle a check box.

So, I discovered xfconf-query, and upon some further reading, came to this as the quickest possible way of doing it via the command line:

xfconf-query -Tc xfwm4 -p /general/use_compositing

Create file compositing.sh using the editor of your choice, with the following content:

#!/bin/sh
xfconf-query -Tc xfwm4 -p /general/use_compositing

Make the file executable:

chmod u+x compositing.sh

Now open Menu > Settings > Keyboard > Application shortcuts > Add

Voila! Enjoy switching compositing on and off as and when you need to.

The Humble Indie Bundle #3 Is Live

The Humble Indie Bundle #3 is officially live.

You can get 5 classic indie games: Crayon Physics Deluxe, Cogs, Hammerfight, VVVVVV and And Yet It Moves for whatever price you want while helping the Child’s Play Charity and the Electronic Frontier Foundation.

The games being cross-platform mean that they work natively on Linux Mac OS X, and Windows. All games are DRM free, so you can install them as many times as you like and even redeem them on Steam and Desura.

So what’s stopping you? Get your hands on some games and support some good causes in the process.

NinjaVideo.net + Linux

DivX streaming from Ninjavideo.net on windows was simple enough with the installation of the DivX web player. On linux, the old mplayerplug-inused to work fine when used with a greasemonkey script. Recently however this was depreciated in debian testing, and replaced with gecko-mediaplayer.

With the removal of the old mplayerplug-in for firefox, things stopped working! The videos would not load with gecko-mediaplayer (which uses gnome-mplayer rather than mplayer), and so after some investigation I was able to find a bug report where someone was having similar issues.

It appears to have been fixed in the latest release, but it is not yet in the debian repos. So in order to start using ninjavideo again, you need to compile gnome-mplayer an gecko-mediaplayer. I have keep all my source files in $HOME/src dir simply because it’s easier to manage. You can stick to your habits, or follow the instructions below.


sudo aptitude build-dep gnome-mplayer
sudo aptitude build-dep gecko-mediaplayer
cd ~/src
wget http://gnome-mplayer.googlecode.com/files/gnome-mplayer-0.9.9.2.tar.gz
wget http://gecko-mediaplayer.googlecode.com/files/gecko-mediaplayer-0.9.9.2....
tar xzfv gnome-mplayer-0.9.9.2.tar.gz
tar xzfv gecko-mediaplayer-0.9.9.2.tar.gz

First let’s compile gnome-mplayer:

cd gnome-mplayer-0.9.9.2
./configure
make
sudo make install

Then, gecko-mediaplayer:

cd gnome-mplayer-0.9.9.2
./configure
make
sudo make install

And that’s it, you’re done! Restart firefox, remove/disable any conflicting plugins (e.g. totem, vlc) and ninjavideo should be running as it was!

CentOS5 – yum – cElementTree – Python

So you updated using yum, and lo and behold yum is no longer working. An attempt to use yum gives you the following:


$ yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named cElementTree

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.4.3 (#1, Jul 27 2009, 17:57:39)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

I had this error on a CentOS5 VPS. Now, the fix for this is simple enough. It involves removal of some packages, then re-installing those packages we removed.


rpm -e yum yum-fastestmirror python-urlgrabber python-sqlite python-elementtree
wget http://mirror.centos.org/centos/5/os/i386/CentOS/yum-3.2.22-20.el5.cento...
wget http://mirror.centos.org/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.1...
wget http://mirror.centos.org/centos/5/os/i386/CentOS/python-urlgrabber-3.1.0...
wget http://mirror.centos.org/centos/5/os/i386/CentOS/python-sqlite-1.1.7-1.2...
wget http://mirror.centos.org/centos/5/os/i386/CentOS/python-elementtree-1.2....
rpm -i yum-3.2.22-20.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm python-urlgrabber-3.1.0-5.el5.noarch.rpm python-sqlite-1.1.7-1.2.1.i386.rpm python-elementtree-1.2.6-5.i386.rpm

Of course bear in mind the architecture and versions (depends when you are reading this post!) of the files.

This should get you up and running again.