Managing the wastebasket in GNOME

This is more a personal note than anything else, but I’m putting it here on the off chance that someone else might find it useful.

I noticed that the wastebasket on my PC desktop had become rather full. This is both inevitable and unsurprising given that, by default, deleting files sends them to the wastebasket and then leaves them there. Forever.

I want to be able to clear out these deleted files, but not all of them because I sometimes need to go back and recover what I have deleted. Fortunately, a solution exists in the form of trash-cli, a command line interface that allows you to manage the FreeDesktop trash folder.

The package provides several commands, the most useful of which for me is the trash-empty command, which not only allows me to permanently delete trashed files, but also to specify how many days to keep. I played around with it a bit and it does exactly what it promises to do.

Being lazy, I have also scheduled this to run every Monday so that I can start the week with nothing more than a month old in my wastebasket. This should ensure that things remain a bit more manageable in future.

NVIDIA

A quick update to my previous post. The excessive CPU issue returned and, after some poking around the problem proved to be the NVIDIA graphics driver, which doesn’t play nice with Wayland.

Fortunately, the resolution is simple: You simply need to edit /etc/gdm/custom.conf and uncomment the line that says WaylandEnable=false.

And now, everything appears to be working as expected.

Give me convenience, or give me death

GNOME Foundation partners with Purism to support its efforts to build the Librem 5 smartphone

The GNOME Foundation has provided their endorsement and support of Purism’s efforts to build the Librem 5, which if successful will be the world’s first free and open smartphone with end-to-end encryption and enhanced user protections.

Emphasis mine.

My GNOME desktop is great and provides a UI that could easily be ported to a mobile device. I would certainly like to see a truly open smartphone succeed. However, I am skeptical of the chances of this one, not for any technical or functional but because of the sheer size of the Android and Apple ecosystems.

Anyone trying to get into the smartphone market faces the same Catch-22: the user base isn’t big enough to appeal to app developers and the paucity of apps deters people from migrating to the platform.

The current duopoly is not fixed forever, but it will take a company the size of Samsung to break it.

Learning Genie with Project Euler

I’ve recently started playing around with the Genie programming language. This is a variation of Vala but with a more Pythonesque syntax. And I do like Python.

Genie is a compiled language that uses the Vala compiler to produce C code which then compiles to an executable binary. This means that it has less overhead than programs written in Python and should run faster. This is not always a consideration but it can certainly be useful.

The inevitable Hello World program looks pretty simple:

[indent=4]
init
    print "Hello World"

The only problem I’ve found so far is that there appears to be a dearth of “Teach Yourself Genie” resources, either online or off. This is not helped by some of the results that come up when you search for “Genie” or even “Genie Gnome”.

So I’ve decided to have another crack at Project Euler. I have already solved a fair few of these problems in Python, if I can re-implement the same solutions in Genie I will count myself as having made some progress.

One down, 592 to go.

Gnome 3.16: A First Impression

I ran a system update today and Gnome 3.16 turned up. Which was nice.

One thing that I always found mildly annoying in Gnome 3.14 (and I think that this was also true of Gnome 3.12) was that when I clicked the shutdown button it would give me a choice between shutting down or logging out. If I wanted to reboot, I had to log out first and then reboot from the login screen.

So, wondering if anything had been done about the shutdown options, I clicked on the shutdown button.

And my laptop shut itself down.

10/10 for simple behaviour. Minus about 30 for being totally unexpected.

MTB: Quick Update

I mentioned, earlier this week, that I have finally gotten around to rewriting my simple background switcher so that it actually works under Gnome 3. At the time I was intending to tidy up the code a bit first and then push it all to the master branch.

Well, I haven’t gotten around to making the changes I intended (yet), but have pushed it to the Master anyway. The current development branch for MTB is 0.3 and, as soon as I have some time, I will see about making it all work a bit more generically.

MTB: A simple background switcher for the Gnome Desktop environment

Two years ago this month, I knocked together a simple background XML powered background switcher for Gnome 2.

Time marches on, Gnome 2 was replaced by Gnome 3, and I kept on intending to update the background switcher so that I could keep on using it. But instead, I’ve rewritten it.

I actually posted the basic script on here last month, but have since extended the functionality somewhat. You can find the latest version of MTB on GitHub (on branch 0.3, for now) and, once I have tidied it up a bit I will push this to the master branch. Because I’m a natural hoarder, I have hung on to the code for the Gnome 2 version of this – which can be found on branch 0.2, obviously enough.

I have also updated the MTB Project Page on this site. Since the instructions here were simply copied and pasted from the README file, I have removed the online duplicates to avoid confusion.

Managing startup applications in Gnome 3

I’m sure this used to be on a menu but now, if you want a GUI to get at your start-up applications, you need to enter the following command in a terminal.

gnome-session-properties

The interface is (inevitably) minimal so there really isn’t much for me to add other than to file this under Note To Self.

MTB3: Yet another (very simple) background switcher for Gnome 3

Way back when I started playing around with Python, one of the first applications I wrote was a transitioning background application. It worked quite nicely, but it was very tied to the Gnome 2 way of doing things and not particularly suited to a conversion to Gnome 3.

So now I have a simplified version which (after a bit of frustration) works quite nicely by simply displaying a random picture from my ~/Pictures/Backgrounds folder. The script, as it stands, looks like this:

#! /usr/bin/python
""" Yet another, veryt simple background switcher for the Gnome 3 Desktop

 mtb.py
 Copyright (C) Paul Pritchard 2013 
 
 MTB3 is free software: you can redistribute it and/or modify it under the 
 terms of the GNU General Public License as published by the Free Software 
 Foundation, either version 3 of the License, or (at your option) any 
 later version.
 
 MTB3 is distributed in the hope that it will be useful, but WITHOUT ANY 
 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License along
 with this program.  If not, see ."""

import os
import random
import mimetypes

backgrounds = os.environ['HOME'] + "/Pictures/Backgrounds/"
pictures = []

for filename in os.listdir(backgrounds):
    mimetype = mimetypes.guess_type(filename)[0]
    if mimetype and mimetype.split('/')[0] == "image":
        pictures.append (filename)

picture = random.randrange (0, len(pictures))
fullpath = '"file:///' + backgrounds + pictures[picture] + '"'
os.system("DISPLAY=:0 GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-uri '%s'" % (fullpath))

I then put a short script in /usr/local/bin so that I could execute it with the mtb command and, since everything was working swimmingly, I turned to cron to launch the app every 20 minutes.

The crontab line looks like this:

*/20 * * * * mtb

And it works, even if I have spent far too long finding my way around gsettings.

There are a couple of points worth noting, if only for my own future sanity.

Firstly, gsettings needs to know what screen to run on. This is fine when the command is executed from a terminal because it knows to run on the screen the terminal is sitting in. But when launching the same command from crontab, there is no terminal. You need, therefore, to include the DISPLAY=:0 GSETTINGS_BACKEND=dconf to tell gsettings where to run.

Secondly, the crontab environment settings are not always as complete as those found in Bash. So while I am able to enter just the command in Frugalware, other distributions may require you to use the full path to the command.