KDE, Linux, OpenSuse, Uncategorized

Compiz works great with KDE 5

Compiz was pretty much “the thing” that got me started with Linux. Whenever it comes up on online forums, there are usually a few people who say the same thing. When KDE 5 and Gnome 3 made their own compositors and window managers a lot the Compiz functionality was replaced. Most people seem to be content with this and Compiz was regarded as a thing of the past. When KDE 5 and Gnome 3 first came out Compiz was completely incompatible. Now it is possible to get Compiz running on both.

I’ve always felt that Compiz offered a lot more and was generally more useful than the KDE effects. Today I found out, it really isn’t that hard to get Compiz working in KDE 5 with Plasma.

I’m using Open SUSE but you should be able to find these packages in whatever distribution you are using.

Compiz is the window manager, Emerald is the window decorator, Compizconfig Settings Manager is the configuration tool, and Fusion Icon sets everything up.

You’ll want to disable KDE’s desktop effects. Search “Compositor” in your application menu and disable “Enable compositor on startup”.

Search “Autostart” in your application menu. Add fusion-icon to run on startup. Run fusion-icon from a terminal or the applications menu, and you should be able to change your window manager to Compiz. Right click the Fusion icon and choose “Select Window Manager”. Once that is set, it will replace your window manager on startup. From the Fusion Icon, you can set your Emerald Theme and Compiz settings.

If you log back in and you don’t have a desktop, or your desktop is blank, this is easy to fix. The blank desktop issue seems to happen if Compiz loads too fast. Replacing the autostart fusion-icon command with a script with the contents sleep 5; fusion-icon seems to give KDE enough time to load the desktop before Compiz loads. Compiz still starts while KDE is loading, so you don’t see a hacky switch in window managers 5 seconds into your desktop session.

If you want to use the “Windows Previews” plugin in Compiz, you may see two window previews when you hover over your task manager if KDE’s window previews are turned on. To disable this, right click your task manager, click “Task Manager Settings” and uncheck “Show Previews”.

So why even use Compiz? One of the main features for me is, just by holding down shift while switching desktops, I can bring the window with me while moving to different sides of the cube. I’ve never been able to find a way to do this in KDE. There are also a lot more features, plugins, and themes.

A lot of it seems frozen in time. A lot of the Emerald themes I remember from 10 years ago. But they still work fine

I think Compiz was good for the Linux community. It got a lot of people talking about Linux and a lot of people using Linux. It is kind of unfortunate that it was shut out by the big two desktop environments. When Compiz was popular, I remember seeing new plugins in the Compiz settings manager every few weeks. It has been years since KDE 5 was released and there are hardly any plugins for it’s “Desktop Effects”.

I know a lot of Linux users dismiss Compiz as pointless “bling”. Even if this was true, people were sharing Compiz videos and people were trying Linux just for Compiz. I think it would of been better if Gnome and KDE didn’t shut Compiz out.

Whatever the issue was with KDE 5, it seems to be fixed. With Gnome, even though most online posts say it is impossible to run Compiz, it has been reported to work if you start Gnome in “fallback mode”.

Code, Django, Uncategorized

Making django-sitetree’s Display Permissions Show Access Denied

I like django-sitetree for what it is. There aren’t any other modules with as many features. One thing that bothers me is the permissions options just hide links. Anyone with a URL can still go to pages they aren’t allowed to. If this is how you are doing security for your site this can be a huge security risk.

Using custom middleware you can use django-sitetree’s own methods to check if you should show a page.

First, if you have multiple sitetrees come up with some logic to decide what sitetree you should look up based off the path.

If have:
alias = 'control_panel' if 'control_panel/action' in request.path else 'main_menu'

This makes it use the ‘control_panel’ sitetree and the ‘main_menu’ sitetree if ‘control_panel/action’ is not in the path.

Next make a middleware class based of whats below. Pay attention to the alias line you made earlier and replace it:

from sitetree.sitetreeapp import SiteTree, get_sitetree

class CheckAccessMiddleware(object): 

def process_request(self, request):
tree = get_sitetree()
context = SiteTree.get_global_context()
context['user'] = request.user
context['request'] = request
------REPLACE THIS------
alias = 'control_panel' if 'control_panel/action' in request.path else 'main_menu'
------REPLACE THIS------
tree.init_tree(alias, context)
page = tree.get_tree_current_item(alias)
if page:
    access = tree.check_access(page, context)
    if not access:
         # This should happen very rarely. A user will not
         # be shown a URL they don't have access to
         from django.core.exceptions import PermissionDenied
         raise PermissionDenied

Add this class to you MIDDLEWARE_CLASSES in settings.py. That should be it. If a path is not in your sitetree it won’t do anything. So make sure everything sensitive is in the sitetree. Don’t have items in your sitetree without a trailing slash and a trailing slash in your urls.py. Django will just redirect to the URL with the trailing slash and this will be run on the URL that does not exist in your sitetree.

One other thing of note, when looking through django-sitetree’s code I noticed they put the requests in a global variable and access it though a singleton. It seems to me that doing that is a definite no no as requests could bleed from one user to the other. I’m not well versed enough in how Django splits up requests among processes to know. It just doesn’t feel particularly right.

Elementary OS, Linux, Uncategorized

Updates to Relay

I pushed out some updates to Relay. You can find the changes on Github or Launchpad. Relay is an elegant and sleek IRC client designed for Elementary OS but will work on any Linux OS.

Relay will try to switch to a theme that looks good. You can now disable this by passing the -t option.

I also added better Unicode support and fixed an issue that was causing it to close prematurely.

Here is what Relay looks like. Its one of the nicest looking IRC clients out there.

Screenshot from 2015-07-04 13:52:24