Compare commits

...

3 commits

Author SHA1 Message Date
504e09386b
Update update_* scripts to display info 2020-04-30 12:34:23 +02:00
8512bb3ecb
Added sway-screens function 2020-04-30 12:32:48 +02:00
8bb1fb8a3b
asdf now has zsh completion 2020-04-30 12:32:19 +02:00
4 changed files with 82 additions and 1 deletions

80
.zshrc
View file

@ -41,7 +41,6 @@ fi
if [ -d /opt/asdf-vm ]; then
. /opt/asdf-vm/asdf.sh
. /opt/asdf-vm/completions/asdf.bash
fi
### Misc
@ -145,6 +144,85 @@ function reload_work_gpg {
kill -9 $(ps aux|egrep "gpg-agent.*work"|grep -v grep|awk '{print $2}')
}
function sway-screens {
local screens=$(swaymsg -t get_outputs -r)
local show_active
local show_inactive
local var_style="plain"
local active_screens=()
local inactive_screens=()
while [ $# -ne 0 ]; do
case $1 in
-a|--active)
show_active=1
;;
-n|--inactive)
show_inactive=1
;;
-s|--style)
case $2 in
json)
var_style="json"
;;
plain)
;;
*)
echo "unknown style ${2}"
return 1
;;
esac
shift
;;
esac
shift
done
if [ "z${show_active}" != "z" ]; then
for s in $(echo $screens|jq -r '.[] | select(.active) | .name'); do
active_screens+=($s)
done
fi
if [ "z${show_inactive}" != "z" ]; then
for s in $(echo $screens|jq -r '.[] | select(.active|not) | .name'); do
inactive_screens+=($s)
done
fi
if [ "${var_style}" = "plain" ]; then
if [ ${#active_screens[@]} -gt 0 ]; then
echo "ACTIVE=${active_screens[@]}"
fi
if [ ${#inactive_screens[@]} -gt 0 ]; then
echo "INACTIVE=${inactive_screens[@]}"
fi
else
local active=""
for s in $active_screens; do
active+="\"$s\","
done
active=${active%,}
local inactive=""
for s in $inactive_screens; do
inactive+="\"$s\","
done
inactive=${inactive%,}
local content=""
if [ "z${show_active}" != "z" ]; then
content+="\"active\": [${active}],"
fi
if [ "z${show_inactive}" != "z" ]; then
content+="\"inactive\": [${inactive}],"
fi
content=${content%,}
echo "{${content}}" | jq
fi
}
## Custom completion
# certo
eval "$(_CERTO_COMPLETE=source_zsh certo)"

View file

@ -1,4 +1,5 @@
#!/usr/bin/env zsh
echo "Updating antibody cache"
currpath=$(realpath $PWD)

View file

@ -1,4 +1,5 @@
#!/usr/bin/env zsh
echo "Updating fzf"
currpath=$(realpath $PWD)

View file

@ -1,4 +1,5 @@
#!/usr/bin/env zsh
echo "Updating pipenv completion"
currpath=$(realpath $PWD)