Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 0276d90b893513179dfa8b34089513b74121ede1
parent df8e3a98e5c2a8d28f051a174c35dd1ba978016e
Author: Luke Smith <>
Date:   Thu,  3 Jan 2019 19:11:39 -0500

ddspawn simplification

M.config/i3/config | 33++++++++++++---------------------
M.scripts/i3cmds/ddspawn | 21+++++++--------------
2 files changed, 19 insertions(+), 35 deletions(-)

diff --git a/.config/i3/config b/.config/i3/config @@ -32,25 +32,16 @@ set $hibernate sudo -A systemctl suspend # #---Dropdown Windows---# # -# First I have a tmux window used for background scripts. -# I'll later bind this to mod+u. -for_window [instance="tmuxdd"] floating enable -for_window [instance="tmuxdd"] resize set 625 450 -for_window [instance="tmuxdd"] move scratchpad -for_window [instance="tmuxdd"] border pixel 3 -for_window [instance="tmuxdd"] sticky enable -for_window [instance="tmuxdd"] scratchpad show -for_window [instance="tmuxdd"] move position center - -# Then I have a window running R I use for basic arithmetic -# I'll later bind this to mod+a. -for_window [instance="dropdowncalc"] floating enable -for_window [instance="dropdowncalc"] resize set 800 300 -for_window [instance="dropdowncalc"] move scratchpad -for_window [instance="dropdowncalc"] border pixel 2 -for_window [instance="dropdowncalc"] sticky enable -for_window [instance="dropdowncalc"] scratchpad show -for_window [instance="dropdowncalc"] move position center +# General dropdown window traits. The order can matter. +for_window [instance="dropdown_*"] floating enable +for_window [instance="dropdown_*"] move scratchpad +for_window [instance="dropdown_*"] sticky enable +for_window [instance="dropdown_*"] scratchpad show +for_window [instance="dropdown_tmuxdd"] resize set 625 450 +for_window [instance="dropdown_dropdowncalc"] resize set 800 300 +for_window [instance="dropdown_tmuxdd"] border pixel 3 +for_window [instance="dropdown_dropdowncalc"] border pixel 2 +for_window [instance="dropdown_*"] move position center # #---Starting External Scripts---# # # Setting the background: @@ -137,8 +128,8 @@ bindsym $mod+Insert exec --no-startup-id showclip bindsym $mod+Pause exec --no-startup-id xcqr # #---Letter Key Bindings---# # -bindsym $mod+q [con_id="__focused__" instance="^(?!dropdowncalc|tmuxdd).*$"] kill -bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!dropdowncalc|tmuxdd).*$"] kill +bindsym $mod+q [con_id="__focused__" instance="^(?!dropdown_).*$"] kill +bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!dropdown_).*$"] kill bindsym $mod+w exec $term -e nmtui bindsym $mod+Shift+w exec --no-startup-id $BROWSER diff --git a/.scripts/i3cmds/ddspawn b/.scripts/i3cmds/ddspawn @@ -1,24 +1,17 @@ #!/bin/sh -# This script simplifies dropdown windows in i3. -# Shows/hides a scratchpad of a given name, if it doesn't exist, creates it. -# Usage: -# argument 1: script to run in dropdown window -# all other args are interpreted as options for your terminal -# My usage: -# ddspawn -# 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) +# Toggle floating dropdown terminal in i3, or start if non-existing. +# $1 is the script run in the terminal. +# All other args are terminal settings. +# Terminal names are in dropdown_* to allow easily setting i3 settings. [ -z "$1" ] && exit -if xwininfo -tree -root | grep "(\"$1\" "; +if xwininfo -tree -root | grep "(\"dropdown_$1\" "; then echo "Window detected." - i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" + i3 "[instance=\"dropdown_$1\"] scratchpad show; [instance=\"dropdown_$1\"] move position center" else echo "Window not detected... spawning." - i3 "exec --no-startup-id $TERMINAL -n $1 $(echo "$@" | cut -d ' ' -f2-) -e $1" + i3 "exec --no-startup-id $TERMINAL -n dropdown_$1 $(echo "$@" | cut -d ' ' -f2-) -e $1" fi