Skip to content

Commit

Permalink
Fix soft tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
nalipaz committed Mar 20, 2015
1 parent e31b368 commit bf1fdd1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
Binary file added .poll-xrandr.swp
Binary file not shown.
1 change: 1 addition & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

72 changes: 36 additions & 36 deletions poll-xrandr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# Help
if [ -n "$1" ] && [[ $1 == "--help" || $1 == "-h" ]]; then
case $1 in
-h|--help)
echo "Usage:
case $1 in
-h|--help)
echo "Usage:
poll-xrandr COMMAND [OPTIONS]
Help Options:
Expand All @@ -14,12 +14,12 @@ COMMAND is required and is a command to be executed on any detected change to xr
Application Options:
-i, --interval The interval for polling, defaults to 4 seconds (-i=4)
" ;;
*)
poll-xrandr --help
;;
esac
exit
" ;;
*)
poll-xrandr --help
;;
esac
exit
fi

i=4 # default interval for polling.
Expand All @@ -28,31 +28,31 @@ connected="$(xrandr -q | grep " connected"|cut -d ' ' -f1|xargs)"

# Endless loop
while : ; do
# Re-read the status
#new_cat="`cat $f`"
connected_recheck="$(xrandr -q | grep " connected"|cut -d ' ' -f1|xargs)"

# If original contents don't match new we need to run command.
if [ "$connected" != "$connected_recheck" ]; then
# Set the original contents the same as new to avoid unnecessarily repeating
connected=$connected_recheck
autorandr --change
fi

shift 1
while [[ $# > 0 ]]; do
key=$1

case $key in
-i=*|--interval=*)
i="${key#*=}"
;;
*)
echo "Unknown option provided, you should fix that."
;;
esac
shift
done

sleep $i
# Re-read the status
#new_cat="`cat $f`"
connected_recheck="$(xrandr -q | grep " connected"|cut -d ' ' -f1|xargs)"

# If original contents don't match new we need to run command.
if [ "$connected" != "$connected_recheck" ]; then
# Set the original contents the same as new to avoid unnecessarily repeating
connected=$connected_recheck
autorandr --change --force
fi

shift 1
while [[ $# > 0 ]]; do
key=$1

case $key in
-i=*|--interval=*)
i="${key#*=}"
;;
*)
echo "Unknown option provided, you should fix that."
;;
esac
shift
done

sleep $i
done

0 comments on commit bf1fdd1

Please sign in to comment.