Files
NixOS/mango/scripts/layout-cmd.sh

22 lines
368 B
Bash

#!/bin/sh
set -eu
tag_json=$(mmsg get all-tags)
symbol=$(printf '%s' "$tag_json" | jq -r '
.all_tags[0].tags[] | select(.is_active == true) | .layout
' | head -1)
arg1="$1"
target_layout="${arg1%%:*}"
for arg in "${@:1:$#-1}"; do
layout="${arg%%:*}"
cmd="${arg#*:}"
if [ "$symbol" = "$layout" ]; then
eval "$cmd"
exit 0
fi
done
eval "${@: -1}"