00-button 512 B

123456789101112131415161718192021222324
  1. . /lib/functions.sh
  2. do_button () {
  3. local button
  4. local action
  5. local handler
  6. local min
  7. local max
  8. config_get button $1 button
  9. config_get action $1 action
  10. config_get handler $1 handler
  11. config_get min $1 min
  12. config_get max $1 max
  13. [ "$ACTION" = "$action" -a "$BUTTON" = "$button" -a -n "$handler" ] && {
  14. [ -z "$min" -o -z "$max" ] && eval $handler
  15. [ -n "$min" -a -n "$max" ] && {
  16. [ $min -le $SEEN -a $max -ge $SEEN ] && eval $handler
  17. }
  18. }
  19. }
  20. config_load system
  21. config_foreach do_button button