Oak3s
I did not mean to imply that your logic was wrong, just that I did not understand it.
After all if it fits your purpose it is right for you.
Here is what you have:
;; If frozen and locked
;; then thaw
;; Else
;; If locked
;; then thaw and lock
;; Else
;; freeze and lock
;; "On/Off" status not considered ??
If i were to take a stab at it this is what I would do.
Note that the logic may be wrong for you.
;; Case
;; Layer frozen
;; then Save current settings, thaw and lock and ON
;; Layer locked
;; then Save current settings, freeze
;; Layer Off
;; then Save current settings, set ON
;; End Case
Settings would be saved in a global variable
;; Restore Layer Settings Lisp
;;
;; If global var
;; Loop var & restore settings