Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

"Open With" Matlab—How-To for Linux

This post explains how to set .m (matlab source code files) to open with Matlab (a how-to for Gnome Linux).
  1. Right-click a .m file and click Properties
  2. Click the Open With tab then click Add
  3. Expand Use custom command and type the following into the field:
matlab -desktop -r "f=%f; cd(fileparts(f)); edit(f); clear f;"
  1. Click Add then select the radio button next to matlab.
  2. Close the property window.
Now all of your .m files should open with Matlab. The only thing I can't fix is that a new instance of Matlab is opened every time you open a .m file. To help, I set the current directory in Matlab to be that of the .m file which is being opened. Now you should be able to open your other .m files in Matlab more easily, without opening multiple instances.

If you'd like to know what that command does:

matlab: to run Matlab
-desktop: to run Matlab without using a terminal
-r: execute following matlab code when Matlab opens
f=%f: Save filename of file to open to variable f
cd(fileparts(f)): change the current directory to file f's directory
edit(f): open file f for editing
clear f: delete the matlab variable f

How To Shade Windows With Mouse Wheel

Scroll your mouse wheel in the up direction when your cursor is over the title-bar of a window. That window should now animate by sliding into the title-bar, therefore shading the window (assuming you're using CompizFusion). If this isn't the case, you can fix it by doing the following:
  1. Press Alt+F2
  2. Type gconf-editor
  3. Expand the aps folder (in the left column tree)
  4. Select the gwd folder
  5. Double click the mouse_wheel_action key in the right column
  6. Type shade into the value field
  7. Press OK and close the configuration editor. 
Thanks to the following forum post for this solution: UbuntuForums

Use Checkgmail with new Ubuntu Notifications

Short version:

Open a terminal and execute the following command in it:

sudo apt-get install checkgmail libnotify-bin && sudo wget http://users.cs.cf.ac.uk/R.P.Coombs/checkgmail -O /usr/bin/checkgmail

Now restart checkgmail. It will now display all new mail notifications using Ubuntu's new fancy-looking notifications. But don't worry, you can still open/archive etc. by hovering over the checkgmail icon as usual.

Long version:

I have modified CheckGmail to use Ubuntu's NotifyOSD notifications (see above pictures). I reckon this looks much better than the original little yellow box that CheckGmail uses.

My code does not affect the yellow box that appears when you hover over the CheckGmail icon, so you can still do this to preview / archive / open / etc. your emails.

You can run the command (above, in the short version) to install my modified CheckGmail program. The first part of the command (sudo apt-get install checkgmail libnotify) installs the original CheckGmail program (as this is required) and libnotify, which is what we'll use to display the new notifications.

The second part of the command (sudo wget http://users.cs.cf.ac.uk/R.P.Coombs/checkgmail -O /usr/bin/checkgmail) copied my program from the internet and saves it onto your computer in the place of the original CheckGmail program file.

My program is identical to the original program, except for the popup method. It is important that you trust my code before you install it onto your system as, if I were nasty, it could be malicious. I promise that I'm not malicious, but if you don't believe me you can view my code here and compare it with CheckGmail's original.

Once you have successfully executed the command you can start CheckGmail by running checkgmail, or, if checkgmail is already running, you must restart it by right-clicking the checkgmail notification-area icon and clicking restart.

P.s. this is another solution, which is better because it does not modify the original code:

http://helpforlinux.blogspot.com/2009/11/get-checkgmail-to-use-ubuntu.html

With a bit of work this could be great!

How to execute multiple commands in a launcher (shortcut) in Ubuntu

If you want a launcher (in the main menu or desktop etc) to perform more than one operation when clicked you might try using a launcher command like gedit; nautilus to open a text editor then a file browser. However, although this command will work in the terminal, it will not work in a launcher. Launchers can only execute one command. The workaround? ...read on:
  1. Open a terminal window
  2. Copy / paste the following code to the terminal:
    echo "echo \$@ > /tmp/runscript; chmod +x /tmp/runscript; /tmp/runscript" >> temp_launch; chmod +x temp_launch; sudo mv temp_launch /usr/bin/launch
  3. Press enter, then type your password when prompted
Now instead of using gedit; nautilus as your launcher command, use launch "gedit; nautilus". All commands between the speech marks will be executed.

Sorted!