Monday, January 26, 2015

Command to cycle displays

I have found here about Disper. See link for details.

It can be installed from Synaptic or the terminal.
The command to cycle between clone, extended, internal and external displays should be like this:
disper --cycle-stages='-e : -c : -S : -s' --cycle
In that case, it would extend to the right. To cycle between the same options but extend to the left:
disper --direction=left --cycle-stages='-e : -c : -S : -s' --cycle
The command can be then associated to a short-key.
Disper will detect displays and use the maximal resolutions by default. If no external display is connected, nothing will happen when the short-key is touched.


ALTERNATIVE: associate each xrandr display configuration to a different short-key.

1. Install lxrandr (a simple display manager).

2. Run it, chose the display configuration you want, save.

3. In a terminal:

gedit  ~/.config/autostart/lxrandr-autostart.desktop
4. Copy/Paste the xrandr command from the file above, and associate it with a short-hey.

5. Close that file.

Re-do steps 2 to 5 for each command / display configuration.

Friday, January 23, 2015

Use Thunar custom actions to extract audio from video (without transcoding)

sudo apt-get install libav-tools
sudo apt-get install parallel  
Add the following command to Thunar custom actions:

xfce4-terminal -e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.m4a' ::: %F"
and the following conditions: *.mp4; *.flv,  video files.
That will extract to m4a container the acc audio from mp4 and flv selected files.
Or, also using `avconv`, but without the need to install `parallel`,   make an executable script, like

#! /bin/sh -e
for i in *.mp4; do avconv -i "${i}" -map 0:1 -c:a copy "${i%.mp4}.m4a"; done

Make it executable and save it.
In Thunar custom actions add a new entry with the command  

bash /path/to/the/script %F

and the following conditions: *.mp4, video files.

This needs separate custom actions for each file type (because it is limited to mp4 to m4a: make changes accordingly for flv to m4a, webm to ogg, avi to mp3 etc) but has the advantage that the output keeps the exact input name (file.mp4 becomes file.m4a), while with the first command does not (file.mp4 becomes file.mp4.m4a).

Change mac adress with Macchanger

sudo apt-get install macchanger macchanger-gtk

Start with the command