diff --git a/env/.config/ghostty/config b/env/.config/ghostty/config index 681a953..6f9751d 100644 --- a/env/.config/ghostty/config +++ b/env/.config/ghostty/config @@ -24,7 +24,6 @@ quit-after-last-window-closed-delay = 5m # macos-icon = custom-style keybind = ctrl+shift+t=toggle_quick_terminal -keybind = ctrl+l=clear_screen # Splits keybind = super+j=goto_split:down diff --git a/env/.local/scripts/close-all-windows b/env/.local/scripts/close-all-windows index dc3e233..3e13fdd 100755 --- a/env/.local/scripts/close-all-windows +++ b/env/.local/scripts/close-all-windows @@ -25,14 +25,19 @@ special_flag="0" workspace_name="" workspace_id="" windows=() +SCRIPTS=${SCRIPTS} + +if [[ -z $SCRIPTS ]]; then + echo "SCRIPTS not set in the environment." + echo "Using: ~/.local/scripts" + SCRIPTS=~/.local/scripts +fi while [[ $# -gt 0 ]]; do if [[ $1 =~ ^-s ]] || [[ $1 =~ ^--special ]]; then - shift special_flag="1" workspace_name=$1 - elif [[ $1 =~ ^-h ]] || [[ $1 =~ ^--help ]]; then usage && exit 0 elif [[ $1 =~ ^-a ]] || [[ $1 =~ ^--active-workspace ]]; then @@ -56,7 +61,4 @@ else windows+=($(hyprctl clients -j | jq -r ".[] | .address")) fi -for w in ${windows[@]}; do - echo "Closing window address: $w" - hyprctl dispatch closewindow address:$w -done +$SCRIPTS/close-window $windows diff --git a/env/.local/scripts/close-windows b/env/.local/scripts/close-windows new file mode 100755 index 0000000..7c6badd --- /dev/null +++ b/env/.local/scripts/close-windows @@ -0,0 +1,130 @@ +usage() { + cat <$dest printf "yay \${1:-\"-S --noconfirm\"} # packages\n" >>$dest chmod +x $dest } -generate-new-webapp() { +generate_webapp() { local dest="$DEV_ENV/env/webapps/$file" @@ -52,10 +54,7 @@ generate-new-webapp() { dest="$dest.json" fi - if [ -f "$dest" ]; then - log "dest exists: $dest" - exit 1 - fi + fail_if_exists $dest log "Creating new webapp: $dest" @@ -67,15 +66,10 @@ generate-new-webapp() { } -generate-new-script() { +generate_script() { local dest="$DEV_ENV/env/.local/scripts/$file" - if [ -f "$dest" ]; then - log "file exists: $dest" - exit 1 - fi - + fail_if_exists $dest log "Creating new script: $dest" - printf "#!/usr/bin/env bash\n\n" >$dest chmod +x $dest echo $dest @@ -89,11 +83,11 @@ if [[ -z "$file" ]]; then fi if [[ $run == "1" ]]; then - generate-new-run + generate_run elif [[ $webapp == "1" ]]; then - generate-new-webapp + generate_webapp elif [[ $script == "1" ]]; then - generate-new-script + generate_script else log "Must supply either \"run\", \"webapp\", or \"script\" option." exit 1