From d7011188c102bf934d1af52eb25cdd59577566d7 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 16 Oct 2018 14:18:54 -0400 Subject: revamp of dropdown scripts, bug fixes --- .scripts/ddspawn | 25 +++++++++++++++++++++++++ .scripts/tmuxdd | 4 ++++ .scripts/tmuxinit | 4 ---- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100755 .scripts/ddspawn create mode 100755 .scripts/tmuxdd delete mode 100755 .scripts/tmuxinit (limited to '.scripts') diff --git a/.scripts/ddspawn b/.scripts/ddspawn new file mode 100755 index 0000000..55da52e --- /dev/null +++ b/.scripts/ddspawn @@ -0,0 +1,25 @@ +#!/bin/sh + +# This script simplifies dropdown windows in i3. +# Usage: +# argument 1: script to run in dropdown window +# all other args are interpreted as options for your terminal +# My usage: +# ddpawn +# bindsym $mod+u exec --no-startup-id ddspawn tmuxdd +# Will hide/show window running the `tmuxdd` script when I press mod+u in i3 +# bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24 +# Similar to above but with `dropdowncalc` and the other args are interpretated as for my terminal emulator (to increase font) + + +[ -z "$1" ] && exit + +if xwininfo -tree -root | grep "(\"$1\" "; +then + echo "Window detected." +else + echo "Window not detected... spawning." + i3 "exec --no-startup-id $TERMINAL -n $1 $(echo "$@" | cut -d ' ' -f2-) -e $1" && i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" + sleep .25 # This sleep is my laziness, will fix later (needed for immediate appearance after spawn). +fi +i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" diff --git a/.scripts/tmuxdd b/.scripts/tmuxdd new file mode 100755 index 0000000..c194ff1 --- /dev/null +++ b/.scripts/tmuxdd @@ -0,0 +1,4 @@ +#!/bin/sh +# This is the script that i3 runs to either start tmux in +# the dropdown terminal or log into a previous session. +tmux a || tmux diff --git a/.scripts/tmuxinit b/.scripts/tmuxinit deleted file mode 100755 index 68a4b86..0000000 --- a/.scripts/tmuxinit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# This is the script that i3 runs to either start tmux in -# the dropdown terminal or log into a previous session. -tmux a || tmux -- cgit v1.3.1