Volutions - ID | News | Gadget | Tutorial | Freeware | Template | Etc.: bash
Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Show Desktop Icon For The Ubuntu Unity Launcher

Show Desktop Unity

Currently there's no "Show desktop" applet / icon for the Unity panel in Ubuntu 11.04 and while you can use Super + D to toggle Show Desktop, many are used to using an icon for this. So here's how to get such an icon on your Unity panel.


Instead of an actual applet you can use a small script we've posted a long time ago (back then, Docky was still a part of Gnome DO and it didn't have a "Show desktop" icon). To get it running, simply follow the steps below.


1. Firstly install wmctrl:
sudo apt-get install wmctrl

2. Download the script and .desktop file, extract it and place the "showdesktop" script in the /usr/local/bin folder using the commands below:
cd
wget http://webupd8.googlecode.com/files/showdesktop.tar.gz
tar -xvf showdesktop.tar.gz && rm showdesktop.tar.gz
sudo mv showdesktop /usr/local/bin/

If you want to manually download the file, get it from HERE.

3. Now you should see a file called "showdesktop.desktop" in your home folder - you can move it wherever you want (or leave it there) and then simply drag it to the Unity launcher and you'll have a "Show desktop" icon.

Known issue: when clicking the "Show Desktop" icon in the Unity launcher, you'll have to wait until the icon stops pulsating before clicking it again (that's about 10 seconds) or else the it doesn't do anything. If you know a way to fix this, please let us know in the comments! Update: you can middle click when the icon is pulsating if you don't want to wait (thanks to Mahdi for the tip!).


Post idea thanks to soee!

Automatically Install All The Google Web Fonts In Ubuntu Using A Script

Google Font Directory

I was reading on Femtux about a Google Web Fonts package for ArchLinux and though I'd make one for Ubuntu. I didn't create a .deb but instead I've modified the original ArchLinux script to download and install all the Google Font Directory fonts on Ubuntu. You can of course manually download the fonts from HERE if you want, but using this script you can install all of them in a few seconds. The fonts included are the new Gnome 3 font, Chrome OS font, Ubuntu font and many more.

What the script does is download all the fonts from Google Font Directory (it includes around 76 fonts, each with many variations that you can use on your desktop or various designs) and installs them under /usr/share/fonts/truetype/google-fonts/ (so if you want to remove them, simply delete that folder).


To download and install all the Google Web Fonts in Ubuntu, open a terminal and type the following commands:
cd && wget http://webupd8.googlecode.com/files/install-google-fonts
chmod +x install-google-fonts
./install-google-fonts

If you want to take a look at the script before running it, download it from HERE.

Once the script finishes downloading and installing the fonts, you can go ahead and try them out. If you want to use one of the Google Web Fonts for your desktop, right click your Desktop, select "Preferences" and set the new font on the "Fonts" tab.

