dotfiles

beau's configuration files
git clone https://git.beauhilton.com/dotfiles.git
Log | Files | Refs | README

reload_html (552B)


      1 #!/bin/sh
      2 
      3 # Get the document title because the browser uses it in the window name
      4 WINNAME=`grep '<title>.*</title>' "$1" | sed -e 's/.*<title>\(.*\)<\/title>.*/\1/'`
      5 
      6 # If the title is empty, use the file name
      7 if [ "x$WINNAME" = "x" ]
      8 then
      9     WINNAME=$1
     10 fi
     11 
     12 # Check if the page is already open
     13 xdotool search --name "$WINNAME" windowactivate --sync
     14 
     15 if [ "$?" = "0" ]
     16 then
     17     # The page is open; emulate the F5 key press to refresh it:
     18     xdotool search --name "$WINNAME" key --clearmodifiers F5
     19 else
     20     # Start the browser
     21     chromium "$1" &
     22 fi