#!/bin/bash shopt -s nullglob SESSIONS="$( loginctl | awk -v USER="$(whoami)" '$3 == USER {print $1}' )" TYPE="" for S in ${SESSIONS} ; do if loginctl show-session "$S" | awk '$0 == "Active=yes" { A = 1 } ; $0 == "Type=wayland" { W = 1 } ; END { if ( ! ( A && W ) ){ exit 1 } }' ; then TYPE="wayland" break fi done if [ "${TYPE}" = "wayland" ]; then xhost +si:localuser:root fi c_user="$(whoami)" pkexec gufw-pkexec "$c_user"