Posts tagged with “linux”

Learning to appreciate ThinkPad X380 Yoga

A while ago, I bought a ThinkPad X380 Yoga. I saw it on eBay, it was cheap, and I've never really tried a convertible laptop before. So I thought, Why the heck not? When the machine arrived, I promptly installed Linux Mint on it.

ThinkPad X380

Everything worked out of the box, including display rotation and touch screen. I tried the pen, and it worked too. And while I thought it was rather neat, I wasn't immediately sold on the whole poke-your-screen-with-a-pointy-plastic-thing idea. But the more I use the machine, the more I appreciate the concept.

Continue reading

Super quick guide to Espanso

Espanso is a text expanding utility, and it's really good at what it does. If you find yourself typing the same text (your name, address, greetings, etc.) over and over again, Espanso is what you need. Deploying the tool is a matter of grabbing the right package, installing it, and running it as a service:

sudo apt install ./espanso-debian-x11-amd64.deb
espanso service register
espanso start

The example above uses Espanso 2.2.1 for Debian with X11. So if you use a different setup, adjust the first two commands accordingly.

To add text expansion rules, switch to $HOME/.config/espanso/match and open the base.yml file for editing.

An expansion rule consists of a trigger (that is, an abbreviation) and a text that replaces it:

- trigger: ":hello"
    replace: "Oh, hello there!"

Add the rules you need, and you're done. When you save the changes, Espanso automatically reloads, and you can use triggers everywhere — including command-line applications.

Get your exact position with a Bash one-liner

Need to get the geographical coordinates of your current position? On a Debian and Linux Mint, install the geoclue-2-demo package using the sudo apt install geoclue-2-demo command, then run the following one-liner:

/usr/libexec/geoclue-2.0/demos/where-am-i | grep -e 'Latitude' -e 'Longitude' | tail -n 2

If you need the latitude and longitude values only, use this one-liner instead:

/usr/libexec/geoclue-2.0/demos/where-am-i | \
grep -e 'Latitude' -e 'Longitude' | tr -d ' ' | \
cut -d':' -f2 | tr -d ° | tail -n 2

Running a systemd service as a regular user

A "note to self" post on how to create a systemd service and run it a regular user.

Assuming, you're logged in as a regular user, create the ~/.config/systemd/user/ directory using the mkdir -p ~/.config/systemd/user/ command. Then, create a .service file:

nano ~/.config/systemd/user/my_service.service

Specify the service options:


ExecStop=/usr/bin/kill -HUP $MAINPID


It's important that WantedBy is set to

Save the unit file, and reload the systemd daemon using the systemctl --user daemon-reload command. Enable and start the service as the user:

systemctl --user enable my_service.service
systemctl --user start my_service.service

Finally, run the loginctl enable-linger $USER command.

Give the notebook battery some TLC with TLP

Notebook batteries are fickle creatures. They don't like being charged to 100%. But they also not keen on being completely depleted. According to the conventional wisdom, to give your notebook's battery a long, productive, and healthy life, you should avoid charging it above 80% and discharging it below 25%.

Sounds simple, but how can you actually accomplish that without keeping your eyes peeled to the battery charge indicator? By letting the TLP worry about that. Install the tool on your system, configure battery charging thresholds, and leave it to TLP to take care of the rest. Here's how to do this on Linux Mint.

Continue reading