More misc. changes I guess

This commit is contained in:
Horseshoe Crab 2022-09-08 00:47:16 -07:00
parent 4cb23eb79f
commit 3fc698d0b8
7 changed files with 55 additions and 36 deletions

40
.bashrc
View File

@ -29,32 +29,30 @@ esac
[ -f /etc/hostname ] && hostname="$(cat /etc/hostname)" [ -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 # set PATH to something tolerable
# NOTE: in Arch, everything's already in /usr/bin, /usr/sbin anyway # NOTE: in Arch, everything's already in /usr/bin, /usr/sbin anyway
if [ "$operating_system" = "linux" ]; then if [ "$operating_system" = "linux" ]; then
PATH="/usr/bin:/usr/local/bin:/bin:/usr/sbin:/usr/local/sbin:/sbin" # base 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:/usr/local/games:/usr/games" # base
PATH="$PATH:/var/lib/snapd/snap/bin" # snapd
PATH="$PATH:$HOME/bin" # secret sauce
if [ "$hostname" = "shorefall" ]; then 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/jdk-11.0.10+9/bin" # JavaTM
PATH="$PATH:$HOME/bin/android-studio/bin" # Android Studio PATH="$PATH:$HOME/bin/android-studio/bin" # Android Studio
PATH="$PATH:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" PATH="$PATH:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"
fi fi
elif [ "$operating_system" = "macOS" ]; then elif [ "$operating_system" = "macOS" ]; then
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
PATH="$PATH:/Applications/Vmware Fusion.app/Contents/Public"
PATH="$PATH:/Library/Apple/usr/bin" PATH="$PATH:/Library/Apple/usr/bin"
work_set_path "$PATH" work_set_path "$PATH"
fi fi
# apply work settings
[ -f "$HOME"/.bash_work_stuff ] && source "$HOME"/.bash_work_stuff
export PATH export PATH
export EDITOR="vim"
export BROWSER="firefox" export BROWSER="firefox"
if [[ "$operating_system" = "macOS" || "$operating_system" = "BSD" ]] ; then if [[ "$operating_system" = "macOS" || "$operating_system" = "BSD" ]] ; then
@ -62,7 +60,10 @@ if [[ "$operating_system" = "macOS" || "$operating_system" = "BSD" ]] ; then
fi fi
# use 'nvim' if it exists on system # 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) # make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
@ -185,7 +186,7 @@ term-color-vals() {
# ex - archive extractor # ex - archive extractor
# usage: ex <file> # usage: ex <file>
ex() { universal-extract() {
if [ -f $1 ] ; then if [ -f $1 ] ; then
case $1 in case $1 in
*.tar.bz2) tar xjf $1 ;; *.tar.bz2) tar xjf $1 ;;
@ -206,6 +207,18 @@ ex() {
fi 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: fetch current public IP address
public-ip() { public-ip() {
curl 'http://icanhazip.com/' curl 'http://icanhazip.com/'
@ -237,10 +250,7 @@ alias DIE='shutdown now '
alias cp='cp -i ' # confirm before overwriting a file alias cp='cp -i ' # confirm before overwriting a file
alias df='df -h ' alias df='df -h '
alias fucking='sudo ' alias fucking='sudo '
alias goddammit=' '
alias bottom='top '
alias bc='bc -l ' # makes bc use 'scale=20' by default alias bc='bc -l ' # makes bc use 'scale=20' by default
alias vim="$EDITOR "
alias bashrc="$EDITOR ~/.bashrc" alias bashrc="$EDITOR ~/.bashrc"
alias vimrc="$EDITOR ~/.vimrc" alias vimrc="$EDITOR ~/.vimrc"
alias nanorc="nano ~/.config/nano/nanorc" # just for fun! 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 alias gdb='gdb -q ' # muzzle gdb
if [ "$hostname" = "shorefall" ]; then 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 spellcheck='aspell check '
alias iso-date='date --iso-8601=s ' alias iso-date='date --iso-8601=s '
fi fi

View File

@ -15,7 +15,7 @@ rm -f $tmpbg
scrot "$tmpbg" scrot "$tmpbg"
# blur the screenshot by resizing and scaling back up (relies on 'imagemagick') # 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 # overlay the icon onto the temporary screenshot
convert "$tmpbg" "$icon" -gravity center -composite "$tmpbg" convert "$tmpbg" "$icon" -gravity center -composite "$tmpbg"

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
user="$USER"
sleep_lock_service_file="/etc/systemd/system/screenlocker.service" sleep_lock_service_file="/etc/systemd/system/screenlocker.service"
screenlocker_file_contents="[Unit] screenlocker_file_contents="[Unit]
@ -7,25 +9,24 @@ Description=Starts i3lock on suspend
Before=sleep.target Before=sleep.target
[Service] [Service]
User=$USER User=x1phosura
Type=forking Type=forking
Environment=DISPLAY=:0 Environment=DISPLAY=:0
ExecStart=/home/$USER/.config/i3/screenlocker.sh ExecStart=/home/x1phosura/.config/i3/screenlocker.sh
[Install] [Install]
WantedBy=sleep.target" WantedBy=sleep.target"
if [ "$1" = "set" ]; then if [ "$1" = "set" ]; then
touch "$sleep_lock_service_file" sudo touch "$sleep_lock_service_file"
echo "$screenlocker_file_contents" > "$sleep_lock_service_file" echo "$screenlocker_file_contents" | sudo tee "$sleep_lock_service_file"
systemctl enable screenlocker.service sudo systemctl enable screenlocker.service
printf "Screenlocking upon closed lid enabled.\n" printf "Screenlocking upon closed lid enabled.\n"
elif [ "$1" = "unset" ]; then elif [ "$1" = "unset" ]; then
systemctl disable screenlocker.service sudo systemctl disable screenlocker.service
rm "$sleep_lock_service_file" sudo rm "$sleep_lock_service_file"
printf "Screenlocking upon closed lid disabled.\n" printf "Screenlocking upon closed lid disabled.\n"
else else
printf "Invalid arguments. Use 'set' or 'unset'.\n" printf "Invalid arguments. Use 'set' or 'unset'.\n"
fi fi

View File

@ -30,7 +30,8 @@ set viewmode miller
set column_ratios 1,3,4 set column_ratios 1,3,4
# Which files should be hidden? (regular expression) # 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' # Show hidden files? You can toggle this by typing 'zh'
set show_hidden false set show_hidden false
@ -92,7 +93,7 @@ set preview_images true
# * urxvt-full: # * urxvt-full:
# The same as urxvt but utilizing not only the preview pane but the # The same as urxvt but utilizing not only the preview pane but the
# whole terminal window. # whole terminal window.
set preview_images_method w3m set preview_images_method ueberzug
# Default iTerm2 font size (see: preview_images_method: iterm2) # Default iTerm2 font size (see: preview_images_method: iterm2)
set iterm2_font_width 8 set iterm2_font_width 8
@ -233,10 +234,10 @@ set metadata_deep_search false
set clear_filters_on_dir_change false set clear_filters_on_dir_change false
# Disable displaying line numbers in main column # Disable displaying line numbers in main column
set line_numbers false set line_numbers true
# Start line numbers from 1 instead of 0 # Start line numbers from 1 instead of 0
set one_indexed false set one_indexed true
# Save tabs on exit # Save tabs on exit
set save_tabs_on_exit false set save_tabs_on_exit false

View File

@ -109,7 +109,7 @@ ext php = php -- "$1"
#-------------------------------------------- #--------------------------------------------
# Audio without X # 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 mplayer2 = mplayer2 -- "$@"
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
ext midi?, terminal, has wildmidi = wildmidi -- "$@" ext midi?, terminal, has wildmidi = wildmidi -- "$@"
@ -117,10 +117,12 @@ ext midi?, terminal, has wildmidi = wildmidi -- "$@"
#-------------------------------------------- #--------------------------------------------
# Video/Audio with a GUI # 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 gmplayer, X, flag f = gmplayer -- "$@"
mime ^video|audio, has smplayer, X, flag f = smplayer "$@" mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
mime ^video, has mpv, X, flag f = mpv -- "$@" mime ^video, has mpv, X = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@" #mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -- "$@" mime ^video, has mplayer, X, flag f = mplayer -- "$@"

11
.vimrc
View File

@ -7,6 +7,8 @@
" and down when the paragraph is all on one line, use gj and gk. " " 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 " enable truecolors if available
"if has('nvim') || has('termguicolors') "if has('nvim') || has('termguicolors')
" set termguicolors " set termguicolors
@ -15,6 +17,7 @@
" TODO: check _if_ mypeachpuff exists, if not, use peachpuff " TODO: check _if_ mypeachpuff exists, if not, use peachpuff
" colorscheme mypeachpuff " colorscheme mypeachpuff
colorscheme peachpuff colorscheme peachpuff
"colorscheme default
syntax on syntax on
set guicursor= "force using block cursor (for neovim) 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 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') " autocmd stuff (note: 'au' == 'autocmd')
" includes language/filetype-specific settings " includes language/filetype-specific settings
if has("autocmd") 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 au VimResized * | set columns=84
" set markdown notes to "wordwrap" kinda " 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 " turns off tabs-to-spaces conversion for makefiles
au FileType make setlocal shiftwidth=8 softtabstop=8 tabstop=8 noexpandtab au FileType make setlocal shiftwidth=8 softtabstop=8 tabstop=8 noexpandtab

4
bin/battery-level.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
upower -i $(upower -e | grep BAT) | grep -E "state|to\ full|to\ empty|percentage"