Compare commits
7 commits
08a46ed691
...
3cee46358e
Author | SHA1 | Date | |
---|---|---|---|
3cee46358e | |||
a27d86942b | |||
ea95ca7dfa | |||
572fa471ae | |||
5ee71ae705 | |||
792e0b930a | |||
701c5bbcfc |
10 changed files with 96 additions and 59 deletions
|
@ -22,7 +22,7 @@ alias gcn!='git commit -v --no-edit --amend'
|
||||||
|
|
||||||
if version_at_least 2.23 "$git_version"; then
|
if version_at_least 2.23 "$git_version"; then
|
||||||
alias gcm='git switch master 2>/dev/null || git switch main'
|
alias gcm='git switch master 2>/dev/null || git switch main'
|
||||||
alias gcd='git switch develop'
|
alias gcd='git switch develop 2>/dev/null || git switch staging'
|
||||||
alias gcb='git switch -c'
|
alias gcb='git switch -c'
|
||||||
else
|
else
|
||||||
alias gcm='git checkout master 2>/dev/null || git checkout main'
|
alias gcm='git checkout master 2>/dev/null || git checkout main'
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
IMAPAccount gmail
|
IMAPAccount gmail
|
||||||
# Address to connect to
|
# Address to connect to
|
||||||
Host imap.gmail.com
|
Host imap.gmail.com
|
||||||
UserCmd "gpg2 --decrypt --no-tty --quiet --no-verbose --for-your-eyes-only --pinentry-mode ask ~/.local/share/pass/misc/aerc-gmail-app-password.gpg | grep username | cut -d: -f2"
|
UserCmd "pass show misc/aerc-gmail-app-password | grep username | cut -d: -f2"
|
||||||
PassCmd "gpg2 --decrypt --no-tty --quiet --no-verbose --for-your-eyes-only --pinentry-mode ask ~/.local/share/pass/misc/aerc-gmail-app-password.gpg | head -n1"
|
PassCmd "pass show misc/aerc-gmail-app-password | head -n1"
|
||||||
# To store the password in an encrypted file use PassCmd instead of Pass
|
# To store the password in an encrypted file use PassCmd instead of Pass
|
||||||
# PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"
|
# PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Runs mbsync, with pre-hooks and post-hooks
|
# Runs mbsync, with pre-hooks and post-hooks
|
||||||
# by default, the pre-hook first runs imapfilter
|
# by default, the pre-hook first runs imapfilter
|
||||||
|
@ -38,7 +38,9 @@
|
||||||
# MBSYNC_NOTIFY=1
|
# MBSYNC_NOTIFY=1
|
||||||
# MBSYNC_PASSWORD_FILE="/path/to/gpg/file.gpg"
|
# MBSYNC_PASSWORD_FILE="/path/to/gpg/file.gpg"
|
||||||
|
|
||||||
PASSWORD_FILE="${MBSYNC_PASSWORD_FILE:-$HOME/.local/share/pass/misc/aerc-gmail-app-password.gpg}"
|
# What to run before and after decrypting the password file.
|
||||||
|
PASSWORD_CMD="pass open -t 1min"
|
||||||
|
# POST_PASSWORD_CMD=""
|
||||||
|
|
||||||
prehook() {
|
prehook() {
|
||||||
if [ -n "$MBSYNC_PRE" ]; then
|
if [ -n "$MBSYNC_PRE" ]; then
|
||||||
|
@ -83,7 +85,7 @@ checkonline() {
|
||||||
# warn user that he has to enter his password in a moment
|
# warn user that he has to enter his password in a moment
|
||||||
# to stop catching him offguard or entering something by accident
|
# to stop catching him offguard or entering something by accident
|
||||||
checkwarnuser() {
|
checkwarnuser() {
|
||||||
agt=$(gpg2 --decrypt --no-tty --quiet --no-verbose --for-your-eyes-only --pinentry-mode cancel "$PASSWORD_FILE" 2>&1)
|
enablegpgagent
|
||||||
if echo "$agt" | grep -qE 'No secret key'; then
|
if echo "$agt" | grep -qE 'No secret key'; then
|
||||||
notify "Mail" "Password phrase needed!"
|
notify "Mail" "Password phrase needed!"
|
||||||
sleep 2.5
|
sleep 2.5
|
||||||
|
@ -91,10 +93,22 @@ checkwarnuser() {
|
||||||
}
|
}
|
||||||
|
|
||||||
enablegpgagent() {
|
enablegpgagent() {
|
||||||
## get password from user
|
[ -n "$agt" ] && return
|
||||||
agt=$(gpg2 --decrypt --no-tty --quiet --no-verbose --for-your-eyes-only --pinentry-mode ask "$PASSWORD_FILE" 2>&1)
|
|
||||||
|
if [ -n "$PASSWORD_CMD" ]; then
|
||||||
|
IFS=" " read -r -a PASSWORD_CMD <<<"$PASSWORD_CMD"
|
||||||
|
# shellcheck disable=SC2068
|
||||||
|
agt=$(${PASSWORD_CMD[@]})
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$POST_PASSWORD_CMD" ]; then
|
||||||
|
IFS=" " read -r -a POST_PASSWORD_CMD <<<"$POST_PASSWORD_CMD"
|
||||||
|
"${POST_PASSWORD_CMD[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
## exit program after first failed attempt
|
## exit program after first failed attempt
|
||||||
if echo "$agt" | grep -qE 'decryption failed'; then
|
if echo "$agt" | grep -qE 'decryption failed' ||
|
||||||
|
echo "$agt" | grep -qE 'No such file'; then
|
||||||
notify "Mail" "Process aborted."
|
notify "Mail" "Process aborted."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -247,10 +247,9 @@ map.v['g<c-a>'] = '<Plug>(dial-increment-additional)'
|
||||||
map.v['g<c-x>'] = '<Plug>(dial-decrement-additional)'
|
map.v['g<c-x>'] = '<Plug>(dial-decrement-additional)'
|
||||||
|
|
||||||
-- PLUGIN: zettelkasten.nvim
|
-- PLUGIN: zettelkasten.nvim
|
||||||
map.n.nore['<cr>'] =
|
map.n.nore['<cr>'] = [[:silent lua require 'zettelkasten'.link_follow()<cr>]]
|
||||||
[[:silent lua require 'zettelkasten'.open_or_make_link()<cr>]]
|
map.v.nore['<cr>'] = [[:lua require 'zettelkasten'.link_follow(true)<cr>]]
|
||||||
map.v.nore['<cr>'] = [[:lua require 'zettelkasten'.open_or_make_link(true)<cr>]]
|
map.n.nore['<leader>ww'] = [[:lua require 'zettelkasten'.index_open()<cr> ]]
|
||||||
map.n.nore['<leader>ww'] = [[:lua require 'zettelkasten'.open_index()<cr> ]]
|
|
||||||
|
|
||||||
-- PLUGIN: toggleterm.nvim
|
-- PLUGIN: toggleterm.nvim
|
||||||
-- create a lazygit window, set up in toggleterm settings
|
-- create a lazygit window, set up in toggleterm settings
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
# see the recent downloads, just press "sd".
|
# see the recent downloads, just press "sd".
|
||||||
#
|
#
|
||||||
# Thorsten Wißmann, 2015 (thorsten` on Libera Chat)
|
# Thorsten Wißmann, 2015 (thorsten` on Libera Chat)
|
||||||
# Refactored to work with bemenu by Marty Oehme, 2021 (@martyo@matrix.org on Matrix)
|
# Marty Oehme, 2021 (@martyo@matrix.org on Matrix), refactored to work with bemenu
|
||||||
# Any feedback is welcome!
|
# Any feedback is welcome!
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
@ -25,10 +25,10 @@ set -e
|
||||||
DOWNLOAD_DIR=${DOWNLOAD_DIR:-${QUTE_DOWNLOAD_DIR:-$HOME/downloads}}
|
DOWNLOAD_DIR=${DOWNLOAD_DIR:-${QUTE_DOWNLOAD_DIR:-$HOME/downloads}}
|
||||||
# the name of the rofi-like command
|
# the name of the rofi-like command
|
||||||
if [ -n "$ROFI_CMD" ]; then
|
if [ -n "$ROFI_CMD" ]; then
|
||||||
:
|
:
|
||||||
elif command -v rofi >/dev/null 2>&1; then
|
elif command -v rofi >/dev/null 2>&1; then
|
||||||
ROFI_CMD="rofi"
|
ROFI_CMD="rofi"
|
||||||
ROFI_ARGS=${ROFI_ARGS:-(
|
ROFI_ARGS=${ROFI_ARGS:-(
|
||||||
-monitor -2 # place above window
|
-monitor -2 # place above window
|
||||||
-location 6 # aligned at the bottom
|
-location 6 # aligned at the bottom
|
||||||
-width 100 # use full window width
|
-width 100 # use full window width
|
||||||
|
@ -39,48 +39,48 @@ elif command -v rofi >/dev/null 2>&1; then
|
||||||
-p 'Open download:' -dmenu
|
-p 'Open download:' -dmenu
|
||||||
)}
|
)}
|
||||||
elif command -v bemenu >/dev/null 2>&1; then
|
elif command -v bemenu >/dev/null 2>&1; then
|
||||||
ROFI_CMD="bemenu"
|
ROFI_CMD="bemenu"
|
||||||
ROFI_ARGS="${ROFI_ARGS:--il 10}"
|
ROFI_ARGS="${ROFI_ARGS:--il 10}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg() {
|
msg() {
|
||||||
local cmd="$1"
|
local cmd="$1"
|
||||||
shift
|
shift
|
||||||
local msg="$*"
|
local msg="$*"
|
||||||
if [ -z "$QUTE_FIFO" ]; then
|
if [ -z "$QUTE_FIFO" ]; then
|
||||||
echo "$cmd: $msg" >&2
|
echo "$cmd: $msg" >&2
|
||||||
else
|
else
|
||||||
echo "message-$cmd '${msg//\'/\\\'}'" >>"$QUTE_FIFO"
|
echo "message-$cmd '${msg//\'/\\\'}'" >>"$QUTE_FIFO"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
die() {
|
die() {
|
||||||
msg error "$*"
|
msg error "$*"
|
||||||
if [ -n "$QUTE_FIFO" ]; then
|
if [ -n "$QUTE_FIFO" ]; then
|
||||||
# when run as a userscript, the above error message already informs the
|
# when run as a userscript, the above error message already informs the
|
||||||
# user about the failure, and no additional "userscript exited with status
|
# user about the failure, and no additional "userscript exited with status
|
||||||
# 1" is needed.
|
# 1" is needed.
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! [ -d "$DOWNLOAD_DIR" ]; then
|
if ! [ -d "$DOWNLOAD_DIR" ]; then
|
||||||
die "Download directory »$DOWNLOAD_DIR« not found!"
|
die "Download directory »$DOWNLOAD_DIR« not found!"
|
||||||
fi
|
fi
|
||||||
if ! command -v "${ROFI_CMD}" >/dev/null; then
|
if ! command -v "${ROFI_CMD}" >/dev/null; then
|
||||||
die "Rofi command »${ROFI_CMD}« not found in PATH!"
|
die "Rofi command »${ROFI_CMD}« not found in PATH!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
crop-first-column() {
|
crop-first-column() {
|
||||||
cut -d' ' -f2
|
cut -d' ' -f2-
|
||||||
}
|
}
|
||||||
|
|
||||||
ls-files() {
|
ls-files() {
|
||||||
# add the slash at the end of the download dir enforces to follow the
|
# add the slash at the end of the download dir enforces to follow the
|
||||||
# symlink, if the DOWNLOAD_DIR itself is a symlink
|
# symlink, if the DOWNLOAD_DIR itself is a symlink
|
||||||
# sort by newest
|
# sort by newest
|
||||||
find "${DOWNLOAD_DIR}/" -maxdepth 1 -type f -printf "%T+ %f\n" | sort -r
|
find "${DOWNLOAD_DIR}/" -maxdepth 1 -type f -printf "%T+ %f\n" | sort -r
|
||||||
}
|
}
|
||||||
|
|
||||||
mapfile -t entries < <(ls-files)
|
mapfile -t entries < <(ls-files)
|
||||||
|
@ -88,14 +88,14 @@ mapfile -t entries < <(ls-files)
|
||||||
# we need to manually check that there are items, because rofi doesn't show up
|
# we need to manually check that there are items, because rofi doesn't show up
|
||||||
# if there are no items and -no-custom is passed to rofi.
|
# if there are no items and -no-custom is passed to rofi.
|
||||||
if [ "${#entries[@]}" -eq 0 ]; then
|
if [ "${#entries[@]}" -eq 0 ]; then
|
||||||
die "Download directory »${DOWNLOAD_DIR}« empty"
|
die "Download directory »${DOWNLOAD_DIR}« empty"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
line=$(printf '%s\n' "${entries[@]}" |
|
line=$(printf '%s\n' "${entries[@]}" \
|
||||||
crop-first-column |
|
| crop-first-column \
|
||||||
$ROFI_CMD "${ROFI_ARGS[@]}") || true
|
| $ROFI_CMD "${ROFI_ARGS[@]}") || true
|
||||||
if [ -z "$line" ]; then
|
if [ -z "$line" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg info "file is $line"
|
msg info "file is $line"
|
||||||
|
@ -104,7 +104,7 @@ filetype=$(xdg-mime query filetype "$path")
|
||||||
application=$(xdg-mime query default "$filetype")
|
application=$(xdg-mime query default "$filetype")
|
||||||
|
|
||||||
if [ -z "$application" ]; then
|
if [ -z "$application" ]; then
|
||||||
die "Do not know how to open »$line« of type $filetype"
|
die "Do not know how to open »$line« of type $filetype"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg info "Opening »$line« (of type $filetype) with ${application%.desktop}"
|
msg info "Opening »$line« (of type $filetype) with ${application%.desktop}"
|
||||||
|
|
|
@ -61,6 +61,8 @@ if exist fzf; then
|
||||||
fzf_pkg_tool=yay
|
fzf_pkg_tool=yay
|
||||||
elif exist paru; then
|
elif exist paru; then
|
||||||
fzf_pkg_tool=paru
|
fzf_pkg_tool=paru
|
||||||
|
elif exist pacman; then
|
||||||
|
fzf_pkg_tool=pacman
|
||||||
fi
|
fi
|
||||||
# shellcheck disable=2139 # we *want* this to be done at shell startup instead of dynamically
|
# shellcheck disable=2139 # we *want* this to be done at shell startup instead of dynamically
|
||||||
if [ -n "$fzf_pkg_tool" ]; then
|
if [ -n "$fzf_pkg_tool" ]; then
|
||||||
|
@ -89,6 +91,4 @@ fi
|
||||||
if exist vifm; then
|
if exist vifm; then
|
||||||
alias vm=vifm
|
alias vm=vifm
|
||||||
alias vmm='vifm ${PWD}'
|
alias vmm='vifm ${PWD}'
|
||||||
# enable picture preview script
|
|
||||||
exist vifmrun && alias vifm=vifmrun
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# more usage instructions at https://github.com/clvv/fasd
|
# more usage instructions at https://github.com/clvv/fasd
|
||||||
# eval "$(fasd --init posix-hook posix_alias bash-hook zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)"
|
# eval "$(fasd --init posix-hook posix_alias bash-hook zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)"
|
||||||
type fasd >/dev/null 2>&1 && eval "$(fasd --init auto)"
|
exist fasd && eval "$(fasd --init auto)"
|
||||||
|
|
||||||
# any
|
# any
|
||||||
alias a='fasd -a'
|
alias a='fasd -a'
|
||||||
|
|
11
sh/.config/sh/alias.d/sfz.sh
Normal file
11
sh/.config/sh/alias.d/sfz.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
## Quickly bring up a file server for
|
||||||
|
# the current directory.
|
||||||
|
|
||||||
|
if exist sfz; then
|
||||||
|
alias serve="sfz"
|
||||||
|
elif exist gossa; then
|
||||||
|
alias serve="gossa"
|
||||||
|
elif exist rossa; then
|
||||||
|
alias serve="rossa"
|
||||||
|
fi
|
|
@ -6,28 +6,28 @@
|
||||||
# Also makes yay call paru since that is the new hotness
|
# Also makes yay call paru since that is the new hotness
|
||||||
# (or at least I want to try it)
|
# (or at least I want to try it)
|
||||||
|
|
||||||
type paru >/dev/null 2>&1 && {
|
exist paru && {
|
||||||
# recreate the normal look of yay
|
# recreate the normal look of yay
|
||||||
alias yay="paru --bottomup"
|
alias yay="paru --bottomup"
|
||||||
}
|
}
|
||||||
|
|
||||||
syu() {
|
syu() {
|
||||||
type topgrade >/dev/null 2>&1 && {
|
exist topgrade && {
|
||||||
topgrade
|
topgrade
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type paru >/dev/null 2>&1 && {
|
exist paru && {
|
||||||
paru
|
paru
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type yay >/dev/null 2>&1 && {
|
exist yay && {
|
||||||
yay
|
yay
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type pacman >/dev/null 2>&1 && {
|
exist pacman && {
|
||||||
echo "Did not find paru, or yay installed. Updates will not be applied to aur packages."
|
echo "Did not find paru, or yay installed. Updates will not be applied to aur packages."
|
||||||
sudo pacman -Syu
|
sudo pacman -Syu
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# simple check for running graphical session
|
||||||
if [ -n "$DISPLAY" ] || [ -z "$XDG_VTNR" ] || [ "$XDG_VTNR" -ne 1 ]; then
|
if [ -n "$DISPLAY" ] || [ -z "$XDG_VTNR" ] || [ "$XDG_VTNR" -ne 1 ]; then
|
||||||
return
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# more involved check for running graphical session
|
||||||
|
# but figures it out for weird sshd sessions as well
|
||||||
|
if [ "$(loginctl show-session "$(loginctl show-user "$(whoami)" -p Display --value)" -p Type --value)" = 'wayland' ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# just in case we are running x11 and this wants
|
||||||
|
# to automatically start wayland, stop it from doing so
|
||||||
|
if [ "$(loginctl show-session "$(loginctl show-user "$(whoami)" -p Display --value)" -p Type --value)" = 'x11' ]; then
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v river >/dev/null 2>&1; then
|
if command -v river >/dev/null 2>&1; then
|
||||||
river
|
river
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue