Deprecated: Assigning the return value of new by reference is deprecated in /home/content/27/11020327/html/wp-settings.php on line 267

Deprecated: Assigning the return value of new by reference is deprecated in /home/content/27/11020327/html/wp-settings.php on line 269

Deprecated: Assigning the return value of new by reference is deprecated in /home/content/27/11020327/html/wp-settings.php on line 270

Deprecated: Assigning the return value of new by reference is deprecated in /home/content/27/11020327/html/wp-settings.php on line 287
New Machine and Being Stuck in Linux Theming Hell | ProDevTips - Web Development Tutorials

New Machine and Being Stuck in Linux Theming Hell

Oh Jesus, where to start?

I bought a new custom desktop machine, the old mantop one (why “mantop”?, because no woman would ever buy it, let alone lug it around) has been working fantastic, lately running Lucid with GNOME 2 and Compiz. The new one is my first with SSD drives, has a freakish Nvidia card (GTX660-DC2T-2GD5) that will be able to handle three screens (if I should so want) and all in a small form factor (Mini ITX motherboard, Asus P8H77-I Socket LGA1155, it’s running on an Intel chip, apparently very important), 16GB RAM (apparently these small boards don’t take more). It’s almost like a Mac Mini! Erhm, not really but could work as a carry on. I bought it from invadeIT, great online shop, buy from them if you live in Thailand.

As an aside, 2008-2009 was the golden age of the mantops, it felt like various manufacturers were competing in who could make the biggest and baddest one, HP had some freakish things in a small but probably lucrative market (they probably hoped, these things weren’t cheap so I wonder what kind of margins they were dreaming of) that Sony must’ve wanted in on, or test. My AW11Z has an 18.4″ screen with full HD resolution and there is some base in the speakers if you listen carefully.

I bought the biggest Case Logic I could find but I still had to wiggle and press to get it in there with the whole bag looking malformed after zipping it. Anyway, the market must’ve been too small because they haven’t been building anything like this ever since and probably never will, a pity. No scale no pay…

So the first thing I did on the new machine was to try out Ubuntu 12.04, Unity is nice and all but for some reason Compiz felt very sluggish. I ended up downloading the 310.44 binary and doing a manual install, BAM! no X anymore. Don’t do the manual install! I’ve done it a few times, half of the times the machine ended up without X, the rest of the times the performance actually got worse. So instead of trying to get my kernel back to normal I opted to try a different Ubuntu based distro as the Ubuntu install process is so smooth and quick nowadays. Enter Linux Mint 13 MATE edition. I install it, login, looks like GNOME 2 (but with some nice extras), nice. I install my favourite theme and icons. Lyrae and Mattahan are real giants doing awesome work to further Linux as a desktop that doesn’t have to look like yet another Windows/Mac like clone.

And therein probably lies my rub probably, at least on a kind of abstract level, it seems that all of the big projects, KDE4, GNOME 3 and Unity are walking down that path towards something that tries to be slick and clever but in the end tells you to like it, or fuck off. If increased adoption of said solutions is the goal, and it sure is in the case of Canonical’s Unity as they are getting more and more commercial (a development I totally support btw), then it kind of makes sense. If Unity can work as a gateway to make people do the switch, nothing will stop them from using Ubuntu One and the Ubuntu Software Center if they later make the switch from Unity to something more customizable, for Canonical it doesn’t matter.

But it costs money for Canonical, money that might be better spent trying to develop something that can compete with Adobe PS and MS Office. I would definitely pay for those two Software Center downloads. Or maybe they’re on to something big with this Mir thing, (X server replacement which will result in no more Compiz, grr). More devices being able to access the software store equals more profit. Whatever replaces Compiz on Mir will probably not be as customizable.

In the end the future probably belongs to Compiz, Enlightenment and Openbox. At least when it comes to user base. Sooner or later I will take the time to try out Enlightenment and Openbox. Anyway I’m glad I took the time to see what all the damn fuss is about with regards to the three big projects, I get it but in the end the theming changes in GTK became a much bigger issue for me. With Linux you will never want for a lack of window managers, widget systems though seem to be a tougher nut to crack, seems like we’re stuck with Qt and GTK, those two are really the big boys and when they change there is no escaping the repercussions.

