This repository has been archived on 2024-01-22. You can view files and clone it, but cannot push or open issues or pull requests.
speedie-page/articles/My workflow.md

440 lines
22 KiB
Markdown

Woah, is that an upgraded blog? **Yes.**
First I want to mention that blog posts are now being written in Markdown and
converted to HTML and RSS feeds on the fly by a PHP script I hacked together.
Formatting in the RSS feeds should be a lot nicer now, and I don't have to
do anything beyond write the Markdown and put the file in the `articles/`
directory. But that's the reason you now once again have duplicate blog posts.
I apologize for that.
![My system](/articles/img/system.jpg)
Today I want to talk about something a little different. I've talked about the
software I use in the past, but not really my system as a whole. If you've used
[spde](https://git.speedie.site/speedie/spde) in the past, you're already familiar
with it because it sets up a system nearly identical to mine, except it doesn't have
any of my files on it.
I apologize in advance for the ridiculous length of this blog post,
I know it's long, but I wanted to go into detail about absolutely
everything. Despite the long length of this blog post though,
I still have not said everything I have to say. Insane, I know.
I do not expect that you read all of this, but I want to truly
document why I do what I do.
Regardless, I thought I'd write about my workflow, to hopefully
give you some ideas on how you could potentially improve yours. Or at the very least,
you could point out the flaws in my workflow so I can improve mine.
## Goals
These are the goals for my workflow. If possible, everything I use should be
designed around these goals. They are:
- Use the mouse as little as possible.
- Some applications like the web browser just suck by design. In those cases I
don't make any attempt to fix it.
- Use text as much as possible, because then I can use Vim which doesn't use the
mouse.
- Get stuff done as quickly as possible. I need to be able to write code,
text and documents quickly. The quicker the better.
- Some, but not too much eyecandy.
- Ideally written in C/C++ or shell script as well. But that's just because
it's what I'm most familiar with, and I like being able to fix bugs in programs
I use by myself. Of course, I would still use a good program even if it wasn't
written in a language I know.
## The computer
My operating system that I *actually* use is running on top of an Arch system in
a QEMU virtual machine. Both the host system and the guest system have full disk
encryption, as I believe this should be a standard. The reason I use a virtual
machine for the actual work is because it allows me to only pass through *some*
USB devices or *some* PCIe devices. It also allows me to quickly test different
configurations or operating systems, and allows me to quickly back up and restore
my system. I still have copies of my Gentoo system that I could restore right now.
This is close to time travel as it gets. Awesome.
The system isn't too special, it's a box with a Intel Core i9 10900, 16 GB of DDR4
RAM, an AMD Radeon RX 570 and 580. The reason I have two graphics cards is so I can
leave one to the host. If I need two virtual machines to both have decent graphics
I can leave the integrated graphics to the host and pass through the two GPUs.
These GPUs are quite old now, but I don't play any games on my computer or do any
graphically demanding work, so they are fine.
## Operating system
I use Arch Linux on both my laptop and desktop computer. I'm using a GNU/Linux distro
because I value freedom and privacy, but also because it is impossible to
achieve a good workflow on proprietary operating systems like Windows and macOS.
As for why I choose to use Arch, it gets updates often because it's a rolling release,
PKGBUILDs (the format for building pacman packages) are very nice to work with for
those who are familiar with shell scripting, and even if you're not into writing
your own packages, there's the AUR (Arch User Repository) that users can push and
pull from if the package you need isn't available in the main repositories.
While I could probably go with something like Parabola GNU/Linux-libre, my hardware
does not fully support it, unfortunately.
## Window manager
I use a standalone window manager (more specifically a dynamic tiling window manager)
because allow you to move your windows without using the mouse. The reason
I don't use a desktop environment is because a desktop environment comes with
all the programs I'm going to mention set up for you. Most of these programs
are not designed with the goals I have in mind though, so I would be getting
a lot of programs I don't want to use. A window manager as the name implies only
manages the windows, and it is up to me to find other programs that do other things
I need to do.
Also, this applies to tiling window managers specifically, but instead of placing
windows on top of each other, when using a tiling window manager you **always**
have access to every window. This makes a massive difference if you have many
windows open all the time. Instead of wasting several seconds snapping windows
to the corners of the screen, why not have your window manager automatically
split the screen for you?
The window manager I have chosen is as you guys probably know by now,
[dwm](https://dwm.suckless.org) because it's fast and allows plenty of customization
because everything is done in the C programming language. Basic customization
is easy even with no C knowledge, and patches can be applied to add extra
functionality. If you *do* happen to know C, you can implement a lot of
features you want yourself and submit patches to suckless, and if you don't
know C it's a great opportunity to learn more about C. This technically makes
dwm **the** most feature rich window manager, AND the most minimal window manager.
Very cool.
The best part is because you're forking the dwm window manager, you have
the power to do anything you want. suckless can't randomly decide one day that
they want to remove a feature that you depend on, or randomly break the project.
If your dwm build breaks, it's your fault, because no one else is (presumably)
working on it.
If you do not want to patch together a dwm build yourself, you can get
[mine here.](https://git.speedie.site/speedie/speedwm)
## Terminal
Most of the programs that I use are terminal applications. Therefore, the terminal
emulator is an essential part of my setup. For the same reasons I chose dwm
as my window manager, I've chosen [st](https://st.suckless.org) as my
terminal emulator of choice. I'd argue st (which stands for simple terminal) has
the most features out of any terminal, and most potential for customization
and new features. While st by default has many fewer features than xterm,
my fork of st for instance has transparency, sixel graphics, clickable URLs,
scrollback, keyboard select, ligatures, proper underlines, multi font support,
wide glyph support, and more.
While there are terminals that offer these features separately, I have yet to
find one that offer all of the above. While st doesn't have all of these out of
the box, all of them can be combined into your st fork by using patches. The one
notable feature st is missing that some terminal emulators like Alacritty offer
is GPU accelerated buffers. But in most cases, this just isn't necessary or noticeable.
This was partially taken from [Luke's build of st](https://github.com/Lukesmithxyz/st)
but if I press Ctrl+Shift+c I get a spmenu list of commands I've ran, and if I select
one it will copy the output of that command. It will **not** run the command
again, it will parse the terminal buffer and copy the output text to my clipboard.
Once again, if you do not want to patch together an st build yourself, you can get
[mine here.](https://git.speedie.site/speedie/st)
## File manager
For simple tasks like moving a single file to a different place, I will
usually just use core utilities like `cp` to copy files around. But for more
complicated tasks, I will use a program called `vifm`. Vifm is a terminal file
manager, but I'm not using it because it's a terminal program. I'm using it because
it's incredibly efficient. It has Vi-style keybinds, doesn't use the mouse, supports
previewing PDFs, images, documents, music cover art and more using `vifmrun` and
ueberzugpp. It's excellent, and I have yet to find a graphical file manager anywhere
near as efficient.
If you're used to Vim, it will take almost no time to learn it. `dd` deletes a line
in Vim, so naturally `dd` deletes a file or directory in Vifm. `cw` changes a
word in Vim, so in Vifm is renames a file or directory. `yy` copies (yanks)
a line in Vim, so in Vifm it copies a file or directory. It has two panes, one of
which can be used as either a preview pane, or a second pane, allowing you to
for example quickly copy between one directory and another. Speaking of Vim..
## Text editor
The text editor I use should come as no surprise to anyone who has been following
my blog for a while. If there is one skill I want every single person on the planet
to learn it is the Vim text editor. Vim is the most important program in my workflow,
and if I could only have one of the programs I mentioned in the blog post, it would
definitely be Vim. Actually, more specifically Neovim. Neovim is just a fork of Vim
which is more community oriented that also adds Lua scripting support and supports
the XDG standard.
The reason you should use Vim is because it doesn't use the mouse for anything.
While it is possible to use the mouse if you go out of your way to enable it, Vim
is designed to be operated using exclusively the keyboard. Tasks that take a long
time with a standard text editor, such as indenting thousands of lines, replacing
complicated text becomes tasks that can be performed in seconds. And seemingly
simple tasks like moving around in a file can be performed significantly faster
with Vim. The mouse is no longer holding you back.
While it is true that it can have a steep learning curve, once you've actually
learned it, you will regret not having learned it earlier. Vim changes the way
you see and use programs, it changes the way you believe programs should be
designed. It's incredible. The "steep learning curve" isn't as bad though,
when you consider the fact that you can still use arrow keys when you begin
and the mouse to move between lines. So if you're coming from a simple text
editor you don't have to learn all of Vim's quirks all at once. You can
(and will) gradually learn it. You start with arrow keys, then start using
`hjkl` for movement and other basic keys like `g` and `G`
Vim is already an upgrade from your standard text editor out of the box, but if you
want the text editor of your dreams, one that can match your IDE or at the very least
edit text at the speed of light, you can bind keys in your configuration. The ones
that changed my life are:
`nnoremap <C-h> <C-w>h`
`nnoremap <C-j> <C-w>j`
`nnoremap <C-k> <C-w>k`
`nnoremap <C-l> <C-w>l`
`nnoremap H :vertical resize +10<cr>`
`nnoremap J :resize -10<cr>`
`nnoremap K :resize +10<cr>`
`nnoremap L :vertical resize -10<cr>`
If you can't tell already, these allow you to split your Vim window into
different sections using keybinds and resize those sections. If you want
a more proper IDE, you can use Vim plugins, which add functionality to it.
One of the most important plugins I use is
[Ctrlp](https://github.com/ctrlpvim/ctrlp.vim) which allows you to quickly
open files recursively in your current working directory. I usually bind
this to `Ctrl+F` but you can bind it to anything you want.
If you have a true color terminal (which you do if you use the aforementioned
st) you have basically unlimited possibilities for customization. While images
are a bit tricky, they can certainly be done.
Again, if you don't feel like doing all that configuration, you can get
my configuration for Neovim [here](https://git.speedie.site/speedie/speedie-nvim).
## Music player
I like music, and I don't like music players that suck. Most of them suck, unfortunately.
cmus is pretty nice though. It's fast and light, primarily because it's written
in C and is a terminal application. While it's not entirely like Vim, it uses
commands for navigation, supports playlists, metadata, and more. Pretty much
all the basic media player functionality you could imagine. I've also heard
of people using Ueberzug or similar to display the cover art inside cmus, but that
isn't something I've tried yet.
You can control it without having the main program open using `cmus-remote`.
Not only can you do basic media control with it such as next and previous track,
pause, shuffle, repeat, etc. but you can also use it to query information about
the playing track and cmus
itself. This is useful in shell scripts, and I'm using this with my conky config
to display the metadata and cover art for the playing track, and I'm also using
it with my status bar. This is really nice.
I've tried and used other music players in the past, such as Musique, moc,
musikcube, but all of them lack features I need. I still use musikcube occasionally,
because it has a really nice feature. You can run musikcube on the computer that
contains your music and other computers on your network can connect to it.
You can even use a web server like Apache with it if you want.
Either way, there isn't that much to say about cmus, it's just excellent, and
doesn't really require any configuration whatsoever. You just start it, add
a music directory using `:add ~/Music`, update metadata using `:update-cache`
and play your music.
## Email
For email client, I use another terminal application called `neomutt`. It
doesn't have Vi-style keybinds by default, but it can be customized significantly.
In this case though, I haven't bothered and instead I simply use a script
by Luke Smith called [mutt wizard](https://github.com/LukeSmithxyz/mutt-wizard).
This script is very nice because it sets up mutt with appropriate inboxes,
downloads all the mail for you, sets up syncing and sets up neomutt with a sane
config for people who like Vi-style keybinds.
Most email clients are terrible, and they usually take a very long time to open
when all you want to do is see your email. With neomutt and mutt wizard however,
because it downloads all the mail you don't need to be connected to the internet
to see your emails, and all emails you've sent and received are stored locally on
your computer, it opens instantly and you can instantly search through and delete
your emails. It doesn't download any mail unless you request it to, or set up a
cronjob to do it. I can't believe this is a core feature of most email clients.
Mutt wizard rocks, and I have yet to find anything that comes even close in terms
of user experience.
Of course, if you don't want to use Luke's script, you can definitely go and
configure neomutt yourself. In fact I did this in the past. But for an ideal
setup you need other programs along with it, and it's a lot to manage and set up.
Luke's setup works perfectly for me, so all I do is install mutt wizard, log in
and everything is ready to go and I can start syncing my emails.
## RSS
I use RSS for media consumption, and this is for several reasons. RSS gives you
what you want, and ONLY what you want. Nothing else. Most sites that people
use like YouTube, Reddit and Twitter offer RSS feeds that you can use to get
media. Odysee recently added RSS feeds as well, which is very nice. In fact,
you might be reading this very blog post in an RSS reader.
Either way, I use a program called newsboat as my RSS reader. While it is a
bit bloated in terms of dependencies, it gets the job done, and it is quite
scriptable. It is also very easy to get into, you just add a few lines to
`~/.config/newsboat/config` and add your feeds to `~/.config/newsboat/urls`
and you're ready to go. Very nice.
I also use some scripts along with newsboat, that I can use to open, for
example videos in mpv, or other links in my web browser. I also have
a script to download videos using `yt-dlp` so I can watch them later
locally without an internet connection.
My newsboat configuration can be found
[here](https://git.speedie.site/speedie/dotfiles) if you don't want to
deal with any of the configuration yourself. Keep in mind it doesn't
come with any urls file though.
## Image viewer
For viewing images, I use a program called `nsxiv`. It is a fork of the
older `sxiv` image viewer. Not too much to say here, but nsxiv is a very
scriptable image viewer. It can handle pretty much all types of images
you can imagine, it loads them in and displays them quickly.
It is controlled primarily using keybinds. It has pretty much all the features
you expect out of an image viewer, but also more specific features such
as the `-o` flag, which will output the path to the
images you mark. You can mark an image using the `m` key. This is a super
useful feature.
## Media player
For media playback, I use mpv. I've used VLC in the past, and while that's
an okay player, it is a bit too bloated for me, and I don't really like
the QT look it has. mpv is controlled primarily using keybinds, but can
also be used with the mouse if all you need is basic features.
mpv has some pretty cool features though, such as YouTube playback using
`youtube-dl`. The nice thing about this is that there are plugins like
sponsorblock which as the name implies will skip sponsor segments in
YouTube videos. I would like to see VLC do this.
There are other nice scripts for mpv like downloading lyrics for
music and displaying it and I think you can even get a script which
streams from a piracy site if that's something you are into.
Either way, mpv is excellent and almost perfect, from the way they
treat their users on Twitter, to the playback, to the possible
customization.
## Bluetooth, Wifi, Wallpapers, and more
One interesting thing about my setup is that I use scripts for a lot
of things. There is far too much to note here, so I will dedicate this
section to the different scripts I use.
For bluetooth, I've written a script that uses
[spmenu](https://spmenu.speedie.site) which interacts with the command
line program `bluetoothctl`. While you can do this using a GUI program
like blueman, this is incredibly fast. I just press `Ctrl+Super+Shift+b`
and it will automatically scan for devices to connect to. Most people
probably won't even have their bluetooth manager open when I'm already
connected to the device.
Same goes for wifi, but here the script is a wrapper for `iwctl`, part
of the `iwd` package.
For wallpapers, I'm once again using spmenu. I have a script that lists
out my wallpapers and allows me to pick one. It also previews the images
right there, no need for any external image viewers or anything.
And when I choose a wallpaper, I have that work alongside my browser
start page and window manager. When I select a wallpaper, the function
in my config will use Pywal to get colors from that image and theme my
terminal, status bar, web browser and web browser start page accordingly.
And when my terminal emulator is themed, all TUI programs will
be colored as well.
I have a lot more of these scripts, it never ends. I use similar spmenu
scripts for clipboard management, password management, screen recording,
taking screenshots and more. Scripts are incredibly
useful.
## Run launcher and bookmarking
For run launcher, I use spmenu_run. It handles both .desktop entries,
traditional $PATH binaries, and even basic file management. Funnily
enough, if you use spmenu_run on GNOME and plug in a device like a
USB flash drive, it will actually ask if you want to open it in
spmenu_run.
Bookmarking is also done using spmenu_run. If I type in `@` I can
get a list of bookmarks I've added, and I select one it will copy
the link to the clipboard. (or run any other command I want it to)
I will add entries using
`@Cool link:echo https://cool.com | xclip -sel clipboard`. I find
this more useful than regular bookmarks because I can run any
command I want, not just copy links to my clipboard. It's incredibly
versatile and customizable. I should note that I will still
occasionally use my browser's built in bookmarking though.
## Web browser
I won't go too much into detail, but the web browser I use is Ungoogled
Chromium. I've chosen this web browser because although the codebase is
anything but minimal, it has a clean user interface, can be themed with
the rest of my system, runs very quickly on both new and old systems,
respects your privacy, and can be extended using extensions.
I don't use that many extensions. I use uBlock Origin because an ad
blocker is essential if you want to use the modern web. There's just
no way around it. I also use Vimium, which adds basic Vim motions to
Chromium, and notably the `f` (follow) functionality. This
was taken from Qutebrowser and allows you to navigate web pages
exclusively using the keyboard. I usually use JShelter as well, which
prevents some, but not all fingerprinting and other malicious things
websites like to do. It's not perfect, something like GNU IceCat would
be a LOT better for security, but this is good enough for me.
If you want to read more about why I like Ungoogled Chromium, check
out my article titled
[Ungoogled Chromium - The best browser for most people](https://speedie.site/blog/Ungoogled+Chromium+-+The+best+browser+for+most+people).
## PDFs
For reading PDFs, I use Zathura. The reason I use it as my PDF reader
is because it opens instantly, has Vi-style keybinds, and supports
everything a basic reader should, such as printing. Zathura can
be themed, and so can the documents. I have it set to always use
a dark theme, because a blinding white page isn't very nice.
Not too much to say here, if you know how to navigate in Vim, you
know exactly how to navigate in Zathura. It's that simple.
## Writing
I write almost everything in Markdown. The only exception is this
website. But even then, the blog posts themselves are written in
Markdown.
I like Markdown because it can be converted to
any format you want using programs like Pandoc. All the software
I write now uses Pandoc to generate man pages. It is really
convenient.
## EOF
Alright.. so, that's my system, I guess. As you can tell, it's
heavily designed around Vim like programs and the command line.
If you were wondering why I'm such a big fan of the UNIX
philosophy, specifically the "handle text streams", this
is why.
I believe I've perfected my setup now, which shows because I
haven't been doing any major changes to my setup or workflow
all year. I did briefly attempt to move over to Wayland a while ago,
and while I did manage to rewrite my scripts to support both X11
and Wayland, I have decided to stick with X11 and my dwm fork.
Anyways, I think that's all I have to say. Have a good day!