Wednesday, May 8, 2013

How to add "show desktop" button to Tint2 panel ?

As openbox user , who uses tint2 and likes it very much , i tend to miss my show desktop button I enjoyed in other panels (xfce4,etc) ...
here is brief how-to guide to add "show desktop" button to Tint2 panel..
1-you need to have tint2-svn version of tint2 which includes applications launcher
2- make sure you have wmctrl app installed ..
3- cd to /usr/bin

cd usr/bin
 and create show_desktop.sh script with the following code
 #!/bin/sh  
 if wmctrl -m | grep "mode: ON"; then  
 exec wmctrl -k off  
 else  
 exec wmctrl -k on  
 fi  
save the file and change its permission to a+x

chmod a+x show_desktop.sh

now we need to create .desktop entry for our script 

cd usr/share/applications

sudo mousepad show_desktop.desktop s

add the following

[Desktop Entry]

Version=1.0

Exec=/usr/bin/show_desktop.sh

Icon=/usr/share/applications/Desktop-32.png

Terminal=false

Type=Application

Icon line is optional , but if you want to use customized icon ,
move the icon to /usr/share/applications ,
 identify the icon
identify Desktop-32.png
 and modify the line accordingly
modify your tint2rc configuration file and add the following
#------------------------------------------
#LAUNCHER
#------------------------------------------
launcher_icon_theme = areao43
launcher_padding = 4 4
launcher_background_id = 1
launcher_icon_size = 40 
launcher_item_app = /usr/share/applications/showdesktop.desktop

here is screenshot of my desktop =)
 

 sources used in this how-to with some personal modifications

 https://wiki.archlinux.org/index.php/Tint2#Application_Launchers_in_tint2-svn_.28AUR.29
http://crunchbang.org/forums/viewtopic.php?id=6455
 http://code.google.com/p/tint2/wiki/FAQ#Adding_a_%27show_desktop%27_button

Thursday, April 25, 2013

Chinese characters not displayed properly in firefox ?

I use Arch -Linux linux distribution, I don't speak chinese , but I surf some chinese trackers from time to time , the problem is the characters are not displayed properly as you can see in this screenshot
so, how can we fix it?
just install this package .. which is basically a sans-serif font with all chinese glyphs 
sudo pacman -S wqy-microhei

that's it.

Thursday, April 11, 2013

How make usb-headset as default sound card in Arch Linux

last week I installed ArchBang as replacement to ubuntu ,the installation process went smoothly since all partitions were already set-up, I like it so far , it's more challenging and the learning-curve for me has been great, it requires much more tweaking but in the end , you are in control of every bit of your system. I had few problems though, one of them was cofiguring ALSA sound drivers to take USB-Headset as default card for sound playback, it's possible to choose the audio driver in Smplayer and VLC but not all apps offer this feature and best solution is to edit system-wide setting to take the usb-headset as default.
this is the source I used (if you are into reading  +1000 word guide =) ).
here what i did:
I created a sh script  to generate .asoundrc file with usb-headset as default device
 nano asoundrc.sh  
 paste the following code
 % cat /usr/bin/asoundrc  
 #!/bin/bash  
 # asoundrc v0.1.0 20090101 markc@renta.net GPLv3  
 # asoundrc v0.2.0 20090320 quatro_por_quatro@yahoo.es GPLv3  
 #  
 # A simple script to create a particular default audio device regardless  
 # of what cards are loaded or in what order. It could be used anytime or  
 # placed in a ~/.bashrc script for a persistent setup every login.  
 #  
 # Usage: asoundrc [DEFAULT_CARD] > ~/.asoundrc  
 # use the first parameter as the card name, or else  
 # look for the sound card, discarding those that are only microphones  
 # when there are multiple cards, use the first one  
 if default_card="${1:-$(cat "$(for f in $(ls -1 /proc/asound/card[0-9]*/{midi,codec}* 2>/dev/null); do echo "${f%/*}"; done \  
 | sed -e '\|^[\[:blank:]\]$|d' -e 'q')/id" 2>/dev/null)}"; then  
   echo "Using sound card: ${default_card}" >&2   
   cat /proc/asound/card[0-9]*/id | \  
   gawk --assign default_card="${default_card}" \  
 '{print "pcm."$1" { type hw; card "$1"; }\nctl."$1" { type hw; card "$1"; }" }  
 END {print "pcm.!default pcm."default_card"\nctl.!default ctl."default_card}'  
 else  
   echo "Warning: No sound cards found." >&2  
 fi 
 
 chmod a+x asounrc.sh  
