Merge branch 'main' of https://git.snaile.de/luca/dotfiles
This commit is contained in:
commit
61aff0076d
|
@ -0,0 +1,98 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xserverrc" ]; then
|
||||
server=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xserverrc
|
||||
elif [ -r "$HOME/.xserverrc" ]; then
|
||||
server=$HOME/.xserverrc
|
||||
else
|
||||
server=/etc/X11/xinit/xserverrc
|
||||
fi
|
||||
|
||||
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession" ]; then
|
||||
client=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession
|
||||
elif [ -r "$HOME/.xsession" ]; then
|
||||
client="$HOME/.xsession"
|
||||
else
|
||||
client=/etc/X11/xinit/xinitrc
|
||||
fi
|
||||
|
||||
# Automatically determine an unused $DISPLAY
|
||||
d=0
|
||||
while true; do
|
||||
[ -e "/tmp/.X$d-lock" ] || [ -S "/tmp/.X11-unix/X$d" ] || break
|
||||
d=$((d + 1))
|
||||
done
|
||||
display=":$d"
|
||||
unset d
|
||||
|
||||
if [ -n "${XAUTHORITY+x}" ]; then
|
||||
XAUTHORITY=$HOME/.Xauthority
|
||||
export XAUTHORITY
|
||||
fi
|
||||
|
||||
removelist=
|
||||
|
||||
# check for GNU hostname
|
||||
if hostname --version >/dev/null 2>&1; then
|
||||
if ! hostname --version 2>&1 | grep GNU -q; then
|
||||
hostname=$(hostname -f)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$hostname" ]; then
|
||||
hostname=$(hostname)
|
||||
fi
|
||||
|
||||
authdisplay=${display:-:0}
|
||||
|
||||
mcookie=$(/usr/bin/mcookie)
|
||||
|
||||
if [ -z "${mcookie+x}" ]; then
|
||||
echo "Couldn't create cookie"
|
||||
exit 1
|
||||
fi
|
||||
dummy=0
|
||||
|
||||
# create a file with auth information for the server. ':0' is a dummy.
|
||||
xserverauthfile=$(mktemp --tmpdir serverauth.XXXXXXXXXX)
|
||||
trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM
|
||||
xauth -q -f "$xserverauthfile" <<EOF
|
||||
add :$dummy . $mcookie
|
||||
EOF
|
||||
|
||||
serverargs=${serverargs}" -auth "${xserverauthfile}
|
||||
|
||||
# now add the same credentials to the client authority file
|
||||
# if '$displayname' already exists do not overwrite it as another
|
||||
# server may need it. Add them to the '$xserverauthfile' instead.
|
||||
for displayname in $authdisplay $hostname$authdisplay; do
|
||||
authcookie=$(xauth list "$displayname" | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p") 2>/dev/null
|
||||
if [ -n "${authcookie+x}" ]; then
|
||||
xauth -q <<EOF
|
||||
add $displayname . $mcookie
|
||||
EOF
|
||||
removelist="$displayname $removelist"
|
||||
else
|
||||
dummy=$((dummy + 1))
|
||||
xauth -q -f "$xserverauthfile" <<EOF
|
||||
add :$dummy . $authcookie
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
|
||||
xinit $client -- $server $serverargs $display
|
||||
|
||||
retval=$?
|
||||
|
||||
if [ -z "${removelist+x}" ]; then
|
||||
xauth remove $removelist
|
||||
fi
|
||||
if [ x"$xserverauthfile" != x ]; then
|
||||
rm -f "$xserverauthfile"
|
||||
fi
|
||||
|
||||
if command -v deallocvt >/dev/null 2>&1; then
|
||||
deallocvt
|
||||
fi
|
||||
|
||||
exit $retval
|
|
@ -0,0 +1,170 @@
|
|||
#!/bin/sh
|
||||
export XCURSOR_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/icons"
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
|
||||
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
|
||||
export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
|
||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
|
||||
export AWT_TOOLKIT="MToolkit wmname LG3D" #May have to install wmname
|
||||
export LF_ICONS="\
|
||||
tw=:\
|
||||
st=:\
|
||||
ow=:\
|
||||
dt=:\
|
||||
di=:\
|
||||
fi=:\
|
||||
ln=:\
|
||||
or=:\
|
||||
ex=:\
|
||||
*.c=:\
|
||||
*.cc=:\
|
||||
*.clj=:\
|
||||
*.coffee=:\
|
||||
*.cpp=:\
|
||||
*.css=:\
|
||||
*.d=:\
|
||||
*.dart=:\
|
||||
*.erl=:\
|
||||
*.exs=:\
|
||||
*.fs=:\
|
||||
*.go=:\
|
||||
*.h=:\
|
||||
*.hh=:\
|
||||
*.hpp=:\
|
||||
*.hs=:\
|
||||
*.html=:\
|
||||
*.java=:\
|
||||
*.jl=:\
|
||||
*.js=:\
|
||||
*.json=:\
|
||||
*.lua=:\
|
||||
*.md=:\
|
||||
*.php=:\
|
||||
*.pl=:\
|
||||
*.pro=:\
|
||||
*.py=:\
|
||||
*.rb=:\
|
||||
*.rs=:\
|
||||
*.scala=:\
|
||||
*.ts=:\
|
||||
*.vim=:\
|
||||
*.cmd=:\
|
||||
*.ps1=:\
|
||||
*.sh=:\
|
||||
*.bash=:\
|
||||
*.zsh=:\
|
||||
*.fish=:\
|
||||
*.tar=:\
|
||||
*.tgz=:\
|
||||
*.arc=:\
|
||||
*.arj=:\
|
||||
*.taz=:\
|
||||
*.lha=:\
|
||||
*.lz4=:\
|
||||
*.lzh=:\
|
||||
*.lzma=:\
|
||||
*.tlz=:\
|
||||
*.txz=:\
|
||||
*.tzo=:\
|
||||
*.t7z=:\
|
||||
*.zip=:\
|
||||
*.z=:\
|
||||
*.dz=:\
|
||||
*.gz=:\
|
||||
*.lrz=:\
|
||||
*.lz=:\
|
||||
*.lzo=:\
|
||||
*.xz=:\
|
||||
*.zst=:\
|
||||
*.tzst=:\
|
||||
*.bz2=:\
|
||||
*.bz=:\
|
||||
*.tbz=:\
|
||||
*.tbz2=:\
|
||||
*.tz=:\
|
||||
*.deb=:\
|
||||
*.rpm=:\
|
||||
*.jar=:\
|
||||
*.war=:\
|
||||
*.ear=:\
|
||||
*.sar=:\
|
||||
*.rar=:\
|
||||
*.alz=:\
|
||||
*.ace=:\
|
||||
*.zoo=:\
|
||||
*.cpio=:\
|
||||
*.7z=:\
|
||||
*.rz=:\
|
||||
*.cab=:\
|
||||
*.wim=:\
|
||||
*.swm=:\
|
||||
*.dwm=:\
|
||||
*.esd=:\
|
||||
*.jpg=:\
|
||||
*.jpeg=:\
|
||||
*.mjpg=:\
|
||||
*.mjpeg=:\
|
||||
*.gif=:\
|
||||
*.bmp=:\
|
||||
*.pbm=:\
|
||||
*.pgm=:\
|
||||
*.ppm=:\
|
||||
*.tga=:\
|
||||
*.xbm=:\
|
||||
*.xpm=:\
|
||||
*.tif=:\
|
||||
*.tiff=:\
|
||||
*.png=:\
|
||||
*.svg=:\
|
||||
*.svgz=:\
|
||||
*.mng=:\
|
||||
*.pcx=:\
|
||||
*.mov=:\
|
||||
*.mpg=:\
|
||||
*.mpeg=:\
|
||||
*.m2v=:\
|
||||
*.mkv=:\
|
||||
*.webm=:\
|
||||
*.ogm=:\
|
||||
*.mp4=:\
|
||||
*.m4v=:\
|
||||
*.mp4v=:\
|
||||
*.vob=:\
|
||||
*.qt=:\
|
||||
*.nuv=:\
|
||||
*.wmv=:\
|
||||
*.asf=:\
|
||||
*.rm=:\
|
||||
*.rmvb=:\
|
||||
*.flc=:\
|
||||
*.avi=:\
|
||||
*.fli=:\
|
||||
*.flv=:\
|
||||
*.gl=:\
|
||||
*.dl=:\
|
||||
*.xcf=:\
|
||||
*.xwd=:\
|
||||
*.yuv=:\
|
||||
*.cgm=:\
|
||||
*.emf=:\
|
||||
*.ogv=:\
|
||||
*.ogx=:\
|
||||
*.aac=:\
|
||||
*.au=:\
|
||||
*.flac=:\
|
||||
*.m4a=:\
|
||||
*.mid=:\
|
||||
*.midi=:\
|
||||
*.mka=:\
|
||||
*.mp3=:\
|
||||
*.mpc=:\
|
||||
*.ogg=:\
|
||||
*.ra=:\
|
||||
*.wav=:\
|
||||
*.oga=:\
|
||||
*.opus=:\
|
||||
*.spx=:\
|
||||
*.xspf=:\
|
||||
*.pdf=:\
|
||||
*.nix=:\
|
||||
"
|
|
@ -1,6 +1,6 @@
|
|||
!! Set cursor size (Check GTK in .config too):
|
||||
Xcursor.size: 24
|
||||
Xcursor.theme: Fluent-dark-cursors
|
||||
Xcursor.theme: Qogir-dark
|
||||
!! Set transparency (0-1):
|
||||
*.alpha: 0.8
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
# stty icrnl
|
||||
exec /usr/bin/Xorg -nolisten tcp "$@" vt$XDG_VTNR
|
|
@ -0,0 +1,123 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
PROGNAME=Xsession
|
||||
|
||||
OPTIONFILE=/etc/X11/Xsession.options
|
||||
|
||||
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xresources" ] && USRRESOURCES=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xresources || USRRESOURCES=$HOME/.Xresources
|
||||
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession.d" ] && SESSIONDIR=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession.d || SESSIONDIR=/etc/X11/Xsession.d
|
||||
[ -d "${XDG_DATA_HOME:-$HOME/.local/share}/xorg/" ] && ERRFILE=${XDG_DATA_HOME:-$HOME/.local/share}/xorg/xsession-errors || ERRFILE=$HOME/.xsession-errors
|
||||
|
||||
message() {
|
||||
# pretty-print messages of arbitrary length; use xmessage if it
|
||||
# is available and $DISPLAY is set
|
||||
MESSAGE="$PROGNAME: $*"
|
||||
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
|
||||
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
||||
# echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
||||
# fi
|
||||
}
|
||||
|
||||
message_nonl() {
|
||||
# pretty-print messages of arbitrary length (no trailing newline); use
|
||||
# xmessage if it is available and $DISPLAY is set
|
||||
MESSAGE="$PROGNAME: $*"
|
||||
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
|
||||
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
||||
# echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
||||
# fi
|
||||
}
|
||||
|
||||
errormsg() {
|
||||
# exit script with error
|
||||
message "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
internal_errormsg() {
|
||||
# exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
|
||||
# One big call to message() for the sake of xmessage; if we had two then
|
||||
# the user would have dismissed the error we want reported before seeing the
|
||||
# request to report it.
|
||||
errormsg "$*" \
|
||||
"Please report the installed version of the \"x11-common\"" \
|
||||
"package and the complete text of this error message to" \
|
||||
"<debian-x@lists.debian.org>."
|
||||
}
|
||||
|
||||
OPTIONS="$(
|
||||
if [ -r "$OPTIONFILE" ]; then
|
||||
cat "$OPTIONFILE"
|
||||
fi
|
||||
if [ -d /etc/X11/Xsession.options.d ]; then
|
||||
run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d '\n' cat
|
||||
fi
|
||||
)"
|
||||
|
||||
has_option() {
|
||||
# Ensure that a later no-foo overrides an earlier foo
|
||||
if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# attempt to create an error file; abort if we cannot
|
||||
if (umask 077 && touch "$ERRFILE") 2>/dev/null && [ -w "$ERRFILE" ] &&
|
||||
[ ! -L "$ERRFILE" ]; then
|
||||
chmod 600 "$ERRFILE"
|
||||
elif ERRFILE=$(mktemp 2>/dev/null); then
|
||||
if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
|
||||
message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
|
||||
"\"$ERRFILE\"; look for session log/errors in" \
|
||||
"\"$TMPDIR/xsession-$USER\"."
|
||||
fi
|
||||
else
|
||||
errormsg "unable to create X session log/error file; aborting."
|
||||
fi
|
||||
|
||||
# truncate ERRFILE if it is too big to avoid disk usage DoS
|
||||
if [ "$(stat -c%s \""$ERRFILE"\")" -gt 500000 ]; then
|
||||
T=$(mktemp -p "$HOME")
|
||||
tail -c 500000 "$ERRFILE" >"$T" && mv -f "$T" "$ERRFILE" || rm -f "$T"
|
||||
fi
|
||||
|
||||
exec >>"$ERRFILE" 2>&1
|
||||
|
||||
# sanity check; is our session script directory present?
|
||||
if [ ! -d "$SESSIONDIR" ]; then
|
||||
errormsg "no \"$SESSIONDIR\" directory found; aborting."
|
||||
fi
|
||||
|
||||
# Attempt to create a file of non-zero length in /tmp; a full filesystem can
|
||||
# cause mysterious X session failures. We do not use touch, :, or test -w
|
||||
# because they won't actually create a file with contents. We also let standard
|
||||
# error from mktemp and echo go to the error file to aid the user in
|
||||
# determining what went wrong.
|
||||
WRITE_TEST=$(mktemp)
|
||||
if ! echo "*" >>"$WRITE_TEST"; then
|
||||
message "warning: unable to write to ${WRITE_TEST%/*}; X session may exit" \
|
||||
"with an error"
|
||||
fi
|
||||
rm -f "$WRITE_TEST"
|
||||
|
||||
SESSIONFILES=$(run-parts --list $SESSIONDIR)
|
||||
if [ -n "$SESSIONFILES" ]; then
|
||||
set +e
|
||||
for SESSIONFILE in $SESSIONFILES; do
|
||||
message "Executing $SESSIONFILE"
|
||||
. $SESSIONFILE
|
||||
done
|
||||
set -e
|
||||
fi
|
||||
|
||||
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xprofile" ]; then
|
||||
. ${XDG_CONFIG_HOME:-$HOME/.config}/X11/xprofile
|
||||
else
|
||||
. $HOME/.xprofile
|
||||
fi
|
||||
|
||||
exec dwm
|
|
@ -0,0 +1,23 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -n "$XDG_RUNTIME_DIR" ] &&
|
||||
[ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] &&
|
||||
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
|
||||
# We are under systemd-logind or something remarkably similar, and
|
||||
# a user-session socket has already been set up.
|
||||
#
|
||||
# Be nice to non-libdbus, non-sd-bus implementations by using
|
||||
# that as the session bus address in the environment. The check for
|
||||
# XDG_RUNTIME_DIR = "/run/user/`id -u`" is because we know that
|
||||
# form of the address, from systemd-logind, doesn't need escaping,
|
||||
# whereas arbitrary addresses might.
|
||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
||||
fi
|
||||
|
||||
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
||||
# tell dbus-daemon --session (and systemd --user, if running)
|
||||
# to put a minimal subset of the Xsession's environment in activated
|
||||
# services' environments
|
||||
dbus-update-activation-environment --verbose --systemd \
|
||||
DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY
|
||||
fi
|
|
@ -0,0 +1,5 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
if has_option allow-user-resources && [ -f "$USRRESOURCES" ]; then
|
||||
xrdb -merge $USRRESOURCES
|
||||
fi
|
|
@ -0,0 +1,23 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
add_module() {
|
||||
case :$GTK_MODULES: in
|
||||
*:$1:*) ;;
|
||||
|
||||
*)
|
||||
if [ -z "$GTK_MODULES" ]; then
|
||||
GTK_MODULES=$1
|
||||
else
|
||||
GTK_MODULES=$GTK_MODULES:$1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
add_module gail
|
||||
add_module atk-bridge
|
||||
|
||||
export GTK_MODULES
|
||||
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
||||
dbus-update-activation-environment --verbose --systemd GTK_MODULES
|
||||
fi
|
|
@ -0,0 +1,7 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
export QT_ACCESSIBILITY=1
|
||||
|
||||
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
||||
dbus-update-activation-environment --verbose --systemd QT_ACCESSIBILITY
|
||||
fi
|
|
@ -0,0 +1,7 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
if [ "${SSH_AUTH_SOCK:-0}" -ne $$ ]; then
|
||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
fi
|
||||
export GPG_TTY="$(tty)"
|
||||
gpg-connect-agent updatestartuptty /bye >/dev/null
|
|
@ -0,0 +1,15 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
start() {
|
||||
pidof -s $1 || $@ >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
start playerctld daemon
|
||||
start picom --experimental-backends
|
||||
start unclutter -noevents
|
||||
start dunst
|
||||
start pipewire
|
||||
start dwmblocks
|
||||
start remapd
|
||||
start setbg
|
||||
start xwallpaper --zoom "${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
|
|
@ -0,0 +1,17 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
export XSECURELOCK_AUTH_BACKGROUND_COLOR="#24283b"
|
||||
export XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5"
|
||||
export XSECURELOCK_AUTH_WARNING_COLOR="#f7768e"
|
||||
export XSECURELOCK_BACKGROUND_COLOR="#15161E"
|
||||
export XSECURELOCK_DATETIME_FORMAT="%d.%m.%Y %H:%M"
|
||||
export XSECURELOCK_PASSWORD_PROMPT="time_hex"
|
||||
export XSECURELOCK_AUTH_TIMEOUT=10
|
||||
export XSECURELOCK_SHOW_DATETIME=1
|
||||
export XSECURELOCK_COMPOSITE_OBSCURER=0
|
||||
export XSECURELOCK_SAVER="/usr/libexec/xscreensaver/cubicgrid"
|
||||
export XSECURELOCK_SHOW_DATETIME=1
|
||||
export XSECURELOCK_SHOW_HOSTNAME=1
|
||||
|
||||
xset s 300
|
||||
xss-lock -l -- xsecurelock &
|
|
@ -3,27 +3,36 @@
|
|||
follow = keyboard
|
||||
width = 370
|
||||
height = 370
|
||||
offset = 0x19
|
||||
padding = 1
|
||||
horizontal_padding = 1
|
||||
offset = 5x24
|
||||
transparency = 10
|
||||
font = Monospace 12
|
||||
format = "<b>%s</b>\n%b"
|
||||
frame_width = 2
|
||||
frame_color = "#414868"
|
||||
frame_color = "#383c4a"
|
||||
progress_bar_corner_radius = 5
|
||||
line_height = 2
|
||||
corner_radius = 8
|
||||
markup = full
|
||||
icon_theme = Qogir-dark
|
||||
icon_path = /usr/share/icons/Qogir-dark/16/panel/
|
||||
|
||||
[urgency_low]
|
||||
background = "#32344a"
|
||||
foreground = "#787c99"
|
||||
background = "#1a1b26"
|
||||
foreground = "#c0caf5"
|
||||
highlight = "#7aa2f7"
|
||||
timeout = 3
|
||||
|
||||
[urgency_normal]
|
||||
foreground = "#7aa2f7"
|
||||
background = "#32344a"
|
||||
frame_color = "#7aa2f7"
|
||||
background = "#1a1b26"
|
||||
foreground = "#c0caf5"
|
||||
highlight = "#7aa2f7"
|
||||
timeout = 5
|
||||
|
||||
[urgency_critical]
|
||||
background = "#32344a"
|
||||
foreground = "#7aa2f7"
|
||||
background = "#1a1b26"
|
||||
foreground = "#c0caf5"
|
||||
frame_color = "#ff768e"
|
||||
highlight = "#ff768e"
|
||||
timeout = 10
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
gtk-theme-name="Qogir-Dark"
|
||||
gtk-icon-theme-name="Adwaita"
|
||||
gtk-theme-name="Qogir-dark"
|
||||
gtk-icon-theme-name="Qogir-dark"
|
||||
gtk-font-name="Sans 10"
|
||||
gtk-cursor-theme-name="Fluent-dark-cursors"
|
||||
gtk-cursor-theme-name="Qogir-dark"
|
||||
gtk-cursor-theme-size=0
|
||||
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[Settings]
|
||||
gtk-theme-name=Qogir-Dark
|
||||
gtk-icon-theme-name=Adwaita
|
||||
gtk-theme-name=Qogir-dark
|
||||
gtk-icon-theme-name=Qogir-dark
|
||||
gtk-font-name=Sans 10
|
||||
gtk-cursor-theme-name=Fluent-dark-cursors
|
||||
gtk-cursor-theme-name=Qogir-dark
|
||||
gtk-cursor-theme-size=0
|
||||
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
|
|
|
@ -198,6 +198,8 @@ map N
|
|||
map g/ cd "/"
|
||||
map W &setsid $TERMINAL -e $SHELL -c "lf; $SHELL"
|
||||
|
||||
# Kitty Specific
|
||||
map W &setsid $TERMINAL $SHELL -c "lf; exec $SHELL"
|
||||
|
||||
# Load bookmark shortcuts
|
||||
source "~/.config/lf/shortcutrc"
|
||||
|
|
|
@ -5,7 +5,7 @@ image() {
|
|||
h=$3
|
||||
x=$4
|
||||
y=$5
|
||||
kitty +kitten icat --transfer-mode file --place "${w}x${h}@${x}x${y}" -- "$f"
|
||||
kitty +kitten icat --transfer-mode file --place "${w}x${h}@${x}x${y}" -- "$f" && exit 1
|
||||
chafa "$f" -f symbols -s "$((w-2))x$h" && exit 1
|
||||
echo -e "\e[31mImage previewer not installed\e[0m"
|
||||
return 1
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
local cmds = {
|
||||
{ -- Handles the automatic line numeration changes
|
||||
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
|
||||
{
|
||||
pattern = "*",
|
||||
command = "if &nu && mode() != \"i\" | set rnu | endif"
|
||||
}
|
||||
},
|
||||
{ -- Handles the automatic line numeration changes
|
||||
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
|
||||
{
|
||||
pattern = "*",
|
||||
command = "if &nu | set nornu | endif"
|
||||
}
|
||||
},
|
||||
{
|
||||
"BufWritePost",
|
||||
{
|
||||
pattern = { "bm-files", "bm-dirs" },
|
||||
command = "!shortcuts"
|
||||
}
|
||||
},
|
||||
{
|
||||
{ "BufRead", "BufNewFile" },
|
||||
{
|
||||
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
|
||||
command = "set filetype=xdefaults"
|
||||
}
|
||||
},
|
||||
{
|
||||
"BufWritePost",
|
||||
{
|
||||
pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" },
|
||||
command = "!xrdb %"
|
||||
}
|
||||
},
|
||||
{
|
||||
"BufWritePost",
|
||||
{
|
||||
pattern = "~/.local/src/dwmblocks/config.h",
|
||||
command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }"
|
||||
}
|
||||
},
|
||||
{
|
||||
"BufWritePost",
|
||||
{
|
||||
pattern = "*.java",
|
||||
callback = function()
|
||||
vim.lsp.codelens.refresh()
|
||||
end
|
||||
}
|
||||
},
|
||||
{
|
||||
{ "BufDelete", "VimLeave" },
|
||||
{
|
||||
pattern = "*.tex",
|
||||
command = "!texclear \"%:p\""
|
||||
}
|
||||
},
|
||||
{ -- Use 'q' to quit from common plugins
|
||||
'FileType',
|
||||
{
|
||||
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
|
||||
callback = function()
|
||||
vim.cmd [[
|
||||
nnoremap <silent> <buffer> q :close<CR>
|
||||
set nobuflisted
|
||||
]]
|
||||
end
|
||||
}
|
||||
},
|
||||
{
|
||||
'Filetype',
|
||||
{
|
||||
pattern = { "gitcommit", "markdown" },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
}
|
||||
},
|
||||
{ -- Automatically apply changes to plugins.lua
|
||||
'BufWritePost',
|
||||
{
|
||||
group = 'packer_user_config',
|
||||
pattern = { "plugins.lua", "pluginlist.lua" },
|
||||
command = "source <afile> | PackerCompile"
|
||||
}
|
||||
},
|
||||
{ -- Fix auto comment
|
||||
'BufWinEnter',
|
||||
{
|
||||
callback = function()
|
||||
vim.cmd("set formatoptions-=cro")
|
||||
end
|
||||
}
|
||||
},
|
||||
{ -- Highlight yanked text
|
||||
'TextYankPost',
|
||||
{
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.api.nvim_create_augroup('packer_user_config', { clear = true })
|
||||
|
||||
for _, entry in ipairs(cmds) do
|
||||
local event = entry[1]
|
||||
local opts = entry[2]
|
||||
if type(opts.group) == "string" and opts.group ~= "" then
|
||||
local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group })
|
||||
if not exists then
|
||||
vim.api.nvim_create_augroup(opts.group, {})
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_autocmd(event, opts)
|
||||
end
|
|
@ -0,0 +1,28 @@
|
|||
local filetypes = {
|
||||
{
|
||||
extension = {
|
||||
yml = function(path, bufnr)
|
||||
if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' },
|
||||
{ type = 'directory', upward = true }) and
|
||||
vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then
|
||||
return 'yaml.ansible'
|
||||
else
|
||||
return 'yaml'
|
||||
end
|
||||
end,
|
||||
yaml = function(path, bufnr)
|
||||
if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' },
|
||||
{ type = 'directory', upward = true }) and
|
||||
vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then
|
||||
return 'yaml.ansible'
|
||||
else
|
||||
return 'yaml'
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, entry in pairs(filetypes) do
|
||||
vim.filetype.add(entry)
|
||||
end
|
|
@ -0,0 +1,157 @@
|
|||
return {
|
||||
kind = {
|
||||
Array = "",
|
||||
Boolean = "蘒",
|
||||
Class = "",
|
||||
Color = "",
|
||||
Constant = "",
|
||||
Constructor = "",
|
||||
Enum = "",
|
||||
EnumMember = "",
|
||||
Event = "",
|
||||
Field = "",
|
||||
File = "",
|
||||
Folder = "",
|
||||
Function = "",
|
||||
Interface = "",
|
||||
Key = "",
|
||||
Keyword = "",
|
||||
Method = "",
|
||||
Module = "",
|
||||
Namespace = "",
|
||||
Null = "ﳠ",
|
||||
Number = "",
|
||||
Object = "",
|
||||
Operator = "",
|
||||
Package = "",
|
||||
Property = "",
|
||||
Reference = "",
|
||||
Snippet = "",
|
||||
String = "",
|
||||
Struct = "",
|
||||
Text = "",
|
||||
TypeParameter = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Variable = "",
|
||||
},
|
||||
git = {
|
||||
LineAdded = "",
|
||||
LineModified = "",
|
||||
LineRemoved = "",
|
||||
FileDeleted = "",
|
||||
FileIgnored = "",
|
||||
FileRenamed = "",
|
||||
FileStaged = "S",
|
||||
FileUnmerged = "",
|
||||
FileUnstaged = "",
|
||||
FileUntracked = "U",
|
||||
Diff = "",
|
||||
Repo = "",
|
||||
Octoface = "",
|
||||
Branch = "",
|
||||
},
|
||||
ui = {
|
||||
ArrowCircleDown = "",
|
||||
ArrowCircleLeft = "",
|
||||
ArrowCircleRight = "",
|
||||
ArrowCircleUp = "",
|
||||
BoldArrowDown = "",
|
||||
BoldArrowLeft = "",
|
||||
BoldArrowRight = "",
|
||||
BoldArrowUp = "",
|
||||
BoldClose = "",
|
||||
BoldDividerLeft = "",
|
||||
BoldDividerRight = "",
|
||||
BoldLineLeft = "▎",
|
||||
BookMark = "",
|
||||
BoxChecked = "",
|
||||
Bug = "",
|
||||
Stacks = " ",
|
||||
Scopes = "",
|
||||
Watches = "",
|
||||
DebugConsole = " ",
|
||||
Calendar = "",
|
||||
Check = "",
|
||||
ChevronRight = ">",
|
||||
ChevronShortDown = "",
|
||||
ChevronShortLeft = "",
|
||||
ChevronShortRight = "",
|
||||
ChevronShortUp = "",
|
||||
Circle = "",
|
||||
Close = "",
|
||||
CloudDownload = "",
|
||||
Code = "",
|
||||
Comment = "",
|
||||
Dashboard = "",
|
||||
DividerLeft = "",
|
||||
DividerRight = "",
|
||||
DoubleChevronRight = "",
|
||||
DoubleChevronLeft = "",
|
||||
Ellipsis = "…",
|
||||
EmptyFolder = "",
|
||||
EmptyFolderOpen = "",
|
||||
File = "",
|
||||
FileSymlink = "",
|
||||
Files = "",
|
||||
FindFile = "",
|
||||
FindText = "",
|
||||
Fire = "",
|
||||
Folder = "",
|
||||
FolderOpen = "",
|
||||
FolderSymlink = "",
|
||||
Forward = "",
|
||||
Gear = "",
|
||||
History = "",
|
||||
Lightbulb = "",
|
||||
LineLeft = "▏",
|
||||
LineMiddle = "│",
|
||||
List = "",
|
||||
Lock = "",
|
||||
MinusCircle = "",
|
||||
NewFile = "",
|
||||
Note = "",
|
||||
Package = "",
|
||||
Pencil = "",
|
||||
Plus = "",
|
||||
Project = "",
|
||||
Search = "",
|
||||
SignIn = "",
|
||||
SignOut = "",
|
||||
Tab = "",
|
||||
Table = "",
|
||||
Target = "",
|
||||
Telescope = "",
|
||||
Text = "",
|
||||
Tree = "",
|
||||
Triangle = "契",
|
||||
TriangleShortArrowDown = "",
|
||||
TriangleShortArrowLeft = "",
|
||||
TriangleShortArrowRight = "",
|
||||
TriangleShortArrowUp = "",
|
||||
},
|
||||
diagnostics = {
|
||||
BoldError = "",
|
||||
Error = "",
|
||||
BoldWarning = "",
|
||||
Warning = "",
|
||||
BoldInformation = "",
|
||||
Information = "",
|
||||
BoldQuestion = "",
|
||||
Question = "",
|
||||
BoldHint = "",
|
||||
Hint = "",
|
||||
Debug = "",
|
||||
Trace = "✎",
|
||||
},
|
||||
progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
||||
misc = {
|
||||
Robot = "ﮧ",
|
||||
Squirrel = "",
|
||||
Tag = "",
|
||||
Watch = "",
|
||||
Smiley = "ﲃ",
|
||||
Package = "",
|
||||
CircuitBoard = "",
|
||||
},
|
||||
}
|
|
@ -39,3 +39,17 @@ o.listchars = "eol:$,tab:>-,trail:~,extends:>,precedes:<"
|
|||
|
||||
g.Illuminate_ftblacklist = { 'alpha', 'NvimTree' }
|
||||
g.mapleader = ' '
|
||||
|
||||
local icons = require 'config.iconlist'
|
||||
|
||||
local signs = {
|
||||
DiagnosticSignError = icons.BoldError,
|
||||
DiagnosticSignWarn = icons.BoldWarning,
|
||||
DiagnosticSignHint = icons.BoldHint,
|
||||
DiagnosticSignInfo = icons.BoldInformation
|
||||
}
|
||||
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
|
|
@ -15,6 +15,7 @@ null_ls.setup {
|
|||
debug = false,
|
||||
sources = {
|
||||
formatting.black.with { extra_args = { "--fast" } },
|
||||
formatting.shfmt,
|
||||
-- formatting.stylua,
|
||||
-- diagnostics.flake8,
|
||||
},
|
||||
|
|
|
@ -5,15 +5,6 @@ end
|
|||
|
||||
local icons = require('config.icons').list
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
|
||||
prompt_prefix = icons.ui.Telescope,
|
||||
selection_caret = icons.ui.Forward,
|
||||
file_ignore_patterns = { ".git/", "node_modules" },
|
||||
|
||||
},
|
||||
}
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
|
|
|
@ -7,7 +7,7 @@ shadow-offset-y = -13;
|
|||
shadow-exclude = "!focused";
|
||||
|
||||
# Fading
|
||||
fading = true;
|
||||
fading = false;
|
||||
fade-in-step = 0.04;
|
||||
fade-out-step = 0.04;
|
||||
fade-delta = 4;
|
||||
|
@ -23,22 +23,21 @@ blur-background-frame = false;
|
|||
blur-kern = "3x3box";
|
||||
blur-strength = 5;
|
||||
blur-background-exclude = [
|
||||
"class_g = 'LibreWolf' && argb",
|
||||
"class_g = 'easyeffects'",
|
||||
"class_g *= 'slop'",
|
||||
"_GTK_FRAME_EXTENTS@:c",
|
||||
"_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
|
||||
"class_g = 'Dunst'",
|
||||
"class_g = 'librewolf-default'",
|
||||
"class_g = 'easyeffects'",
|
||||
"class_g *= 'slop'",
|
||||
"_GTK_FRAME_EXTENTS@:c",
|
||||
"_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
|
||||
];
|
||||
|
||||
# Opacity
|
||||
opacity-rule = [
|
||||
"100:class_g = 'LibreWolf' && argb",
|
||||
"100:class_g = 'easyeffects'",
|
||||
"0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'",
|
||||
"0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'",
|
||||
"0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'",
|
||||
"0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'",
|
||||
"0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'"
|
||||
"0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'",
|
||||
"0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'",
|
||||
"0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'",
|
||||
"0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'",
|
||||
"0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'"
|
||||
];
|
||||
|
||||
# Other
|
||||
|
@ -63,11 +62,12 @@ use-damage = true;
|
|||
# Window type settings
|
||||
wintypes:
|
||||
{
|
||||
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }
|
||||
dock = { shadow = false; clip-shadow-above = true; }
|
||||
dnd = { shadow = false; }
|
||||
popup_menu = { opacity = 1.0; shadow = false; }
|
||||
dropdown_menu = { opacity = 1.0; shadow = false; }
|
||||
utility = { opacity = 1.0; shadow = false; }
|
||||
dock = { shadow = false; };
|
||||
dnd = { shadow = false; };
|
||||
tooltip = { shadow = false; };
|
||||
menu = { opacity = false; };
|
||||
dropdown_menu = { opacity = false; };
|
||||
popup_menu = { opacity = false; };
|
||||
utility = { opacity = false; };
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Use $XINITRC variable if file exists.
|
||||
[ -f "$XINITRC" ] && alias startx="startx $XINITRC"
|
||||
|
||||
# sudo not required for some system commands
|
||||
for command in mount umount sv pacman apt updatedb su shutdown poweroff reboot ; do
|
||||
alias $command="sudo $command"
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
#!/bin/zsh
|
||||
#!/bin/sh
|
||||
|
||||
# profile file. Runs on login. Environmental variables are set here.
|
||||
|
||||
# Adds `~/.local/bin` to $PATH
|
||||
export PATH="$PATH:${$(find -L ~/.local/bin -type d -printf %p:)%%:}"
|
||||
|
||||
# Adds `~/.local/share/npm-global` to $PATH
|
||||
export PATH=~/.npm-global/bin:$PATH
|
||||
|
||||
unsetopt PROMPT_SP
|
||||
localpath="$(find -L ~/.local/bin -type d -printf %p: | sed 's/.$//')"
|
||||
export PATH="$PATH:~/.local/share/npm-global/bin:$localpath"
|
||||
|
||||
# Default programs:
|
||||
export EDITOR="nvim"
|
||||
|
@ -21,20 +17,15 @@ export XDG_DATA_HOME="$HOME/.local/share"
|
|||
export XDG_CACHE_HOME="$HOME/.cache"
|
||||
export PYENVS_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/virtualenv"
|
||||
export KEYMAPS_DIR="$HOME/.local/bin/keymaps"
|
||||
export XINITRC="${XDG_CONFIG_HOME:-$HOME/.config}/x11/xinitrc"
|
||||
export ZSH_COMPDUMP="${XDG_CACHE_HOME:-$HOME/.cache}/zcompdump"
|
||||
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
|
||||
export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch-config"
|
||||
export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0"
|
||||
export LESSHISTFILE="-"
|
||||
export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc"
|
||||
export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/shell/inputrc"
|
||||
export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
|
||||
# export ALSA_CONFIG_PATH="$XDG_CONFIG_HOME/alsa/asoundrc"
|
||||
export GNUPGHOME="${XDG_CONFIG_HOME:-$HOME/.config}/gnupg"
|
||||
export WINEPREFIX="${XDG_DATA_HOME:-$HOME/.local/share}/wineprefixes/default"
|
||||
export KODI_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/kodi"
|
||||
export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store"
|
||||
export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
|
||||
export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android"
|
||||
export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo"
|
||||
|
@ -42,14 +33,10 @@ export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
|
|||
export ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg"
|
||||
export UNISON="${XDG_DATA_HOME:-$HOME/.local/share}/unison"
|
||||
export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history"
|
||||
export WEECHAT_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/weechat"
|
||||
export MBSYNCRC="${XDG_CONFIG_HOME:-$HOME/.config}/mbsync/config"
|
||||
export ELECTRUMDIR="${XDG_DATA_HOME:-$HOME/.local/share}/electrum"
|
||||
export XCURSOR_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/icons"
|
||||
export GRADLE_USER_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/gradle"
|
||||
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # WARN: This line can break some display managers
|
||||
|
||||
# Other program settings:
|
||||
export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
|
||||
export FZF_DEFAULT_OPTS="--layout=reverse --height 40%"
|
||||
export LESS=-R
|
||||
export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')"
|
||||
|
@ -60,181 +47,10 @@ export LESS_TERMCAP_se="$(printf '%b' '[0m')"
|
|||
export LESS_TERMCAP_us="$(printf '%b' '[1;32m')"
|
||||
export LESS_TERMCAP_ue="$(printf '%b' '[0m')"
|
||||
export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
|
||||
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
|
||||
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
|
||||
export AWT_TOOLKIT="MToolkit wmname LG3D" #May have to install wmname
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
|
||||
export ANSIBLE_NOCOWS=1 # Stop those fucking cows in Ansible
|
||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||
export VAULT_ADDR='https://vault.tralios.de'
|
||||
|
||||
xcommand=${XDG_CONFIG_HOME:-$HOME/.config}/X11/startgraphical
|
||||
|
||||
# This is the list for lf icons:
|
||||
export LF_ICONS="\
|
||||
tw=:\
|
||||
st=:\
|
||||
ow=:\
|
||||
dt=:\
|
||||
di=:\
|
||||
fi=:\
|
||||
ln=:\
|
||||
or=:\
|
||||
ex=:\
|
||||
*.c=:\
|
||||
*.cc=:\
|
||||
*.clj=:\
|
||||
*.coffee=:\
|
||||
*.cpp=:\
|
||||
*.css=:\
|
||||
*.d=:\
|
||||
*.dart=:\
|
||||
*.erl=:\
|
||||
*.exs=:\
|
||||
*.fs=:\
|
||||
*.go=:\
|
||||
*.h=:\
|
||||
*.hh=:\
|
||||
*.hpp=:\
|
||||
*.hs=:\
|
||||
*.html=:\
|
||||
*.java=:\
|
||||
*.jl=:\
|
||||
*.js=:\
|
||||
*.json=:\
|
||||
*.lua=:\
|
||||
*.md=:\
|
||||
*.php=:\
|
||||
*.pl=:\
|
||||
*.pro=:\
|
||||
*.py=:\
|
||||
*.rb=:\
|
||||
*.rs=:\
|
||||
*.scala=:\
|
||||
*.ts=:\
|
||||
*.vim=:\
|
||||
*.cmd=:\
|
||||
*.ps1=:\
|
||||
*.sh=:\
|
||||
*.bash=:\
|
||||
*.zsh=:\
|
||||
*.fish=:\
|
||||
*.tar=:\
|
||||
*.tgz=:\
|
||||
*.arc=:\
|
||||
*.arj=:\
|
||||
*.taz=:\
|
||||
*.lha=:\
|
||||
*.lz4=:\
|
||||
*.lzh=:\
|
||||
*.lzma=:\
|
||||
*.tlz=:\
|
||||
*.txz=:\
|
||||
*.tzo=:\
|
||||
*.t7z=:\
|
||||
*.zip=:\
|
||||
*.z=:\
|
||||
*.dz=:\
|
||||
*.gz=:\
|
||||
*.lrz=:\
|
||||
*.lz=:\
|
||||
*.lzo=:\
|
||||
*.xz=:\
|
||||
*.zst=:\
|
||||
*.tzst=:\
|
||||
*.bz2=:\
|
||||
*.bz=:\
|
||||
*.tbz=:\
|
||||
*.tbz2=:\
|
||||
*.tz=:\
|
||||
*.deb=:\
|
||||
*.rpm=:\
|
||||
*.jar=:\
|
||||
*.war=:\
|
||||
*.ear=:\
|
||||
*.sar=:\
|
||||
*.rar=:\
|
||||
*.alz=:\
|
||||
*.ace=:\
|
||||
*.zoo=:\
|
||||
*.cpio=:\
|
||||
*.7z=:\
|
||||
*.rz=:\
|
||||
*.cab=:\
|
||||
*.wim=:\
|
||||
*.swm=:\
|
||||
*.dwm=:\
|
||||
*.esd=:\
|
||||
*.jpg=:\
|
||||
*.jpeg=:\
|
||||
*.mjpg=:\
|
||||
*.mjpeg=:\
|
||||
*.gif=:\
|
||||
*.bmp=:\
|
||||
*.pbm=:\
|
||||
*.pgm=:\
|
||||
*.ppm=:\
|
||||
*.tga=:\
|
||||
*.xbm=:\
|
||||
*.xpm=:\
|
||||
*.tif=:\
|
||||
*.tiff=:\
|
||||
*.png=:\
|
||||
*.svg=:\
|
||||
*.svgz=:\
|
||||
*.mng=:\
|
||||
*.pcx=:\
|
||||
*.mov=:\
|
||||
*.mpg=:\
|
||||
*.mpeg=:\
|
||||
*.m2v=:\
|
||||
*.mkv=:\
|
||||
*.webm=:\
|
||||
*.ogm=:\
|
||||
*.mp4=:\
|
||||
*.m4v=:\
|
||||
*.mp4v=:\
|
||||
*.vob=:\
|
||||
*.qt=:\
|
||||
*.nuv=:\
|
||||
*.wmv=:\
|
||||
*.asf=:\
|
||||
*.rm=:\
|
||||
*.rmvb=:\
|
||||
*.flc=:\
|
||||
*.avi=:\
|
||||
*.fli=:\
|
||||
*.flv=:\
|
||||
*.gl=:\
|
||||
*.dl=:\
|
||||
*.xcf=:\
|
||||
*.xwd=:\
|
||||
*.yuv=:\
|
||||
*.cgm=:\
|
||||
*.emf=:\
|
||||
*.ogv=:\
|
||||
*.ogx=:\
|
||||
*.aac=:\
|
||||
*.au=:\
|
||||
*.flac=:\
|
||||
*.m4a=:\
|
||||
*.mid=:\
|
||||
*.midi=:\
|
||||
*.mka=:\
|
||||
*.mp3=:\
|
||||
*.mpc=:\
|
||||
*.ogg=:\
|
||||
*.ra=:\
|
||||
*.wav=:\
|
||||
*.oga=:\
|
||||
*.opus=:\
|
||||
*.spx=:\
|
||||
*.xspf=:\
|
||||
*.pdf=:\
|
||||
*.nix=:\
|
||||
"
|
||||
|
||||
stty onlcr
|
||||
[ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC"
|
||||
[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] && setsid shortcuts >/dev/null 2>&1
|
||||
sudo -n loadkeys ${XDG_DATA_HOME:-$HOME/.local/share}/ttymaps.kmap 2>/dev/null
|
||||
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && shortcuts >/dev/null 2>&1 &
|
||||
|
||||
[ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ] && ! pidof -s Xorg >/dev/null 2>&1 && exec $xcommand
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# xinitrc runs automatically when you run startx.
|
||||
|
||||
# There are some small but important commands that need to be run when we start
|
||||
# the graphical environment. There is a link to this file in ~/.xprofile
|
||||
# because that file is run automatically if someone uses a display manager
|
||||
# (login screen) and so they are needed there. To prevent doubling up commands,
|
||||
# I source them here with the line below.
|
||||
|
||||
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then
|
||||
. "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile"
|
||||
else
|
||||
. "$HOME/.xprofile"
|
||||
fi
|
||||
dwm
|
|
@ -1,44 +0,0 @@
|
|||
#!/bin/sh
|
||||
xrandr --dpi 109 --fb 4480x1633 \
|
||||
--output DP-2 --mode 2560x1440 --pos 1920x0 \
|
||||
--output HDMI-0 --mode 1920x1080 --pos 0x553
|
||||
setbg &
|
||||
xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources" & xrdbpid=$!
|
||||
remaps &
|
||||
|
||||
autostart="picom checkup dunst unclutter pipewire dwmblocks"
|
||||
for program in $autostart; do
|
||||
pidof -s "$program" || "$program" &
|
||||
done >/dev/null 2>&1
|
||||
playerctld daemon
|
||||
|
||||
if ! pgrep -x -u "${USER}" gpg-agent 1> /dev/null 2>&1; then
|
||||
gpg-connect-agent /bye 1> /dev/null 2>&1
|
||||
fi
|
||||
unset SSH_AGENT_PID
|
||||
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
||||
# export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
|
||||
SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
export SSH_AUTH_SOCK
|
||||
fi
|
||||
GPG_TTY="$(tty)"
|
||||
export GPG_TTY
|
||||
gpg-connect-agent updatestartuptty /bye > /dev/null
|
||||
|
||||
export XSECURELOCK_AUTH_BACKGROUND_COLOR="#24283b"
|
||||
export XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5"
|
||||
export XSECURELOCK_AUTH_WARNING_COLOR="#f7768e"
|
||||
export XSECURELOCK_BACKGROUND_COLOR="#15161E"
|
||||
export XSECURELOCK_DATETIME_FORMAT="%d.%m.%Y %H:%M"
|
||||
export XSECURELOCK_PASSWORD_PROMPT="time_hex"
|
||||
export XSECURELOCK_AUTH_TIMEOUT=10
|
||||
export XSECURELOCK_SHOW_DATETIME=1
|
||||
export XSECURELOCK_COMPOSITE_OBSCURER=0
|
||||
export XSECURELOCK_SAVER="/usr/lib/xscreensaver/cubicgrid"
|
||||
export XSECURELOCK_SHOW_DATETIME=1
|
||||
export XSECURELOCK_SHOW_HOSTNAME=1
|
||||
xset s 300
|
||||
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
|
||||
|
||||
# Ensure that xrdb has finished running before moving on to start the WM/DE.
|
||||
[ -n "$xrdbpid" ] && wait "$xrdbpid"
|
|
@ -15,46 +15,49 @@ ext="${file##*.}"
|
|||
|
||||
cd "$dir" || exit 1
|
||||
|
||||
textype() { \
|
||||
textype() {
|
||||
command="pdflatex"
|
||||
texroot=$(readlink -f "$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]")")
|
||||
[ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot"
|
||||
( head -n5 "$file" | grep -qi 'xelatex' ) && command="xelatex"
|
||||
texroot=$(readlink -f "$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]")")
|
||||
[ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot"
|
||||
(head -n5 "$file" | grep -qi 'xelatex') && command="xelatex"
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
grep -qi addbibresource "$file" &&
|
||||
biber --input-directory "$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base"
|
||||
grep -qi addbibresource "$file" &&
|
||||
biber --input-directory "$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base"
|
||||
}
|
||||
|
||||
case "$ext" in
|
||||
# Try to keep these cases in alphabetical order.
|
||||
[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;;
|
||||
c) cc "$file" -o "$base" && "$base" ;;
|
||||
cpp) g++ "$file" -o "$base" && "$base" ;;
|
||||
cs) mcs "$file" && mono "$base".exe ;;
|
||||
go) go run "$file" ;;
|
||||
h) sudo make install ;;
|
||||
# findup is a script available here: https://unix.stackexchange.com/a/35265
|
||||
java) loc=$(findup . -name gradlew); [ "$loc" != "" ] && exec "$loc" run -q -p "$(dirname "$loc")" ;;
|
||||
m) octave "$file" ;;
|
||||
md) if [ -x "$(command -v lowdown)" ]; then
|
||||
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf
|
||||
elif [ -x "$(command -v groffdown)" ]; then
|
||||
groffdown -i "$file" | groff -T pdf > "$base.pdf"
|
||||
else
|
||||
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
||||
fi ; ;;
|
||||
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;;
|
||||
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;;
|
||||
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
|
||||
py) python "$file" ;;
|
||||
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
|
||||
rs) cargo build ;;
|
||||
sass) sassc -a "$file" "$base".css ;;
|
||||
scad) openscad -o "$base".stl "$file" ;;
|
||||
sent) setsid -f sent "$file" 2>/dev/null ;;
|
||||
tex) textype "$file" ;;
|
||||
fnl) fennel --compile "$file" > "$base.lua" ;;
|
||||
*) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;;
|
||||
# Try to keep these cases in alphabetical order.
|
||||
[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf >"$base".pdf ;;
|
||||
c) cc "$file" -o "$base" && "$base" ;;
|
||||
cpp) g++ "$file" -o "$base" && "$base" ;;
|
||||
cs) mcs "$file" && mono "$base".exe ;;
|
||||
go) go run "$file" ;;
|
||||
h) sudo make install ;;
|
||||
# findup is a script available here: https://unix.stackexchange.com/a/35265
|
||||
java)
|
||||
loc=$(findup . -name gradlew)
|
||||
[ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)"
|
||||
;;
|
||||
m) octave "$file" ;;
|
||||
md) if [ -x "$(command -v lowdown)" ]; then
|
||||
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf >"$base".pdf
|
||||
elif [ -x "$(command -v groffdown)" ]; then
|
||||
groffdown -i "$file" | groff -T pdf >"$base.pdf"
|
||||
else
|
||||
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
||||
fi ;;
|
||||
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf >"$base".pdf ;;
|
||||
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;;
|
||||
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
|
||||
py) python "$file" ;;
|
||||
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
|
||||
rs) cargo build ;;
|
||||
sass) sassc -a "$file" "$base".css ;;
|
||||
scad) openscad -o "$base".stl "$file" ;;
|
||||
sent) setsid -f sent "$file" 2>/dev/null ;;
|
||||
tex) textype "$file" ;;
|
||||
fnl) fennel --compile "$file" >"$base.lua" ;;
|
||||
*) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;;
|
||||
esac
|
||||
|
|
|
@ -4,8 +4,11 @@ These cronjobs have components that require information about your current displ
|
|||
|
||||
When you add them as cronjobs, I recommend you precede the command with commands as those below:
|
||||
|
||||
```
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here
|
||||
```
|
||||
$()$(
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus
|
||||
export DISPLAY=:0
|
||||
. $HOME/.zprofile
|
||||
then_command_goes_here
|
||||
)$()
|
||||
|
||||
This ensures that notifications will display, xdotool commands will function and environmental variables will work as well.
|
||||
|
|
|
@ -9,9 +9,8 @@ sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
|
|||
Check your internet connection, if pacman is already running, or run update manually to see errors."
|
||||
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||
|
||||
if pacman -Qu | grep -v "\[ignored\]"
|
||||
then
|
||||
if pacman -Qu | grep -v "\[ignored\]"; then
|
||||
notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
|
||||
else
|
||||
notify-send " Repository Sync" "Sync complete. No new packages for update."
|
||||
notify-send " Repository Sync" "Sync complete. No new packages for update."
|
||||
fi
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
# Toggles all cronjobs off/on.
|
||||
# Stores disabled crontabs in ~/.consaved until restored.
|
||||
|
||||
([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send " Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send " Cronjobs saved and disabled.")
|
||||
([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - <"${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send " Cronjobs re-enabled.") || (crontab -l >"${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send " Cronjobs saved and disabled.")
|
||||
|
|
|
@ -12,9 +12,15 @@
|
|||
# Xorg and MacOS as well.
|
||||
|
||||
# Run only if user logged in (prevent cron errors)
|
||||
pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;}
|
||||
pgrep -u "${USER:=$LOGNAME}" >/dev/null || {
|
||||
echo "$USER not logged in; sync will not run."
|
||||
exit
|
||||
}
|
||||
# Run only if not already running in other instance
|
||||
pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;}
|
||||
pgrep mbsync >/dev/null && {
|
||||
echo "mbsync is already running."
|
||||
exit
|
||||
}
|
||||
|
||||
# First, we have to get the right variables for the mbsync file, the pass
|
||||
# archive, notmuch and the GPG home. This is done by searching common profile
|
||||
|
@ -25,7 +31,7 @@ pkill -RTMIN+12 dwmblocks
|
|||
|
||||
eval "$(grep -h -- \
|
||||
"^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \
|
||||
"$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \
|
||||
"$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \
|
||||
"$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \
|
||||
"$HOME/.pam_environment" 2>/dev/null)"
|
||||
|
||||
|
@ -35,54 +41,53 @@ alias mbsync="mbsync -c $MBSYNCRC"
|
|||
|
||||
# Settings are different for MacOS (Darwin) systems.
|
||||
case "$(uname)" in
|
||||
Darwin)
|
||||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
|
||||
;;
|
||||
*)
|
||||
case "$(readlink -f /sbin/init)" in
|
||||
*systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
|
||||
esac
|
||||
# remember if a display server is running since `ps` doesn't always contain a display
|
||||
pgrepoutput="$(pgrep -a X\(org\|wayland\))"
|
||||
displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)"
|
||||
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do
|
||||
export DISPLAY=$x
|
||||
notify-send --app-name="mutt-wizard" "New mail!" "📬 $2 new mail(s) in \`$1\` account."
|
||||
done ;}
|
||||
;;
|
||||
Darwin)
|
||||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2; }
|
||||
;;
|
||||
*)
|
||||
case "$(readlink -f /sbin/init)" in
|
||||
*systemd* | *openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
|
||||
esac
|
||||
# remember if a display server is running since `ps` doesn't always contain a display
|
||||
pgrepoutput="$(pgrep -a X\(org\|wayland\))"
|
||||
displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)"
|
||||
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do
|
||||
export DISPLAY=$x
|
||||
notify-send --app-name="mutt-wizard" "New mail!" "📬 $2 new mail(s) in \`$1\` account."
|
||||
done; }
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check account for new mail. Notify if there is new content.
|
||||
syncandnotify() {
|
||||
acc="$(echo "$account" | sed "s/.*\///")"
|
||||
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
||||
new=$(find\
|
||||
"$HOME/.local/share/mail/$acc/INBOX/new/"\
|
||||
"$HOME/.local/share/mail/$acc/Inbox/new/"\
|
||||
"$HOME/.local/share/mail/$acc/inbox/new/"\
|
||||
"$HOME/.local/share/mail/$acc/INBOX/cur/"\
|
||||
"$HOME/.local/share/mail/$acc/Inbox/cur/"\
|
||||
"$HOME/.local/share/mail/$acc/inbox/cur/"\
|
||||
-type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null)
|
||||
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
|
||||
case 1 in
|
||||
$((newcount > 0)) ) notify "$acc" "$newcount" ;;
|
||||
esac
|
||||
acc="$(echo "$account" | sed "s/.*\///")"
|
||||
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
||||
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" \
|
||||
"$HOME/.local/share/mail/$acc/Inbox/new/" \
|
||||
"$HOME/.local/share/mail/$acc/inbox/new/" \
|
||||
"$HOME/.local/share/mail/$acc/INBOX/cur/" \
|
||||
"$HOME/.local/share/mail/$acc/Inbox/cur/" \
|
||||
"$HOME/.local/share/mail/$acc/inbox/cur/" \
|
||||
-type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2>/dev/null)
|
||||
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
|
||||
case 1 in
|
||||
$((newcount > 0))) notify "$acc" "$newcount" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Sync accounts passed as argument or all.
|
||||
if [ "$#" -eq "0" ]; then
|
||||
accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
|
||||
accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
|
||||
else
|
||||
for arg in "$@"; do
|
||||
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
|
||||
done
|
||||
accounts=$*
|
||||
for arg in "$@"; do
|
||||
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
|
||||
done
|
||||
accounts=$*
|
||||
fi
|
||||
|
||||
# Parallelize multiple accounts
|
||||
for account in $accounts; do
|
||||
syncandnotify &
|
||||
syncandnotify &
|
||||
done
|
||||
|
||||
wait
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit
|
||||
|
||||
echo " 痢" > /tmp/newsupdate
|
||||
echo " 痢" >/tmp/newsupdate
|
||||
pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
|
||||
/usr/bin/newsboat -x reload
|
||||
rm -f /tmp/newsupdate
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
while :; do
|
||||
dmesg -W -f kern | grep "input:" -q
|
||||
sleep 1
|
||||
remaps us:dvorak
|
||||
done
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
# battery status file is sent in as an argument from sb-battery
|
||||
|
||||
while inotifywait -e modify "$1/status"; do
|
||||
pkill -RTMIN+3 dwmblocks || break
|
||||
done
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
while :; do
|
||||
mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break
|
||||
done
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
playerctl status -F | (while read -r _; do pkill -RTMIN+11 dwmblocks; done)
|
|
@ -6,60 +6,64 @@
|
|||
|
||||
twoscreen() { # If multi-monitor is selected and there are two screens.
|
||||
|
||||
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
|
||||
# Mirror displays using native resolution of external display and a scaled
|
||||
# version for the internal display
|
||||
if [ "$mirror" = "yes" ]; then
|
||||
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
||||
internal=$(echo "$screens" | grep -v "$external")
|
||||
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
|
||||
# Mirror displays using native resolution of external display and a scaled
|
||||
# version for the internal display
|
||||
if [ "$mirror" = "yes" ]; then
|
||||
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
||||
internal=$(echo "$screens" | grep -v "$external")
|
||||
|
||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
|
||||
tail -n 1 | awk '{print $1}')
|
||||
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
|
||||
tail -n 1 | awk '{print $1}')
|
||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
|
||||
tail -n 1 | awk '{print $1}')
|
||||
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
|
||||
tail -n 1 | awk '{print $1}')
|
||||
|
||||
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
|
||||
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
|
||||
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
|
||||
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
|
||||
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
|
||||
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
|
||||
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
|
||||
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
|
||||
|
||||
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
|
||||
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
||||
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
|
||||
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
||||
|
||||
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
||||
--output "$internal" --auto --same-as "$external" \
|
||||
--scale "$scale_x"x"$scale_y"
|
||||
else
|
||||
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
||||
--output "$internal" --auto --same-as "$external" \
|
||||
--scale "$scale_x"x"$scale_y"
|
||||
else
|
||||
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||
fi
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||
fi
|
||||
}
|
||||
|
||||
morescreen() { # If multi-monitor is selected and there are more than two screens.
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:")
|
||||
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:")
|
||||
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
|
||||
}
|
||||
|
||||
multimon() { # Multi-monitor handler.
|
||||
case "$(echo "$screens" | wc -l)" in
|
||||
2) twoscreen ;;
|
||||
*) morescreen ;;
|
||||
esac ;}
|
||||
case "$(echo "$screens" | wc -l)" in
|
||||
2) twoscreen ;;
|
||||
*) morescreen ;;
|
||||
esac
|
||||
}
|
||||
|
||||
onescreen() { # If only one output available or chosen.
|
||||
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)""
|
||||
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)""
|
||||
}
|
||||
|
||||
postrun() { # Stuff to run to clean up.
|
||||
setbg # Fix background if screen size/arangement has changed.
|
||||
remaps-no-change # Re-remap keys if keyboard added (for laptop bases)
|
||||
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||
setbg # Fix background if screen size/arangement has changed.
|
||||
remaps -n # Re-remap keys if keyboard added (for laptop bases)
|
||||
{
|
||||
killall dunst
|
||||
setsid -f dunst
|
||||
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||
}
|
||||
|
||||
# Get all possible displays
|
||||
|
@ -70,14 +74,22 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
|
|||
|
||||
# If there's only one screen
|
||||
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
||||
{ onescreen "$screens"; postrun; notify-send "💻 Only one screen detected." "Using it in its optimal settings..."; exit ;}
|
||||
{
|
||||
onescreen "$screens"
|
||||
postrun
|
||||
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
|
||||
exit
|
||||
}
|
||||
|
||||
# Get user choice including multi-monitor and manual selection:
|
||||
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
||||
case "$chosen" in
|
||||
"manual selection") arandr ; exit ;;
|
||||
"multi-monitor") multimon ;;
|
||||
*) onescreen "$chosen" ;;
|
||||
esac
|
||||
case "$chosen" in
|
||||
"manual selection")
|
||||
arandr
|
||||
exit
|
||||
;;
|
||||
"multi-monitor") multimon ;;
|
||||
*) onescreen "$chosen" ;;
|
||||
esac
|
||||
|
||||
postrun
|
||||
|
|
|
@ -5,17 +5,20 @@
|
|||
feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
|
||||
|
||||
case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in
|
||||
"copy url") echo "$feed" | xclip -selection clipboard ;;
|
||||
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
|
||||
"queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
|
||||
"queue yt-dlp audio") qndl "$feed" 'yt-dlp -o "%(title)s.%(ext)s" -f bestaudio --embed-metadata --restrict-filenames' ;;
|
||||
"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
|
||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
|
||||
lynx) lynx "$feed" >/dev/null 2>&1 ;;
|
||||
"copy url") echo "$feed" | xclip -selection clipboard ;;
|
||||
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
|
||||
"queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
|
||||
"queue yt-dlp audio") qndl "$feed" 'yt-dlp -o "%(title)s.%(ext)s" -f bestaudio --embed-metadata --restrict-filenames' ;;
|
||||
"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
PDF) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
sxiv) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
vim) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
setbg)
|
||||
curl -L "$feed" >$XDG_CACHE_HOME/pic
|
||||
xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1
|
||||
;;
|
||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
|
||||
lynx) lynx "$feed" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
|
|
|
@ -5,18 +5,18 @@
|
|||
# be prompted to give a mountpoint from already existsing directories. If you
|
||||
# input a novel directory, it will prompt you to create that directory.
|
||||
|
||||
getmount() { \
|
||||
getmount() {
|
||||
[ -z "$chosen" ] && exit 1
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2086
|
||||
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
||||
test -z "$mp" && exit 1
|
||||
if [ ! -d "$mp" ]; then
|
||||
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
|
||||
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
mountusb() { \
|
||||
mountusb() {
|
||||
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
|
||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||
sudo -A mount "$chosen" 2>/dev/null && notify-send "禍 USB mounting" "$chosen mounted." && exit 0
|
||||
|
@ -24,30 +24,35 @@ mountusb() { \
|
|||
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
|
||||
partitiontype="$(lsblk -no "fstype" "$chosen")"
|
||||
case "$partitiontype" in
|
||||
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
|
||||
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";;
|
||||
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
|
||||
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
|
||||
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;;
|
||||
*)
|
||||
sudo -A mount "$chosen" "$mp"
|
||||
user="$(whoami)"
|
||||
ug="$(groups | awk '{print $1}')"
|
||||
sudo -A chown "$user":"$ug" "$mp"
|
||||
;;
|
||||
esac && notify-send "禍 USB mounting" "$chosen mounted to $mp." ||
|
||||
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
|
||||
}
|
||||
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
|
||||
}
|
||||
|
||||
mountandroid() { \
|
||||
mountandroid() {
|
||||
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
||||
chosen="$(echo "$chosen" | cut -d : -f 1)"
|
||||
getmount "$HOME -maxdepth 3 -type d"
|
||||
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
|
||||
simple-mtpfs --device "$chosen" "$mp" &&
|
||||
notify-send " Android Mounting" "Android device mounted to $mp." ||
|
||||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
||||
}
|
||||
simple-mtpfs --device "$chosen" "$mp" &&
|
||||
notify-send " Android Mounting" "Android device mounted to $mp." ||
|
||||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
||||
}
|
||||
|
||||
asktype() { \
|
||||
asktype() {
|
||||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
||||
case $choice in
|
||||
USB) mountusb ;;
|
||||
Android) mountandroid ;;
|
||||
USB) mountusb ;;
|
||||
Android) mountandroid ;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
|
||||
anddrives=$(simple-mtpfs -l 2>/dev/null)
|
||||
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
|
||||
|
|
|
@ -13,7 +13,8 @@ share2mnt=//"$srvname".local/"$share"
|
|||
sharemount() {
|
||||
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
|
||||
[ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
|
||||
notify-send "Netshare $share already mounted"; exit 1
|
||||
notify-send "Netshare $share already mounted"
|
||||
exit 1
|
||||
}
|
||||
|
||||
sharemount
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
#
|
||||
# If there is already a running instance, user will be prompted to end it.
|
||||
|
||||
updateicon() { \
|
||||
echo "$1" > /tmp/recordingicon
|
||||
updateicon() {
|
||||
echo "$1" >/tmp/recordingicon
|
||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||
}
|
||||
}
|
||||
|
||||
killrecording() {
|
||||
recpid="$(cat /tmp/recordingpid)"
|
||||
|
@ -25,99 +25,100 @@ killrecording() {
|
|||
sleep 3
|
||||
kill -9 "$recpid"
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
screencast() { \
|
||||
screencast() {
|
||||
ffmpeg -y \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-f alsa -i default \
|
||||
-r 30 \
|
||||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
||||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
||||
echo $! > /tmp/recordingpid
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-f alsa -i default \
|
||||
-r 30 \
|
||||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
||||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲠ"
|
||||
}
|
||||
}
|
||||
|
||||
video() { ffmpeg \
|
||||
-f x11grab \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! > /tmp/recordingpid
|
||||
updateicon "ﲣ"
|
||||
}
|
||||
|
||||
webcamhidef() { ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 1920x1080 \
|
||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! > /tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
|
||||
webcam() { ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 640x480 \
|
||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! > /tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
|
||||
|
||||
audio() { \
|
||||
video() {
|
||||
ffmpeg \
|
||||
-f alsa -i default \
|
||||
-c:a flac \
|
||||
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
|
||||
echo $! > /tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
-f x11grab \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲣ"
|
||||
}
|
||||
|
||||
askrecording() { \
|
||||
webcamhidef() {
|
||||
ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 1920x1080 \
|
||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
|
||||
webcam() {
|
||||
ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 640x480 \
|
||||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
|
||||
audio() {
|
||||
ffmpeg \
|
||||
-f alsa -i default \
|
||||
-c:a flac \
|
||||
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon ""
|
||||
}
|
||||
|
||||
askrecording() {
|
||||
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
||||
case "$choice" in
|
||||
screencast) screencast;;
|
||||
audio) audio;;
|
||||
video) video;;
|
||||
*selected) videoselected;;
|
||||
webcam) webcam;;
|
||||
"webcam (hi-def)") webcamhidef;;
|
||||
screencast) screencast ;;
|
||||
audio) audio ;;
|
||||
video) video ;;
|
||||
*selected) videoselected ;;
|
||||
webcam) webcam ;;
|
||||
"webcam (hi-def)") webcamhidef ;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
|
||||
asktoend() { \
|
||||
asktoend() {
|
||||
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
||||
[ "$response" = "Yes" ] && killrecording
|
||||
}
|
||||
[ "$response" = "Yes" ] && killrecording
|
||||
}
|
||||
|
||||
videoselected()
|
||||
{
|
||||
slop -f "%x %y %w %h" > /tmp/slop
|
||||
read -r X Y W H < /tmp/slop
|
||||
videoselected() {
|
||||
slop -f "%x %y %w %h" >/tmp/slop
|
||||
read -r X Y W H </tmp/slop
|
||||
rm /tmp/slop
|
||||
|
||||
ffmpeg \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-video_size "$W"x"$H" \
|
||||
-i :0.0+"$X,$Y" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! > /tmp/recordingpid
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-video_size "$W"x"$H" \
|
||||
-i :0.0+"$X,$Y" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! >/tmp/recordingpid
|
||||
updateicon "ﲣ"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
screencast) screencast;;
|
||||
audio) audio;;
|
||||
video) video;;
|
||||
*selected) videoselected;;
|
||||
kill) killrecording;;
|
||||
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
|
||||
screencast) screencast ;;
|
||||
audio) audio ;;
|
||||
video) video ;;
|
||||
*selected) videoselected ;;
|
||||
kill) killrecording ;;
|
||||
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording ;;
|
||||
esac
|
||||
|
|
|
@ -4,22 +4,25 @@
|
|||
# Provides you with mounted partitions, select one to unmount.
|
||||
# Drives mounted at /, /boot and /home will not be options to unmount.
|
||||
|
||||
drives="$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'; awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab)"
|
||||
drives="$(
|
||||
lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'
|
||||
awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab
|
||||
)"
|
||||
|
||||
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||
|
||||
case "$chosen" in
|
||||
*)
|
||||
chosen="${chosen#📱 }"
|
||||
sudo -A umount -l "$chosen"
|
||||
;;
|
||||
*)
|
||||
chosen="${chosen% (*}"
|
||||
sudo -A umount -l "$chosen"
|
||||
;;
|
||||
*)
|
||||
chosen="${chosen#📱 }"
|
||||
sudo -A umount -l "$chosen"
|
||||
;;
|
||||
*)
|
||||
chosen="${chosen% (*}"
|
||||
sudo -A umount -l "$chosen"
|
||||
;;
|
||||
esac && notify-send "禍 Drive unmounted." "$chosen successfully unmounted." ||
|
||||
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
|
||||
|
||||
sudo -A umount "$chosen" && notify-send "禍 USB unmounting" "$chosen unmounted."
|
||||
sudo -A umount "$chosen" && notify-send "禍 USB unmounting" "$chosen unmounted."
|
||||
|
||||
sudo -A umount -l "$chosen" && notify-send " Android unmounting" "$chosen unmounted."
|
||||
sudo -A umount -l "$chosen" && notify-send " Android unmounting" "$chosen unmounted."
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
set -e
|
||||
path="$1"
|
||||
shift 1
|
||||
while [[ $path != / ]];
|
||||
do
|
||||
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
||||
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
||||
path="$(readlink -f "$path"/..)"
|
||||
while [[ $path != / ]]; do
|
||||
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
||||
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
||||
path="$(readlink -f "$path"/..)"
|
||||
done
|
||||
|
||||
|
|
|
@ -13,15 +13,19 @@ else
|
|||
fi
|
||||
|
||||
case "$url" in
|
||||
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
|
||||
setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;;
|
||||
*png|*jpg|*jpe|*jpeg|*gif)
|
||||
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
*pdf|*cbz|*cbr)
|
||||
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
*mp3|*flac|*opus|*mp3?source*)
|
||||
qndl "$url" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
*)
|
||||
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
|
||||
*mkv | *webm | *mp4 | *youtube.com/watch* | *youtube.com/playlist* | *youtube.com/shorts* | *youtu.be* | *hooktube.com* | *bitchute.com* | *videos.lukesmith.xyz* | *odysee.com*)
|
||||
setsid -f mpv -quiet "$url" >/dev/null 2>&1
|
||||
;;
|
||||
*png | *jpg | *jpe | *jpeg | *gif)
|
||||
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||
;;
|
||||
*pdf | *cbz | *cbr)
|
||||
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||
;;
|
||||
*mp3 | *flac | *opus | *mp3?source*)
|
||||
qndl "$url" 'curl -LO' >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -9,11 +9,10 @@ output="$(date '+%y%m%d-%H%M-%S').png"
|
|||
xclip_cmd="xclip -sel clip -t image/png"
|
||||
|
||||
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
|
||||
"a selected area") maim -s pic-selected-"${output}" ;;
|
||||
"current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
|
||||
"full screen") maim -q -d 0.2 pic-full-"${output}" ;;
|
||||
"a selected area (copy)") maim -s | ${xclip_cmd} ;;
|
||||
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;
|
||||
"full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
|
||||
"a selected area") maim -s pic-selected-"${output}" ;;
|
||||
"current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
|
||||
"full screen") maim -q -d 0.2 pic-full-"${output}" ;;
|
||||
"a selected area (copy)") maim -s | ${xclip_cmd} ;;
|
||||
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;
|
||||
"full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
basename="${1%.*}"
|
||||
|
||||
case "${*}" in
|
||||
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
|
||||
*.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
|
||||
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
|
||||
*.tex | *.m[dse] | *.[rR]md | *.mom | *.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
|
||||
*.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
|
||||
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Arbitrary but unique message tag
|
||||
msgTag="volume"
|
||||
|
||||
# Change the volume using alsa(might differ if you use pulseaudio)
|
||||
pamixer "$@" >/dev/null
|
||||
|
||||
# Query amixer for the current volume and whether or not the speaker is muted
|
||||
volume="$(pamixer --get-volume)"
|
||||
|
||||
if [ "$volume" -gt "100" ]; then
|
||||
urgency="critical"
|
||||
else
|
||||
urgency="low"
|
||||
fi
|
||||
|
||||
if [ "$volume" -gt "70" ]; then
|
||||
icon="audio-volume-high"
|
||||
elif [ "$volume" -gt "30" ]; then
|
||||
icon="audio-volume-medium"
|
||||
elif [ "$volume" -gt "0" ]; then
|
||||
icon="audio-volume-low"
|
||||
fi
|
||||
|
||||
mute="$(pamixer --get-mute)"
|
||||
if [ "$volume" = 0 ] || [ "$mute" = "true" ]; then
|
||||
notify-send -a "changeVolume" -i "audio-volume-muted" -u $urgency -h string:x-dunst-stack-tag:$msgTag "Volume muted"
|
||||
else
|
||||
notify-send -a "changeVolume" -i "$icon" -u $urgency -h string:x-dunst-stack-tag:$msgTag \
|
||||
-h int:value:"$volume" "Volume: ${volume}%"
|
||||
fi
|
||||
|
||||
# Play the volume changed sound
|
||||
canberra-gtk-play -i audio-volume-change -d "changeVolume"
|
|
@ -6,5 +6,5 @@
|
|||
# (with other things) by default and is used in some other places.
|
||||
|
||||
for i in $(ls /tmp/mpvSockets/*); do
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
|
||||
done
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
# For example:
|
||||
# `./prompt "Do you want to shutdown?" "shutdown -h now"`
|
||||
|
||||
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2
|
||||
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray)" = "Yes" ] && $2
|
||||
|
|
|
@ -9,6 +9,6 @@ while read -r line; do
|
|||
[ -z "$line" ] && continue
|
||||
url="${line%%[ ]*}"
|
||||
qndl "$url" "curl -LO"
|
||||
done < "$queuefile"
|
||||
done <"$queuefile"
|
||||
|
||||
echo > "$queuefile"
|
||||
echo >"$queuefile"
|
||||
|
|
|
@ -1,29 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
groups="us:dvorak de:nodeadkeys"
|
||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
|
||||
index() {
|
||||
echo "$groups" | cut -d ' ' -f "$1"
|
||||
echo "$groups" | cut -d ' ' -f "$1"
|
||||
}
|
||||
|
||||
i=1
|
||||
while [ ! "$found" ]; do
|
||||
group=$(index $i)
|
||||
if [ "$group" = "$current" ]; then
|
||||
newgroup=$(index $((i+1)))
|
||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||
found=true
|
||||
elif [ -z "$group" ]; then
|
||||
newgroup=$(index 1)
|
||||
found=true
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
if [ "$1" = "-n" ]; then
|
||||
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
elif [ "$1" = "" ]; then
|
||||
groups="us:dvorak de:nodeadkeys"
|
||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
i=1
|
||||
while [ ! "$found" ]; do
|
||||
group=$(index $i)
|
||||
if [ "$group" = "$current" ]; then
|
||||
newgroup=$(index $((i + 1)))
|
||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||
found=true
|
||||
elif [ -z "$group" ]; then
|
||||
newgroup=$(index 1)
|
||||
found=true
|
||||
fi
|
||||
i=$((i + 1))
|
||||
done
|
||||
else
|
||||
newgroup="$1"
|
||||
fi
|
||||
|
||||
setxkbmap -layout "$(echo "$newgroup" | cut -d ':' -f1)" -variant "$(echo "$newgroup" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp
|
||||
setxkbmap -layout "$(echo "$newgroup" | cut -d ':' -f1)" -variant "$(echo "$newgroup" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp 1>/dev/null 2>&1 || echo "Unkown keyboard layout"
|
||||
xset r rate 300 50
|
||||
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
||||
killall xcape 2>/dev/null
|
||||
xcape -e 'Super_L=Escape'
|
||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||
sleep 0.03
|
||||
pkill -RTMIN+15 dwmblocks
|
||||
|
|
|
@ -4,7 +4,8 @@ current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s
|
|||
|
||||
setxkbmap -layout "$(echo "$current" | cut -d ':' -f1)" -variant "$(echo "$current" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp
|
||||
xset r rate 300 50
|
||||
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
||||
killall xcape 2>/dev/null
|
||||
xcape -e 'Super_L=Escape'
|
||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||
sleep 0.03
|
||||
pkill -RTMIN+15 dwmblocks
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
if echo "$1" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" ; then
|
||||
if echo "$1" | grep -q "https*://\S\+\.[A-Za-z]\+\S*"; then
|
||||
url="$1"
|
||||
else
|
||||
url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" |
|
||||
|
@ -14,5 +14,5 @@ RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
|
|||
if awk '{print $1}' "$RSSFILE" | grep "^$url$" >/dev/null; then
|
||||
notify-send "You already have this RSS feed."
|
||||
else
|
||||
echo "$url" >> "$RSSFILE" && notify-send "RSS feed added."
|
||||
echo "$url" >>"$RSSFILE" && notify-send "RSS feed added."
|
||||
fi
|
||||
|
|
|
@ -10,8 +10,8 @@ for PID in $PIDlist; do
|
|||
cwd=$(readlink /proc/"$PID"/cwd)
|
||||
# zsh and lf won't be ignored even if it shows ~ or /
|
||||
case "$cmdline" in
|
||||
'lf -server') continue ;;
|
||||
"${SHELL##*/}"|'lf'|'lf '*) break ;;
|
||||
'lf -server') continue ;;
|
||||
"${SHELL##*/}" | 'lf' | 'lf '*) break ;;
|
||||
esac
|
||||
# git (and its sub-processes) will show the root of a repository instead of the actual cwd, so they're ignored
|
||||
[ "$process_group_leader" = 'git' ] || [ ! -d "$cwd" ] && continue
|
||||
|
|
|
@ -8,10 +8,13 @@
|
|||
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
|
||||
|
||||
trueloc="$(readlink -f "$1")" &&
|
||||
case "$(file --mime-type -b "$trueloc")" in
|
||||
image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
||||
inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
||||
*) notify-send "Error" "Not a valid image." ; exit 1;;
|
||||
esac
|
||||
case "$(file --mime-type -b "$trueloc")" in
|
||||
image/*) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
||||
inode/directory) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
||||
*)
|
||||
notify-send "Error" "Not a valid image."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
xwallpaper --zoom "$bgloc"
|
||||
|
|
|
@ -12,7 +12,7 @@ lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc"
|
|||
|
||||
# Remove, prepare files
|
||||
rm -f "$shell_shortcuts" "$lf_files" "$lf_dirs" "$lf_shortcuts" "$zsh_named_dirs" 2>/dev/null
|
||||
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
|
||||
printf "# vim: filetype=sh\\nalias " >"$shell_shortcuts"
|
||||
|
||||
# Format the `directories` file in the correct syntax and sent it to all three configs.
|
||||
eval "echo \"$(cat "$bmdirs")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
vals=$(aptitude full-upgrade --simulate --assume-yes |
|
||||
grep -m1 '^[0-9]\+ packages upgraded,' |
|
||||
tr -cd '0-9 ' |
|
||||
tr ' ' '\n' |
|
||||
grep '[0-9]\+' |
|
||||
xargs echo)
|
||||
|
||||
print=" "
|
||||
for i in $vals; do
|
||||
[ $i != 0 ] && icon="\033[11m\033[10m"
|
||||
print="$print$i/"
|
||||
done
|
||||
|
||||
[ -n "$icon" ] && printf "$icon " && echo $print | sed 's/\/$//'
|
|
@ -6,40 +6,64 @@ green="\033[32m"
|
|||
white="\033[37m"
|
||||
reset="\033[0m"
|
||||
for battery in /sys/class/power_supply/BAT?*; do
|
||||
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
|
||||
[ -n "${capacity+x}" ] && printf " "
|
||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||
case "$(cat "$battery/status" 2>&1)" in
|
||||
"Full") icon=""; color="$green" ;;
|
||||
"Charging") icon=""; color="$cyan" ;;
|
||||
"Not charging") icon=""; color="$white" ;;
|
||||
"Unknown") icon=""; color="$orange" ;;
|
||||
"Discharging")
|
||||
if [ "$capacity" -le 10 ]; then
|
||||
icon=""; color="$red"
|
||||
elif [ "$capacity" -le 20 ]; then
|
||||
icon=""; color="$red"
|
||||
elif [ "$capacity" -le 30 ]; then
|
||||
icon=""; color="$white"
|
||||
elif [ "$capacity" -le 40 ]; then
|
||||
icon=""; color="$white"
|
||||
elif [ "$capacity" -le 50 ]; then
|
||||
icon=""; color="$white"
|
||||
elif [ "$capacity" -le 60 ]; then
|
||||
icon=""; color="$white"
|
||||
elif [ "$capacity" -le 70 ]; then
|
||||
icon=""; color="$white"
|
||||
elif [ "$capacity" -le 80 ]; then
|
||||
icon=""; color="$white"
|
||||
elif [ "$capacity" -le 90 ]; then
|
||||
icon=""; color="$white"
|
||||
elif [ "$capacity" -le 95 ]; then
|
||||
icon=""; color="$white"
|
||||
else
|
||||
icon=""; color="$white"
|
||||
fi
|
||||
|
||||
;;
|
||||
*) exit 1 ;;
|
||||
"Full")
|
||||
icon=""
|
||||
color="$green"
|
||||
;;
|
||||
"Charging")
|
||||
icon=""
|
||||
color="$cyan"
|
||||
;;
|
||||
"Not charging")
|
||||
icon=""
|
||||
color="$white"
|
||||
;;
|
||||
"Unknown")
|
||||
icon=""
|
||||
color="$orange"
|
||||
;;
|
||||
"Discharging")
|
||||
if [ "$capacity" -le 10 ]; then
|
||||
icon=""
|
||||
color="$red"
|
||||
elif [ "$capacity" -le 20 ]; then
|
||||
icon=""
|
||||
color="$red"
|
||||
elif [ "$capacity" -le 30 ]; then
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 40 ]; then
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 50 ]; then
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 60 ]; then
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 70 ]; then
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 80 ]; then
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 90 ]; then
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 95 ]; then
|
||||
icon=""
|
||||
color="$white"
|
||||
else
|
||||
icon=""
|
||||
color="$white"
|
||||
fi
|
||||
|
||||
;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
printf "$color%s$reset %d" "$icon" "$capacity";
|
||||
printf "$color%s$reset %d" "$icon" "$capacity"
|
||||
done && printf "\\n"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
cache=/tmp/cpubarscache
|
||||
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
|
||||
[ ! -f $cache ] && echo "$stats" > "$cache"
|
||||
[ ! -f $cache ] && echo "$stats" >"$cache"
|
||||
old=$(cat "$cache")
|
||||
printf "\033[11m\033[10m "
|
||||
echo "$stats" | while read -r row; do
|
||||
|
@ -12,14 +12,15 @@ echo "$stats" | while read -r row; do
|
|||
case "$(echo "$old" | awk '{if ($1 == id)
|
||||
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
|
||||
id="$id" total="$total" idle="$idle")" in
|
||||
"0") printf "\033[32m▁";;
|
||||
"1") printf "\033[32m▂";;
|
||||
"2") printf "\033[32m▃";;
|
||||
"3") printf "\033[33m▄";;
|
||||
"4") printf "\033[33m▅";;
|
||||
"5") printf "\033[33m▆";;
|
||||
"6"|"7"|"8") printf "\033[31m▇";;
|
||||
"0") printf "\033[32m▁" ;;
|
||||
"1") printf "\033[32m▂" ;;
|
||||
"2") printf "\033[32m▃" ;;
|
||||
"3") printf "\033[33m▄" ;;
|
||||
"4") printf "\033[33m▅" ;;
|
||||
"5") printf "\033[33m▆" ;;
|
||||
"6" | "7" | "8") printf "\033[31m▇" ;;
|
||||
|
||||
esac
|
||||
done; printf "\033[0m\n"
|
||||
echo "$stats" > "$cache"
|
||||
done
|
||||
printf "\033[0m\n"
|
||||
echo "$stats" >"$cache"
|
||||
|
|
|
@ -12,7 +12,7 @@ url="wttr.in/Karlsruhe"
|
|||
opt="?F"
|
||||
emojiopt="?format=1"
|
||||
convertemoji() {
|
||||
sed -i '
|
||||
sed -i '
|
||||
s/☀️//
|
||||
s/☁️//
|
||||
s/⛅️//
|
||||
|
@ -26,11 +26,11 @@ s/🌩//
|
|||
s/🌫//
|
||||
' "$emojifile"
|
||||
}
|
||||
getforecast() { curl -sf "$url$opt" > "$weatherfile" && curl -sf "$url$emojiopt" > "$emojifile" || exit 1 ;}
|
||||
showweather() {
|
||||
emoji="$(printf "\033[12m%s\033[10m" "$(cut -d ' ' -f 1 "$emojifile")")"
|
||||
sed '16q;d' "$weatherfile" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/$emoji /g;1q" | tr -d '\n'
|
||||
sed '13q;d' "$weatherfile" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " \033[34m\033[0m " $1 "°","\033[31m\033[0m " $2 "°"}';
|
||||
getforecast() { curl -sf "$url$opt" >"$weatherfile" && curl -sf "$url$emojiopt" >"$emojifile" || exit 1; }
|
||||
showweather() {
|
||||
emoji="$(printf "\033[12m%s\033[10m" "$(cut -d ' ' -f 1 "$emojifile")")"
|
||||
sed '16q;d' "$weatherfile" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/$emoji /g;1q" | tr -d '\n'
|
||||
sed '13q;d' "$weatherfile" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " \033[34m\033[0m " $1 "°","\033[31m\033[0m " $2 "°"}'
|
||||
}
|
||||
getforecast && convertemoji
|
||||
showweather
|
||||
|
|
|
@ -1,29 +1,28 @@
|
|||
#!/bin/sh
|
||||
# FIX: Script dies when ethernet cable is plugged in through docking station
|
||||
shift=""
|
||||
|
||||
if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
|
||||
for w in /sys/class/net/w*/operstate; do
|
||||
percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
|
||||
grep -vxq '0x1003' && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/" $w | tr -d "[:space:]")"
|
||||
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
|
||||
shift=" "
|
||||
done
|
||||
for w in /sys/class/net/w*/; do
|
||||
percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w/operstate)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
|
||||
grep -vxq '0x1003' "$w/flags" && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/" $w/operstate | tr -d "[:space:]")"
|
||||
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
|
||||
shift=" "
|
||||
done
|
||||
fi
|
||||
|
||||
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
|
||||
for e in /sys/class/net/e*/operstate; do
|
||||
if_icon="$(sed "s/down//;s/up//" $e)"
|
||||
printf "$shift\033[11m%s\033[10m" "$if_icon"
|
||||
shift=" "
|
||||
done
|
||||
for e in /sys/class/net/e*/operstate; do
|
||||
if_icon="$(sed "s/down//;s/up//" $e)"
|
||||
printf "$shift\033[11m%s\033[10m" "$if_icon"
|
||||
shift=" "
|
||||
done
|
||||
fi
|
||||
|
||||
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
|
||||
for _ in /sys/class/net/tun*/operstate; do
|
||||
printf "$shift\033[11m%s\033[10m" "嬨"
|
||||
shift=" "
|
||||
done
|
||||
for _ in /sys/class/net/tun*/operstate; do
|
||||
printf "$shift\033[11m%s\033[10m" "嬨"
|
||||
shift=" "
|
||||
done
|
||||
fi
|
||||
|
||||
printf "\n"
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#!/bin/sh
|
||||
filter() {
|
||||
if mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 3 ]; then
|
||||
song=$(mpc current -f "%artist% - %title%" | xargs -0 )
|
||||
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
|
||||
mpc | awk 'NR==2' | grep -q playing && icon="" || icon=""
|
||||
echo "$icon $song"
|
||||
elif mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 1 ]; then
|
||||
echo "ﱙ"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
if mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 3 ]; then
|
||||
song=$(mpc current -f "%artist% - %title%" | xargs -0)
|
||||
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
|
||||
mpc | awk 'NR==2' | grep -q playing && icon="" || icon=""
|
||||
echo "$icon $song"
|
||||
elif mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 1 ]; then
|
||||
echo "ﱙ"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
pidof -x sbd-music >/dev/null 2>&1 || sbd-music >/dev/null 2>&1 &
|
||||
filter
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/sh
|
||||
update() {
|
||||
sum=0
|
||||
for arg; do
|
||||
read -r i < "$arg"
|
||||
sum=$(( sum + i ))
|
||||
done
|
||||
cache=/tmp/${1##*/}
|
||||
[ -f "$cache" ] && read -r old < "$cache" || old=0
|
||||
printf %d\\n "$sum" > "$cache"
|
||||
printf %d\\n $(( sum - old ))
|
||||
sum=0
|
||||
for arg; do
|
||||
read -r i <"$arg"
|
||||
sum=$((sum + i))
|
||||
done
|
||||
cache=/tmp/${1##*/}
|
||||
[ -f "$cache" ] && read -r old <"$cache" || old=0
|
||||
printf %d\\n "$sum" >"$cache"
|
||||
printf %d\\n $((sum - old))
|
||||
}
|
||||
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
||||
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/sh
|
||||
vals=$(aptitude full-upgrade --simulate --assume-yes |\
|
||||
grep -m1 '^[0-9]\+ packages upgraded,' |\
|
||||
tr -cd '0-9 ' |\
|
||||
tr ' ' '\n' |\
|
||||
grep '[0-9]\+' |\
|
||||
xargs echo)
|
||||
|
||||
print=" "
|
||||
for i in $vals; do
|
||||
[ $i != 0 ] && icon="\033[11m\033[10m"
|
||||
print="$print$i/"
|
||||
done
|
||||
|
||||
[ -n "$icon" ] && printf "$icon " && echo $print | sed 's/\/$//'
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# Prints the current volume or ﱝ if muted.
|
||||
[ "$(pamixer --get-mute)" = true ] && echo "ﱝ" && exit
|
||||
[ "$(pamixer --get-mute)" = true ] && echo "\033[11mﱝ\033[10m" && exit
|
||||
vol="$(pamixer --get-volume)"
|
||||
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
|
@ -9,9 +9,9 @@ elif [ "$vol" -gt "30" ]; then
|
|||
icon=""
|
||||
elif [ "$vol" -gt "0" ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -eq "0" ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -eq "0" ]; then
|
||||
icon=""
|
||||
else
|
||||
printf "\033[11m\033[10m " && exit
|
||||
printf "\033[11m\033[10m " && exit
|
||||
fi
|
||||
printf "\033[11m%s\033[10m %s\n" "$icon" "$vol"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#/bin/sh
|
||||
# pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
|
||||
printf "\033[11m\033[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/ /')"
|
||||
printf "\033[11m\033[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
while : ; do
|
||||
mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break
|
||||
done
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
playerctl status -F | tee "/tmp/playerctl-status" | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;)
|
|
@ -1,18 +1,21 @@
|
|||
#!/bin/sh
|
||||
# A dmenu wrapper script for system functions.
|
||||
case "$(readlink -f /sbin/init)" in
|
||||
*systemd*) ctl='systemctl' ;;
|
||||
*) ctl='loginctl' ;;
|
||||
*systemd*) ctl='systemctl' ;;
|
||||
*) ctl='loginctl' ;;
|
||||
esac
|
||||
|
||||
case "$(printf " lock\nﴚ leave dwm\n累 renew dwm\nﭦ hibernate\n sleep\nﰇ reboot\n襤 shutdown\n display off" | dmenu -i -p 'Action: ')" in
|
||||
' lock') xset s activate & gpg-connect-agent --no-autostart reloadagent /bye;;
|
||||
'ﴚ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||
'累 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||
' lock')
|
||||
xset s activate &
|
||||
gpg-connect-agent --no-autostart reloadagent /bye
|
||||
;;
|
||||
'ﴚ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||
'累 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||
# 'ﭦ hibernate') slock $ctl hibernate -i ;;
|
||||
# ' sleep') slock $ctl suspend -i ;;
|
||||
'ﰇ reboot') $ctl reboot ;;
|
||||
'襤 shutdown') $ctl poweroff ;;
|
||||
' display off') xset dpms force off ;;
|
||||
*) exit 1 ;;
|
||||
'ﰇ reboot') $ctl reboot ;;
|
||||
'襤 shutdown') $ctl poweroff ;;
|
||||
' display off') xset dpms force off ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
# I have vim run this file whenever I exit a .tex file.
|
||||
|
||||
case "$1" in
|
||||
*.tex)
|
||||
*.tex)
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyg|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete
|
||||
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyg|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete
|
||||
rm -rdf "$dir/_minted-$(basename -- "$base")"
|
||||
;;
|
||||
*) printf "Give .tex file as argument.\\n" ;;
|
||||
*) printf "Give .tex file as argument.\\n" ;;
|
||||
esac
|
||||
|
|
|
@ -2,25 +2,25 @@
|
|||
set -e
|
||||
[ -e "$1" ] || exit 1
|
||||
getfsroot() {
|
||||
printf "%s" "$(df "$1" --output=target | tail -1)"
|
||||
printf "%s" "$(df "$1" --output=target | tail -1)"
|
||||
}
|
||||
|
||||
filepath="$(realpath "$1")"
|
||||
filename="$(basename "$1")"
|
||||
fsroot="$(getfsroot "$1")"
|
||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
||||
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
||||
|| basedir="${fsroot}/.Trash"
|
||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
||||
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
||||
basedir="${fsroot}/.Trash"
|
||||
infodir="$basedir/info"
|
||||
filedir="$basedir/files"
|
||||
|
||||
mkdir -p "$infodir" 1>/dev/null 2>&1
|
||||
mkdir -p "$filedir" 1>/dev/null 2>&1
|
||||
find "$filedir" -regex ".*$filename.*" | grep -oP '(?<=.\.~)\d+(?=~$)' | sort -n | tail -1 | (
|
||||
ext=$(($(cat /dev/stdin)+1))
|
||||
filedest="$filedir/$filename.~$ext~"
|
||||
command mv -f "$filepath" "$filedest"
|
||||
cat <<EOF > "$infodir/$(basename "$filedest")"
|
||||
ext=$(($(cat /dev/stdin) + 1))
|
||||
filedest="$filedir/$filename.~$ext~"
|
||||
command mv -f "$filepath" "$filedest"
|
||||
cat <<EOF >"$infodir/$(basename "$filedest")"
|
||||
[Trash Info]
|
||||
Path=$filepath
|
||||
DeletionDate=$(date +%Y%m%dT%T)
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
getfsroot() {
|
||||
printf "%s" "$(df "$1" --output=target | tail -1)"
|
||||
printf "%s" "$(df "$1" --output=target | tail -1)"
|
||||
}
|
||||
list() {
|
||||
# 1st arg is trash files directory
|
||||
# 2nd arg is directory to match trash files for
|
||||
[ ! "$(ls -A "$1")" ] && exit 1
|
||||
for file in "$1"/* ; do
|
||||
[ "$(head -1 "$file")" = "[Trash Info]" ] && \
|
||||
fpath=$(grep Path "$file" | cut -d '=' -f2) && \
|
||||
echo "$fpath" | grep -qP "^$2/[^/]+$" && \
|
||||
printf "%s %s %s\n" \
|
||||
"$(basename "$file")" \
|
||||
"$fpath" \
|
||||
"$(date -d "$(grep Date "$file" | cut -d '=' -f2)" +'%x %X')"
|
||||
done
|
||||
# 1st arg is trash files directory
|
||||
# 2nd arg is directory to match trash files for
|
||||
[ ! "$(ls -A "$1")" ] && exit 1
|
||||
for file in "$1"/*; do
|
||||
[ "$(head -1 "$file")" = "[Trash Info]" ] &&
|
||||
fpath=$(grep Path "$file" | cut -d '=' -f2) &&
|
||||
echo "$fpath" | grep -qP "^$2/[^/]+$" &&
|
||||
printf "%s %s %s\n" \
|
||||
"$(basename "$file")" \
|
||||
"$fpath" \
|
||||
"$(date -d "$(grep Date "$file" | cut -d '=' -f2)" +'%x %X')"
|
||||
done
|
||||
}
|
||||
|
||||
[ -n "$1" ] && dir="$(realpath "$1")" || dir="$(getfsroot "$PWD")"
|
||||
fsroot="$(getfsroot "$dir")"
|
||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
||||
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
||||
|| basedir="${fsroot}/.Trash"
|
||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
||||
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
||||
basedir="${fsroot}/.Trash"
|
||||
|
||||
sel="$(list "$basedir/info" "$dir" | fzf)"
|
||||
file="$basedir/files/$(echo "$sel" | cut -d ' ' -f1)"
|
||||
|
|
|
@ -4,11 +4,14 @@
|
|||
|
||||
[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
|
||||
|
||||
echo "Enter the album/book title:"; read -r booktitle
|
||||
echo "Enter the album/book title:"
|
||||
read -r booktitle
|
||||
|
||||
echo "Enter the artist/author:"; read -r author
|
||||
echo "Enter the artist/author:"
|
||||
read -r author
|
||||
|
||||
echo "Enter the publication year:"; read -r year
|
||||
echo "Enter the publication year:"
|
||||
read -r year
|
||||
|
||||
inputaudio="$1"
|
||||
|
||||
|
@ -22,25 +25,24 @@ ext="opus"
|
|||
#ext="${1#*.}"
|
||||
|
||||
# Get the total number of tracks from the number of lines.
|
||||
total="$(wc -l < "$2")"
|
||||
total="$(wc -l <"$2")"
|
||||
|
||||
while read -r x;
|
||||
do
|
||||
while read -r x; do
|
||||
end="$(echo "$x" | cut -d' ' -f1)"
|
||||
|
||||
[ -n "$start" ] &&
|
||||
echo "From $start to $end; $track $title"
|
||||
echo "From $start to $end; $track $title"
|
||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||
[ -n "$start" ] && echo "Splitting \"$title\"..." &&
|
||||
ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -to "$end" -vn -c copy "$file" &&
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||
ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -to "$end" -vn -c copy "$file" &&
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||
title="$(echo "$x" | cut -d' ' -f 2-)"
|
||||
esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
|
||||
track="$((track+1))"
|
||||
track="$((track + 1))"
|
||||
start="$end"
|
||||
done < "$2"
|
||||
done <"$2"
|
||||
# The last track must be done outside the loop.
|
||||
echo "From $start to the end: $title"
|
||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||
echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" &&
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
if [ -f "$1" ]; then
|
||||
# Try to get DOI from pdfinfo or pdftotext output.
|
||||
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
||||
doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
|
||||
exit 1
|
||||
doi=$(pdftotext "$1" - 2>/dev/null | grep -io "doi:.*" -m 1) ||
|
||||
exit 1
|
||||
else
|
||||
doi="$1"
|
||||
fi
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
usage ()
|
||||
{
|
||||
printf "Usage : noisereduce <input video file> <output video file>\n"
|
||||
exit
|
||||
usage() {
|
||||
printf "Usage : noisereduce <input video file> <output video file>\n"
|
||||
exit
|
||||
}
|
||||
|
||||
# Tests for requirements
|
||||
ifinstalled ffmpeg || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
||||
ifinstalled sox || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
||||
ifinstalled ffmpeg || {
|
||||
echo >&2 "We require 'ffmpeg' but it's not installed."
|
||||
exit 1
|
||||
}
|
||||
ifinstalled sox || {
|
||||
echo >&2 "We require 'ffmpeg' but it's not installed."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$#" -ne 2 ]
|
||||
then
|
||||
usage
|
||||
if [ "$#" -ne 2 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ ! -e "$1" ]
|
||||
then
|
||||
printf "File not found: %s\n" "$1"
|
||||
exit
|
||||
if [ ! -e "$1" ]; then
|
||||
printf "File not found: %s\n" "$1"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -e "$2" ]
|
||||
then
|
||||
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
||||
read -r yn
|
||||
case $yn in
|
||||
[Yy]* ) ;;
|
||||
* ) exit;;
|
||||
esac
|
||||
if [ -e "$2" ]; then
|
||||
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
||||
read -r yn
|
||||
case $yn in
|
||||
[Yy]*) ;;
|
||||
*) exit ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
inBasename=$(basename "$1")
|
||||
inExt="${inBasename##*.}"
|
||||
|
||||
isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
|
||||
if [ -n "$isVideoStr" ]
|
||||
then
|
||||
isVideo=1
|
||||
printf "Detected %s as a video file\n" "$inBasename"
|
||||
if [ -n "$isVideoStr" ]; then
|
||||
isVideo=1
|
||||
printf "Detected %s as a video file\n" "$inBasename"
|
||||
else
|
||||
isVideo=0
|
||||
printf "Detected %s as an audio file\n" "$inBasename"
|
||||
isVideo=0
|
||||
printf "Detected %s as an audio file\n" "$inBasename"
|
||||
fi
|
||||
|
||||
printf "Sample noise start time [00:00:00]: "
|
||||
read -r sampleStart
|
||||
if [ -z "$sampleStart" ] ; then sampleStart="00:00:00"; fi
|
||||
if [ -z "$sampleStart" ]; then sampleStart="00:00:00"; fi
|
||||
printf "Sample noise end time [00:00:00.900]: "
|
||||
read -r sampleEnd
|
||||
if [ -z "$sampleEnd" ] ; then sampleEnd="00:00:00.900"; fi
|
||||
if [ -z "$sampleEnd" ]; then sampleEnd="00:00:00.900"; fi
|
||||
printf "Noise reduction amount [0.21]: "
|
||||
read -r sensitivity
|
||||
if [ -z "$sensitivity" ] ; then sensitivity="0.21"; fi
|
||||
|
||||
if [ -z "$sensitivity" ]; then sensitivity="0.21"; fi
|
||||
|
||||
tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
|
||||
tmpAudFile="/tmp/noiseclean_tmpaud.wav"
|
||||
|
@ -64,18 +64,18 @@ tmpAudCleanFile="/tmp/noiseclean_tmpaud-clean.wav"
|
|||
printf "Cleaning noise on %s...\n" "$1"
|
||||
|
||||
if [ $isVideo -eq "1" ]; then
|
||||
ffmpeg -v warning -y -i "$1" -qscale:v 0 -vcodec copy -an "$tmpVidFile"
|
||||
ffmpeg -v warning -y -i "$1" -qscale:a 0 "$tmpAudFile"
|
||||
ffmpeg -v warning -y -i "$1" -qscale:v 0 -vcodec copy -an "$tmpVidFile"
|
||||
ffmpeg -v warning -y -i "$1" -qscale:a 0 "$tmpAudFile"
|
||||
else
|
||||
cp "$1" "$tmpAudFile"
|
||||
cp "$1" "$tmpAudFile"
|
||||
fi
|
||||
ffmpeg -v warning -y -i "$1" -vn -ss "$sampleStart" -t "$sampleEnd" "$noiseAudFile"
|
||||
sox "$noiseAudFile" -n noiseprof "$noiseProfFile"
|
||||
sox "$tmpAudFile" "$tmpAudCleanFile" noisered "$noiseProfFile" "$sensitivity"
|
||||
if [ $isVideo -eq "1" ]; then
|
||||
ffmpeg -v warning -y -i "$tmpAudCleanFile" -i "$tmpVidFile" -vcodec copy -qscale:v 0 -qscale:a 0 "$2"
|
||||
ffmpeg -v warning -y -i "$tmpAudCleanFile" -i "$tmpVidFile" -vcodec copy -qscale:v 0 -qscale:a 0 "$2"
|
||||
else
|
||||
cp "$tmpAudCleanFile" "$2"
|
||||
cp "$tmpAudCleanFile" "$2"
|
||||
fi
|
||||
|
||||
printf "Done"
|
||||
|
|
|
@ -13,41 +13,45 @@ ifinstalled pass pass-otp
|
|||
|
||||
dir="${PASSWORD_STORE_DIR}"
|
||||
|
||||
choice="$({ echo "🆕add" ; echo "🕙sync-time" ; ls ${dir}/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
|
||||
choice="$({
|
||||
echo "🆕add"
|
||||
echo "🕙sync-time"
|
||||
ls ${dir}/*-otp.gpg
|
||||
} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
|
||||
|
||||
case $choice in
|
||||
🆕add )
|
||||
ifinstalled maim zbar xclip || exit 1
|
||||
🆕add)
|
||||
ifinstalled maim zbar xclip || exit 1
|
||||
|
||||
temp="$dir/temp.png"
|
||||
otp="otp-test-script"
|
||||
trap 'shred -fu $temp; pass rm $otp' HUP INT QUIT TERM PWR EXIT
|
||||
temp="$dir/temp.png"
|
||||
otp="otp-test-script"
|
||||
trap 'shred -fu $temp; pass rm $otp' HUP INT QUIT TERM PWR EXIT
|
||||
|
||||
notify-send "Scan the image." "Scan the OTP QR code."
|
||||
notify-send "Scan the image." "Scan the OTP QR code."
|
||||
|
||||
maim -s "$temp" || exit 1
|
||||
info="$(zbarimg -q "$temp")"
|
||||
info="${info#QR-Code:}"
|
||||
issuer="$(echo "$info" | grep -o "issuer=[A-z0-9]\+")"
|
||||
name="${issuer#issuer=}"
|
||||
maim -s "$temp" || exit 1
|
||||
info="$(zbarimg -q "$temp")"
|
||||
info="${info#QR-Code:}"
|
||||
issuer="$(echo "$info" | grep -o "issuer=[A-z0-9]\+")"
|
||||
name="${issuer#issuer=}"
|
||||
|
||||
if echo "$info" | pass otp insert "$otp"; then
|
||||
while true ; do
|
||||
export name="$(prinf | dmenu -p "Give this One Time Password a one-word name:")"
|
||||
echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break
|
||||
done
|
||||
pass mv "$otp" "$name-otp"
|
||||
notify-send "Successfully added." "$name-otp has been created."
|
||||
else
|
||||
notify-send "No OTP data found." "Try to scan the image again more precisely."
|
||||
fi
|
||||
if echo "$info" | pass otp insert "$otp"; then
|
||||
while true; do
|
||||
export name="$(prinf | dmenu -p "Give this One Time Password a one-word name:")"
|
||||
echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break
|
||||
done
|
||||
pass mv "$otp" "$name-otp"
|
||||
notify-send "Successfully added." "$name-otp has been created."
|
||||
else
|
||||
notify-send "No OTP data found." "Try to scan the image again more precisely."
|
||||
fi
|
||||
|
||||
;;
|
||||
🕙sync-time )
|
||||
ifinstalled ntp || exit 1
|
||||
notify-send -u low "🕙 Synchronizing Time..." "Synching time with remote NTP servers..."
|
||||
updatedata="$(sudo ntpdate pool.ntp.org)" &&
|
||||
;;
|
||||
🕙sync-time)
|
||||
ifinstalled ntp || exit 1
|
||||
notify-send -u low "🕙 Synchronizing Time..." "Synching time with remote NTP servers..."
|
||||
updatedata="$(sudo ntpdate pool.ntp.org)" &&
|
||||
notify-send -u low "🕙 Synchronizing Time..." "Done. Time changed by ${updatedata#*offset }"
|
||||
;;
|
||||
*) pass otp -c ${choice}-otp ;;
|
||||
;;
|
||||
*) pass otp -c ${choice}-otp ;;
|
||||
esac
|
||||
|
|
|
@ -20,14 +20,18 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
|
|||
r) redo="$OPTARG" ;;
|
||||
s) ppt="$OPTARG" ;;
|
||||
e) endtime="$OPTARG" ;;
|
||||
x) res="$OPTARG"
|
||||
x)
|
||||
res="$OPTARG"
|
||||
echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
|
||||
echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
|
||||
exit 1 ;;
|
||||
p) echo "Purge old build files in $cache? [y/N]"
|
||||
exit 1
|
||||
;;
|
||||
p)
|
||||
echo "Purge old build files in $cache? [y/N]"
|
||||
read -r confirm
|
||||
echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
|
||||
exit ;;
|
||||
exit
|
||||
;;
|
||||
v) verbose=True ;;
|
||||
*) echo "$(basename "$0") usage:
|
||||
-i input timecode list (required)
|
||||
|
@ -42,14 +46,14 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
|
|||
-d tmp directory
|
||||
-r rerun imagemagick commands even if done previously (in case files or background has changed)
|
||||
-p purge old build files instead of running
|
||||
-v be verbose" && exit 1
|
||||
-v be verbose" && exit 1 ;;
|
||||
|
||||
esac done
|
||||
esac done
|
||||
|
||||
# Check that the input file looks like it should.
|
||||
{ head -n 1 "$file" 2>/dev/null | grep -q "^00:00:00 " ;} || {
|
||||
{ head -n 1 "$file" 2>/dev/null | grep -q "^00:00:00 "; } || {
|
||||
echo "Give an input file with -i." &&
|
||||
echo "The file should look as this example:
|
||||
echo "The file should look as this example:
|
||||
|
||||
00:00:00 first_image.jpg
|
||||
00:00:03 otherdirectory/next_image.jpg
|
||||
|
@ -57,17 +61,20 @@ esac done
|
|||
etc...
|
||||
|
||||
Timecodes and filenames must be separated by Tabs." &&
|
||||
exit 1
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -n "${audio+x}" ]; then
|
||||
# Check that the audio file looks like an actual audio file.
|
||||
case "$(file --dereference --brief --mime-type -- "$audio")" in
|
||||
audio/*) ;;
|
||||
*) echo "That doesn't look like an audio file."; exit 1 ;;
|
||||
audio/*) ;;
|
||||
*)
|
||||
echo "That doesn't look like an audio file."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
||||
endtime="$((totseconds-seconds))"
|
||||
endtime="$((totseconds - seconds))"
|
||||
fi
|
||||
|
||||
prepdir="${prepdir:-$cache/$file}"
|
||||
|
@ -78,43 +85,42 @@ prepfile="$prepdir/$file.prep"
|
|||
mkdir -p "$prepdir"
|
||||
|
||||
{
|
||||
while read -r x;
|
||||
do
|
||||
# Get the time from the first column.
|
||||
time="${x%% *}"
|
||||
seconds="$(date '+%s' -d "$time")"
|
||||
# Duration is not used on the first looped item.
|
||||
duration="$((seconds - prevseconds))"
|
||||
while read -r x; do
|
||||
# Get the time from the first column.
|
||||
time="${x%% *}"
|
||||
seconds="$(date '+%s' -d "$time")"
|
||||
# Duration is not used on the first looped item.
|
||||
duration="$((seconds - prevseconds))"
|
||||
|
||||
# Get the filename/text content from the rest.
|
||||
content="${x#* }"
|
||||
base="$(basename "$content")"
|
||||
base="${base%.*}.jpg"
|
||||
# Get the filename/text content from the rest.
|
||||
content="${x#* }"
|
||||
base="$(basename "$content")"
|
||||
base="${base%.*}.jpg"
|
||||
|
||||
if [ -f "$content" ]; then
|
||||
# If images have already been made in a previous run, do not recreate
|
||||
# them unless -r was given.
|
||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
|
||||
convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base"
|
||||
else
|
||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
|
||||
convert -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base"
|
||||
fi
|
||||
if [ -f "$content" ]; then
|
||||
# If images have already been made in a previous run, do not recreate
|
||||
# them unless -r was given.
|
||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ]; } &&
|
||||
convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base"
|
||||
else
|
||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ]; } &&
|
||||
convert -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base"
|
||||
fi
|
||||
|
||||
# If the first line, do not write yet.
|
||||
[ "$time" = "00:00:00" ] || echo "file '$prevbase'
|
||||
# If the first line, do not write yet.
|
||||
[ "$time" = "00:00:00" ] || echo "file '$prevbase'
|
||||
duration $duration"
|
||||
|
||||
# Keep the information required for the next file.
|
||||
prevbase="$base"
|
||||
prevtime="$time"
|
||||
prevseconds="$(date '+%s' -d "$prevtime")"
|
||||
done < "$file"
|
||||
# Do last file which must be given twice as follows
|
||||
echo "file '$base'
|
||||
# Keep the information required for the next file.
|
||||
prevbase="$base"
|
||||
prevtime="$time"
|
||||
prevseconds="$(date '+%s' -d "$prevtime")"
|
||||
done <"$file"
|
||||
# Do last file which must be given twice as follows
|
||||
echo "file '$base'
|
||||
duration ${endtime:-5}
|
||||
file '$base'"
|
||||
} > "$prepfile"
|
||||
} >"$prepfile"
|
||||
if [ -n "${audio+x}" ]; then
|
||||
ffmpeg -hide_banner -y -f concat -safe 0 -i "$prepfile" -i "$audio" -c:a aac -vsync vfr -c:v libx264 -pix_fmt yuv420p "$outfile"
|
||||
else
|
||||
|
|
|
@ -11,7 +11,7 @@ Options:
|
|||
-d: year of publication
|
||||
-g: genre
|
||||
-c: comment
|
||||
You will be prompted for title, artist, album and track if not given." && exit 1 ;}
|
||||
You will be prompted for title, artist, album and track if not given." && exit 1; }
|
||||
|
||||
while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in
|
||||
a) artist="${OPTARG}" ;;
|
||||
|
@ -24,7 +24,7 @@ while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in
|
|||
c) comment="${OPTARG}" ;;
|
||||
f) file="${OPTARG}" ;;
|
||||
*) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
|
||||
esac done
|
||||
esac done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
|
@ -38,7 +38,7 @@ file="$1"
|
|||
[ -z "$track" ] && echo "Enter a track number." && read -r track
|
||||
|
||||
case "$file" in
|
||||
*.ogg) echo "Title=$title
|
||||
*.ogg) echo "Title=$title
|
||||
Artist=$artist
|
||||
Album=$album
|
||||
Track=$track
|
||||
|
@ -46,7 +46,7 @@ Total=$total
|
|||
Date=$date
|
||||
Genre=$genre
|
||||
Comment=$comment" | vorbiscomment -w "$file" ;;
|
||||
*.opus) echo "Title=$title
|
||||
*.opus) echo "Title=$title
|
||||
Artist=$artist
|
||||
Album=$album
|
||||
Track=$track
|
||||
|
@ -54,8 +54,8 @@ Total=$total
|
|||
Date=$date
|
||||
Genre=$genre
|
||||
Comment=$comment" | opustags -i -S "$file" ;;
|
||||
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
|
||||
*.flac) echo "TITLE=$title
|
||||
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
|
||||
*.flac) echo "TITLE=$title
|
||||
ARTIST=$artist
|
||||
ALBUM=$album
|
||||
TRACKNUMBER=$track
|
||||
|
@ -63,5 +63,5 @@ TOTALTRACKS=$total
|
|||
DATE=$date
|
||||
GENRE=$genre
|
||||
DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;;
|
||||
*) echo "File type not implemented yet." ;;
|
||||
*) echo "File type not implemented yet." ;;
|
||||
esac
|
||||
|
|
|
@ -35,4 +35,3 @@ json="$(jq -r --arg "$movie" "$thumbnail" ". + {\"$movie\": \"$thumbnail\"}" <"$
|
|||
echo "$json" >"$index"
|
||||
|
||||
echo "$cache/$thumbnail"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=File Manager
|
||||
Exec=/usr/local/bin/kitty -e lfrun %u
|
||||
Exec=/usr/local/bin/kitty -e lfcd %u
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Mail
|
||||
Exec=/usr/local/bin/kitty -e neomutt %u
|
||||
# FIX:
|
||||
Exec=/usr/bin/thunderbird %u
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Text editor
|
||||
Exec=/usr/local/bin/kitty -e lvim %u
|
||||
Exec=/usr/local/bin/kitty -e nvim %u
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Torrent
|
||||
Exec=/usr/bin/env transadd %U
|
||||
# FIX:
|
Loading…
Reference in New Issue