Advertisements
Fedora/Yum update notification in OpenBox
06 Feb

Fedora/Yum update notification in OpenBox

OpenBox is a minimalist windows manager for Linux, it’s also my manager of choice. Due to its minimal memory footprint its faster than Gnome or KDE, but because its minimal a lot of what you may have come to know and move is no enabled by default.

I will cover more about OpenBox and its configuration in future posts, but this evening I decided to check for any updates to Fedora 21 and to my surprise I found over 200 updates waiting on me. I know, I am really bad at checking for updates but so are you so don’t judge!

When you log into KDE or Gnome many other services and background programs are run, one of which checks for system updates and alerts you. There is no such thing running by default when your first run OpenBox so I created a Bash script that runs in cron. It uses the notify-send command to pop-up alerts when updates are available.

Create a new file in /usr/local/bin/yum-watch and copy in:

Now make sure the file is executable with sudo chmod 700 /usr/local/bin/yum-watch. Now just add your new command to cron or run it at startup and you’ll start getting notifications if and when new updates are available.

agedu: Clean up wasted space in Linux
17 Dec

agedu: Clean up wasted space in Linux

In some situations a quick trip to get a drive is required but in many situations space can easily be reclaimed by removing the gunk that’s accumulated, but how do you determine what’s junk? Linux has the du command that will recursively search a director and list all files and there size but it still comes down to you to determine what should be kept and what should be removed.

In comes agedu (age dee you). Like du this new tool searches for files in all directories and lists there size, but it can also differentiate between files that are still in use and ones that haven’t been accessed less often.

From the man pages

agedu scans a directory tree and produces reports about how much disk space is used in each directory and sub-directory, and also how that usage of disk space corresponds to files with last-access times a long time ago.

In other words, agedu is a tool you might use to help you free up disk space. It lets you see which directories are taking up the most space, as du does; but unlike du, it also distinguishes between large collections of data which are still in use and ones which have not been accessed in months or years – for instance, large archives downloaded, unpacked, used once, and never cleaned up. Where du helps you find what’s using your disk space, agedu helps you find what’s wasting your disk space.

