From 3b5b7aac644a3d65591041e15ddb6dabea4f3832 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Fri, 21 Aug 2020 20:02:03 +0200 Subject: [PATCH] Add debug function --- ecran | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/ecran b/ecran index a53b27b..9f3f68b 100755 --- a/ecran +++ b/ecran @@ -3,9 +3,32 @@ # Description: Manage video output (size, orientation, ...) # And reload wm configuration -# First and main screen (laptop screen,…) -MAIN_SCREEN="LVDS-1" +# Vars {{{ +## First and main screen (laptop screen,…) +readonly MAIN_SCREEN="LVDS-1" +[ -z "${DEBUG}" ] && readonly DEBUG=0 + +## Colors +readonly PURPLE='\033[1;35m' +readonly RED='\033[0;31m' +readonly RESET='\033[0m' +readonly COLOR_DEBUG="${PURPLE}" +# }}} + +# Functions {{{ +debug_message() { # {{{ + + local_message="${1}" + + ## Print message if DEBUG is enable (=0) + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG − ${PROGNAME}: ${local_message}" + + return 0 +} +# }}} + +# }}} case "${1}" in ds | dockstation | work )