Skip to content

Instantly share code, notes, and snippets.

@basiclines
Last active March 27, 2020 08:23
Show Gist options
  • Save basiclines/28e6ab6f42591edf9848c94c235c3fa7 to your computer and use it in GitHub Desktop.
Save basiclines/28e6ab6f42591edf9848c94c235c3fa7 to your computer and use it in GitHub Desktop.
Sets the current browser as default each 1s
#!bin/bash
while true; do
firefox=$(ps aux | grep -v grep | grep -ci "firefox")
safari=$(ps aux | grep -v grep | grep -ci "safari")
opera=$(ps aux | grep -v grep | grep -ci "opera")
brave=$(ps aux | grep -v grep | grep -ci "brave")
chrome=$(ps aux | grep -v grep | grep -ci "chrome")
if [ $firefox -gt 0 ]
then
defaultbrowser firefox
fi
if [ $safari -gt 0 ]
then
defaultbrowser safari
fi
if [ $opera -gt 0 ]
then
defaultbrowser opera
fi
if [ $brave -gt 0 ]
then
defaultbrowser brave
fi
if [ $chrome -gt 0 ]
then
defaultbrowser chrome
fi
echo "Running..."
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment