Last active
April 10, 2019 23:44
-
-
Save deconstructionalism/ea2dc257586aab9d1e985617a68d4b15 to your computer and use it in GitHub Desktop.
put into ~/.bash_profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| atom_resize () { | |
| FONT_SIZE="32px" | |
| BASE_DIR=".atom" | |
| TEACHING_STYLE="teaching-styles.less" | |
| ATOM_STYLE="styles.less" | |
| if grep -q Microsoft /proc/version > /dev/null 2>&1 | |
| then | |
| TEACH_STYLE_PATH=~/winhome/${BASE_DIR}/${TEACHING_STYLE} | |
| ATOM_STYLE_PATH=~/winhome/${BASE_DIR}/${ATOM_STYLE} | |
| else | |
| TEACH_STYLE_PATH=${HOME}/${BASE_DIR}/${TEACHING_STYLE} | |
| ATOM_STYLE_PATH=${HOME}/${BASE_DIR}/${ATOM_STYLE} | |
| fi | |
| if [[ "$1" = "off" ]] | |
| then | |
| COMMENT="//" | |
| elif [[ "$1" =~ ^[1-9]{1}[0-9]*(px|em|%)$ ]] | |
| then | |
| COMMENT="" | |
| FONT_SIZE="$1" | |
| elif [[ -z "$1" ]] | |
| then | |
| COMMENT="" | |
| else | |
| echo "only \"off\" or \"[int](px|em|%)\" acceptable!" | |
| return | |
| fi | |
| cat > ${TEACH_STYLE_PATH} <<EOF | |
| ${COMMENT}@teaching-font-size: ${FONT_SIZE}; | |
| atom-text-editor, html, body, .tree-view, .tab-bar .tab { | |
| ${COMMENT}font-size: @teaching-font-size; | |
| } | |
| EOF | |
| IMPORT_STRING="@import \"${TEACHING_STYLE}\";" | |
| if ! grep -q "${IMPORT_STRING}" "${ATOM_STYLE_PATH}" | |
| then | |
| echo "${IMPORT_STRING}" >> ${ATOM_STYLE_PATH} | |
| fi | |
| cat ${ATOM_STYLE_PATH} > "${ATOM_STYLE_PATH}.tmp" | |
| mv "${ATOM_STYLE_PATH}.tmp" ${ATOM_STYLE_PATH} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment