learn how to do one minute hacks, in three minutes

I write this technical blog for you to enjoy, and to help me remember. So where do I get all this knowledge? I figure it out! Here’s how I learned to fix a small gedit annoyance in one minute, and within the next three, you’ll be able to do the same for other types of problems too. Ready? Set? Go!

I use gedit enough, that when I hack, I often end up using up more than the five allotted spaces in the “recent files” sections. I wanted to see eight. Since I knew it would have been silly for the developers to hard code the number five, I decided there was a chance that they stored it in the dconf settings. (BTW, there’s also an amazing “Dashboard” plugin which I use for more complex recent-files searching…)

Enter dconf-editor. Run this, and start browsing through the hierarchy. You’ll notice that the org.gnome.* hierarchy has a lot going on. Look around, and you’ll find a “gedit” section. Once there, you’ll probably recognize some of the key names, as preferences you’ve seen. I searched for the number 5 and I found it next to a ‘max-recents’ key.

You can edit this with the editor, or for your convenience, just run:

gsettings set org.gnome.gedit.preferences.ui max-recents 8

the corresponding ‘read’ command is:

gsettings get org.gnome.gedit.preferences.ui max-recents

of course. The interesting thing about these settings, is that if coded properly, their actions are “live”. Which means, you can toggle them on and off, and in most cases, you’ll see the results immediately. Similarly, if you toggle a particular setting in gedit, you should see the changes instantly in dconf-editor.

Have fun playing with this and,

Happy hacking,

James

 

Picking up the pieces after a Fedora 18 install

I love GNOME and Fedora, but “upgrading” from Fedora 17 to 18 did not go well for me. I recommend you wait until either these are all fixed, or Fedora 19+ suits your needs. Here are a list of problems I had, and some workarounds. Hopefully proper patches to these bugs will get merged quickly, so that you don’t need to use these fixes.

Problem: Boot fails after upgrade from Fedora 17 to Fedora 18. I used the new “fedup” method.

Workaround: I did a fresh install. Make sure you have backups first, of course. I didn’t feel like spending a lot of time debugging why it broke.

Problem: The <Backspace> key no longer goes “up” in nautilus. I hope this wasn’t a “feature removal”.

Workaround: Add:

(gtk_accel_path "<Actions>/ShellActions/Up" "BackSpace")

to your: ~/.config/nautilus/accels and restart nautilus of course.

Problem: Split view (extra pane) functionality is missing in nautilus 3.6

Workaround: The GNOME developers plan to eventually replace this in a similar form. Until then, you can install the nemo file manager, which is a fork of nautilus 3.4 and is packaged in Fedora 18. (yum install nemo nemo-open-terminal)

Problem: GNOME Shell background is entirely black in overview mode.

Workaround: Using gnome-tweak-tool, under the “Desktop” section, set “Have file manager handle the desktop“, to “OFF“. Unfortunately, this disables viewing of files on your desktop. This wasn’t a problem in Fedora 17.

Problem: Restarting the X server with the familiar Control-Alt-Backspace, can’t be enabled in the keyboard shortcuts menu as it used to.

Workaround: This option is now hidden in the gnome-tweak-tool under typing: terminate.

I hope this scratches your itches!

Happy hacking,

James

Renaming a GNOME keyring (for seahorse, the passwords and keyrings application)

The GNOME Keyring is a great tool to unify password management across the desktop. Sadly, Firefox is the one application that doesn’t support this natively. (Chrome actually does!)

Seahorse is a useful tool to browse and manage your keyrings. Each keyring is physically stored in: ~/.gnome2/keyrings/$something.keyring

Usually the “$something“, matches the name of the keyring, however the real name comes from within the file. I had an older ubuntu machine running GNOME, and I wanted to import my keyring. Here’s how I did it:

  1. Copy ~/.gnome2/keyrings/login.keyring (from the ubuntu machine) to ~/.gnome2/keyrings/ubuntu.keyring (on the new machine)
  2. Open up seahorse and change the keyring password of this “login” keyring to the empty string. This stores the passwords in a plain text format, which is briefly necessary.
  3. Edit the ubuntu.keyring file. There will be an obvious “display-name” section at the top of the file to edit. I changed it to:
    [keyring]
    display-name=ubuntu
  4. After restarting seahorse, I now changed the password back to something secure. If this process worked, you should already see the new keyring name in your keychain list.

Obviously this is a bit of a hack, and a proper rename function would be preferable, but until that exists, hopefully this will fill a niche if you’re stuck and you want to pull in an old keyring into your already populated $HOME.

Happy hacking,

James

changing *that* keyboard shortcut right there (in gnome)

I love my keyboard shortcuts, and I sometimes I want to change them. If you’re ever in a gnome application and wanted to change *that one right there*, you can now live-edit them!

In a terminal, first enable this feature:

gsettings set org.gnome.desktop.interface can-change-accels true

Next, hover over the menu item shortcut that you want to change. Enter the shortcut you want. It should update immediately! I like to disable this live-editing, so that I don’t accidentally change any shortcuts. To do so run:

gsettings set org.gnome.desktop.interface can-change-accels false

Too bad firefox doesn’t support this. This is one more reason why native GTK apps make your entire experience blend together (consistent) and more magic!

Happy hacking!

James

