#!/bin/sh
case "$1" in
    lock)
        i3lock -c 282C34 -n &
        sleep 20 && pgrep i3lock && xset dpms force off
        ;;
    logout)
        i3-msg exit
        ;;
    suspend)
        systemctl suspend
        ;;
    hibernate)
        systemctl hibernate
        ;;
    reboot)
        systemctl reboot
        ;;
    shutdown)
        systemctl poweroff
        ;;
    *)
        echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
        exit 2
esac

exit 0

#!/bin/sh
lock() {
  i3lock -c 282C34 -n
}

case "$1" in
    lock)
        lock
        ;;
    logout)
        i3-msg exit
        ;;
    suspend)
        systemctl suspend
        ;;
    hibernate)
        systemctl hibernate
        ;;
    reboot)
        systemctl reboot
        ;;
    shutdown)
        systemctl poweroff
        ;;
    *)
        echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
        exit 2
esac

exit 0

--- 
+++ 
@@ -1,8 +1,11 @@
 #!/bin/sh
+lock() {
+  i3lock -c 282C34 -n
+}
+
 case "$1" in
     lock)
-        i3lock -c 282C34 -n &
-        sleep 20 && pgrep i3lock && xset dpms force off
+        lock
         ;;
     logout)
         i3-msg exit
Add display of when locked
