Introducing Playerctl

Playerctl is a command line controller and lib for spotify, vlc, audacious, bmp, xmms2, mplayer, and other media players. Get it here. This article will demonstrate some use cases of the utility and explain some of its design goals. If you find an interesting way to use Playerctl not mentioned here, let me know about it by posting a comment on this article or sending me an email.

The command line utility

Playerctl includes a command line utility that can be used to control your media player with these commands:

  playerctl [OPTION...] COMMAND

Available Commands:
  play              Command the player to play
  pause             Command the player to pause
  play-pause        Command the player to toggle between play/pause
  next              Command the player to skip to the next track
  previous          Command the player to skip to the previous track
  volume [LEVEL]    Print or set the volume to LEVEL from 0.0 to 1.0
  status            Get the play status of the player
  metadata [KEY]    Print metadata information for the current track. Print only value of KEY if present

GObject-Introspection Build System Example

“…why should we not calmly and patiently review our own thoughts, and thoroughly examine and see what these appearances in us really are?” — Plato

GObject Introspection is a pretty neat tool from the Gnome project that allows you to expose a common API from a C library to various scripting languages. This is accomplished by “introspection” (my favorite computer metaphor I’ve come across so far) where by a coder may follow conventions that enable the program to take an inventory of its internal state after compiling and describe itself in a structured, language-agnostic kind of way.

The downside of this approach is the complexity it imposes on the library’s initial creators. The most challenging aspect for me was actually getting the thing to build. The best supported build system is the venerable autotools aka the GNU build system, with autoconf, automake, libtool, et al.

This guide is meant to be a gentle introduction to setting up a build system for a GI library. You should have a basic understanding of the GObject class before you begin. All the files discussed here are available on the Github project page.

Personal Pastebin Tool

Here is a vim script that let’s you turn your website into a personal pastebin service so you can share text files with people. I’ll explain how it works and share some interesting ways to use it. Could be fun.

Why a personal pastebin?

Despite how we may appear sometimes, programmers are actually among the most social engineers. If you work around them long enough, you’ll need to share some code or the contents of some configuration file. It’s generally considered to be bad manners to send anything more than a line or two to someone in a chat client. For this reason, people have created pastebins. Just share a link where the contents are displayed and anyone interested can take a look.

I was using some other pastebin services for awhile, but the web interfaces are tedious to use. There are some good command line tools for hastebin with vim integration if you look for them and don’t mind using a public pastebin. But if you already have a webserver, why not use it to host your pastes? Here are the benefits of using the script:

  • Share your code in just a few keystrokes.
  • Use your own syntax hilighting and color scheme.
  • Share anything that fits in a vim buffer, even a shell (more on that later)
  • It’s a subtle way to promote your site among your friends.

Introducing I3-style

i3-style is an i3 config templater that supports themes. Check it out.

Make all your themes come true

You probably already know that i3 is an improved tiling window manager for X11 designed specifically with us super users in mind. And what is it exactly that makes a super user so super? We customize everything!

In your i3 config file, you can change the colors of the window decorations and the different parts of i3bar. However, this can get tedius because the lines that change the colors are strewn about the file, and they only take HTML style hex color codes. This can make customizing the colorscheme a difficult task.

What’s so cool about i3-style?

  • Easy to try out new themes right after you install.
  • Themes are easy to read, modify, and share.
  • Modifies your config in place – extra template files not needed.