agedu has several operating modes. In one mode, it scans your disk and builds an index file containing a data structure which allows it to efficiently retrieve any information it might need. Typically, you would use it in this mode first, and then run it in one of a number of `query’ modes to display a report of the disk space usage of a particular directory and its sub-directories. Those reports can be produced as plain text (much like du) or as HTML. agedu can even run as a miniature web server, presenting each directory’s HTML report with hyperlinks to let you navigate around the file system to similar reports for other directories.

So, the install

Fedora 18, 19, 20 & 21

Ubuntu/Debian

Basic Usage

The first step is to let agedu scan a directory, bellow I’ve just scanned my Downloads folder:

To access the report you need run agedus built in web server:

Now just fire up your browser and go to the URL stated:

agedu Web Interface
agedu Web Interface

Conclusion

There are other options available such as --exclude and --include arguments which let you control what files are indexed, for example if you wanted to see what ISOs were taking up the most space you’d use:
agedu -s ./ --exclude '*' --include '*.iso'

This post was designed to written to give you a quick overview of agedu since I have only touched on the options available. Check out the man pages or read thru the developers website for more details.

Install Oracle Java JDK or JRE 8u11
18 Jul

Install Oracle Java JDK or JRE 8u11

I do not format my desktop PC very often, I reinstall my laptop three or four times a month but not my primary machine. With almost every clean installation I have to lookup how to install Oracle’s Java instead of using the pre installed version OpenJDK.

Since I search for it so often I thought it was well past time I wrote a guide of my own.

What’s New in JDK 8

Java 8 is a major feature release on version 7. The updates are too many to go into great detail here, but Oracle have a full feature change log on their own site

Scope

This guide will tell you how to install Sun/Oracle Java JDK and/or JRE 8u11 on Fedora 20, 19, 18, 17, 16, 15, 14, 13 and 12 – I haven’t tested on all these version of Fedora, only 20 & 19, but Fedora haven’t change the process so much that this wouldn’t work on older versions. If you do find any problems, please let me know in the comments section and I will get the guide updated.

Install Sun/Oracle Java JDK/JRE 8u11

Download 32bit of 64bit RPM packages

Download the RPM files from Oracle’s download page. Depending on your system, 32 or 64bit, download:
* 32-bit JDK download jdk-8u11-linux-i586.rpm
* 64-bit JDK download jdk-8u11-linux-x64.rpm
* 32-bit JRE download jre-8u11-linux-i586.rpm
* 64-bit JRE download jre-8u11-linux-x64.rpm

Install the RPM packages

Next just install the RPM package you’ve just downloaded using one of these commands

Set the newly installed Java as the system default

Now that your Java 8u11 is installed you need to tell Fedora to use it by default. The alternatives simply created links from the system default paths to the new java installation directory

Install Browser plugin for Firefox

Most people do not need to do this, I never do. If you dont know you need java inside your browser skip this step – you can always come back to it later if you find you need to run java from within in Firefox.

Set up Java Development Kit

You only need this if you installed the JDK. These two commands, javac and jar, are just used to complie java code and package the result files for distribution.

If you need to run multiple versions set 8u11 to the default

In the steps above you have replace the already installed version of Java with 8u11, but you havent removed it. If in future you install 8u12, but still want 8u11 to be your default you can specifiy the version of java to pass to alternatives instead of using latest.

JRE Users

JDK Users

Make sure its all worked

Just a quick check to see its all work as you expect

Post Install

You now have Java installed, the last thing to you need to do is make sure you have the JAVA_HOME environment variable set on your system.

You can do this per user by adding the above to $HOME/.bash_profile or make it a system wide setting by adding it to /etc/profile

Switching JRE

Now you have installed Oracle Java, and used alternatives to set it as the system default, you may come across occasions when you need to switch the system back to OpenJDK. You can use the alternatives command with the –config argument to set things up the way you want.

java

javaws

libjavaplugin.so (32-bit)

libjavaplugin.so.x86_64 (64-bit)

javac

01 Jun

Getting Saitek X52 Joystick Working Within Linux

Now that Steam is available for Linux (How to install article coming soon) I have once again made the switch to 100% Linux. How that I have Steam installed I wanted to start playing Egosoft’s X3 series again, but for best performance this really needs a joystick. This is how I went about installing and using my Saitek X52 joystick in Fedora 18.

The problem is as of Fedora 17 the joydev kernel module was removed by default. The result is when a new joystick is plugged in the require paths in /dev/input/jsX are not being created, so your software and games can not find the device. So we need to reinstall the joydev module.

After installing the kernel joydev module the joystick and all its buttons are detected by the latest kernel (which as of writing is)

The Install Instructions for a fresh install

  1. Even though joydev was stripped from the default kernel it has been bundled into an easy to install package available in the yum repsitory

2. Now the kernel software is installed we need to load it. You can ether take a moment and reboot your PC, the modules will get loaded at boot time, or you can load them your self with modprobe

  1. After the new modules have been loaded you can plug your joystick in and you should see the new paths being created under /dev/input it will be something like /dev/input/js0. You can not test to make sure your joystick is being detected correctly using ‘jstest’

Installing Qjoypad Optional, mapping buttons to the keyboard

The Saitek X52 has over 30 buttons on it so the easiest way to set these up would be mapping them to keyboard shortcuts. Luckly, with a little Googling, I found a fantastic tool for this. Qjoypad is a Qt based program that will just sit in your tray and map any button presses to the associated keyboard shortcut.

There are no binary packages, that I could find, but installing from source is fairly painless. There are alternatives out there, but I haven’t spent any time with them. I found Qjoypad first, and for my purposes, it was perfect. If you find something you think is better please let me know in the comments!

  1. Install Qt dependancy packages

  1. Download the latest version of Qjoypad, as of writing that was 4.1.0
  2. Extract downloaded file

  1. Change directory into main source folder

  1. The distributed config file makes a check for qmake, unfortunitly this will fail in Fedora as the qt-devel package installed qmake as qmake-qt4 so we can just comment out the check in line 14-17

  1. Now run config to generate the Makefile

  1. Edit the new Makefile and append -lX11 to the end of line 19. I’m not ‘up-to-scratch’ with Makefiles and compiling, so I’m not able to give a good reason for this, I just now without it ‘make’ will fail to compile. If someone can explain it better than I leave a comment and I’ll happily update the article

  1. Now as root run the install

  1. Run QJoypad

Qjoypad will run in your system tray and can be opened by double clicking. From there you can setup your profiles and key bindings. There is support for multiple profiles as well so you are able to set different bindings for each of your games and load them as required.

I hope this has been of help to you, I know I’ll be refering to it after my next install. Please leave me a comment bellow if this was of help, or you’ve found any problems.

As always, if you have been, thanks for reading

Getting Logitech Custom Mouse Buttons Working Within Linux
13 Mar

Getting Logitech Custom Mouse Buttons Working Within Linux

Having lived in a Windows environment for the past couple of years I’ve gotten somewhat used to my routines and short cuts, most of which are missing or changed now that I’m 95% Ubuntu. The most notable absentee are all the extra buttons on my Logitech MX Revolution mouse, which I have mapped to a vast array or custom key stroked. So, lest I forget, this is how I have got these custom buttons working correctly.

All these buttons are detected by the latest kernel (which as of writing is)

This is great news because all we need to do now is map each button against the desired application/keystroke.

My system of choice is Ubuntu 10.10 as of writing, this has since changed to Fedora so all the command line and install command listed are correct for this distributions as of writing. If you find other commands work on other distributions leave a not in the command and I will be sure to update the main article.

The Install Instructions for a fresh install

  1. We should install xbindkeys. This will re-map mouse and keyboard inputs so the install is…

The goal is to configure the mouse buttons to send key combinations to activate o

ther desktop or application functionalities. Technically all xbindkeys is doing is executing an application in response to a keystroke or mouse button.

  1. So in-order to map a mouse button to a keystroke we have to install an application called xte, which in Ubuntu comes as part of the xautomation package which can be installed like this

  1. Now we need to create a configuration file for xbindkey, which can be done like this…

  1. We need to edit this file in a text editor. I use nano, but vim, kate or gedit are just as good but you can of course use what ever editor you would prefer to…

The xbindkeys configuration file has a very simple format…

  1. So we need to add our button-to-key configurations, but first we need to know what ‘events’ the mouse buttons are triggering before we can remap them. For this we can use xev, this program is a key and mouse event sniffer. It runs by opening a small window. You can now start pressing keyboard or mouse buttons over the window and see if they are detected. For example the forward button on my Logitech Revolution MX looks something like this:

Bellow I’ve included a table for the Logitech MX mouse, these will probably be if you have a newer, or older mouse

Mouse Button Event Code xbindkeys Code
Thumb Scroll Up 13 b:13
Thumb Scroll Click 17 b:17
Thumb Scroll Down 15 b:15
Thumb Button Up 9 b:9
Thumb Button Down 8 b:8
Left Button 1 b:1
Right Button 2 b:2
Scroll Up 4 b:4
Scroll Down 5 b:5
  1. Now that we have a list of all our button codes we can move on to actually writing the configuration file. For example I have this to map the Thumb Button Up and Thumb Button Down buttons to switching workspace in my Gnome shell, these keycombinations are specific to my setup so you will need to chnage them. What I’m doing here is pressing the ‘Windows’ key ‘Left Control’ then ether ‘Down’ or ‘Up’ then releasing the other two keys…

The Rapup Now we make it all work

Thats all there is. Once you have setup your /.xbindkeysrc confirguration file, you just need to configure xbindkeys to run automatically on system startup. This is going to be different depending on your windows manager, but here are the steps for KDE and Gnome

Gnome3
  1. There’s a tool in GNOME 3 which allows you to add, modify and remove autostart entries and you can run it by executing from a terminal or from the ALT+F2 dialog. Just run gnome-session-properties
  2. Click on “Add”
  3. Write ‘Xbindkeys’ in the Name and ‘/usr/bin/xbindkeys’ as the Command and press OK.
  4. Done!
KDE
  1. Open System Settings.
  2. Go to Advanced tab -> Autostart.
  3. Click on “Add Program…”.
  4. Write ‘/usr/bin/xbindkeys’ and press OK. A new dialog pops up. Press OK again.
  5. Done!