Skip to content

Instantly share code, notes, and snippets.

@chearon
Last active January 10, 2018 20:22
Show Gist options
  • Save chearon/7d946faeffe4093256213c26e0efc6a1 to your computer and use it in GitHub Desktop.
Save chearon/7d946faeffe4093256213c26e0efc6a1 to your computer and use it in GitHub Desktop.
Place in your ~/.config/fish/functions folder. The "scroll" command will then toggle macOS/classic style scrollbars to help test websites.
function scroll
set state (defaults read NSGlobalDomain AppleShowScrollBars)
if [ $state = "Automatic" ]
set state "Always"
echo "Scrollbars set to classic (always visible)"
else
set state "Automatic"
echo "Scrollbars set to normal macOS (autohide, zero width)"
end
defaults write NSGlobalDomain AppleShowScrollBars -string $state
# Finder has to restart (but not via the GUI for some reason)
killall Finder
# Chrome has to restart for the scrollbars to change :(
if pgrep "Google Chrome" > /dev/null
and read -n 1 -p "set_color -o brblue; echo -n 'Restart Chrome [y,n]? '; set_color normal" yesno
and [ $yesno = "y" ]
osascript -e 'tell app "Google Chrome" to quit'
sleep 1
open -a "Google Chrome"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment