Multiple scripts that are useful but don't deserve their own repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
multiple_scripts/set-xwindow-icon-by-pid.sh

32 lines
886 B

#!/bin/bash
##############################################################################
# set-xwindow-icon-by-pid
# (c) Steven Saus 2020
# Licensed under the MIT license
#
##############################################################################
ProgramToSearchFor=${1}
IconToUse=$(realpath ${2})
# Icon themes in ~/.gtkrc-2.0 and ~/.config/gtk-3.0/settings.ini
if [ $# -lt 2 ]; then
echo "You must specify a process and FULL PATH to an icon"
exit 1
else
if [ -f ${IconToUse} ];then
psx=$(ps aux | grep $1)
num=$(echo "$psx"|grep --color=auto -c -v -e grep -e $0)
if [ $num -gt 0 ];then
MyPID=$(echo "$psx" | awk '{print $2}')
MyWindowID=$(xdotool search --pid "${MyPID}")
xseticon -id ${MyWindowID} ${IconToUse}
fi
else
echo "There was no icon present!"
exit 1
fi
fi