From 87217ea8574fc1f60f786551100fe8e799dfd066 Mon Sep 17 00:00:00 2001 From: justmidi Date: Tue, 28 Sep 2021 03:15:24 +0000 Subject: [PATCH] Initial commit --- .gitignore | 1 + clean.sh | 17 ++++++ color.sh | 3 + media.sh | 36 ++++++++++++ pm.sh | 20 +++++++ rc.sh | 11 ++++ shortcuts.sh | 41 +++++++++++++ system_tools.sh | 24 ++++++++ variables.sh | 39 +++++++++++++ wal.sh | 152 ++++++++++++++++++++++++++++++++++++++++++++++++ weather.sh | 4 ++ 11 files changed, 348 insertions(+) create mode 100644 .gitignore create mode 100755 clean.sh create mode 100755 color.sh create mode 100755 media.sh create mode 100755 pm.sh create mode 100755 rc.sh create mode 100755 shortcuts.sh create mode 100755 system_tools.sh create mode 100755 variables.sh create mode 100755 wal.sh create mode 100755 weather.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..faf4dfb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +os diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..7da7edc --- /dev/null +++ b/clean.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +clean(){ + rm ~/.bash* + rm ~/.fehbg + rm ~/.lesshst + rm ~/.python* + rm ~/.Xauthority + rm ~/*png + rm ~/Desktop -rf + rm ~/Downloads/* -rf + rm ~/.screenlayout -rf + rm ~/.node_repl_history + rm ~/.wget-hsts +} + +alias clean='clean 2> /dev/null' diff --git a/color.sh b/color.sh new file mode 100755 index 0000000..e96b479 --- /dev/null +++ b/color.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +alias color='cat ~/.cache/wal/sequences &' diff --git a/media.sh b/media.sh new file mode 100755 index 0000000..bdae296 --- /dev/null +++ b/media.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +alias mbsync="mbsync -c ~/.config/isync/mbsyncrc -a" + +bgmpv(){ + xwinwrap -ov \ + -st \ + -s \ + -nf \ + -b \ + -un \ + -argb \ + -fs \ + -fdt \ + -o 1.0 \ + -d \ + -debug \ + -- mpv "$1" \ + -wid WID \ + --no-osc \ + --no-osd-bar \ + --player-operation-mode=cplayer \ + --panscan=1.0 +} + + +#alias yt="~/.config/fish/media/yt.sh" +#alias dyt="~/.config/fish/media/dyt.sh" +#alias yts # search +#alias dytp # download playlist +#alias ayt # audio +#alias adyt # audio download +#alias adytp # audio download playlist +#alias vyt # video +#alias vdyt # video download +#alias vdytp # video download playlist diff --git a/pm.sh b/pm.sh new file mode 100755 index 0000000..dfe026d --- /dev/null +++ b/pm.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +OS=`cat $XDG_CONFIG_HOME/sh/os` + +[ OS == "alpine" ] && \ + alias install='apk add' && \ + alias uninstall='apk remove' && \ + alias update='apk update' + +[ OS == "void" ] && \ + alias install='xbps-install -Sy' && \ + alias installed='xbps-query -m' && \ + alias uninstall='xbps-remove -Ry' && \ + alias search='xbps-query -Rs' && \ + alias update='xbps-install -Syu' + +[ OS == "debian" ] && \ + alias install='apt install' && \ + alias uninstall='apt remove' && \ + alias update='apt update && apt upgrade -y' diff --git a/rc.sh b/rc.sh new file mode 100755 index 0000000..8d92b23 --- /dev/null +++ b/rc.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +export SH_CONFIG="$HOME"/.config/sh/ +source $SH_CONFIG/variables.sh +source $SH_CONFIG/shortcuts.sh +source $SH_CONFIG/system_tools.sh +source $SH_CONFIG/clean.sh +source $SH_CONFIG/media.sh +source $SH_CONFIG/weather.sh +source $SH_CONFIG/color.sh +source $SH_CONFIG/pm.sh diff --git a/shortcuts.sh b/shortcuts.sh new file mode 100755 index 0000000..39cb092 --- /dev/null +++ b/shortcuts.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +alias cache='cd $XDG_CACHE_HOME' +alias config='cd $XDG_CONFIG_HOME' +alias share='cd $XDG_DATA_HOME' +alias dev='cd "$HOME"/Dev/' +snd(){ + mkdir /tmp/"$1" + cd /tmp/"$1" +} + +alias b=$BROWSER +alias v=$EDITOR + +alias p="printf" + +alias bookmarks='v Media/Docs/misc/bookmarks.md' + +alias desk="$XDG_CONFIG_HOME"/screenlayout/desk.sh +alias mobile="$XDG_CONFIG_HOME"/screenlayout/mobile.sh +alias tv="$XDG_CONFIG_HOME"/screenlayout/tv.sh + +alias gpg="gpg2 --homedir $GNUPGHOME " +alias gpg-agent="gpg-agent --homedir $GNUPGHOME " +alias gpg-connect-agent="gpg-connect-agent --homedir $GNUPGHOME " +alias gpgconf="gpgconf --homedir $GNUPGHOME " +alias gpgsm="gpgsm --homedir $GNUPGHOME " +alias gpgv="gpgv2 --homedir $GNUPGHOME " +alias minecraft="flatpak run com.mojang.Minecraft" +#alias ssh="ssh -F $SSH_CONFIG -i $SSH_ID " +#alias ssh-copy-id="ssh-copy-id -i $SSH_ID " +alias wal='$XDG_CONFIG_HOME/sh/wal.sh' +alias xinit="xinit $XINITRC" +alias xrdb="xrdb -load $XRESOURCES \ + ; grep -v '^color' $XDG_CONFIG_HOME/kitty/kitty.conf \ + > /tmp/kitty \ + ; grep 'color' $XRESOURCES \ + | sed s/^\*color/color/g \ + | sed s/:// \ + >> /tmp/kitty \ + ; mv /tmp/kitty $XDG_CONFIG_HOME/kitty/kitty.conf" diff --git a/system_tools.sh b/system_tools.sh new file mode 100755 index 0000000..f4dec2a --- /dev/null +++ b/system_tools.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +alias .='pwd && ls' +alias ..='cd ..' +alias clip='xclip -selection c' +alias df='df -h' +alias du='du -ch' +#alias extract +alias free='free -h' +alias publicIp='curl ipinfo.io/ip' +alias publicHostname='curl ipinfo.io/hostname' +alias ll='ls -l' +alias l='ls -Al' +alias l1='ls -1' +alias la='ls -A' +alias rm='rm -rf' +alias k='loadkeys colemak' +alias homeSize='la | wc -l' +deformat(){ + sed 's/\x1B[@A-Z\\\]^_]\|\x1B\[[0-9:;<=>?]*[-!"#$%&'"'"'()*+,.\/]*[][\\@A-Z^_`a-z{|}~]//g' +} +pastebin(){ + curl -F'file=@'$1 https://0x0.st +} diff --git a/variables.sh b/variables.sh new file mode 100755 index 0000000..fb58edb --- /dev/null +++ b/variables.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +export BROWSER=firefox +export COLUMNS=80 +export EDITOR=nvim +export LANG=en_US.UTF-8 +export LC_CTYPE=en_US.UTF-8 +export MAIL="$HOME"/Media/Mail +export MANPAGER='nvim +Man! -' +export PAGER='nvimpager' +export PATH +export PRINTER +export TERM="xterm-kitty" +export TMPDIR=/tmp + +export XDG_CACHE_HOME="$HOME"/.cache +export XDG_CONFIG_HOME="$HOME"/.config +export XDG_CONFIG_DIRS="$XDG_CONFIG_HOME":/etc/xdg +export XDG_DATA_HOME="$HOME"/.local/share +export XDG_DATA_DIRS="$XDG_DATA_DIRS":/usr/local/share:/usr/share + +export ANDROID_SDK_HOME="$XDG_CONFIG_HOME"/android +export ANDROID_AVD_HOME="$XDG_DATA_HOME"/android/ +export ANDROID_EMULATOR_HOME="$XDG_DATA_HOME"/android/ +export ADB_VENDOR_KEY="$XDG_CONFIG_HOME"/android +export GNUPGHOME="$XDG_DATA_HOME"/gnupg +export GPG_AGENT_INFO="$XDG_DATA_HOME"/"S.gpg-agent:$(pgrep gpg-agent):1" +export GPG_TTY=$(tty) +export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc +export STACK_ROOT="$XDG_DATA_HOME"/stack +export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +export SSH_CONFIG="$XDG_CONFIG_HOME"/ssh/config +#export SSH_ID="$XDG_CONFIG_HOME"/ssh/id_ed25519 +export WEECHAT_HOME="$XDG_CONFIG_HOME"/weechat +export WGETRC="$XDG_CONFIG_HOME"/wgetrc +export XINITRC="$XDG_CONFIG_HOME"/X11/xinitrc +export XSERVERRC="$XDG_CONFIG_HOME"/X11/xserverrc +export XRESOURCES="$XDG_CONFIG_HOME"/X11/xresources diff --git a/wal.sh b/wal.sh new file mode 100755 index 0000000..544355c --- /dev/null +++ b/wal.sh @@ -0,0 +1,152 @@ +#!/bin/sh + +wallpapers(){ + directories=`ls -d -1 ~/Media/Images/lukesmithxyz/*/ \ + | sed -e 's/\///g' \ + | sed -e 's/.*lukesmithxyz//'` + for i in $directories + do + echo " "${i} + done +} + +usage(){ + echo "Usage: wal [options] + + DESCRIPTION + Sets wallpapers and theme. + + Wallpapers can either be a file, directory, or one of the + genres listed below in the "WALLPAPERS" section. Also, + because any of the "genres" are directories means you can + use them as relative paths to any file in those directories. + + For example: \`wal Cityscapes/cityscape_23.png\` + + OPTIONS + -h | --help) Displays this help message + + -c | --center) Set as centered desktop background + + -f | --fill) Like --scale, but preserves aspect ratio by + zooming the image until it fits. May cut off + corners + + -m | --max) Like --fill, but scale the image to the + maximum size that fits the screen with black + borders on one side + + -p | --print Prints the current location to the background. + + -r | --reload Reloads the color palette with the current + background. + + -s | --scale) Set as scaled desktop background. This will + fill the whole background, but the images' + aspect ratio may not be preserved + + -t | --tile) Set as tiled desktop background + + WALLPAPERS" + wallpapers +} + +set_wallpaper(){ + # FR: config file for different image locations + location="/ . ~/Media/Images ~/Media/Images/lukesmithxyz" + image_types="png jpg jpeg webp" + for l in $location; do + if [ -e $l/$pic ] \ + || [ -d $l/$pic ]; then + wal -n -i $l/$pic + else + for i in $image_types; do + [ -e $l/$pic.$i ] && wal -n -i $l/$pic.$i + done + fi + done + feh --no-fehbg $option "$(< "${HOME}/.cache/wal/wal")" +} + +option="--bg-fill" +options(){ + args=`getopt \ + -o 'hc:f:m:prs:t:' \ + --long 'help,center:,fill:,max:,print,reload,scale:,tile:' \ + -- "$@"` + valid_args=$?; [ $valid_args != "0" ] && usage + eval set -- "$args" + while : + do + case $1 in + -h | --help) usage \ + ; shift \ + ;; + -c | --center) option="--bg-center" \ + && pic="$2" \ + && set_wallpaper \ + ; shift 2 \ + ;; + -f | --fill) option="--bg-fill" \ + && pic="$2" \ + && set_wallpaper \ + ; shift 2 \ + ;; + -m | --max) option="--bg-max" \ + && pic="$2" \ + && set_wallpaper \ + ; shift 2 \ + ;; + -p | --print) cat ~/.cache/wal/wal \ + && echo "" \ + ; shift \ + ;; + -r | --reload) option="--bg-fill" \ + && pic="$(cat ~/.cache/wal/wal)" \ + && set_wallpaper \ + ; shift \ + ;; + -s | --scale) option="--bg-scale" \ + && pic="$2" \ + && set_wallpaper \ + ; shift 2 \ + ;; + -t | --tile) option="--bg-tile" \ + && pic="$2" \ + && set_wallpaper \ + ; shift 2 \ + ;; + --) shift \ + ; break \ + ;; + *) echo -e "Error: Unexpected option $1\n" \ + ; usage \ + ; exit 2 \ + ;; + esac + done +} + +[ $# == 1 ] \ + && ([ $@ == "--help" ] \ + || [ $@ == "-h" ] \ + || [ $@ == "--print" ] \ + || [ $@ == "-p" ] \ + || [ $@ == "--reload" ] \ + || [ $@ == "-r" ]) \ + && options $@ \ + && exit + +[ $# == 1 ] \ + && pic="$1" \ + && set_wallpaper $option $@ \ + && exit + +[ $# != 0 ] \ + && options $@ \ + && exit + +[ $# == 0 ] \ + && echo -e "Error: Arguments required\n" \ + && usage \ + && exit 1 diff --git a/weather.sh b/weather.sh new file mode 100755 index 0000000..4c734f4 --- /dev/null +++ b/weather.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +alias wttr="curl 'https://wttr.in/?m&M&F&A&Q'" +alias doppler='mpv --loop-file=inf "https://radar.weather.gov/lite/N0R/LSX_loop.gif"'