Lock and unlock the KDE desktop with a bluetooth device


Today my mouse right button stopped working, so I searched on my desk drawer and I have found a bluetooh mouse… I don’t usually like bluetooth devices, but if there is no more option… so, after install some basic bluetooth packages like bluez and the bluez-utils and start some daemons like bluetooth like this

sudo pacman -S bluez bluez-utils
sudo systemctl enable bluetooth
sudo systemctl start bluetooth

I finally could open System Settings and pair my new old mouse and continue working 🙂

But, some years ago, I played with a piece of software, called BlueProximity that can lock and unlock your computer based on a bluetooth device proximity you previously paired with the application.

I have taken a look into AUR and someone has prepared a package which works flawlessly. So first we can install it with

yaourt -S blueproximity –noconfirm

And then whe can start it right from the menu

Once started, first we must pair a bluetooth device. It’s supposed to work with any bluetooth device, when this application was developed, back in the ’00s, only PDA and phones were the only bluetooth powered devices, nowadays perhaps we can prefer to pair with a smartwatch or another IoT bluetooth enabled device 😉

The use is pretty straight forward

  • Make visible your desired device on its settings
  • Click on “Scan for devices”: your device should be shown on the list.
  • Select your device and click on “Use selected device”: its MAC now its copied to a text field below the former buttons.
  • Click on “Scan channels on device” to let the application scan for usable communication channels.

Now the device is paired with the BlueProximity. BlueProximity is a GNOME application, and if like me are using KDE, the lock and unlock commands will not work for you, so lets configure the right commands.

On “Locking” tab, we put this

The fields are


dbus-send –type=method_call –dest=org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.Lock; xset dpms force off


qdbus | perl -ne ‘qx/kquitapp $1/ if /(kscreenlocker_greet-\d+)/’; xset dpms force on

If you want to unlock the computer as you come near:

qdbus | perl -ne ‘qx/kquitapp $1/ if /(kscreenlocker_greet-\d+)/’; xset dpms force on

If you want only to wake up the screen

qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity

If your version of KDE is below 4.13, perhaps you must use those other commands.


qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock


killall -9 kscreenlocker

Enable bash completion after sudo command


If you usually work with the sudo command you will find yourself typing the entire command line after the first word: sudo. That’s pretty annoying and the solution, pretty straight forward.

First of all, we need to install bash-autocompletion package from extra repositories.

That’s all. 🙂


Netstat on Archlinux


Today a quick post to self-reference. I have lost 10 minutes searching on the web how to install netstat on arch linux. So if anyone of you fall in this post the answer is easy: on net-tools package.

In fact inside net-tools, we can find a very useful set of netwok tools:

[malevolent@malevolo ~]$ sudo pacman -Ql net-tools
net-tools /bin/
net-tools /bin/netstat
net-tools /sbin/
net-tools /sbin/arp
net-tools /sbin/ifconfig
net-tools /sbin/ipmaddr
net-tools /sbin/iptunnel
net-tools /sbin/mii-tool
net-tools /sbin/nameif
net-tools /sbin/plipconfig
net-tools /sbin/rarp
net-tools /sbin/route
net-tools /sbin/slattach
net-tools /usr/
net-tools /usr/share/
net-tools /usr/share/man/
net-tools /usr/share/man/man5/
net-tools /usr/share/man/man5/ethers.5.gz
net-tools /usr/share/man/man8/
net-tools /usr/share/man/man8/arp.8.gz
net-tools /usr/share/man/man8/ifconfig.8.gz
net-tools /usr/share/man/man8/mii-tool.8.gz
net-tools /usr/share/man/man8/nameif.8.gz
net-tools /usr/share/man/man8/netstat.8.gz
net-tools /usr/share/man/man8/plipconfig.8.gz
net-tools /usr/share/man/man8/rarp.8.gz
net-tools /usr/share/man/man8/route.8.gz
net-tools /usr/share/man/man8/slattach.8.gz

Add image to GRUB2


Well, after the recent upgrade on the Arch boot ISO, you should probably notice that the good and oldie GRUB 0.99 has been replaced by GRUB2, hated by some for their “complexity” – true is it takes some time to learn how to edit or add new entries – but with a lot of new features that makes your boot menu more fancy and useful.

