diff --git a/.bashrc b/.bashrc index a3ddc5e..22ed3b7 100644 --- a/.bashrc +++ b/.bashrc @@ -29,32 +29,30 @@ esac [ -f /etc/hostname ] && hostname="$(cat /etc/hostname)" -# apply "secret" settings (these are just settings I don't want in git) -[ -f "$HOME"/.bashrc_secrets ] && source "$HOME"/.bashrc_secrets - -# apply work settings -[ -f "$HOME"/.bash_work_stuff ] && source "$HOME"/.bash_work_stuff - # set PATH to something tolerable # NOTE: in Arch, everything's already in /usr/bin, /usr/sbin anyway if [ "$operating_system" = "linux" ]; then PATH="/usr/bin:/usr/local/bin:/bin:/usr/sbin:/usr/local/sbin:/sbin" # base - PATH="$PATH:/var/lib/snapd/snap/bin" # snapd PATH="$PATH:/usr/local/games:/usr/games" # base + PATH="$PATH:/var/lib/snapd/snap/bin" # snapd + PATH="$PATH:$HOME/bin" # secret sauce if [ "$hostname" = "shorefall" ]; then - PATH="$PATH:$HOME/bin" # secret sauce PATH="$PATH:$HOME/bin/jdk-11.0.10+9/bin" # JavaTM PATH="$PATH:$HOME/bin/android-studio/bin" # Android Studio PATH="$PATH:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" fi elif [ "$operating_system" = "macOS" ]; then PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" - PATH="$PATH:/Applications/Vmware Fusion.app/Contents/Public" PATH="$PATH:/Library/Apple/usr/bin" work_set_path "$PATH" fi + +# apply work settings +[ -f "$HOME"/.bash_work_stuff ] && source "$HOME"/.bash_work_stuff + export PATH +export EDITOR="vim" export BROWSER="firefox" if [[ "$operating_system" = "macOS" || "$operating_system" = "BSD" ]] ; then @@ -62,7 +60,10 @@ if [[ "$operating_system" = "macOS" || "$operating_system" = "BSD" ]] ; then fi # use 'nvim' if it exists on system -[ command -v nvim &> /dev/null ] && export EDITOR="nvim" || export EDITOR="vim" +if command -v nvim > /dev/null 2>&1 ; then + export EDITOR="nvim" + alias vim='nvim' +fi # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" @@ -185,7 +186,7 @@ term-color-vals() { # ex - archive extractor # usage: ex -ex() { +universal-extract() { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xjf $1 ;; @@ -206,6 +207,18 @@ ex() { fi } +# prune_bash_history - remove certain frequently-used/"clutter" command entries +# from .bash_history +prune_bash_history() { + sed 's/^l$//g ; s/^ll$//g ; s/^la$//g ; s/^lla$//g ; s/^cl$//g ; s/^ranger$//g' \ + "$HOME"/.bash_history > "$HOME"/.bash_history-BAK + if [ -f "$HOME"/.bash_history-BAK ] ; then + mv "$HOME"/.bash_history-BAK "$HOME"/.bash-history + else + echo "[ERROR] .bash_history-BAK was not created. Aborting..." + fi +} + # public-ip: fetch current public IP address public-ip() { curl 'http://icanhazip.com/' @@ -237,10 +250,7 @@ alias DIE='shutdown now ' alias cp='cp -i ' # confirm before overwriting a file alias df='df -h ' alias fucking='sudo ' -alias goddammit=' ' -alias bottom='top ' alias bc='bc -l ' # makes bc use 'scale=20' by default -alias vim="$EDITOR " alias bashrc="$EDITOR ~/.bashrc" alias vimrc="$EDITOR ~/.vimrc" alias nanorc="nano ~/.config/nano/nanorc" # just for fun! @@ -256,7 +266,7 @@ alias rangre='ranger '; alias rangr='ranger ' # <<<-^^^-: common ranger typos alias gdb='gdb -q ' # muzzle gdb if [ "$hostname" = "shorefall" ]; then - alias i3config="$EDITOR ~/.config/i3/config && i3-msg reload && i3-msg restart" + alias i3config="$EDITOR ~/.config/i3/config && i3-msg reload && i3-msg restart" alias spellcheck='aspell check ' alias iso-date='date --iso-8601=s ' fi diff --git a/.config/i3/screenlocker.sh b/.config/i3/screenlocker.sh index 44009b1..f16dedd 100755 --- a/.config/i3/screenlocker.sh +++ b/.config/i3/screenlocker.sh @@ -15,7 +15,7 @@ rm -f $tmpbg scrot "$tmpbg" # blur the screenshot by resizing and scaling back up (relies on 'imagemagick') -convert "$tmpbg" -filter Gaussian -thumbnail 20% -sample 500% "$tmpbg" +convert "$tmpbg" -filter Gaussian -thumbnail 8% -sample 1250% "$tmpbg" # overlay the icon onto the temporary screenshot convert "$tmpbg" "$icon" -gravity center -composite "$tmpbg" diff --git a/.config/i3/set-screenlocking-for-sleep.sh b/.config/i3/set-screenlocking-for-sleep.sh index ebc42b3..7a65f33 100755 --- a/.config/i3/set-screenlocking-for-sleep.sh +++ b/.config/i3/set-screenlocking-for-sleep.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +user="$USER" + sleep_lock_service_file="/etc/systemd/system/screenlocker.service" screenlocker_file_contents="[Unit] @@ -7,25 +9,24 @@ Description=Starts i3lock on suspend Before=sleep.target [Service] -User=$USER +User=x1phosura Type=forking Environment=DISPLAY=:0 -ExecStart=/home/$USER/.config/i3/screenlocker.sh +ExecStart=/home/x1phosura/.config/i3/screenlocker.sh [Install] WantedBy=sleep.target" if [ "$1" = "set" ]; then - touch "$sleep_lock_service_file" - echo "$screenlocker_file_contents" > "$sleep_lock_service_file" - systemctl enable screenlocker.service + sudo touch "$sleep_lock_service_file" + echo "$screenlocker_file_contents" | sudo tee "$sleep_lock_service_file" + sudo systemctl enable screenlocker.service printf "Screenlocking upon closed lid enabled.\n" elif [ "$1" = "unset" ]; then - systemctl disable screenlocker.service - rm "$sleep_lock_service_file" + sudo systemctl disable screenlocker.service + sudo rm "$sleep_lock_service_file" printf "Screenlocking upon closed lid disabled.\n" - else printf "Invalid arguments. Use 'set' or 'unset'.\n" fi diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 0a33373..270f9f3 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -30,7 +30,8 @@ set viewmode miller set column_ratios 1,3,4 # Which files should be hidden? (regular expression) -set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$ +#set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$ +set hidden_filter ^\.|^lost\+found$|^__(py)?cache__$ # Show hidden files? You can toggle this by typing 'zh' set show_hidden false @@ -92,7 +93,7 @@ set preview_images true # * urxvt-full: # The same as urxvt but utilizing not only the preview pane but the # whole terminal window. -set preview_images_method w3m +set preview_images_method ueberzug # Default iTerm2 font size (see: preview_images_method: iterm2) set iterm2_font_width 8 @@ -233,10 +234,10 @@ set metadata_deep_search false set clear_filters_on_dir_change false # Disable displaying line numbers in main column -set line_numbers false +set line_numbers true # Start line numbers from 1 instead of 0 -set one_indexed false +set one_indexed true # Save tabs on exit set save_tabs_on_exit false diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf index 9038190..ffbd4a6 100644 --- a/.config/ranger/rifle.conf +++ b/.config/ranger/rifle.conf @@ -109,7 +109,7 @@ ext php = php -- "$1" #-------------------------------------------- # Audio without X #------------------------------------------- -mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@" +mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@" mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" ext midi?, terminal, has wildmidi = wildmidi -- "$@" @@ -117,10 +117,12 @@ ext midi?, terminal, has wildmidi = wildmidi -- "$@" #-------------------------------------------- # Video/Audio with a GUI #------------------------------------------- +# Note: flag f has something to do with ranger detaching the process I think, +# so I disabled it for mpv mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" mime ^video|audio, has smplayer, X, flag f = smplayer "$@" -mime ^video, has mpv, X, flag f = mpv -- "$@" -mime ^video, has mpv, X, flag f = mpv --fs -- "$@" +mime ^video, has mpv, X = mpv -- "$@" +#mime ^video, has mpv, X, flag f = mpv -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" mime ^video, has mplayer, X, flag f = mplayer -- "$@" diff --git a/.vimrc b/.vimrc index be268e1..37a8f74 100644 --- a/.vimrc +++ b/.vimrc @@ -7,6 +7,8 @@ " and down when the paragraph is all on one line, use gj and gk. " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"set all& " may affect neovim at certain window sizes + " enable truecolors if available "if has('nvim') || has('termguicolors') " set termguicolors @@ -15,6 +17,7 @@ " TODO: check _if_ mypeachpuff exists, if not, use peachpuff " colorscheme mypeachpuff colorscheme peachpuff +"colorscheme default syntax on set guicursor= "force using block cursor (for neovim) @@ -96,17 +99,15 @@ set autoindent " should automatically indent set noeol " make vim _not_ automatically append newline to files after exiting -" makes words not get cut off and split weirdly at end of border -setlocal linebreak - " autocmd stuff (note: 'au' == 'autocmd') " includes language/filetype-specific settings if has("autocmd") - " applies columns rule even when vim is resized (caused by terminal resizing) + " applies columns rule even when vim resized (caused by terminal resizing) au VimResized * | set columns=84 " set markdown notes to "wordwrap" kinda - au BufRead,BufNewFile *.md setlocal columns=84 + " 'linebreak' makes words not get cut off and split weirdly at end of border + au BufRead,BufNewFile *.md setlocal columns=84 linebreak " turns off tabs-to-spaces conversion for makefiles au FileType make setlocal shiftwidth=8 softtabstop=8 tabstop=8 noexpandtab diff --git a/bin/battery-level.sh b/bin/battery-level.sh new file mode 100755 index 0000000..29edf31 --- /dev/null +++ b/bin/battery-level.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +upower -i $(upower -e | grep BAT) | grep -E "state|to\ full|to\ empty|percentage" +