From 546afee39da09616d7eefb9151ea28e7f9f66d21 Mon Sep 17 00:00:00 2001 From: vdbewout Date: Fri, 11 Aug 2023 14:59:51 +0200 Subject: [PATCH] feat(tmux): remove sed dependency for theme loading --- catppuccin.tmux | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/catppuccin.tmux b/catppuccin.tmux index bb3f930..0dbdf12 100755 --- a/catppuccin.tmux +++ b/catppuccin.tmux @@ -225,7 +225,16 @@ main() { # NOTE: Pulling in the selected theme by the theme that's being set as local # variables. # shellcheck source=catppuccin-frappe.tmuxtheme - source /dev/stdin <<<"$(sed -e "/^[^#].*=/s/^/local /" "${PLUGIN_DIR}/catppuccin-${theme}.tmuxtheme")" + # https://github.com/dylanaraps/pure-sh-bible#parsing-a-keyval-file + while IFS='=' read -r key val; do + # Skip over lines containing comments. + # (Lines starting with '#'). + [ "${key##\#*}" ] || continue + + # '$key' stores the key. + # '$val' stores the value. + local "$key"="${val:1:-1}" + done < "${PLUGIN_DIR}/catppuccin-${theme}.tmuxtheme" # status set status "on"