třiapůl

Life without GUI I

2021-05-09

Originally composed for rawtext.club. This is an introduction to the 'project'. Several tips follow below.

Some time ago, by current standards a very long time ago, when I was introduced to *nices, I was initially enthralled by the unprecedented choices and options that presented themselves to the thrifty user. Migrating from the world of Microsoft's XP, I was already a naturally curious individual and when I found out that the looks and aesthetics of an operating system could be changed, I wasted no time in tinkering with them. I already had previous experience with scouring every option in Windows' 95 and 98 screensaver options and the customizable colors of windows and panels. Once the internet rolled its heavy threads into the neighborhood, I wasted no time in downloading all sorts of themes and changes to user interfaces. Looking back at those habits, I was definitely not very cautious when it came to messing around with how the operating system looked and must've been pulling all sorts of dubious software into the machine with every utility promising to perk up one's desktop. But no matter the choices and programs in the Windows sphere, one would still be working with the interface that was ultimately tailored across the big pond somewhere in California. Of course those programs that radically changed the appearance were probably the root causes of Internet Explorer's now diminishing web view size, numerous toolbars and a homepage in Arameic.

Every subsequent release of Windows seemed to further sterilise the options for wild customization, making it ever more attractive to pull worm infested programs off the internet to perform the slightest changes. And let's not get into a discussion on the quality of various themes that came with Vista and 7. But hey, nowadays one can change the color of the panel to one of 16 colors and disable opacity. And what about the D A R K M O D E ? Choices!

But back to my introduction to what was initially Kubuntu during highschool classes on UNIX systems. While part of my brain busied itself with the structure of the filing system, the other wasted no time in playing with the uncountable options of customization. I'm certain my terminal changed font and color every 20 seconds. But what about the look of windows? Not only could I now change the colors of title bars, or move the system panel to a different edge of the screen, I could have no title bars at all and if I so desired, have a massively obtrusive window list in the middle of the screen. This was the compiz era of wobbly windows and while today a rather useless feature, back then it blew my mind that all these things were seemingly native to the system. And I didn't even know yet of the variety of desktop environments and window managers, each with their vast array of customization.

As time went on and I grew comfortable with the different system, I moved from the aesthetic tinkering to a utilitarian approach. I was no longer forced to use a dedicated file manager with little to no customization, I could peruse the bookshelves of countless programs written by crafty people and discover what each had to offer. But perhaps it is of little use to present to you the open approach to customization that *nix systems follow, because after all, this is not an essay on tinkering with the looks and functionality of one's computer. In the end it was not so much the appearance and fluff, but the command line, that stole my heart. If there is one thing I took from it all, it is that rummaging through all possible options a program or an environment offers leads to better understanding and one grows more confident with its usage and is more couragous in bending it to their needs.

Soon after my full descend into Linux, I began valuing minimalism and simplicity, realizing I don't need most of the things that I was lead to believe I formerly needed to be presented with at all times in the case of Windows or even some *nix desktop environments. This being one of those lightbulb moments, where I realized that everything every graphical interface does is just commands in the shell with a sleek suit. During this time I made the switch from Fedora and xfce/gnome, two of the desktop enviroments I kept alternating between, to now defunct crunchbang distribution of Debian. My first real encounter with window managers, namely openbox. And again, I was blown away by the mix of simplicity and customization. But even before that I was already getting to know the bare system frequently by Ctrl+Alt+F1-ing into the GUI-less space and performing tasks that graphical programs did for me by hand.

That was when I began a series of tips I called 'Life without GUI,' which was shared with a single person, who also fell deeply in love with Linux during the same time, but our paths have since diverted, as he grew to value ease of use and sleek customizable modern interfaces, while I continued down the road beneath the hood of the system, so to speak.

My series was not so much on the fundamentals of UNIX use, akin to 'how to mount a disk,' or 'how to copy files,' but rather on some creative ways of doing things and interesting tools that existed only in the shell environment that could easily be missed by those too keen on having graphical utilities do most, if not all their tasks.

