I am attempting to create a zsh function in my .zshrc file so that I can have one command that will capture byobu's scrollback buffer into $BYOBU_RUN_DIR/printscreen (the default location) and then open that file in my editor of choice, micro, with the cursor at the end of the file.

I am using xdotool to send the keyboard events to tell byobu to capture the scrollback buffer and then trying to open it with micro.

This is my current function, sb (short for 'scrollback') in .zshrc.

sb () {
  xdotool key shift+F7;
  micro -startpos 10000,1 "$BYOBY_RUN_DIR/printscreen";

This does indeed cause the scrollback buffer to be captured into $BYOBU_RUN_DIR/printscreen. I confirm by running cat $BYOBU_RUN_DIR/printscreen.

However, then micro attempts to open /printscreen (without the byobu run directory prefix).

  • Guess what. It was just a typo in the environment variable. It should have been $BYOBU_RUN_DIR – user10108 Jan 25 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.