diff --git a/usr/lib/tik/modules/pre/10-welcome b/usr/lib/tik/modules/pre/10-welcome index 568a857..98e767e 100644 --- a/usr/lib/tik/modules/pre/10-welcome +++ b/usr/lib/tik/modules/pre/10-welcome @@ -13,25 +13,8 @@ displayACWarningMsg() { } checkLaptop() { - chassis=$(cat /sys/class/dmi/id/chassis_type) - # Test for respectively Handheld, Notebook, Laptop, and Portable - # If chassis variable matches 8 9 10 or 11 function continues else it proceeds to test AC power and Battery - [[ "$chassis" =~ ^(8|9|10|11)$ ]] || return - # Tested machine is confirmed mobile - givePowerRecommendation=false - # Only check for AC and Battery power connections with upower - updevices=$(/usr/bin/upower -e | grep -E 'AC|BAT') - for pdev in $updevices; do - # Get detailed info for each AC and BAT device in upower - upinfo=$(/usr/bin/upower -i "$pdev" | grep -E 'online|state') - # Check for discharging state or AC power offline which is equal to no state - if [[ "$upinfo" =~ (discharging|no) ]]; then - # Give power recommendation only once, so set this to true - givePowerRecommendation=true - fi - done - if [ "$givePowerRecommendation" = true ]; then - log "[welcome] AC Power disconnected and Battery is not charging" + if ! systemd-ac-power; then + log "[welcome] AC Power disconnected and battery is not charging" displayACWarningMsg fi }