Wednesday, October 16, 2013

Search within text files by CLI

Open terminal in the target folder and run this command:

 grep -r <word> *

replacing <word>  with the needed expression.

Change the color font of Xfce desktop



Open home as root and ctrl-h to see hidden files.

Open .gtkrc.2.0 and add this:

style "xfdesktop-icon-view" {
XfdesktopIconView::label-alpha = 0

#Text colors you can delete if you want to use gtk theme colors
fg[NORMAL] = "#ffffff"
fg[SELECTED] = "#ffffff"
fg[ACTIVE] = "#0000ff"

}
widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view"




-------------
 (via)

I have changed the original lines that made selected font green so that it will stay white.

Delete these lines to get back to the default theme-based colors.

Friday, October 11, 2013

Dual monitors shortkey settings

~via~

With LXRandr, one can save  a certain display configuration. Then, in order to find that, you need to know what has changed in the home folder:

find ~/ -mmin -5 -type f
 
You can change 5 to a smaller number if you wish.
In this way, after saving configuration in LXRandr and running this command, the last change recorded is in ~/.config/autostart/lxrandr-autostart.desktop. That's it.
To open that:

gedit ~/.config/autostart/lxrandr-autostart.desktop
 
It contains something like:

[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --off
OnlyShowIn=LXDE 
 
What you need is (- with variable resolution - that is depending on my specific displays):
 
xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --off 

that is for the external monitor off, internal on.

To have the external on and the internal off:

xrandr --output LVDS --off --output VGA-0 --mode 1360x768 --rate 60.0 

To have extended monitor:

xrandr --output VGA-0 --auto --left-of LVDS 
 
Double desktop for a specific resolution for each display:

xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --mode 1360x768 --rate 60.0
 
To have the same display resolution on both:

xrandr --output LVDS --mode 1360x768 --rate 60.1 --output VGA-0 --mode 1360x768 --rate 60.0
 
or:
 
xrandr --output LVDS --mode 1680x1050 --rate 60.1 --output VGA-0 --mode 1680x1050 --rate 60.0
 
or lower:
 
xrandr --output LVDS --mode 1280x720 --rate 60.1 --output VGA-0 --mode mode 1280x720 --rate 60.0 


And for each you need to assign a key (that is done differently depending on the desktop environment).

Saturday, October 5, 2013

Use Nautilus actions to extract audio from video and more

Better than trying to add context menu commands to the minimalist Pantheon-Files of Elementary OS or to use other media applications to extract sound from video, I guess the most simple is just to install Nautilus (it is not at all problematic in eOS, contrary to Thunar, which comes with the whole Xfce environment).

 sudo apt-get install nautilus
also

 sudo apt-get install parallel


Then install Nautilus-Actions Configuration Tool and open it..

I will provide an example for extracting audio (aac in m4a container) from flv and mp4 video files.

Define a new action, give it a name, maybe an icon too. Check - 'Display action in selection context menu'.

 Use Context label: Extract as m4a






Under the command tab, add the command (the one that I use in Thunar - see the links in the question):

Path:
gnome-terminal
Parameeters:
 -e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.m4a' ::: %F"



Under Execution tab there are options to select depending on what you wan to see during and after the action (open terminal, report).

Under Basenames tab, enter the filters for the type of files in the context menu of which you want to see the command - in this case: *.flv and *.mp4.




There are other options, but these look sufficient for the purpose of my question.



Similar actions can be added to extract sound from other types of video and, of course for other very different purposes.

NOTE:
In fact the use of parallel is not necessary to select multiple files and process them:

avconv -i '{}' -map 0:1 -c:a copy '{}.m4a


will have the same result

Parallel has the theoretical advantage of processing one-by-one the selected file or to set the number of parallel processes.