The XPS 13 is a great laptop and it comes with an equally matched touchpad. Setting up touch gestures is pretty easy, and we will cover what needs to be done to get it working on Arch.
First, let’s install all the needed software:
After installing the 2 packages you should be able to run libinput-gestures -d as root and try the pre-defined gestures. You should see an output when you swipe left/right/up/down with ¾ fingers and pinch in/out.
# libinput-gestures -d
libinput-gestures: session unknown+unknown on Linux-5.0.6-arch1-1-ARCH-x86_64-with-arch, python 3.7.3, libinput 1.13.0
/usr/bin/libinput-gestures: hash 4cc3250c5befc6926c04b3e499114677
Gestures configured in /etc/libinput-gestures.conf:
swipe up _internal ws_up
swipe down _internal ws_down
swipe left xdotool key alt+Right
swipe right xdotool key alt+Left
pinch in xdotool key super+s
pinch out xdotool key super+s
libinput-gestures: device /dev/input/event10: DLL075B:01 06CB:76AF Touchpad
libinput-gestures: SWIPE up 3 [-33.88000000000001, -604.8000000000001]
libinput-gestures: SWIPE right 3 [755.69, -17.479999999999993]
xdotool key alt+Left
Let’s add your user to the input group (because it should not run as root), then re-login:
sudo gpasswd -a [user] input
Now let’s edit our personal config file in ~/.config/libinput-gestures.conf. Using xdotool create a map of what keyboard shortcuts you would like to map your gestures to. Keep in mind you can also map it to commands.
For example, my config file looks like this:
gesture swipe up 3 xdotool key Ctrl+F9
gesture swipe up 4 xdotool key Ctrl+F10
gesture swipe left 3 xdotool key Ctrl+Alt+Right
gesture swipe right 3 xdotool key Ctrl+Alt+Left
gesture swipe down 3 xdotool key Super+Down
And the keyboard shortcuts are mapped to (KDE):
Ctrl+F9 - Show all windows (current desktop)
Ctrl+F10 - Show all windows (all desktops)
Ctrl+Alt+Right - Move to desktop on right
Ctrl+Alt+Left - Move to desktop on left
Super+Down - Desktop preview
Let’s configure the gestures to start with the desktop environment:
$ libinput-gestures-setup autostart
And start the gestures for the current session:
$ libinput-gestures-setup start
Icon theme "papirus" not found.
Icon theme "ubuntu-mono-dark" not found.
Icon theme "Mint-X" not found.
Icon theme "elementary" not found.
Icon theme "gnome" not found.
Bash keeps a history of the commands you type in and saves them to ~/.bash_history. These commands can be accessed in many ways and there are a lot of configuration related on how they are saved. I’ll cover some basic functionality here.
Event Designators (!, !!, !*)
From MAN Pages
An event designator is a reference to a command line entry in the history list. Unless the reference is absolute, events are relative to the current position in the history list.
For the different examples below, assume we are running it against the same command (netstat -an | grep ':22'). This is to help you visualize the differences between each of the event designators.
Repeating the last command that starts with !string
You can run the most recent command starting with string by using !string.
$ ls my_file.txt
.rw-r--r-- 0 victor users 18 Oct 11:35 my_file.txt
$ ls my_folder
drwxr-xr-x - victor users 18 Oct 11:35 my_folder
drwxr-xr-x - victor users 18 Oct 11:35 my_folder
Tip:you can use the :p option to print the command instead of running it
netstat -an | grep ':22'
Repeating the same command with !!
As you may already know, the !! can be used for repeating the same command.
$ echo !!
echo netstat -an | grep ':22'
This is useful when you forget to use sudo on a command that requires sudo access.
$ systemctl daemon-reload
Failed to reload daemon: Access denied
$ sudo !!
sudo systemctl daemon-reload
[sudo] password for victor:
Re-using the last argument with !$
Another very useful option is the !$, which provides quick access to the last argument in a command.
$ echo !$
This can come in handy if you need to repeat the last argument with another command.
$ touch my_new_script.sh
$ vim !$
$ mkdir myfolder
$ cd !$
The fc command
The command fc allows you to open commands in your history with an editor, modify the commands and then execute the modified version. It will use your default editor (as per $EDITOR), so make sure that is set.
Some common usage for fc:
fc -l - List your last commands
fc n - Edit the n command
fc -1 - Edit the last command
fc 20 22 - Edit commands 20 to 22
On this section we talk a little bit about some of the configuration available for your Bash history.
Adds time to each command in history
# Sets up time for history
export HISTTIMEFORMAT="+%Y/%m/%d %T "
$ history | tail -n 10
949 +2019/03/11 00:32:53 ssh seedbox
950 +2019/03/11 16:05:53 cd .config/polybar
951 +2019/03/11 16:05:56 ./launch.sh
952 +2019/03/11 17:49:38 lolbanner victor
953 +2019/03/11 17:53:10 lolbanner test
954 +2019/03/11 17:53:11 psg checkupdates
955 +2019/03/11 17:53:11 clear
956 +2019/03/11 17:53:11 echo hello 1
957 +2019/03/11 17:53:11 history
958 +2019/03/11 18:10:01 history | tail -n 10
This comes in handy if you run multiple terminal emulators simultaneously. By default, the latest closed terminal emulator will overwrite history from the other windows. With this setting, changes are appended making sure all commands are saved to history.
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend
Banners in *nix like systems is something that is being used for a very long time. System admins would sometimes use it to let users know that the system was going down (nowadays built-in with the shutdown command), or setup motd messages for SSH logins. Within the past years people got very creative with the use of different fonts and ASCII art.
For today’s post we will work With two different apps to display beautiful banners on your systems or config/dot files:
figlet - displays the banners
lolcat - colorizes the banners
pacman -Sy figlet lolcat
Figlet comes with a default font and you can start using it right away
fzf is a command line fuzzy finder that can be used to automatically filter a list of items. Think of it as an interactive search tool, where items get filtered as you type characters in your terminal.
The video below shows a basic interaction using a list or files from the fd search utility:
fzf can also be used with other Bash tasks, like history, ssh and even file/dir completion. The GitHub page has a lot documentation on how to implement auto completion.
You can also use the --preview option to output the current selection into a preview box, and even call a command to be used with that value. For example, we can preview all the files in a folder by searching for files (with find or fd), piping the output to fzf, and then using a program like cat (on the example below I’m using bat, which is a clone of cat with the addition of syntax highlight and other cool things) to preview the files.
I’ve covered only the very basic usage for fzf, but it should give you an idea of how powerful this finder utility is. On future posts I’m going to cover other use cases, like the git workflow that I use.