Initial commit
commit
97cc190533
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# usage:
|
||||
# raisewindow firefox
|
||||
#
|
||||
# or, if the binary and window class are dissimilar:
|
||||
# raisewindow firefox-developer firefox
|
||||
# ^binary name ^ partial class name of windows created by this application (xprop)
|
||||
|
||||
CMD=$1
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
CLASS=$2
|
||||
else
|
||||
CLASS=$CMD
|
||||
fi
|
||||
|
||||
function gshell(){
|
||||
gdbus call \
|
||||
--session \
|
||||
--dest org.gnome.Shell \
|
||||
--object-path /org/gnome/Shell \
|
||||
--method org.gnome.Shell.Eval "$1" \
|
||||
| sed -E -e "s/^\(\S+, '//" -e "s/'\)$//"
|
||||
}
|
||||
|
||||
if [[ $XDG_SESSION_TYPE = "wayland" ]]; then
|
||||
RESP=`gshell "
|
||||
global
|
||||
.get_window_actors()
|
||||
.filter(w=>w.meta_window.get_wm_class().toLowerCase()==\"$CLASS\".toLowerCase())[0].meta_window.activate(0)"`
|
||||
if [[ "$RESP" == *undefined ]]; then
|
||||
$CMD;
|
||||
fi
|
||||
else
|
||||
wmctrl -x -a "$CLASS" || ($CMD & notify-send -i "$CLASS" "Starting $CMD");
|
||||
fi
|
Loading…
Reference in New Issue