From 255e76a4c1f1904fbe77018f8b87d261f947622a Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 22 May 2021 17:32:06 +0200 Subject: [PATCH 1/3] add ifs to vim and exa --- general/.aliases | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/general/.aliases b/general/.aliases index 6577618..9c80c51 100755 --- a/general/.aliases +++ b/general/.aliases @@ -5,7 +5,20 @@ # ░▀░░░▀░▀░▀▀▀░▀▀▀░▀░▀░▀░▀░▀░▀░▀▀▀ alias m="ncmpcpp" -alias vim="nvim" + +if command -v nvim; then + alias vim="nvim" + alias vi="nvim" +elif command -v vim; then + alias nvim="vim" + alias vi="vim" +elif command -v vi; then + alias nvim="vi" + alias vim="vi" +else + echo "[ERROR] No vim program found on the system! Couldn't bind aliases!" +fi + alias p="ipython" alias dp="python ~/.scripts/dropbox.py" @@ -13,13 +26,17 @@ alias dp="python ~/.scripts/dropbox.py" # ░█░░░█░█░█░░░█░█░█▀▄ # ░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀ -# alias ls='ls --group-directories-first --color=auto' -# alias ll='ls -alFh --group-directories-first --color=auto' -# alias la='ls -A --group-directories-first --color=auto -F' -alias ls='exa' -alias ll='exa --long --header --git' -alias sl='exa -a --long --header --git' -alias la='exa -a' +if command -v exa; then + alias ls='exa' + alias ll='exa --long --header --git' + alias sl='exa -a --long --header --git' + alias la='exa -a' +else + alias ls='ls --group-directories-first --color=auto' + alias ll='ls -alFh --group-directories-first --color=auto' + alias la='ls -A --group-directories-first --color=auto -F' +fi + alias dir='dir --color=auto' alias vdir='vdir --color=auto' alias grep='grep --color=auto' @@ -83,4 +100,7 @@ alias fixscreen="xrandr --output DP-4 --mode 1920x1080 --pos 0x0 -r 144 --output alias doubleScreen="xrandr --output DP-3 --mode 1920x1080" alias exScreen="xrandr --output DP-3 --mode 1920x1080 --right-of eDP-1" -source ~/.privateAliases +if [[ -e ~/.privateAliases ]]; then + source ~/.privateAliases +fi + From e5f3d478916caca498fc138b5828ea507556dc6c Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 22 May 2021 17:34:22 +0200 Subject: [PATCH 2/3] add if to zsh powerline --- general/.zshrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/general/.zshrc b/general/.zshrc index 824f3a2..4becde8 100644 --- a/general/.zshrc +++ b/general/.zshrc @@ -2,6 +2,9 @@ # Initialize p10k if present if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" + ZSH_THEME="powerlevel10k/powerlevel10k" +else + ZSH_THEME="robbyrussell" fi # Path to your oh-my-zsh installation. @@ -9,8 +12,6 @@ export ZSH="$HOME/.oh-my-zsh" source ~/.aliases -ZSH_THEME="powerlevel10k/powerlevel10k" - plugins=( git vscode @@ -31,4 +32,4 @@ plugins=( source $ZSH/oh-my-zsh.sh # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh \ No newline at end of file +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh From 1d4c035995b2fc475d8d01613239f87cf6783673 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 23 May 2021 03:00:44 +0200 Subject: [PATCH 3/3] misc --- desktop/.aliases.desktop | 7 ++++ desktop/README.md | 1 + general/.aliases | 91 ++++++++++++++++++++++++---------------- laptop/.aliases.laptop | 8 ++++ laptop/README.md | 1 + 5 files changed, 72 insertions(+), 36 deletions(-) create mode 100644 desktop/.aliases.desktop create mode 100644 desktop/README.md create mode 100644 laptop/.aliases.laptop create mode 100644 laptop/README.md diff --git a/desktop/.aliases.desktop b/desktop/.aliases.desktop new file mode 100644 index 0000000..c29558f --- /dev/null +++ b/desktop/.aliases.desktop @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# Fix fn keys for Keychron K1 +alias fixkeys="sudo echo 0 > /sys/module/hid_apple/parameters/fnmode" + +# Fix the screens on Desktop computer +alias fixscreen="xrandr --output DP-4 --mode 1920x1080 --pos 0x0 -r 144 --output DVI-I-1 --primary --mode 1920x1080 --pos 1920x0 -r 144" diff --git a/desktop/README.md b/desktop/README.md new file mode 100644 index 0000000..cc59c60 --- /dev/null +++ b/desktop/README.md @@ -0,0 +1 @@ +# Desktop-specific dotfiles diff --git a/general/.aliases b/general/.aliases index 9c80c51..a99d00d 100755 --- a/general/.aliases +++ b/general/.aliases @@ -1,32 +1,53 @@ #!/usr/bin/env bash +export SCREENSHOT_DIR='~/pictures/screenshots' + # ░█▀█░█▀▄░█▀█░█▀▀░█▀▄░█▀█░█▄█░█▀▀ # ░█▀▀░█▀▄░█░█░█░█░█▀▄░█▀█░█░█░▀▀█ # ░▀░░░▀░▀░▀▀▀░▀▀▀░▀░▀░▀░▀░▀░▀░▀▀▀ alias m="ncmpcpp" -if command -v nvim; then +if command -v nvim &> /dev/null; then alias vim="nvim" alias vi="nvim" -elif command -v vim; then +elif command -v vim &> /dev/null; then alias nvim="vim" alias vi="vim" -elif command -v vi; then +elif command -v vi &> /dev/null; then alias nvim="vi" alias vim="vi" else - echo "[ERROR] No vim program found on the system! Couldn't bind aliases!" + echo -e "\033[31m[ERROR] No vim program found on the system! Couldn't bind aliases!\033[0m" +fi + +if command -v ipython &> /dev/null; then + alias p="ipython" +fi + +if command -v youtube-dl &> /dev/null; then + alias youtube-dl-list='youtube-dl -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio" -o "%(playlist_index)s-%(title)s.%(ext)s"' + alias music-dl='youtube-dl --extract-audio -f "bestaudio[ext=m4a]/best""' + alias music-dl-list='youtube-dl --extract-audio -f "bestaudio[ext=m4a]/best" -o "%(playlist_index)s-%(title)s.%(ext)s"' fi -alias p="ipython" -alias dp="python ~/.scripts/dropbox.py" +if command -v maim &> /dev/null; then + alias skusho='maim -u -k $(echo $SCREENSHOT_DIR)/$(date +%s).png' + + if command -v xclip &> /dev/null; then + alias skushoclip='maim -k -s -u | xclip -selection clipboard -t image/png -i' + fi +fi + +if command -v rsync &> /dev/null; then + alias cp='rsync --progress -h' +fi # ░█▀▀░█▀█░█░░░█▀█░█▀▄ # ░█░░░█░█░█░░░█░█░█▀▄ # ░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀ -if command -v exa; then +if command -v exa &> /dev/null; then alias ls='exa' alias ll='exa --long --header --git' alias sl='exa -a --long --header --git' @@ -43,35 +64,36 @@ alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' +alias echo-colors='for x in 0 1 4 5 7 8; do for i in {30..37}; do for a in {40..47}; do echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "; done; echo; done; done; echo "";' + # ░█▄█░▀█▀░█▀▀░█▀▀ # ░█░█░░█░░▀▀█░█░░ # ░▀░▀░▀▀▀░▀▀▀░▀▀▀ # Cd to git folder -alias gt="cd ~/git" +alias gt='cd ~/git' # Make ftp server -alias makeftp="python -m pyftpdlib --directory=$HOME/ --port=2121" +alias makeftp='python -m pyftpdlib --directory=$HOME/ --port=2121' # Get current Fcitx mode -alias getFcitxMod='qdbus "org.fcitx.Fcitx" "/inputmethod" "GetCurrentIM"' +alias get-fcitx-mode='qdbus "org.fcitx.Fcitx" "/inputmethod" "GetCurrentIM"' -alias youtube-dl-list='youtube-dl -o "%(playlist_index)s-%(title)s.%(ext)s" -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio"' - -cfile() { +c-file() { nvim $($HOME/.scripts/rofi/config-selector.py) } -alias tangleDoomEmacs="cd $HOME/.doom.d && $HOME/.emacs.d/bin/org-tangle config.org && cd -" +alias openfile='~/.scripts/rofi/config-selector.py | xargs nvim' -alias openfile="~/.scripts/rofi/config-selector.py | xargs nvim" +# alias tangle-doom-emacs='cd $HOME/.doom.d && $HOME/.emacs.d/bin/org-tangle config.org && cd -' alias xr='xmonad --recompile' # TODO: Update to paru alias xmr='yay -S xmobar-git --answerclean A --answerdiff N' alias xxmr='xr; xmr' -alias tmuxkillall="tmux ls | awk '{print $1}' | sed 's/://g' | xargs -I{} tmux kill-session -t {}" + +alias killall-tmux='tmux ls | awk '{print $1}' | sed 's/://g' | xargs -I{} tmux kill-session -t {}' alias cd..='cd ..' alias ..='cd ..' @@ -80,27 +102,24 @@ alias ....='cd ../../..' alias .....='cd ../../../..' alias ......='cd ../../../../..' -alias q="exit" +alias q='exit' -alias rainbows='head -n 1000 /dev/random | toilet -f pagga | lolcat' +# Supposed to be used as a pipe: "cat file | rainbow" +alias rainbow='toilet -f pagga | lolcat' -#TODO: Fix dynamic disable and enable (16 was a one time occurence) -alias disableTouch="xinput set-prop 16 'Device Enabled' 0" -alias enableTouch="xinput set-prop 16 'Device Enabled' 1" - -# Connect to home media server -alias plexr=" ssh -L 8443:localhost:32400 -N desktop" - -# Fix fn keys for Keychron K1 -alias fixkeys="sudo echo 0 > /sys/module/hid_apple/parameters/fnmode" - -# Fix the screens on Desktop computer -alias fixscreen="xrandr --output DP-4 --mode 1920x1080 --pos 0x0 -r 144 --output DVI-I-1 --primary --mode 1920x1080 --pos 1920x0 -r 144" - -alias doubleScreen="xrandr --output DP-3 --mode 1920x1080" -alias exScreen="xrandr --output DP-3 --mode 1920x1080 --right-of eDP-1" - -if [[ -e ~/.privateAliases ]]; then - source ~/.privateAliases +if [[ -f ~/.scripts/dropbox.py ]]; then + alias dp="python ~/.scripts/dropbox.py" +fi + +if [[ -f ~/.aliases.private ]]; then + source ~/.aliases.private +fi + +if [[ -f ~/.aliases.desktop ]]; then + source ~/.aliases.desktop +fi + +if [[ -f ~/.aliases.laptop ]]; then + source ~/.aliases.laptop fi diff --git a/laptop/.aliases.laptop b/laptop/.aliases.laptop new file mode 100644 index 0000000..0a6fb0e --- /dev/null +++ b/laptop/.aliases.laptop @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +#TODO: Fix dynamic disable and enable (16 was a one time occurence) +alias disable-touch="xinput set-prop 16 'Device Enabled' 0" +alias enable-touch="xinput set-prop 16 'Device Enabled' 1" + +alias doubleScreen="xrandr --output DP-3 --mode 1920x1080" +alias exScreen="xrandr --output DP-3 --mode 1920x1080 --right-of eDP-1" diff --git a/laptop/README.md b/laptop/README.md new file mode 100644 index 0000000..be6becb --- /dev/null +++ b/laptop/README.md @@ -0,0 +1 @@ +# Laptop-specific dotfiles