Thankfully, there’s a few add-ons, that makes YouTube a little less annoying and distracting to use. At least for me. With the help of the add-on Unhook, I’ve been able to completely disable the default landing page, which is apparently called the “Home feed. Now when I visit youtube.com, I get automatically redirected to my subscriptions page.
Unhook, have also enabled me to hide things like the live chat, screen feed, end screen cards, inapt search results, the Explore and Trending sections and the Shorts Tab.
The second add-on I use for YouTube, is Enhancer for YouTube. It focuses a lot more on the video watching part, but it does a few things that Unhook also does.
With Enhancer for YouTube, I’m able to make things a lot less distracting when I’m watching videos. All I see, is the video. Nothing else. Well. Except for the top header, which I did try to hide, but I wasn’t able to access the search feature then.
The video might look to be in some sort of full screen mode, but it’s just expanded by default, to make use of as much screen space as possible. This means that all the other content, like video title, description, recommended videos, are forced down below the video. Which means that I can’t see it, unless I choose to scroll down to see it.
With the add-on Enhancer for YouTube, I’m also able to always set the playback quality to 4k. By default, YouTube seems to choose some random quality for me. I can also do things like disable autoplay for all videos, automatically expand the videos descriptions and hide Shorts.
]]>Some day, I might get bored with Linux Mint, and would like to go back to Gentoo again.
It would turn out that, that “one day” would be the day after me publishing the post. Why? Well. When I sat down last night, trying to get some actual work done, I got kinda annoyed with how stacking window managers work. And I felt a bit distracted by all the eyecandy when I tried to focus get things done.
I guess, that eyecandy desktop setups doesn’t work for me, after all. It was fun trying it out though. I’m still going to keep Linux Mint around, and tinker with it from time to time. I might even use it for a day or so when I get bored of Gentoo the next time.
]]>Eventually, I decided that it would be fun to try out something completely new and different. Something with a bit more eyecandy to it, even if it would mean a less ‘productive’ option. I don’t spend much time at my computer these days anyway, and computers should be fun to use!
Something that looked good out of the box was important for me, as well as a system that I’m familiar with. It also needed to be something that had proven themselves to be a reliable project over a long period of time. And it needed to be something that was beginner-friendly. I didn’t want to spend time learning something new, and I didn’t want to spend time modifying the looks of it, other than minor tweaks. I wanted something beginner-friendly, because I didn’t want to have to care about anything. Everything should just work.
With Gentoo—everything—is about choices. Which is great. If, you want a custom-built operating system that’s 100% tailored for you, by you. It also means that you get to/need to make a lot of decisions and choices. That can be a lot of fun, but I don’t feel like that’s something for me, at least not at this point in life.
I haven’t been using Linux Mint for more than a week or so, but it has been a fun and rewarding experience so far. Linux Mint, both looks and works just great! Let’s just hope that it stays that way.
The desktop environment, which is called Cinnamon, has been a pure joy to use. I was honestly sceptical about finding a desktop environment that would make sense and work me, but so far, everything seems to work just fine. I really don’t have to use the mouse for any window management at all. Which is equally surprising as pleasing for me. I really like all the manual semi-tiling features it comes with.
It seems like there’s a lot of features and settings in Cinnamon. I have been able to make a lot of tweaks and changes, that makes things work a lot better for me, and how I want things to work. The only thing I couldn’t find, was a way to centre windows. Thankfully, that is easily fixed with the tool xdotool and this handy Bash-script (that I found, somewhere, on the Internet, a long time ago, and I have no idea who wrote it):
#!/bin/bash
IFS='x' read screenWidth screenHeight < <(xdpyinfo | grep dimensions | grep -o '[0-9x]*' | head -n1)
width=$(xdotool getactivewindow getwindowgeometry --shell | head -4 | tail -1 | sed 's/[^0-9]*//')
height=$(xdotool getactivewindow getwindowgeometry --shell | head -5 | tail -1 | sed 's/[^0-9]*//')
newPosX=$((screenWidth/2-width/2))
newPosY=$((screenHeight/2-height/2-29))
xdotool getactivewindow windowmove "$newPosX" "$newPosY"
It almost feels like cheating when I use a desktop environment with graphical tools and applications for everything. Pairing my Bluetooth headphones? No worries. It’s just a few clicks away. No more spending time reading the manual pages, and trying to remembering some commands, that I’ll probably forget about until next time anyway.
The one thing that I don’t like with Cinnamon, is the menu. It’s too… modern? I miss a good old classic menu. Something that you would find in an older version of Xfce.
Gentoo is still around. I have no plans on abandoning Gentoo, but for now, it’s in maintenance mode only. And who knows. Some day, I might get bored with Linux Mint, and would like to go back to Gentoo again.
]]>I first tried to cover it with a piece of paper and some tape, but that didn’t work. It probably just made it more annoying for both of us. My second idea was a success though. I was able to disable it in the operating system itself. It took me a few tries (read: reboots), before I figured it out though.
I was trying to solve it via acpid, but I never got it to work. It turns out that if you use elogind, it will steal the power button input and shutdown the computer no matter what. Thank you Zucca on Gentoo forums for that piece of valuable knowledge.
I added HandlePowerKey=ignore
to the [Login]
-section in the file /etc/elogind/logind.conf
. I then restarted elogind using the command # rc-config restart elogind
. Zucca wrote that it would restart your session, but it didn’t for me. I don’t know if I had to or not, but I manually logged out and back in again, just in case.
And that’s all. When my son is now pressing the power button on my computer case, it does absolutely nothing! I’m happy, and my son is happy!
]]>I first created a desktop entry file called mutt.desktop
, in the folder ~/.local/share/applications/
, with the following content:
[Desktop Entry]
Type=Application
Name=Mutt
NoDisplay=true
Exec=/usr/bin/urxvt -e mutt %u
Terminal=true
FIY: If you use a desktop environment, and want a fancy shortcut for Mutt, you could consider adding these values as well:
Icon=email
Categories=Internet;
StartupNotify=true
I then added the following content to the file ~/.config/mimeapps.list
:
[Default Applications]
x-scheme-handler/mailto=mutt.desktop;
And then everything just worked for me.
]]>In the end, I decided to go with a static solution that only requires a tiny bit of manual work by me. I don’t expect a lot of comments anyway. It’s all based on the “Dead Simple Jekyll Comments” project.
I basically copied their product, removed a bunch of features, made some tweaks to it, to make it work better with how I like things. I removed things like the privacy invasive feature that make calls to the Gravatar service, and the ‘reply to comment’-feature. There’re also no notifications or anything like that. I wanted it to be as simple as possible.
It works by you e-mailing me your comment—using my fancy mailto-link—that you can find in the comment section, located below each post. When I accept your comment, I’ll just send the content to a shell script that does the rest of the work for me.
While this might not be for everyone, I personally really like the simplicity of it.
]]>I first heard about Gandi, the French cloud service provider, after getting my Ubuntu Membership back in 2009. It turned out that the Ubuntu Membership came with a few perks. One of the perks, happned to be a generous discount rate at Gandi.
I became a customer at Gandi, partly because of the discount, but also because I liked that they both funded and supported various non-profit organizations and open source projects, like Creative Commons, Gnome, Electronic Frontier Foundation, Students for Free Culture, World Wide Fund for Nature, International Federation for Human Rights, Ubuntu and Debian. They also used open source software themselves, at least for some of their services. And their services seemed to be good and reasonable priced as well.
Before TWS bought Gandi, I paid about 11 EUR per year, for a .SE-domain. All domains also came with 3 free e-mail accounts, with 3 GB storage for each account. That all changed when TWS took over. My expenses for my domain and my e-mail, went from 11 EUR per year, to about 75 EUR per year. That’s a 681% (!) price increase.
The 3 free e-mail accounts that used to be included with each domain for free, now costs 4 EUR monthly, per account. Which is a bit pricey for a rather basic e-mail service if you ask me. And my 11 EUR domain, now costs 34 EUR. That’s just not okay.
And yes. I’m well aware that free e-mail was rather generous of them. I would have gladly paid about 1-2 EUR (monthly) for it. If, the domain was still at 11 EUR. TWS took it way too far.
First: GleSYS is a sponsor of Linuxkompis! They have sponsored my Swedish project Linuxkompis, with a VPS since the start of Linuxkompis. And that’s it. They have nothing to with me moving my domain to them. And I get nothing for moving my domain to them either. They’re most likely not even aware of the fact that I have moved my domain to them. The domain “linuxkompis.se”, is paid in full by me, with my own money.
GleSYS is a Swedish cloud service provider that uses green and sustainable energy. They also happen to charge a much more reasonable yearly fee at 192 SEK (≈16 EUR) for my domain. And as an added bonus, their user interface is way better than the one that Gandi ever had.
While GleSYS do provide an e-mail service, they don’t have two-factor-authentication for it, only for the regular cloud account. Which is a big no no for me. It doesn’t matter if they have the most sophisticated e-mail features of all providers out there. If I can’t secure my e-mail account with 2FA, I’m not even going to bother trying them out.
That’s why I went back with Mailbox.org. I used to be a customer at Mailbox.org in the past, before I moved over to Gandi a couple of years ago. I wrote about it here.
I did look around for other alternatives, before settling with Mailbox.org. They seem to be the best option out there today. It should also be noted that, since I wrote my last post about them, they have replaced the Google reCAPTCHA spyware with something called Friendly Captcha. Which is a privacy-first and fully GDPR-compliant service from Germany. They also don’t use cookies or store personal data from the users. A wise move by Mailbox.org.
I have only used Mailbox.org for about two months now. Some things are still the same, like their website, which is still, ehh.. confusing and quirky to use. We’ll have to see about the rest, but I have no complaints about the service in general though. They have always provided me with a reliable and high quality service. And to be fair, it’s not like I’m accessing my account via their website that much anyway.
]]>I try to keep my subscribed channels to a bare minimum. If I remove a channel, it doesn’t mean that I think it’s bad or boring, it’s just that I’m currently prioritizing something else at the moment.
Page last updated: February 24, 2024.
My Raspberry Pi 2, was mainly used for running WeeChat with BitlBee. WeeChat is a text-based IRC-client, and BitlBee brings instant messaging to IRC-clients. This meant that I could use my IRC-client for XMPP. Which is my go-to instant messaging platform, since the dawn of times.
The good thing with this setup, was that I could simply use my IRC-client for XMPP. WeeChat is my all-time favourite client. It’s something that I’m comfortable with, and it happens to be a fairly advanced client. You can customize to your liking in any way possible, with the large repository of plugins, that’s available for it. The bad thing with this setup, was the fact that the latest release of BitlBee is more than 4 years old. And even back then, the support for XMPP was lacking, at best. BitlBee, doesn’t support things like OMEMO (end-to-end encryption), MAM (Message Archive Management) or simply sending/receiving files.
No support for MAM, means that any message that I receive while offline, is lost forever. Well. For BitlBee at least. Any client that does support MAM, would have fetched the messages and showed them to me, the next time I would have logged in.
That’s why I was running it on a Raspberry Pi. It’s tiny and it doesn’t draw any power at all. Which meant that could always have it running 24/7, without ever worrying about an expensive electricity bill.
While it wasn’t a perfect setup, I was okay enough with it. It was actually a setup, that I used for almost a decade. The reason I decided to retire the setup, was for the fact that I currently don’t spend much time with my computer. And I don’t see that changing in the near future. The time I do spend with my computer, isn’t really spent on IRC or XMPP anyway.
I also have to give Alpine Linux, some love here. Alpine Linux is an “independent, non-commercial, general purpose Linux distribution designed for power users who appreciate security, simplicity and resource efficiency”. I quoted their website.
Alpine Linux is built around musl libc and busybox. Which makes it small and resource efficient. I think the base installation weights in at about 120 MB disk usage. Another neat thing with the ARM-version, is the fact that I only runs from RAM. This means that your poor SD-card is saved from constant abuse, and could potentially last forever.
My new setup is simply running a client on my desktop computer. I choose Gajim, which supports both OMEMO, MAM and other fancy things. It’s a pure XMPP client, which means that it doesn’t support the IRC protocol, but the only IRC-channel that I’m still active on these days, are bridged to an XMPP-room anyway.
And yes. Gajim is a graphical client. It’s not usually what I use. It was actually quite difficult, switching to something graphical, but I’m slowly getting used to it. I also don’t like the fact that it’s trying to be ‘modern’, with bloat like “workspaces”, that you can’t even disable… It seems to be the least bad client right now though.
I’ve been using Pidgin in the past, but they lack modern XMPP features like BitlBee as well, but the new major upcoming version of Pidgin, looks promising though! I’m patiently waiting for that to happen.
And the reason that I didn’t choose a text-based client like Profanity or Poezio—that both have good support for XMPP—was for the simple fact that this old dog, don’t have the time or motivation to learn new tricks. At least not right now.
]]>In my last post, I was trying out Debian. I had some idea that I wanted to try out something dead simple. I think that idea lasted for about a month, before I went back to Gentoo again.
My desktop looks pretty much the same as the previous years. I haven’t really changed much in.. an eternity ago. Well. Why change something that works.
In the last post I wrote “No more panel”. I turned out that I actually like having a panel. ;)
Here’s some information about my setup and some of the more frequently used software that I use regularly.
Operating system: | Gentoo Linux |
Window manager: | i3 |
System panel: | Polybar |
Shell: | zsh |
Terminal emulator: | URxvt |
Terminal typeface: | Terminus |
Terminal colour scheme: | Solarized |
Application launcher: | Rofi |
Notification daemon: | Dunst |
Text editor: | Neovim |
File manager: | Ranger |
Web browser: | qutebrowser |
E-mail client: | Mutt + mbsync |
Web feed reader: | Newsboat |
Password manager: | KeePassC |
Bookmark manager: | Buku |
Media player: | mpv |
Image viewer: | sxiv |
Instant messaging client: | WeeChat + bitlbee |
Document reader: | Zathura |
Calendar: | Khal |
Contact book: | Khard |
CalDAV/CardDAV-sync: | vdirsync |
It would be fun to see what your desktop looks like. Feel free to comment on this post on Mastodon with some pictures and information about your setup.
]]>My wife wanted to buy some keycaps for her younger brother as a Christmas present. After asking me for some advice, she decided to buy the Tai-Hao Sunshine keycaps. They were available for 449 SEK (≈40 EUR) a few weeks before Christmas.
Tai-Hao is an old company from Taiwan, founded back in 1962. They manufacture computer keyboards, keyboard keycaps, keyboard switches and card readers. This particular set is an “exotic” set, and it’s available in both German and ‘Nordic’. The Nordic language support means that they have combined the Swedish, Finnish, Norwegian and the Danish language on one set of keys.
For some reason, they included two tools for removing keycaps. A plastic version and a metal wire version. Don’t use the plastic tool! It will most likely scratch your keycaps.
The complete set consist of 114 colourful and vibrant keys. Nine of them are extra keys, while the rest is standard keys for a full-size Nordic ISO keyboard. The extra keys are:
There’s also a ‘non-exotic’ ANSI version of this set as well. It seems to have some add-on kits that supports the UK-ISO-layout and some keyboard specific layouts, like the non-standard Razer BlackWidow, the Leopold FC-980M and some other keyboards and layouts.
The bad is honestly not that bad, at least not considering the price and the target audience, which is non-enthusiasts and gamers.
The set is compatible with a full-size standard ISO keyboard layout. They have included a few extra keys, but if you have some non-standard layout, you’re most likely out of luck in terms of compatibility—unless if you invest in some of the add-on sets, which might be difficult and/or even a bit too expensive to get your hands on, depending on where you live.
The keycaps are only 1 mm thick. If that doesn’t mean anything to you, it’s most likely won’t be of an issue for you. Me personally, prefer keycaps that’s 1.3 to 1.5 mm thick, as they make for a better sound profile.
The good thing about combining the Nordic languages into one set of keycaps, is that you can keep the price down for the keycaps. The bad thing, is that the keycaps looks cluttered with a lot of extra text.
I would personally never buy (or even recommend) any keycaps, unless they’re made out of PBT-plastic. The durability, compared to regular keycaps made out of ABS-plastic, is light-years better.
I have owned multiple keycaps in ABS-plastic—before I found out about PBT-keycaps—and they all started to show wear just after a few months of use. And they eventually started to shine not long after that. Compare that, with my oldest PBT-keycaps, which have been used and abused for more than six years now, and they still look pretty close to brand new.
Another thing that I like about PBT-keycaps is the rugged texture they tend to have. This makes for a pleasant experience for the fingertips when you type on them. These keycaps had an extra rugged surface.
It’s also worth mentioning that PBT-plastic, don’t turn yellow by UV-light, like ABS-plastic do. Well. Unless you have dark keycaps, then it doesn’t really matter anyway.
Double-shot moulding is the process of moulding plastic around a preformed metal or plastic insert. This has been a popular process to create truly durable keycaps. It used to be a common method back in the 70s and 80s, back when keyboards wasn’t complete rubbish.
The good thing about double-shot moulding is that the legends are razor sharp and fully flush to the keycaps, which makes them pleasant to type on. The legends will also never wear our.
The price is decent, especially considering what you get for the price. If you want any of the ‘enthusiast sets’ (from brands like enjoyPBT), you often have to spend 3 or 4 times the amount of money.
This is an excellent set for anyone who’s looking for a colourful set, which won’t break your bank.
]]>Unfortunately. I derped a little bit. While I was working on it, I accidentally copied some source files from my Swedish website to this website. The mistake itself was quick and easy to revert. The real issue was that I accidentally published several hundreds of ‘new’ posts here, in Swedish.
My apologies to anyone who happen to be subscribed to my web feed and got flooded with a bunch of Swedish posts from my other website.
Anyway. On to some more positive things. If you read this, it means that I have a working workflow for composting and publishing content using my phone. It’s nothing fancy. It just involves git and running Jekyll on my server, instead of on my desktop computer.
]]>My current desktop computer is getting old and while there’s nothing wrong with it, it’s quite a bulky dust magnet that takes up a lot of space. It would be nice if I could replace it with something that’s portable and takes up a lot less space.
I’m not doing any heavy tasks these days anyway, which is especially true since I replaced Gentoo with Fedora, which is why the limited performance and cooling on a laptop isn’t going to cause any issues for me anyway. And honestly, any modern AMD mobile CPU is probably way faster than my—more than decade old—CPU now anyway.
And with some modern laptop computers you’re also able to connect an external monitor via USB-C and charge the computer via the same cable. I can only imagine how clean my potential battletop setup would look like.
Feel free to recommend me anything you think would be a good fit for me. My requirements are few and simple:
I’m fully aware of the Framework laptop computer, but it features a blank screen that requires fractional scaling, which doesn’t seem to be working that good in Linux based operating system. It’s also important that it’s usable around any sort of light sources, which is why I don’t want a blank screen.
Another thing that’s important for me, is reasonable repairability. I want to be able to replace both the battery and the disk when they go bad and need to be replaced. Any other repairability is a plus, buy not a requirement.
I’m also aware of the fact that a laptop keyboard can’t compare to a proper mechanical keyboard, so I don’t have high expectations here. I just want something that’s decent in terms of laptop computer keyboards.
]]>I tried giving libinput a chance, but I couldn’t come close to finding some sane mouse settings for it. I strongly dislike silly things like mouse acceleration. If I want to quickly move my mouse cursors across the screen, I’ll just quickly move my arm…
Thankfully, it’s possible to go back to evdev, and it’s not that difficult either. You just have to install the package for it. In Fedora the package is named xorg-x11-drv-evdev
.
Then create a file named something like /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
, with the following content:
Section "InputClass"
Identifier "My Mouse"
MatchIsPointer "yes"
Driver "evdev"
Option "AccelerationScheme" "none"
EndSection
Save the file, restart X.org and enjoy your sane mouse settings. I personally set my mouse settings using xset
. I keep my profile flat with xset m 0/0
.
No authenticators available
It turns out that I needed to install the package cyrus-sasl-plain
for Mutt to work with my host Gandi. The cyrus-sasl-plain
package contains the Cyrus SASL plugins which support PLAIN and LOGIN authentication schemes. I happen to use the LOGIN
authentication.
It’s—relatively speaking—an economical build. I haven’t counted the total sum for it, but I think it ended up slightly above 200 EURO. Which I consider to be a excellent price for a high quality custom-built keyboard that both sound good and feels buttery smooth to type on.
Keyboard size: | 60% |
Case: | NPKC low-profile aluminium case (Black) |
Circuit board: | Aves 60 (Hotswap) (Prototype) |
Switches: | Gateron G Pro White Linear Silver (38 gram springs) |
Plate: | Universal aluminium plate (Black) |
Stabilizers: | DUROCK screw-in stabilizers (Clear) |
Keycaps: | Blank keycaps from NPKC (Cherry-profile) |
The PCB is called Aves 60. It’s a hotswap PCB with an ISO-layout and a split right Shift-key. Hotswap means that it’s basically ‘plug and play’. There’s no soldering required as it is with a ‘regular’ PCB. While soldering the switches is okay, de-soldering them without proper (read: expensive) equipment it’s time-consuming and everything but pleasant work. That’s why I’m rather excited about my first hotswap PCB.
The Aves 60 is currently just a prototype to make sure that it was designed correctly and that everything works as expected, which it does. This means that we’ll move on to production soon and it should be available in the stores in a few months from now, if everything goes according to plans.
The Aves 60 and the Aves 65 both support QMK, VIA and VIAL. Which is also great news for me! I have until now, used a PCB called S60-X from Sentraq. It’s an old model that’s only supported by QMK. And unfortunately, the physical ISO-layout that I use, isn’t supported by the graphical configuration tool for QMK. This means I’ve been editing the source code, compile the source code and then manually flashing it, whenever I’ve made any changes to my keyboard layout.
This is all in the past now! With VIAL—which is an open source version of VIA—I can program my keyboard in real-time using a graphical application. This means that I can point and click using my mouse and any changes that I make are instant.
I haven’t done that many changes since I last wrote about my custom keyboard layout a couple of years ago, but if you haven’t read that post, I highly suggest you doing it, especially if you’re new to compact and custom keyboards.
I went with a new switch from Gateron named “G Pro White Linear Silver”. It’s a linear switch that actuates at 37 gf (grams of force) and bottoms out at 45 gf. This makes them into a—really—light switch. They’re probably way too light for most people.
This switch is factory lubricated, which makes them buttery smooth with a more muted sound. If you haven’t listened to a lubricated high quality keyboard before, I can highly suggest that you do it right away.
The price for 70 switches was about 20 EUR (excluding VAT). This is a good price, especially considering the fact that I’ve spent a lot more on some hyped brands—that even after modifying them—would still not perform as good as these.
My previous case was a bulky high-profile case with a five degree typing angle. My new case is a simple and affordable low-profile case with a zero degree typing angle.
There’s not much to say about it. It’s a black, simple and it gets the work done. It sounds a lot better after some sound dampening material in the bottom.
]]>The first annoyance I had with Debian was with Pulseaudio. When I changed the volume—using shortcuts on my keyboard in incremental steps of 5%—the sound would glitch for a second or two for each step. It wasn’t a deal-breaker, but it was somewhat annoying. My second issue was far more annoying though; every time I woke up my computer, the Internet connection would be completely gone. The only way I was able to get it back, was to either reboot my router or my computer.
I also had some minor annoyance, like how the boot process would completely hang without any message about why when it tried to mount a missing storage disk at boot. It took me a while before I figured out that it would continue to boot into some systemd rescue mode if I just waited for a few minutes. After that I was able to debug the issue and finally add the noauto
argument to the disk in my filesystem table. While minor annoyances like this, aren’t any kind of deal-breaker for me, it can be a bit frustrating to deal with, when they stack up on top of each other.
I eventually decided to try upgrading to Debian testing, to see if that would solve any of the issues for me. It didn’t. In fact, it made everything worse. My graphical stack was now completely kaput. I don’t know what happened and I couldn’t figure out how to solve it either. On top of that, I happened to stumble upon the article “the sad state of web browser support currently within Debian”. I then decided that Debian wasn’t worth it on the desktop for me, and I simply gave up. I wiped everything and installed Arch Linux. It wasn’t one of my top choices, but it was something that I was familiar with.
I actually used to run Arch Linux before switching to Gentoo. It used to be a simple (to use) binary operating system that I never really had any major issues with. I ended up leaving it mainly for three reasons; 1) I was bored and I wanted to try out something new. Gentoo seemed like the natural step for me. 2) The project and the community was (is?) toxic and hostile, especially to new users. 3) I had some annoyances with systemd. Before they switched to systemd, everything worked fine, but when they later switched to systemd, well.. It was ugly. Thankfully, it did mature and become more stable over time, just not as stable as it used to be. In the end it would work okay, but there was always some issues, like how the boot and shutdown process would always freeze as a result of how they just randomly start and stop processes. I wasn’t a fan of them changing things that didn’t need chance either. With systemd, they removed the ifconfig
command and replaced it with another tool that requires multiple commands to show you the same information. The ifconfig
tool has been around for 38 years and is commonly used in UNIX-, BSD- and Linux-based operating systems. Why break and replace things that works?
In Arch Linux, I had the same issues with the sound, as well as some other issues. One of them was some issue with the USB-memory sticks that would not appearing unless I rebooted the computer. Other than that, things seemed to work fine. I only used it for two weeks though. Their small software repository and the fact that I missed Gentoo, was the main reason that I decided to go back to Gentoo again.
I decided to start fresh with a new installation, even though I had a backup of my previous Gentoo installation. It just felt fun and fresh starting over with a brand new install. I just copied some of my previous configuration files, which resulted in a base installation in less than an hour anyway.
]]>My current phone is the Google Pixel 3a from 2019. It’s running the LineageOS operating system without the Open GApps stack (GApps is short for “Google Apps”). This means there’s no proprietary software or tracking from Google on the phone by default.
My old trusty phone is still performing well, both in terms of UX experience and battery life. With that said, I’m not a heavy user and I don’t have any bloated applications like Facebook or something similar. I can easily use it for a day without having to worry about it dying on me, which is important.
It’s several been years since I turned off both the sound and the vibration. I can’t ever imagine enabling them again either. I find it rather stressful with a device that pokes at me for my attention when I’m doing something else, even if that thing is on the phone.
Well. There’s actually two exceptions for the no sound rule. 1) When I’m expecting an important call, I do enable the sound temporarily. This only happens about once per year. 2) There’s sound permanently enabled for one person; my partner. She only calls me when there’s something important.
I have disabled notifications for email and most other things. Not that I really got that many notifications before to begin with.
The only recurring notifications are from Conversations (my XMPP-/Snikket-client), the calendar and Tasks (my to-do manager).
I decided to uninstall Tusky some time ago. I used to spend way too much time there. Honestly speaking, I was probably a bit addicted to it. It’s partly why I took a 30 day break from Mastodon last year. It was a healthy break that lead to me using it a lot less after that.
I have since my break made some additional changes as well. I stopped following most people (It’s nothing personal towards anyone). My brain needed a break from all flood of information my timeline gave me.
I visit Mastodon about every two days now. Each visit lasts about five minutes. I still access it almost exclusively via my phone, but I now use the web based client Pinafore instead. It’s the same client I’ve been using on my computer for a long time now.
Time saved from not spending time on social media is now spent on being more productive in life. And I really enjoy it.
Something that has helped me a lot with not being as distracted by my phone anymore, is to keep it out of sight from myself.
When I get home, I simply put it on the drawer, where it’s out of sight from me for the rest of the day. I used to either keep it in my pocket (even at home) or somewhere near me. This was always distracting as my brain kept poking at me, begging me to keep checking it. My brain didn’t care that I was like 10 seconds ago I checked it the last time.
I have gone from maybe 4-5 hours of screen time per day to about 1-2 hours the past year. With that said, I do use my phone for my own company as well. My ideal screen time would be less than 1 hour per day, but that’s probably not going to happen as long as I have my company.
I try to keep the applications to a minimum. I consider my phone to be a time saving tool that can make my life easier and more efficient. I always use my computer whenever it’s possible, but I like the fact that I can check my email when I’m commuting to work.
I use F-Droid Classic as my main software store. And Aurora Store to access some of my applications that’s only available on Google Play Store.
Aegis Authenticator | Two-factor authentication. |
AntennaPod | Audiocast-client. |
Coffee | Keeps the display awake. |
Conversations | XMPP-client. |
DAVx⁵ | CalDAV/CardDAV synchronization. |
Diary | Plaintext diary/journal. |
Fennec F-Droid | Fennec F-Droid is based on the latest Firefox release (codenamed Fenix). |
ICSx⁵ | Subscribe to Webcal calendars. |
K-9 Mail | Email-client. |
KeePassDX | Password manager. |
Lawnchair | Home launcher. |
Markor | Text editor with support for notes and todo-lists. Markdown and todo.txt support. |
Mullvad VPN | VPN-client for Mullvad. |
NewPipe | YouTube-client. |
Organic Maps | Open-source, community-driven maps for travelers, tourists, cyclers & hikers. Uses OpenStreetMap. |
Privacy Browser | A web browser that respects your privacy. |
Send Reduced | Reduces images in size and removes EXIF-data before sharing them. |
Syncthing | Decentralized local file synchronization. |
Tasks.org | Todo-client. |
AnyList | Shopping list. |
BankID | An electronic personal identification system used by various service providers. |
BookBeat | Audio and e-book streaming service. |
Discord | Client for Discord. |
Firefox Focus | A web browser that blocks tracking and deletes all history when done. |
Google Camera | Googles own camera application. |
Google Keyboard | Googles own keyboard. |
Google Maps | Maps. |
Splitwise | Share expenses between friends and family. |
Swish payments | Payment service for sending money. |
WordPress | A WordPress client that lets you manage your WordPress website. |
WooCommerce | A WooCommerce client that lets you manage your online WooCommerce store. |
It has proprietary bits and telemetry removed, but still connects to various Mozilla and Google services that can track users. It’s not ideal, but I only use it for websites that I trust and when I want to save my login credentials, which is something that Privacy Browser currently doesn’t support.
I use this application to mirror the storage on my phone to my computer. It’s nice having a fresh copy of all my data if when something happens. I also use it to sync my password database and my notes that I manage using Markor.
I use this with my partner to share various shopping lists. It’s not open source, but it works good and it’s a wonderful application for grocery shopping when you’re sharing the list in real-time with someone else. I would like to replace it with something open source, but that’s probably never going to happen.
This is my backup web browser when some websites do not work with Privacy Browser. It’s not Privacy Browsers fault, it’s just sometimes too secure and some websites doesn’t like that.
I would love to use the default AOSP camera, but it’s just horrible. The photos look like they’re taken with a 10 year older phone with the AOSP camera compared to using Google Camera.
Thankfully. LineageOS lets you block specific applications from accessing the network, which is something I’ve done for the Google Camera and the Google Keyboard application. It’s not an ideal solution, but it’s the one that sucks the least.
To make the camera work, I had to install something called Gcam Services Provider. It’s an application that “simulates” the Google Play Services that the Google Camera application (Gcam) requires, allowing the camera application to be used on devices without Google Play Services.
While I prefer to use Organic Maps, there’s unfortunately times when it doesn’t have enough information, and I’m therefore ‘forced’ to use Google Maps to find some specific places.
I would love to use the default AOSP keyboard, but it’s just horrible.
This is another application that I exclusively use with my partner. It lets you easily keep track of various expenses with others.
This is a Swedish payment services used by everyone. Cash money is not common here anymore, and Swish is more or less a requirement these days.
I tried to stay old school and DRM-free by buying physical audiobooks in CD-format, but it was hard finding good books secondhand, and buying them new would have ruined my wallet. I listen to audiobooks at work, and I average about 20-25 hours per week.
I really like this service though. Their library seems to be good, the pricing is good and their application isn’t full of malicious trackers.
I’m more of less forced to use Discord due to my company. I’m not forced to use WordPress or WooCommerce, but they’re two good applications that makes my life a bit easier managing my company when I’m not home.
]]>As the wallpaper on my desktop shows, I have now moved to Debian. I wrote about it here. It’s been about a month since my move, and I really like it so far.
To summarize my decision to jump from Gentoo to Debian (which are two vastly different Linux based operating systems): I don’t have the time or energy to tinker or to care about my setup these days. I just want something that’s rock solid and something that works with the least amount of work as possible. Debian is perfect for that! You install it in a few minutes and you then don’t have to care about anything for the next years.
My last post can be found here: My Desktop - November 2020.
I decided to hide my Polybar panel as I find it distracting. I really don’t want to know how many unread emails I have, or if someone’s trying to get my attention on XMPP when I’m focusing on something else. I’ll just check my unread messages when I have the time for it.
I also decided to go with a simple wallpaper, that’s exactly 0% distracting. I thought about going with no wallpaper at all, but as a visual artist, I like graphics and art. I therefore decided to go with a simple Debian wallpaper that’s only visible when I don’t have any client running at all.
I sometimes float my clients to make the content in them easier to read. This is often the case for my web feed client Newsboat. As you can see in the screenshot, the wallpaper isn’t in any way distracting.
Here’s some information about my setup and some of the more common software that I use.
Operating system: | |
Window manager: | i3 |
System panel: | |
Shell: | zsh |
Terminal emulator: | URxvt |
Terminal typeface: | Terminus |
Terminal colour scheme | Solarized |
Application launcher: | Rofi |
Notification daemon: | Dunst |
Text editor: | Neovim |
File manager: | Ranger |
Web browser: | qutebrowser |
E-mail client: | |
Web feed reader: | Newsboat |
Password manager: | KeePassC |
Bookmark manager: | Buku |
Media player: | mpv |
Image viewer: | sxiv |
Instant messaging client: | |
Document reader: | Zathura |
Calendar: | Khal |
Contact book: | Khard |
CalDAV/CardDAV-sync: | vdirsync |
It works by parsing the YouTube website directly, but is also able to use any Invidious instance as a fallback. This method is usually the most reliable one.
Unfortunately, pipe-viewer isn’t available in the Debian repositories, but it’s thankfully rather simple installing the application yourself.
Start by installing the dependencies:
# apt install git libwww-perl liblwp-protocol-https-perl libdata-dump-perl libjson-perl libmodule-build-perl
Download the source code using git
:
$ git clone https://github.com/trizen/pipe-viewer
Go to the directory:
$ cd pipe-viewer
And to install pipe-viewer:
$ perl Build.PL
# ./Build install
You can now use pipe-viewer
.
You can either search for anything by parsing an argument in the shell like this:
$ pipe-viewer "<KEYWORD(S)>"
Or by starting pipe-viewer
first, and then searching for whatever you’re looking for.
There’s a lot more flags than this, to check out all of them, use the flag --help
.
YouTube specific | |
---|---|
-uf, --favorites=<USER> |
View all favourites by a specific user. |
-uv, --uploads=<USER> |
View all uploaded videos by a specific user. |
-a, --author=<USER> |
Search only videos by a specific user. |
-rv, --related=<URL> |
Show all related videos to a specific video. |
--comments <URL> |
Show video comments for a specific video. |
-sp, --search-pl <KEYWORD> |
Search for playlists of videos. |
Filters | |
---|---|
--order=view_count |
Sort by view count. |
--duration=<short/long> |
Sort by short or long duration. |
--resolution=<VALUE> |
Supported resolutions: best, 2160p, 1440p, 1080p, 720p, 480p, 360p, 240p, 144p, audio |
--hd! |
Search only for videos available in at least 720p. |
Player options | |
---|---|
-A |
Play all results. |
-n, --novideo |
Audio only, no video. |
The reason I want something that’s as close to zero maintenance as possible, is due to the fact that my time will be—to say the least—limited next year. Not that I’m complaining! The next phase of my life doesn’t have room for me spending time tinkering with Gentoo as I used to.
More on what’s going on later in another post, but you can probably guess what’s up anyway. :)
Debian has been around for a long time. It’s actually one of the oldest Linux based operating systems. And with Debian, you know what you get; a mature, stable and reliable operating system that value libre software that respects your freedom.
The Debian project is moving slowly with very few to no surprises. If you want the “latest and greatest” software, you should probably look elsewhere, but if you value stability and reability, then Debian is an excellent option for you.
I don’t really care about the “latest and greatest” software. The application stack that I use doesn’t see many changes anyway. My window manager i3 is feature complete and doesn’t see any new features anymore. My email client Mutt is 26 years old and I highly doubt that they’ll come with any new shiny futures that I must have on a regular basis. And while I use ‘modern’ software like NeoVim, all the basic features is already there for me.
Debian is also supported by everyone and everything! If there’s anyone that supports a Linux based operating system, you can be confident that Debian is the one. And while I was okay making my own packages for Gentoo, it’s nice to be able to quickly install some package, as well as not having to care about the burden with maintaining them yourself.
One thing that I did miss quite a lot while running Gentoo was the Mullvad VPN client. With Gentoo, I had to use the Wireguard client—while it’s an okay client that works as a basic VPN client—it lacks the extra features that makes the Mullvad VPN client the best VPN client out there.
With the Mullvad VPN client you can get up and running with two simple commands, without ever needing any super user permissions. Other things that I like with the Mullvad VPN client is the setting that allow you to deny any traffic (both wide and/or locally) without a VPN connection. You can also easily do things like using a custom DNS server and split tunneling.
And in addition to the regular graphical client, they also provide a CLI based tool, which is perfect for users like me who prefer using text-based interfaces.
Contrary to what some seem to think; I don’t hate systemd and I don’t think it’s the evil end of Linux as we know it. It’s just not my cup of tea. With that said, I used to have rather strong feelings about systemd. Partly because I had a lot of issues with it in the past, but mostly because I don’t like changes and that I had turned into a majorly old grumpy person. Let’s just say that ‘life happened’ the past two years or so. I had major issues with stress and it ended up making me into a rather negative person in general.
That’s past me now though! I have now decided to get back to being that annoyingly positive person that I used to be. To succeed with that I have decided to make multiple changes. A few of them is to just not care about things as much as I used to, to be more pragmatic and to use social media a lot less. I think I need a healthy break from it, for now at least.
That’s why I have decided that I’m not only okay with systemd, I’m even okay using it myself! Well. As long as it makes my life easier, stays out of my way and just work.
]]>This means that it has been semi-broken for some time now; playing any video results in constant buffering due to Google—once again—have found a way to throttle their users who use youtube-dl instead of their incredibly bloated, slow and privacy invasive website youtube.com.
This is how well youtube-dl is working for me right now:
(Buffering) AV: 00:00:16 / 00:16:29 (2%) A-V: 0.000 Cache: 0.8s/96KB
Thakfully, someone have forked the project into a new project called yt-dlp. This new fork works perfectly:
AV: 00:00:29 / 00:16:29 (3%) A-V: 0.000 Cache: 23s/3MB
Add this line to your configuration file for mpv (~/.config/mpv/mpv.conf
):
script-opts-append=ytdl_hook-ytdl_path=yt-dlp
It should now use yt-dlp instead of youtube-dl.
]]>Start by right-clicking on a game in your Steam library. It will then create a .desktop
-file with that game in the folder ~/.var/app/com.valvesoftware.Steam/Desktop/
.
In that file, there’s a line that looks like this:
Exec=steam steam://rungameid/<ID>
Using that ID, you can then launch the game using this command:
com.valvesoftware.Steam steam://rungameid/<ID>
If you use Flatpak:
flatpak run com.valvesoftware.Steam steam://rungameid/<ID>
With all that prepared. You can now use this Rofi plugin that I created:
#!/bin/sh
DIR="/home/$( whoami )/.var/app/com.valvesoftware.Steam/Desktop"
handle_selection() {
if [ "$1" ]; then
ID="$(grep -oP '(?<=rungameid/).*' "$DIR"/"$1".desktop)"
flatpak run com.valvesoftware.Steam steam://rungameid/"$ID"
notify-send "Steam" "Launching the game \"$1\""
fi
}
handle_selection "$( cd "$DIR" || exit; ls -t | sed 's/\.desktop//' | rofi -dmenu -i -p 'Launch game' -hlbg '#5FA5D7' -bc '#5FA5D7' -bw 3)"
It adds a distraction free mode that helps me focus on my writing by centering the content and hiding all other elements.
Toggle Goyo:
:Goyo
Turn on and resize Goyo to the dimension 100x50
:
:Goyo 100x50
Turn off Goyo:
:Goyo!
I have bound the toggle feature to the key <Leader>g
:
map <Leader>g :Goyo<CR>
The plugin works just fine as is, but I did change the text area to 100x50 (as seen in the example image above), as I find that to be a better fit for me.
This is the settings that I added to my configuration file:
let g:goyo_width=100
let g:goyo_height=50
It took me about a week before I was back with qutebrowser again. The Vimium addon is a good addon (for what it is), but it’s simply not good enough for me. While I could use keybindings for a lot of things, unfortunately, some basic things didn’t work at all.
While I still dislike QtWebEngine, the good old trusty web browser qutebrowser simply makes the interaction with the web a lot more enjoyable for me. I simply don’t need or want all the shiny bells and whistles that a ‘modern’ web browser like Firefox comes with. I find all the features and the somewhat massive graphical user interface rather distracting.
And even if I have some issues with the web engine, it does get the job done, and I guess that I can’t use anything else than qutebrowser after all these years with it now. I’m perhaps way too spoiled with the most polished Vi-like web browser out there.
]]>unclutter-xfixes uses the x11-xfixes extension, which means that they don’t use fake windows or pointer grabbing. This should cause fewer problems with window managers and/or applications.
This is one of the tools that I just install once and then forget about it ever being there. I don’t use the mouse that much and it’s rather nice being able to hide it. They recently came out with a new release for the first time in close to 3 years, which reminded me that I should probably mention it on my website.
To start it you simply run unclutter
. In a recent update, they added a few new neat features:
--start-hidden |
Hides the cursor initially when unclutter-xfixes starts. |
--ignore-button |
Lets you specify one or more buttons which does not unhide the cursor. |
--hide-on-touch |
Hides the cursor on touch input. |
One of the alternatives to Mailbox that I’ve checked out in the past is Gandi. It’s where I’ve housed my domains since 2015, and it would have been rather convenient to have my email there as well, especially since they offer two free email accounts with all their domains.
The reason I haven’t used their email service in the past is simply because they didn’t support two-factor authentication and filter rules. This is now something that they support and I decided to give them a chance right away.
It took me less than a day for me decide that I wanted to switch over to Gandi. That was about a week ago now, and I still feel just as happy with the switch. I have now decided that I wanted to share my thoughts about it. So. This is not meant to be a proper review of some sorts, it’s just my rambly thoughts.
I don’t want to get too nitpicky or sound too negative here, so I decided to not included all the weird quirks with Mailbox. Quirks like the fact that some settings are randomly split behind two different menus and only one of these menus are mobile friendly, or the fact that the web interface is sometimes utterly horrible to use. It contains bugs that actually make you feel like that they’re not using the web interface themselves.
Their two-factor authentication could have been a lot better. It looks like the people behind Mailbox can be a bit ignorant, and they don’t seem to care that a lot of customers have requested proper two-factor authentication for years now[1][2].
When you activate two-factor authentication with Mailbox, you can no longer use your password and your TOTP as expected, because your password is now replaced with a 4 digit PIN. They outright refuse to implement proper two-factor authentication support because it’s according to Mailbox themselves “insecure and unsafe” and the customer are basically too stupid to understand basic security.
I’ve had my domains at Gandi since 2015. I’ve always been happy with their service, and it’s nice to see that they’re actually actively working on improving their service as well. Their control panel and their services has been noticeable improved over the years. Not that I have ever been unhappy with their service.
.eu
for about 12 EUR (exluding VAT) per year. And if you pay 3 years (or more) in advance, you get a discount and the yearly price is then 10.02 EUR.Privacy and environmentally friendly. They help and support associations, companies, and alternative projects that share their ethics and values, including environmentalism, open source projects, and those who are helping democratize the internet and technology by protecting our digital rights.
They support a lot of different projects and organizations like Ubuntu, OpenStreetMap and the Electronic Frontier Foundation. You can read more about it here.
If you like what I had to say about Gandi, and if you decided to give them a chance, feel free to use my referral link:
You get 75% off a Simple Hosting S+ pack and 20% off the purchase or transfer of a domain name. In return, I get a €5 promo code when you create your new account and complete your first order.
]]>It comes with a command-line client called upower
, which makes it possible to check the status of your device via the shell. I have a wireless mouse called Logitech G305 and this is the output I get with upower --dump
:
$ upower --dump
Device: /org/freedesktop/UPower/devices/mouse_hidpp_battery_0
native-path: hidpp_battery_0
model: G305 Lightspeed Wireless Gaming Mouse
serial: 4074-61-97-4e-4d
power supply: no
updated: Wed 21 Jul 2021 12:07:44 PM CEST (4 seconds ago)
has history: yes
has statistics: yes
mouse
present: yes
rechargeable: yes
state: fully-charged
warning-level: none
battery-level: full
percentage: 100% (should be ignored)
icon-name: 'battery-full-charged-symbolic'
History (charge):
1626862064 100.000 fully-charged
Daemon:
daemon-version: 0.99.11
on-battery: no
lid-is-closed: no
lid-is-present: no
critical-action: PowerOff
If I have multiple devices and would like to only show information about my mouse, I can then use the flag -i, --show-info
like this:
$ upower -i /org/freedesktop/UPower/devices/mouse_hidpp_battery_0
And if I just want to print the battery percentage:
$ upower -i /org/freedesktop/UPower/devices/mouse_hidpp_battery_0 | grep "percentage" | awk '{print $2}'
100%
The list is in alphabetical order to not favour anything in particular, but it’s perhaps no secret that I personally like (and use) Gentoo and Alpine Linux myself.
Operating system | Init |
---|---|
Alpine Linux | OpenRC |
Artix Linux | OpenRC |
runit | |
s6 | |
Suite66 | |
Bedrock Linux | Supports any init. |
Calculate Linux | OpenRC |
CRUX | BSD-style init |
Devuan | OpenRC |
Funtoo | OpenRC |
runit | |
s6 + s6-rc | |
sysvinit | |
Gentoo | OpenRC |
runit | |
s6 | |
sysvinit | |
Guix | Shepherd |
Hyperbola | OpenRC |
KISS | Supports any init. |
Linux From Scratch | sysvinit |
Obarun | s6 |
Parabola | OpenRC |
PCLinuxOS | sysvinit |
Pentoo | sysvinit |
Slackware | sysvinit |
Void Linux | runit |
I have tried most of them myself, but not all of them. I did not add every alternative that’s available out there. My criteria for this list is that they’re widely known and has been around for a considerable time.
If you’re looking for a beginner-friendly and easy to set up and use alternatives, I can personally recommend Devuan, which is a fork of Debian by multiple people from Debian and the community. Another options are PCLinuxOS, which is intended to be easy to use. I have not tried it myself though.
And feel free to send me any recommendation that you think should be on this list as well.
A couple of people have recommended me MX Linux. I have chosen to not include MX Linux. Partly because they include systemd by default—even though they default to sysvinit—and partly because I feel like they’re a bit too political for my liking.
Pine oil is a by-product of the pulp and paper industry. It can be used to clean everything in your home, it’s cheap and widely available in all local stores. It can’t get any better than that.
You shouldn’t get fooled by all the expensive (and often exclusive and hard to get) hip “eco-friendly” products that’s designed for just one specific part of your home. It just hurts your wallet and most importantly; it hurts the planet with unnecessary waste if you have to buy a dozen of different products to clean your home.
And perhaps most importantly; whatever you do, don’t buy chemical-based cleaning products. It’s bad for both the environment and your health. I ditched my chemical-based and toxic products long before I was made aware of the environmental issues we’re facing today. I switched to natural products when I noticed that my asthma was getting worse by the very products that was supposed to keep me safe and healthy in my clean home.
Other than that, I clean my home like any other person. I have a vacuum cleaner, washable knitted dishcloths (that my mom made me), and a (synthetic) feather-duster.
]]>After some testing of various solutions and tools, I ended up with a setup using Pandoc, WeasyPrint and Markdown. I consider Markdown to be the best markup language and I use it for everything!
The source for this PDF-document looks like this:
# H1 Header
I really like using Markdown.
1. First item
2. Second item
3. Third item
4. Fourth item
> This is some quoted text.
```sh
#!/bin/sh
echo "This is a code block."
```
And this is the CSS I used:
:root {
--blue: #3465A4;
}
@font-face {
font-family: 'NotoSans';
src: url('NotoSans-Condensed.ttf') format('ttf')
}
html {
font-family: 'NotoSans';
line-height: 1.45em;
}
h1 {
font-size: 26px;
color: var(--blue);
padding-bottom: 0.15em;
border-bottom: 1px solid #CCC;
}
pre {
background-color: rgba(0,0,0,0.05);
border: 1px solid rgba(0,0,0,0.1);
padding: 1em;
font-size: 12px;
}
blockquote {
background-color: rgba(0,0,0,0.05);
border-left: 5px solid rgba(0,0,0,0.1);
padding: 0.1em 0.75em;
}
And this is the command I used to render the document:
$ pandoc --pdf-engine weasyprint -c style.css demo.md -s -o demo.pdf
To make this work you need to install Pandoc and WeasyPrint. In Gentoo the packages are called app-text/pandoc
and dev-python/weasyprint
.
With that said. I did not install Pandoc from source myself. It simply requires way too many packages for my liking (when compiled from source):
# emerge pandoc
[...]
Total: 133 packages (133 new), Size of downloads: 165,258 KiB
I instead used a binary package that’s available from their GitHub-page. The archive weights in at about 14 MB and unpacked at about 68 MB. I then just put the folder in ~/.local/bin/
and created a symbolic link to the binary file.
diff
to compare the changes from my current minimal custom kernel configuration to the new kernel configuration that came with the latest kernel in Gentoo, I thought to myself: “Is this really worth it?”.
I don’t gain any performance, and no resource or disk space improvements, so why should I be bothered using my own custom kernel when it takes a considerable amount of time maintaining it? I’ve only been rolling my own custom kernel because it’s fun and a good learning experience.
Wait. I said what now? No disk space improvements? Well. Relativity speaking, my custom kernel is a lot smaller than the binary kernel that Gentoo provides. Technically speaking, I save about 75 MB by only including the absolute bare minimum required for my computer.
The little disk space I gained there, is actually lost to the fact that I always have to keep a copy of the source for the current kernel. The source for the kernel takes up about 52 MB in its compressed state, and about 150 MB uncompressed. Is it really worth all the time and effort for saving 23 MB?
The reason I used to use my own custom kernel to beging with, was for the simple fact that it was fun! It’s a fun learning experience and it’s a fun challenge. That’s it.
Time changes tough. When I was younger I used to have an infinite amount of time to spend on whatever I felt like, but that time has since passed. I’m currently busy with life in general, and I don’t have much time to spend on my hobbies. And with a limited free time, does it really make any sense (for me) to spend the little free time I have on things like a custom kernel, especially when I don’t have to?
And yes. I know that some are probably shouting at their monitors right now; “Why use Gentoo if you’re going to use a binary kernel?”.
Well. It’s a semi-valid question. Let’s have a look at the Gentoo philosophy first:
Every user has work they need to do. The goal of Gentoo is to design tools and systems that allow a user to do that work as pleasantly and efficiently as possible, as they see fit. Our tools should be a joy to use, and should help the user to appreciate the richness of the Linux and free software community, and the flexibility of free software. […] The goal of Gentoo is to strive to create near-ideal tools. Tools that can accommodate the needs of many different users all with divergent goals.
I even made my own post about why I like Gentoo last year. A tl;dr of that post would be something like:
The first point is the main reason why Gentoo call themselves a metadistribution. Gentoo can be anything you like, there’s really no right or wrong way of doing it, it’s only your way of doing it. And that’ what I like about Gentoo, there’re no incentives, hard coded paths or unwritten rules that you have to follow.
I now use a binary kernel with Gentoo to gain all the benefits from using Gentoo, while saving time from not having to maintain my own kernel. Time that I can spend on things I find more important (in my currently busy life with limited time and energy), things like this post.
And who knows, I might go back to my own custom kernel later in the future, when I don’t have work and have more time for my hobbies again.
]]>pm-utils
, which didn’t come as a surprise considering it hasn’t been updated upstreams for 11 years now.
pm-utils was a small collection of scripts that handles suspend and resume on behalf of HAL. One of the things that pm-utils allowed me to do, was to automatically run any scripts when I woke up the computer.
With the deprecation of pm-utils, I was left with two alternatives; 1) elogind (the systemd project’s logind, extracted to a standalone package) and 2) s2ram. Considering the fact that I’m not a big fan of systemd, I really only had one choice.
While s2ram works just fine, it does lack the ability to automatically run scripts when waking up my computer. To work around this, I modified my i3lock script to run another script called suspend-resume.sh
.
After a few tries, I figured out that I needed the flag -n, --nofork
for i3lock to get it execute a command after waking up my computer and unlocking the screen:
i3lock -n; suspend-resume.sh
Here’s the complete script:
#!/bin/bash
icon="$HOME/.config/i3/lock.png"
img="/tmp/i3lock.png"
rm $img
scrot $img
convert $img -scale 10% -scale 1000% $img
convert $img $icon -gravity center -composite $img
case $1 in
lock)
suspend-resume.sh
i3lock -u -i $img -n; suspend-resume.sh
;;
suspend)
suspend-resume.sh
doas s2ram -f
i3lock -u -i $img -n; suspend-resume.sh
;;
esac
And this is what the suspend-resume-sh
script looks like:
#!/bin/bash
weather.sh &
/usr/bin/vdirsyncer sync &
mbsync-notify.sh &
I actually ended up liking this solution a lot more than the old one with pm-utils, because this is all run by my own user and not as root pretending to be me.
]]>The CSS-class looks like this:
img {
filter: drop-shadow(1px 3px 5px rgba(0,0,0,0.55));
}
A good use case for this would be if you want to have shadows around your images in your articles, but don’t want non-square images to look weird.
]]>Thankfully, this is where urlscan comes in the picture and saves the day. urlscan is a piece of software that extract URLs from any message (or any text file) and then allow the user to select and open any URL in the default web browser.
I use the text based web browser Lynx to render HTML messages. It usually looks like this:
As you can see, there’s no visible URLs. They’re all grouped down at the bottom of the message, without any context. This can make it hard to figure out which URL I’m interested in, especially when they’re all annoying obfuscated tracking links.
This is where urlscan comes in. When I press Ctrl+B
, it opens urlscan and presents me the URLs with some context:
If the environment variable $BROWSER
is set to a browser command, then that specified browser is used. The $BROWSER
environment variable is only honored if the rc-file doesn’t contain the COMMAND option.
In Gentoo, it’s available as the package net-mail/urlscan
:
# emerge --ask net-mail/urlscan
I have simply added these two macros to NeoMutt:
macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"
macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"
And don’t forget to set your $BROWSER
variable. I have this in my ~/.zshrc
file:
export BROWSER="browser.sh"
The script browser.sh
contains this:
#!/bin/bash
qutebrowser-tmp $1 >/dev/null 2>&1 & disown -a
And the script qutebrowser-tmp
is script that creates a temporary session with qutebrowser for me. That script looks like this:
#!/bin/bash
PROFILEDIR=`mktemp -p /tmp -d tmp-qb-profile.XXXXXX.d`
mkdir $PROFILEDIR/config
cp ~/.config/qutebrowser/{user-stylecheet.css,autoconfig.yml} $PROFILEDIR/config/
mkdir $PROFILEDIR/data/userscripts/
cp ~/.local/share/qutebrowser/userscripts $PROFILEDIR/data/userscripts/
qutebrowser --basedir $PROFILEDIR $1
rm -rf $PROFILEDIR
Compiling the QMK firmware in Gentoo means that I have to setup a development toolchain for the Atmel AVR microprocessor, which is what my keyboard uses. While it’s not rocket science to cross compile things in Gentoo, we can’t ignore the fact that I’m lazy.. So. I found it a lot easier and quicker to just set it up on my secondary computer with Alpine Linux instead.
All I had to do was to install the packages avr-gcc
and avr-libc
, I could then simply compile the source code. Flashing the firmware is still done on Gentoo with the tool dfu-programmer
, simply because that’s the machine my keyboard is connected to.
To make things a lot more simpler I wrote a Bash script that lets me edit, compile and flash the firmware:
edit
option simply opens the keymap.c
file using Neovim.make
option syncs the changes of the source code to my other computer using rsync, it then compiles the new version on my other computer, makes a backup of the old firmware and lastly copies the new firmware back to my desktop computer.flash
, and run as root because I can’t use the keyboard when it’s put into the bootloader mode and the commands has to be run with privileges. The third option simply erases the storage on the keyboard, flashes the firmware and then boots the keyboard back up.This is what the script looks like:
#!/bin/bash -e
DIR="/home/johan/Backups/QMK"
FILE="sentraq-s60x-iso.hex"
case $1 in
edit)
nvim $DIR/qmk_firmware/keyboards/kb/keymaps/default/keymap.c
;;
make)
rsync -aAXv -e "ssh" $DIR/qmk_firmware/ billy:/home/johan/qmk_firmware/
ssh johan@billy -t "cd /home/johan/qmk_firmware && make kb:default"
if test -f "$DIR/$FILE"; then
mv "$DIR/$FILE" "$DIR/$FILE-$(date +%Y-%m-%d--%H%M%S)"
fi
rsync -aAXv -e "ssh" billy:/home/johan/qmk_firmware/kb_default.hex "$DIR/$FILE"
;;
flash)
echo "Don't forget to put your keyboard into the bootloader mode!"
echo "5..." ; sleep 1
echo "4..." ; sleep 1
echo "3..." ; sleep 1
echo "2..." ; sleep 1
echo "1..." ; sleep 1
echo "Flashing keyboard..."
dfu-programmer atmega32u4 erase --force
dfu-programmer atmega32u4 flash "$DIR/$FILE"
dfu-programmer atmega32u4 launch
;;
esac
It’s nothing fancy, but it gets the job done. Improvements are always appreciated!
]]>And because I use the spellcheck feature all the time, I also want the shortcuts for it to be close to the home row. Unfortunately, I couldn’t find any available keys that felt natural to me to bind the spellcheck commands to, but after some thinking, I got the idea that I could use temporary keybindings.
This means that the keybindings for the spellcheck is only available when I have the spellcheck feature enabled, and I can bind them to keys that I normally use for other things.
After some experimenting, I came up with this solution:
map <silent> <F1>
\ :set nospell<BAR> :silent! unmap ff<BAR> :silent! unmap fF<BAR>
\ :silent! unmap fa<BAR> :silent! unmap fn<BAR> :silent! unmap fd<BAR>
\ :redraw<BAR> echom "Spellcheck disabled"<CR>
map <F2>
\ :setlocal spell spelllang=sv<BAR> :noremap ff ]s<BAR> :noremap fF [s<BAR>
\ :noremap fa zg<BAR> :noremap fn z=<BAR> :noremap fd zuw<BAR>
\ :highlight SpellBad ctermfg=003 ctermbg=none cterm=none<BAR> :redraw<BAR>
\ echom "Swedish spellcheck enabled"<CR>
map <F3>
\ :setlocal spell spelllang=en<BAR> :noremap ff ]s<BAR> :noremap fF [s <BAR>
\ :noremap fa zg<BAR> :noremap fn z=<BAR> :noremap fd zuw<BAR>
\ :highlight SpellBad ctermfg=003 ctermbg=none cterm=none<BAR> :redraw<BAR>
\ echom "English spellcheck enabled"<CR>
This means that when I enable spellcheck I also enable these keybindings:
ff |
Go to the next misspelled word. |
fF |
Go the previously misspelled word. |
fn |
Correct the current misspelled word. |
fa |
Add the current word to the dictionary. |
fd |
Remove the current word from the dictionary. |
And when I disable the spellcheck, it then removes the keybindings and restore the default behaviour for the f
key.
Keyboard: | Custom |
Size: | 60% |
Case: | KBDfans Diamond |
Circuit board: | Sentraq S60-X |
Switches: | Gateron Red |
Stabilizers: | GMK Screw-in stabilizers by GMK Electronic Design (Space bar key) |
DUROCK Screw-in stabilizers V2 (Backspace and Enter key) | |
Keycaps: | NPKC Blank PBT (Cherry-profile) |
Birthday: | 2018-01-19 |
After about two years since the last changes to my keyboard, I decided it was time to make changes to it again. I bought the highly regarded L7 linear switches, screw-in stabilizers and some 55 gram springs, all from DUROCK. I think I spent about 100 EUR on it in total.
The switches are available in various weights, with the lightest weighting in at 62 grams, which is still way to heavy for me. My current switches have 45 gram springs, and I find them just perfect for me. The reason I went with 55 gram springs was simply because it was the only thing available at the moment, and I decided to buy them and take my chances.
It took me a couple of hours to open the switch houses, replace the spring and then applying the almost invincible switch film on all 63 switches. The film is not required, but it’s a good thing to have it on some switches from certain brands after you have opened them. Some brands are prone to become unstable and wobbly, and it can also impact the sound of the switches as well.
My plan was to use a PCB that I bought a couple of years ago; the Plain60-B. I didn’t need it at the time, but it was cheap (about 30 EUR), available and I knew that I—at some point—wanted to build a second custom keyboard, I was just patiently waiting for the right switches; something that was end-game material, but at the same time affordable and something that didn’t need lubrication to be decently smooth. Something like the DUROCK switches that I just bought.
Well. Somehow, I had totally missed that what makes the DUROCK switches good, is the fact that they come slightly factory lubed. And yes. I know that pretty much every single person in the custom keyboard community absolutely love lubricated switches. I’m just not one of them.
While I like the sound and smoothness of lubricated switches, I find them sluggish. I prefer the more ‘mechanical’ feel to my switches, not some rubbery feeling. And yes, I’m aware of the fact that I’m probably never going to have the smoothest switches, but I’m okay with that. Smooth enough is fine for me.
Plain60-B is a rather simple and affordable PCB, that’s designed to support as little layouts as possible without limiting usability for most users. It doesn’t even feature LEDs or underglow.
It supports both the VIA and the QMK firmware. And as a creature of habit, I went with QMK as always. If you want to read about my layout, check out my post about my custom keyboard layout. The post is about two years old, so I might do an update on that soon.
After modding all the switches, I soldered them on to the PCB. I then applied the stabilizer foam on the PCB, which helps to dampen the sound when bottoming the keys out as you type. I then assembled the stabilizers. I had also applied stabilizer shrinks on the stabilizer stems and slightly lubed to make them sound better.
Then it was time for the big moment, and, well.. It was just one large pile of disappointment. The switches and stabilizers sounded good, but the first travel distance of the switches felt sluggish and it didn’t really help that the springs was slightly too heavy for me. The stabilizers felt quite mushy, but that turned out to be due to the stabilizer shrinks.
I wasn’t happy at all, to the point that after less than a week of usage I actually reverting pretty much all my changes to the keyboard.
I went back to my old PCB, but I did replace the old GMK screw-in stabilizers with the new ones from DUROCK. This time without the stabilizer shrinks, and it was a success, except for the fact that the spacebar felt weird. It felt a big sluggish, and after multiple tweaks and no success, I replaced the stabilizer with the old one from GMK.
The GMK screw-in stabilizers doesn’t sound as good as the ones from DUROCK (not that they sound terrible either, their old models are after all considered to be one of the best stabilizers out there), but in the end; function is more important than sound for me.
I don’t have a proper desoldering station, so I’m going to outsource that job to my good friend towhatend. The PCB will be used for a future project (with my favourite switch; Gateron Red) and the DUROCK switches will be sold on the secondhand market to someone who actually likes good sounding, but sluggi.. lubricated switches.
]]>vvG
to a key like Ctrl+A
.
It turned out that the syntax for the keybinding was a bit different then from what I expected it to be:
:bind <Ctrl+a> mode-enter caret ;; selection-toggle ;; move-to-end-of-document
I usually try to stay away from Ctrl+<Key>
, but for some things it just makes sense. Especially when it’s something that’s deeply rooted in the muscle memory.
While wtwitch was (and still is) a good client, I missed one little detail from it; being able to see how long a channel has been online.
That’s why I was rather happy when a fellow user of Twitchy decided to fork Twitchy and make it work by fixing the missing headers for API calls, as well as adding the ‘new’ streaming quality 720p at 60 FPS.
I have no idea what the future is for this fork. It still has the same name and pretty much one commit since the fork, but for as long as it works, I’m going to use it.
]]>The script is written in Bash, and it’s pretty straightforward. It requires bash
, curl
and xsltproc
.
This is the syntax for how you show the current weather:
$ forecast.sh -l "Sweden/Stockholm/Stockholm"
Stockholm, Sweden
Sunrise: 05:40 Sunset: 18:09
Forecast:
From 2021-03-23 10:00 to 12:00
Outlook: Clear sky 8°C
Wind: Light breeze 3.0 m/s W
Precipitation: 0 mm
Pressure: 1014.9 hPa
There are two flags available -l
and -o
. The -l
flag is for location and the location itself is formated like Country/State/City
. The -o
flag is for offset, and the following time periods are available:
There are two flags available:
-l <Country/State/City> |
Let’s you set the location. |
-o <N> |
Let’s you (optionally) set the time period. |
The following time periods are available:
Period-offset of 0
(default) gives the forecast for the current period. A value of 1
gives the forecast for the next period and so on.
I mainly use it with Polybar to show the current weather like this:
Since the weather doesn’t change that often, I have chosen to use a cron job that runs once every hour and saves the data to a file that Polybar then reads.
The cron job looks like this:
forecast.sh -l "<Country>/<State>/<City>" -p 0 | grep "Outlook" | sed 's/Outlook: //'
And the command for Polybar looks like this:
[module/weather]
inherit = script/defaults
exec = cat /tmp/weather.log
format-prefix = " "
format-prefix-foreground = ${colors.blue}
By default, there’s no colours for the manual pages, which can make it more difficult to distinguish parts and sections of the documentation than it has to be.
If you want to put some colours on your own manual pages; simply add this to your configuration file for your shell:
man() {
env LESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;33;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;39;5;146m' \
man "$@"
}
If you want to change the colour of the yellow text, you have to change the value 33
on line 3 and if you want to change the cyan colour, you then have to change the value 36
on line 8.
Here are the codes if you haven’t memorised them:
Colour | Code |
---|---|
Black | 30 |
Red | 31 |
Green | 32 |
Yellow | 33 |
Blue | 34 |
Purple | 35 |
Cyan | 36 |
Light Gray | 37 |
cat
. For the most part that works just fine, but for some larger documents—especially documents with documentation that contains a lot of headers, lists and folds—it can be somewhat difficult to read the document.
That’s why I’m using Supercat for things like this. It works just like cat
(hence the name), but it also supports colours using regular expressions.
The markers “{{{” and “}}}” are Neovim folds. I can’t imagine living without folds. I use them all the time, even though they do make the file ‘cluttery’ to read with any other standard tool.
It should be noted that this works with a pager as well. If the document is really large, I will page it to less
.
Supercat works by specifying a configuration file and the file you want to print:
$ spc -c ~/.config/supercat/markdown.conf demo.md
My configuration file for my Markdown documents looks like this:
# spc configuration file
#
# col - color (blk, red, grn, yel, blu, mag, cya, whi)
#
# a - color attribute (console_code)
# ' ':normal (0)
# '-':normal (0)
# 'b':bold (1)
# 'u':underline (4)
# 'r':reverse-video (7)
# 'k':blink (5)
#
# n - number of matches, (' ':1, '1'-'9':1-9, '0':all)
#
# t - pattern type
# 'c':chars (strchr)
# 's':string (strstr)
# 't':regexp (regcomp) (convert 10-digit unix time to MMDDHHMMSS)
# 'r':regexp (regcomp)
# ' ':regexp (regcomp)
#
# col a n t pattern
#################### ### # # # ########################################
H1 red 1 (^#\s.*$)
H2 yel 1 (^##\s.*$)
H3 yel 1 (^###\s.*$)
H4 yel 1 (^####\s.*$)
Header red 1 (^---.*$)
Fold blk 1 (# \}\}\})
Fold blk 1 (\}\}\})
Fold blk 1 (\{\{\{)
List blu 1 (^\s*\*)
It only supports headers, lists and folds, which is all that I use for formatting my plaintext documents.
]]>That’s why I adapted my current Rofi script for wtwitch instead of Twitchy:
And here’s the script itself:
#!/bin/bash
handle_selection() {
if [[ $1 ]]; then
name=$(echo $1 | awk {'print $1'} | sed 's/\://')
notify-send "wtwitch" "Launching the livestream with $name"
streamlink https://twitch.tv/$name --title "{author}: {title} ({category})"
else
exit 1
fi
}
handle_selection "$( wtwitch check | sed -n '/Live/,/Settings/p' | sed '/Live channels/d;/Settings/d' | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g;s/ //;' | rofi -font "xos4terminus 12" -bw 3 -dmenu -i -p 'wtwitch' )"
The only thing it’s missing is the current online time of the channels, but that’s a limitation of wtwitch and not my script.
And I know, I haven’t made a post about Rofi itself yet. I’ve been using it for years now, perhaps it’s time for it soon.
]]>doas was originally written for OpenBSD, but are now ported to Linux, FreeBSD, NetBSD and illumos.
In terms of disk usage, the binary file for doas is about four times smaller than sudo on my computer with Gentoo and about 27 (!) times smaller on my computer with Alpine Linux (1216 KiB vs 44 KiB).
When it comes to the configuration, I would say it’s a bit more straightforward, but not enough to be a dealbreaker. In terms of functionality, it seems like doas have some features that sudo is currently lacking, like denying a user access to a specific command.
To allow all users in the wheel
group to gain access to root, add this to the configuration file /etc/doas.conf
:
permit :wheel
Allow a user to execute a command without entering the password:
permit nopass <user> cmd <command>
Deny users access to commands (even if they’re in the wheel
group):
deny <user> cmd <command>
With twitchy it was as easy as:
$ twitchy --non-interactive | wc -l
I used this command to display the online channels in Polybar like this:
[module/twitch]
inherit = script/defaults
exec = twitchy --non-interactive | wc -l
format-prefix = " "
format-prefix-foreground = ${colors.magenta}
And this is what it looks like:
This is also possible with wtwitch, even though it doesn’t support it, I just had to use a few tools to get around it:
$ wtwitch check | sed -n '/Live/,/Settings/p' | sed '/Live channels/d;/Settings/d' | head -n -1 | wc -l
This feature is not available in i3 by default, but thanks to an addon called i3-swallow and the Python library i3ipc-python, it’s possible to have this in i3 as well.
The installation is pretty easy, you just have to download the source code for i3-swallow, preferably using git:
$ git clone https://github.com/jamesofarrell/i3-swallow
Then place the script in your $PATH. I use the folder ~/local/bin/
myself:
$ ln -s ~/src/git/i3-swallow/swallow.py ~/.local/bin/
This package is availbable via pip:
$ pip install --user i3ipc
I prefer to keep as much packages as possible via Gentoo’s own package manager, so I made an ebuild for it called dev-python/i3ipc
:
EAPI=7
PYTHON_COMPAT=( python3_{7..9} )
inherit distutils-r1
DESCRIPTION="An improved Python library to control i3wm and sway."
HOMEPAGE="https://github.com/altdesktop/i3ipc-python"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64"
RDEPEND="dev-python/python-xlib"
DEPEND="${DEPEND}"
You can now use the script like this:
$ swallow.py mpv <file>
Here’s how it looks when you list the online channels you have subscribed to:
wtwitch has the following commands available:
[w]atch [name] - Watch [name] streamer.
[s]ub [name(s)] - Subscribe to [name] streamer.
You can subscribe to multiple streamers in one command.
[u]nsub [name(s)] - Unsubscribe from [name] streamer.
You can unsubscribe from multiple streamers in one command.
[c]heck - View your settings and the status of streamers you are
subscribed to.
[e] [search-term] - Search games/categories for [search-term].
[n] [search-term] - Search streamers/channels for [search-term].
[g]ame [name] - View the top streamers for [name] game/category.
[t]op - View the top games and streamers on Twitch.
[f] - Toggle the printing of offline subscriptions with [c]heck.
[l] - Toggle the usage of colors in wtwitch output.
[p]layer [program] - Change the player program that gets passed to streamlink.
[q]uality [quality] - Change the video quality that gets passed to streamlink.
[b]lock [name(s)] - Block [name] streamer, preventing them from appearing in any
output. You can block multiple streamers in one command.
[v]ersion - Print the current version of wtwitch.
[h]elp - Print this help.
You can install the manual page yourself (see below) or just have a look at the online manual if you need any help.
This is a Bash script, so the ‘installation’ is rather simple; you can just put the script in your $PATH and then run it, but I do recommend creating a symbolic link from the source directory to your $PATH instead. This makes updating the source a lot easier.
This is what I did to create a symbolic link:
$ ln -s ~/src/git/wtwitch/src/wtwitch ~/.local/bin
Do note that wtwitch requires streamlink and jq, both packages should be available in the repositories for any common Linux based operating systems. In Gentoo, they’re available as net-misc/streamlink
and app-misc/jq
.
If, you want to install an offline copy of the manual you need to install the tool scdoc. It’s available in Gentoo as app-text/scdoc
.
Make sure that you’re in the src
directory and then run scdoc
:
$ scdoc < wtwitch.1.scd > wtwitch.1
You can then view the manual page with the command:
$ man -l wtwitch.1
The only applications that actually send me daily notifications is my XMPP-client Conversations and my e-mail client K-9 Mail. And removing those two applications was never an option. XMPP and e-mail are my two primary (and basically only) way of communicating with my family, friends and the world.
Because e-mail is not used for real-time conversations, I decided to disable the notifications to see if that made any difference for me. Well. It didn’t. I really don’t get that many e-mail messages per day to begin with, it only made me spend more time checking my inbox to see if I haven’t missed anything.
Then one morning, everything changed. I was sitting in my kitchen, eating my breakfast and listening to some netcast show before getting ready for work when my phone all of a sudden just went silent. I poked at the phone trying to wake it up, but nothing happened. It was dead.
It turned out that my phone had been affected by the notorious “bootloop of death” issue, which seems to be a common issue for both my Nexus 5X and the Nexus 6P. To my knowledge, it’s something that eventually happens to every phone? It seems that I was just lucky that it took me more than 4 years for my phone to turn into an expensive brick.
I was suddenly forced to buy a new phone, something that I wasn’t really thrilled about. I didn’t want to spend either money or time on a new phone. The one I had was perfectly fine, and I’m not even interested in phones anymore. After much hesitation, I ended up ordering the Google Pixel 3a. I know—it’s no secret that I strongly dislike Google—but I want a decently affordable phone with a good camera.
I think I was without a phone for about four or five days. While it was a bit scary to not be able to call anyone in case of an emergency (I was living alone at the time), it also felt rather nice taking a break from my otherwise distracting phone. When I eventually received my new phone, I found out about a new (new for me) feature called “flip to shhh”. It’s a feature that turns off both the sound and the vibration when you flip the phone upside down flat on any surface. A feature that I instantly fell in love with.
I used it all the time and it didn’t take long before I started to forget about my phone more and more. I just flipped it upside down and I often forgot about it the rest of the day, until it was time to go to sleep. It eventually came to the point where I had gotten so used to having a completely silent phone, that when it did make a sound, it annoyed me!
Then one day I decided to just put it in the “do not disturb” mode, which also turns of all the sound and the vibrations. I could then use phone while it was still completely silent.
Fast-forward a year or so and it’s still in the “do not disturb” mode. It wasn’t my plan, but it was actually really nice to have a silent phone that’s never poking at me for attention. I still flip the phone upside down to not see the display, as that would still be a distraction for me.
It’s sometimes easy to forget that the perfect solutions often are the simplest ones.
]]>This is what you need to add to your style sheet:
@media (prefers-color-scheme: dark) {
}
You then add any CSS-rule in there for the things you want to change when the dark mode is enabled. For an example, let’s say you want a black background with white ext instead of the regular white background with black text:
@media (prefers-color-scheme: dark) {
html {
background: #111;
color: #fff;
}
}
That’s it!
]]>For this to work you need a plugin called mpv-mpris. It adds support for controlling mpv using the standard media keys by implementing support for the MPRIS D-Bus Interface Specification.
You can either download the latest stable release or clone the latest code using git:
$ git clone https://github.com/hoyon/mpv-mpris
You can then compile the code:
$ make
$ make install
It’s important to not use root with make install
, if you do that, it will then copy the plugin to the wrong folder /root/.config/mpv/scritps/
and not to your own folder ~/.config/mpv/scripts/
.
The package playerctl
should be available in mosts repositories. In Gentoo, it’s called media-sound/playerctl
.
You can now control mpv with Playerctl using the command playerctl <function>
. You can list all available commands and features by just executing the command playerctl
without any arguments.
Here’s an example:
$ ffmpeg -i input_file.webp output_file.jpg
It’s also possible to convert it to a PNG as well.
]]>Christmas is—for me—all about spending time with friends and family, eating too much food, snacks and candy, drinking (non-alcoholic) glögg and julmust, doing crafts, baking and of course; watching a bunch of Christmas themed movies. I know, I’m a sucker for Christmas.
For a lot of people, Christmas is unfortunately everything but how I just described my Christmas. For some, it’s a period filled with stress and anxiety, perhaps it has even become some sort of mandatory service, rather than a cheerful voluntary holiday. They’re stressed for all the things they “have to” do, buy and prepare, all the places they have to visit and be at, all the friends and family they have to spend both time with and money on.
And let’s not forget all the unwritten rules and scheduled traditions some slavishly follow without even question it. That’s not really healthy though. Christmas should be a cheerful holiday, or perhaps nothing at all if you choose to not celebrate it. Because that’s just it, Christmas should be what you want it to be, and why not make it to something that you actually enjoy and look forward each year?
A large issue with Christmas is the fact that we’re overconsuming food and presents. I’m from the relatively small country Sweden, we’re about 10 million people here, yet, last year (according to hui ) we spent 7.8 billion euro on Christmas shopping, and on average we spent 769.8 euro per person. It’s estimated that we’re going to break those numbers this year, just like we always seem to do every year.
All this is rather ironic considering the fact that (according to Svensk Handel ) 41% of the Swedes considers the environment and sustainability aspect to be the most important thing for us. If that’s true, then why are our overconsuming our planet to a rapid death?
Svensk Handel also mentioned that we rated Christmas presents the seventh most important thing on Christmas. That’s after friends & family, food, Christmas decorations, snow, Christmas tree and Christmas music. They also said that 79% of the Swedes likes giving away presents and that only 56% of us actually cares about receiving gifts. Why on earth are we giving away presents to people who don’t even want them and why are these people not saying anything?
I’m not completely surprised though, this is a fairly typical us Swedish people. We’re so afraid of conflicts and being offended that we rather waste money on each other, rather than talking to each other about it. Wouldn’t it be easier to tell our family and friends that we don’t want any presents (or at least not as much) for the next Christmas? For me, that sounds like a lot better option than sitting there and pretending to be happy for some presents that you really don’t want in the first place.
And think about it, we’re all adults, if we really need something, we’ll just buy it! We don’t need to wait up to a year for the next Christmas for someone to—maybe—give us that specific item we need.
Most of us are working long and hard days, we’re tired after work, to tired to care about what makes life worth living, we neglect time with our friends, our family and ourselves. And for what? If it’s only so that we can afford all those luxurious and excessive presents and food, is it then really worth it?
We’re wasting our planet’s highly limited resources on producing all the food that we “must have” for Christmas, only to eat a fraction of it, then throw it away in the garbage and then continue to spend the rest of the money on presents that no one really needed (or asked for) in the first place. It might sound like a harsh thing to say, but it’s the truth for a lot of people.
With all that said, I’m not implying that we should skip Christmas or any part of it, quite the opposite. I want us all to focus on what truly important and makes Christmas so great. Instead of stressing through a hundred things, I want everyone to focus on the core of Christmas, with the family and the friends we want to spend time with, not the ones we’re expected to spend time with.
I would like to see all of us to just drop all the “rules” and “musts”. If you don’t like something, just don’t bother doing it. If you don’t want to spend five weeks preparing food, then don’t. End of story.
I would also like to see less of that overconsumption from everyone. And no. I promise, it’s not the end of the world if we can’t buy “all the things”, there’s still a lot to for us to do and to even buy.
I’m not joking. Making your own presents with things that you already own, can source in the nature and/or via secondhand shopping. It’s an affordable and highly personal way of showing someone that you care about them.
And if you’re not a handy or crafty person, there’s always other options like a framed photo with a personal photograph, a book or a calendar with multiple photos. It’s not as environmentally friendly and cheap as making something from things that already exists, but at least it’s not expensive and it should be something that’s going to last for a long time.
We should really not underestimate secondhand shopping. It’s a superb option for your wallet and our planet. Just be aware that secondhand shopping might not be the best place for any last minute shopping, as it sometimes can take a bit of luck and time to find the exact things you’re looking for.
I like browsing around on secondhand stores, and something that I have learned is that people are basically crazy, they give away and sell all kinds of things—in perfectly good condition—all the time, just because it’s not in fashion or that they’re just bored with “the old” and want new shiny things.
Buying secondhand is also good for our planet. If we buy more used items, use what we have, fix what we already have when it breaks or when it just needs maintenance—instead of throwing it away as soon as possible—we don’t have to produce as much of the new stuff that we do today. Our excessive carbon dioxide emissions—caused by our irresponsible overconsumption—is snowballing into a fast and brutal death of our planet. Why waste our frail emissions budget on things we really don’t need or care that much about to begin with?
Even if you don’t care about our planet, consider the fact that spending less money can (and most likely will) improve both your health and the quality of your life. The less money you spend, the more money you can save and the less expenses you have, the less you have to spend of your life working.
With more time on your hands, you could spend more time with things that you actually care about, things that brings actual value and happiness to your life. Hopefully in an environmentally friendly manner.
It doesn’t have to be an expensive trip somewhere, it can be something simple as an afternoon tea party at some cozy tavern or café. It often requires little to no effort and money. Make your own card or buy one at a secondhand-store like I do. I actually buy and stock them secondhand for about 0.1 euro each. I really don’t see why you need to spend 2-3 euro on new cards.
Another option is consumables. If you’re not a tea party person, there’s always the option to buy consumables. It can be anything from an environmentally friendly soap, some fancy coffee beans, to perhaps something like a simple chocolate bar.
A less common present, but equally appreciated, is donations to non-profit organisations and charities. If you want to give away something truly caring and unselfish, consider making a donation to something that does good for this world. If you’re not sure about where to donate your money to, there’s always GiveWell, an American non-profit charity assessment that search for the charities that save or improve lives the most per dollar.
No presents at all is actually a valid option as well, as boring as it might sound. Just don’t forget that spending time with your friends and family should be everyone’s number one priority anyway. I really think that excluding presents is something that everyone should understand and be okay with, no questions asked.
If you’re simply not fortunate enough to afford presents and don’t want anyone to know about it, you could simply use the argument about our excessive carbon dioxide emissions as an excuse for not wanting to buy any presents.
A potluck is a gathering where each guest (or group) contributes with a different, often homemade dish of food to be shared. This means that you can all enjoy the things you like to eat on Christmas, while you at the same time equally shares and distributes the burden, the cost and the time it takes to prepare the food. This should leave everyone with more time for Christmas.
Just don’t forget to think twice about what food you really want for Christmas. You should also consider to only add the most important things, and in moderate portions. If you throw away food, you’re also throwing away your own money, money that you most likely worked hard for by trading away a portion of your highly limited life.
And if potlucks is not your cup of tea and you choose to go for something else, please make sure that everyone is okay with the distribution of the responsibility of the food. It’s unfortunately not uncommon that it’s still a one person (involuntary) job in some homes.
]]>I probably didn’t have to take any new screenshots, I’m that boring that I could have probably used any old screenshot from the last years or so, and that’s because my setup doesn’t see much (if any) changes these days. Believe it or not, but I’m pretty happy with what I got.
I tried to make the screenshots as “non-montage-y” as possible. My primary workspace (the second image) features a couple of extra applications that I normally wouldn’t have visible at the same time. I often only have my web browser visible and maybe one more application. I like to distribute my clients across my 10 workspaces, so I can focus on one or two things at the same time.
Check out my post “I went from a multi monitor setup to just a single monitor setup” if you want to read about how I improved my productivity by going from three monitors to just one monitor.
My third workspace (the third image) often works as my secondary workspace where I have my newsreaders, e-mail client and todo-list easily accessible when I want to check if something new has happened.
Here’s some information about my setup and some of the more common software that I use:
Operating system: | Gentoo Linux |
Window manager: | i3 |
System panel: | Polybar |
Shell: | zsh |
Terminal emulator: | URxvt |
Terminal typeface: | Terminus |
Terminal colour scheme | Solarized |
Application launcher: | Rofi |
Notification daemon: | Dunst |
Text editor: | Neovim |
File manager: | Ranger |
Web browser: | qutebrowser |
E-mail client: | NeoMutt |
Web feed reader: | Newsboat |
Password manager: | KeePassC |
Bookmark manager: | Buku |
Media player: | mpv |
Image viewer: | sxiv |
Instant messaging client: | WeeChat + bitlbee |
Document reader: | Zathura |
Calendar: | Khal |
Contact book: | Khard |
CalDAV/CardDAV-sync: | vdirsync |
I added links to software that I have talked about in the past. If you want me to talk about any of the others, just let me know. I will probably talk about them eventually, when I feel inspired to do so.
]]>The more I used my new setup with WMFS, the more conscious I got about my workflow in general, almost to the point where I became obsessed with optimizing everything in regard to how I used my computer. Bothered by how I was using Firefox, I had no choice but to look into how I could make my web browsing workflow more efficient.
I started out with the most obvious thing I could think of; I read the documentation for Firefox to see what keybindings they supported. And, well.. It turned out there’s actually quite a few commands! The issue was that they only made sense for a person with three arms.
Seriously speaking though. Some shortcuts require both of my hands and I do understand that they exist for people with disabilities, but I didn’t have any disability, I was just looking to make my experience more efficient from a power-user perspective.
Thankfully this was back when ‘good old’ Firefox was still supporting the old type of add-ons (for better and worse). I therefore decided to go out and look for any add-on that could hopefully solve this issue for me, or at least make it better in any way possible. This was a long time ago and I can’t really remember what I was looking for, or what I was expecting to find, but I somehow ended up with an add-on called Vimperator, an add-on designed to provide a more “efficient user interface for keyboard-fluent users”. The design of Vimperator was heavily inspired by the well known text editor Vim.
I was well aware of what Vim was back then, that’s why I also had no intention of trying Vim out myself. Younger and grumpy me was perfectly happy with my modeless editor, which probably was Geany at the time.
The reason I decided to give this “Vim-like add-on” a chance, was for the simple reason that it actually seemed like a decently simple and straightforward add-on when I read about it. While it did add a bunch of features, they were at the same time all optional to use. One of the features that cought my attention was some really neat and simple—one handed—keybindings.
Here’s a few examples comparing the default keybindings in Firefox and how they worked in Vimperator:
Action | Firefox default | Vimperator |
---|---|---|
Close tab | Ctrl+W |
d |
Undo closed tab | Ctrl+Shift+T |
u |
Search | Ctrl+F |
/ |
Next search hit | Ctrl+G |
n |
Previous search hit | Ctrl+Shift+G |
p |
Go to top | Ctrl+↑ |
gg |
Go to bottom | Ctrl+↓ |
Shift+g |
Refresh page | Ctrl+R |
r |
Open search in new foreground tab | Ctrl+Shift+Enter |
Shift+o |
It took me literally minutes to get used to Vimperator and it instantly made my workflow a lot more efficient! I was really pleased with it from day one, even as a grumpy non-Vim user.
Over time, I picked up and used even more shortcuts and features. It eventually came to the point where I ended up hiding all the graphical elements in Firefox, which included the navigation buttons and the address bar. I was still using the mouse at this time, but I was efficient enough with the keyboard shortcuts to not need any of the visual buttons anymore. When I wanted to open a website I just used the key o
to open the address field and O
to open the website in a new tab.
I’m a person who has always been interested in minimalism in some way or another, and having a clean looking web browser like this felt like I had visually achieved my end-game setup.
Over time, I started to depend less on the mouse and more on the keyboard, even though some things would always require the mouse in Firefox. After all, Firefox is designed around the philosophy of a graphical ‘point and click’ interface and an add-on is limited in how much magic it can do.
How does anyone browse the web without a mouse? It’s simple! You use something called hints. Hints work by activating ‘visual hints’ using the key f
and then just typing the combination of the alphanumeric letters for the link you wish to visit. It automatically opens the first hit, so there’s no need to confirm with the Enter key.
And if you want to open a link in a new tab you just use the key F
. It might be even more ways to use hints than this, but that’s going to depend a lot on what web browser and/or add-on you’re using. A cool feature that I like in qutebrowser (my current web browser, but more on that later) is a feature called “rapid hints”. I activate it with ;r
and it then shows me all the hints, the only difference now is that it open all links in a new tab by default and the hints stays open, which means that I can rapidly open multiple links.
At one point in time I remember asking myself “If the Vimperator add-on can make Firefox as good as it is right now, perhaps that Vim editor isn’t so bad after all?”. So. I decided it was time to give Vim a fair chance!
The first few days with Vim was honestly pretty slow and awkward for me, I kept forgetting about the different modes and instead of typing text, I constantly kept screwing up the text by selecting parts of the text, randomly jumping all over the place and doing all kinds of impressive accidents in swift motions.
Once I learned the basics of Vim, it became really fun to use it. My hands and my wrists was also thankful for not having to reach for the mouse all the time. I had never really considered how much time I actually spend in a text editor before I started to use Vim.
And while I wasn’t magically 9999% more efficient over a night, it did make editing text about 9999% more enjoyable for me.
I didn’t take long for me to come to the conclusion that Vim is the best text editor ever, for me. With my new-found awareness of Vim and its magic, I also started to notice that there’s a lot of Vim-like applications that supports keybindings and features similar to Vim. This lead me on a quest to Vim-ify both my desktop and workflow. Years later, I can safely say I did quite well with this task. There’s not much that doesn’t work like Vim on my computer these days.
I have also at one point in time replaced Firefox with qutebrowser, a keyboard-focused web browser with a minimal graphical user interface, highly inspired by (but not limited to) the Vimperator add-on and the Vi-like web browser dwb.
With qutebrowser I don’t have to use the mouse at all. Well. Some websites are so poorly designed that they don’t work without a pointing device. And yes, boohoo me, but let’s not forget about the people with disabilities who actually have no choice but to fully rely on the keyboard to access the web. All websites must be keyboard compatible.
My web browser is pretty much the only graphical application that I still use on a regular basis. Other graphical applications that I also use, but less frequently, are the PDF-viewer Zathura and the image viewer sxiv, which are both using Vi-like keybindings, a minimal graphical user interface and does not require any pointing device.
I even use the mouse so little that I let it automatically hide after a few seconds of inactivity with Unclutter. It’s really nice to be able to hide the mouse when you rarely use it.
Vim itself can’t take all credit for it though, it was more precisely efficient Vim-users and the keyboard community who inspired me to learn proper touch typing. And by “proper touch typing” I mean touch typing with all your ten fingers with the correct placement on the keyboard.
I have been a touch typist for a long time, but I was a self-taught using my own style with 2.5 fingers, unaware of any proper technique for the longest time. When I eventually found out about the right way I was too used to my own technique to be bothered starting over.
Eventually, that all changed when I saw some real world touch typist (from the keyboard community) typing really fast without breaking a sweat or even lifting their hands to reach all the alphanumeric keys. It was that and some inspiring Vim-wizards doing their magic with Vim that inspired me to finally re-learn touch typing the proper way.
I started out by doing typing tests on the website 10FastFingers. I was frustratingly slow the first day, typing at around 20 words per minute. Any attempts to participate in any form of real time conversation drove me nuts, but what kept me going was the fact that my hands felt rather relaxed when I typed. My hand didn’t rush all over the keyboard anymore, they just gently rested on the wrist rest and my fingers did most if not all the jobs.
Things did take a humorous turn when I fired up Vim the first time though. My muscle memory was completely reset in more than one way, it turned out that I was now no longer capable of finding the punctuation characters. Why didn’t I just peak at the keyboard? Well.. I use blank keycaps on my keyboard.
Re-learning to properly touch-type was one of the most frustrating thing I have ever done in my life, but at the same time it was also the most rewarding thing I have ever done. I think it took my muscle memory about one month to get back at my old typing speeds, by then I was also a lot more accurate. It didn’t take long after that for me to also increase my typing speed. Today I’m actually more than 20 words per minute faster than before.
You should really consider learning to properly touch type if you haven’t already done so. It changed my life for the better and I’m forever thankful to myself that I eventually did it.
As much as I love Vim, there’s a few things that I like less about it. The development cycle with Vim is slow, like really slow, they release a new version every two or three years. This is usually not an issue for me as I don’t care about bleeding edge software, but one day when I needed a feature in Vim that didn’t exist yet, I had to look for solutions. One of those solutions was to either install a plugin or try Neovim, who already had implemented the feature I was looking for.
Neovim is a fork of Vim that strives to improve the extensibility and maintainability of Vim. Neovim looked like a fresh breeze and I decided to try it out. It turned out to be quite a nice surprise. While it wasn’t a huge change in terms of functionally, or at least in the way I used it, I did notice that Neovim performed a bit faster. Not that I ever had any real issues with how Vim performed.
Another thing that I noticed with Neovim was some better defaults. It made me aware of small quality of life features that I previously didn’t know about. Because of this I could also remove a surprisingly large part of my configuration file, while I still gained new functionally.
Are you confused by all the names? Hopefully this will clear things out for you:
As you can see, the ‘Vi-family’ have quite the history dating all the way back to 1973.
New or old to the vi-family, I can highly recommend you checking out these links:
Probably in that order as well. I have a few more links to some interesting articles in my bookmarks section if you want to do some more reading.
Anyway. I hope you enjoyed reading my post about how I got started with Vim!
]]>I have since then made some changes to it, I have skipped both the Bash-script and the Supercat tool and I have also replaced Syncthing with Nextcloud for the syncronisation of this task.
My current setup consist of a plaintext file called todo.txt
, which is located in the folder $HOME/nextcloud/notes/
. The content of the file uses Markdown formatting (as always) and it looks like this:
# todo
------
## Monday
* [x] Plan dinners for the week
* [x] Grocery shopping
## Thuesday
* [ ] Laundry
<Note: I did not include the rest of the weekdays here for the sake of this demo>
## Unspecified
* [ ] Something that can be done any day
When I have completed a task, I cross it off with a checkmark. I intentionally leave the list intact the whole week, so I can see what I have done over the week and then feel good about what I have done. It does actually help with the motivation!
On my phone I can then access and edit the file using Nextcoud Notes. I can also preview the file ‘properly’ using the built-in preview mode and I can even interact with the checkboxes by tapping on them.
I find this way of managing a todo-list a lot simpler than my previous setup. I can’t really see why I need to make things any more complicated than this.
To make the managements of my list a lot easier, I have decided to install a Neovim plugin for this called Bullets.vim. It’s a fairly simple plugin for automated bullet lists. And as nice bonus I can now jump to any task and then press <Leader key>+x
to mark it as completed or uncompleted.
The concept is pretty simple, instead of buying new clothes you swap clothes with each other.
For every piece of clothing you give away you get a ticket, the ticket can then be traded with another item there. There’s usually a maximum amount of items you can give away and at today’s event it was 10 items each. Everything that doesn’t get a new home goes usually to either charity or to a secondhand store.
I had a lot of fun and I ended up with a bunch of good kids clothes which was nice. I do wish that more guys would attend these kinds of events. It’s usually uncommon to see guys and that makes it rather difficult to find anything for myself and other guys. It’s a lot easier to find clothes for women and kids.
I think this is a great way of updating and refreshing your wardrobe without it costing you any money and more importantly; it’s not impacting the planet with any additional carbon dioxide.
If you didn’t know, the fashion industry’s carbon impact is bigger than the airline industry’s carbon impact. According to the same source Quantis the total greenhouse gas emissions related to textiles production creates around 1.2 billion tons of carbon dioxide annually.
In a report from Naturvårdsverket (the Swedish Environmental Protection Agency), the average Swede buys about 14 kilos of clothes and textiles per year and only two thirds of those clothes are being used. And it gets worse; we also throw away about 8 kilos of clothes and textiles per person and per year here in Sweden.
Most of those clothes are perfectly fine and could have come to good use for a lot of people, especially for those who’s not fortunate enough to afford new clothes.
The bad thing with wealthy countries is that they have too much money to spend on things they don’t really need to begin with. Swedes is especially good at overconsumption junk we don’t really need. And for some reason a lot of us seems to think that it’s okay to do a lot of shopping as long as you give away your old items to second hand.
This has resulted in the second hand stores here being crammed full of perfectly fine clothes (and other items), but most people don’t even visit the second hand stores to begin with. Perhaps it’s still taboo to buy used clothes for some? Who knows.
What we need to do is to buy way less new stuff and way more of the used and perfectly fine things out there. We need to start to think about tomorrow and what future that lays ahead of us if we continue down the unsustainable path we’re currently on.
]]>Some aren’t even open source, so they’re not an option to begin with, some require a GitHub account, some are too expensive (paid hosting) and some self-hosted alternatives are just a pure nightmare to set up.
If I have somehow missed some hidden gem out there, let me know via e-mail or IRC.
]]>I prefer to bake myself and this year me and my partner tried a new recipe, and they turned out great!
We used this recipe (It’s in Swedish) this year and it’s probably my current all-time favourite.
The reason I liked it more than the others is that you only need to ferment the dough once (which saves time) and you don’t heat the milk, which makes the dough easier to work with.
There’s a lot of recipes in English for Swedish cinnamon buns if you want to try them yourself. One of them are from a popular Swedish person called Fredriks Fika. He recently made a recipe in English for classic cinnamon buns.
If you haven’t yet tried Swedish cinnamon buns I can highly recommend you doing so!
]]>uMatrix is an add-on for advanced users to block any class of request made by the web browser, like scripts, iframes and ads. The add-on is created by the same person who also created (and later abandoned) the popular web browser add-on uBlock, an add-on which was transferred to another person who made himself rather unpopular by making some controversial choices.
The original author of uBlock later forked his previous project into a new project called uBlock Origins, a project that’s still being maintained today.
Thankfully he didn’t do the same mistake twice and it seems like he’s only abandoning the uMatrix project, with the possibility of maybe resuming it later according to a comment made by himself on GitHub.
Considering how popular this add-on is, I’m certain that someone will fork this project under a new name and continue the development of it. If you hear anything about a fork or an alternative to uMatrix, feel free to contact me about it and I will update this post with the information.
]]>I feel like that I would like to take a break from Mastodon[1] and see what happens with my phone usage in general. I access Mastodon 95% of the time via my phone and according to my phone I have opened Tusky (my Mastodon-client) in average about 30 to 50 times per day the last month or so. One day it was 100 times! That’s just crazy.
I can only imagine how much of an effect that distraction must have on my life in general. And since Mastodon is the only distraction I have on my phone these days, I’m hopeful that by removing my account it will result in something positive, like bringing back my passion for weblogs and the old web again.
To be honest, I have always considered myself to be a ‘healthy’ low-usage phone user, mostly spending my time modifying my phone with custom firmwares and icon packs, rather than using it for anything else. And sure, I once was that person, but something obviously happened along the road. I don’t know what, but I intend to find out what happened when I got lost and how I can find my way back again.
I now feel that I want to focus more on my weblog. It would be nice if this website could function more as my social corner of the web, just like how a weblog used to before we had ‘social medias’. For it to be truly social I probably need a commenting system as well. I’m not sure what to use yet, but I’m looking for options.
If you want to contact me and/or leave feedback you can do so via e-mail and IRC (I’m Hund at freenode).
]]>I started fresh with a new theme from scratch. This made it easier to improve the parts of the old code that I didn’t like from my previous theme. I was able work with a lot less code which was a lot of fun. I managed to remove 16 kilobytes of code and my website[1] is now down to 220 kilobytes of code.
If you like my theme you can find the source code here. If you have any feedback on the theme itself or my code (good or bad), feel free to contact me and let me know about it.
]]>Even though I’ve been an avid user of everything text-based for a long time, I was sceptic over using a text-based file manager. Could it really be as fast or as convenient as a graphical file manager? Well. It turned out I was wrong, so wrong!
The first days with Ranger felt a little bit awkward, kind off like how it felt with Vim the first time, but at the same time you instantly knew you were onto something good. I was using the basic navigation with the keys j
and k
to navigate up and down, gg
and G
to jump to the top and bottom and '<LETTER>
for my bookmarks. While it did work, it wasn’t efficient and browsing larger folders took me forever. This could have all been avoided if I hadn’t just quickly skimmed through the documentation and instead thoroughly read (at least most of) the documentation first.
It wasn’t until I read the whole documentation that I found out about the “find” feature, a feature that lets you quickly search for files and folders. It works by hitting the letter f
and then typing some of the characters from the file or folder you’re looking for. If you end up with a unique hit it will open the file or folder directly and you can also at any time navigate between the hits with the keys n
and tab
. This way of navigating made a large impact on the efficiency for me and it also convinced me that a text-based file manager can actually be more efficient.
With that said. I wasn’t 100% satisfied with the find-feature until I found out about a neat little tweak to the it! By rebinding f
to the function scout -ftsea%space
I was now able to visually filter out all non-hits, making it a lot easier to find what I’m looking for. I made a little animated GIF-image to demonstrate what I’m talking about:
If you want to do the same thing, add this line to your configuration file ~/.config/ranger/rc.conf
:
map f console scout -ftsea%space
Ranger comes with a lot of features and if that’s not enough, it’s also possible to add new functionality with scripts and plugins. As this is meant to be an introduction to Ranger I will only cover some basics here.
The first thing you might ask yourself is: “What about thumbnails?”. Well. Showing thumbnails for images might be considered to be one of the most basic features a file manager should have by some. And they’re right.
Ranger can show a (single) preview/thumbnail of pretty every file there is—even archives (using atool) and torrent-files (using transmission-show)—the issue is that it can only preview the currently marked file. Which is perfectly fine for everything but images. A solution to this is the image viewer sxiv, which can show thumbnails for images.
I wrote about sxiv back in 2018: “sxiv - A simple Vi-like image viewer”. It’s a great lightweight and scriptable image viewer that I highly recommend everyone checking out!
What makes Ranger truly great is the keybindings. To give you an idea how it could work, I have included some of the common keybindings for me. Some of them are defaults and some of them are my own. I’m not really sure which ones are the defaults or not though, I’ve been using Ranger for a long time now.
Command | Description |
---|---|
H |
Show hidden files and folders. |
r |
Open with <APPLICATION> . |
D |
Delete the marked file or the selected files. |
<Space> |
Selects the current file/folder. |
v |
Marks all files and folders in the current directory. |
a |
Edit the name of the file/folder by putting the cursor last. |
I |
Edit the name of the file/folder by putting the cursor first. |
cw |
Change the name of the file/folder. |
o |
Sort current directory. oa to sort by time os to sort by name size and so on. |
'<LETTER> |
Jump to bookmark. |
m<LETTER> |
Bookmarks the current directory. |
:bulkrename |
Lets you bulk rename the selected files and folders by using your $EDITOR. |
Command | Description |
---|---|
gn |
opens a new tab. |
gc |
closes the current tab. |
<Tab> |
switches tab to the right. |
<Shift>+<Tab> |
switches tab to the left. |
This is some of the keybindings that I actually know that I have added myself.
Command | Description |
---|---|
F |
Executes detox %f on the current file or folder. Detox makes file names pretty by removing troublesome characters and spaces. |
Md |
Creates a folder. |
U |
Uploads the selected file(s) and/or folder(s) to my Nextcloud account using shareLinkCreator. |
Pp |
Creates a PDF-document of the selected document using Pandoc. |
Ph |
Creates a HTML-document of the selected document using Pandoc. |
px |
Extracts the archive using atool . |
pat |
Creates an archive using tar . |
paz |
Creates an archive using zip . |
w |
Sets the current image as a wallpaper using feh . |
If you’re at any time lost and/or need any kind of help in Ranger, you can just press the key ?
to bring up this dialog that will help you:
View [m]an page, [k]ey bindings, [c]ommands or [s]ettings? (press q to abort)
To install a plugin you simply copy it to the folder $XDG_CONFIG_HOME/ranger/plugins/
. I only have one plugin myself and that’s a plugin called plugin_file_filter.py, it’s a plugin that visually hide files and folders. Why? The main reason I installed it is so I can hide the folder ~/Desktop
. I don’t have a desktop, so why would I want to see the folder?
You can find more plugins on their wiki.
This is far from everything that Ranger can do, my hope is that what I covered here today is enough to help peak the interest for you with Ranger and to try it out yourself!
I highly recommend you checking out their cheatsheet (PNG / SVG), the official user guide and the rest of the wiki for all the information available about Ranger.
And if you’re interested in looking at my latest public configuration for Ranger it’s available online via my public Git-repository for Ranger and other dotfiles.
]]>Thankfully I found a solution to that today and eix looks a lot better for me now. Here’s a comparison with a before and after images:
I found the solution in this post over at the Gentoo forums. The solution is to simply set the variable SOLARIZED=true
in your shell. You do this with the command export SOLARIZED=true
. If you want to make it permanent you just add it to your configuration file for your shell.
Setting it all up is pretty easy and straightforward, as long as you know what to do. You can either read the documentation or just be happily lazy and copy my pretty generic setup that I use with both my Nextcloud account and a public read-only calendar from Google, so I can keep myself à jour with our holidays here.
It’s wise to start with the backend. The file file you need to edit is ~/.config/vdirsyncer
and this is what my configuration file looks like (It should be safe to copy this and the other configuration files and just make minor obvious adjustments to them):
[general]
# A folder where vdirsyncer can store some metadata about each pair.
status_path = "~/.config/vdirsyncer/status/"
# CardDAV
# =======
# Operation Tulip
# ---------------
[pair nextcloud_contacts]
# A `[pair <name>]` block defines two storages `a` and `b` that should be
# synchronized. The definition of these storages follows in `[storage <name>]`
# blocks. This is similar to accounts in OfflineIMAP.
a = "nextcloud_contacts_local"
b = "nextcloud_contacts_remote"
# Synchronize all collections that can be found.
# You need to run `vdirsyncer discover` if new calendars/addressbooks are added
# on the server.
collections = ["from a", "from b"]
# Synchronize the "display name" property into a local file (~/.contacts/displayname).
metadata = ["displayname"]
# To resolve a conflict the following values are possible:
# `null` - abort when collisions occur (default)
# `"a wins"` - assume a's items to be more up-to-date
# `"b wins"` - assume b's items to be more up-to-date
#conflict_resolution = null
[storage nextcloud_contacts_local]
# A storage references actual data on a remote server or on the local disk.
# Similar to repositories in OfflineIMAP.
type = "filesystem"
path = "~/.config/vdirsyncer/contacts/"
fileext = ".vcf"
[storage nextcloud_contacts_remote]
type = "carddav"
url = "https://cloud.operationtulip.com/remote.php/dav/addressbooks/users/<USERNAME>/contacts/"
username = "<USERNAME>"
password = "<PASSWORD>"
# CalDAV
# ======
# Operation Tulip
# ---------------
[pair nextcloud_calendar]
a = "nextcloud_calendar_local"
b = "nextcloud_calendar_remote"
collections = ["personligt", "fdelsedagar", "temadagar"]
# Calendars also have a color property
metadata = ["displayname", "color"]
[storage nextcloud_calendar_local]
type = "filesystem"
path = "~/.config/vdirsyncer/calendars/"
fileext = ".ics"
[storage nextcloud_calendar_remote]
type = "caldav"
url = "https://cloud.operationtulip.com/remote.php/dav/"
username = "<USERNAME>"
password = "<PASSWORD>"
# Helgdagar
# ---------
[pair helgdagar]
a = "helgdagar_local"
b = "helgdagar_remote"
collections = null
[storage helgdagar_local]
type = "filesystem"
path = "~/.config/vdirsyncer/calendars/helgdagar/"
fileext = ".ics"
[storage helgdagar_remote]
type = "http"
url = "https://calendar.google.com/calendar/ical/sv.swedish%23holiday%40group.v.calendar.google.com/public/basic.ics"
read_only = "true"
(My calendar “fdelsedagar” is actually named “Födelsedagar”, vdirsyncer just removed the letter “ö” for some reason.)
When you’re done setting up vdirsyncer you need to ‘discover’ both the calendars and the addressbooks with the command:
$ vdirsyncer discover
You can then synchronize everything with the command:
$ vdirsyncer sync
And you’re done! I highly recommend you scheduling the command using Cron. I have this in my configuration file for it to sync every three hours:
*/180 * * * * vdirsyncer sync
The config is located at ~/.config/khal/config
and my configuration file looks like this:
[default]
default_calendar = Personligt
highlight_event_days = true
[view]
dynamic_days= false
[locale]
unicode_symbols = false
local_timezone = Europe/Stockholm
default_timezone = Europe/Stockholm
timeformat = %H:%M
dateformat = %d.%m
longdateformat = %d.%m.%Y
[calendars]
[[Personligt]]
path = ~/.config/vdirsyncer/calendars/personligt/
color = light cyan
[[Födelsedagar]]
path = ~/.config/vdirsyncer/calendars/fdelsedagar/
color = dark blue
[[Helgdagar]]
path = ~/.config/vdirsyncer/calendars/helgdagar
color = yellow
Once it’s setup you can start using Khal. It comes with both a text-based user interface as well as a command-line interface. The syntax for the commands can be a bit tricky to figure out if you’re new and clueless, but the interactive mode is really simple.
When I was new I had issues remembering the syntax for the time and date. For some reason you format the syntax like this: <DD>.<MM>. <HH>:<MM> <HH>:<MM>
, for an example: 12.08. 18:00 22:00
. Which doesn’t make much sense to me. Something more sensible would be something like 12.08 18:00-22:00
.
Anyway. Here’s a few examples of what you can do via the command-line:
$ khal printcalendars
List all events between today and 30 days forward:
$ khal list today 30d
Tuesday, 25.08.2020
Linux födelsedag (R)
On a specific date (in this example it’s October 12 between the clock 18:00 and 22:00):
$ khal new 12.08. 18:00 22:00 "Laundry"
You can also specify dynamic dates, alarms, a specific calendar and a description:
$ khal new tomorrow 18:00 22:00 -alarm 10m -a <CALENDAR> "<TITLE> :: <DESCRIPTION>"
If you want it to be a recurring event:
$ khal new 12.08. "<EVENT>" -r <yearly/monthly/weekly/daily>
There’s also the flag -u, –until
if you want it to be for a limited time only.
$ khal search <KEYWORD>
When you want to edit an event you simply use a search keyword (like “Linus”):
$ khal edit --show-past "Linus"
28.12-28.12 Linus Torvalds födelsedag (R)
Edit? [n]o [q]uit [s]ummary [d]escription da[t]etime range re[p]eat
[l]ocation [c]ategories [a]larm [D]elete:
It’s also possible to import calendars from ICS-files:
$ khal import -a <CALENDAR NAME> <FILE>
And if you want to use the interactive mode:
$ khal interactive
You can add a new event using the interactive mode without first running Khal, even though this method can be a bit annoying if you do it wrong:
$ khal new -i
summary: Test
datetime range: 12.08 13.08 13:00 15:00
critical: Could not parse "12.08 13.08 13:00 15:00".
critical: Please check your configuration or run `khal printformats` to see if this does match your configured [long](date|time|datetime)format.
critical: If you suspect a bug, please file an issue at https://github.com/pimutils/khal/issues/
To be honest I have no idea how the “datetime” syntax work here. I only use the shell commands myself, but I highly recommend using the proper interactive interface with khal interactive
and then pressing the key N
.
I also highly recommend you reading the documentation for Khal regarding all the available commands and how they all work.
For some reason the name scheme doesn’t follow its sibling. For Khard the configuration file is ~/.config/khard/khard.config
. Here’s my configuration file:
[general]
debug = no
default_action = list
editor = nvim
merge_editor = colordiff
[addressbooks]
[[Personal]]
path = ~/.config/vdirsyncer/contacts/contacts
[contact table]
# display names by first or last name: first_name / last_name
display = first_name
# group by address book: yes / no
group_by_addressbook = no
# reverse table ordering: yes / no
reverse = no
# append nicknames to name column: yes / no
show_nicknames = no
# show uid table column: yes / no
show_uids = yes
# sort by first or last name: first_name / last_name
sort = first_name
[vcard]
# extend contacts with your own private objects
# these objects are stored with a leading "X-" before the object name in the vcard files
# every object label may only contain letters, digits and the - character
# example:
# private_objects = Jabber, Skype, Twitter
private_objects = Jabber
# preferred vcard version: 3.0 / 4.0
preferred_version = 3.0
# Look into source vcf files to speed up search queries: yes / no
search_in_source_files = no
# skip unparsable vcard files: yes / no
skip_unparsable = no
Running just khard
prints all the contacts like this:
$ khard
<INDEX NUMBER> <NAME> cell: <PHONE NUMBER> home: <E-MAIL ADRESS> <ID>
You can show an contact with the argument show
:
$ khard show alex
Name: Alexander
Address book: Personal
Phone
cell: <PHONE NUMBER>
E-Mail
home: <E-MAIL ADRESSS>
Address
home:
<ADRESS>
Miscellaneous
UID: <UUID>
If you want to edit a contact using your editor:
$ khard edit alex
The file is to large to show here, but it contains a lot of sane syntax and comments to help you understand how it works. Here’s the part with “important dates”:
# important dates
# Formats:
# vcard 3.0 and 4.0: yyyy-mm-dd or yyyy-mm-ddTHH:MM:SS
# vcard 4.0 only: --mm-dd or text= string value
# anniversary
Anniversary :
# birthday
Birthday : 1970-01-01
I once again recommend you reading the documentation for Khard regarding all the available commands and how they all work.
I didn’t go thought every possible bit, but it should be enough to get you started and going! I hope you enjoy this software as much as I do.
]]>To print information about a track you use the flag -l, --list-info
:
$ audiotag -l 01_Claustrophobic_Amnesia.ogg
*** `01_Claustrophobic_Amnesia.ogg'
=== ALBUM: TENONDERGANG
=== ALBUMARTIST: Ter Ziele
=== ARTIST: Ter Ziele
=== COMMENT: Visit http://terziele.bandcamp.com
=== DATE: 2018
=== TITLE: Claustrophobic Amnesia
=== TRACKNUM: 1
=== TRACKNUMBER: 1
I noticed that the track is missing a genre, let’s set the genre for all the tracks of that album:
$ audiotag -g "Depressive suicidal black metal" *.ogg
It’s simple as that. To list all available features just use the flag -h, --help
. I also highly recommend using the flag -p, --pretend
to dry run the command if you’re not 100% sure about what you’re about to do.
The easiest option is probably to clone the Git-repository on GitHub and copy the script to your $PATH. Just make sure that you have installed Perl (version 5.6 or newer) and:
id3tag
or id3lib
.vorbiscomment
from vorbis-tools
.metaflac
from flac
.If you’re using Gentoo, these are packages you might be looking for:
media-libs/id3lib
media-sound/vorbis-tools
media-libs/flac
media-video/atomicparsley
If you don’t have support for a format it might annoyingly remind you about it every time you use the tool:
$ audiotag -h -- INSERT --
WARNING: `AtomicParsley' not found in path, required for mp4 support!
WARNING: `AtomicParsley' not found in path, required for m4a support!
[...]
As you can see I don’t have support for MP4 or M4A and I don’t care. I fixed this issue by commenting out two parts of the script between the lines 473-491:
# MCM - handle mp4 and m4a using AtomicParsley
elsif ($file =~ /\.mp4$/i or $file =~ /\.m4a$/i) {
push @cmd, "AtomicParsley";
push @cmd, $file;
foreach (sort { $a cmp $b } keys %$info) {
# don't need extra track num field
/TRACKNUMBER/ && next;
$plus_tags{$_} ||= "===";
push @result, "$plus_tags{$_} $_: $info->{$_}";
}
if ($genre ) { push @cmd, ("--genre", uc $genre); }
if ($artist ) { push @cmd, ("--artist", $artist); }
if ($album ) { push @cmd, ("--album", $album); }
if ($title ) { push @cmd, ("--title", $title); }
if ($track ) { push @cmd, ("--track", $track); }
if ($year ) { push @cmd, ("--year", $year); }
if ($comments) { push @cmd, ("--comment", $comments); }
push @cmd, ("--overWrite", "--gapless", "true");
}
And the lines 663-664:
check_for_prog(\@filetypes, \@missing, "mp4", "AtomicParsley" );
check_for_prog(\@filetypes, \@missing, "m4a", "AtomicParsley" );
It then stopped complaining about it.
]]>Like most other people I have my TV connected to a computer so I can play my local media on the TV. I used to have a dedicated computer for it with the ever so popular software Kodi and the ridiculously tiny wireless keyboard Logitech DiNovo Mini. It was a solution that worked fine for about a decade or so before I decided it was time for a change.
While the setup was good enough, I had two issues with it. One was the Bluetooth keyboard, it was regularly—several times per week—dropping the connection and the only way to get it to connect was to remove the battery for a few seconds. I eventually got tired of it and started looking for a new Bluetooth keyboard, but I couldn’t find anything that I liked. This is when I was starting to considering the option to just get a proper wired mechanical keyboard for a lot less money.
The second issue was the YouTube workflow with Kodi. I have never had any TV-channels (by choice), I instead ended up watching various content makers on YouTube, which is kind of ironic considering that I’m generally the last person to adopt anything remotely new or modern.
Back then I was following a crazy amount of channels. The YouTube-client for Kodi was perfectly fine for my needs at the time, at first at least. It had all the basic features one would expect of an Kodi-addon back then. You where able to login to your Google-account, view and subscribe to channels and all that. And it was all fine until one day when my list of subscriptions started queueing up and I ran into an unpleasant issue.
It turned out that the client had a pretty low cap on how many videos it would show in the subscription list with all new videos. It meant that if I wasn’t obsessively bench watching videos I would miss out on them. Well. Unless if I visited all the channels manually, one by one.. At this time I was following around 100 channels.
While I was looking for a solution to my issue I happened to read about YouTube secretly supporting web feeds. As a long time user and an advocate of web feeds I got exited and I instantly knew that this was something I wanted to explore! I tried to find a solution that would involve web feeds and while I was doing it I had this fun idea of setting up an UNIX-like media center. I was already using Newsboat and I thought it would be cool to use it in some workflow on my media computer as well.
I ended up with a text-based media center based on my back then number one Linux based operating system; Arch Linux, which was later replaced with Gentoo.
I didn’t have to think this through for long. I instantly knew what I wanted and how I wanted it. I installed my favourite window manager i3, the terminal emulator URxvt, the file manager Ranger, the media player mpv (with youtube-dl), livestreamer-curses and a few other things. I didn’t really have to make any major changes to anything other than changing a few keybindings to better fit a workflow that would not require me to use both my hands. I know how lazy I can be when I’m laying down in the sofa and I also use blank keycaps, so I need to be able to use my muscle memory.
With Newsboat as my new ‘YouTube-client’ I was in full control of the content. I didn’t have to worry about missing videos and I could easily filter out content that I didn’t want to see. I could also easily mark any videos as seen, a process that was utterly complicated in Kodi. To mark a video as seen in Kodi I had to either watch the whole video or fast forward to the end for it to mark it as seen.
And then it was the quality! With Kodi I was stuck at low resolution videos at 720p with 30 FPS. With mpv (and with the help of youtube-dl) I could watch videos in any quality I wanted. Almost.. My media computer was over a decade old and it turned out that I was limited to 1440p at 60 FPS if I wanted a smooth video without audio sync issues. This turned out to be just fine as well. I could not see any differences in the qulity with a slightly higher bitrate from my sofa a few meters away from the TV.
My new setup also improved my workflow by a lot. With Kodi I had to close the application I was using and then browse to the next thing, which always required far too many steps and a lot of time. In i3 I can just leave it in the background and instantly switch to anything else on another workspace with the keys Alt+<N>
.
The only downside with my text-based setup is the movie part. I don’t have access to fancy covers, metadata and things like that, but that’s okay since I don’t have a huge movie collection or anything.
Exactly one year ago I moved to the big city into a new and smaller apartment. I brought both my full-size desktop computer with me, but after a few months I decided that they took up way too much space and that I had to do something about it.
I also liked the idea of having just one computer, so I decided I wanted to try using my desktop computer as my media computer as well.
Here’s what I did:
q
to exit Newsboat and then run the command jo movies
to open Ranger in the movies directory on my storage.I have bound the keys <Super>+<Enter>
to focus workspace 10 on my TV and then spawn URxvt with alternative settings.
Here’s the config for i3:
bindsym $super+Return workspace 10; $exec "tvterm"
The script tvterm
looks like this:
#!/bin/bash
urxvt -name URxvt-tv -hold -e sh -c 'printf "\33]2;%s\007" "tvterm"; zsh'
The “TV settings” for URxvt looks like this:
URxvt-tv.font: xft:Monospace:pixelsize=40
URxvt-tv.boldFont:xft:Monospace:pixelsize=40
URxvt-tv.background: #000000
URxvt-tv.foreground: #FFFFFF
! black dark/light
URxvt-tv.color0: #2e3436
URxvt-tv.color8: #6e706b
! red dark/light
URxvt-tv.color1: #cc0000
URxvt-tv.color9: #ef2929
! green dark/light
URxvt-tv.color2: #4e9a06
URxvt-tv.color10: #8ae234
! yellow dark/light
URxvt-tv.color3: #edd400
URxvt-tv.color11: #fce94f
! blue dark/light
URxvt-tv.color4: #3465a4
URxvt-tv.color12: #729fcf
! magenta dark/light
URxvt-tv.color5: #92659a
URxvt-tv.color13: #c19fbe
! cyan dark/light
URxvt-tv.color6: #07c7ca
URxvt-tv.color14: #63e9e9
! white dark/light
URxvt-tv.color7: #d3d7cf
URxvt-tv.color15: #eeeeec
I wrote about using URxvt with alternative settings before if you want to read more about it.
It looks like I’m moving again soon and this time I’m not going to have my computer near my TV anymore. I know for sure that I don’t want a full-size computer as my media center anymore. I might end up getting a Raspberry Pi or something similar. I would highly appreciate any ideas or recommendations for a cheap, tiny and low consumption setup!
And that’s it I guess. My setup is not crazy in any way, but I like it!
]]>That is not always a desirable solution and sometimes not even an option. One example would be the folder ~/Desktop
for me, it’s a folder that I never use. I don’t even have a “desktop” to begin with, but I can’t just hide it by renaming it to “.Desktop”. If I did it would just be recreated.
With the help of the plugin plugin_file_filter.py it’s possible to visually hide files and folders you don’t want to see. If you want to temporarily view the hidden files and/or folders again you can just temporarly set the setting show_hidden
to true.
Start by creating the folder ~/.config/ranger/plugins/
:
$ mkdir ~/.config/ranger/plugins/
Save the script to the newly created folder. In the script you then have this part:
HIDE_FILES = ("/boot", "/sbin", "/proc", "/sys")
Edit that part to your liking and just restart Ranger for the changes to take effect.
]]>So. I’m pretty sure that it comes to no ones surprice that Newsboat is my web feed reader client of choice. If you happen to have missed out on this client, then you’re in for a treat! Newsboat is a feature rich text-based client that makes reading news more enjoyable.
I like Newsboat for multiple reasons, some of them are because it’s a client that’s keyboard driven, highly customizable, has support for regular expression filters, macros, running multiple instances (at the same time with different settings/feeds!) and because it even let’s me execute shell scripts.
I have two different profiles of Newsboat with different settings and feeds to separate my regular news from my video content subscriptions, which mainly is YouTube, even though I have at least one channel from PeerTube now!
After you have installed Newsboat you should probably tweak a few settings and add at least one feed before you run it for the first time. If you don’t you will be greeted with this message:
Error: no URLs configured. Please fill the file /home/<user>/.newsboat/urls with RSS feed URLs or import an OPML file.
Add your feed(s) to the file $HOME/.config/newsboat/urls
(one feed per line):
http://hunden.linuxkompis.se/feed.xml
https://fosstodon.org/@hund.rss
It should be noted that Newsboat supports cloud based services like The Old Reader, NewsBlur, FeedHQ, Bazqux, Tiny Tiny RSS and nextCloud News. You can read more about that in the chapter “Newsboat as a Client for Newsreading Services”.
I also recommend changing the default browser to your browser of choice in the file $HOME/.config/newsboat/config?
. For Firefox it would be something like:
browser "firefox --new-tab %u"
For a complete documentation about the configuration options check out their website. My current setup looks like this.
A basic ignore-filter that hides articles based on keywords in the title looks like this:
ignore-article "https://feber.se/rss" "title =~ \"<keyword>|<another keyword>\""
It’s also possible to filter articles based on keywords from the link, author, content, date, age and so on. It can actually get quite advanced if you would like to.
It’s also possible to create dynamic feeds based on certain filters. One examples would be to list all unread articles in one feed:
"query:> \Fresh Articles:age < \"1\" and title !~ \"trailers|trailer|\" and link !~ \"r\/gentoo\""
Another one would be to only show articles newer than N
days. In this example it will only show articles that’s 48 hours old or newer:
"query:> \Fresh Articles:age < \"2\" and unread = \"yes\""
It’s also possible to combine multiple filters with each other. In this example I created a dynamic feed that only lists unread articles that has the keyword “trailer” in the title:
"query:> \Trailers:unread =\"yes\" and title =~ \"trailer\""
You can read more about filters in their documentation.
Macros is another feature that I really like about Newsboat. Even though I might only use some basic macros myself, I find them valuable.
I use mainly three macros. One that lets me open the article in my readability-script:
macro r set browser "html2text.py %u | fold -s -w 115 | less" ; open-in-browser ; set browser "`echo $BROWSER`"
Another one that opens the article in Firefox via its reader view mode:
macro R set browser "firefox --new-tab about:reader?url=%u" ; open-in-browser ; set browser "`echo $BROWSER`"
And a third one that opens the articles (with videos) in my media player:
macro m set browser "mpv %u" ; open-in-browser ; set browser "`echo $BROWSER`"
You run a macro with the key ,
followed by the key you assigned the macro to. You can read more about macros here.
With the help of my good friend Ghosty, I managed to create a Python-script that fetches the articles and presents them to me in a more readable way. I use this script when the feed only publish an excerpt and not the whole article.
Here’s what some articles looks like when they want to force you to their websites:
It works pretty much flawlessly, except for one little detail; there’s no images. If the article includes images I have no way of knowing it.
A workaround to this issue for me was to involve another web browser. I happen to have Firefox installed for websites that I don’t really trust. When I come across a image heavy article I just open the article in Firefox using my previously mentioned macro:
macro R set browser "firefox --new-tab about:reader?url=%u" ; open-in-browser ; set browser "`echo $BROWSER`"
This is the script:
#!/usr/bin/env python3
from newspaper import Article
import sys
url = sys.argv[1]
a = Article(url)
a.download()
a.parse()
c = a.title.count("",1)
print(a.title)
print("="*c)
print("")
print(a.text)
For the script to work you need the Python-package called newspaper3k
. Save the script, make it executable and then use it like this:
$ html2text.py <URL>
If you want decent folding of words and pagination I highly recommend you piping the output via the tools fold
and less
like this:
html2text.py %u | fold -s -w 115 | less
That’s it for now! I hope you liked my introductory post to Newsboat enough to give it a try.
]]>This goes for news articles, weblog posts, software releases, submissions from a subreddit on Reddit, toots from users on Mastodon, new videos from YouTube-channels and so on. Pretty much everything supports web feeds these days! You can even automatically download torrent files using web feeds via clients like Flexget, but that’s an article for another time.
You could say it kind off works like an e-mail newsletter, but in a much less broken and annoying way! With web feeds you don’t need to give out any information about you at all[1], you’re in 100% control and you can at any time easily end your subscription on your own terms.
I have about 50 feeds—not counting the YouTube-channels—in my client, it’s mainly news sites, weblogs, projects and feeds for software releases. It makes life so much easier to just open my client, quickly glance at what’s new, perhaps read a few articles and then go on with my life.
Without web feeds I would have to manually visit all those ≈50 websites and look for any new content on them. I can only image the amount of time I would have wasted doing that over the years.
Reading the articles via my client comes with several benefits, the largest one is the fact that I can read the content in the comfort of my own desktop and in a consistent way. I don’t have to care about navigating poorly designed websites with unreadable typefaces and colours take make my eyes bleed.
And let’s not forget that I don’t have to worry about malicious ads or trackers! If you didn’t know; Google alone is tracking you on 86% of the top 50 000 websites today. And as we all know, Google is far from the only malicious company out there spying on you.
Another benefit with web feed readers is the ability to filter out content that you don’t want to see. I follow a lot of YouTube-channels using web feeds and some of them post daily content with various gameplay videos. If I don’t like some video game I can just add a filter that hides all the articles with those games.
Web feeds is not all good though. There’s one thing I don’t like with some websites though and that’s some websites do not publish the whole article in their web feed, for the simple reason that they want you to visit their website directly. They do so in an attempt to both track you and expose you to their ads. My way around this is a neat little Python-script that fetches the article and formats the content in a readable way for me. More about this later.
A hidden gem with YouTube is the fact that there’s a web feed for every channel on YouTube. A highly appreciated feature by people like me who tend to avoid the ‘modern’ web as much as possible.
There’s unfortunately no magic button to find the feed, what you need to do is to visit a channel and make sure the address looks like something like this:
https://www.youtube.com/channel/UC_zQ777U6YTyatP3P1wi3xw
If the address ends with the channel name like this:
https://www.youtube.com/c/nevertoosmall
Then you need to visit one of their videos and click your way back to the channel via the channel name under the video title.
Step two is to copy the last part of the address that looks like this:
UC_zQ777U6YTyatP3P1wi3xw
And append it to this address:
https://www.youtube.com/feeds/videos.xml?channel_id=
So it looks like this:
https://www.youtube.com/feeds/videos.xml?channel_id=UC_zQ777U6YTyatP3P1wi3xw
This is the address that you add to your web feed reader. There’s one thing to note here though; the article is missing all the descriptive text for the video. If you really want the description you can subscribe to the channels via an Invidious-instance. Invidious also adds several other features that regular YouTube doesn’t have, like showing you an icon for every web feed and letting you subscribe to playlists.
If you’re paying attention to the links you might have noticed that the YouTube-links and the Invidious-links have the same ending. This makes it easy to convert the links between them if you choose to migrate to any other instance or perhaps just want to go back to the default YouTube-links.
Here’s an example of the Never Too Small-channel:
https://www.youtube.com/feeds/videos.xml?channel_id=UC_zQ777U6YTyatP3P1wi3xw
https://invidious.snopyta.org/feed/channel/UC_zQ777U6YTyatP3P1wi3xw
I tend to favour text-based applications and tools simply for the reason that they often get the job done in the most effcient way possible. I do understand that’s not the case for everyone and if you’re someone who prefers graphical applications there’s a lot good clients for you as well.
To name a few popular clients:
There’s also several cloud based web feed services that let’s you read news via the web and even syncing your data across clients on various devices. I’m not that up to date with that though. I used to self-host a server using something called Tiny Tiny RSS, but I have since then shut the whole server down in my road to depending less on the cloud.
I hope I managed to spark some interest for web feeds with this introductionary post. If you liked it I would highly recommend you reading my post about my all time favourite web feed reader client called Newsboat.
]]>This is what I have in my Neovim configuration to let me copy marked text using Ctrl+C
:
vmap <C-c> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR>
Just make sure to install the tool xclip
if you don’t already have it.
I first though it was an issue with the plugin Ranger.vim and I didn’t do anything about it. I exclusively use that plugin to navigate my filesystem and open files in Neovim using Ranger (and previously in Vim) and I can’t live without it.
It wasn’t until I recently that I noticed that I had the same issue when using the built in command :edit
that I did some research about it and found out about the feature autochdir
:
'autochdir' 'acd' boolean (default off)
global
When on, Vim will change the current working directory whenever you
open a file, switch buffers, delete a buffer or open/close a window.
It will change to the directory containing the file which was opened
or selected.
When enabled it means that when I’m working on a file in the folder $HOME/example/
and then open a new buffer and spawn Ranger inside Neovim (or just using :edit
) I end up in the folder $HOME/example
and no in my home folder $HOME/
.
Source: https://vim.fandom.com/wiki/Set_working_directory_to_the_current_file.
]]>$ uprecords
# Uptime | System Boot up
----------------------------+---------------------------------------------------
-> 1 29 days, 04:57:14 | Linux 5.4.38-gentoo-x86_ Tue May 26 15:23:46 2020
----------------------------+---------------------------------------------------
NewRec 29 days, 04:57:13 | since Tue May 26 15:23:46 2020
up 29 days, 04:57:14 | since Tue May 26 15:23:46 2020
down 0 days, 00:00:00 | since Tue May 26 15:23:46 2020
%up 100.000 | since Tue May 26 15:23:46 2020
Install the package app-misc/uptimed
:
# emerge --ask app-misc/uptimed
After the installation you need to start the service:
# service uptimed start
And preferable add it to the default system runlevel:
# rc-update add uptimed default
Install the package uptimed
:
# apt install uptimed
After the installation you need to start the service:
# systemctl start uptimed
And preferable add it to the default system runlevel:
# systemctl enable uptimed
After the installation you can simply run the command uprecords
to display your uptime records. I also recommend you checking out the flag --help
for more options.
Web feeds happens to be my prefered way of consuming Reddit these days. Reddit is for the most part a a higly toxic place and I try to stay away from it, but it does comes with a lot of good things that I like.
June 23, 2020 - Thanks to @dredmorbius@toot.cat on the fediverse for recommending me a few more feeds that I did not know about.
Let us start with all the standard web feeds.
If you want to you can even add dates to any feeds, here is an example showing the monthly top feed:
Other possible dates are hour
, day
, week
, year
and all
.
If you would like to follow a subreddit you can do so as well. Here is an example with the subreddit r/Gentoo:
You can even combine several subreddits in one feed like this:
It is also possible to follow users. Here is an example with the fictive user “reddit_user”:
If you want to you can only follow either the users submitted posts and the comments of any user:
Yep. This is a thing as well:
It is also possible to follow a single comment:
]]>Here’s an example when I have searched for the number 3
and jumped to that search hit:
You can’t probably see it, but the colours are different! The colour on the normal text is #839496
while the highlighted text is #93a1a1
. I was able to fix this and here’s how it looks for me right now:
This is the setting that fixes it:
hi search ctermfg=8 ctermbg=3 cterm=none
Adding that setting to my configuration for Neovim didn’t work though, for some reason my colour scheme changes it back, a workaround for me was to use an auto command for it:
autocmd colorscheme solarized highlight search ctermfg=8 ctermbg=3 cterm=none
A big thanks to “marcohinzgitter[” and “habamax” on the irc-channel #neovim at freenode.net for the helping me solving this long standing issue!
]]>I didn’t really like the approach of having two terminal emulators, so I decided to do some research to see if I could solve it by only using my main terminal emulator URxvt. Spoiler: I could.
It turns out that you can add alternative settings for URxvt and then optionally enable them with an argument. I found out about this in an old thread over at the Arch Linux forums.
You can add a custom setting with the name URxvt-<word>
, like URxvt-tv
and when you run URxvt wit the flag -name URxvt-tv
it will use these settings.
I added the following settings to my file ~/.Xresources
:
! TV settings
URxvt-tv.font: xft:Monospace:pixelsize=40
URxvt-tv.boldFont:xft:Monospace:pixelsize=40
! Tango colours
URxvt-tv.background: #000000
URxvt-tv.foreground: #FFFFFF
! Black dark/light
URxvt-tv.color0: #2e3436
URxvt-tv.color8: #6e706b
! Red dark/light
URxvt-tv.color1: #cc0000
URxvt-tv.color9: #ef2929
! Green dark/light
URxvt-tv.color2: #4e9a06
URxvt-tv.color10: #8ae234
! Yellow dark/light
URxvt-tv.color3: #edd400
URxvt-tv.color11: #fce94f
! Blue dark/light
URxvt-tv.color4: #3465a4
URxvt-tv.color12: #729fcf
! Magenta dark/light
URxvt-tv.color5: #92659a
URxvt-tv.color13: #c19fbe
! Cyan dark/light
URxvt-tv.color6: #07c7ca
URxvt-tv.color14: #63e9e9
! White dark/light
URxvt-tv.color7: #d3d7cf
URxvt-tv.color15: #eeeeec
When I run the command urxvt -name URxvt-tv
it will launch URxvt with my alternative settigns.
This is not related to the title of this post but I thought I would include it anyway. I wanted to be able to instantly spawn the “TV terminal” on my TV from any monitor and workspace and have it automatically disable the decoration. I solved this by adding this keybinding to i3:
bindsym Mod4+Return workspace 10; exec --no-startup-id "tvterm"
I also added these two rules to i3::
for_window [title="tvterm"] border none
workspace 10 output HDMI-0
The script tvterm
includes this snippet:
#!/bin/bash
urxvt -name URxvt-tv -hold -e sh -c 'printf "\33]2;%s\007" "tvterm"; zsh'
I don’t know why, but I didn’t get it to work when I added that command direcly to the configuration file for i3. And the printf part is to trigger the rules for i3.
]]>As of writing this post the latest version of rTorrent is 0.9.8 and the latest version of libtorrent is 0.13.8.
Start by downloading the source code for rTorrent and libtorrent from their website:
$ wget http://rtorrent.net/downloads/rtorrent-0.9.8.tar.gz http://rtorrent.net/downloads/libtorrent-0.13.8.tar.gz
We then need to download the patch that adds some lovely colours to rTorrent. I used the patch from the package rtorrent-color from the Arch User Repository:
$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/rtorrent-color.tar.gz
Continue to unpack the archives:
$ tar -xvzf rtorrent-0.9.8.tar.gz
$ tar -xvzf libtorrent-0.13.8.tar.gz
$ tar -xvzf rtorrent-color.tar.gz
Install the required dependencies:
# apt-get build-essential build-dep rtorrent libtorrent
Start by going to the folder libtorrent-0.13.8
:
$ cd libtorrent-0.13.8
Configure and install the package:
$ ./autogen.sh
$ ./configure --disable-debug
# make install
The flag --disble-debug
is optional.
Go to the folder ../rtorrent-0.9.8
:
$ cd ../rtorrent-0.9.8
Apply the patch:
$ patch -up1 -i <path to patch>/rtorrent-0.9.8_color.patch
Configure and install the package:
$ ./autogen.sh
You now have two options; to enable or disable remote connections for rTorrent. If you don’t connect to rTorrent via a third party client like ruTorrent or Transdroid I highly suggest you disable the feature.
With support for remote connections:
$ ./configure --disable-debug
Without support for remote connections:
$ ./configure --disable-debug --without-xmlrpc-c
Then continue to install the software:
# make install
The configuration file for rTorrent is $HOME/.rtorrent.rc
and this is the part of the config that adds the colours:
# 0 = black
# 1 = red
# 2 = green
# 3 = yellow
# 4 = blue
# 5 = purple
# 6 = cyan
# 7 = grey
# 8 = dark grey 9 = dark red
#10 = dark green
color_inactive_fg = 3
color_dead_fg = 1
color_active_fg = 6
color_finished_fg = 2
This is my configuration file for rTorrent:
# General settings
max_peers = 200
max_peers_seed = 100
max_uploads = 50
download_rate = 0
upload_rate = 0
session = /home/johan/.rtorrent/session
schedule = low_diskspace,5,60,close_low_diskspace=100M
port_range = 58152-58162
port_random = no
check_hash = no
encryption = allow_incoming,try_outgoing,enable_retry
dht = off
peer_exchange = no
# Colors
## 0 = black
## 1 = red
## 2 = green
## 3 = yellow
## 4 = blue
## 5 = purple
## 6 = cyan
## 7 = grey
## 8 = dark grey 9 = dark red
## 10 = dark green
color_inactive_fg = 3
color_dead_fg = 1
color_active_fg = 6
color_finished_fg = 2
# Notifications
method.set_key = event.download.finished,notify,"execute2=/home/johan/Scripts/rtorrent_notify.sh,$d.name="
# Folders
schedule = watch_directory_torrents, 5, 5, "load.start=/mnt/hdd0/.torrents/*.torrent,d.directory.set=/mnt/hdd0/torrents/"
This script (as specified in the configuration file) gets executed every time rTorrent completes a torrent and sends me a message about it via XMPP using sendxmpp:
#!/bin/sh
echo "New torrent!\n\n$1" | /usr/bin/sendxmpp --tls-ca-path="/etc/ssl/certs" -t <My XMPP-account>
If you run rTorrent locally and just want a desktop notification, you can just replace the content with this:
#!/bin/sh
notify-send "New torrent!" "$1"
So. I wanted to be able to list all my posts in an alphabetical order by tags and then sort each of these posts by title, not by date like it would by default.
My desktop
- I went from a multi monitor setup to just a single monitor setup
- My Desktop - Mars 2019
My keyboards
- My keyboard - KBParadise V60
- My keyboard - Let’s Split
- My keyboard - The Black Diamond
And this is how it can be done:
{% assign tags_sorted = site.tags | sort %}
{% assign posts_sorted = site.posts | sort: 'title' %}
{% for tagitem in tags_sorted %}
<!-- for each tag, create an anchor by using the tag name as an id -->
<div id="{{ tagitem[0] }}">
<h3> {{ tagitem[0] }} </h3> <!-- for create a heading -->
<ul> <!-- create the list of posts -->
<!-- iterate through all the posts on the site sorted by alphabet-->
{% for post in posts_sorted %}
<!-- list only those which contain the current tag -->
{% if post.tags contains tagitem[0] %}
<li>
<a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endfor %}
qlop
from the collection of utilities called q applets you can check how long it took to install a package in Gentoo. qlop reads from your log $EMERGE_LOG_DIR/emerge.log
and extracts relevant information.
# qlop -Ht qtwebengine
[...]
2020-02-19T16:58:02 >>> dev-qt/qtwebengine: 2 hours, 14 minutes, 17 seconds
2020-03-31T01:27:45 >>> dev-qt/qtwebengine: 2 hours, 12 minutes, 43 seconds
2020-05-28T10:24:16 >>> dev-qt/qtwebengine: 2 hours, 22 minutes, 6 seconds
The flag -t
lists all installations and the flag -H
prints the time in a human readable format.
If you would like to see the average time it has taken to install a certain package you can do so with the flag -a
:
# qlop -Ha qtwebengine
dev-qt/qtwebengine: 2 hours, 6 minutes, 24 seconds average for 19 merges
dev-qt/qtwebengine: 2 seconds average for 1 unmerge
Don’t forget to check out all the available features with the flag --help
.
The tool is available in the package app-portage/portage-utils
:
# emerge --ask app-portage/portage-utils
If you want to run a command as any user you easily do that by using sudo
:
$ sudo -H -u <user> sh -c "<command>"
Here’s an explanation of the flags I’m using:
-H, --set-home |
Request that the security policy set the HOME environment variable to the home directory specified by the target user’s password database entry. Depending on the policy, this may be the default behavior. |
-U user, --other-user=user |
Used in conjunction with the -l option to list the privileges for user instead of for the invoking user. The security policy may restrict listing other users’ privileges. The sudoers policy only allows root or a user with the ALL privilege on the current host to use this option. |
Here’s an example script, it’s one of my scripts called 00refresh
:
#!/bin/bash
case $1 in
suspend|hibernate)
;;
resume|thaw)
sudo -H -u johan sh -c "DISPLAY=:0.0 /home/johan/Scripts/pm-resume.sh"
;;
*) exit $NA
;;
esac
The script is placed in the folder /etc/pm/sleep.d/
and made executable. The number 00
in the beginning of the filename defines the sleep hook ordering convention. When you set it to something between 00 and 49 it assumes the usual services and userspace infrastructure is still running, you can read more about that in the manual.
It’s a great feature for system critical filesystems, but if you have a storage disk you usually don’t need that feature at all. And if you have a large system disk you could probably lower the value a bit, but that’s for you to decide.
I have turned off the reserved blocks on my storage disk and as you can see below it does make a noticeable difference on a larger filesystem.
$ df -h
Filesystem Size Used Avail Use% Mounted on
[...]
/dev/sdb1 3.6T 1.9T 1.6T 55% /mnt/hdd0
$ df -h
Filesystem Size Used Avail Use% Mounted on
[...]
/dev/sdb1 3.6T 1.9T 1.8T 52% /mnt/hdd0
Start by checking the amount of reserved block count you have on the disk:
# tune2fs -l /dev/sdb1 | grep 'reserved block count'
Reserved block count: 48837696
If you don’t know what your device names is you can list them with the command fdisk -l
as a privileged user. In my case the device name was sdb1
.
To change the value we are going to use the tool tune2fs
. In this example I changed the value to 0
(zero) with the flag -m0
:
# tune2fs -m0 /dev/sdb1
tune2fs 1.45.5 (07-Jan-2020
Setting reserved blocks percentage to 0% (0 blocks)
You can then double check to see if it worked:
# tune2fs -l /dev/sdb1 | grep 'reserved block count'
Reserved block count: 0
Thankfully you can easily fix this by adding a few parameters to the $EDITOR
for your NeoMutt configuration file:
set editor="vim +':set textwidth=0' +':set wrapmargin=0' +':set wrap'"
This should work fine with Mutt and Vim as well.
]]>Post updated:
One of the many reasons why I like Gentoo, is the fact that it makes my computer fun to use again. It’s partly because Gentoo provide the tools to build an operating system that’s tailored for just me. Unlike most other mainstream Linux based operating systems, you’re not limited to what they see fit for you.
I also like the friendly and helpful community surrounding Gentoo. Even though Gentoo is considered to be one of the more advanced operating systems, the community (including those who work with Gentoo) is still friendly and helpful towards everyone, including newcomers who might not even be that experienced with any Linux based operating system to begin with.
There’s no elitism at all in the land of Gentoo, and you don’t get any “Internet karma” by the community for using some weird piece of software by some obscure project. Perhaps most importantly, you won’t get bashed on for choosing to install the ‘wrong’ init-system or any ‘mainstream’ or ‘uncool’ piece of software that’s ‘too easy’ to use. As a long time user of other Linux based operating systems this was a fresh breath of air for me.
If you want to read about Gentoo’s philosophy in their own words, I can highly recommend reading the article “the philosophy of Gentoo” by the creator Daniel Robbins.
With Gentoo, you get what I call a semi-rolling release model. When it comes to the default kernel, they always use the long-term support (LTS) kernel, and when it comes to other software they’re in no hurry to rush out any bleeding edge software to the stable repository.
Unlike most other Linux based operating systems and their binary package managers (pun intended), there’s not just two modes; “stable” and “YOLO”. With Gentoo you can of course unmask every single testing package, if you would like to ‘yolo it’, but perhaps a bit more safe approach would be to unmask a single package. If you would like to try a new testing version of your favourite text editor, you can do so by unmasking just that single package.
Gentoo doesn’t rely on various repositories to separate stable and untested packages from each other, they instead use something called keywords. There’s two keywords for every architecture:
arch (Example: amd64 , x86 , ppc-macos ) |
Both the package version and the ebuild are widely tested, known to work and not have any serious issues on the indicated platform. |
~arch (Example: ~amd64 , ~x86 , ~ppc-macos ) |
The package version and the ebuild are believed to work and do not have any known serious bugs, but more testing is required before the package version is considered suitable for arch. |
You can add keywords for a specific package (or a whole category), a specific versions of a package and all versions of a package up to or after a specific version. And yes, Gentoo categories every package into different categories. This makes it easier to find packages and it also means that packages can have the same name without it being confusing.
Compiling your packages from source with settings and optimizations specifically tuned for your hardware can sometimes give you a significant performance boost, but with today’s hardware that is for most not something noticeable. The real benefit with compiling your own software is that you gain a greater control over the software you use. It means that you can customize both the compiler itself and the target-application options to better fit you and your system. If you don’t want and/or use a feature with a certain piece of software, why should you then have to include it with the package in the first place?
Modifying your packages isn’t as literal as with CRUX. Gentoo uses something called USE-flags, which let’s you easily enable and disable specific features for software, both on a global and on a per-package level.
An example would be the USE-flag perl
, which adds support for the programming language Perl for certain packages. My favourite terminal emulator called URxvt, comes with support for plugins via Perl, and If I want support for Perl in URxvt, I can simply install the package x11-terms/rxvt-unicode
with the USE-flag perl
enabled, but I don’t want to use Perl I can simply add the flag -perl
to completely disable support for Perl, and avoid any unnecessary features in the software itself and the installation of any extra packages.
Another thing that I like with Gentoo is the fact that it’s easy to both set up your own local repository and create your own ebuilds. An ebuild is a text file with Bash syntax that instructs the package manager on how to compile any piece of software. This means that I’m not reliant on the package maintainers to include and keep any package up to date. I can simply do it myself, without much effort.
The Distribution Kernel project aims to maintain sys-kernel/*-kernel
packages. These kernel packages have three goals:
The modern versions of Distribution Kernels support two mechanisms for changing the kernel configuration: savedconfig
and /etc/kernel/config.d directory
. Savedconfig replaces the entire default config with an administrator-supplied config file, so it is probably a better choice for those desiring to build an entirely custom kernel. When using /etc/kernel/config.d
, the configuration files are merged on top of the default configuration file, so it is more convenient for use-cases that change some specific options.
I let a friend read this draft before publishing it, and it turns out that he had totally misunderstood how you install packages in Gentoo. He thought it was rather complicated, that you needed to use make
, that you needed to know where to install files and all that, but it’s actually just as easy as installing any package in any other Linux based operating system:
# emerge <package>
That’s it.
And no, installing packages doesn’t require a weekend in the freezer. Most packages doesn’t take that long at all, I would say that most packages takes about 1-5 minutes for me on my decade old computer running an Intel i5-2500k CPU.
Here’s a few examples of some of the common packages that I have (sorted in order by time):
Package | Average compile time |
---|---|
media-gfx/inkscape | 13 m 48 s |
sys-kernel/gentoo-kernel | 11 m |
media-gfx/gimp | 7 m 11 s |
x11-libs/gtk+ | 3 m 31 s |
x11-terms/rxvt-unicode | 34 s |
mail-client/neomutt | 25 s |
There is some exceptions here though, like dev-qt/qtwebengine
and app-office/libreoffice
. For me, QtWebEngine takes about 4 hours (!) to install.
When the previous operating system I was using switched over to systemd, I experienced a noticeable downgrade in terms of stability, as well as a slight downgrade in usability. The two things that annoyed me the most wasn’t the stability issues, it was the binary logs and the fact that when I booted and shut down the operating system, I would always have to wait 90 seconds (!) for some issues with a service that was not working as intended.
I used systemd for several years—I really tried to like it for what it was—but I eventually gave up it. There was always some issue with it, and it did kill the fun in using computers for a while. It also didn’t help that they had (and still have) a weird approach to software design, it’s what I would call an anti-UNIX philosophy. They also notorious for making somewhat controversial moves, but let’s not get too deep into the whole systemd controversy.
Gentoo supports multiple init-systems like OpenRC, Runit, s6 + s6-rc, sysvinit and even systemd. The default init is OpenRC, but there’s nothing stopping you from choosing any other alternative. And unlike most other Linux based operating systems, that perhaps ‘technically’ supports one alternative init, they won’t punish you for choosing a path that doesn’t align with their narrow views.
I myself uses OpenRC, as it’s what I’m used to as a pre-systemd user. I’ve been using Gentoo for years now, and I have so far never had any real issues with OpenRC. It’s robust, familiar and easy to use, just the way I prefer it to be.
The documentation for Gentoo is superb! The Gentoo wiki is regarded as one of the best documented wiki. The first time I tried Gentoo was back in 2010. At that time, I had only been using Linux based operating systems for about 4 years, and I was still a beginner at it, but I still managed to install Gentoo all by myself, thanks to the documentation on the Gentoo wiki.
The downsides with Gentoo can be the fact that you have to compile pretty much all software by yourself[1]. If you have a really slow computer, it can take some time to compile some packages, but as long as you do some planning you’ll be fine. And by planning, we’re talking about installing LibreOffice from source on a laptop computer the day before class, and not five minutes before class.
app-officelibreoffice-bin
and dev-lang/rust-bin
.Well. That’s all! I hope you liked reading my thoughts about Gentoo and that it perhaps even got you interested in trying it out for yourself.
]]>The wallpaper is available in the following three sizes:
The pictures are available on Nextcloud here: https://cloud.operationtulip.com/s/Z7FmBzFdnaQWC8e.
If you want it in any other size, the sources along with instructions is available there as well. If you need any help or just want me to make it for you, just ask.
]]>What is Linuxkompis anyway? It’s a Swedish project that me and a few friends are working on. If you happen to speak Swedish, like Linux and open source software I would highly recommend you checking it out!
Since I’m now hosting this website myself I also needed a proper domain for it. I thought about buying a new domain, but all the good ones are already taken and I wasn’t super thrilled about spending money on another domain. So.. Why not make use of one that I already have?
The name “hunden” is a Swedish word and it translates to “the dog”. “Hund” means dog in Swedish (and Norwegian, Danish and Germany). The name “Hunden” is also a bad pun of the two words “Hund” and “En[glish]”.
Why not just hund.linuxkompis.se? Because that’s where I have my Swedish blog. It looks just like this website, but it’s in Swedish and a lot older than this blog.
]]>The idea with my journal is that I want it to be quick and simple, even though I initially thought about other options like Jekyll and flat file-databases with one entry per file and so on. In the end I decided I don’t want to overdo it—I want to keep it as simple as possible—otherwise I would have probably not bothered with keeping a journal if it would take too much time doing it.
I decided that the best way was to use a single plain text file with Markdown formatting and then using my editor to input the text. As for the formatting, I tried a few different ways of formatting my entries before I settled with this style:
# 2019
## December
### 18 - Wednesday
Example entry.
### 19 - Thursday
Example entry.
If I for some reason ever want to convert it to something else, like HTML code or a PDF-document it would then look like this:
2019
December
18 - Wednesday
Example entry.
19 - Thursday
Example entry.
I also fold every month in Vim to keep it visually compact. Do you keep a journal of some sort? What applications are you using and how are you doing it? It would be fun hearing how other people are doing it. :)
]]>The mistake I did was to remove this line from my ~/.zshrc
:
export FREETYPE_PROPERTIES="truetype:interpreter-version=35"
It’s an option that I added years ago and I didn’t even remember what it did. When I cleaned my configuration for ZSH I decided to uncomment everything that I wasn’t sure if I needed or not. I thought that if it’s something important I will notice it eventually. Which I did, but not in the way I intended.. It took me a couple of days before figuring out what broke the font rendering and this was it.
A couple of years ago, FreeType decided to change the default rendering for the fonts, to something way more ugly if you ask me. They call it the “v40 TrueType” and I don’t like it at all. I prefer the older v35 method and the export enables this by default.
]]>diff
-output from etc-update
.
This is how the default output looks like:
And this is what it can look like if you replace diff
with colordiff
:
First make sure that you have the package app-misc/colordiff
installed and then replace the following line in the file /etc/etc-update.conf
:
diff_command="diff -uN %file1 %file2"
With this line:
diff_command="colordiff -uN %file1 %file2"
And you’re done.
]]>WireGuard® is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances.
For me this was happy news! I have been using OpenVPN for years now and while it’s okay, it’s far from perfect. I have spent countless of hours trying to get it to work the way I want it to and sometimes just to make it work at all. And let’s not get into the performance issues.. Pushing my 100 Mbit Internet connection through OpenVPN uses a lot of processing power.
I haven’t used Wireguard for that long, but so far I’m pleased with how easy it was to set up and how well it has performed. I’m currently running it on both my desktop computer and my 4 year old Android phone, the trusty Nexus 5X. When I used OpenVPN on my phone it used so much battery that I instead avoided using the phone on networks that I didn’t trust rather than using OpenVPN due to how much battery it required.
With Wireguard the battery impact is rather small on my phone. Even though I’m running the application in the userspace rather than the kernel module that’s not available for my version of Lineage OS.
Another thing that impressed we is that I no longer need my custom script for pm-utils
to restart the VPN-connection every time I wake up my computer, with WireGuard it just works.
The package for WireGuard is still marked as unstable and I needed to whitelist it it by adding the following line to the file /etc/portage/package.accept_keywords
:
net-vpn/wireguard ~amd64
I then installed the package:
# emerge -av net-vpn/wireguard
WireGuard isn’t in the kernel sources yet, so I then had to rebuilt the module myself:
# emerge -av @module-rebuild
I also want the module to load when my system starts, so I added the following line in the file /etc/conf.d/modules
:
modules="wireguard"
I then needed to make sure that the modules-service is set to run in the boot runlevel:
# rc-update add modules boot
All I had to do was to download a premade configuration file from my VPN-provider. It was named integrity_vpn.conf
and it looked like this:
[Interface]
PrivateKey = <Key>
Address = <IPv6 and IPv4 adresses>
DNS = <IPv6 and IPv4 adresses>
[Peer]
PublicKey = <Key>
Endpoint = <Adress>
AllowedIPs = 0.0.0.0/0, ::/0
I copied the file to the folder /etc/wireguard
:
# cp integrity_vpn.conf /etc/wireguard
And I also made sure to set strict permission for it:
# chmod 600 /etc/wireguard/integrity_vpn.conf
And that’s it!
I could now connect to my VPN-provider with the command:
# wg-quick up integrity_vpn
And to disconnect:
# wg-quick down integrity_vpn
To make it connect to my VPN-provider automatically at start I added the previous start command to the file /etc/conf.d/local.start
.
You can manually enable it with the command :set colorcolumn=<Value>
and it will work for that session. But manually enabling it or statically enabling it wasn’t any options either, I only wanted to enable it for Bash- and Python-files and after some reading I figured it out:
au BufWinEnter *.sh,*.py set colorcolumn=80
The only issue I ever encountered in regards to using an internal sound card was with ALSA getting confused and not knowing which card to use. For some reason it always chooses the PC-speaker.
To work around that issue with Arch Linux (which was what I used before Gentoo) I just blacklisted the kernel module pcspkr
with the command # rmmod pcspkr
and then made it permanent:
# echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf
With Gentoo that didn’t work[1], so I had to tell ALSA which card I wanted it to use. To do so I needed to figure out the name of my card, which you can do with the command aplay -L
:
$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=DX
Xonar DX, Multichannel
Default Audio Device
[...]
front:CARD=DX,DEV=0
Xonar DX, Multichannel
Front speakers
[...]
front:CARD=pcsp,DEV=0
pcsp, pcsp
Front speakers
snd_pcsp
. It could have worked to just disabled that as well.As you can see, my soundcard is called DX
and the device number is 0
:
front:CARD=DX,DEV=0
With that I then created the file ~/.asoundrc
and added this content to it:
defaults.pcm.!card DX
defaults.pcm.!device 0
defaults.pcm.!ctl DX
I then continued to reboot my computer and it all worked just fine after that.
If you want to make these changes for all users on your computer, just add the content to the file /etc/asound.conf
instead.
Source: ALSA - Gentoo Wiki
]]>cp
can sometimes be a bit lacking. It doesn’t give you any feedback whatsoever, which is almost never an issue for your average small file, but when you copy perhaps several gigabytes of files you want to know if it’s going to take 10 minutes or 10 hours.
A way around this is to use rsync, the tool most people probably associate with making backups, but with the right flags it’s actually a really good verbose tool for simply copying files. Here’s an example when I copied a folder for a virtual machine:
$ rsync -ah --progress VirtualBox/vhost-cloud-new /media/HDD0/
sending incremental file list
vhost-cloud-new/
vhost-cloud-new/vhost-cloud-new.vbox
3.29K 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=7/9)
vhost-cloud-new/vhost-cloud-new.vbox-prev
3.29K 100% 3.14MB/s 0:00:00 (xfr#2, to-chk=6/9)
vhost-cloud-new/vhost-cloud.vdi
3.43G 19% 111.59MB/s 0:02:00
As you can see rsync will show you the size of the file, the current progress, the current speed and the estimated time left for the file it’s currently copying:
3.43G 19% 111.59MB/s 0:02:00
When you copy folders with rsync you need to make sure that you end the folder name with a forward slash (folder/
) when you want to copy the content of the folder, and don’t end it with a forward slash (folder
) when you want to copy the folder itself.
This command will copy the folder to the destination:
$ rsync -ah --progress VirtualBox/vhost-cloud-new /media/HDD0/
This command will copy the content of the folder to the destination:
$ rsync -ah --progress VirtualBox/vhost-cloud-new/ /media/HDD0/
-a, –archive | Archive mode; equals -rlptgoD (no -H,-A,-X). |
-r, –recursive | Recurse into directories. |
-l, –links | Copy symlinks as symlinks. |
-p, –perms | Preserve permissions. |
-t, –times | Preserve modification times. |
-g, –group | Preserve group. |
-o, –owner | Preserve owner (super-user only). |
-D | same as --devices --specials; |
--devices | Preserve device files (super-user only). |
--specials | Preserve special files. |
It’s not that convenient to type rsync -ah --progress <source> <destination>
every time, so I highly suggest you creating an alias for it. I made one that I named cpr
.
Just add the snippet alias cpr='rsync -ah --progress'
to either your ~/.bashrc
or what your configuration file might be, and then reload the configuration with the command source ~/.bashrc
.
This is the default layer where I have all the keys you expect to find on a keyboard. I have blanked out the layout and only included the changes I have made to it.
The orange button where you normally find Caps Lock
is where I have a primary layer tap key. This means that when I tap that key it will functions as the Escape
-key and when I tap and hold it will act as my FN1
-key and activating my secondary layer.
The left pink key is a modifier key that works as Backspace
when tapped and then function as Right Shift
when tapped and held.
The green keys a set of modifier keys as well. They work as a extra set of navigation keys when tapped and then as the regular keys when tapped and held.
This is my secondary layer. I can probably seem a bit overwhelming with all the colours, but it’s actually pretty simple and it’s at least logic to me.
The purple keys are what’s called chained keys. This means that when I use the key kombination FN+C
it will act as Ctrl+Alt+C
. This eliminates pretty much all my use of my regular Left Ctrl
-key and most of my hand movement.
This is my third layer where I have my numpad keys.
I have an external numpad, but I lent that to my mom who had greater use of it than me. With both a regular keyboard who has a numpad cluster and with an external numpad there’s a lot of hand movement. I don’t like that. With this layer I can access the numpad whenever I want to input a lot of number without moving my hand at all.
If this looks interesting I suggest you checking out the documentation.
]]>This is made possible with a Python 3 script called himawaripy. It’s a script that downloads a fresh picture of the Earth that’s taken with the Japanese weather satellite Himawari 8.
You can choose between different resolutions which are referred to as quality. You can choose between quality 4
, 8
, 16
and 20
. The application doesn’t come with a manual and the flag --help
doesn’t say anything about the quality options.
I tried them all and this is what I ended up with when about 90% of the Earth was visible:
Quality | Resolution (pixels) | File size |
---|---|---|
4 | 2200 x 2200 | 5.83 MB |
8 | 4400 x 4400 | 21.8 MB |
16 | 8800 x 8800 | 79 MB |
20 | 11000 x 11000 | 126 MB |
Be aware that the quality 20
eats a lot of memory when it processes the image! It used about 650 MiB of RAM for me. With quality 4
it only used about 40 MiB of RAM.
The recommended (or at least the easiest) way of installing it is via the Python package manager called pip
:
$ pip install --user himawaripy
If you don’t have pip
you need to install it. On systems like Gentoo and Arch Linux the package is called python-pip
, while on Debian and Debian based systems it’s called python3-pip
.
The default usage is:
$ himawaripy -l <quality> --auto-offset
The flag --auto-offset
determines the timezone automatically. You can manually specify the UTC offset in hours yourself with the flag -o, --offfset <-12 to +10>
.
They only specify some common desktop environments as compatible, but it just fell back to feh
for me who doesn’t use a desktop environment.
If you only want to download the image and not set is as a wallpaper you can add the flag --dont-change
:
$ himawaripy -l <quality> --dont-change
This is handy if you want to use the image for something else or just want to set it as a wallpaper yourself like I do.
By default some of the Earth was hidden behind my panel. I didn’t liked it so I wrote a little script that adds a black border to the image and then sets that image as the wallpaper.
#!/bin/bash
dir="$HOME/.cache/himawaripy"
himawaripy -l 4 --auto-offset --dont-change
convert -border 64x64 -bordercolor black $dir/himawari*.png $dir/output.png
feh --bg-max $dir/output.png
I then added a cronjob that runs every 60 minutes to refresh the image:
*/60 * * * * $HOME/Scripts/space_wallpaper.sh
less
and reading text like this?
Reducing the environmental impact of a smartphone is one o
f our key business goals. For us, that starts by extending
the lifespan of our phone at the first stage of its lifec
ycle. For example, we use modular design to make repairs a
nd upgrades easy for the first user.
With fold
you could be reading it like this:
Reducing the environmental impact of a smartphone is
one of our key business goals. For us, that starts by
extending the lifespan of our phone at the first stage
of its lifecycle. For example, we use modular design
to make repairs and upgrades easy for the first user.
The two examples above are part of the output from this command (with only less
and then with less
and fold
):
$ html2text.py https://www.fairphone.com/en/2019/04/16/refurbished-phones-give-valuable-resources-a-new-life/ | fold -s -w 55 | less
The tool fold
comes with the GNU core utillities so it’s actually a tool that most should have by default. If you for some reason don’t have it installed, the package should be named coreutils
in all major distros.
Using it is simple, you can use it by itself:
$ fold <file>
Or use it in combination with other tools like I did:
$ cat <file> | fold
It only comes with three flags:
-b , --bytes |
Count bytes rather than columns. |
-s , --spaces |
Break at spaces. |
-w , --width=<WIDTH> |
Use |
pm-utils
for it.
You then also know that you need to use sudo
for it to work. This is a bit of an issue if you want to bind either command to a keyboard shortcut. A way around this is to add an exception for pm-suspend
and pm-hibernate
in the your /etc/sudoers
file, so you don’t have to enter your password for them anymore.
Just open your configuration for sudo
with the command visudo
and add this:
<USER> ALL = NOPASSWD: /usr/sbin/pm-hibernate
<USER> ALL = NOPASSWD: /usr/sbin/pm-suspend
You still need to use sudo pm-suspend
and sudo pm-hibernate
, but it will no longer ask you for your password.
$ youtube-dl --write-auto-sub <URL>
It will default to English, but you can specify another language with the flag --sub-lang
:
$ youtube-dl --sub-lang sv --write-auto-sub <URL>
You can list all available subtitles with:
$ youtube-dl --list-subs <URL>
It’s also possible to skip the video and only download the subtitle if you add the flag --skip-download
:
$ youtube-dl --sub-lang sv --write-auto-sub --skip-download <URL>
For more information consult the manual: man youtube-dl
.
Keyboard: | Custom |
Size: | 60% |
Case: | Diamond by KBDfans |
Circuit board: | S60-X by Sentraq |
Switches: | KS-8 (Red) by Gateron |
Stabilisers: | GMK Screw-in stabilisers by GMK Electronic Design |
Keycaps: | Cherry-profiled PBT Blanks by NPKC |
I had issues with my Tealio switches becoming unnaturally scratchy. I tried solving it with lube—which helped a bit—unfortunately it didn’t solve the issue. I wanted to try a new layout and replace the old horrible “genuine” stabilisers from Cherry anyway, so I decided to start fresh!
I don’t own any good desoldering equipment, but a friendly stranger from the Swedish keyboard community offered to help me with it for free. I did offer him money, but he didn’t want any. :)
I used to have “end game” Tealio switches with custom gold plated 60 grams springs from SPRiT, lubed with Tribosys 3204. They ended up being a bit more expensive than I had planned, but this was my first attempt at my “end game” keyboard and I kept telling myself it was okay.
Lubricating switches was the most boring thing I have ever done in my life. I’m normally a patient person, but this was too much even for me. Swapping the springs took some time as well, but at least it didn’t require much effort.
When it was time to pick new switches I decided to go with regular stock Gateron Red switches. They’re good enough, cheap and comes with light springs that I’m okay with.
Fun fact: I actually paid more for the old custom springs alone than what I paid for the Gateron switches. :|
I bought the first stabilisers from an American vendor a long time ago, who claimed that they where “genuine” and not some cheap knockoffs from China (poor knockoffs is a common issue). I’m not sure what to believe, but I had major issues with them being rattly and popping off every time I removed a keycap. And it was a pure hell getting them back once they where loose.
This time I bought GMK screw-in stabilisers from a trusted guy via Reddit. What’s different about these is that you screw them to the PCB! They’re really not going anyway this time!
I also applied some thick lube from Super Lube on the parts where metal parts meats the plastic. The result is night and day in comparison from my old Cherry stabilisers. I’m really happy with the result!
I also decided to skip the commonly used switch plate. Aluminum is fairly soft, but I always felt that it was still a bit too harsh to type on for my fragile fingers. :)
I’m really happy with how it turned out. The change is subtle, but it’s noticeable and I like it!
I was also curious about trying a new layout. I wanted to split both the Backspace
-key and the right Shift
-key, as well as changing the bottom row to a classic UNIX bottom row and trying an ANSI Enter
-key.
All mentioned changes are marked in blue here:
And for reference, this is the default 60% ISO-layout:
I didn’t like it at all. The longer spacebar threw me off completely and I also had issues reaching the AltGr
-key—a key that I didn’t knew I was using as much as I did. The split Backspace
-key was a nightmare to use as well. I grabbed my soldering equipment and changed the layout to this:
After about a month of using the ANSI Enter
-key I decided that it wasn’t something for me after all. Sure, it might be closer to my pinky finger, but it’s still awkward to reach. I had to bend my wrist at a way more sharper angle which made it hurt after a while.
After one final adjustment to the layout and I’m now back to a pretty much standard ISO-layout. I kept the split right Shift
-key to avoid one extra stabiliser. I haven’t really found a good use for the extra key yet. It currently functions as an extra Delete
-key, but I rarely ever user it.
It took me a while to figure it out, but thankfully the solution is fairly easy. All I had to was to manually download the dictionary, extract it and then copy two files to the correct folder.
I had issues with just right-clicking and saving. I had to copy the link and then use wget
to be able to download the file.
Unpack the archive using unzip
(or any other archiving tool of choice):
$ unzip <file>.xpi
unzip
will unpack the files from the archive all over the folder that you’re currently standing in. I highly suggest you putting the archive in a temorary folder for easier management.
Copy the two files <lang>.aff
and <lang>.dic
to the folder dictionaries
that’s located in your IceCat folder.
Where that folder is located might depend on how you installed GNU IceCat. I manually installed it at ~/.local/bin/icecat
, so I moved the files to ~/.local/bin/icecat/dictionaries/
.
You then have to restart GNU IceCat for it to notice the new dictionary.
You set a mark (at the location of the cursor) with the key m
followed by a letter (a-z
or A-Z
). Do note that you get no visual indication that you have set a mark there and that the uppercase marks (A-Z
) works across your buffers.
If you set a mark using a uppercase letter it will open that document in the same buffer that you’re currently in, it will not spawn a new buffer.
You can now jump to that exact position from anywhere in the document with the key `a
. Or if you use 'a
it will then jump to the beginning of the line where the mark a
was set.
You can use marks to change, delete and yank text as well.
Delete:
d'a |
Delete all the lines from the current line to the line with the mark a . |
d`a |
Delete all the text from the current cursor position to the position of mark a |
Change:
c'a |
Change all the text from the current line to the line of mark a |
c`a |
Change all the text from the current cursor position to the position of mark a |
Yank:
y'a |
Yank all the lines from current line to the line with the mark a |
y`a |
Yank all the text from the current cursor position to the position of mark a |
You can list all marks using the command :marks
(or a specific mark with :marks a
or :marks abC
):
mark line col file/text
a 36 45 Yank all the lines from current line to the line with the
It’s also possible to scroll/jump between all the marks as well.
]' |
Jump to the next line with a lowercase mark |
[' |
Jump to the previous line with a lowercase mark |
]` |
Jump to the next lowercase mark |
[` |
Jump to the previous lowercase mark |
On my Swedish keyboard the character '
is a lot easier to access than the character `
. Because of that and the fact that I use the “`” feature a lot more, I deicided to switch place with them by adding this to my configuration file:
nnoremap ' `
nnoremap ` '
Source (and even more information): https://vim.fandom.com/wiki/Using_marks
]]>Visually hiding parts of the documents makes it easier to manage the documents, especially if they’re large.
As the title suggests, this is only to get you started. There’s a lot more to this subject than what this post will cover. I will only cover the basics to get you sold on one of the greatest features in Vim. :)
By default Vim doesn’t save your folds. Getting this part to work required a bit of trial and error with various settings, but I eventually got it to work in a sane way thanks to the help of the web.
Add this part to you configuration file ~/.vimrc
and Vim will automatically save and restore your folds just the way you left them:
augroup AutoSaveFolds
autocmd!
autocmd BufWinLeave,BufLeave,BufWritePost ?* nested silent! mkview!
autocmd BufWinEnter ?* silent! loadview
augroup end
Save and source the settings with source ~/.vimrc
(or just restart Vim) for the changes to apply.
Folding is easy, just remember that you need to be in visual mode to be able to create folds.
zf |
Create fold |
zd |
Delete fold |
zo |
Open fold |
zc |
Close fold |
zR |
Open all folds |
zM |
Close all folds |
zE |
Delete all folds |
That’s all for this post. If you want to read more about folding, different folding methods and what not, I then suggest you reading the help topic about it in Vim with :help folding
.
Here’s a demo:
$ sleep 5 ; echo "Every 60 seconds a minute passes in Africa."
Every 60 seconds a minute passes in Africa.
[ Time: 5s ]
Download the plugin via git
to your preferable folder of choice:
$ git clone https://github.com/popstas/zsh-command-time
Add this line to your ~/.zshrc
configuration file (and make sure that the path points to your file):
source "$HOME/.zsh/plugins/zsh-command-time/command-time.plugin.zsh"
This part is also going into your ~/.zshrc
configuration file:
# Different output for zsh-command-time
zsh_command_time() {
if [ -n "$ZSH_COMMAND_TIME" ]; then
hours=$(($ZSH_COMMAND_TIME/3600))
min=$(($ZSH_COMMAND_TIME/60))
sec=$(($ZSH_COMMAND_TIME%60))
if [ "$ZSH_COMMAND_TIME" -le 60 ]; then
timer_show="$fg[green]${ZSH_COMMAND_TIME}s $fg[default]"
elif [ "$ZSH_COMMAND_TIME" -gt 60 ] && [ "$ZSH_COMMAND_TIME" -le 180 ]; then
timer_show="$fg[yellow]${min}m ${sec}s $fg[default]"
else
if [ "$hours" -gt 0 ]; then
min=$(($min%60))
timer_show="$fg[red]${hours}h ${min}m ${sec}s $fg[default]"
else
timer_show="$fg[red]${min}m ${sec}s"
fi
fi
printf "\n[ ${ZSH_COMMAND_TIME_MSG}\n" "$timer_show]"
fi
}
To prevent too much clutter in the main configuration file I added the above part to a file called ~/.zsh/functions.zsh
. If you wish to do the same thing, don’t forget to source the file in your ~/.zshrc
configuration file as well:
source "$HOME/.zsh/functions.zsh"
Source your configuration with $ source ~/.zshrc
(or just restart the terminal emulator) when you’re done for the changes to take effect.
And yes, I said files as in plural. It allows you to upload multiple files in one go. It will then create a folder named something like 1553524745
(in your predefined upload-folder), upload the files to that folder and then share the public link to the clipboard.
It relies on curl
, xclip
and optionally zenity
for graphical notifications with interactive inputs.
It’s a script, there’s not much to do other than downloading the script and making it executable:
$ git clone https://github.com/schiessle/shareLinkCreator
$ cd shareLinkCreator
$ chmod +x shareLinkCreator
Start by copying the file config.example
to a more permanent place like ~/.config/shareLinkCreator/config
.
You only need to change the values baseURL
, username
and password
in the configuration file. The value uploadTarget
is optional and it’s where you want the files to be uploaded.
I have a folder called tmp
and a Cronjob that once a day at midnight deletes files in that folder that’s older than 1 days. The Cronjob looks like this:
00 00 * * * find $HOME/Nextcloud/tmp/* -mtime +1 -delete
You then need to place the script itself somewhere safe and change this line in the script:
. "$(dirname $0)/config"
You want to point it to the configuration file like this:
. "$HOME/.config/shareLinkCreator.rc"
It’s dead simple:
$ ./shareLinkCreator <file>
And for multiple files:
$ ./shareLinkCreator <file> <file>
When the file is uploaded it will copy the link to you clipboard and give you a notification about it.
I highly recommend setting a $PATH for your shell with all your scripts. You can then call the scripts by their names without the absolute path to the specific directory. Read more about it here.
]]>To make things simpler you can add a $PATH
to your shell. You can then call the script just by it’s name without the path to it. Like example.sh
instead of ~/Scripts/example.sh
.
Add this to your configuration file (~/.zshrc
for zsh and ~/.bashrc
for Bash):
export PATH="<your path>:$PATH"
You can use any folder. I prefer having my scripts in the folder ~/Scripts
:
export PATH="$HOME/Scripts:$PATH"
Resource your configuration file (or just restart the terminal emulator):
$ source ~/.bashrc
$ source ~/.zshrc
You can now call your script only by its name if it’s stored in ~/Scripts
or whatever folder you specified.
It uses xrandr for the magic, the official configuration utility to the RandR. It’s a CLI-tool that can be used to set things like the size, orientation or the reflection of the outputs for a monitor.
If you’re thinking “Why?”, I suggest you reading my previous post: “I went from a multi monitor setup to just a single monitor setup”.
This is only tested with the i3 window manager, but it should (in theory) work with other window managers. If you try it with something else let me know how it went. :)
The script is a little more than 150 lines of code so I uploaded it here. Download it and make it executable with $ chmod +x mon.py
.
To split your monitor with the same ratio as seen in the screenshot:
$ ./mon.py split -r 70x30
If you don’t specify a value it should default to 50x50
.
-h, --help |
Show the help message |
--i3ipc |
If you wish to put the focus back on the workspace where you where when you ran the script. This requires the Python-package i3ipc which is available via pip : pip install --user i3ipc . |
--i3 |
Use this flag if you use i3 in order to reload the panels after splitting the monitor. |
--reload |
It’s also possible to pass your own commands like --reload i3-msg reload . |
To revert back to a single monitor setup:
$ ./mon.py undo
I might go as far as saying that it’s even worse. Which would funnily enough confirm my love for the philosophy worse is better.
I got my triple monitor setup as a treat for myself when I quit with a Swedish tobacco called snus more than 5 years ago. I didn’t really need them, I just wanted to treat myself with something extra nice for quitting snus. Something that’s a lot more addicting than cigarettes.
I have been enjoying my setup for a long time now, but for the past months or so, I have been thinking about what value they truly add for me.
So. I thought I would give it a try to do a more ranty post, which hopefully won’t be too rambly or boring. I hope that my post might even be of some kind of value for someone as well.
The biggest and probably the most obvious advantage of a multi monitor setup is the physical space. You get more space to display a lot more content at the same time. Which might be more or less valuable depending on what you do at your computer. For me it was mostly about luxury rather than anything productive.
You get quickly spoiled with having two or more simultaneous workspaces that work independent of each other. You can fullscreen a video, or arrange some clients on a secondary monitor while working on the primary monitor, and they won’t ever interfere with each other in any way.
It’s possible to emulate a similar behaviour with another tiling window manager called Herbstluftwm. It can let you close the clients but not the containers and it also lets you partition your monitor(s) in any way you want. You can use a single monitor as two “physical” monitors.
Herbstluftwm is a good alternative that I’ve used in the past, but its hack-isch approach always leaves me trying to script everything to infinity rather than letting me get any actual work done. :)
Yep. More desktop space also requires a larger desk. I have a 140 centimeter wide desk that’s barley large enough to fit the monitors alone. There’s really no room for anything else. And it would require a pretty ridiculously large desk for my battlestation to feel anything close to light and roomy.
From a minimalist point of view the unnecessary required space has always bothered me. I live in a small apartment (by choice) and I don’t want my desk to be the dominant part of my living room. And while my current desk size is okay (for one monitor) I would prefer going smaller when I replace it (soon™).
Well. I guess that my priorities have shifted a bit over the years. Maybe I’m adult enough now where I value the benefits of minimalism, simplicity and aesthetics more than what multi monitor setup can give me. :)
Part of my interest for minimalism is based on my love for the minimalist aesthetics, but also my issues with overstimulation. It’s something I have battled with my whole life, yet it took me a long time to realize exactly how much of a distraction a multi monitor setup was for me.
Just writing this post on a single monitor setup with Vim in fullscreen using the plugin goyo.vim have boosted my productivity with like 9999%.
OT: Why have I yet not made a post about goyo.vim? I’m adding it to my todo-list as soon as possible! :)
More monitors equals more clutter. More clutter equals more things to keep clean. More things to keep clean equals more effort and less time to spend on things that matters in life.
This happens to be one of the many things I feel so strongly about a minimalist lifestyle. It’s not only about aesthetics and karma on Reddit. It’s mainly about the practical benefits that makes an impact on my real life outside this computer screen.
Finding a crisp and a high resolution picture in a 16:3 aspect ratio is nearly impossible. It’s not really a dealbreaker in any way. It’s more like a minor party pooper, I really don’t see my wallpaper that much anyway, but it happens! And when I do it’s nice to see a picture that makes me happy. :)
After all these years with a multi monitor setup I had to really rethink my whole workflow in a way more inventive way than ever before. When you have more space than you need you don’t really tend to make the most of it. That all changed now and it was quite the challenge the first few days adapting to 1/3 of the space I was used to.
It’s been about a week now and I have slowly been finding my way back to just one monitor and I must say that I actually prefer a single monitor setup over a multi monitor setup now. Multiple monitors actually only have one big advantage for me, while a single monitor have several small advantages that together outnumber that one advantage with a multi monitor setup.
The picture above displays my desktop in action. It’s pretty bare bones in terms of the visuals when I don’t have any visible clients. I try to maximize the usable space as much as I can and that’s why the panel is only visible when a workspace is marked as urgent or when I press the Super-key. The panel might be informative, but it’s also rather distracting for me when I try to focus on other things.
The wallpaper is a real photo of our moon. It’s actually close to 50 000 photos merged into one large 81 megapixels photo. You can read more about it on Reddit here.
This is my desktop in action and it’s a pretty typical setup. I like watching content from Twitch and YouTube when I’m at my computer and not working on anything that requires hyper focus. The small video isn’t as immersive as a fullscreen video on a 24” monitor but I still think it’s large enough to not bother me.
In the bottom right I have WeeChat. I usually keep it on a secondary workspace, but it’s sometimes nice being able to keep an eye out on a conversation on XMPP or IRC without switching between workspaces all the time. I have hidden the nicklist and buffer in WeeChat to make it more compact. I can toggle them by tapping the key Esc
and then followed by b
for the buffers list and n
for the nicklist.
The large master container to the left is usually in a tabbed mode where I keep several clients. This means that I can open, close and switch focus between larger clients without interfering with the container to the left where I keep the video and WeeChat.
I play pretty much only one game and that’s Minecraft. When I play and do more monotone things like mining it’s nice to watch a video that keeps me company. :)
I have solved this with a little script that floats the client and puts it in the corner as seen in the screenshot.
#!/bin/bash
if [ $(i3-msg -t get_tree | jq . | grep '["]focused": true' -A50 | grep '"floating":' | awk {'print $2'} | sed 's/"user_/img/;s/",/img/;s/"auto_/img/') = off ]
then
i3-msg floating enable;
i3-msg sticky enable
i3-msg border none;
i3-msg resize set 640 360;
i3-msg move to position 1280 0;
i3-msg focus tiling
else
i3-msg floating disable
i3-msg border pixel 3
i3-msg sticky disable
fi
Going from a multi monitor setup to just one monitor when you don’t need to felt a bit weird at first to be honest. I’m glad I did it though, as I now feel that it actually adds more value and makes me more productive than before.
What surprised me the most was that I was considering upgrading to a new large monitor that would ease the ‘pain’ of having just one monitor. Now I feel that a 24” 1080p works just fine. At least when you have a good window manager and a thought out workflow.
]]>Keeping track of the time can be a good thing though—duh—that’s why I use a neat console based widget called tty-clock. I’m not sure if it technically qualifies as a widget, but that’s what I call it anyway. :)
To get a clock like in the example above I use this command:
$ tty-clock -c -C 7 -r -f "%A, %B %d"
Here’s a breakdown of the flags:
-c |
Sets the clock at the center of the terminal. |
-C 7 |
Sets the clock color to what you see in the preview. |
-r |
Rebounds the clock. |
-f "%A, %B %d" |
Sets the date format as described in man date . |
Check the man tty-clock
for more options.
Two packages are available in the AUR:
It’s available in the repositories as tty-clock
.
It’s probably just easier to compile it yourself, but if you prefer ebuilds I wrote this super simple ebuild:
$ cat app-misc/tty-clock-2.3.ebuild
EAPI=6
DESCRIPTION="Clock using lib ncurses"
HOMEPAGE="https://github.com/xorg62/tty-clock"
SRC_URI="https://github.com/xorg62/${PN}/archive/v${PV}.tar.gz"
LICENSE="BSD-3-Clause"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""
DEPEND=""
RDEPEND="${DEPEND}"
Download the latest point release or the latest and greatest code via git:
$ git clone https://github.com/xorg62/tty-clock
Then compile and install the files:
$ make
$ sudo make install
Hemligastugan | **Admin** Hund » Example message.
WeeChat then thinks that the user “Hemligastugan” (which is a bot) mentioned me and then highlights the message for me. This got annoying pretty fast since it was me who wrote the message in Minecraft. :)
Thankfully this was easy to solve with the help of two plugins. One for the magic and another one to make it persistent:
Install the two scripts in WeeChat:
/script install unhighlight.py buffer_autoset.py
I created a rule (using regex) that disables highlights for all messages containing the text **Admin** Hund
in the channel #Hemligastugan
on the server im
(Bitlbee) like this:
/buffer_autoset add irc.im.#Hemligastugan localvar_set_unhighlight_regex \*\*Admin\*\* Hund
If you want to add another rule just use the separator |
. And don’t forget to save everything with the command /save
when you’re done.
I’ve been using both the Solarized colourscheme and the i3 window manager for about five years now. You can’t do much changes to a desktop as minimal as this, which is for the most of the time a good thing as it lets me focus on getting things done. :)
Here is some information for anyone interested:
Operating system: | Gentoo Linux |
Window manager: | i3 |
Panel/bar: | i3bar with Conky |
Terminal emulator: | URxvt |
Applications shown: | TwitchyBash, Twitch Bash client |
WeeChat, IRC client | |
Newsboat, news reader | |
Ranger, file manager | |
Neofetch, system information | |
Wallpaper: | Wallhaven.cc (8256x5504px) |
With the help of autossh you can automatically reconnect to lost connections. This is the basics and also how I use it:
$ autossh -M 0 -o "ServerAliveInterval 45" -o "ServerAliveCountMax 2" <user>@<host> -t "<command>"
The options ServerAliveInterval
and ServerAliveCountMax
will make the SSH client exit if it finds itself no longer connected to the server. And don’t forget to check out man autossh
for a lot more information.
And yes. Tmux have more features than Screen, but worse is better as they say. I just want the absolute basics and not any additional complexity or anything like that. I also consider Screen to be a lot easier and straight forward to use.
Screen and Tmux are two programs that let you create sessions in the terminal that you can detach and then attach to from any terminal emulator and/or machine. This is handy when you want to run anything via the console and don’t want to be forced to always keep that window open.
Let’s say you work on a remote computer where you want to continue running a service or application that can’t be run as a service. If you close the terminal it will also close the application. If you were to run it via a screen you could then detach that session and it will continue to run in the background.
It’s always a good idea to run things in a screen over a remote connection anyway. If anything happens to your connection and you get disconnected, you might loose important work and/or time.
* [Create a new session](#create-a-new-session)
* [Create a new session and automatically run a command](#create-a-new-session-and-automatically-run-a-command)
* [Create a new session without attaching to it](#create-a-new-session-without-attaching-to-it)
* [Detaching a session](#detaching-a-session)
* [List all sessions](#list-all-sessions)
* [Resume a session](#resume-a-session)
* [Create or resume a session in one command](#create-or-resume-a-session-in-one-command) * [Better titles](#better-titles)
Creating a new session is easy as:
$ screen -S <session name>
You can also run a command directly when creating a new session:
$ screen -S <session name> "<command>"
This also works and might be useful for some scenarios:
$ screen -S <session name> sh -c "<command>"
Sometimes you might want to create a new session without automatically attaching to it. This is possible with the combination of the flags -d -m
:
$ screen -S <session name> -d -m "<command>"
To detach a session tap and hold the key Ctrl
while tapping the keys A
and D
.
You can list all sessions with the flag -ls
:
$ screen -ls
There are screens on:
28049.keepassc (Detached)
3816.news (Attached)
2 Sockets in /tmp/screen/S-johan.
To resume a session:
$ screen -r <session name or PID>
Using the PID might be useful if you somehow ends up with two or more sessions with the same name.
I run several things in various screens. One of those things is my password manager KeePassC. If I were to use the commands I just mentioned, it would require a lot of effort to create, resume and keeping track of any running session. Thankfully there’s two flags that solves that for us.
If we check the manual we will find the combined flags -D -RR
with the descriptive text:
-D -RR Attach here and now.
It might sound dramatic, but it just means that it will do what you told it to do, no questions asked.
This is how the command looks for me with KeePassC:
$ screen -D -RR -S keepassc -t KeePassC sh -c "keepassc"'
This means that I can always run this one command and it will always do the same thing; if there’s already a session created it will then detach that session (if attached anywhere) and then attach the session to the terminal I ran the command from.
The default title for a new screen looks like this:
New screen...
With a few tweaks you can get it to look like this:
KeePassC [Screen 0 at Atlas]
If you want equally fancy titles, then add the following two lines to ~/.screenrc
:
hardstatus off
hardstatus string "%t [Screen %n at %H]"
You can then choose your own title with the flag -t <your title>
as seen in the example above in the previous part.
The command I used for this image was:
$ convert <input file> \( +clone -background black -shadow 50x8+0+5 \) +swap -background none -layers merge +repage <output file>
The part 50x8+0+5
controls the appearance of the shadow. The first value controls the opacity, the second one controls the radius and the two last ones controls the left/right and up/down alignment of the shadow.
This leaves you with Hund:_
and not Hund: _
. If you want the old behaviour back like me, the solution is simple. You just need to change one simple setting:
/set weechat.completion.nick_completer ": "
Don’t forge to save the changes with /save
.
Source: https://weechat.org/files/releasenotes/ReleaseNotes-devel.html#v2.4_nick_completer.
]]>I use blank keys on my keyboard and using the number row works just fine for simple things like switching workspaces and short numbers. For serious number inputs I highly prefer using something numpad-y though.
So. A few months ago I decided to try adding the number keys from the numpad to my alpha keys, but on a secondary layer that I access via the key that I coloured purple.
This is all made possible due to the ATMega32U4 microcontroller on my custom keyboard, which supports the open source firmware QMK. I’m planning on making a post about that some day if you’re curious about it. :)
I have been using this new “numpad” for a few months now. At first it was really awkward and I had to think before typing any number, but after a few months I have to say I have gotten really used to it. I don’t think a need a separate numpad anymore.
If your keyboard is programmable I would highly recommend you trying this out. :)
]]>You play the game by aligning three or more gems vertically or horizontally by swapping adjacent gems. The game ends when there are no possible moves left. Its simplicity is what makes it so brilliant.
I haven’t played any similar games for a long time, so I can’t compare it to other popular alternatives. I like this version a lot though. It’s buttery smooth, simple and starting a new game is instant. It’s perfect for the times when you want to kill a few minutes here and there.
And unlike most (if not all?) other alternatives, this is a open source game released under the license GPLv2.
Installation instructions can be found on their website here. They currently provide options for Ubuntu, Fedora, openSUSE, Debian and Arch Linux. You’re always free to compile it from source yourself as well.
I installed it on Gentoo Linux using my own simple ebuild called gweled-0.9.1.ebuild
which I put in the category games-puzzle
:
EAPI=6
inherit autotools
DESCRIPTION="Gweled is a free version of a popular game called Bejeweled or Diamond Mine for GNU/Linux."
HOMEPAGE="https:/img/gweled.org"
SRC_URI="http:/img/launchpad.net/${PN}/trunk/${PV}/+download/${PN}-${PV}.tar.gz"
LICENSE="GPLv2+"
SLOT="0"
KEYWORDS="amd64"
DEPEND="media-libs/libmikmod"
RDEPEND="${DEPEND}"
Thanks to @skunksarebetter@fosstodon.org on Mastodon for making me aware of this game! :)
]]>N
minutes with some fancy colours to make it look good. This is the result:
This is my second version of it. I’m not a programmer in any way, but I like tinkering with Bash. I tried to make it easy to change the colours yourself by adding variables. I also made it so it will cut the title and end with the character …
if it’s longer than the width of the terminal.
If you want to change the order of what it prints out, it shouldn’t be that difficult to change that either.
#!/bin/bash
# This requires Twitchy to work:
# https://github.com/BasioMeusPuga/twitchy
online=$HOME/.cache/twitchy.txt
width=$(expr $(tput cols) - 13)
twitchy --non-interactive | sort > $online
#------------------------------#
# Colours
#------------------------------#
default="\e[39m"
black="\e[30m"
red="\e[32m"
yellow="\e[33m"
blue="\e[34m"
magenta="\e[35m"
cyan="\e[36m"
lightGray="\e[37m"
darkGray="\e[90m"
lightRed="\e[91m"
lightGreen="\e[92m"
lightYellow="\e[93m"
lightBlue="\e[94m"
lightMagenta="\e[95m"
lightCyan="\e[96m"
white="\e[97m"
cName=$yellow
cTitle=$magenta
cGame=$blue
cUptime=$default
cDash=$default
cTwitchLogo=$magenta
cTwitchText=$default
#------------------------------#
if [[ -z $online ]]; then
echo -e "\n$cTwitchLogo _______ _ _ _
|__ __| (_) | | |
| |_ ___| |_ ___| |__
| \ \ /\ / / | __/ __| '_ \
| |\ V V /| | || (__| | | |
|_| \_/\_/ |_|\__\___|_| |_|
$cTwitchText one is online. :("
else
while read line
do
name=$(echo "$line" | cut -d "," -f1)
title=$(echo "$line" | cut -d "," -f3- | rev | cut -d "," -f2- | rev)
titleLenght=$(echo "$title" | wc -c)
if [[ $titleLenght -lt "$width" ]]; then
title=$(echo "$line" | cut -d "," -f3- | rev | cut -d "," -f2- | rev)
else
title=$(echo "$line" | cut -d "," -f3- | rev | cut -d "," -f2- | rev | cut -c1-$width | sed '0,/ /s/.$/img/' | sed '${s/$/\…/}')
fi
game=$(echo "$line" | cut -d "," -f2)
uptime=$(echo "$line" | cut -d "," -f3- | rev | cut -d "," -f1 | rev)
echo -e "\n $cName$name $cDash- $cTitle$title\n $cGame$game $cUptime($uptime)"
done < "$online"
fi
I use the script with the tool watch
so I can make it automatically update every 5 minutes:
$ watch -c -t -n 300 twitchyBash.sh
The flags used is:
-c --color
-t --no-title
-n --interval
And to get a fancy title for the terminal:
$ printf "\33]2;%s\007" "twitchyBash" && watch -c -t -n 300 twitchyBash.sh
To make life easier I added an alias called live
for it:
alias live='printf "\33]2;%s\007" "twitchyBash" && watch -c -t -n 300 twitchyBash.sh'
It supports most features you expect from a document reader like fitting documents to the width (s
) and height (a
), searching (/
), hinting links (f
), inverting colours aka “recolor” (Ctrl+r
), view pages side-by-side (d
) and more.
And as you might expect, since it’s a Vi-like application you use keys like j
, k
, Ctrl+f
, Ctrl+b
, and G
for navigation and +
and -
for zooming in and out, and so on.
There’s a fair amount of features and settings for it. I suggest you look it up using the manual pages; $ man zathura
.
And this is my fairly light config with a few changes:
$ cat ~/.config/zathura/zathurarc
# Font
set font "xos4terminus 22"
# Automatically adjust the document to full width
set adjust-open width
# Set the title to the filename
set window-title-basename true
# Larger scoll steps with j/k
set scroll-step 50
# Adjusting the document
map [normal] E adjust_window best-fit
map [fullscreen] E adjust_window best-fit
map [normal] e adjust_window width
map [fullscreen] e adjust_window width
# Toggling the inverted colours
map <C-i> recolor
I’m not sure why, but I have to use the font size 22
to get the size 12
in the bar. Unfortunately I get the actual font size 22
in a few other places like when I’m using hints. :/ Please let me know if you know how to solve it!
Zathura and the plugins should be available in most official repositories. They’re at least available for Gentoo Linux, Arch Linux and Debian[1] with the same names:
zathura |
|
zathura-cb |
Comicbook support |
zathura-djvu |
DjVu support |
zathura-pdf-mupdf |
EPUB, PDF and XPS support based on MuPDF[1] |
zathura-pdf-poppler |
PDF support based on Poppler |
zathura-ps |
PostScript support |
I have also added a version history to make it easier to keep track of the changes to this post.
N
number of lines in the beginning or the end.$ echo "is an example" | sed 's/^/this /'
this is an example
$ echo "this is an" | sed 's/$/ example/'
this is an example
$ echo -e "1\n3" | sed '/1/a 2'
1
2
3
$ echo -e "1\n3" | sed '/3/i 2'
1
2
3
Add the words Example word
to the third line in a file:
$ sed -i '3iExample word' <file>
$ echo "one two three" | awk '{print $3}'
three
$ echo "one two three" | awk '{print $1$3}'
one three
You can add some spacing between the words like this:
$ echo "one two three" | awk '{print $1" "$3}'
one three
$ echo -e "one\ntwo\nthree" | sed -n 1p
one
$ sed -n 10,20p <file>
Or pipe it with a command:
$ cat <file> | sed -n 10,20p
If you want to print all lines but lines 10 to 20 replace p
with d
.
From an output:
$ echo -e "one\ntwo\nthree" | head -10
From a file:
$ head -10 <file>
From an output:
$ echo -e "one\ntwo\nthree" | tail -10
From a file:
$ tail -10 <file>
To reverse this replace p
with !p
.
$ echo -e "one\ntwo\nthree" | sed -n '/two/p'
two
$ echo -e "one\ntwo\nthree" | sed -n '/^one/p'
one
Same thing but with several words:
$ echo -e "one\ntwo\nthree" | sed -n '/^one\|^three/p'
one
three
To reverse this replace p
with !p
.
$ echo -e "one\ntwo\nthree" | sed -n '/one$/p'
one
three
Same thing but with several words:
$ echo -e "one\ntwo\nthree" | sed -n '/one$\|three/p'
one
three
$ echo "this is an example,string" | cut -d "," -f1
this is an example
$ echo "this is an example,string" | rev | cut -d "," -f1 | rev
string
The line will be the same width as your terminal.
printf "%`tput cols`s"|tr ' ' '-')
---------------------------------------[...]
$ cat $FILE | sed -n '/EXAMPLE_WORD_1/,/EXAMPLE_WORD_2/p'
$ echo "Example" | rev
elpmaxE
echo -n "Example" | head -c 3
Exa
echo -n "Example" | tail -c 3
ple
The flag -n
is to make sure that Bash doesn’t add a newline
at the end.
$ echo -e "example\nwords" | sed '0,/./s/./img/'
xample
words
$ echo -e "example\nwords" | sed '0,/./s/.$/img/'
exampl
words
$ echo -e "example\nwords" | sed 's/./img/'
xample
ords
$ echo -e "example\nwords" | sed 's/.$/img/'
exampl
word
$ sed -i 's/^[ \t]*/img/;s/[ \t]*$/img/' <file>
$ sed -i 's/#.*/img/' <file>
$ sed -i '/^$/d' <file>
In a file:
$ sed '/EXAMPLE_WORD/d' ./file.txt
In a output:
$ cat file.txt | sed '/EXAMPLE_WORD/d'
N
number of lines in the beginning or the end.Remove the last line at the end:
$ cat file.txt | head -n -1
Remove the first line at the top:
$ cat file.txt | tail -n +2
$ echo -e "one two four" | sed 's/four/three/'
one two three
$ echo -e "one two three three" | sed 's/three/four/2'
one two three four
$ echo -e "dog cat cat" | sed 's/cat/dog/g'
dog dog dog
$ sed -i '3 s/cat/dog/' <file>
$ sed -i '3-10 s/cat/dog/g' <file>
echo -e "1\n4\n3" | sed '/4/c 2'
1
2
3
$ sed -i 's/\t/ /g' <file>
$ echo "EXAMPLE Text" | awk '{print tolower($0)}'
example text
$ echo "Example text" | awk '{print toupper($0)}'
EXAMPLE TEXT
$ echo "example" | sed 's/.*/\l&/'
Example
$ echo "example" | sed 's/.*/\u&/'
Example
$ echo "ExamplE" | sed 's/.$/\l&/'
Example
$ echo "EXAMPLe" | sed 's/.$/\u&/'
Example
$ cat file.txt | wc -l
$ cat file.txt | wc -w
$ cat file.txt | wc -m
Alt
-key toggles the menu bar.
This is an issue for me because I use the Alt
-key as my modifier-key for my window manager i3. Which means that I constantly toggle the menu bar by mistake. And while the menu bar is visible the keybindings for Vim Vixen doesn’t work.
The solution to the issue is actually rather easy. I found the solution on r/firefox on Reddit here. What you neede to do is to simply toggle a value in Firefox.
Copy and paste this link into your adress bar in Firefox:
about:config?filter=ui.key.menuAccessKeyFocuses
Then set the value to false
by double-clicking on the string and you’re done.
cp
, mv
and rm
you don’t get a confirmation for your action. This can be a awfully bad thing if you happen to make a mistake like slipping on a key and accidentally deleting the wrong file. No ones want that.
There’s a pretty simple way to prevent an accident like that, and that’s using the flag -i, --interactive
with those commands. It will then ask for your confirmation every time you’re about to overwrite or delete files:
$ mv -i dog.txt cat.txt
mv: overwrite 'cat.txt'?
$ cp -i cat.txt dog.txt
cp: overwrite 'dog.txt'?
$ rm -i *
zsh: sure you want to delete all 2 files in /home/johan/test [yn]?
This flag has actually saved me a few times. I highly recommend adding aliases for them so you never forget to use the flags:
alias cp='cp -i'
alias mv='mv -i'
alias rm='mv -i'
By default, rm
will ask for confirmation for every single file, if you batch delete files and only want to confirm once, you can change the flag to a capital “i” like this: -I
. It will then only ask you when you remove three files or more and when you’re removing files and folders recursively.
Keeping yourself updated on all the possible security vulnerabilities for your packages isn’t an easy or fun task though. Thanks to the website Gentoo Linux Security Advisories (GLSA) that’s not an issue! All the security vulnerabilities and its solutions for Gentoo Linux gets published there for easy access.
And besides visiting the website itself, there’s also 3 optional and handy ways of easily staying informed about the news there; via a handy command-line tool, via e-mail and via two news feeds.
All the information mentioned below can be found on their website here: Stay informed – Gentoo Linux.
The tool glsa-check
comes bundled with the package app-portage/gentoolkit and it can check if any of your installed packages is affected:
$ glsa-check -t affected
This system is not affected by any of the listed GLSAs
It can do a few other things as well. To list all the available options just run glsa-check
without any arguments.
All advisories are posted to the gentoo-announce mailing list. You can subscribe by sending an emtpy e-mail to gentoo-announce+subscribe@lists.gentoo.org. A confirmation e-mail will be sent back to you and you need to reply to the message to complete the subscription.
They also offer two news feeds that you can subscribe to:
That’s why I looked for a plugin that could do this for me and after some looking arond I found buffer_autoclose.py.
It’s simple to use, you just install it and you’re done. But you migh want to change the default settings. By default it’s set to run every 60 seconds and to look for conversations that has been inactive for 30 minutes and close them.
To change the age on inactive buffers (I changed it to 1440 minutes which is 24 hours):
/set plugins.var.python.buffer_autoclose.age_limit <minutes>
This is how often it should check for old private buffers (I changed it to 60 minutes):
/set plugins.var.python.buffer_autoclose.interval <minutes>
And this is if you never want to close the buffers with someone special:
/set plugins.var.python.buffer_autoclose.ignore "Hund"
You install the script in WeeChat with the command:
/script install buffer_autoclose.py
Once installed WeeChat should automatically load it.
]]>Then there’s the syncing issue as well. I haven’t really found an application that I both like and that supports syncing with my phone in some easy and sane way.
So, one day I decided to try out the plaintext route. Plaintext is after all one of my favourite things in this world! After a little bit of tinkering I settled on the workflow of simply using my editor Vim and then Supercat, which works like cat
but supports colourised output via regular expression.
The command I use to view the document is $ spc -c <config> <document>
and I have put it in a small script for easy access:
#!/bin/bash
file="$HOME/Documents/todo.md"
spc="spc -c $HOME/.config/supercat/markdown"
case $1 in
ls)
echo ""
$spc $file
echo ""
;;
edit)
vim $file
;;
esac
My configuration for Supercat looks like this:
# spc configuration file
#
# col - color (blk, red, grn, yel, blu, mag, cya, whi)
#
# a - color attribute (console_code)
# ' ':normal (0)
# '-':normal (0)
# 'b':bold (1)
# 'u':underline (4)
# 'r':reverse-video (7)
# 'k':blink (5)
#
# n - number of matches, (' ':1, '1'-'9':1-9, '0':all)
#
# t - pattern type
# 'c':chars (strchr)
# 's':string (strstr)
# 't':regexp (regcomp) (convert 10-digit unix time to MMDDHHMMSS)
# 'r':regexp (regcomp)
# ' ':regexp (regcomp)
#
# col a n t pattern
#################### ### # # # ########################################
H1 yel 1 (^#\s.*$)
H2 mag 1 (^##\s.*$)
Prio High red 1 ##(\sHigh)
Prio Medium yel 1 ##(\sMedium)
Prio Low grn 1 ##(\sLow)
Numbered list item blu 1 ([0-9]\.)
List item blu 1 (^-)
List item blu 1 (^\*)
Highligt cya \*(.*?)\*
I then use Syncthing to sync the document with my phone and on my phone I use an application called Editor (which is available on F-droid here) to view and edit the document.
I have also added a shortcut on my home screen that opens the file directly in Editor for quick and easy access.
I understand that this might not be a good solution for all, but me personally like the simplicity of it. :)
]]>It’s a fairly simple and straight forward plugin manager that lets you install, uninstall, update and even search for plugins. Which is really all I can ask for.
You install a plugins by first adding a line (sometimes two or more) into your ~/.vimrc
file. Let’s say you want to install the plugin goyo.vim plugin. You then add this line to your configuration:
Plugin 'junegunn/goyo.vim'
You then either restart Vim or resource your configuration with :resource ~/.vimrc
and then execute the command:
:PluginInstall
And you’re done! Do note that some plugins might require a second plugin or so, make sure to always read the installation instructions for the plugin you’re trying to install.
If you deicide you don’t want the plugin, you then just delete or comment out the line you just added to your configuration and then run the command:
:PluginClean
Updating your plugins is just as easy as everything else, you just runt this command:
:PluginUpdate
You can also search for plugins with the command:
:PluginSearch <keyword>
Unfortunately you can’t see any information about the plugins from the search results. I never use the search feature myself, I just jump straight onto my search engine of choice to find what I’m looking for.
Spoiler: my search engine of choice is Searx.
Start by cloning the Vundle.vim
plugin to your Vim-folder:
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Then add this to your ~/.vimrc
file:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
<Add your future content regarding Vundle here>
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
Re-open or resource your configuration with :source ~/.vimrc
to apply the changes.
I don’t do advanced math myself, but if you like command-line tools and need to do math (advanced or not) this application should be something for you.
It features both a CLI and a simple TUI. The TUI looks like this:
$ calc
C-style arbitrary precision calculator (version 2.12.5.4)
Calc is open software. For license details type: help copyright
[Type "exit" to exit, or "help" for help.]
; 3 * (4 + 1)
15
; 3 * 19^43 - 1
29075426613099201338473141505176993450849249622191102976
; . % (2^127-1)
47385033654019111249345128555354223304
;
And the CLI looks about the same:
$ calc '3 * (4 + 1)'
15
Since I’m not into math I’m not going to talk about all the features, but you can read more about them on their webpage ‘What is Calc?’.
The package seems to be named calc
in most distributions, except for the Debian family where it’s named apcalc
.
I started out by creating the file /etc/systemd/system/i3lock.service
with the following content:
[Unit]
Description=Lock screen before suspend
Before=sleep.target
[Service]
User=johan
Type=forking
Environment=DISPLAY=:0
ExecStart=/home/johan/Scripts/i3lock.sh
[Install]
WantedBy=sleep.target
I then enabled the service with the command:
# systemctl enable i3lock.service
That’s it! And for those curious, this is what my i3lock.sh
looks like:
#!/bin/bash
icon="$HOME/.config/i3/lock.png"
img="$HOME/.cache/i3lock.png"
# Take a screenshot for our background
scrot $img
# Pixelate the background
convert $img -scale 10% -scale 1000% $img
# Add the lock-icon
convert $img $icon -gravity center -composite $img
# Finally run i3lock itself
i3lock -u -i $img
It will now lock my screen before it goes to sleep, so it’s locked when it wakes up again.
]]>After more than 6 years of service, my Steelseries Xai has now finally been retired. It has been slowly giving up on me for probably a year or so, with random disconnects and single clicks registering as double clicks getting more and more common.
Since I don’t use the mouse that much (basically only GIMP and Minecraft), cheap me had a hard time opening up the wallet for a new one. But after several months of research and a lot of hesitation caused by said cheapness, I finally bought the decently priced Logitech G305.
It’s as you can see a wireless mouse with a small footprint. It features the popular Hero sensor that’s supposedly perform good in games, but more importantly (at least for me) supposed to be energy efficient and they say that the battery will last for 9 month if you use the endurance mode instead of the gaming mode. With the gaming mode the battery should last about 250 hours, which is still good.
Even though I have large hands, I still prefer small and light mouses. This is both small (but not too small) and decently light with its 97 grams.
Speaking of weight, a positive thing with this mouse (and the only reason I even considered it in the first place) is that it supports regular sized AA-batteries, which is both easy and cheap to replace. I refuse to buy a mouse with a proprietary sized rechargeable battery that will go bad in a few years.
And if 97 grams is too heavy, you can make it about 7-8 grams lighter by buying a slightly more expensive lithium battery, which is also more durable.
The mouse buttons feels way more tactile than on my old Xai, but they’re also a bit louder. At first I found it annoying, but after just a few days of usage I stopped noticing it. The side buttons is a bit mushy though. I didn’t like them at all in the beginning, but now I’m used to them and it doesn’t bother me at all.
Overall I’m really happy with it and if you’re looking for a new mouse I would highly looking into this mouse. :)
]]>For a regular post you just use toot like this:
toot post "Example content."
But if you want to use newlines and quotes, you need echo the content with the flag -e
, which enables interpretation of backslash escapes.
You can then add a newline using \n
like this:
echo -e "First line\nSecond line" | toot post
And if you want to use a quotes, you just need to escape the characters like this:
echo -e "\"Example quote.\"" | toot post
I use it for my servers to notify me about various events that you would normally use something like sendmail for. Two examples is that rTorrent sends me message when it has finished downloading a new torrent, which is handy since it automatically downloads torrents from a local folder that I share via the network and I don’t always have the session with rTorrent open to check its progress.
The other example is that it send the regular reports from Logwatch via XMPP, which is something I used to do via sendmail.
And here’s how it works:
$ echo "Hello world" | /usr/bin/site_perl/sendxmpp --tls-ca-path="/etc/ssl/certs" -t hund@example.tld
$ echo "Hello world" | /usr/bin/sendxmpp --tls-ca-path="/etc/ssl/certs" -t hund@example.tld
I had issues with some Bash script when I didn’t specify the static path to be binary on both my Arch Linux and Debian machines, which is why I use the full path. I also had to use the flag --tls-ca-path="/etc/ssl/certs"
for it to work with TLS.
The script for rTorrent looks like this:
#!/bin/bash
echo -e "New torrent!\n\n$1" | /usr/bin/sendxmpp --tls-ca-path="/etc/ssl/certs" -t hund@example.tld
And in my $HOME/.rtorrent.rc
I added this:
method.set_key = event.download.finished,notify_xmpp,"execute2=/home/johan/Scripts/rtorrent-xmpp.sh,$d.name="
It’s available in the official repositories for Debian and Gentoo Linux as sendxmpp
and net-im/sendxmpp
. If you’re running Arch Linux you need to turn to the AUR; sendxmpp and sendxmpp-git.
The configuration file is $HOME/.sendxmpprc
and my configurations looks like this:
username: hund
jserver: example.tld:5222
component: example.tld
password: ***
And don’t forget to set some stricter permissions for the configuration:
$ chmod 600 ~/.sendxmpprc
That should be all. :)
A big thanks to vanad.is and the blog post “Send system cronjob output via XMPP”. It’s where I found out about this neat client.
]]>#!/bin/bash
title=$(curl -Ss $1 | grep -oE "<title>.*</title>" | sed 's/<title>/img/;s/- YouTube<\/title>/img/')
mpv $1 --ytdl --title "mpv -- $title"
I named it p.sh
and you call it with p.sh <url>
.
And since they allow you to launch an instances via the commandline, why not make it work with Rofi so I don’t have to launch the launcher itself and then choose which instance I want to play. :)
This script is a modified version of my script for VirtualBox, which I’m not the author of, I’m not sure where I found it either.
#!/bin/bash
path="/home/$( whoami )/.multimc"
handle_selection() {
if [[ $1 ]]; then
if [[ -d "$path/instances/$1" ]]; then
touch "$path/instances/$1"
notify-send "MultiMC" "Launching instance $1."
sh $path/MultiMC -l "$1" &
else
notify-send "MultiMC" "No instance called $1."
fi
fi
}
handle_selection "$( cd "$path/instances"; ls -t -d * | sed '/_MMC_TEMP/d;/instgroups.json/d' | rofi -font "xos4terminus 12" -m -0 -dmenu -i -p 'MultiMC' -hlbg '#5FA5D7' -bc '#5FA5D7' )"
I have the script in the folder $HOME/Scripts/rofi
and I launch the Rofi menu with all the scripts by calling this script using my window manager:
#!/bin/bash
cd $HOME/Scripts/rofi; menu=$(find -L . -printf '%P\n' | sort | tail -n +2 | rofi -font "xos4terminus 12" -m -0 -bw 3 -dmenu -i -p "Rofi Scripts: "); ./"${menu}"
# woeusb --target-filesystem NTFS --device windows.iso /dev/sdX
There’s also a graphical application for it available via the command woeusbgui
if you prefer using that.
It’s available via AUR as woeusb and woeusb-git.
It’s available via WebUpd8’s PPA.
]]>I always download the FLAC version and then converts it to OGG Vorbis myself since I like to keep the quality a bit higher than what’s really needed. And this is the reason for this post. :)
To convert FLAC music to the OGG Vorbis format you need the tool oggenc
, which is provided with the package vorbis-tools
. You can then convert any track with the command:
$ oggenc -q <N>
Where <N>
is the quality you want. If you want to convert a whole folder you can then combine it with find
like this:
$ find . -name "*flac" -exec oggenc -q 7 {} \;
The quality ranges in a scale from 1 to 10. It doesn’t use explicit bit rates in its quality settings like other common formats. Partly because they don’t think that you should only stare at the bit rate when measuring audio quality. And another reason for this is that OGG Vorbis uses a form of variable bit rate, where extra bits are used when the audio is harder to encode and less when the audio is simpler.
To put the scale into perspective. Quality 5
is near CD quality and quality 6
is enough for it to be perceived as lossless quality—unless you have an extraordinary audio setup. But if you’re that deep into the rabbit hole you’re probably not using anything less than CD’s or FLAC anyway. :)
ls
sorts all folders, symlinked folders and files by name and not by type and then by name, which I find quite annoying and sometimes even confusing.
Thankfully you can change this behavior pretty easy, you just need to add one small function to your zsh configuration:
dir1st() { [[ -d $REPLY ]] && REPLY=1-$REPLY || REPLY=2-$REPLY;}
Then call it like this:
ls -ldU -- *(o+dir1st)
And here’s an example image:
If you’re a Bash user and knows how to make this work there, let me know! I’m pretty sure there’s a lot of Bash users out there who would want this as well.
]]>Á
will be replaced with A
, an empty space with _
and it’s even smart enough to replace CGI escaped ASCII characters like %20
with _
.
Here’s a small example:
$ cd Pictues/Wallpapers/Space
$ detox --dry-run *
atlantis_nebula__7_by_starkiteckt-1080p.jpg -> atlantis_nebula_7_by_starkiteckt-1080p.jpg
cold_embrace___high_resolution___by_starkiteckt-db385qy.png -> cold_embrace_high_resolution_by_starkiteckt-db385qy.png
Hyper Cradle 1920x1080 HD.png -> Hyper_Cradle_1920x1080_HD.png
The defaults should be good enough for most, but there’s a lot of configuration options available and you can read all about them via the manual pages.
]]>After a couple of days of debugging I ended up installing Pulseaudio to see how that worked. It actually solved my issue pretty easily, even if it took some time to rebuild some of the packages in Gentoo. I went with the application ncpamixer to manage Pulseaudio, it’s a fairly simple mixer with a Ncurses user-interface.
And as bonus with Pulseaudio, I can now also control the sound per application. Which is something I never missed, but once I tried it it’s something I can’t live without anymore.
The default theme didn’t really look that good with my Solarized colour scheme, so I copied c0r73x’s theme and made my own version that looks a lot better.
# solarized theme {
"theme.solarized.default_indicator" = "■ "
"theme.solarized.bar_style.bg" = "■"
"theme.solarized.bar_style.fg" = "■"
"theme.solarized.bar_style.indicator" = "■"
"theme.solarized.bar_style.top" = ""
"theme.solarized.bar_style.bottom" = ""
"theme.solarized.bar_low.front" = 0
"theme.solarized.bar_low.back" = -1
"theme.solarized.bar_mid.front" = 0
"theme.solarized.bar_mid.back" = -1
"theme.solarized.bar_high.front" = 0
"theme.solarized.bar_high.back" = -1
"theme.solarized.volume_low" = 2
"theme.solarized.volume_mid" = 3
"theme.solarized.volume_high" = 1
"theme.solarized.volume_peak" = 1
"theme.solarized.volume_indicator" = -1
"theme.solarized.selected" = 3
"theme.solarized.default" = -1
"theme.solarized.border" = -1
"theme.solarized.dropdown.selected_text" = 0
"theme.solarized.dropdown.selected" = 6
"theme.solarized.dropdown.unselected" = -1
# }
You configuration gets automatically generated and populated when you first run it and you find the file here:
$HOME/.config/ncpamixer.conf
One thing to note though; by default you can quickly change the volume in larger steps with the number keys 1-9
(3
sets the volume to 30% et cetera), but only up to 90%, which is something I found a bit weird. The key after 9
on the number row is obviously 0
, which by default mutes the volume!?
And yes, the key m
also mutes the volume. So why do we need the 0
key to mute the volume as well? And why wouldn’t anyone want to quickly be able to set the volume to 100%? So, the first thing I did was to change the key 0
to set the volume to 100% instead:
"keycode.48" = "set_volume_100" # 0
It’s available in the AUR: https://aur.archlinux.org/packages/ncpamixer-git.
Official ebuilds is available here: https://github.com/fulhax/fulhax-overlay/tree/master/media-sound/ncpamixer.
]]>#!/bin/bash
handle_selection() {
if [[ $1 ]]; then
name=$(echo $1 | awk {'print $1'})
notify-send "Twitchy" "Launching the livestream with $name"
streamlink https://twitch.tv/$name --title "$name - Twitch"
else
exit 1
fi
}
handle_selection "$( twitchy --non-interactive | sort | awk -F, '{print $1 " - " $(NF-1) " [" $(NF-2) "] (" $(NF-0) ")"}' | rofi -font "xos4terminus 12" -m 0 -bw 3 -dmenu -i -p 'Twitchy' -hlbg '#5FA5D7' -bc '#5FA5D7' )"
I use this script to list my Rofi scripts in Rofi:
#!/bin/bash
cd $HOME/Scripts/rofi; menu=$(find -L . -printf '%P\n' | sort | tail -n +2 | rofi -font "xos4terminus 12" -m -0 -bw 3 -dmenu -i -p "Rofi Scripts: "); ./"${menu}"
And I have bound it to Alt
+Shift
+p
in i3:
bindsym $mod+shift+p exec "sh $HOME/Scripts/rofi-scripts.sh"
Create the folder ~/.config/mpv/scripts/
if you don’t already have it:
$ mkdir ~/.config/mpv/scripts/
Then download the script to that folder:
$ wget https://gist.githubusercontent.com/torque/9dbc69543118347d2e5f43239a7e609a/raw/bd9fcfe68a4f13b655c686e5790cbd2ee9489475/pause-indicator.lua -P ~/.config/mpv/scripts/
And that’s it. :)
I didn’t like the default colours, the size of the icon and the animation duration was a bit too quick for me so I changed it. There’s no configuration file, but changing the values is easy as long as you know which values it is.
Foreground colour
I changed the default value from FC799E
to E6E6E6
.
settings['pause-indicator-foreground-style'] = [[\c&HFC799E&]]
Background colour
I changed the default value from 2D2D2D
to 1111111
.
settings['pause-indicator-background-style'] = [[\c&H2D2D2D&]]
Animation duration
I changed the default value from 0.25
to 0.50
.
settings['animation-duration'] = 0.25
Icon size
I changed the default value from 1
to 2
.
settings['display-scale-factor'] = 1
And the result is what you can see in the image above.
]]>I’ve seen a lot of people use blurred and pixelated screenshots of their desktop and they do look pretty cool, so I decided to do the same thing myself. :)
I wrote a Bash script that uses scrot
and imagemagick
to take a screenshot of my desktop, pixelate the image, add the lock icon to it and lastly lock the screen using the newly created image.
#!/bin/bash
icon="$HOME/.config/i3/lock.png"
img="$HOME/.cache/i3lock.png"
scrot $img
# Pixelate image
convert $img -scale 10% -scale 1000% $img
# Blur image
#convert $img -blur 0x4 500% $img
convert $img $icon -gravity center -composite $img
i3lock -u -i $img
The lock icon I use can be found on the website Iconfinder.com here and I used the 256px version myself.
I also included the option to blur the image, which does look cool as well, but that operation is noticeably slower than pixelating the image.
]]>With tab completion you can list all the available commands which makes it pretty easy to figure out how to do things and what’s available to you. And fortunately a tab completion script for both Bash and zsh do exist, it’s called i3-completion and it looks something like this:
$ i3-msg <Tab>
[ exec kill nop restart swap
append_layout exit layout open scratchpad title_format
bar floating mark reload shmlog unmark
border focus mode rename split workspace
debuglog fullscreen move resize sticky
Clone the latest code from their git repository:
$ git clone https://github.com/cornerman/i3-completion
To add the script to either Bash or zsh you need to source it in you configuration (~/.bashrc
or ~/zshrc
):
source "<path to file>/i3_completion.sh"
And if you use zsh you also need to make sure to enable the usage of Bash scripts in zsh by adding this line before sourcing the script:
autoload bashcompinit && bashcompinit
Lastly save and reload your configuration:
Bash:
source ~/.bashrc
zsh:
source ~/.zshrc
And now you should have fancy tab completions for your i3 commands. :)
]]>On Gentoo Linux I needed to emerge a total of 42 packages for youtube-viewer, most are small, but still.. 42 packages. And I don’t even use 99% of the features anyway, I just want to be able to search and play videos without having to use YouTube’s hideously bloated and malicious website which tracks my every move.
Just recently, I found out about a super light and basic client called ytp via HexDSL on Mastodon. It’s written in Bash and the only dependency it needs is jq, which is a lightweight command-line JSON processor.
The only dependency you need to install is jq
and after that you can clone the repository with git, make the script executable and run it:
$ git clone https://gitlab.com/uoou/ytp
$ cd ytp && chmox +x ytp
$ ./ytp "<search word>"
And as always, I advise you to put the script in your $PATH
for easy access.
awk
and it’s in return a bit simpler.
:'<,'>%!awk '{print NR".",$0}'
It works by you selecting the lines with Ctrl+v
and then execute the command, it will then transform your list from this:
One
Two
Three
To this
1. One
2. Two
3. Three
And because I don’t want to manually type it every time, I decided to map it to \n
:
map \n :'<,'>%!awk '{print NR".",$0}'<CR>
Source: Stackoverflow
]]>:)
. And it’s not that emojis are all bad, it’s just that they’re not consistent across devices, sometimes not even across applications on the same device and some applications don’t even support emojis to begin with.
My terminal emulator (URxvt) supports most emojis, but they’re tiny and it can be /really/ difficult trying to figure out what they’re supposed to look like. Today when I was discussing emojis with a friend we got the brilliant idea that there has to be a script for WeeChat that converts emojis to plain text. And it sure does!
It’s called emoji2alias.py and it converts emojis to plain text snippets like :stuck_out_tongue:
. It’s based on the script emoji_aliases.py which lets you send emojis with aliases like :stuck_out_tongue:
.
You install the script in WeeChat with the command:
/script install emoji2alias.py
And if you like me don’t like getting messages with text like :stuck_out_tounge:
, then you can edit the script yourself and replace the text with :P
or whatever you prefer. Do note that any changes will be overwritten if you update the script, so I highly recommend that you make a copy of the script, give it a unique name and use that script instead.
Spell check is a nice feature to have when I do things like posting an update to Mastodon via the command-line client toot. But one annoying thing with it is that the syntax highlighting feature in Vim overrides the misspelled words, making it impossible to spot potentially misspelled words.
Vim with syntax highlighting enabled and disabled for the zsh buffer.
Thankfully there’s an easy way of automatically disabling the syntax highlighting feature in Vim when editing the zsh buffer, you just add one tiny line to your Vim configuration:
autocmd FileType zsh set syntax=off
Save and reload your configuration and you’re set.
]]>$EDITOR
of choice when needed can therefore be a real blessing.
To make it work you need to add these lines to your configuration file ~/.zshrc
:
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^I' edit-command-line
And don’t forget to set the $EDITOR
variable as well:
export EDITOR="vim"
I have it bound to Ctrl+I
to be consistent with how I open the $EDITOR
in qutebrowser, but you’re free to bind it to what makes sense for you. And if you use the Vi-mode in zsh like me it’s probably a good idea to bind a key for it in the normal
mode as well:
bindkey -M vicmd '^I' edit-command-line
Save your changes and source your configuration with the command source ~/.zshrc
or just restart the shell for it to take effect.
Thankfully it’s easy to disable the nicklist for specific buffers via the script toggle_nicklist.py.
Installing a script is easy in WeeChat:
/script install toggle_nicklist.py
You use the plugin with the command /toggle_nicklist <option>
. The options you have available is show
, hide
, toggle
, add
and remove
.
And to hide a nicklist for a certain buffer you just jump to the buffer and then run the command /toggle_nicklist add
. And don’t forget to save any changes with /save
when you’re done.
Apparently zsh has the capability of spell checking and auto correcting your misspelled commands. And this is how it looks in action:
$ mr superSecretDatabase.db
Correct mr to rm? [Yes, No, Abort, Edit] y
You enable the feature by adding setopt correct
to your config ~/.zshrc
and then resourcing your configuration with the command source ~/.zshrc
.
By default the options will be [nyae]
and not [Yes, No, Abort, Edit]
as shown in my example above. You can change this by adding the following line to your configuration:
export SPROMPT="Correct %R to %r? [Yes, No, Abort, Edit] "
Colours makes text easier to read and if you would like it to highlight the triggered word in red and the suggested word in green you can do so by adding this line to your configuration:
export SPROMPT="Correct $fg[red]%R$reset_color to $fg[green]%r$reset_color? [Yes, No, Abort, Edit] "
Just make sure that you have enabled colours in zsh with autoload -U colors && colors
for it to work.
It sometimes wants to correct completely fine commands for me, like command
to _command
. I don’t know what triggers it, but you can avoid it by creating an alias for said command:
alias <command>="nocorrect <command>"
Source: Refining Linux — ZSH Gem #4: Spell checking and auto correction
]]>--fullscreen
in my window manager i3, the client sometimes spawns on the wrong monitor. The reason for this behaviour is due to the fact that i3 doesn’t support the EMMH hint called “_NET_WM_FULLSCREEN_MONITORS”, which is something you can read more about on their issue tracker here.
But as a workaround for this issue I created a rule for mpv in i3 that only gets called when I run mpv with the flag --title mvpFullscreen
:
for_window [title="mpvFullscreen"] border none, floating toggle, move window to position 3840 0, resize set 1920 1080
The rule makes mpv float, removes the decoration, moves it to the upper left corner of my third monitor and then rezies it to the same size as my monitor. It’s a fake but instant and flawless looking fullscreen and I’m really happy with it.
]]><N>
days on the web, but you can’t as far as I know do it with only one command. And running rm -rf
in the shell without any confirmation feels a bit too risky as well. Because no matter how experienced you are, accidents do happen. :)
That’s why I wrote this little script that let’s you in a safe manner verify both the age and folder before actually doing anything. I named the script deleteOldFiles.sh
and it works by you first specifying the days followed by the path.
$ deleteOldFiles.sh 3 Nextcloud/tmp
These are the files and/or folders that will be deleted:
Nextcloud/tmp/2018-07-15-224841_628x482_scrot.png
Nextcloud/tmp/IMG_20180719_114053.jpg
Nextcloud/tmp/IMG_20180719_172601.jpg
Are you sure you want to continue? [y/n]
And here’s the script:
#!/bin/bash
set -e
set -u
files=$(find "$2" -mtime +"$1" -print)
printf "\nThese are the files and/or folders that will be deleted:\n\n"
printf "$files"
printf "\n\n"
read -p $'Are you sure you want to continue? [y/n] ' -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
find "$2" -mtime +"$1" -delete
echo -e '\nDone!'
else
echo -e '\nAborted!'
fi
I’m not a programmer in any way, so if you have any feedback about it (good or bad) let me know. :)
July 24, 2018
I got some feedback here and I was told that using the flag -delete
with find
is a better and more secure way of doing it. So I changed my script to use the -delete
flag as well as adding the feature that it now prints the files and/or folders that’s going to get deleted.
July 24, 2018
I got more feedback! And even a merge request with some further improvements to my script. Thanks! :)
]]>Unclutter is actually an old tool, and the latest version of it dates back to 1996, this is why the user Airblader (the person behind i3-gaps) decided to fork the project under the name unclutter-xfixes and bring it up to date.
But with that said, I’ve been using the old Unclutter until recently and I have never had any issues with it. So it should work just fine, but unclutter-xfixes is the recommended choice.
Using Unclutter/unclutter-xfixes is nothing more than running the command unclutter
. And if you check out the manual, you will find a few optional flags to tinker with, like the flag --timeout <n>
which changes the number of seconds after which the cursor should be hidden.
Unclutter is both available in the repositories for Arch Linux and Ubuntu as unclutter
:
Arch Linux:
# pacman -S unclutter
Ubuntu:
# apt install unclutter
Arch Linux:
unclutter-xfixes is available via the Arch User Repo as the package unclutter-xfixes-git.
Ubuntu:
If you’re using Ubuntu (or most likely any other Linux distribution) you then need to compile it yourself.
Start with installing the dependencies:
# apt install build-essential libev-dev libx11-dev libxfixes-dev libxi-dev pkg-config
And optionally you also might want to install the package asciidoc
if you want to include the manual. Do note that I needed to download more than 700MB worth of packages for that, which is why I only added it as a optional dependency. But it’s only needed when compiling the package, so it’s okay to uninstall it when you done compiling unclutter-xfixes.
And lastly, continue to download the source code and compile it:
$ git clone https://github.com/Airblader/unclutter-xfixes
$ cd unclutter-xfixes
$ make
# make install
This is where trash-cli comes into the picture. It’s a simple and straightforward command-line tool written in Python that works as a interface to the FreeDesktop.org trash. And instead of straight up deleting your files with the command rm
, you can use trash
to put them in your FreeDesktop.org trash and then recycle them at a later stage.
You put a file or folder in the trash with the command trash-put <file>
or just trash <file
. To list your trashed files you use the command trash-list
:
$ trash-list
2018-07-09 14:14:04 /home/johan/Unpack-4461
2018-07-09 14:13:46 /home/johan/rsync-bosco-2018-06-17.log
2018-07-09 14:13:17 /home/johan/lol_felt_bad.jpg
To restore a file or a folder you use the command trash-restore
followed by the corresponding number:
$ trash-restore
1 2018-07-09 14:14:04 /home/johan/Unpack-4461
2 2018-07-09 14:13:46 /home/johan/rsync-bosco-2018-06-17.log
3 2018-07-09 14:13:17 /home/johan/lol_felt_bad.jpg
What file to restore [0..3]: 3
If you wish to recycle all your trashed files you can do so with the command trash-empty
. Note that it’s also possible to only recycle files older than a specified value, for an example this example will only recycle files older than 30 days:
trash-empty 30
It’s available in both the official repositories for Arch Linux, Ubuntu and via the Python package manager pip with the name trash-cli
.
Arch Linux:
# pacman -S trash-cli
Ubuntu:
# apt install trash-cli
pip:
$ pip install trash-cli --user
And as a little bonus, it also works well with the e-mail clients Mutt and NeoMutt, which I will cover further down in this blog post.
It’s available in the official repositories as abook
in both Arch Linux and Ubuntu. I assume it’s the case for most other distros as well.
But if you want support for vCards (.csv) you need to patch and compile it yourself. If you choose to do so, jump to their download page and download the latest version.
Unpack the archive and cd
to the directory:
$ tar -zxvf abook-0.6.0pre2.tar.gz
$ cd abook-0.6.0pre2
Download the patch:
$ wget http://abook.sourceforge.net/patches/abook_vcard_import.patch
I’m not sure if this is needed for all, but I needed this patch for it to successfully compile on Arch Linux:
$ wget -O gcc5.patch https://git.archlinux.org/svntogit/packages.git/plain/trunk/gcc5.patch?h=packages/abook
And now apply the patches:
$ patch -p1 -i abook_vcard_import.patch
$ patch -p1 -i abook_vcard_import.patch
Lastly compile and install it:
$ ./configure
$ make
# make install
I’m using Arch Linux (with the binary from their repositories) and the flag --help
only mention this regarding a configuration:
-C --config <file> use an alternative configuration file
And the manual only mention this:
-C --config <filename>
Use an alternative configuration file (default is $HOME/.abook/abookrc).
But I did some digging and found the file /usr/share/man/man5/abookrc.5.gz
, which I extracted and found a manual with more information — including variables for the configuration. Why is this not the default manual? Anyway, I converted it to HTML and uploaded it here.
And this is what my configuration looks like:
# Automatically save database on exit
set autosave=true
# Show all email addresses in list
set show_all_emails=true
# frequently used values:
# -1 disabled
# phone Home Phone
# workphone Work Phone
# fax Fax
# mobile Mobile Phone
# nick Nickname/Alias
# url URL
# Command used to start mutt
set mutt_command=mutt
# Command used to print
set print_command=lpr
# Command used to start the web browser
set www_command=w3m
# address style [eu|us|uk]
set address_style=eu
# use ASCII characters only
set use_ascii_only=false
# Prevent double entry
set add_email_prevent_duplicates=false
# field to be used with "sort by field" command
set sort_field=nick
# show cursor in main display
set show_cursor=false
set index_format=" {name:30} {mobile:20} {workphone:20} {email:35}"
When you start abook
you get a menu on top hinting you about the three most common shortcuts; ?
for help, a
to add an entry and r
to remove an entry. The help shows you as expected all available commands:
? | help |
q | quit |
Q | quit without saving |
P | quit and output selected item(s) to stderr |
^L | refresh screen |
arrows / j,k | scroll list |
enter | view/edit item |
a | add item |
r / del | remove selected items |
M | merge selected items (into top one) |
D | duplicate item |
U | remove duplicates |
space | select item |
+ | select all |
- | unselect all |
* | invert selection |
w | write database to disk |
l | read database from disk |
C | clear whole database |
i | import database |
To import an adress book you use this syntax:
abook --convert --infile <file> --informat <input format> --outfile ~/.abook/addressbook --outformat <output format>
As an example, let’s import a vCart adress book:
abook --convert --infile example.csv --informat csv --outfile ~/.abook/addressbook --outformat abook
There’s also support for importing these two kinds of address books:
But I have no idea who uses those two?
For some reason it supports exporting to more formats than it can import. The website lists these as compatible formats:
Exporting an adress book works as expected in the same way as importing an adress book. In this example I’m exporting my adress book to a plain text file:
$ abook --convert --infile ~/.config/abook/addressbook --informat abook --outfile hund.text --outformat text
And the result is a plain text file looking like this:
-----------------------------------------
Hund's address book
-----------------------------------------
-----------------------------------------
Hund
hund@example.com
hund0b1.gitlab.io
-----------------------------------------
Katt
katt@example.com
Home Phone: 123 456 789
-----------------------------------------
As I previously mentioned, it’s possible to use Abook with Mutt, which is partly the reason I chose to go with Abook a long time ago.
For Abook to work with Mutt you need to add this part to your Mutt configuration:
set query_command = "abook --mutt-query '%s'"
macro generic,index,pager \ca "<shell-escape>abook<return>" "launch abook"
macro index,pager A "<pipe-message>abook --add-email<return>" "add the sender address to abook"
Now when you’re composing a new message you can either just <tab>
to bring out a list with all your contacts. It’s also possible to type some letters to filter out some results before tabbing.
And if you want to add a contact to Abook, you just use the key A
when you’re either reading the message or when it’s selected in the mailbox.
It’s straight forward, to set a timer you use the flag -t
and to set a countdown you use the flag -c
with the time like 1d2h3m
, 5m30s
or just 5m
:
$ utimer -c 5m30s
Time Remaining: 0 days 00:05:26.358 (326.358 seconds)
$ utimer -t 5m
Elapsed Time: 0 days 00:00:04.353 (4.353 seconds)
You can use the following in any combination for the timer and countdown:
d | days |
h | hours |
m | minutes |
s | seconds |
ms | milliseconds |
And to start a stopwatch:
$ utimer -s
Elapsed Time: 0 days 00:00:03.482 (3.482 seconds)
To stop the stopwatch you use the key q
. And for more information you can always consult the flag --help
.
If you have access to the Arch User Repo you can install it via there, the name of the package is utimer. But if you’re using something else you probably need to compile it yourself.
I tried compiling it in my virtual machine with Ubuntu 16.04, so I could verify the instructions and add them here, but it didn’t go as planned. When I ran ./configure
it complained about two packages:
checking for GLIB… configure: error: Package requirements (glib-2.0 >= 2.16.6 gobject-2.0) were not met:
No package ‘glib-2.0’ found No package ‘gobject-2.0’ found
I started with the first dependency by installing the package libglib-2.0-dev
using apt
:
# apt install libglib2.0-dev
[sudo] password for johan:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies.
libglib2.0-dev : Depends: libpcre3-dev (>= 1:8.31) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I have held broken packages? Let’s check them out:
$ apt-mark showhold
$
OK? Am I doing something wrong here or what? Anyway I also tried my luck with aptitude
:
# aptitude install libglib2.0-dev
The following NEW packages will be installed:
libglib2.0-bin{a} libglib2.0-dev libpcre3-dev{ab} libpcre32-3{a} zlib1g-dev{a}
0 packages upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,246 kB of archives. After unpacking 12.6 MB will be used.
The following packages have unmet dependencies:
libpcre3-dev : Depends: libpcre3 (= 2:8.38-3.1) but 2:8.41-1.1+ubuntu14.04.1+deb.sury.org+4 is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) libglib2.0-dev [Not Installed]
2) libpcre3-dev [Not Installed]
Accept this solution? [Y/n/q/?] y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
If anyone is reading this and is actually using Debian (or anything based on it) and knows how to fix this, please let me know via any of the links in the footer.
]]>This is where toot comes into the picture. toot is a Mastodon client for the command-line interface and it’s packed with a lot of features that bitlbee-mastodon doesn’t have.
The command toot
will list all the commands available for you:
$ toot
toot - a Mastodon CLI client
v0.18.0
Authentication:
toot login Log in from the console, does NOT support two factor authentication
toot login_browser Log in using your browser, supports regular and two factor authentication
toot activate Switch between logged in accounts.
toot logout Log out, delete stored access keys
toot auth Show logged in accounts and instances
Read:
toot whoami Display logged in user details
toot whois Display account details
toot instance Display instance details
toot search Search for users or hashtags
toot timeline Show recent items in your public timeline
toot curses An experimental timeline app (doesn't work on Windows)
Post:
toot post Post a status text to your timeline
toot upload Upload an image or video file
Accounts:
toot follow Follow an account
toot unfollow Unfollow an account
toot mute Mute an account
toot unmute Unmute an account
toot block Block an account
toot unblock Unblock an account
To get help for each command run:
toot <command> --help
It’s fairly straight forward and if you want to know more about a specific command you can show more information by passing the flag --help
:
$ toot post --help
usage: toot post [-h] [-m MEDIA] [-v VISIBILITY] [--no-color] [--debug]
[-u USING]
[text]
Post a status text to your timeline
positional arguments:
text The status text to post.
optional arguments:
-h, --help show this help message and exit
-m MEDIA, --media MEDIA
path to the media file to attach
-v VISIBILITY, --visibility VISIBILITY
post visibility, one of: public, unlisted, private,
direct
--no-color don't use ANSI colors in output
--debug show debug log in console
-u USING, --using USING
the account to use, overrides active account
https://github.com/ihabunek/toot
Here’s an example of what it looks like when you show your timelime:
$ toot timeline
───────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────
F-Droid │ Aurora Store: Download apks from #GooglePlayStore#AuroraStore is a #fork of
@fdroidorg │ #YalpStore by Sergey Yeriomin. It lets you download apps directly from Google
2018-06-17 10:29 │ Play Store as #apk files. It can search for #updates of installed #apps and lets
Reblogged @Aznorth │ you search for other apps.Aurora Store provides a #MaterialUI to #Yalp
│ #Store.https://f-droid.org/app/com.dragons.aurora#fdroidorg #fdroid #libre #app
│ @fdroidorg #altenative
───────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────
F-Droid │ This weeks #twif is live:
@fdroidorg │ https://f-droid.org/en/2018/06/14/this-week-in-fdroid-w24.htmlEnjoy!
2018-06-17 08:23 │
───────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────
If you want to list the public timeline just add the flag --public
and to list the timeline for you instance only you add the flags --public --local
.
And here’s what it looks like when you do a search and look up a profile:
$ toot search pixelfed
Accounts:
* @pixelfed@mastodon.social PixelFed
Hashtags:
#pixelfed, #pixelfedlogo, #pixelfed_replaces_instagaram, #pixelfed_replaces_instagram
$ toot whois @pixelfed@mastodon.social
@pixelfed@mastodon.social PixelFed
Federated Image Sharing powered by ActivityPub.Created by @dansupPress
Inquiries: hello@pixelfed.org
ID: 50992
Since: 2018-05-17 @ 21:27:57
Followers: 1239
Following: 0
Statuses: 249
https://mastodon.social/@pixelfed
And why not follow them so we can monitor the progress of the awesome project PixelFed? :)
$ toot follow @pixelfed@mastodon.social
✓ You are now following @pixelfed@mastodon.social
That’s about it. toot is a great little tool if you prefer doing things in the shell like me.
You need the dependencies python-requests
, python-beautifulsoup4
and the make dependency python-setuptools
. You can then download the latest version of toot on GitHub here.
Unpack the archive and simply install it with the command python setup.py install
.
Before you can use toot you need to add your account(s). You can do so by running the command toot login
or toot login_browser
if you’re using two factor authentication, you will be then directed to your Mastodon instance via your web browser and then asked to authorize toot.
toot supports multiple accounts at the same time, you just have to repeat what you just did for your other instance and you can then view your logged in accounts with the command toot auth
. The active account will have the flag ACTIVE
next to it. You can then use the command toot activate
to switch between your accounts, or just use the flag --using
in combination with your command to use an account temporarily.
If you wish to delete your access token you can do so by logging out using the command toot logout
.
For this I like to use the application StreamCurse, which is a Ncurses frontend to Streamlink, a CLI-tool that lets you extract livestreams from various services and play them via your media player of choice, mine happens to be mpv.
What StreamCurse does is that it lets you collect all your favourite livestreams from various services in one place and it will then keep you updated about the livestreams that’s currently broadcasting. The nice thing with this solution is that I can fully avoid bloated and/or sites that tracks you, like Twitch and YouTube. I also don’t need an account to follow anyone and don’t even have to leave the safety of my own desktop. :)
The interface is fairly straight forward, it uses a Vi-like navigation with few and simple keybindings, I have listed some of the more common ones down below:
a | Add stream |
d | Delete stream |
Enter | Start stream |
r | Change stream resolution |
n | Change stream name |
u | Change stream URL |
? | List all shortcuts |
You can set a default resolution for all new streams, but it’s also possible to change the resolution per stream with the key r
. This is something I currently have to do for livestreams from YouTube due to the streams at 1080p/60FPS is using DASH, which is not yet supported and as a workaround I have limited the resolution to 1080p/30FPS for those streams.
The package streamlink
is available in the repositories for both Gentoo Linux and Arch Linux. It’s as far as I know not available in Ubuntu, but since it’s just a regular Python application you can install it via pip
:
pip install streamlink --user
To install streamcurse
you need to download the source code from the git repository and manually install it yourself:
$ git clone https://github.com/RadicalEd360/streamcurse
$ cd streamcurse
# python3 setup.py install
You can start adding streams right away, but if you do have a Twitch-account you can choose to sync all the channels you follow with the keybinding w
followed by your username.
The configuration can be found in the folder $CONFIG/streamcurse
, if you want to change any settings like the colors or permanently adding your Twitch-username.
And when I say it’s fast I really mean it! Loading huge with a file size at 50 MB takes 1-2 seconds on my 8 year old computer, while regular sized are instant.
The website lists these features:
The second point is one of the few things I dislike with the suckles-philosophy though. They don’t use configuration files, which means that if you want to change any of the settings you need to edit the source code. It’s for the most part straight forward, but it also means that you need to download the source and compile it yourself. I would prefer if I could just create a configuration file in my folder $CONFIG
, that I can also easily share with my friends and/or across my own computers with my other dotfiles. With that said, it’s still a great image viewer and you’re most likely not going to need to change any of the settings anyway.
To use sxiv you either open an image directly with sxiv <file>
or by open a folder in thumbnail mode: xsiv -tr <folder>
or xsiv -tr {<folder>,<second folder>}
for multiple folders. The flag -r
tells it to search the given directory (or directories) recursively for to view and the flag -t
tells it to start in thumbnail mode.
There’s a lot of shortcuts for sxiv – but they’re all listed in the man page for sxiv – so I’m only going to mention the most common ones to get you started:
n |
Go to the next image. |
p |
Go to the previous image. |
g |
Jump to the first image. |
G |
Jump to the last image |
f |
Toggle fullscreen mode. |
b |
Toggle the bar. |
+ |
Zoom in. |
- |
Zoom out. |
e |
Fit image to the window width. |
E |
Fit image to the window height. |
q |
Exit sxiv. |
For it to show the image size and file size you need to install the packages exiv2
and imagemagick
, then create the file ~/.config/sxiv/exec/image-info
with this content:
#!/bin/sh
# Example for ~/.config/sxiv/exec/image-info
# Called by sxiv(1) whenever an image gets loaded,
# with the name of the image file as its first argument.
# The output is displayed in sxiv's status bar.
s=" | " # field separator
filename=$(basename "$1")
filesize=$(du -Hh "$1" | cut -f 1)
# The '[0]' stands for the first frame of a multi-frame file, e.g. gif.
geometry=$(identify -format '%wx%h' "$1[0]")
tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }')
tags=${tags%,}
echo "${filesize}${s}${geometry}${tags:+$s}${tags}${s}${filename}"
Source: ArchWiki.
It’s also possible to add shortcuts to sxiv that let’s you execute any shell command you like. Let’s start with creating the file `$CONFIG/.sxiv/exec/key-handler and adding this example content to it:
#!/bin/sh
while read file
do
case "$1" in
"C-u")
exiftool -all= "$file" && shareLinkCreator "$file" ;;
"C-w")
feh --bg-fill "$file" ;;
"C-d")
trash-put "$file" ;;
esac
done
This is the shortcuts I use and it works by first pressing Ctrl+x
and then the shortcut, like Ctrl+d
to move the selected file to my trash.
It’s available via pip:
$ pip install markdown2 --user
To convert a document you simply use the command:
$ markdown2 input_file.md > output_file.html
But if you use tables in your document it will not render them correctly unless you add the flag -x tables
:
$ markdown2 input.md > output.html -x tables
The default styling of tables is bad as you can see in this before and after picture:
The styling I added was this:
<style>
table { border-collapse: collapse; width:100%; }
td, th { border: 1px solid #ddd; padding: 8px; }
tr:nth-child(even){background-color: #f2f2f2;}
tr:hover {background-color: #ddd;}
th { padding-top: 12px; padding-bottom: 12px; background-color: #ddd; }
</style>
But manually adding that to every document with tables isn’t going to be fun, so I wrote a simple script called md2html.sh
to do it for me:
#!/bin/sh
markdown2 $1 > $2 -x tables
sed -i '1 i\<style>table { border-collapse: collapse; width:100%; } td, th { border: 1px solid #ddd; padding: 8px; } tr:nth-child(even){background-color: #f2f2f2;} tr:hover {background-color: #ddd;} th { padding-top: 12px; padding-bottom: 12px; background-color: #ddd; }</style>' $2
And to use it:
$ md2html.py input.md output.html
If I want to convert it to a PDF-document I just print it to a PDF-document via my web browser, which saves me from installing additional packages for something that I rarely ever use anyway.
]]>Size: | 60% |
Case: | Diamond, KBDfans |
PCB: | S60-X, Sentraq |
Switches: | Tealios, ZealPC |
Springs: | SPRiT Edition (60g), SPRiT |
Keycaps: | PBT Blanks, NPKC |
Artisan: | Cherry Blank, SKD Cables |
I enjoyed building it and the soldering job turned out pretty good for being a self-taught first timer. And I really liked having a split keyboard, but the ortholinear layout is not for me. :)
Size: | 40% |
Case: | Let’s Split, Smashing Acrylic [Website] |
PCB: | Let’s Split, Smashing Acrylic [Website] |
Switches: | Gateron Yellow |
Keycaps: | NPKC PBT blanks |
It’s also rocking a custom controller called The Pegasus Hoof, which makes it fully programmable via the open source TMK firmware. This adds a lot of neat features like layers and macros.
Brand: | Filco |
Model: | Majestouch 2 |
Size: | TKL / 80% |
Switches: | Cherry MX Red |
Keycaps: | NPKC PBT blanks |
Cable: | Custom, PexonPCs [Website] |
Brand: | KBParadise |
Model: | V60 |
Size: | 60% |
Switches: | Gateron Red |
Keycaps: | NPKC PBT blanks |
Artisan: | Idea23 [Website] |
Cable: | Custom, PexonPCs [Website] |