spotymenu: control spotify via dmenu

I while ago it became a pain in the ass for me to select and arrange albums with Spotify’s GUI. It’s slow, feels heavy and bloated. I wanted something quicker and easier to use, especially something what I can control with the keyboard. I know there is mopidy-spotify and other libspotify based applications too, but those work only with premium accounts.

I’ve found a bunch of scripts, but those only do basic Spotify controls via dbus (play/pause, prev/next etc.). I have my own script which does the same, I needed something more “powerful”.

One day I’ve started using dmenu and the idea had came to me: I should use this nice little software for this job! Then I wrote a little album export script, and after that I’ve started to work on spotymenu.

Long story short: It’s still a very simple and basic bash script, definitely not a GUI replacement, the GUI still needs to run, but at least it works with non-premium accounts and this way I can have my album list exported to a local plain text file in the first place.

If you are interested, check out my repository where you can find a detailed README too: spotymenu

Run terminal applications from dmenu with their Xresources name

If you are using dmenu, you might want to run terminal applications from it. I’ve found an old post about a modified dmenu_run script in the Arch Linux Forums, in the Dmenu Hacking Thread: #45. It worked fine, but I’m using urxvt with .Xresources color definitions for some apps.

So I modded that script a bit to use the .Xresources name when it’s given. For that to work, you need to create list with the names of the apps in ~/.dmenu_term_apps, for example:

$cat ~/.dmenu_term_apps

htop
alsamixer
ranger -name ranger
mocp -name moc
newsbeuter -name newsbeuter
rtorrent -name rTorrent

If the -name <name> was given, the app will use its own Xresources settings, otherwise it will use the default settings.

You can find this modified script in my Scripts repo: dmenu_run

dmenu2 modding

About a month ago I started using dmenu (dmenu2, precisely), but I didn’t like the behaviour of the TAB key (completion). I wanted it to behave like Vimperator: TAB key to select the next element, Shift+TAB to select the previous. So I modified the dmenu.c file in the source and now it works the way I wanted.

If you like this TAB behaviour better, you can get this modified version from my dmenu2 repository.

urxvt url-select-plus

For urxvt there is a nice perl extension called url-select, written by Bert Muennich. It was fine until I needed a few more options, especially an option for opening the selected url in an alternative browser. So I made a slight modification: added an option for it, then added another option for opening the selected url with a media player, which is useful for youtube or some other video links. I renamed this modified script to url-select-plus to avoid naming conflicts.

Update (03/10/2016): I added another option for an image viewer, now you can open image links directly with it (see: imgviewer option).

Now I can use these options in my .Xresources file:

URxvt.url-select-plus.altlauncher: chromium
URxvt.url-select-plus.mediaplayer: mpv
URxvt.url-select-plus.imgviewer: feh

Then I can hit O (Shift+o) to open the selected link in the alternative browser, which for me is Chromium. If it’s a youtube link, then I can hit m on the link and it will open the video in mpv. Of course, you can use it with another media player (mplayer, for example), just make sure you have youtube-dl installed.

You can find this extension in my dotfiles repo: url-select-plus

If you use this instead of the original url-select, don’t forget to modify the names for other options too in the .Xresources file:

URxvt.keysym.M-f: perl:url-select-plus:select_next
URxvt.url-select-plus.launcher: firefox
URxvt.url-select-plus.altlauncher: chromium
URxvt.url-select-plus.mediaplayer: mpv
URxvt.url-select-plus.imgviewer: feh
URxvt.url-select-plus.button: 1
URxvt.url-select-plus.underline: true

Blog update

Long time since I updated this blog, if you read this, it means I’ve just successfully migrated from jekyllrb to Hugo. The migration wasn’t hard, but it wasn’t super easy either. I had a few bumps, I had to read the documentation apparently, but so far I like it. I also cleaned up a bit, removed some old, obsolete posts. I hope I can write some new, helpful/useful post in the near future.

In the meantime: if you interested in frequent updates, visit my dotfiles repo and/or my Scripts repo. I’m always tinkering with my configs and scripts and push them to github frequently. Or you can check out my repositores list.