samedi 5 janvier 2019

how to remap key less than "<" greater that ">" on hp laptop omen (linux / gnome / arch) ?

- install xorg-xev: sudo pacman -S xorg-xev
- run xev
- in the window press the key you want to remap and look in the terminal what's the value for "keycode" (for me it was keycode=105)

KeyPress event, serial 34, synthetic NO, window 0x3e00001,
    root 0x167, subw 0x0, time 396542, (376,252), root:(459,402),
    state 0x10, keycode 105 (keysym 0x3c, less), same_screen YES,
    XKeysymToKeycode returns keycode: 94
    XLookupString gives 1 bytes: (3c) "<"
    XmbLookupString gives 1 bytes: (3c) "<"
    XFilterEvent returns: False

- now if you want less than "<" and greater that ">" holding shift, you have to use this command:
xmodmap -e "keycode 105 = less greater less greater bar brokenbar lessthanequal greaterthanequal"

- this change is only available during the user's session, after a restart you'd have to type it again.

- if like me you're using Gnome 3 (gnome-shell) you should add a new .desktop file in ~/.config/autostart to execute a script containing the command at each startup of the gnome session.
- for example create ~/scripts/keyboardRemapKey.sh with
#!/bin/bash
xmodmap -e "keycode 105 = less greater less greater bar brokenbar lessthanequal greaterthanequal"

- then create ~/.config/autostart/keyboardRemapKey.desktop with
[Desktop Entry]
Name=Keyboard remap
GenericName=Keyboard remap "less key" at startup
Comment=Keyboard remap "less key" at startup
Exec=/home/user/scripts/keyboardRemapLessKeyAtStartup.sh
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=true

and the change will be permanent.

//TODO: add some config files in
https://www.freedesktop.org/wiki/Software/XKeyboardConfig/Development/
https://www.x.org/releases/current/doc/xorg-docs/input/XKB-Config.html
https://michal.kosmulski.org/computing/articles/custom-keyboard-layouts-xkb.html

mardi 1 janvier 2019

how to add a new environment variable to PATH on ARCH/Debian/Ubuntu?

The global variable PATH is set up in /etc/profile.
What we want is to override this PATH variable's value with the new variable at the user level.
User variable configuration file is ~/.bashrc, so edit this file with your favorite editor:

at the end of the file add a line with your new variable declaration:

#my new variable
export MY_NEW_EXECUTABLE_HOME_DIR=/home/user/libs/myNewLib

then override the globally declared PATH variable like this:
export PATH="${PATH}:$MY_NEW_EXECUTABLE_HOME_DIR/bin"



bash script to convert all mp4 in a folder to mkv files with ffmpeg

 #!/bin/bash for i in *.mp4; do   echo "$i" "${i%%.*}.mkv"   ffmpeg -i "$i" -vcodec copy -acodec copy "${...