Being now here and a part of rawtext.club, it would be foolish to preach on the magic of the command line, but it has given me a nudge to perhaps resurrect this old project of mine and share some of my findings. Note that these would be mostly niche things with not much value to the average user of a computer, but could provide insight into some in the very least fun-to-try tools.

While this is mostly just my introduction into the topic, I will leave with you a recent discovery.

Playing videos:

"I rarely use X myself and when I do, it's for the lack of UTF-8 support in the OpenBSD tty! Even then I just fullscreen xterm! What even is a mouse?!" you cry and I commend you for it, but we all know that there are times when you just can't get by without either X or a window that hosts some graphical output. Surely you're one those who have since given up on video streaming sites, but you still like to watch your favorite Godard here and there. "It always ruins my no GUI-streak, retko! If only there was a way to watch videos without leaving the shell." Well, my fellow rawtextclubian, what if I told you there is a way to watch your favorite flick in the glorious ASCII, right there from the command prompt? Here's what you'll need:

mpv

mpv is a fantastic media player that can already play your audio files, similar to mplayer, but it has a few nifty perks that we'll make use of below. Okay, that wasn't a very demanding list. Here's how to get it, depending on your system or distribution:

# apt install mpv

or

# pkg_add mpv

or

# dnf install mpv

or

http://mpv.io

If you wish to build it yourself.

You get the gist.

mpv is very simple to use on its own. The basic syntax is:

$ mpv [file-to-play]

Of course for our purposes this will only work for audio. Not for long. Say you want to play that Godard film you mentioned before, but don't want to ruin your no-GUI streak. Note that there will be 'some' quality loss. You might not be able to tell much from the picture, depending on the resolution of your terminal.

$ mpv --vo=tct that-film-i-like.ogg

You're in business! You can specify a custom resolution with '--vo-tct-width=NUMBER --vo-tct-height=NUMBER' if mpv doesn't recognize the size of your terminal and choose between two methods of displaying the picture. It'll even work on on a terminal that doesn't support true color (taken from mpv manual):

        --vo-tct-algo=ALGO
                        Select how to write the pixels to the terminal.

                half-blocks Uses unicode LOWER HALF BLOCK character
                        to achieve higher vertical resolution.
                        (Default.)

                plain Uses spaces. Causes vertical resolution to
                        drop twofolds, but in theory works in more
                        places.

        --vo-tct-256=YES|NO
                        (default: no) Use 256 colors - for terminals which
                        don't support true color.

If you only plan to watch videos this way from now on, there are a few benefits, apart from the obvious lack of need for graphical support. No need for those 4K files, since you'll be effectively watching an impressionist animation made of squares. This might also help you watch videos on ancient hardware!

"Cool, but I still want to watch youtube." Fine, you heretic. You can even watch youtube videos without ever leaving the shell this way. Get youtube-dl here:

https://youtube-dl.org

Note that it might be packaged in your distribution, but chances are it's outdated. Luckily for you, there's no need to compile it, since it's just a python script. So be sure to have python as well. Now it's just a matter of:

$ mpv --vo=tct https://link-to-the-youtube-video

Finale: Of course if you've been following the above tutorial, you can tell this doesn't have much value to you, if you have access to a graphical server and don't mind ruining your no-GUI streak. We can argue whether it actually counts as GUI if it's just a borderless window with a film some other time. But to leave you with some usefulness. You can use mpv (and youtube-dl combo) to just stream audio in the background like so:

$ mpv --no-video https://link-to-a-video-you-dont-mind-only-listening-to &

$ mpv --no-video video-file-you-dont-mind-only-listening-to &

Lastly: depending on your OS, you might be able to use the DRM driver to stream videos straight in the shell environment. The playing video will occupy one of the virtual terminal screens and it might feel like the X server with nothing but your video. But you do not need X and there is no mouse support. The following works on my freeBSD machine.

$ mpv --vo=drm [file-to-play]

That's it for now. See you next time on 'Life without GUI.'

[tr]