Entrepreneurship, Linux, and Ruby
Posts tagged ubuntu
Fun with ion3
Oct 7th
Ion™ is a tiling tabbed window manager designed with keyboard users in mind.
In recent years I've been a GNOME / Compiz guy, but while I've enjoyed it's tight integration with Ubuntu and flashy effects, I've always missed the simplicity of so-called minimalist window managers, mainly fvwm. These days, however, practically everything I do happens inside a Firefox, gvim, or gnome-terminal.
I want keyboard-driven. I want scriptable. And I don't want windows hiding behind other windows. Ever.
Enter ion3. I've only been using it for the last 24 hours, and even though I haven't memorized all of the keymaps, or learned how to code in Lua (yet!), I already love it. So far the only problem I've not been able to overcome is a bug in the latest Adobe Flash that breaks fullscreen video. This isn't specific to ion3 – it's a problem with any focus-follows-mouse system. I hear there is a workound, but it didn't seem to work for me. I consider it a microscopic trade-off for such an efficient window manager. Many of my previously sluggish applications now run incredibly fast, and with a couple days of practice I'll be working faster too.
Installation
Now just log out, choose ion3 and start a new session. The first time you log in you'll be greeted with the man page, which I highly suggest reading. If you try not to "cheat" by using the mouse, you'll pick up almost everything in a couple of hours, and from there you'll find yourself navigating faster and faster until you don't have to think about it at all. Just like vim.
Ion is both simple and well-documented, so it would be pointless for me to write introductory tutorial. Instead, here are a couple tricks I've discovered.
Modifying your configuration
One of the first things you're going to want to do when you're done messing around is change a few settings. For the most part, this is done in a file called cfg_ion.lua. Copy the system-wide file (I found mine at /etc/X11/ion3/cfg_ion.lua) to ~/.ion3/cfg_ion.lua and open it with a text editor.
$ cp `locate cfg_ion.lua | head -1` ~/.ion3/cfg_ion.lua
$ gvim ~/ion3/cfg_ion.lua
You'll need to restart Ion for your changes to take effect. Don't worry, all your applications will stay open; only the window manager needs to be restarted. Hit F12 and type session/restart.
I messed this file up a few times experimenting, and I'll probably mess it up a few more. If you screw up this file like I did, your F12 shortcut can disappear, and you'll need another way to restart Ion after you've fixed it. Keep a terminal open whenever you're editing, because you may not be able to launch one. The trick to restart Ion from the console is simple:
$ kill -USR1 21108
Remapping Mod1
The Mod1 key is used to initiate most interactions with Ion. On most systems, this is Alt. This is usually a very bad choice, because a lot of other applications need the Alt key for other things. I tried the Flying Window key, but it turns out it's in a very uncomfortable place on the keyboard. The number keys are used a lot. Try reaching Win+6, and you'll see what I mean. CapsLock has been working great for me, and as an added bonus, makes it much more work to shout on IRC.
Check your keymaps with xmodmap -pm. On my system, Mod3 was unused, so I remapped CapsLock to that.
Edit (or create) ~/.Xmodmaprc and insert these lines at the bottom…
add Mod3 = Caps_Lock
Then run it…
Also add this line to ~/.Xsession so it is run automatically whenever you start X.
If your xmodmap -pm now reads…
then you're in luck! Now you just need to edit the META variable near the top of your cfg_ion.lua to reflect the change
and restart.
All done! I hope you enjoy learning and using Ion3 as much as I have. I don't think I'll be switching again any time soon.
Setting up rTorrent with Firefox
Mar 14th
Being the closest thing we have to a native uTorrent in Linux, I really like Deluge. But, at least for me, it uses a seemingly impossible amount system resources. Since a Bittorrent client is the kind of thing I want to leave running in the background, I needed a lighter alternative.
I don't see any real need for a graphical interface when ultimately all it's doing is moving bits around on a network, so I went with rTorrent. One of the benefits of using command-line software is that you can use SSH and screen to control it over the network… we don't need no fancypants AJAX interface for this!
Part 1 – rTorrent
If you're using Ubuntu, you can get rTorrent from the repositories, like so…
Now that you've got the software, you're going to need to configure it. rTorrent looks for a configuration file called .rtorrent.rc in your home directory. Don't panic. Just save the sample as ~/.rtorrent.rc and open it up in your favorite text editor.
You don't need to worry about most of the stuff in this file, but you can if you want to. Here's how I have it set up:
# I like to limit this because I'm often connected through cheap
# wireless routers that have trouble with lots of connections.
min_peers = 40
max_peers = 450
# Same as above but for seeding completed torrents (-1 = same as downloading)
#min_peers_seed = 10
max_peers_seed = 50
# Maximum number of simultanious uploads per torrent.
max_uploads = 30
# Where do you want your downloads to go?
directory = ~/downloads
# You can put this anywhere you like, but I put it here.
# Remember that you'll have to create this directory
session = ~/.rtorrent/session
# Watch a directory for new torrents, and stop those that have been
# deleted.
# This will be important when we're setting up Firefox.
schedule = watch_directory,5,5,load_start=~/downloads/torrents/*.torrent
schedule = untied_directory,5,5,stop_untied=
# Port range to use for listening.
# Remember if you're connected through a NAT router, you'll
# need to forward these ports.
port_range = 50471-50479
# Enable peer exchange (for torrents not marked private)
peer_exchange = yes
Part 2 – Save Link In Folder
Okay, so you've got rTorrent all set up now, and configured to watch for new *.torrent files in a directory (mine is ~/downloads/torrents/*.torrent). Now let's configure Firefox. There's an extension by Achim Seufert called Save Link In Folder. You'll want to install this.
After your browser restarts, go to Tools > Add-ons > Save Link In Folder > Preferences and add a new folder, like this…

Remember – the download directory must be the one you told rTorrent to watch!

Now when you click a torrent link, just save it instead of opening it with Deluge. If rTorrent is running it will notice the new torrent, and get to work! You can even queue up torrents while rTorrent is off, for downloading later.
I'm definitely an rTorrent noob, having just set this up tonight, but so far I like it a lot, and no longer have the performance issues I had using Deluge. This configuration would also be ideal for setting up a seedbox / media center machine, if you set up all your Firefoxes to save torrent files to a network mount on the server.


