Tag Archives: linux

Switch keyboard layout holding windows key

I find really useful to switch keyboard layout while holding a key. That way I can easily type an English while writing in Greek. Left Windows key is good option for me as I don’t really need it on my Arch Linux powered laptop.

Can be easily setup in /etc/X11/xorg.conf.d/01-keyboard-layout.conf:

Section "InputClass"
        Identifier "keyboard-layout"
        Driver "evdev"
        MatchIsKeyboard "yes"
        Option "XkbLayout"  "us,gr"
        Option "XkbOptions" "grp:alt_caps_toggle,grp:lwin_switch"
EndSection

A full list is available in /usr/share/X11/xkb/rules/xorg.lst

Take Screenshots on LXDE

Edit the following in ~/.config/openbox/lxde-rc.xml:

   

<keybind key="Print">
      <action name="Execute">
        <command>screenshot-desktop.sh</command>
      </action>
    </keybind>
    <keybind key="A-Print">
      <action name="Execute">
        <command>screenshot-window.sh</command>
      </action>
    </keybind>

To take a full desktop screenshot:

#!/bin/bash
DATE=`date +%Y-%m-%d\ %H\:%M\:%S`
xwd -root | convert - "$HOME/Desktop/Screenshot-$DATE.png"
notify-send "Desktop screenshot saved!" "A descktop screenshot was saved on your Desktop as:\n Screenshot-$DATE.png" -i /usr/share/icons/Tango/scalable/devices/camera.svg

screenshot-desktop.sh

To take the current window screenshot:

#!/bin/bash
 activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
 activeWinId="${activeWinLine:40}"
 activeWinTitle=$(xwininfo -id $activeWinId | grep 'Window id:' | cut -d"\"" -f2)


COUNTER=0
FILENAME="$HOME/Desktop/$activeWinTitle-Screenshot.png"

while [ -f "$FILENAME" ]; do
  let COUNTER=COUNTER+1
  FILENAME="$HOME/Desktop/$activeWinTitle-Screenshot-$COUNTER.png"
done


 import -window $activeWinId "$FILENAME"

notify-send "Window screenshot saved!" "Windows screenshot was saved on your Desktop as:\n $FILENAME" -i /usr/share/icons/Tango/scalable/devices/camera.svg

screenshot-window.sh