Spotify song in i3 status bar

While customizing my i3 status bar, I wanted to have currently played Spotify song in it. Some time ago, I created an open source script in Python called spotify-cli-linux and I wanted to use it. When we want to put something custom into the i3 status bar, the easiest way to do it, is to save data into the file and then read the file. I created the following config inside ~/.config/i3status/config file: ...

February 20, 2020 · 3 min · 546 words · Piotr Wittchen

Publishing Python package to PyPi

Introduction I have my own tiny Python project called spotify-cli-linux, which is (surprise!) command line interface for Spotify desktop app on Linux. Python is not my primary programming language and I work more with Java. Nevertheless, I find this language enjoyable and useful in many cases, so I try to learn something new about it from time to time. In the beginning, I’ve provided instructions how to install my Python script in the system via curl and wget, which is fine, but it’s not recommended and official way to do it. Moreover, people may be afraid of running shell scripts from remote resources on their machines. That’s why I decided to upload my project to PyPi, which is The Python Package Index. ...

April 8, 2018 · 3 min · 592 words · Piotr Wittchen

Control Spotify on Linux like a hacker

Recently, I created a tiny script called spotify-cli, which allows you to control Spotify on Linux from terminal. It’s inspired by shpotify, which is a shell script doing similar things, but on macOS. My script is written in Python and uses dbus under the hood, which allows to communicate with bus daemon to pass messages between applications. I used pactl for controlling the system sound. You can install spotify-cli as follows via wget: sh -c "$(wget https://raw.githubusercontent.com/pwittchen/spotify-cli-linux/master/install.sh -O -)" or via curl: ...

March 5, 2017 · 1 min · 181 words · Piotr Wittchen

Automate boring stuff

Introduction In my current company all the people who perform creative work (mostly programmers) need to prepare so-called PKUP report. PKUP stands for Podwyższone Koszty Uzyskania Przychodu in the Polish language. It’s legal regulation in Poland, which allows paying a lower income tax due to the particular type of work. For the regular employee, it means that he or she will simply get a bit higher salary per month. How the report looks in practice? As a programmer, I simply create software as a source code. Added, removed and modified lines of code in the existing codebase are treated as my creative work. Luckily, we use Git so I can generate *.diff files from the Git repositories I’m contributing to. Besides that, I need to prepare document as a *.docx file with a short description of my work. My tasks look different every month, but report actually looks almost the same every month. Preparing this report is boring and repeatable stuff. ...

January 1, 2017 · 3 min · 527 words · Piotr Wittchen

3 questions about your Git repository

Introduction Can you answer the following questions about your Git repository? Does development branch has all changes from master branch? Is your gitlog a crap? How old are your branches? If not, but you want to know answers, you’re lucky, because I prepared 3 simple scripts for you, which can help to find it out. Does development branch has all changes from master branch? git-branch-comparator is a python script, which checks if development branch has all changes from master branch in Git repository. Another, easier way to accomplish the same task suggested in comments by Mike (thanks!) is to call simply: ...

December 28, 2015 · 3 min · 629 words · Piotr Wittchen