# vim: set ft=make : # Enable Supergfxctl, a GPU switcher for hybrid laptops. Options: status | enable | disable enable-supergfxctl ACTION="": #!/usr/bin/bash source /usr/lib/ujust/ujust.sh get_status_token() { local service_state service_state="$(systemctl is-enabled supergfxd.service 2>/dev/null || true)" if [[ -z "$service_state" ]]; then return 1 elif [[ "$service_state" == "enabled" ]]; then echo "enable" else echo "disable" fi } get_current_status() { if [[ "$(get_status_token)" == "enable" ]]; then echo "Enabled" else echo "Disabled" fi } enable_supergfxctl() { systemctl enable --now supergfxd.service echo "Supergfxctl is now enabled." } disable_supergfxctl() { systemctl disable --now supergfxd.service echo "Supergfxctl is now disabled." } OPTION="{{ ACTION }}" if [[ "$OPTION" == "help" ]]; then echo "Usage: ujust enable-supergfxctl