Over to the details of the whole GTK2 vs 3 mess. I was thinking wtf is going on with some of the apps after fooling around a bit in Mint. Apparently the devs have started upgrading to GTK3, and apparently this new version has switched config format to CSS, so the apps looked like shit in Reuben, an example is Rhythmbox, the music player of my choice, damit, damit. What to do? After some googling I discover that there is a new tool that let’s you style stuff all over the place, GTK3/2 bla bla, you name it, perhaps a solution. But no, it ended up screwing up MATE and I couldn’t get my panels or Reuben theme back. Seems like something you use to try and get GTK2 apps to look good when you’re running a GTK3 theme in GNOME3 or something, not the other way around, so be warned. I totally understand the reason to port the config stuff from some unique formats to CSS but the problem doesn’t go away just because I feel a little bit better about it.

At this point I figure what the heck let’s try out KDE4, let’s see what Kwin has on Compiz, nothing actually, it’s got Scale and Expo, that’s about it. I install Compiz and do compiz –replace and it actually works but screws up plasma so the panel would have to be replaced and why bother? Instead, what had GNOME 3 to offer? I kind of liked the interface where you search and get the results in the middle and you have the desktops to the right and all, cute but that’s all it is. Here the Unity/Compiz combo is a much better alternative for anyone who cares about productivity.

So I cleared out all display related configs from my home folder and logged back into MATE again, eventually I realized that I could simply drop a gtk-3 folder (from an existing GTK3 theme) in the existing folder of my current theme to make for instance Rhythmbox look better. Problem was that Reuben hasn’t been ported to gtk-3 yet (I might give it a go at some point if lyrae doesn’t care, just messaged her, we’ll see what happens). I fiddled around trying to find some GTK3 themes I could “hijack” this way for a while before I gave up, what I found that was promising didn’t come close enough to be acceptable, probably not enough themes yet.

Over to my current Compiz setup and how to get there in MATE.

First of all, update APT so you get as new Nvidia binaries as you can get and install them through for instance Synaptic, I currently have 310.14, they’re solid like a rock.

Then follow this tutorial.

At this point I couldn’t get Reuben to be the window decorator for Compiz, here’s how to force it (note: it’s the second answer, the first answer brings up that damn tweak tool again). Note that you need to actually configure Compiz before you turn it on for the first time. Window Decoration and Move Window are musts.

Let’s discuss my present Compiz config to see why Kwin and Mutter don’t even come close.

General Settings: under the Focus & Raise Behaviour I’ve unchecked Click To Focus, this is very important as you will see shortly. Under Key bindings I’ve mapped mouse Button9 to close a window, it’s the lower of two extra buttons on the side of my Logitech Anywhere Mouse MX, I simply click that button and it closes the window underneath. Maximize Window Vertically is something I use a lot so I’ve set it to Right Ctrl + Up Arrow, my screen is so big 2560×1440 that I rarely have the need to mazimize completely but I have it under Shift+Ctrl+Mouse1. Show Desktop is mapped to the lower right corner to enable a quick flick of the hand to show it. I’ve set a total of 4 desktops under Desktop Size, arranged in a two by two grid.

Expo is triggered by going bottom left with the mouse pointer, that’s all you need, then you get all the desktops and just pick one by right clicking, forget about spinning cubes and what not. Talking about the devil, I still have Desktop Wall activated though because it allows me to move (and move windows) from desktop slightly more quickly than Expo. Sometimes I’m in a kind of “keyboard mode” and then the Wall enables me to switch between desktops without reaching for the mouse. However, with Expo you can also move windows between the desktops. Trailfocus is an important one, normally I would use Dim Inactive (AKA ADD Helper) but it has turned buggy so Trailfocus it is for me even though the trailing effect is not really wanted.

What is wanted though is the ability of inactive windows to become partially transparent. This feature in combination with the fact we don’t need to click to raise windows will increase the effective screen real estate by order of magnitudes when it comes to certain activities. It could be for instance a code editor above a browser window which contains a tutorial, the only thing required in that situation to change context is a lazy move of the mouse over to the browser window, no click required. This move would then make the coding window transparent, allowing for reading of the tutorial beneath the editor, and so it goes, back and forth, no clicks. Another common situation is a terminal and a browser window.