PS: If you’re curious, I used this to change the gnome-terminal and gedit cycle tab left/right actions to instead respond to the thinkpad back/forward keys which are conveniently located right above the left and right arrow keys respectively.

Source: http://library.gnome.org/users/evolution/3.3/change-keyboard-shortcuts.html.en

gnome3+others glipper/klipper replacement

So a friend of mine uses kde4 for its klipper feature. Turns out he’s right that it’s an awesome feature! I realized I couldn’t let gnome3 take second place to a clipboard app, so after a bit of searching…

$ sudo yum install gnome-shell-extension-gpaste gpaste xsel

Next hit up: https://extensions.gnome.org/local/ to flip on the extension. I had to first type: ALT-F2, “r” (to restart the gnome shell). Don’t worry your apps won’t die. And then I flipped it on.

Clicking on the new shell icon will let you change your pastes, as well as the gpaste preferences that you use. I like to combine this with xsel, so that I can:

$ echo this will be seen in gpaste | xsel

…and presto!

Happy hacking!

a custom epiphany location bar

since i do much research on the internets, i often find myself in a web browser. my favourite of the lot isĀ epiphany. this post isn’t about its merits or failures, but about the awesome way to make my location bar be exactly how i like it: monospaced.

just add the following into your ~/.gtkrc-2.0 file and then restart epiphany. feel free to modify as you wish.


# ~/.gtkrc-2.0
style "Epiphany_Locationbar" {
# leave out the font size if you wish
font_name = "Monospace 12"
#bg[NORMAL] = "#ff0000"
}

# both of these seem to work...
#widget "*.EphyLocationEntry.*" style "Epiphany_Locationbar"
widget_class "*.EphyLocationEntry.*" style "Epiphany_Locationbar"

thanks to raphael for the original post, and the #epiphany developers.

multi monitors and how it should all work (long babble)

at work i use two screens for my day to day workflow. i find it’s much more efficient for doing work, like coding. i’ll often have at least one terminal open, a full screen text editor, and usually a number of references, such as the dbus specification open in a web browser.

i recently just realized that one of the reasons multiple monitors are so useful to me, isn’t because of the increased screen real estate (although that certaintly is an important factor) but because of how the window manager deals with the windows. for example, when i click maximize, the chosen window expands to fill that monitors capacity, and not the entire set of monitors. it would be nice for this type of behaviour to be configurable somewhere for people with ultra large screens, who want to manage their windows better. the closest i’ve found is: winwrangler which i’ve started using at home where i only have one screen. it works sort of along those lines, however i still want more. multiple “workspaces” are essential. no matter how many screens i have, i’ll always need a few workspaces to be able to flip between email and coding– there is no sense in mixing it all together.

the cheeses (“the cheddar”, aka the suggestions i want to make in this babble):

  • as i change workspaces both/(all) screens change along with me. adding multiple monitors, essentially extends the size of the workspace. let us call this “mode 1“.
  • an alternate behaviour could be to allow “x” independent workspaces on monitor 1, and “y” independent workspaces on monitor 2, and so on… i read somewhere that someone accomplished this with two different x sessions somehow; the problem was that you couldn’t drag windows from one to the other. if someone was able to solve that problem and that type of usability was possible, then we could call this “mode 2
  • even more exciting would be to have a workspace on each monitor sharing a common set of workspaces. for example workspace “c” could be displayed on monitor 1, and workspace “e” could be displayed on monitor 2. you could switch each independently, and in the special case that both monitors were displaying the same workspace, then you would be getting an almost “clone”. the one exception to this being a true clone is that when using multiple monitors, you usually have a static per-monitor panel layout which doesn’t change as you switch workspaces. that functionality is good. all this would be called “mode 3
  • for completeness sake, a *true* clone of one screen to another is a possibility, and should be called “mode 0“.

the complicated point to this discussion is doing what any good mathematician, computer scientist, or ropes-technician (because of the knot tying) would do, and that is to extend the idea of our our modes to the more general case where we can mix and match them for N screens. (to take it a step further would be to let any physical screen be split into M virtual screens, and then use those to solve the above problem!)

think of combining two screens in mode 1, which together are in mode 2 with a second screen, which all together could be in mode 3 with an auxiliary monitor. you’ve got a big mess, and maybe it would be nice to dump this whole setup to your clone output in mode 0 to the projector. now i’m pretty sure that nobody would want that particular setup, but there should be some sensible way to choose what setup you do want, and to configure it appropriately.

i’ve heard that xmonad can apparently do something like mode 3. it makes me want to switch to using that. mode 1 is currently what i’m using. mode 2 could probably be emulated in a window manager which supports mode 3, by confining monitor 1 to only allow even numbered workspaces, and monitor 2 to only allow odd numbered workspaces (mod N if you have N monitors), and mode 0 already exists and is nice for presentations.

i think there are two important things to get right:

1) have a way to create “virtual screens” – it would be nice to be able to benefit from multiple screen logic, without physically buying 8 screens. also this would be indispensible for testing.
2) have a beautifully designed tool for managing the configuration, which obviously uses a well thought out configuration file format.

i would love to hear your thoughts, and if anyone knows of projects with great goals like these, please let me know.

ps: compiz has a “multi output mode” but i’m not sure exactly what it does and if it helps with any of this.