Tag: devour

  • Zsh: Devouring Tools or Hiding the Terminal

    There has been a bit of a rush on Youtube videos describing how to hide the terminal when running certain commands; when using the terminal as a file browser you may want to show a media file. And sometimes when showing that file, you may wish to hide the terminal – particularly on a small laptop screen.

    Just for fun, I decided to take one of the recipes and adapt it for my working environment which revolves around the zsh when I am in a terminal window.

    To start with, I need the xdo tool, which can be installed with :-

    $ sudo apt install xdo

    Once that is installed, I modified a shell script from https://github.com/salman-abedin/devour/blob/master/ into a zsh function. I created a function file within my FPATH (~/lib/zsh/functions/devour) :-

    function devour {
      id=$(xdo id)
      xdo hide
      . $@
      xdo show "$id"
    }

    Note that I have deliberately not redirected stdout and stderr away.

    I then added the following to my .zshrc :-

    autoload devour

    The next step is to create aliases for the commands you might want to run automatically in such a way :-

    alias mpv="devour mpv"

    Although I am not sure “devour” is the right word to use for this action, but I have yet to think of a better one.