Tag: configuration

Advanced Linux Mouse Configuration Made Easy

logitech-mouseThose of you using a mouse with multiple buttons, such as the one shown here, probably already know how painful it can be to make it work just as you’d like on Linux. I have myself been postponing the configuration of my Evoluent VerticalMouse for years. I recently gave myself a little kick in the butt, and came up with the following solution.

Identify your mouse

First, find the exact name of your, and copy it somewhere for later use:

xinput list

Mine is: “Evoluent VerticalMouse 4”

Learn your mouse’s buttons’ positions

Install xev if not already installed:

sudo apt-get install xev

Open a terminal, and run xev from the command line. A small white window will open. Put your mouse in that window, and try clicking one of your mouse’s buttons. You will get a lot of output for every click. You need to find a block that looks like this, the most important part being near the end (button 3 in this case):

ButtonPress event, serial 36, synthetic NO, window 0x3c00001,
 root 0x269, subw 0x3c00002, time 14058208, (44,38), root:(1725,240),
 state 0x10, button 3, same_screen YES

Now you can easily write down the number associated to every button of your mouse.

Choose the right order for your buttons

We will use xinput to change the button mapping. Starting with the button map you have just written down, you can easily swap buttons to match your preferences. For example, here’s what I had at first (my mouse has three buttons like in the old times, and two thumb buttons) :

  1. Left click
  2. Middle click (paste selected text in Linux)
  3. Right click
  4. Wheel scroll up
  5. Wheel scroll down
  6. ?
  7. ?
  8. Upper thumb click (back)
  9. Wheel click (forward)
  10. Lower thumb click

Here’s what I wanted :

  1. Left click (1)
  2. Right click (3)
  3. Forward (9)
  4. Wheel scroll up (4)
  5. Wheel scroll down (5)
  6. ?
  7. ?
  8. Back (8)
  9. Paste selected text (2)
  10. Lower thumb click (unused… 10)

In my case, the xinput command looks like this:

xinput -set-button-map "Evoluent VerticalMouse 4" 1 3 9 4 5 6 7 8 2 10

You can run this command in the terminal to test if your configuration works well. You can always come back to default with :

xinput -set-button-map "Evoluent VerticalMouse 4" 1 2 3 4 5 6 7 8 9 10

Make your command run at startup

We’re almost done… Now create a file in your home directory with a name something like .mouse_config, and paste your xinput command in it. Open the automatic startup program that comes with your OS. Its name in Ubuntu 12.04 is Startup Applications. Add a new entry that points to your script, add a name and a description if you want to, and that’s it! Enjoy a perfectly working mouse!

Installing a Transmission Daemon on Ubuntu

TransmissionLet’s say you have a computer (could be your home file server) on which you want to install a torrent client as daemon (command line), and manage it through a Web interface. Would be great, right? It’s pretty easy to achieve but there are a couple of details you need to pay attention to.

Note: This tutorial was written for Ubuntu Server 12.04 but it doesn’t mean it can’t be useful for other versions or distros.

Required packages

It’s pretty simple as only a couple of packages need to be installed, and they are already in the repositories. For readability, I’m putting each of them on a different line, but they should all go on the same.

sudo apt-get install transmission-cli
                     transmission-common
                     transmission-daemon

Create folders for Transmission

Even if you could always use the default folders, I like keeping track of everything, the way I want it. So here’s what I’ve done. I think the folder names talk by themselves.

sudo mkdir ~/transmission
sudo mkdir ~/transmission/complete
sudo mkdir ~/transmission/downloading
sudo mkdir ~/transmission/torrents

Permissions

This step isn’t crucial, but it will save you lots of “sudo” commands in the future. By default, Transmission always gives downloaded files permissions to the transmission group (debian-transmission to be more precise). This is why adding your user to this group could be a good idea. Make sure your replace your_user in the following commands:

sudo usermod -a -G debian-transmission your_user

Now you need to set the correct ownership and permissions:

sudo chown -R your_user:debian-transmission ~/transmission
sudo chmod -R 755 ~/transmission

A good configuration file

Now this part is very important. The configuration file must be filled correctly or else you might not be able to access Transmission’s web interface. Many other things could also “go wrong”. But don’t worry, you can edit this file anytime in the future to fix any problem you might encounter.

First thing to do is to stop the daemon. If you don’t, the configuration file will be overridden when Transmission closes the next time.

sudo /etc/init.d/transmission-daemon stop

Use any text editor (I use Nano here) to edit the configuration file.

sudo nano /etc/transmission-daemon/settings.json

You will find all possible settings here: official Transmission wiki.

When you’re done, restart the daemon.

sudo /etc/init.d/transmission-daemon start

Configuration file example

Here’s an example of what I have added or changed from the default configuration file. Don’t forget to change your_favorite_list_url and your_user in the following example.

"blocklist-enabled": true,
"blocklist-updates-enabled": true,
"blocklist-url": "your_favorite_list_url",

"download-dir": "/home/your_user/transmission/complete",

"incomplete-dir-enabled": true,
"incomplete-dir": "/home/your_user/transmission/downloading",

"rpc-authentication-required": false,
"rpc-whitelist-enabled": false,

"watch-dir-enabled": true,
"watch-dir": "/home/your_user/transmission/torrents"

Make sure there’s a comma at the end of each line, except for the last one. The last entry (watch-dir), means every torrent file your copy in that folder will be automatically added by Transmission. Download should start only seconds after that.

Port forwarding

For optimal performance in both download and upload, it is recommended to open/forward Transmission’s default port, 51413. To do that, you will need to access your router’s from your favorite Web browser (usually at http://192.168.0.1 or http://192.168.1.1). If you need help passed that point, I suggest googling for something like “your_router_model port forwarding”. You should find plenty of information.

Access Transmission WebUI

Now that you have stopped the daemon, edited settings.json, and restarted the daemon, you should be able to access the Web interface. Simply navigate to your server/computer’s IP and port 9091 (can be changed in settings.json if it doesn’t suit your needs), which should look something like: http://192.168.1.101:9091.

Last step: show your girlfriend how to add new torrents using WebUI. 😉

© 2017 Evil Coding Monkey

Theme by Anders NorenUp ↑