Speaking about fanciness, today we’ll gonna change (or add one) our boot splash image. I want to show you to do this on the Arch way but for the lazies out there, I will introduce you two interestings GUI that can accomplish this and another GRUB2 related tasks.

First of all, lets download a PNG background image to use in our GRUB.

The Arch Way
Then, we will need to edit /etc/default/grub and add the path to the image we have just downloaded


Note that I have a word with an accent, it works. It will also work a blank space in the path because the double quotes.

You will need to change accordingly the color of the font and the highlighted item in GRUB, so if you want to have a white background image, choose a dark color to contrast and not blind yourself 😛

On /etc/default/grub, modify the entries

export GRUB_COLOR_NORMAL="white/black"
export GRUB_COLOR_HIGHLIGHT="white/blue"

As your wish, first color is foreground color and the second one, the background color.

To generate the changes, remember why some people hates GRUB2: it needs to “compile” the changes, not anymore will work by only modifying config files, so do:

# grub-mkconfig -o /boot/grub/grub.cfg

If adding the splash image was successful, you will see "Found background image..." in the terminal as the command is executed.

If this phrase is not seen, the image information was probably not incorporated into the grub.cfg file. Please, take a look to the documentation

GTK way: grub-customizer
On AUR we can found a gtk application called Grub Customizer. So let’s install it:
$ yaourt -S grub-customizer
It obviously needs root password to run, so the easiest way to execute it is with the gksudo utility, like this:
$ gksudo grub-customizer
Then a gtk dialog appears asking us the root password (not sudo password). We can introduce it and the interface will appear.

You will see a windows with several grub entries, and several buttons as well, but to change/add the background image, you will need to click on the “Preferences” icon. This will pop up another window with three tabs. The second tab, “Appearance” will let us set background image and fonts.

Once set, we will close this window, save the changes and then, click on “File” menu –> “Install in the MBR”


Just say that this application can be used under KDE as well, but if you are a GTK hater, you probably want to use the next method instead. For all the rest, instead of gksudo, you will need to use kdesu to invoke grub-customizer.

KDE way: GRUB2 Editor
KDE4 has a KDE Control Module for configuring the GRUB2 bootloader. Its name is GRUB2 Editor and you will find it also in AUR. So to install it let’s run:
$ yaourt -S grub2-editor

Once installed, we will find it on System Settings --> System Administration --> Startup and Shutdown --> GRUB2 Bootloader

The usage will be like Grub Customizer.

Well, hope you enjoy your useless but cool GRUB2 splash image!

Colored bash prompt


Perhaps you use a simple terminal like xterm, aterm, eterm, or some a bit more sophisticated lije konsole o gnome-terminal. In such case, maybe this article isn’t for you… but maybe you use a most avanced and featured-rich terminal like yakuake, guake or terminator, or you are used to gentoo’s bash colors like me. Then you will find default’s arch linux bash prompt is quite ugly and hard to recognize who are you in a given time or which of those hundred files are executables or directories or hard/soft links only with a glance.

You can then, edit your .bashrc or even better, edit /etc/bash.bashrc and replace (if you never modified it) its content with the original and unmodified Gentoo’s bashrc

# /etc/bash.bashrc
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !

# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.

if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize

# Enable history appending instead of overwriting. #139609
shopt -s histappend

# Change the window title of X terminals
case ${TERM} in
PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}07"'
PROMPT_COMMAND='echo -ne "33_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}33\\"'


# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true

if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)

if [[ ${EUID} == 0 ]] ; then
PS1='\[33[01;31m\]\h\[33[01;34m\] \W \$\[33[00m\] '
PS1='\[33[01;32m\]\u@\h\[33[01;34m\] \w \$\[33[00m\] '

alias ls='ls --color=auto'
alias grep='grep --colour=auto'
if [[ ${EUID} == 0 ]] ; then
# show root@ when we do not have colors
PS1='\u@\h \W \$ '
PS1='\u@\h \w \$ '

# Try to keep environment pollution down, EPA loves us.
unset use_color safe_term match_lhs