1
1
Fork 0

added switch desktop script and edited jekyll.sh

This commit is contained in:
david 2021-11-20 21:43:25 +01:00
parent ca2d8640c2
commit 07ed6afd95
2 changed files with 46 additions and 0 deletions

View File

@ -3,6 +3,7 @@
export JEKYLL_VERSION=4.2.0
docker run --rm \
--volume="$PWD:/srv/jekyll" \
--volume="$HOME/Public/docs:/srv/docs" \
-p 127.0.0.1:4000:4000/tcp \
-it jekyll/jekyll:$JEKYLL_VERSION \
jekyll $@

45
switch_desktop.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# name: switch_desktop.sh
# version: 0.1
# author: david@socialnerds.org
# description: switch to next, previous, specific desktop.
# you can also toggle between first and second desktop.
#
# usage: ./switch_desktop.sh next|prev|<int>|toggle
num=$(wmctrl -d | grep "*" | awk '{print $1}')
lockfile="/tmp/switch_desktop.lock"
if [ ! -f $lockfile ]; then
echo "creating lockfile [$lockfile]"
touch $lockfile
if [[ "$1" =~ ^[0-9]+$ ]]; then
echo "switching to specific desktop [$1]"
wmctrl -s $1
elif [ "$1" == "next" ]; then
echo "switching to next desktop [$next]"
next=$((num+1))
wmctrl -s $next
elif [ "$1" == "prev" ]; then
if [ $num -ne 0 ]; then
echo "switching to previous desktop [$prev]"
prev=$((num-1))
wmctrl -s $prev
fi
elif [ "$1" == "toggle" ]; then
if [ $num -eq 0 ]; then
echo "switching to second desktop"
wmctrl -s 1
else
echo "switching back to first desktop"
wmctrl -s 0
fi
fi
echo "waiting for 0.5 seconds"
sleep 0.5
echo "cleaning up lockfile [$lockfile]"
rm $lockfile
fi