From 55685b3084bd4d3dd9107c6f60841d02560ba47b Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sun, 3 Apr 2022 09:26:07 +0530 Subject: [PATCH] fish: Make life easier by setting GST_DEBUG_DUMP_DOT_DIR globally --- fish/.config/fish/conf.d/setup.fish | 3 +++ fish/.config/fish/functions/dotg.fish | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/fish/.config/fish/conf.d/setup.fish b/fish/.config/fish/conf.d/setup.fish index cfd0ca0..c47d655 100644 --- a/fish/.config/fish/conf.d/setup.fish +++ b/fish/.config/fish/conf.d/setup.fish @@ -63,6 +63,9 @@ function __fish_setup_on_tty_login --description "Set up environment on tty logi set -Ux GST_DEBUG_NO_COLOR 1 set -Ux GST_DEBUG_COLOR_MODE "off" + mkdir -p /tmp/gst-dot + set -Ux GST_DEBUG_DUMP_DOT_DIR /tmp/gst-dot + # Start all tmux sessions on login ~/.tmux/session-setup.sh end diff --git a/fish/.config/fish/functions/dotg.fish b/fish/.config/fish/functions/dotg.fish index 2fb1113..ea09140 100644 --- a/fish/.config/fish/functions/dotg.fish +++ b/fish/.config/fish/functions/dotg.fish @@ -1,4 +1,14 @@ function dotg --description 'Generate gstreamer dot graph for selected file' - find $argv -maxdepth 1 -regextype posix-extended -regex ".*\.(dot)" | fzf | read -l result; and dot -Tsvg "$result" -O - mv "$result".svg ~/Pictures/gstreamer + if count $argv > /dev/null + set dotpath "$argv" + else + set dotpath "$GST_DEBUG_DUMP_DOT_DIR" + end + + find $dotpath -maxdepth 1 -regextype posix-extended -regex ".*\.(dot)" | fzf | read -l result; + + if test -n "$result" + dot -Tsvg "$result" -O + mv "$result".svg ~/Pictures/gstreamer + end end