Group and Tab Windows is another important feature. Not the grouping itself but the ability to tab only specific windows, this one is extremely useful as it let’s you create what amounts to a partitioned application switcher. Great for when you’re actually coding hard and need to for instance quickly switch from editor to terminal quickly back and forth, a time when you don’t want to reach for the mouse at all. Simply a must for mouse haters all over the world. Apart from that I use Scale and the Scale Addons and the Static Application Switcher.

Place Windows is also a must if you have a dual screen setup, otherwise the windows will always appear on the left screen and that might not be what you want.

Next up was getting rid of DuckDuckGo. I’ve got no beef with the Mint creators trying to earn some cash but DuckDuckGo is a serious NoGo.

As it happens I like the Ubuntu fonts, here’s how installing them and more.

Next up was styling the awesome Terminator. Here is my current config:

  title_receive_bg_color = "#e8e6de"
  title_transmit_bg_color = "#e8e6de"
  title_receive_fg_color = "#000000"
  title_transmit_fg_color = "#000000"
  title_inactive_bg_color = "#e8e6de"
    palette = "#909fa3:#a99898:#47391a:#beb58e:#929aa5:#a195a3:#8d9d9d:#8c7b7b:#1a2b32:#3b1a1a:#253d0f:#3d2710:#233543:#3b1d3f:#273f3f:#392121"
    use_system_font = False
    cursor_color = "#8a8a8a"
    foreground_color = "#000000"
    font = Ubuntu Mono 12
    background_color = "#edeae2"
      type = Terminal
      parent = window0
      type = Window
      parent = ""

But what happened with the Rhythmbox problems? As it happens Banshee 2.4.0 doesn’t use GTK3 (and therefore looks good) so if I could just move all my ratings in RB to Banshee I would be set, I locate the RB database (XML) and the Banshee database (SQLite3). Shit, not an easy copy paste and some search replace work. Here’s how I solved it in PHP:

$db = new PDO('sqlite:/home/henrik/.config/banshee-1/banshee.db');
$r = new SimpleXMLElement(file_get_contents('/home/henrik/.local/share/rhythmbox/rhythmdb.xml'));
foreach($r->xpath("//entry") as $e){
	$arr = (array)$e;
		$sql = "update CoreTracks set Rating = '{$arr['rating']}' where Title = '{$arr['title']}'";
	//echo $sql."\n";

An apt-get install php5-sqlite was required to get it to work. But damn look at that code, it perfectly captures the amazing power of other people’s work (and abstractions). Imagine the amount of hours of work put into PDO and SimpleXMLElement that lets me fetch exactly the info I want from an XML file and then insert it into an SQLite3 database in 8 lines of code. This is the magic of software development in a nutshell, you simply get that huge investment for free! A “real world” analogy would be if I wanted to improve the road to my house for instance. Magically from nowhere someone would just show up and be like hey take this Caterpillar, but not only that, I would just have to flip a few switches and the machine would do all the work by itself, and I would pay 0 for it. It’s simply mind boggling.

So I start playing my by-rating-sorted music library and realize that the FN + F12 (forward button) combo on my keybord won’t play the next song, fuuuuuuu… Compiz to the rescue again in the form of General -> Commands. The command banshee –next is now mapped to Ctrl+Super+Right Arrow, rinse and repeat for –previous, –stop and –play.

Now for some more work related stuff, you’re done reading now if you’re only interested in the desktop environment stuff. If you’re a web dev you probably know that standard MySQL doesn’t cut it anymore, to be cool (and fast) you need to run Percona or TokuDB on MariaDB. I have opted for Percona but there are some problems with install, adding their PPA and simply doing apt-get resulted in unmet dependencies for me, here is the solution:

wget -r -l 1 -nd -A deb -R "*dev*"

Install them in one command:

$ sudo dpkg -i *.deb

The installation won’t succeed as there will be missing dependencies. To handle this, use:

$ apt-get -f install and all dependencies will be installed and the Percona Server installation will be finished by apt.

Run sudo dpkg -i *.deb again.

And btw, the new machine flies, wow. The SSD technology is really THE IT improvement of the decade, the biggest bottleneck isn’t much of a bottleneck anymore.

Related Posts

Tags: , , , , ,