From 03dd8b3cd8d03300ee85377ea40fa486819d2ebc Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Wed, 6 Mar 2024 14:59:00 -0500 Subject: Update shortcutgen env and misc others --- .local/bin/dropdowntoggle | 18 +++++++++++++++--- .local/bin/shortcutgen | 4 +++- .local/bin/upsite | 27 ++++++++++++++++++++++----- 3 files changed, 40 insertions(+), 9 deletions(-) (limited to '.local/bin') diff --git a/.local/bin/dropdowntoggle b/.local/bin/dropdowntoggle index f4a4705..91e834e 100755 --- a/.local/bin/dropdowntoggle +++ b/.local/bin/dropdowntoggle @@ -8,11 +8,23 @@ name="$1" class="dropdown" title="dropdown_$name" -active="$(xdotool search --name $title | wc -l)" +active="$(xdotool search --name "$title" | wc -l)" shift +case "$TERMINAL" in +*st) + classflag="-c" + titleflag="-t" + cmdflag="-e" + ;; +*alacritty) + classflag="--class" + titleflag="--title" + cmdflag="--command" + ;; +esac case "$active" in - 0) $TERMINAL --class "dropdown" --title "$title" --command "$@" & ;; - *) kill -9 `xdotool search --name "$class" getwindowpid` ;; +0) $TERMINAL "$classflag" "dropdown" "$titleflag" "$title" "$cmdflag" "$@" & ;; +*) kill -9 "$(xdotool search --name "$class" getwindowpid)" ;; esac diff --git a/.local/bin/shortcutgen b/.local/bin/shortcutgen index ce29ffb..2335a92 100755 --- a/.local/bin/shortcutgen +++ b/.local/bin/shortcutgen @@ -16,5 +16,7 @@ echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/map g\2 cd \3/' >"$XDG_CONFIG_HOME/lf/ echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/alias g\2="cd \3"/' >"$HOME/.cache/zsh-shortcuts" # Environment variables (read by .profile) -echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/export G\U\2="\3"/' >"$HOME/.cache/env-shortcuts" +echo "$raw" | sed 's/^\(.*\),\(.*\),/export G\U\2=,/;s/,\(.*\)/\1/' >"$HOME/.cache/env-shortcuts" + + diff --git a/.local/bin/upsite b/.local/bin/upsite index c6ef404..5b15d21 100755 --- a/.local/bin/upsite +++ b/.local/bin/upsite @@ -1,11 +1,28 @@ #!/bin/sh -sitename="chausse.xyz" +username="master" +url="chausse.xyz" +siteroot="$HOME/Workspace/$url" -branch="construction" - -cd "$HOME/Workspace/$sitename$construction" && git pull origin $branch && git checkout $branch +case "$1" in + -d|--dev) + url="dev.$url" + destdir="/var/www/dev" + branch="master" + ;; + -m|--main) + destdir="/var/www/chausse" + branch="construction" + ;; + *) + echo "Usage: upsite [dev|main]" + exit 1 + ;; +esac +cd "$siteroot" || exit 1 +git checkout $branch +git pull hugo --gc=true --minify +rsync -aucz --delete --progress "$siteroot/public/" "$username@$url:$destdir" -rsync -auvz "$HOME/Workspace/$sitename$construction/public/" "master@$sitename:/var/www/chausse" -- cgit v1.2.3