Skip to content

Commit

Permalink
kjf
Browse files Browse the repository at this point in the history
  • Loading branch information
ediw8311xht committed Mar 5, 2023
1 parent 6710e13 commit 9b32468
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 154 deletions.
161 changes: 86 additions & 75 deletions bash/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,137 +12,150 @@ PS0=''
PS0+='\e[0 q'
INSERT='$(echo "${PWD/~/\~}" | perl -pe '\''s/^(\/[^\/]*|~)[\/]\K.*(?=\/[^\/]*$)/../g'\'')'
INSERT2='$(echo "${PWD/~/\~}" | perl -pe '\''s/^(\/[^\/]*|~)[\/]\K.*(?=\/[^\/]*$)/../g; s/[^ ]/ /g'\'')'
PS1=''
PS1+='\[\e[1;37m\]['
PS1+='\[\e[m\]'
PS1+='\A\[\e[1;37m\]|'
PS1+='\[\e[1;32m\]'"${INSERT}"'/'
PS1+='\[\e[1;37m\]]\$ '
PS1+='\[\e[m\]'
PS1='>'
#PS1=''
#PS1+='\[\e[1;37m\]['
#PS1+='\[\e[m\]'
#PS1+='\A\[\e[1;37m\]|'
#PS1+='\[\e[1;32m\]'"${INSERT}"'/'
#PS1+='\[\e[1;37m\]]\$ '
#PS1+='\[\e[m\]'
PS2=''
PS2+=' '"${INSERT2}"
#PS2+=' '"${INSERT2}"
# --------------------------------------------------------------------- #
# FUNCTIONS #
# --------------------------------------------------------------------- #
function kup() {
. "$HOME/.secrets"
mps() {
local a='\[\e[00;01;07;34m\]' ; local e='\[\e[00;01m\]' ; local j='\[\e[00;01;34m\]'
local b='\D{%F}' ; local d='\D{%T}' ; local m='\D{%s}'
local f=':\w/:>' ; local h='-\$' ; local i=':\W/:>'
local k='\D{%d-%m-%y}' ; local l='\D{%H%M}'
if [[ "${1,,}" =~ l ]] ; then PROMPT_DIRTRIM="2"; PS1="${a} ${b} | ${d} ${e} ${f} "
elif [[ "${1,,}" =~ m ]] ; then PROMPT_DIRTRIM="1"; PS1="${a} ${k} ${l} ${e} ${i} "
elif [[ "${1,,}" =~ x ]] ; then return 1 #PS1='$(xspec)'
elif [[ "${1,,}" =~ s ]] ; then PS1=" ${m} ${h} "
else return 2 ; fi
PS1+='\[\e[0m\]'
} ; mps 'L'

kup() {
killall 'kiwix-serve'
sleep 3
cd "${KIWIX_DIRECTORY}"
ls
kiwix-serve *.zim \
--verbose \
--daemon \
--nodatealiases \
--address="127.0.0.1" \
--port="${KIWIX_PORT}"
kiwix-serve *.zim --verbose --daemon --nodatealiases --address="127.0.0.1" --port="${KIWIX_PORT}"
}
run_flask() {
cd "$MYWEB"
flask run --cert "${CERT_LOCALHOST}" --key "${KEY_LOCALHOST}"
cd -
}
function cd_from_lf() {
cd_from_lf() {
lf
if a="$(ls -1 -tr /tmp/tmplf* | tail -1)"
then
if a="$(ls -1 -tr /tmp/tmplf* | tail -1)"
then
z="$(cat "${a}")"
if [[ "${PWD}" != "${a}" ]] ; then
cd "$(cat "${a}")" || return 1
fi
trash-put "${a}"
fi
}
function kn() {
kn() {
local IFS=$'\n'
local ns=($(echo "$(grep -Pi '^ [0-9]+\K.*'"${1}"'.*$' <<< $(ps ax))"))
echo "MATCHES GOT: ${#ns[@]}"; echo "${ns[*]}"
}
function cg() {
cg() {
if [[ -z "$*" ]] ; then
compgen -A function -abck | sort | uniq -c | grep -Pio '.+[0-9]+ \K.*'
else
compgen -A -abck | sort | uniq -c | grep -Pio '.+[0-9]+ \K.*'
else
while [[ -n "${1}" ]] ; do
compgen -A function -abck | sort | uniq -c | grep -Pio '.+[0-9]+ \K.*' | grep -Pi "${1}"
compgen -A function -abck | sort | uniq -c | grep -Pio '\(?=>.+[0-9]+ \).*'; shift
done
compgen -A -abck | sort | uniq -c | grep -Pio '.+[0-9]+ \K.*' | grep -Pi "${1}"
compgen -A -abck | sort | uniq -c | grep -Pio '\(?=>.+[0-9]+ \).*'; shift
done
fi
}
function my_cd() {
if [[ "${1}" = '-g' ]] ; then
my_cd() {
if [[ "${1}" = '-g' ]] ; then
cd /; shift 1
fi

cd "${@:-"$(find . -type d | fzf --preview="ls -1 {}" )"}"
}
function vid() {
vid() {
if [[ "${1}" =~ ^-mono ]] ; then local AUD="mono"; shift 1; fi

mpv --audio-channels="${AUD:-"auto"}" "${@:-.}" & disown
}
function upd_pip_z() {
local IFS=$'\n'
upd_pip_z() {
local IFS=$'\n'
local zname="$(date +'%Y%m%d')_pipoutdated.txt"
pip list --outdated > "${zname}"
local A="$(cat "${zname}" | sed '1,2d' | sed -e 's/[ ][ ]*/ /g' | cut -d' ' -f1)"
for i in $A ; do pip install --upgrade "${i}"; done
return "$?"
}
function fpend() {
fpend() {
if [[ "$1" =~ ^-[dD](ate)? ]] ; then shift 1; local MDATE="#$(date)"; fi
if [[ -f "${1}" ]] ; then
for i in "${@:2}" "${MDATE:-"_"}"; do
for i in "${@:2}" "${MDATE:-"_"}"; do
echo "${i}" ' |---| ' "${1}"
echo "${i}" >> "${1}"
done
echo "${i}" >> "${1}"
done
return "$?"
fi
echo "INCORRECT ARGUMENTS"; return 1
}
function addally() {
addally() {
echo '#----------ADDALLY----------# '"${ITEXT}" >> "$HOME/.bashrc"
printf 'alias %s='\''cd "%s"'\'' %s\n\n' \
"${1}" "${PWD/$HOME/\$HOME}" "${ITEXT}" >> "$HOME/.bashrc"
}
function rep_char() {
rep_char() {
local z="${1}"; while ((z--)) ; do echo -n "${2}"; done
}
function nifs() { IFS=$'\n' ; printf 'IFS=%q\n' "${IFS}" ; }
function rifs() { IFS=$' \t\n'; printf 'IFS=%q\n' "${IFS}" ; }
function ppifs() { printf "IFS=%q" "${IFS}"; echo "" ; }
function pifs() { printf "%q" "${IFS}"; echo "" ; }
function acheck() { compgen -c | grep -x "${@}" ; }
function gport_function() { netstat -lntu | grep -Pi "${@:-""}" ; }
function alias_conflict() {
nifs() { IFS=$'\n' ; printf 'IFS=%q\n' "${IFS}" ; }
rifs() { IFS=$' \t\n'; printf 'IFS=%q\n' "${IFS}" ; }
ppifs() { printf "IFS=%q" "${IFS}"; echo "" ; }
pifs() { printf "%q" "${IFS}"; echo "" ; }
acheck() { compgen -c | grep -x "${@}" ; }
gport_function() { netstat -lntu | grep -Pi "${@:-""}" ; }
alias_conflict() {
local beg=' '
echo "------------------------------"
local cvm="$(compgen -c)"
for i in $(alias -p | grep -Pio '^[ \t]*alias[ \t]*\K[^=]*') ; do
for i in $(alias -p | grep -Pio '^[ \t]*alias[ \t]*\K[^=]*') ; do
local wcl="$(grep -x "${i}" <<< "${cvm}" | wc -l)"
if [[ "${wcl}" -gt 1 ]] ; then
echo "${wcl} - ${i}"
if [[ "${wcl}" -gt 1 ]] ; then
echo "${wcl} - ${i}"
if [[ "${1,,}" =~ ^[-][-]?f(ull)?$ ]] ; then
type -a "${i}" |
type -a "${i}" |
sed 's/^/'"${beg}"'/' |
sed 's/.*is aliased to [`][ \t]*/\n'"${beg}""${beg}"'/'
fi
echo "------------------------------"
fi
done
}
function get_alias_fzf() {
get_alias_fzf() {
local prc='grep -Po '
local prc+='"^alias[ \t]*"{}"[=].[ \t]*\K.*" '
local prc+="$HOME/.bashrc"
xcmenu --input --clipboard \
"$(fzf --preview="${prc}" < \
<(alias -p | grep -Pio '^[ \t]*alias[ \t]*\K[^=]*'))"
}
function bash_history_grab() {
bash_history_grab() {
if [[ -n "${2}" ]] ; then
grep -Pi "${2}" "$HOME/.bash_history2" | tail -n "${1}"
grep -Pi "${2}" "$HOME/.bash_history2" | tail -n "${1}"
else
grep -Pi "${1}" "$HOME/.bash_history2"
grep -Pi "${1}" "$HOME/.bash_history2"
fi
}
function killall_loaded() {
killall_loaded() {
local jam="${*}"
if [[ "${*}" =~ ^-p ]] ; then
if [[ "${*}" =~ ^-p ]] ; then
if ! local jam="${jam: 2}" || [[ "${#jam}" -lt 1 ]] ; then
echo "ERROR"; return 1
fi
Expand All @@ -158,12 +171,8 @@ function killall_loaded() {
#---------------------------------------------------------------------- #
#-ALIASES #
#---------------------------------------------------------------------- #
alias rml=' rmlint --no-followlinks \
--keep-all-tagged \
--no-crossdev \
--paranoid \
--progress \
--types="duplicates" '
alias rml=' rmlint --no-followlinks --keep-all-tagged --no-crossdev --paranoid --progress --types="duplicates"'
alias r=' run_flask'
alias z=' zim'
alias m=' mv --no-clobber --verbose'
alias l=' cd_from_lf'
Expand All @@ -177,12 +186,11 @@ alias j=' flask run --cert="$HOME/ADD_TO_TRUSTED/mykey.crt" --key="$HO
alias t=' trash-put'
alias hb=' nvim $HOME/.bash_history2'
alias cl=" printf '\n%.0s_______________________________' {1..400} ; printf '%.0s\n' {1..500} ; clear; echo ''"
# KIWIX
alias k=' kiwix-desktop'
alias kgo=' . "$HOME/.secrets"; cd "${KIWIX_DIRECTORY}"'
alias cp=' cp -i'
alias df=' df -h'
alias fz=' my_cd'
alias fz=' my_cd'
alias fo=' xdg-open "$(fzf)"'
alias fn=' nvim "$(fzf --preview="nvim {}")"'
alias gf=' find / -iname'
Expand Down Expand Up @@ -256,19 +264,18 @@ alias tre=' ps -ejH'
alias trev=' ps axjf'
alias tres=' ps -eHo euser,ruser,suser,fuser,f,comm,label'
alias vcs=' sc-im'
alias phone=' aft-mtp-cli'
alias decl=' declare -f'
alias ht=' htop'
alias pips=' poetry search'
alias sman=' man -K --regex'
alias down=' cd "$HOME/Downloads/"'
alias pics=' cd "$HOME/Pictures/"'
alias aud=' cd "$HOME/Audio/"'
alias docs=' cd "$HOME/Documents/"'
alias spreds=' cd "$HOME/Documents/SPREADSHEETS/"'
alias desk=' cd "$HOME/Desktop/"'
alias down=' cd "$HOME/Downloads/"'
alias pics=' cd "$HOME/Pictures/"'
alias aud=' cd "$HOME/Audio/"'
alias docs=' cd "$HOME/Documents/"'
alias spreds=' cd "$HOME/Documents/SPREADSHEETS/"'
alias desk=' cd "$HOME/Desktop/"'
alias wallz=' cd "$HOME/Pictures/Wallpapers"'
alias nswp=' cd "$HOME/.mynvim/swapfiles/"'
alias nswp=' cd "$HOME/.mynvim/swapfiles/"'
alias git_mt=' git log --pretty=format:"%h %s" --graph'
alias mansec=' man -f'
alias sap=' apropos'
Expand All @@ -279,20 +286,24 @@ alias getfont=' fc-list -v | grep -i '
alias lc=' compgen -c'
alias slc=' compgen -c | grep -i'
alias list_coms=' compgen -c'
alias fnsc=' (read _z; $EDITOR <(xlsfonts | grep -F -- "--0-0-0-0-" | grep -Pi -- "${_z:-''}")) <<<'
alias fnsc=' (read _z; $EDITOR <(xlsfonts | grep -F -- "--0-0-0-0-" | grep -Pi -- "${_z:-''}")) <<<'
alias cz=' ccze -m ansi'
alias fm=' worker'
alias filemanager='worker'
#---------------------------------------------------------------------- #
#-QUICK-ADDED-ALIASES #
#---------------------------------------------------------------------- #
# '{ ControlMask, XK_q, clipcopy, {.i = 0} },
# '{ ControlMask, XK_i, clippaste, {.i = 0} },
# '{ ControlMask, XK_j, kscrolldown, {.i = -1} },
# '{ ControlMask, XK_k, kscrollup, {.i = -1} },
# '{ ControlMask, XK_s, externalpipe, {.v = copyoutput } }
#---------------------------------------------------------------------- #
#-EXPORT #
#---------------------------------------------------------------------- #
export MYKIWIX="$HOME/.local/share/kiwix"
export DOCS="$HOME/Documents/"
export DESK="$HOME/Desktop/"
export DOWN="$HOME/Downloads/"
export DOWN="$HOME/Downloads/"
export PYTHONPATH="${PYTHONPATH}:$HOME/.local/python3.10/site-packages"

export PAGER='most'
Expand All @@ -310,7 +321,7 @@ export NO_AT_BRIDGE=1
export QT_QPA_PLATFORMTHEME="qt5ct"

#---------------------------------------------------------------------- #
#-`PATH` #
#-`PATH` #
#---------------------------------------------------------------------- #
if [ -d "$HOME/bin/" ] ; then PATH="$HOME/bin/:$PATH" ; fi
if [ -d "$HOME/bin/txt2man" ] ; then PATH="$HOME/bin/txt2man:$PATH" ; fi
Expand All @@ -337,5 +348,5 @@ alias pacdneed='pacman -Qet'



#alias reqs=' (read _a ; yay -Qi "${_a}" | grep -Pi "^(Required by:|Optional For:)" | grep -Pi "(Required by|Optional For|[^ \t]+)") <<<'
#alias reqs=' (read _a ; yay -Qi "${_a}" | grep -Pi "^(Required by:|Optional For:)" | grep -Pi "(Required by|Optional For|[^ \t]+)") <<<'

30 changes: 16 additions & 14 deletions i3wm/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# i3 config file (v4)
#-------------------------------------------------SPECIAL-BINDS-----------#
#sticky toggle
set $mode_be exec killall xmessage ; mode
set $xm_hd exec $HOME/bin/xmsg_quick.sh
set $mode_be exec killall xmessage ; mode
set $xm_hd exec $HOME/bin/xmsg_quick.sh
bindsym Mod1+Shift+r exec --no-startup-id "xrdb ~/.Xresources; $HOME/bin/i3wm_config_check.sh --3"
bindsym Mod1+Shift+c exec --no-startup-id "$HOME/.secret_xinit; xrdb ~/.Xresources; $HOME/bin/i3wm_config_check.sh --NOASK --0"
bindsym Mod1+Shift+a --release mode freekey; exec --no-startup-id "sleep 0.2; xdotool key 'ctrl+v'; sleep 0.2; xdotool key 'alt+y'"
Expand All @@ -27,6 +27,7 @@
set $inacti_TEXT #888888
set $unfocu_TEXT #888888
set $focuse_BORD #004f98
#set $focuse_BORD #0088FF
set $inacti_BORD #888888
set $unfocu_BORD #333333
set $focuse_TBAR #004f98
Expand All @@ -43,8 +44,8 @@
set_from_resource $IN_GAPS i3wm.IN_GAPS 0
set_from_resource $OUT_GAPS i3wm.OUT_GAPS 0
set_from_resource $TOP_GAPS i3wm.TOP_GAPS 0
set_from_resource $BOT_GAPS i3wm.TOP_GAPS 0
set_from_resource $R_GAPS i3wm.IN_GAPS 0
set_from_resource $BOT_GAPS i3wm.BOP_GAPS 0
set_from_resource $R_GAPS i3wm.R_GAPS 0
set_from_resource $L_GAPS i3wm.L_GAPS 0
#-------WORKSPACES--------------------------------------------------------#
#-------------------------------LEFT--------#
Expand All @@ -65,10 +66,11 @@
workspace 13 output $MON_3
workspace 14 output $MON_3
#-------------------------------------------------------SETTINGS----------#
smart_gaps on
floating_modifier $mod
focus_follows_mouse yes
floating_maximum_size 1800 x 1080
font pango:Hack 7
font pango:Hack 8
default_border $BORDER_PIXEL
#---GAPS------------------------------------------#
gaps inner 0
Expand All @@ -81,13 +83,13 @@
client.focused $focuse_TBAR $focuse_TBAR $focuse_TEXT $focuse_TBAR $focuse_BORD
client.focused_inactive $inacti_TBAR $inacti_TBAR $inacti_TEXT $inacti_TBAR $inacti_BORD
client.unfocused $unfocu_TBAR $unfocu_TBAR $unfocu_TEXT $unfocu_TBAR $unfocu_BORD
client.focused_tab_title $- $- #000cc2
client.background $-
client.focused_tab_title $- $- #000cc2
client.background $-
#-------------------------------------------------------INCLUDE-----------#
# for_window set border before release_border if you want to include
for_window [all] border $BORDER_PIXEL
# release_border_i3wm.conf needs to be included before others.
include release_border_i3wm.conf
# --------- ("release_border_i3wm.conf") needs to be included before others.
#include release_border_i3wm.conf
include shift_bindings_i3wm.conf
include regular_bindings_i3wm.conf
include modes_i3wm.conf
Expand All @@ -100,11 +102,11 @@
for_window [instance="i3s_note"] floating enable, resize set $WSW $WSH, move scratchpad, scratchpad show, move position center
for_window [instance="i3s_st"] floating enable, resize set $WSW $WSH, move scratchpad, scratchpad show, move position center
for_window [window_role="task_dialog"] floating enable, move position center
for_window [window_role="Preferences"] floating enable, move position center
for_window [window_role="pop-up"] floating enable, move position center
for_window [window_role="bubble"] floating enable, move position center
for_window [window_type="dialog"] floating enable, move position center
for_window [window_type="popup_menu"] floating enable, move position center
for_window [window_role="Preferences"] floating enable, move position center
for_window [window_role="pop-up"] floating enable, move position center
for_window [window_role="bubble"] floating enable, move position center
for_window [window_type="dialog"] floating enable, move position center
for_window [window_type="popup_menu"] floating enable, move position center
for_window [class="Emacs"] floating enable, move scratchpad
for_window [class="Xmessage"] floating enable
no_focus [class="Xmessage"]
Expand Down
Loading

0 comments on commit 9b32468

Please sign in to comment.