The script creates a "googlefontdirectory" folder in the directory where you run it (your home folder if you've followed our exact instructions) - you can either delete this folder or keep it and the next time you run the script, it will only update the fonts instead of completely downloading them all over again.


Want more fonts? Also see:

Download The Ultimate Bashrc File

The Ultimate Bashrc is a custom .bashrc file that comes with tons of aliases, functions and bash settings, all in one file. Here are a few examples: various bash prompts, sudo for entire line, apt history, various conversion functions like temperature, currency (based on Google) and so on, rip audio from video, bookmarks directories, copy/paste for the command line, convert any video to avi, cp with progress bar, translate a word using Google, Deb Extraction / Remaker (extracts a deb file & organizes for easy deb manipulation and repacking using "debremaker"), a "del" alias that moves the files to trash instead of removing them completely, a "site down for everyone or is it just me" function, various computer info and many more.

While you probably won't need everything in this custom bashrc file, I'm sure you'll find some very useful functions that you can use so go ahead and take a look - everything is very well organized and documented so it should be pretty easy to figure what everything does and what's required to get it to work.




Thanks to inameiname for the tip!

Y PPA Manager 0.0.4 Released With A New "Deep Search" Feature

Y PPA Manager

Y PPA Manager is a GUI tool to add, remove, purge, list and search for Launchpad PPAs.

Today I've released a new Y PPA Manager version that adds a new feature: deep search. The regular Y PPA Manager search displays all the PPAs that the Launchpad search returns for the word you search for - that includes PPAs that don't have packages for your Ubuntu version, PPAs that only have the searched keyword in the description as well as PPAs in which that package was available but it has been removed recently.


Deep search

The new "deep search" works like this:
  • it scans all the PPAs returned by the Launchpad search and only displays the PPAs that have the exact package you've searched for available at the time you've performed the search
  • the Y PPA Manager displays the exact version for the package you've searched for as well as the PPA in which that package can be found in one place so you don't have to check the packages in each PPA to know the version of the packages returned by the search
  • "deep search" will only return packages available for your Ubuntu version (or whatever version you've specified in the config file)

Please note that the "deep search", just like the regular search makes use of the Launchpad PPA search so if Launchpad doesn't find a certain PPA, Y PPA Manager won't list it either. There's nothing I can do about this.


But enough talk. Here is a screenshot with an example Y PPA Manager deep search results for "nautilus":

Y PPA Manager deep search

As you can see, the old regular search actions are still available: you can add the PPA, perform a new search or list the packages in a PPA to get a better idea of what's inside that PPA:

PPA Packages


Because of the way the "deep search" works, it takes more then a regular search to complete so you may still use the regular search for quicker results. Also, you must enter the exact package name when using the "deep search" feature. But of course, the results will be more accurate and it's a lot easier to see the version (no extra clicks required) using the deep search.


Install Y PPA Manager

Try it for yourself! Add the Y PPA Manager PPA and install it in Ubuntu Karmic, Lucid, Maverick and Natty (also works in Linux Mint) using the following commands:
sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager


Oh, there's one more feature I've implemented a while back but I forgot to tell you about it: when adding a PPA using Y PPA Manager, the GPG key is imported on port 80 so if you're behind a firewall you won't get GPG key errors anymore (this only works for the new PPAs you add - for the already added PPAs, use Lauchpad Getkeys)!

For more info on Y PPA Manager, see THIS post and the Y PPA Manager Launchpad page. A video with Y PPA Manager is available in THIS post.


Report any bugs you may find @ Launchpad.

Get Caps / Num / Scroll Lock Keys NotifyOSD Notifications Using Compiz And A Script

lock keys notifications

Using this tweak you will get NotifyOSD notification bubbles when the caps lock, num lock or scroll lock status changes (you press a lock key).


One way of getting NotifyOSD notifications when you press the Caps Lock, Num Lock and Scroll Lock keys is using Indicator Keylock - which displays the lock keys status using both NotifyOSD and an appindicator.

But if you only want NotifyOSD notifications, you can do this without installing Indicator Keylock - by using a patched NotifyOSD provided by Leolik, a script and Compiz. This is a tweak Antoni "Pinguy" is using in his latest Pinguy OS 10.10 and he shared this tip with us so you can use it even if you don't want to install Pinguy OS.


How to set up and use the Lock Keys script

1. Optional: install the patched NotifyOSD we've talked about a while back - this makes the notifications respect the timeout passed by the script. Without this package, the notifications will be displayed for 10 seconds which is annoying in some occasions.

sudo add-apt-repository ppa:leolik/leolik
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libnotify-bin
pkill notify-osd

2. Download the script from HERE and save it somewhere on your system (like a "scripts" folder in your home directory for example). Then right click the file, select "Properties" and on the "Permissions" tab, check the "Allow executing file as program" box.

3. Make sure you have CompizConfig Settings Manager installed:
sudo apt-get install compizconfig-settings-manager


compizconfig settings manager commands tab

Go to System > Preferences > CompizConfig Settings Manager, enable the "Commands" plugin (if not already enabled) and on the commands tab, for 3 empty command boxes, enter this:

/path/to/lock_keys caps
/path/to/lock_keys num
/path/to/lock_keys scrl

In the above commands, replace "/path/to/lock_keys" with the exact path to where you've save the lock_keys script (downloaded in step 1).

4. On the same CompizConfigSettings Manager Commands plugin, go to the "Key Bindings" tab and for the "Run command X" corresponding to each command enter under step 3 press the "disabled" button, then press "Grab key combination" and press the key corresponding to the command (caps, num or scroll lock). When assigning a key such as Caps Lock, Num Lock or Scoll Lock, after pressing the key, press ENTER or else Compiz will not assign the key and will wait to press some more keys!

Compizconfig settings manager key bindings

And you're done!



Thanks to Antoni "Pinguy" for the script tip! Script credits: red_five and excedio

Split Single Lossless Audio Files To Flac Or mp3 Using A Nautilus Script

split lossless nautilus script

Some music players like gMusicBrowser (and many others) can't read .cue files so you may want to split those single lossless audio files into multiple flac or mp3 files.

There is a tool for that called gCue2Tracks but it didn't work that well in the test I ran today: to split to mp3 it firstly converts the files to .wav and only then to mp3 which takes a lot of time; I've tried to use it to split an .ape file to mp3 with a 320 kbps quality (disabled vbr) yet the converted mp3s were 110 kbps; and finally it fails to convert to wv which probably means it doesn't work the other way around either.

Because of the two reasons above, WebUpd8 reader CokiDVD has created a nautilus script which can split single lossless audio files (ape, flac, wavpack) by .cue file into flac or mp3 (320kbps or 192kbps). Further more, the script also adds tags to the new files so all the resulting flac or mp3 files will have the artist, album, title and genre tags set up automatically.

Install the packages required by the script


The script requires some packages to be installed to be able to split loseless audio files as well as Zenity for the GUI. Install the dependencies in Ubuntu by using the following commands:
sudo add-apt-repository ppa:adrian-m-benson/ppa #required for a newer shntool to fix a bug with wavpack
sudo add-apt-repository ppa:flacon/ppa #required for MAC package
sudo apt-get update
sudo apt-get install shntool cuetools flac wavpack lame mp3info zenity mac

Download and install the script

To download and "install" the script, use the following commands:
cd ~/.gnome2/nautilus-scripts
wget http://webupd8.googlecode.com/files/splitlossless.tar.gz
tar -xvf splitlossless.tar.gz && rm splitlossless.tar.gz
chmod +x "Split Lossless"

If you want to set it up manually, download the script from HERE.

Now to use it, simply right click a single losless audio file (.ape, .flac or .wv) and select Scripts > Split Lossless. At this point, a window will pop-up asking you to select the .cue file for that lossless audio file - select it and you can then chose the audio format in which to split the file (flac or mp3).


Thanks to CokiDVD for the script!


See also: Split APE and FLAC Files in Ubuntu and Add Tags by Cue File

Set Up Aero Snap In Ubuntu (w/ Compiz) Using A Script

I've recently seen a screencast by gotbletu about setting up hot corners for the Compiz Grid plugin which is a lot like Aero Snap but better in my opinion so I wanted to make this very easy to set up for everybody. After using the script in this post, you can move a window to a screen corner by right clicking the corner in which you want to move the active window to.

"Aero Snap" for Ubuntu (using Compiz) is not hard to set up but it requires a lot of copying and pasting so I though I'd make a script to do everything automatically so to achieve exactly what you see in the video, all you have to do is run the script I've created.


Bur firstly, what does the Compiz Grid plugin do?

The Compiz Grid plugin can be used to tile, position and resize your windows to fit an imaginary grid. All you have to do is press Ctrl + Alt + Keypad numbers to place the selected windows; for instance: Ctrl + Alt + 1 will move a window to the bottom left corner, Ctrl + Alt + 7 will move a window to the top left corner and so on.

By default you can't assign a Compiz hot corner to the Grid plugin which would be really helpful, but you can achieve this by using a package called "xautomation" and the Compiz Commands plugin.

Here is the screencast by gotbletu in which he is using the Compiz Grid plugin to set up Aero Snap in Ubuntu to see exactly what I'm talking about:



Set up Aero Snap in Ubuntu using Compiz and a script


Warning: by using this script, the commands from 0 to 7 from the Compiz Commands plugin will be overwritten so if you have some custom commands, save them in the last 4 command fields!

To get Aero Snap in Ubuntu, simply copy / paste the following commands in a terminal:
wget http://webupd8.googlecode.com/files/grid-corners
chmod +x grid-corners
./grid-corners

The script installs compizconfig-settings-manager, compiz-fusion-plugins-extra and xautomation, enables the Compiz Grid and Commands plugins and sets all the commands and keybindings to a screen edge and mouse button 3 (right click). If you want to use a different mouse button, you can either manually change this in the Compiz Commands plugin or edit the script (it's easier - use search and replace) and run the script again.

Once you run the script, click a window, then place your mouse pointer to a screen corner/edge and right click.

By using the Grid plugin, the windows will also get resized when moved to a corner. If you don't want this, disable the Compiz Grid plugin and use PyWO instead (all you have to do is run it on starup).


For a different way to get Aero Snap in Ubuntu (but you'll still have to use Compiz), check out THIS video on YouTube (also read the video description - it includes a file you can download that has all the commands required to set up Aero Snap in Ubuntu). P.s.: the video also includes instructions on installing 'cowsay' and 'figlet' - you can ignore those and skip to the Aero Snap part.


[video and xautomation commands via gotbletu]

'Directory Cleaner And Files Organizer' Updated With Command Line Version

A while back we've posted about a script called "Directory Cleaner And Files Organizer" that helps you keep various folders clean (such as your Desktop) by automatically moving the files by extension into folders such as Pictures, Documents and so on.

If you remember, I've mentioned it would be nice if it had a command line version so you could automatically run it at startup or in a cron job. Well, an update today brings a command line version of the Directory Cleaner And Files Organizer script.

To use, download the script, extract it and open "cmd_cleaner" and starting with line 28 of the script you should see something like this:

picdir="/home/$USER/Pictures"
musicdir="/home/$USER/Music"
docdir="/home/$USER/Documents"
videodir="/home/$USER/Videos"
archdir="/home/$USER/Archives"
progdir="/home/$USER/Scripts"

These are the folders where your files will be moved upon cleaning - change them to whatever you want (or leave them as they are). Then make the script executable:
chmod +x /path/to/cmd_cleaner

Then, to clean a folder, use:
/path/to/cmd_cleaner a /home/andrei/Desktop

Of course, change /home/andrei/Desktop in the command above with the path to the folder you want to clean (I've used an exact path because I'm not sure if relative paths / variables work in Cron). "a" stands for advanced cleaning and "s" for simple (so you can replace "a" in the above command with "s") - we've already explained what these do in the previous post.


Now you're ready to add it to a cron job (for a GUI you can use Gnome Schedule) or to your startup applications (System > Preferences > Startup applications - simply add the command like I've explained above).


Note: if you get a bunch of errors when running the script, don't worry about it, the script works but the errors are displayed because it checks multiple times (so this is only a display error which will be fixed soon). The author explanation:

The cleaning is working without problem, the error are the second checking result, when the document is already moved. The same is also in the classic cleaner. I will look at this later and will to rewrite it for output without errors.

Download Directory Cleaner And Files Organizer

Hide / Show Desktop Icons In Linux Using A Simple Script [Gnome]

I was reading a post on Lifehacker about hiding/showing your Desktop icons in Mac OSX using a script and though: "hey, I bet this can be done easier in Linux". And so it is: EnLi has created a very small script that does just that: it can toggle your desktop icons on/off using a click for a distraction-free desktop.

You can either use it as a Nautilus script or assign it a keyboard shortcut.

a) To use it as a Nautilus script, copy/paste the following commands in a terminal window:
cd ~/.gnome2/nautilus-scripts
wget http://enli.co.cc/files/Scripts/Toggle-Desktop.sh
chmod +x Toggle-Desktop.sh

Then simply right click in Nautilus and select Scripts > Toggle-Desktop. Please note that when you turn off the icons on the desktop, you can't right click the desktop so you'll have to open a Nautilus window to be able to run the script.


b) To assign a keyboard shortcut to the script:


Download the script and place it anywhere you want, then make it executable:
chmod +x /path/to/Toggle-Desktop.sh

Then assing a keyboard shortcut: under System > Preferences > Keyboard Shortcuts, click "Add", enter a name for your custom keyboard shortcut and under "Command", enter the full path to where you've saved the script. And finally, assign a new keyboard shortcut for the newly created action.


Credits for the script: EnLi`s Blog

YAD: Zenity On Steroids [Display Graphical Dialogs From Shell Scripts]

Those of you who like writing bash scripts and use Zenity for a GUI should give YAD a try. YAD (Yet Another Dialog) is a fork of Zenity with many improvements, such as custom buttons, additional dialogs, pop-up menu in notification icon and more. I've been using it for Y PPA Manager so if you want to see it in action, give Y PPA Manager a try.

Unfortunately even though Zenity is constantly updated, these updates only bring language updates and fixes. Here is where YAD shines: basically most of the stuff you ever wanted to do in Zenity is available in YAD: you can have as many buttons as you want, each with the text you want, a really nice icons dialog (which I've used as the main Y PPA Manager UI) and many more. Here's an example of a YAD dialog you could never get using Zenity:

YAD


If you want to convert a script from using Zenity to YAD, there are a few things you'll have to change, but it's worth it. YAD doesn't have all the useless dialogs such as --error, --info, --notification, --question or --warning - instead, it has a --form dialog to which you can add whatever message, buttons and icons you want. For help on using YAD (it's quite easy!), see the examples sections at it's Wiki or have a look at Y PPA Manager code. Here is the code (thanks to ananasik) used to generate the dialog in the above screenshot:
yad --title="Desktop entry editor" --text="Simple desktop entry editor" --form --field="Type:CB" --field="Name" --field="Generic name" --field="Comment" --field="Command:FL" --field="Icon" --field="In terminal:CHK" --field="Startup notify:CHK" "Application" "Name" "Generic name" "This is the comment" "/usr/bin/yad" "yad" FALSE TRUE --button="WebUpd8:2" --button="gtk-ok:0" --button="gtk-cancel:1"

Install YAD in Ubuntu

If you're using Ubuntu, you can install the latest YAD from the Y PPA Manager WebUpd8 PPA (available for Ubuntu Karmic, Lucid, Maverick and Natty):
sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install yad

To see all the available options, type:
yad --help-all

For those of you who don't use Ubuntu, download YAD source @ Google Code.

If you find a bug or have a feature request, don't hesitate in reporting it on YAD's Google Code page - it's developer is really nice and he always tries to help.

Keep Your Desktop Clean With Directory Cleaner And Files Organizer

Directory cleaner and files organizer

In my search for a clean Desktop (because I got tired of cleaning it manually), I came across "Directory cleaner and files organizer", a script (with Zenity for a GUI) that automatically cleans any directory (and thus the Desktop folder) by moving the files to various folders such as all the pictures into ~/Pictures, the archives into ~/Archives, documents into ~/Documents and so on.

The script recognizes more than 470 extensions and the directories where it moves the files can be customized in the settings. Also, I'm using it for organizing my Desktop but you can use it for any other folder such as the ~/Downloads folder and so on.

Directory cleaner and files organizer has 2 options for cleaning: "Start-Cleaning" which moves all the files in the selected directory to the directories you've set in its settings, overwriting any existing files, and "Advanced-Cleaning" which is a smart way of moving the files:
  • if the file that's going to be moved already exists in the destination folder, a new folder with its extension is created and the file is moved into that folder.
  • if that folder also has a file with the same name, the file is renamed using the date and time so the file never gets overwritten


Installation

Before proceeding with the installation, remember to always check the source of any script you run on your computer!

Directory cleaner and files organizer only depends on Zenity which should already be installed. To install Directory cleaner and files organizer, download if from HERE, extract it and double click the "install.sh" file.

Once installed you can find it under Accessories > Files-Oraganizer.


Configuring Directory cleaner and files organizer

Directory cleaner and files organizer clean paths can be configured. By default, selecting "Edit-Settings" will pop up the following configuration:

Edit path's for your files with exact order
-----------------------------------------------------
/home/YOUR_USERNAME/Pictures
/home/YOUR_USERNAME/Music
/home/YOUR_USERNAME/Documents
/home/YOUR_USERNAME/Videos
/home/YOUR_USERNAME/Archives
/home/YOUR_USERNAME/Scripts

You can get an idea on what each folder is for (therefore I won't get into detail here since it's obvious), so you can easily modify it to point to some other location.


Directory cleaner and files organizer is not 100% automated as you have to run it and select the folder you want it to clean. But if you know a bit of Bash, you can always tweak it so you can launch it via command line (without Zenity) and then add it to an hourly cron job.

2ClickUpdate 6.0 Adds Ubuntu 10.10 Support

2CLickUpdate

2ClickUpdate is a front-end for system updates that checks for and installs updates, removes unnecessary files and cleans up after installing the updates. It works on any Debian/Ubuntu based Linux distribution.

2ClickUpdate is a shell script with a GUI provided by Zenity that uses axel (similar to apt-fast) for handling the downloads (so the downloads are a lot faster then regular updates) and NotifyOSD notifications.


2ClickUpdate automatically performs the following actions:
  • Refreshes your package list.
  • Installs the latest updates for your applications and system libraries.
  • Removes packages that were automatically installed to satisfy dependencies for some packages that are no more needed.
  • Removes packages and configuration files which are not required by any other software upon your system.
  • Removes all stored archives in your cache for packages that are no longer in the repositories or that have a newer version in the repositories.
  • Deletes from cache the downloaded packages to free up some space.

All with just 2 clicks (thus the name).


2ClickUpdate is available in 20 languages and the latest version (6.0) finally works with Ubuntu 10.10 Maverick Meerkat. Other new features in 2ClickUpdate 6.0 include:

  • RamCleanApt, which optimizes RAM memory freeing up some MB's.
  • Redesigned User interface in 2Click Update
  • 2cuCORE (a command line version of 2ClickUpdate) edition is also available in .deb packages for easy installs/uninstalls
  • SmartApt module for installing/upgrading is now based on Update Manager


Here is a video demoing the latest 2ClickUpdate recorded by its developer, Salih EMIN:





Download 2ClickUpdate 6.0 (GUI ) - available as a .deb | Once installed, launch it via the Applications > System Tools > 2ClickUpdate menu item.


Thanks to Salih EMIN for the news and video!

Download Compress PDF 1.4 (Nautilus Script) [Updated]

Compress PDF

Compress PDF is a Nautilus script which uses ghostscript to compress PDF files and comes in 8 languages (English, Portuguese (pt-PT), Spanish (es-AR), Czech, French, Simplified Chinese, Arabic, Malayalam). The script lets you choose between 5 different compression levels: Screen-view only, Low Quality, Hight Quality, High Quality (Color Preserving) and Default.

Ricardo has just released an update (version 1.2) which fixes a bug that was causing metadata from the original PDF file (meaning author, title, creator) to be lost after compression.


Update: the post now links to Compress PDF 1.4 which comes with the following changes:

  • Compress PDF now uses notify-osd to inform the user when the compression is completed, and automatically exits (useful for bigger files);
  • Temporary files are now hidden;
  • Saving and replacing the original PDF file with the compressed one works as expected;
  • Fixed: If the user presses Cancel, at any time, Compress PDF will exit and temporary files will be removed;


To use the script, run the following commands in a terminal:
sudo apt-get install zenity ghostscript
cd ~/.gnome2/nautilus-scripts
rm "Compress PDF" #in case you're using an older version
wget http://launchpad.net/compress-pdf/1.x/1.4/+download/Compress-PDF-1.4.tar.gz
tar zxvf Compress-PDF-1.4.tar.gz && rm Compress-PDF-1.4.tar.gz


Or manually download the script from HERE.

Thanks to Ricardo Ferreira for the script and the tip!
 
Support By Blogger