dotfiles

Configuration for the software I use.
git clone https://git.sr.ht/~jbauer/dotfiles
Log | Files | Refs | README | LICENSE

commit b3a7eab278838c5ca84c6938ab00f0019903adc8
parent d1836fd000eb623581bc8983143aec4b59cf377c
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Thu, 25 Feb 2021 00:21:24 -0500

Get rid of tmux rebinds

Diffstat:
M.config/tmux.conf | 16+++-------------
A.local/bin/tmux-bar | 31+++++++++++++++++++++++++++++++
D.local/bin/tmux-battery | 3---
3 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/.config/tmux.conf b/.config/tmux.conf @@ -28,16 +28,6 @@ set -g bell-action other # }}} # Keybindings {{{ -# Rebind prefix -unbind C-b -set-option -g prefix C-q -bind-key C-q send-prefix - -# Split Panes Using | and - -unbind '"' -unbind % -bind | split-window -h -bind - split-window -v # Vim-like Pane Switching bind h select-pane -L @@ -74,9 +64,9 @@ set -g status-position bottom set -g status-bg colour236 set -g status-fg colour3 set -g status-left '' -set -g status-right 'Batt: #(tmux-battery) #[fg=colour233,bg=colour241,bold] %Y-%m-%d #[fg=colour233,bg=colour245,bold] %H:%M ' -set -g status-right-length 50 +set -g status-right '#(tmux-bar) #[fg=colour233,bg=colour241,bold] %Y-%m-%d #[fg=colour233,bg=colour245,bold] %H:%M ' +set -g status-right-length 80 set -g status-left-length 20 -set -g status-interval 5 +set -g status-interval 1 # }}} diff --git a/.local/bin/tmux-bar b/.local/bin/tmux-bar @@ -0,0 +1,31 @@ +#!/bin/sh + +nowPlaying=$(cmus-remote -Q 2>/dev/null) +title=$(echo "$nowPlaying" | grep 'tag title' | cut -d' ' -f3-) +artist=$(echo "$nowPlaying" | grep 'tag artist' | cut -d' ' -f3-) +repeat=$(echo "$nowPlaying" | grep 'set repeat ' | cut -d' ' -f3-) +shuffle=$(echo "$nowPlaying" | grep 'set shuffle' | cut -d' ' -f3-) +duration=$(echo "$nowPlaying" | grep 'duration' | cut -d' ' -f2-) +position=$(echo "$nowPlaying" | grep 'position' | cut -d' ' -f2-) +curStatus=$(echo "$nowPlaying" | head -1 | cut -d' ' -f2) + +if [ "$curStatus" != "playing" ] && [ "$curStatus" != "paused" ]; then + printf "Nothing Playing" + exit 0 +fi + +((durationMinutes=$duration/60)) +((durationSeconds=$duration%60)) +((positionMinutes=$position/60)) +((positionSeconds=$position%60)) + +if [ "$shuffle" = "true" ]; then + icons=" " +fi +if [ "$repeat" = "true" ]; then + icons="$icons " +fi + +printf "\"%s\" by %s — %02d:%02d/%02d:%02d%s" "$title" "$artist" \ + "$positionMinutes" "$positionSeconds" "$durationMinutes" \ + "$durationSeconds" "$icons" diff --git a/.local/bin/tmux-battery b/.local/bin/tmux-battery @@ -1,3 +0,0 @@ -#!/bin/sh - -acpi | head -1 | awk '{print $4}' | tr -d ','