From 099caf3d7a09e0596c8d8d7360b5ff138e31ec33 Mon Sep 17 00:00:00 2001 From: James Patrick Date: Sat, 27 Jun 2020 00:21:13 -0400 Subject: [PATCH] Adding tty-popup window. --- sway/config | 4 ++++ sway/scripts/tty-popup | 18 ++++++++++++++++++ zsh/modules/tmux/init.zsh | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 sway/scripts/tty-popup diff --git a/sway/config b/sway/config index a9c3867..7da0b7c 100644 --- a/sway/config +++ b/sway/config @@ -7,6 +7,8 @@ set $down j set $up k set $right l set $term kitty +set $scripts $HOME/.config/sway/scripts +set $tty-popup $scripts/tty-popup set $menu bash ~/.config/sway/scripts/menu set $pass_menu $term --class fzf-pass -e sh -c /usr/bin/fzf-pass @@ -24,6 +26,8 @@ for_window [class="pip"] $PIP for_window [window_role="PictureInPicture"] $PIP for_window [class="feh"] floating enabled ; border pixel 0 for_window [app_id="fzf-pass"] focus, floating enabled, border pixel 1 +for_window [app_id="tty-popup"] focus; $PIP +for_window [app_id="tty-popup" title="^pass$"] resize set 33 ppt 33 ppt # Status Bar: bar { diff --git a/sway/scripts/tty-popup b/sway/scripts/tty-popup new file mode 100755 index 0000000..a07947a --- /dev/null +++ b/sway/scripts/tty-popup @@ -0,0 +1,18 @@ +#! /bin/bash + +# This can be accessed by child process to tell if this is a popup pane. +export TTY_POPUP=1 + +if (( $# == 0)) ; then + echo "Invalid usage. I need an argument." + echo " ➜ $0 title \"command or script\"" + exit 1 +fi + +if (( $# > 1 )) ; then + title=$1 + shift +fi + + +kitty --class "${class:-"tty-popup"}" --title "$title" -e "$@" & diff --git a/zsh/modules/tmux/init.zsh b/zsh/modules/tmux/init.zsh index 30f6d23..cc2cfbb 100644 --- a/zsh/modules/tmux/init.zsh +++ b/zsh/modules/tmux/init.zsh @@ -11,7 +11,7 @@ if [ "$EUID" -eq 0 ] ; then fi # If this this terminal meets any of these return. -env_array=($TMUX $EMACS $VIM $INSODE_EMACS $VSCODE) +env_array=($TMUX $EMACS $VIM $INSODE_EMACS $VSCODE $POPUP_TTY) if [[ -n $env_array ]]; then return 0 fi