#!/bin/bash running_gui_apps() { applications=() # loop through all open windows (ids) for win_id in $( wmctrl -l | cut -d' ' -f1 ); do # test if window is a normal window if $( xprop -id $win_id _NET_WM_WINDOW_TYPE | grep -q _NET_WM_WINDOW_TYPE_NORMAL ) ; then # get the process ID of the window pid=$( xprop -id $win_id _NET_WM_PID | cut -d' ' -f3 ) # get the process name from the process ID using ps pname=$( ps -p $pid -o comm= ) # add to result list applications+=( "$pname" ) fi done readarray -t applications < <(printf '%s\0' "${applications[@]}" | sort -z | xargs -0n1 | uniq) printf '%s\n' "${applications[@]}" } apps=$(running_gui_apps) apps=$(echo "$apps" | tr '\n' ' ') # killall -STOP $apps # killall -TERM picom #killall -STOP picom killall -STOP waybar # killall -STOP polybar # killall -STOP runtransani.sh #killall -STOP Xorg