configs/desktop/scripts/firefox_to_workspace.sh

37 lines
664 B
Bash
Raw Normal View History

2024-02-04 15:59:59 -03:00
#!/bin/bash
# i adapted this script from maze, a dear friend of mine
# maze42d/dotfiles on github
2024-03-03 22:00:48 -03:00
hostname="$(uname -a) | awk '{print $2}'"
if [[ $hostname == "sovereign" ]]; then
firefox_binary="firefox"
else
firefox_binary="firefox-bin"
fi
2024-02-04 15:59:59 -03:00
if [[ -z $1 ]]; then
echo "Usage: $0 <profile> <workspace>"
exit 1
fi
firefox_profile=$1
workspace=$2
echo "$firefox_profile to $workspace"
$firefox_binary -p $firefox_profile &> /dev/null &
PID=$!
command="hyprctl dispatch movetoworkspacesilent ${workspace},pid:$PID"
echo $command
until hyprctl clients | grep "pid: $PID" > /dev/null #wait till window opens
do
sleep 0
done
$command
disown
exit 0