execute the script

here is the output in my case


Using sound card: Intel
pcm.Intel { type hw; card Intel; }
ctl.Intel { type hw; card Intel; }
pcm.CinemaTM { type hw; card CinemaTM; }
ctl.CinemaTM { type hw; card CinemaTM; }
pcm.Headset { type hw; card Headset; }
ctl.Headset { type hw; card Headset; }
pcm.!default pcm.Intel
ctl.!default ctl.Intel
as you can tell, the default card  is Intel (last two lines) , all we need to replace intel with Headset ,copy the text
now create .asoundrc file in your home folder , paste the code , log out then log-in , to see the changes

 #create .asoundrc file in your home folder  
 sudo nano ~/.asoundrc  
 #paste the code and save your work  
 pcm.Intel { type hw; card Intel; }  
 ctl.Intel { type hw; card Intel; }  
 pcm.CinemaTM { type hw; card CinemaTM; }  
 ctl.CinemaTM { type hw; card CinemaTM; }  
 pcm.Headset { type hw; card Headset; }  
 ctl.Headset { type hw; card Headset; }  
 pcm.!default pcm.Headset  
 ctl.!default ctl.Headset  

there are may be other ways to do the same thing but this one sounds simple and did the job for me.


Friday, April 5, 2013

Copy , the new player in Cloud Storage field

They are tens of cloud storage services out there, most popular include -but not limited to- dropbox, gdrive, skydrive, ...
recently we got a new one called Copy ...
it offers 5 Gb as a start, cross-platform with support for linux and android devices.
nice web GUI , sharing options are plenty and easy to use.. you can try it out by registering through this referrral link where both of us will get extra 5 GBs =) 

Friday, February 8, 2013

Google maps vs Openstreetmaps


One shouldn't take Google services for granted ,all these greedy companies care about is money , and even though they use users' input and geotag data to update their maps , they charge you indirectly for it...
it's true I enjoy using Google Navigation app for free on the Galaxy S2 ,but I think it's wise to explore other options in the future...
opnestreetmaps.org is like Wikipedia for maps. it's still lacking compared to Google maps especially in third world countries but that's could be changed if more users contributes the project, take a look at this picture provided in the article and compare it too Google maps.

For me , instead of complaining about the inaccuracy of the openstreet maps , I started adding information about my area, mainly main roads,schools, markets, worship places ,etc... and that's the beauty of open-source project , if you don't like it , you could modify it to suit your needs, but I got to admit it takes time to get used to the editor

Monday, December 3, 2012

How do I rar a file into several parts in Linux?

this tip is taken literally from Superuser but i think it worth spreading..i use it very often in linux which makes command line handling of files enjoyable ;) -not all the time of course- , this little command comes handy when you try transferring huge files on Fat HDDs which support max file size of 4 Gbs...

rar -a -v<size in b,k,m> split.rar files_to_slplit.mkv
in my case ,
 rar a -m0 -v1000000k 1.rar  *.mkv

Thursday, November 29, 2012

Rockbox on Sansa Disk Clip Zip

After my beloved Ipod classic got stolen , I needed another mp3 player with the following features
efficient but relatively cheap.
  • micro sd card slot to upgrade and swap songs.
  • open source friendly.
  • can handle various media files other than well-known mp3 format.
  • light-weight and portable.
  • doesn't attract much attention such as fancy apple products :/
  • plays well with DRM audiobooks (audible specifically ).
 I purchased the Sandisk clip zip 4 Gb..and I like it so far,but i needed more.So , dual booting with Rockbox was my choice, the installation didn't take much time , failed first at linux pc but it went OK on Windows 7 , i guess it has something to do with the drivers or the usb-mode.
Rockbox is full of features and highly customizable (I need to go thru the 128-page manual to get a full picture of i'm missing so far). what i liked most :
  • plugins such as calculator, alarm , 
  • ability to forward 1-2-5 minutes (not possible on SanDisk OS ).
  • support of all sort of playlists .
  • support of many media format.
  • bookmarks and resume from where left .
  • customizable .cfg files for settings editing on pc (can be transferred via usb to the sansa)