From 368e526c8a86c730b92b1ebc1a603794b9c68fa6 Mon Sep 17 00:00:00 2001 From: michalspano Date: Sat, 10 Feb 2024 18:35:38 +0100 Subject: [PATCH] #23, #25 Update `.env` -> `.custom` --- {.env => .custom/scripts}/alacritty-theme.sh | 0 {.env => .custom/scripts}/dump-icons | 0 .custom/scripts/facetime.sh | 26 ++++++ .custom/scripts/git-config.sh | 40 ++++++++ {.env => .custom/scripts}/icl.sh | 6 +- {.env => .custom/scripts}/icons_off.scpt | 0 {.env => .custom/scripts}/icons_on.scpt | 0 .../scripts}/init_latex_template.sh | 0 .custom/scripts/lockscreen.scpt | 3 + {.env => .custom/scripts}/new_dekstop.scpt | 0 .../scripts}/secondary-display-on.scpt | 0 {.env => .custom/scripts}/stopwatch.sh | 0 {.env => .custom/scripts}/terminate_ubs.sh | 0 {.env => .custom/scripts}/wthr.sh | 0 .custom/zsh/alias.zsh | 92 +++++++++++++++++++ .custom/zsh/exports.zsh | 16 ++++ {.env => .custom/zsh}/prompt.zsh | 0 {.env => .custom/zsh}/tmux.zsh | 0 {.env => .custom/zsh}/vi-mode.zsh | 0 .env/alias.zsh | 81 ---------------- .env/bun.zsh | 5 - .env/new_desktop.scpt | 8 -- .zshrc | 12 +-- 23 files changed, 187 insertions(+), 102 deletions(-) rename {.env => .custom/scripts}/alacritty-theme.sh (100%) rename {.env => .custom/scripts}/dump-icons (100%) create mode 100755 .custom/scripts/facetime.sh create mode 100755 .custom/scripts/git-config.sh rename {.env => .custom/scripts}/icl.sh (85%) rename {.env => .custom/scripts}/icons_off.scpt (100%) rename {.env => .custom/scripts}/icons_on.scpt (100%) rename {.env => .custom/scripts}/init_latex_template.sh (100%) create mode 100755 .custom/scripts/lockscreen.scpt rename {.env => .custom/scripts}/new_dekstop.scpt (100%) rename {.env => .custom/scripts}/secondary-display-on.scpt (100%) rename {.env => .custom/scripts}/stopwatch.sh (100%) rename {.env => .custom/scripts}/terminate_ubs.sh (100%) rename {.env => .custom/scripts}/wthr.sh (100%) create mode 100644 .custom/zsh/alias.zsh create mode 100644 .custom/zsh/exports.zsh rename {.env => .custom/zsh}/prompt.zsh (100%) rename {.env => .custom/zsh}/tmux.zsh (100%) rename {.env => .custom/zsh}/vi-mode.zsh (100%) delete mode 100644 .env/alias.zsh delete mode 100644 .env/bun.zsh delete mode 100644 .env/new_desktop.scpt diff --git a/.env/alacritty-theme.sh b/.custom/scripts/alacritty-theme.sh similarity index 100% rename from .env/alacritty-theme.sh rename to .custom/scripts/alacritty-theme.sh diff --git a/.env/dump-icons b/.custom/scripts/dump-icons similarity index 100% rename from .env/dump-icons rename to .custom/scripts/dump-icons diff --git a/.custom/scripts/facetime.sh b/.custom/scripts/facetime.sh new file mode 100755 index 0000000..a28a033 --- /dev/null +++ b/.custom/scripts/facetime.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +: ' + Automated Facetime calling for OS X + - call a number from the CLI with facetime.sh + ' + +TARGET="$1" + +__parse_args() { + if [ -z "$TARGET" ]; then + echo "No number specified!" + exit 1 + elif [ "$TARGET" = "-h" ] || [ "$TARGET" = "--help" ]; then + echo "Usage: facetime.sh " + exit 0 + fi +} + +__call_target() { + echo "Calling $TARGET..." + open facetime://$TARGET +} + +__parse_args +__call_target diff --git a/.custom/scripts/git-config.sh b/.custom/scripts/git-config.sh new file mode 100755 index 0000000..12d3419 --- /dev/null +++ b/.custom/scripts/git-config.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# This script is used to switch between different git credentials + +# Usage: git-config.sh +# can be one of the following: +# - personal +# - work +# - uni + +__usage() { + echo "Usage: git-config " + exit 1 +} + +# ensure that the argument is passed +if [ $# -ne 1 ]; then __usage; fi + +# logic to switch between different git credentials + +# personal +if [ $1 = "personal" ]; then + git config --local user.name "michalspano" + git config --local user.email "michal.spano03@gmail.com" + +# work +elif [ $1 = "work" ]; then + git config --local user.name "spanoatctk" + git config --local user.email "michal.spano@ctk.se" + +# uni +elif [ $1 = "uni" ]; then + git config --local user.name "spano" + git config --local user.email "spano@student.chalmers.se" + +# show current git credentials +elif [ $1 = "--show" ] || [ $1 = "-s" ]; then + git config user.name; git config user.email +else __usage # if the argument is not valid +fi diff --git a/.env/icl.sh b/.custom/scripts/icl.sh similarity index 85% rename from .env/icl.sh rename to .custom/scripts/icl.sh index d14a574..9aa60fc 100755 --- a/.env/icl.sh +++ b/.custom/scripts/icl.sh @@ -28,9 +28,11 @@ elif [ -z "$DAY_COUNT" ]; then DAY_COUNT=""; fi # default 0 = today COMMAND="`icalBuddy -eep '*' -f -nc -sd eventsToday+${DAY_COUNT}`" # get events # some names are larger than the width of the terminal; trim them, such that -# they fit within the terminal's width +# they fit within the terminal's width + add extra padding -WIDTH=$(tput cols) # get the width of the current terminal session +PADDING=10 # extra padding to add to the width +WIDTH=$(tput cols) # get the width of the current terminal session +WIDTH=$((WIDTH - PADDING)) # apply padding COMMAND=$(printf "$COMMAND" | sed -E "s/(.{${WIDTH}}).*/\1/") # trim case "$2" in diff --git a/.env/icons_off.scpt b/.custom/scripts/icons_off.scpt similarity index 100% rename from .env/icons_off.scpt rename to .custom/scripts/icons_off.scpt diff --git a/.env/icons_on.scpt b/.custom/scripts/icons_on.scpt similarity index 100% rename from .env/icons_on.scpt rename to .custom/scripts/icons_on.scpt diff --git a/.env/init_latex_template.sh b/.custom/scripts/init_latex_template.sh similarity index 100% rename from .env/init_latex_template.sh rename to .custom/scripts/init_latex_template.sh diff --git a/.custom/scripts/lockscreen.scpt b/.custom/scripts/lockscreen.scpt new file mode 100755 index 0000000..1710ae3 --- /dev/null +++ b/.custom/scripts/lockscreen.scpt @@ -0,0 +1,3 @@ +#!/usr/bin/osascript + +tell application "System Events" to keystroke "q" using {control down, command down} diff --git a/.env/new_dekstop.scpt b/.custom/scripts/new_dekstop.scpt similarity index 100% rename from .env/new_dekstop.scpt rename to .custom/scripts/new_dekstop.scpt diff --git a/.env/secondary-display-on.scpt b/.custom/scripts/secondary-display-on.scpt similarity index 100% rename from .env/secondary-display-on.scpt rename to .custom/scripts/secondary-display-on.scpt diff --git a/.env/stopwatch.sh b/.custom/scripts/stopwatch.sh similarity index 100% rename from .env/stopwatch.sh rename to .custom/scripts/stopwatch.sh diff --git a/.env/terminate_ubs.sh b/.custom/scripts/terminate_ubs.sh similarity index 100% rename from .env/terminate_ubs.sh rename to .custom/scripts/terminate_ubs.sh diff --git a/.env/wthr.sh b/.custom/scripts/wthr.sh similarity index 100% rename from .env/wthr.sh rename to .custom/scripts/wthr.sh diff --git a/.custom/zsh/alias.zsh b/.custom/zsh/alias.zsh new file mode 100644 index 0000000..787cd80 --- /dev/null +++ b/.custom/zsh/alias.zsh @@ -0,0 +1,92 @@ +# ----- { Aliases } --------------------------------------------------------------------- + +# --- { vars } --- changed for every user + +GH_PROFILE="michalspano" # GitHub profile name [personal] +USER_LOCATION="Göteborg" # User location +# USER_LOCATION="Bratislava" # User location [alternative] + +# --- { DEV Tools } --- + +alias v="nvim" # nvim to v +alias f="fish" # fish to f, the shell environment +alias z="zathura" # zathura to z +alias zth="open -a Zathura" # zathura to its .app location (self made; FIXME) +alias nf="neofetch" # neofetch to 'nf'" +alias py="/usr/local/bin/python3" # python3 to py +alias jl="/usr/local/bin/julia" # julia to jl +alias numi="open /Applications/Numi.app" # numi (Application) to numi +alias tex-template="$HOME/.custom/scripts/init_latex_template.sh" # Install personal LaTeX template + +# alias gh="open 'https://github.com/${GH_PROFILE}'" # open github profile + +alias lz="lazygit" # lazygit to lz +alias glw="glow" # glow to glw + +# utlralist aliases +alias u="ultralist" # ultralist to u +alias ul="ultralist l" # show the list of tasks +alias ult="ultralist l --notes" # show the list of tasks with notes +alias up="ultralist prioritize" # prioritize the task + +alias code="code-insiders" # code-insiders to 'code' +alias sketchybar-reset="brew services restart sketchybar" # restart sketchybar via brew services + +alias icl="$HOME/.custom/scripts/icl.sh" # custom tool to show iCal events +alias codesnap="open https://ray.so/" # open codesnap website [custom tool] +alias clr-plt="open https://coolors.co/generate" # generate css color palette + +# --- { System } --- | macOS specific + +alias sys-sleep="pmset sleepnow" # put system to sleep +alias sys-save="open -b com.apple.ScreenSaver.Engine" # enable save screen mode +alias sys-restart="sudo shutdown -r now" # restart system +alias sys-shutdown="sudo shutdown -h now" # shutdown system +alias sys-lock="$HOME/.custom/scripts/lockscreen.scpt" # lock system +alias sys-new-desktop="$HOME/.custom/scripts/new_dekstop.scpt" # create new desktop + +alias icons-on="$HOME/.custom/scripts/icons_on.scpt" # show icons on desktop +alias icons-off="$HOME/.custom/scripts/icons_off.scpt" # hide icons on desktop + +alias sc-monitor-on="open /Applications/DisplayLink\ Manager.app" # secondary monitor on +alias sc-monitor-off="$HOME/.custom/scripts/secondary-display-on.scpt" # secondary monitor off + +# --- { Personal Extensions } --- + +alias wf="curl wttr.in/${USER_LOCATION}\?1nqF" + +# Applications (shortcuts) +alias clndr="open https://calendar.notion.so/" +alias facetime="$HOME/.custom/scripts/facetime.sh" +alias dict="open /System/Applications/Dictionary.app" +alias gg="open /Applications/GeoGebra\ Classic\ 6.app" + +# Ubersicht CII tools +alias ubso="open /Applications/Übersicht.app" # start the app +alias ubsk="$HOME/.custom/scripts/terminate_ubs.sh" # kill the app + +# Spotify CLI +alias sp="spotify" # spotify to 'sp' +alias sps="spotify status" # show current status +alias spn="spotify next" # play next song +alias spp="spotify play" # play song + +alias al-sw="$HOME/.custom/scripts/alacritty-theme.sh" # alacritty theme switcher +alias stopwatch="$HOME/.custom/scripts/stopwatch.sh" # stopwatch +alias pipes="/usr/local/Cellar/pipes-sh/1.3.0/bin/pipes.sh" # pipes.sh - screen-saver + +# --- { Misc. } ---------------------------------------------------------------------- + +# alias number="~/.custom/scripts/count.py" +# alias icons="eval ~/.custom/scripts/dump-icons.zsh" + +# I just love this segment of the song, so I made I shortcut for listening it. +alias bl-ys="open https://soundcloud.com/user-543006032/bladee-radio-stockholm-mix-w-yung-sherman-031221#t=460" + +# osu! + +alias osu="open /Applications/osu!.app" +alias osup="open https://osu.ppy.sh/users/6499212" +alias osub="open https://osu.ppy.sh/beatmapsets" + +# ----- { Aliases } --------------------------------------------------------------------- diff --git a/.custom/zsh/exports.zsh b/.custom/zsh/exports.zsh new file mode 100644 index 0000000..8de96e8 --- /dev/null +++ b/.custom/zsh/exports.zsh @@ -0,0 +1,16 @@ +# ----- { Exports } --------------------------------------------------------------------- + +export LANG=en_US.UTF-8 # Set language to US English +export SEM="$HOME/School/SEM" # BSc. university directory +export PATH="/usr/local/sbin:$PATH" # Update PATH for Homebrew +export PATH="$PATH:/Users/michalspano/.bin" # Add custom bin directory +export XDG_CONFIG_HOME="$HOME/.config" # load lazygit config +export JAVA_HOME=$(/usr/libexec/java_home) # java Home dir +export GEM_HOME="/Users/michalspano/.gem" # ruby gems +export NVIM="$HOME/.config/nvim/init.vim" # neovim init file +export PATH=$PATH:/Users/michalspano/.spicetify # spicetify config +export PATH="/usr/local/opt/mongodb-community@4.4/bin:$PATH" # MongoDB config +export ubs="$HOME/Library/Application Support/Übersicht/widgets" # Location to Uebersich +export icloud="$HOME/Library/Mobile Documents/com~apple~CloudDocs" # Apple iCloud system location + +# ----- { Exports } --------------------------------------------------------------------- diff --git a/.env/prompt.zsh b/.custom/zsh/prompt.zsh similarity index 100% rename from .env/prompt.zsh rename to .custom/zsh/prompt.zsh diff --git a/.env/tmux.zsh b/.custom/zsh/tmux.zsh similarity index 100% rename from .env/tmux.zsh rename to .custom/zsh/tmux.zsh diff --git a/.env/vi-mode.zsh b/.custom/zsh/vi-mode.zsh similarity index 100% rename from .env/vi-mode.zsh rename to .custom/zsh/vi-mode.zsh diff --git a/.env/alias.zsh b/.env/alias.zsh deleted file mode 100644 index c719206..0000000 --- a/.env/alias.zsh +++ /dev/null @@ -1,81 +0,0 @@ -# ----- { Aliases } --------------------------------------------------------------------- - -# --- { vars } --- changed for every user - -GH_PROFILE="michalspano" # GitHub profile name [personal] -USER_LOCATION="Göteborg" # User location - -# --- { DEV Tools } --- - -alias py="/usr/local/bin/python3" -alias jl="/usr/local/bin/julia" - -alias tex-template="$HOME/.env/init_latex_template.sh" # Install personal LaTeX template - -alias gh="open 'https://github.com/${GH_PROFILE}'" # open github profile - -alias lz="lazygit" # lazygit to lz -alias glw="glow" # glow to glw -alias gs="git status" # ghostscript to gs - -# utlralist aliases -alias u="ultralist" # ultralist to u -alias ul="ultralist l" # show the list of tasks -alias ult="ultralist l --notes" # show the list of tasks with notes -alias up="ultralist prioritize" # prioritize the task - -alias zshconfig="source $HOME/.zshrc" -alias nvim-config="nvim ~/.config/nvim" - -alias code="code-insiders" # code-insiders to 'code' -alias sketchybar-reset="brew services restart sketchybar" # restart sketchybar via brew services - -alias icl="$HOME/.env/icl.sh" # custom tool to show iCal events -alias codesnap="open https://ray.so/" # open codesnap website [custom tool] - -# --- { System } --- | macOS specific - -alias sys-sleep="pmset sleepnow" # put system to sleep -alias sys-save="open -b com.apple.ScreenSaver.Engine" # enable save screen mode -alias sys-restart="sudo shutdown -r now" # restart system - -alias icons-on="$HOME/.env/icons_on.scpt" # show icons on desktop -alias icons-off="$HOME/.env/icons_off.scpt" # hide icons on desktop -alias sys-new-desktop="$HOME/.env/new_dekstop.scpt" # create new desktop - -alias sc-monitor-on="open /Applications/DisplayLink\ Manager.app" # secondary monitor on -alias sc-monitor-off="$HOME/.env/secondary-display-on.scpt" # secondary monitor off - -# --- { Personal Extensions } --- - -alias wf="curl wttr.in/${USER_LOCATION}\?1nqF" - -# applications (shortcuts) -alias spendee="open /Applications/Spendee.app" -alias canary="open /Applications/Canary\ Mail.app" -alias dict="open /System/Applications/Dictionary.app" -alias gg="open /Applications/GeoGebra\ Classic\ 6.app" - -# ubersicht cli tools -alias ubso="open /Applications/Übersicht.app" # start the app -alias ubsk="$HOME/.env/terminate_ubs.sh" # kill the app - -# Spotify CLI -alias sp="spotify" # spotify to 'sp' -alias sps="spotify status" # show current status -alias spn="spotify next" # play next song -alias spp="spotify play" # play song - -# alacritty theme switcher -alias al-sw="$HOME/.env/alacritty-theme.sh" # alacritty theme switcher - -# custom stopwatch utility -alias stopwatch="$HOME/.env/stopwatch.sh" # stopwatch - -# --- { EXPORTS } --- | system specific - -export obs="$HOME/Library/Mobile Documents/iCloud~md~obsidian/Documents/" -export icloud="$HOME/Library/Mobile Documents/com~apple~CloudDocs" -export ubs="$HOME/Library/Application Support/Übersicht/widgets" - -# ----- { Aliases } --------------------------------------------------------------------- diff --git a/.env/bun.zsh b/.env/bun.zsh deleted file mode 100644 index e695e3e..0000000 --- a/.env/bun.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# ----- { bun.zsh } --------------------------------------------------------------------- - -export BUN_INSTALL="/Users/michalspano/.bun" -export PATH="$BUN_INSTALL/bin:$PATH" -[ -s "/Users/michalspano/.bun/_bun" ] && source "/Users/michalspano/.bun/_bun" \ No newline at end of file diff --git a/.env/new_desktop.scpt b/.env/new_desktop.scpt deleted file mode 100644 index 66e1a47..0000000 --- a/.env/new_desktop.scpt +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/osascript -# Quoted from: https://apple.stackexchange.com/a/428915 - -tell application "System Events" - do shell script quoted form of "/System/Applications/Mission Control.app/Contents/MacOS/Mission Control" - click button 1 of group "Spaces Bar" of group 1 of group "Mission Control" of process "Dock" - do shell script quoted form of "/System/Applications/Mission Control.app/Contents/MacOS/Mission Control" -end tell diff --git a/.zshrc b/.zshrc index e4ca784..9281a28 100644 --- a/.zshrc +++ b/.zshrc @@ -25,12 +25,12 @@ plugins=( source $ZSH/oh-my-zsh.sh # Initialize OMZ # Load aliases, exports -[ -f ~/.env/alias.zsh ] && source ~/.env/alias.zsh -[ -f ~/.env/exports.zsh ] && source ~/.env/exports.zsh +[ -f ~/.custom/zsh/alias.zsh ] && source ~/.custom/zsh/alias.zsh +[ -f ~/.custom/zsh/exports.zsh ] && source ~/.custom/zsh/exports.zsh -# Load env prompt, VI mode and tmux configurations. -[ -f ~/.env/prompt.zsh ] && source ~/.env/prompt.zsh -[ -f ~/.env/vi-mode.zsh ] && source ~/.env/vi-mode.zsh -[ -f ~/.env/tmux.zsh ] && source ~/.env/tmux.zsh +# Load custom prompt, VI mode and tmux configurations. +[ -f ~/.custom/zsh/prompt.zsh ] && source ~/.custom/zsh/prompt.zsh +[ -f ~/.custom/zsh/vi-mode.zsh ] && source ~/.custom/zsh/vi-mode.zsh +[ -f ~/.custom/zsh/tmux.zsh ] && source ~/.custom/zsh/tmux.zsh # ----- { ~/.zshrc } -----------------------------------------------------------