bashrc & zshrc: Fix #24 .

OS X settings aren't set automatically anymore, they are now three
different functions.

osx-show-hidden-files
osx-airdrop-listenall
osx-set-updatecheck
This commit is contained in:
Mikaela Suomalainen 2014-05-13 15:34:24 +03:00
parent 75d550b1a2
commit ad49056022
2 changed files with 63 additions and 23 deletions

43
bashrc
View File

@ -233,17 +233,6 @@ export LESS_TERMCAP_us=$'\E[01;32m'
UNAME=`uname` UNAME=`uname`
CPUARCH=`uname -p` CPUARCH=`uname -p`
# If we are on Mac, show hidden files in Finder and enable AirDrop over Ethernet and on unsupported (by Apple) Macs
if [ $UNAME = "Darwin" ]; then
defaults write com.apple.finder AppleShowAllFiles TRUE && defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1
fi
# If we are on Mac, set update check interval to 1 day
if [[ $UNAME = "Darwin" && $USER = "root" ]]; then
defaults write /Library/Preferences/com.apple.SoftwareUpdate ScheduleFrequency 1
fi
# The above requires at least Mountain Lion.
# If we are on Linux, enable apt progress bar and colours # If we are on Linux, enable apt progress bar and colours
if [[ $USER = "root" ]]; then if [[ $USER = "root" ]]; then
mkdir -p /etc/apt/apt.conf.d/ mkdir -p /etc/apt/apt.conf.d/
@ -754,6 +743,38 @@ fi
} }
# Show hidden files in OS X.
function osx-show-hidden-files {
if [ "$1" = "TRUE" ] || ["$1" = 1 ] ; then
$USERCHOICE = "TRUE"
else
$USERCHOICE = 0
fi
defaults write com.apple.finder AppleShowAllFiles $USERCHOICE
echo "defaults write com.apple.finder AppleShowAllFiles $USERCHOICE"
}
# Enable AirDrop on unsupported Macs + Ethernet.
function osx-airdrop-listenall {
if [ "$1" = "TRUE" ] || ["$1" = 1 ] ; then
$USERCHOICE = "TRUE"
else
$USERCHOICE = 0
fi
defaults write com.apple.NetworkBrowser BrowseAllInterfaces $USERCHOICE
echo "defaults write com.apple.NetworkBrowser BrowseAllInterfaces $USERCHOICE"
}
# Check the time how often updates are checked on OS X.
function osx-set-updatecheck {
defaults write /Library/Preferences/com.apple.SoftwareUpdate ScheduleFrequency $1
echo "defaults write /Library/Preferences/com.apple.SoftwareUpdate ScheduleFrequency $1"
}
# .custom # .custom
if [ -f ~/.custom ]; then if [ -f ~/.custom ]; then
source ~/.custom source ~/.custom

43
zshrc
View File

@ -173,16 +173,6 @@ UNAME=`uname`
export SSH_AUTH_SOCK=/tmp/$USER.agent export SSH_AUTH_SOCK=/tmp/$USER.agent
ssh-agent -a /tmp/$USER.agent > /dev/null 2>&1 ssh-agent -a /tmp/$USER.agent > /dev/null 2>&1
# If we are on Mac, show hidden files in Finder and enable AirDrop over Ethernet and on unsupported (by Apple) Macs
if [[ $UNAME = "Darwin" ]]; then
defaults write com.apple.finder AppleShowAllFiles TRUE && defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1
fi
# If we are on Mac, set update check interval to 1 day
if [[ $UNAME = "Darwin" && $USER = "root" ]]; then
defaults write /Library/Preferences/com.apple.SoftwareUpdate ScheduleFrequency 1
fi
# If we are on Linux, enable apt progress bar and colours # If we are on Linux, enable apt progress bar and colours
if [[ $USER = "root" ]]; then if [[ $USER = "root" ]]; then
mkdir -p /etc/apt/apt.conf.d/ mkdir -p /etc/apt/apt.conf.d/
@ -191,8 +181,6 @@ if [[ $USER = "root" ]]; then
echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color
fi fi
# The above requires at least Mountain Lion.
# In our series useless/weird environment variables, beep # In our series useless/weird environment variables, beep
export beep= export beep=
export BEEP= export BEEP=
@ -726,6 +714,37 @@ fi
} }
# Show hidden files in OS X.
function osx-show-hidden-files {
if [ "$1" = "TRUE" ] || ["$1" = 1 ] ; then
$USERCHOICE = "TRUE"
else
$USERCHOICE = 0
fi
defaults write com.apple.finder AppleShowAllFiles $USERCHOICE
echo "defaults write com.apple.finder AppleShowAllFiles $USERCHOICE"
}
# Enable AirDrop on unsupported Macs + Ethernet.
function osx-airdrop-listenall {
if [ "$1" = "TRUE" ] || ["$1" = 1 ] ; then
$USERCHOICE = "TRUE"
else
$USERCHOICE = 0
fi
defaults write com.apple.NetworkBrowser BrowseAllInterfaces $USERCHOICE
echo "defaults write com.apple.NetworkBrowser BrowseAllInterfaces $USERCHOICE"
}
# Check the time how often updates are checked on OS X.
function osx-set-updatecheck {
defaults write /Library/Preferences/com.apple.SoftwareUpdate ScheduleFrequency $1
echo "defaults write /Library/Preferences/com.apple.SoftwareUpdate ScheduleFrequency $1"
}
# Source files for miscannellious modifications. # Source files for miscannellious modifications.