dotfiles

Yes, my $HOME has a git repo now :(

git clone git://git.shimmy1996.com/dotfiles.git
commit 1d74d3cabd0391e192f857f41a65bf45aaebf025
parent 52aa3f00ef6043d6f4efc2446a3c6a1b277ccc45
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Sun, 20 Jan 2019 22:50:38 -0500

Add a block for music players.

Diffstat:
M.README.org | 3+++
M.config/i3blocks/config | 6++++++
A.local/bin/i3blocks/music | 20++++++++++++++++++++
M.profile | 6++++++
4 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/.README.org b/.README.org
@@ -5,6 +5,9 @@ An archive of core configuration files for the fabled Bipedal Inter-Galactic Mas
 
 * Functional Dependencies
 Missing those may cause system to behave funny.
+| =mpc=                   |
+| =mpd=                   |
+| =ncmpcpp=               |
 | =i3blocks=              |
 | =acpi=                  |
 | =alsa-utils=            |
diff --git a/.config/i3blocks/config b/.config/i3blocks/config
@@ -29,6 +29,12 @@ command=~/.local/bin/i3blocks/$BLOCK_NAME
 separator_block_width=15
 markup=none
 
+[music]
+markup=pango
+label=BGM:
+interval=5
+signal=12
+
 [ssid]
 label=NWK:
 interval=5
diff --git a/.local/bin/i3blocks/music b/.local/bin/i3blocks/music
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+# Italic if paused
+filter() {
+    sed "/^volume:/d" | tac | sed -e "s/\\&/&amp;/g;s/\\[paused\\].*/<span color=\"gray\" font_style=\"italic\">/g;s/\\[playing\\].*/<span>/g" | tr -d '\n' | sed -e "s/$/<\\/span>/g"
+}
+
+case $BLOCK_BUTTON in
+    1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;;  # left click, bring up player
+    2) mpc toggle | filter ;;   # left click, nothing
+    3) mpc status | filter && pgrep -x dunst >/dev/null && notify-send "<b>🎵 Music module:</b>
+- Shows mpd song playing.
+- Italic when paused.
+- Left click opens ncmpcpp.
+- Middle click pauses.
+- Scroll changes track.";;  # right click, infobox
+    4) mpc prev   | filter ;;  # scroll up, previous
+    5) mpc next   | filter ;;  # scroll down, next
+    *) mpc status | filter ;;
+esac
diff --git a/.profile b/.profile
@@ -14,6 +14,12 @@ export QT_IM_MODULE=fcitx
 export GTK_IM_MODULE=fcitx
 
 # Preferred applications
+if [[ `hostname` == "bluebear" ]]; then
+    # Wayland fix.
+    export TERMINAL=env WINIT_HIDPI_FACTOR=1.0 WAYLAND_DISPLAY= alacritty
+else
+    export TERMINAL=alacritty
+fi
 export BROWSER="firefox"
 export EDITOR="emacsclient"
 export VISUAL="emacsclient"