#!/bin/sh # Load powerline's tmux bindings, if powerline is installed at all. # # tmux.conf used to source # /usr/lib/python3.11/site-packages/powerline/bindings/tmux/powerline.conf # which pins a Python minor version into a path. That breaks on every Python # upgrade and had already broken everywhere: beastix is on 3.14, and shron had # the line commented out entirely until a checkout replaced its tmux.conf with # a copy carrying the dead path. Every tmux session there then opened with # No such file or directory: /usr/lib/python3.11/... # # Resolving the path from the module itself keeps it correct across upgrades, # and every step is allowed to fail quietly so a machine without powerline - # the Mac has neither it nor tmux - simply gets nothing. set -u command -v powerline-daemon >/dev/null 2>&1 || exit 0 command -v python3 >/dev/null 2>&1 || exit 0 powerline-daemon -q 2>/dev/null || exit 0 dir=$(python3 -c 'import os, powerline; print(os.path.dirname(powerline.__file__))' 2>/dev/null) || exit 0 [ -n "$dir" ] || exit 0 conf="$dir/bindings/tmux/powerline.conf" [ -r "$conf" ] || exit 0 tmux source-file "$conf"