parent
1f2fda79e8
commit
774f14f273
|
@ -1,46 +1,46 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xserverrc" ]; then
|
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xserverrc" ]; then
|
||||||
server=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xserverrc
|
server=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xserverrc
|
||||||
elif [ -r "$HOME/.xserverrc" ]; then
|
elif [ -r "$HOME/.xserverrc" ]; then
|
||||||
server=$HOME/.xserverrc
|
server=$HOME/.xserverrc
|
||||||
else
|
else
|
||||||
server=/etc/X11/xinit/xserverrc
|
server=/etc/X11/xinit/xserverrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession" ]; then
|
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession" ]; then
|
||||||
client=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession
|
client=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession
|
||||||
elif [ -r "$HOME/.xsession" ]; then
|
elif [ -r "$HOME/.xsession" ]; then
|
||||||
client="$HOME/.xsession"
|
client="$HOME/.xsession"
|
||||||
else
|
else
|
||||||
client=/etc/X11/xinit/xinitrc
|
client=/etc/X11/xinit/xinitrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Automatically determine an unused $DISPLAY
|
# Automatically determine an unused $DISPLAY
|
||||||
d=0
|
d=0
|
||||||
while true ; do
|
while true; do
|
||||||
[ -e "/tmp/.X$d-lock" ] || [ -S "/tmp/.X11-unix/X$d" ] || break
|
[ -e "/tmp/.X$d-lock" ] || [ -S "/tmp/.X11-unix/X$d" ] || break
|
||||||
d=$((d + 1))
|
d=$((d + 1))
|
||||||
done
|
done
|
||||||
display=":$d"
|
display=":$d"
|
||||||
unset d
|
unset d
|
||||||
|
|
||||||
if [ -n "${XAUTHORITY+x}" ]; then
|
if [ -n "${XAUTHORITY+x}" ]; then
|
||||||
XAUTHORITY=$HOME/.Xauthority
|
XAUTHORITY=$HOME/.Xauthority
|
||||||
export XAUTHORITY
|
export XAUTHORITY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
removelist=
|
removelist=
|
||||||
|
|
||||||
# check for GNU hostname
|
# check for GNU hostname
|
||||||
if hostname --version > /dev/null 2>&1; then
|
if hostname --version >/dev/null 2>&1; then
|
||||||
if ! hostname --version 2>&1 | grep GNU -q; then
|
if ! hostname --version 2>&1 | grep GNU -q; then
|
||||||
hostname=$(hostname -f)
|
hostname=$(hostname -f)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$hostname" ]; then
|
if [ -z "$hostname" ]; then
|
||||||
hostname=$(hostname)
|
hostname=$(hostname)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
authdisplay=${display:-:0}
|
authdisplay=${display:-:0}
|
||||||
|
@ -48,15 +48,15 @@ authdisplay=${display:-:0}
|
||||||
mcookie=$(/usr/bin/mcookie)
|
mcookie=$(/usr/bin/mcookie)
|
||||||
|
|
||||||
if [ -z "${mcookie+x}" ]; then
|
if [ -z "${mcookie+x}" ]; then
|
||||||
echo "Couldn't create cookie"
|
echo "Couldn't create cookie"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
dummy=0
|
dummy=0
|
||||||
|
|
||||||
# create a file with auth information for the server. ':0' is a dummy.
|
# create a file with auth information for the server. ':0' is a dummy.
|
||||||
xserverauthfile=$(mktemp --tmpdir serverauth.XXXXXXXXXX)
|
xserverauthfile=$(mktemp --tmpdir serverauth.XXXXXXXXXX)
|
||||||
trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM
|
trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM
|
||||||
xauth -q -f "$xserverauthfile" << EOF
|
xauth -q -f "$xserverauthfile" <<EOF
|
||||||
add :$dummy . $mcookie
|
add :$dummy . $mcookie
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -66,18 +66,18 @@ serverargs=${serverargs}" -auth "${xserverauthfile}
|
||||||
# if '$displayname' already exists do not overwrite it as another
|
# if '$displayname' already exists do not overwrite it as another
|
||||||
# server may need it. Add them to the '$xserverauthfile' instead.
|
# server may need it. Add them to the '$xserverauthfile' instead.
|
||||||
for displayname in $authdisplay $hostname$authdisplay; do
|
for displayname in $authdisplay $hostname$authdisplay; do
|
||||||
authcookie=$(xauth list "$displayname" | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p") 2>/dev/null;
|
authcookie=$(xauth list "$displayname" | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p") 2>/dev/null
|
||||||
if [ -n "${authcookie+x}" ]; then
|
if [ -n "${authcookie+x}" ]; then
|
||||||
xauth -q << EOF
|
xauth -q <<EOF
|
||||||
add $displayname . $mcookie
|
add $displayname . $mcookie
|
||||||
EOF
|
EOF
|
||||||
removelist="$displayname $removelist"
|
removelist="$displayname $removelist"
|
||||||
else
|
else
|
||||||
dummy=$((dummy+1));
|
dummy=$((dummy + 1))
|
||||||
xauth -q -f "$xserverauthfile" << EOF
|
xauth -q -f "$xserverauthfile" <<EOF
|
||||||
add :$dummy . $authcookie
|
add :$dummy . $authcookie
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
xinit $client -- $server $serverargs $display
|
xinit $client -- $server $serverargs $display
|
||||||
|
@ -85,14 +85,14 @@ xinit $client -- $server $serverargs $display
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
if [ -z "${removelist+x}" ]; then
|
if [ -z "${removelist+x}" ]; then
|
||||||
xauth remove $removelist
|
xauth remove $removelist
|
||||||
fi
|
fi
|
||||||
if [ x"$xserverauthfile" != x ]; then
|
if [ x"$xserverauthfile" != x ]; then
|
||||||
rm -f "$xserverauthfile"
|
rm -f "$xserverauthfile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v deallocvt > /dev/null 2>&1; then
|
if command -v deallocvt >/dev/null 2>&1; then
|
||||||
deallocvt
|
deallocvt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit $retval
|
exit $retval
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
export XCURSOR_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/icons"
|
export XCURSOR_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/icons"
|
||||||
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
|
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
|
||||||
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
|
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
|
||||||
export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
|
export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
|
||||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||||
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
|
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
|
||||||
export AWT_TOOLKIT="MToolkit wmname LG3D" #May have to install wmname
|
export AWT_TOOLKIT="MToolkit wmname LG3D" #May have to install wmname
|
||||||
export LF_ICONS="\
|
export LF_ICONS="\
|
||||||
tw=:\
|
tw=:\
|
||||||
st=:\
|
st=:\
|
||||||
|
|
|
@ -10,86 +10,86 @@ OPTIONFILE=/etc/X11/Xsession.options
|
||||||
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession.d" ] && SESSIONDIR=${XDG_CONFIG_HOME:-$HOME/.config}/X11/xsession.d || SESSIONDIR=/etc/X11/Xsession.d
|
[ -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
|
[ -d "${XDG_DATA_HOME:-$HOME/.local/share}/xorg/" ] && ERRFILE=${XDG_DATA_HOME:-$HOME/.local/share}/xorg/xsession-errors || ERRFILE=$HOME/.xsession-errors
|
||||||
|
|
||||||
message () {
|
message() {
|
||||||
# pretty-print messages of arbitrary length; use xmessage if it
|
# pretty-print messages of arbitrary length; use xmessage if it
|
||||||
# is available and $DISPLAY is set
|
# is available and $DISPLAY is set
|
||||||
MESSAGE="$PROGNAME: $*"
|
MESSAGE="$PROGNAME: $*"
|
||||||
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
|
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
|
||||||
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
||||||
# echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
# echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
||||||
# fi
|
# fi
|
||||||
}
|
}
|
||||||
|
|
||||||
message_nonl () {
|
message_nonl() {
|
||||||
# pretty-print messages of arbitrary length (no trailing newline); use
|
# pretty-print messages of arbitrary length (no trailing newline); use
|
||||||
# xmessage if it is available and $DISPLAY is set
|
# xmessage if it is available and $DISPLAY is set
|
||||||
MESSAGE="$PROGNAME: $*"
|
MESSAGE="$PROGNAME: $*"
|
||||||
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
|
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
|
||||||
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
||||||
# echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
# echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
||||||
# fi
|
# fi
|
||||||
}
|
}
|
||||||
|
|
||||||
errormsg () {
|
errormsg() {
|
||||||
# exit script with error
|
# exit script with error
|
||||||
message "$*"
|
message "$*"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
internal_errormsg () {
|
internal_errormsg() {
|
||||||
# exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
|
# 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
|
# 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
|
# the user would have dismissed the error we want reported before seeing the
|
||||||
# request to report it.
|
# request to report it.
|
||||||
errormsg "$*" \
|
errormsg "$*" \
|
||||||
"Please report the installed version of the \"x11-common\"" \
|
"Please report the installed version of the \"x11-common\"" \
|
||||||
"package and the complete text of this error message to" \
|
"package and the complete text of this error message to" \
|
||||||
"<debian-x@lists.debian.org>."
|
"<debian-x@lists.debian.org>."
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTIONS="$(
|
OPTIONS="$(
|
||||||
if [ -r "$OPTIONFILE" ]; then
|
if [ -r "$OPTIONFILE" ]; then
|
||||||
cat "$OPTIONFILE"
|
cat "$OPTIONFILE"
|
||||||
fi
|
fi
|
||||||
if [ -d /etc/X11/Xsession.options.d ]; then
|
if [ -d /etc/X11/Xsession.options.d ]; then
|
||||||
run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d '\n' cat
|
run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d '\n' cat
|
||||||
fi
|
fi
|
||||||
)"
|
)"
|
||||||
|
|
||||||
has_option() {
|
has_option() {
|
||||||
# Ensure that a later no-foo overrides an earlier foo
|
# Ensure that a later no-foo overrides an earlier foo
|
||||||
if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
|
if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# attempt to create an error file; abort if we cannot
|
# attempt to create an error file; abort if we cannot
|
||||||
if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
|
if (umask 077 && touch "$ERRFILE") 2>/dev/null && [ -w "$ERRFILE" ] &&
|
||||||
[ ! -L "$ERRFILE" ]; then
|
[ ! -L "$ERRFILE" ]; then
|
||||||
chmod 600 "$ERRFILE"
|
chmod 600 "$ERRFILE"
|
||||||
elif ERRFILE=$(mktemp 2> /dev/null); then
|
elif ERRFILE=$(mktemp 2>/dev/null); then
|
||||||
if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
|
if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
|
||||||
message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
|
message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
|
||||||
"\"$ERRFILE\"; look for session log/errors in" \
|
"\"$ERRFILE\"; look for session log/errors in" \
|
||||||
"\"$TMPDIR/xsession-$USER\"."
|
"\"$TMPDIR/xsession-$USER\"."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
errormsg "unable to create X session log/error file; aborting."
|
errormsg "unable to create X session log/error file; aborting."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# truncate ERRFILE if it is too big to avoid disk usage DoS
|
# truncate ERRFILE if it is too big to avoid disk usage DoS
|
||||||
if [ "$(stat -c%s \""$ERRFILE"\")" -gt 500000 ]; then
|
if [ "$(stat -c%s \""$ERRFILE"\")" -gt 500000 ]; then
|
||||||
T=$(mktemp -p "$HOME")
|
T=$(mktemp -p "$HOME")
|
||||||
tail -c 500000 "$ERRFILE" > "$T" && mv -f "$T" "$ERRFILE" || rm -f "$T"
|
tail -c 500000 "$ERRFILE" >"$T" && mv -f "$T" "$ERRFILE" || rm -f "$T"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec >>"$ERRFILE" 2>&1
|
exec >>"$ERRFILE" 2>&1
|
||||||
|
|
||||||
# sanity check; is our session script directory present?
|
# sanity check; is our session script directory present?
|
||||||
if [ ! -d "$SESSIONDIR" ]; then
|
if [ ! -d "$SESSIONDIR" ]; then
|
||||||
errormsg "no \"$SESSIONDIR\" directory found; aborting."
|
errormsg "no \"$SESSIONDIR\" directory found; aborting."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Attempt to create a file of non-zero length in /tmp; a full filesystem can
|
# Attempt to create a file of non-zero length in /tmp; a full filesystem can
|
||||||
|
@ -99,19 +99,19 @@ fi
|
||||||
# determining what went wrong.
|
# determining what went wrong.
|
||||||
WRITE_TEST=$(mktemp)
|
WRITE_TEST=$(mktemp)
|
||||||
if ! echo "*" >>"$WRITE_TEST"; then
|
if ! echo "*" >>"$WRITE_TEST"; then
|
||||||
message "warning: unable to write to ${WRITE_TEST%/*}; X session may exit" \
|
message "warning: unable to write to ${WRITE_TEST%/*}; X session may exit" \
|
||||||
"with an error"
|
"with an error"
|
||||||
fi
|
fi
|
||||||
rm -f "$WRITE_TEST"
|
rm -f "$WRITE_TEST"
|
||||||
|
|
||||||
SESSIONFILES=$(run-parts --list $SESSIONDIR)
|
SESSIONFILES=$(run-parts --list $SESSIONDIR)
|
||||||
if [ -n "$SESSIONFILES" ]; then
|
if [ -n "$SESSIONFILES" ]; then
|
||||||
set +e
|
set +e
|
||||||
for SESSIONFILE in $SESSIONFILES; do
|
for SESSIONFILE in $SESSIONFILES; do
|
||||||
message "Executing $SESSIONFILE"
|
message "Executing $SESSIONFILE"
|
||||||
. $SESSIONFILE
|
. $SESSIONFILE
|
||||||
done
|
done
|
||||||
set -e
|
set -e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xprofile" ]; then
|
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xprofile" ]; then
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh
|
||||||
|
|
||||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -n "$XDG_RUNTIME_DIR" ] && \
|
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -n "$XDG_RUNTIME_DIR" ] &&
|
||||||
[ "$XDG_RUNTIME_DIR" = "/run/user/`id -u`" ] && \
|
[ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] &&
|
||||||
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
|
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
|
||||||
# We are under systemd-logind or something remarkably similar, and
|
# We are under systemd-logind or something remarkably similar, and
|
||||||
# a user-session socket has already been set up.
|
# a user-session socket has already been set up.
|
||||||
#
|
#
|
||||||
# Be nice to non-libdbus, non-sd-bus implementations by using
|
# Be nice to non-libdbus, non-sd-bus implementations by using
|
||||||
# that as the session bus address in the environment. The check for
|
# that as the session bus address in the environment. The check for
|
||||||
# XDG_RUNTIME_DIR = "/run/user/`id -u`" is because we know that
|
# XDG_RUNTIME_DIR = "/run/user/`id -u`" is because we know that
|
||||||
# form of the address, from systemd-logind, doesn't need escaping,
|
# form of the address, from systemd-logind, doesn't need escaping,
|
||||||
# whereas arbitrary addresses might.
|
# whereas arbitrary addresses might.
|
||||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
||||||
# tell dbus-daemon --session (and systemd --user, if running)
|
# tell dbus-daemon --session (and systemd --user, if running)
|
||||||
# to put a minimal subset of the Xsession's environment in activated
|
# to put a minimal subset of the Xsession's environment in activated
|
||||||
# services' environments
|
# services' environments
|
||||||
dbus-update-activation-environment --verbose --systemd \
|
dbus-update-activation-environment --verbose --systemd \
|
||||||
DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY
|
DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh
|
||||||
|
|
||||||
if has_option allow-user-resources && [ -f "$USRRESOURCES" ]; then
|
if has_option allow-user-resources && [ -f "$USRRESOURCES" ]; then
|
||||||
xrdb -merge $USRRESOURCES
|
xrdb -merge $USRRESOURCES
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh
|
||||||
|
|
||||||
add_module()
|
add_module() {
|
||||||
{
|
|
||||||
case :$GTK_MODULES: in
|
case :$GTK_MODULES: in
|
||||||
*:$1:*)
|
*:$1:*) ;;
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
if [ -z "$GTK_MODULES" ]
|
if [ -z "$GTK_MODULES" ]; then
|
||||||
then
|
GTK_MODULES=$1
|
||||||
GTK_MODULES=$1
|
else
|
||||||
else
|
GTK_MODULES=$GTK_MODULES:$1
|
||||||
GTK_MODULES=$GTK_MODULES:$1
|
fi
|
||||||
fi
|
;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,5 +19,5 @@ add_module atk-bridge
|
||||||
|
|
||||||
export GTK_MODULES
|
export GTK_MODULES
|
||||||
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
||||||
dbus-update-activation-environment --verbose --systemd GTK_MODULES
|
dbus-update-activation-environment --verbose --systemd GTK_MODULES
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
export QT_ACCESSIBILITY=1
|
export QT_ACCESSIBILITY=1
|
||||||
|
|
||||||
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
|
||||||
dbus-update-activation-environment --verbose --systemd QT_ACCESSIBILITY
|
dbus-update-activation-environment --verbose --systemd QT_ACCESSIBILITY
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh
|
||||||
|
|
||||||
if [ "${SSH_AUTH_SOCK:-0}" -ne $$ ]; then
|
if [ "${SSH_AUTH_SOCK:-0}" -ne $$ ]; then
|
||||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||||
fi
|
fi
|
||||||
export GPG_TTY="$(tty)"
|
export GPG_TTY="$(tty)"
|
||||||
gpg-connect-agent updatestartuptty /bye > /dev/null
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# vim:set ft=sh
|
# vim:set ft=sh
|
||||||
|
|
||||||
start()
|
start() {
|
||||||
{
|
pidof -s $1 || $@ >/dev/null 2>&1 &
|
||||||
pidof -s $1 || $@ >/dev/null 2>&1 &
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start playerctld daemon
|
start playerctld daemon
|
||||||
|
|
|
@ -15,6 +15,7 @@ null_ls.setup {
|
||||||
debug = false,
|
debug = false,
|
||||||
sources = {
|
sources = {
|
||||||
formatting.black.with { extra_args = { "--fast" } },
|
formatting.black.with { extra_args = { "--fast" } },
|
||||||
|
formatting.shfmt,
|
||||||
-- formatting.stylua,
|
-- formatting.stylua,
|
||||||
-- diagnostics.flake8,
|
-- diagnostics.flake8,
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,46 +15,49 @@ ext="${file##*.}"
|
||||||
|
|
||||||
cd "$dir" || exit 1
|
cd "$dir" || exit 1
|
||||||
|
|
||||||
textype() { \
|
textype() {
|
||||||
command="pdflatex"
|
command="pdflatex"
|
||||||
texroot=$(readlink -f "$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]")")
|
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"
|
[ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot"
|
||||||
( head -n5 "$file" | grep -qi 'xelatex' ) && command="xelatex"
|
(head -n5 "$file" | grep -qi 'xelatex') && command="xelatex"
|
||||||
$command --output-directory="$dir" "$base" &&
|
$command --output-directory="$dir" "$base" &&
|
||||||
grep -qi addbibresource "$file" &&
|
grep -qi addbibresource "$file" &&
|
||||||
biber --input-directory "$dir" "$base" &&
|
biber --input-directory "$dir" "$base" &&
|
||||||
$command --output-directory="$dir" "$base" &&
|
$command --output-directory="$dir" "$base" &&
|
||||||
$command --output-directory="$dir" "$base"
|
$command --output-directory="$dir" "$base"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$ext" in
|
case "$ext" in
|
||||||
# Try to keep these cases in alphabetical order.
|
# Try to keep these cases in alphabetical order.
|
||||||
[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;;
|
[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf >"$base".pdf ;;
|
||||||
c) cc "$file" -o "$base" && "$base" ;;
|
c) cc "$file" -o "$base" && "$base" ;;
|
||||||
cpp) g++ "$file" -o "$base" && "$base" ;;
|
cpp) g++ "$file" -o "$base" && "$base" ;;
|
||||||
cs) mcs "$file" && mono "$base".exe ;;
|
cs) mcs "$file" && mono "$base".exe ;;
|
||||||
go) go run "$file" ;;
|
go) go run "$file" ;;
|
||||||
h) sudo make install ;;
|
h) sudo make install ;;
|
||||||
# findup is a script available here: https://unix.stackexchange.com/a/35265
|
# 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)" ;;
|
java)
|
||||||
m) octave "$file" ;;
|
loc=$(findup . -name gradlew)
|
||||||
md) if [ -x "$(command -v lowdown)" ]; then
|
[ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)"
|
||||||
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf
|
;;
|
||||||
elif [ -x "$(command -v groffdown)" ]; then
|
m) octave "$file" ;;
|
||||||
groffdown -i "$file" | groff -T pdf > "$base.pdf"
|
md) if [ -x "$(command -v lowdown)" ]; then
|
||||||
else
|
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf >"$base".pdf
|
||||||
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
elif [ -x "$(command -v groffdown)" ]; then
|
||||||
fi ; ;;
|
groffdown -i "$file" | groff -T pdf >"$base.pdf"
|
||||||
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;;
|
else
|
||||||
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;;
|
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
||||||
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
|
fi ;;
|
||||||
py) python "$file" ;;
|
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf >"$base".pdf ;;
|
||||||
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
|
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;;
|
||||||
rs) cargo build ;;
|
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
|
||||||
sass) sassc -a "$file" "$base".css ;;
|
py) python "$file" ;;
|
||||||
scad) openscad -o "$base".stl "$file" ;;
|
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
|
||||||
sent) setsid -f sent "$file" 2>/dev/null ;;
|
rs) cargo build ;;
|
||||||
tex) textype "$file" ;;
|
sass) sassc -a "$file" "$base".css ;;
|
||||||
fnl) fennel --compile "$file" > "$base.lua" ;;
|
scad) openscad -o "$base".stl "$file" ;;
|
||||||
*) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$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
|
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:
|
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.
|
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."
|
Check your internet connection, if pacman is already running, or run update manually to see errors."
|
||||||
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||||
|
|
||||||
if pacman -Qu | grep -v "\[ignored\]"
|
if pacman -Qu | grep -v "\[ignored\]"; then
|
||||||
then
|
|
||||||
notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
|
notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
|
||||||
else
|
else
|
||||||
notify-send " Repository Sync" "Sync complete. No new packages for update."
|
notify-send " Repository Sync" "Sync complete. No new packages for update."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
# Toggles all cronjobs off/on.
|
# Toggles all cronjobs off/on.
|
||||||
# Stores disabled crontabs in ~/.consaved until restored.
|
# 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.
|
# Xorg and MacOS as well.
|
||||||
|
|
||||||
# Run only if user logged in (prevent cron errors)
|
# 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
|
# 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
|
# 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
|
# archive, notmuch and the GPG home. This is done by searching common profile
|
||||||
|
@ -25,7 +31,7 @@ pkill -RTMIN+12 dwmblocks
|
||||||
|
|
||||||
eval "$(grep -h -- \
|
eval "$(grep -h -- \
|
||||||
"^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \
|
"^\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/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \
|
||||||
"$HOME/.pam_environment" 2>/dev/null)"
|
"$HOME/.pam_environment" 2>/dev/null)"
|
||||||
|
|
||||||
|
@ -35,54 +41,53 @@ alias mbsync="mbsync -c $MBSYNCRC"
|
||||||
|
|
||||||
# Settings are different for MacOS (Darwin) systems.
|
# Settings are different for MacOS (Darwin) systems.
|
||||||
case "$(uname)" in
|
case "$(uname)" in
|
||||||
Darwin)
|
Darwin)
|
||||||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
|
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
|
case "$(readlink -f /sbin/init)" in
|
||||||
*systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
|
*systemd* | *openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
|
||||||
esac
|
esac
|
||||||
# remember if a display server is running since `ps` doesn't always contain a display
|
# remember if a display server is running since `ps` doesn't always contain a display
|
||||||
pgrepoutput="$(pgrep -a X\(org\|wayland\))"
|
pgrepoutput="$(pgrep -a X\(org\|wayland\))"
|
||||||
displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)"
|
displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)"
|
||||||
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do
|
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do
|
||||||
export DISPLAY=$x
|
export DISPLAY=$x
|
||||||
notify-send --app-name="mutt-wizard" "New mail!" "📬 $2 new mail(s) in \`$1\` account."
|
notify-send --app-name="mutt-wizard" "New mail!" "📬 $2 new mail(s) in \`$1\` account."
|
||||||
done ;}
|
done; }
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check account for new mail. Notify if there is new content.
|
# Check account for new mail. Notify if there is new content.
|
||||||
syncandnotify() {
|
syncandnotify() {
|
||||||
acc="$(echo "$account" | sed "s/.*\///")"
|
acc="$(echo "$account" | sed "s/.*\///")"
|
||||||
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
||||||
new=$(find\
|
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/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/" \
|
||||||
"$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)
|
||||||
-type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null)
|
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
|
||||||
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
|
case 1 in
|
||||||
case 1 in
|
$((newcount > 0))) notify "$acc" "$newcount" ;;
|
||||||
$((newcount > 0)) ) notify "$acc" "$newcount" ;;
|
esac
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sync accounts passed as argument or all.
|
# Sync accounts passed as argument or all.
|
||||||
if [ "$#" -eq "0" ]; then
|
if [ "$#" -eq "0" ]; then
|
||||||
accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
|
accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")"
|
||||||
else
|
else
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
|
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
|
||||||
done
|
done
|
||||||
accounts=$*
|
accounts=$*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Parallelize multiple accounts
|
# Parallelize multiple accounts
|
||||||
for account in $accounts; do
|
for account in $accounts; do
|
||||||
syncandnotify &
|
syncandnotify &
|
||||||
done
|
done
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit
|
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}"
|
pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
|
||||||
/usr/bin/newsboat -x reload
|
/usr/bin/newsboat -x reload
|
||||||
rm -f /tmp/newsupdate
|
rm -f /tmp/newsupdate
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
while : ; do
|
while :; do
|
||||||
dmesg -W -f kern | grep "input:" -q
|
dmesg -W -f kern | grep "input:" -q
|
||||||
sleep 1
|
sleep 1
|
||||||
remaps us:dvorak
|
remaps us:dvorak
|
||||||
done
|
done
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
# battery status file is sent in as an argument from sb-battery
|
# battery status file is sent in as an argument from sb-battery
|
||||||
|
|
||||||
while inotifywait -e modify "$1/status"; do
|
while inotifywait -e modify "$1/status"; do
|
||||||
pkill -RTMIN+3 dwmblocks || break
|
pkill -RTMIN+3 dwmblocks || break
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
while : ; do
|
while :; do
|
||||||
mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break
|
mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
playerctl status -F | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;)
|
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.
|
twoscreen() { # If multi-monitor is selected and there are two screens.
|
||||||
|
|
||||||
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
|
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
|
||||||
# Mirror displays using native resolution of external display and a scaled
|
# Mirror displays using native resolution of external display and a scaled
|
||||||
# version for the internal display
|
# version for the internal display
|
||||||
if [ "$mirror" = "yes" ]; then
|
if [ "$mirror" = "yes" ]; then
|
||||||
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
||||||
internal=$(echo "$screens" | grep -v "$external")
|
internal=$(echo "$screens" | grep -v "$external")
|
||||||
|
|
||||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
|
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
|
||||||
tail -n 1 | awk '{print $1}')
|
tail -n 1 | awk '{print $1}')
|
||||||
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
|
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
|
||||||
tail -n 1 | awk '{print $1}')
|
tail -n 1 | awk '{print $1}')
|
||||||
|
|
||||||
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
|
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
|
||||||
res_ext_y=$(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_x=$(echo "$res_internal" | sed 's/x.*//')
|
||||||
res_int_y=$(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_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
|
||||||
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
|
||||||
|
|
||||||
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
xrandr --output "$external" --auto --scale 1.0x1.0 \
|
||||||
--output "$internal" --auto --same-as "$external" \
|
--output "$internal" --auto --same-as "$external" \
|
||||||
--scale "$scale_x"x"$scale_y"
|
--scale "$scale_x"x"$scale_y"
|
||||||
else
|
else
|
||||||
|
|
||||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||||
secondary=$(echo "$screens" | grep -v "$primary")
|
secondary=$(echo "$screens" | grep -v "$primary")
|
||||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
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
|
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
morescreen() { # If multi-monitor is selected and there are more than two screens.
|
morescreen() { # If multi-monitor is selected and there are more than two screens.
|
||||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||||
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary 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?")
|
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:")
|
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
|
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.
|
multimon() { # Multi-monitor handler.
|
||||||
case "$(echo "$screens" | wc -l)" in
|
case "$(echo "$screens" | wc -l)" in
|
||||||
2) twoscreen ;;
|
2) twoscreen ;;
|
||||||
*) morescreen ;;
|
*) morescreen ;;
|
||||||
esac ;}
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
onescreen() { # If only one output available or chosen.
|
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.
|
postrun() { # Stuff to run to clean up.
|
||||||
setbg # Fix background if screen size/arangement has changed.
|
setbg # Fix background if screen size/arangement has changed.
|
||||||
remaps -n # Re-remap keys if keyboard added (for laptop bases)
|
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
|
{
|
||||||
|
killall dunst
|
||||||
|
setsid -f dunst
|
||||||
|
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get all possible displays
|
# Get all possible displays
|
||||||
|
@ -70,14 +74,22 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
|
||||||
|
|
||||||
# If there's only one screen
|
# If there's only one screen
|
||||||
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
[ "$(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:
|
# Get user choice including multi-monitor and manual selection:
|
||||||
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
||||||
case "$chosen" in
|
case "$chosen" in
|
||||||
"manual selection") arandr ; exit ;;
|
"manual selection")
|
||||||
"multi-monitor") multimon ;;
|
arandr
|
||||||
*) onescreen "$chosen" ;;
|
exit
|
||||||
esac
|
;;
|
||||||
|
"multi-monitor") multimon ;;
|
||||||
|
*) onescreen "$chosen" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
postrun
|
postrun
|
||||||
|
|
|
@ -5,17 +5,20 @@
|
||||||
feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
|
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
|
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 ;;
|
"copy url") echo "$feed" | xclip -selection clipboard ;;
|
||||||
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
|
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
|
||||||
"mpv loop") setsid -f mpv -quiet --loop "$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 ;;
|
"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") 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 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 ;;
|
"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 ;;
|
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 ;;
|
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 ;;
|
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 ;;
|
setbg)
|
||||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
|
curl -L "$feed" >$XDG_CACHE_HOME/pic
|
||||||
lynx) lynx "$feed" >/dev/null 2>&1 ;;
|
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
|
esac
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
# be prompted to give a mountpoint from already existsing directories. If you
|
# be prompted to give a mountpoint from already existsing directories. If you
|
||||||
# input a novel directory, it will prompt you to create that directory.
|
# input a novel directory, it will prompt you to create that directory.
|
||||||
|
|
||||||
getmount() { \
|
getmount() {
|
||||||
[ -z "$chosen" ] && exit 1
|
[ -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
|
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
||||||
test -z "$mp" && exit 1
|
test -z "$mp" && exit 1
|
||||||
if [ ! -d "$mp" ]; then
|
if [ ! -d "$mp" ]; then
|
||||||
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
|
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")
|
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
mountusb() { \
|
mountusb() {
|
||||||
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
|
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
|
||||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||||
sudo -A mount "$chosen" 2>/dev/null && notify-send "禍 USB mounting" "$chosen mounted." && exit 0
|
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"
|
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
|
||||||
partitiontype="$(lsblk -no "fstype" "$chosen")"
|
partitiontype="$(lsblk -no "fstype" "$chosen")"
|
||||||
case "$partitiontype" in
|
case "$partitiontype" in
|
||||||
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
|
"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)";;
|
"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";;
|
*)
|
||||||
|
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." ||
|
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 "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
||||||
chosen="$(echo "$chosen" | cut -d : -f 1)"
|
chosen="$(echo "$chosen" | cut -d : -f 1)"
|
||||||
getmount "$HOME -maxdepth 3 -type d"
|
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
|
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" &&
|
simple-mtpfs --device "$chosen" "$mp" &&
|
||||||
notify-send " Android Mounting" "Android device mounted to $mp." ||
|
notify-send " Android Mounting" "Android device mounted to $mp." ||
|
||||||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
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
|
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
||||||
case $choice in
|
case $choice in
|
||||||
USB) mountusb ;;
|
USB) mountusb ;;
|
||||||
Android) mountandroid ;;
|
Android) mountandroid ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
anddrives=$(simple-mtpfs -l 2>/dev/null)
|
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}')"
|
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() {
|
sharemount() {
|
||||||
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
|
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
|
[ -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
|
sharemount
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
#
|
#
|
||||||
# If there is already a running instance, user will be prompted to end it.
|
# If there is already a running instance, user will be prompted to end it.
|
||||||
|
|
||||||
updateicon() { \
|
updateicon() {
|
||||||
echo "$1" > /tmp/recordingicon
|
echo "$1" >/tmp/recordingicon
|
||||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||||
}
|
}
|
||||||
|
|
||||||
killrecording() {
|
killrecording() {
|
||||||
recpid="$(cat /tmp/recordingpid)"
|
recpid="$(cat /tmp/recordingpid)"
|
||||||
|
@ -25,99 +25,100 @@ killrecording() {
|
||||||
sleep 3
|
sleep 3
|
||||||
kill -9 "$recpid"
|
kill -9 "$recpid"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
screencast() { \
|
screencast() {
|
||||||
ffmpeg -y \
|
ffmpeg -y \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-framerate 60 \
|
-framerate 60 \
|
||||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||||
-i "$DISPLAY" \
|
-i "$DISPLAY" \
|
||||||
-f alsa -i default \
|
-f alsa -i default \
|
||||||
-r 30 \
|
-r 30 \
|
||||||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
||||||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
||||||
echo $! > /tmp/recordingpid
|
echo $! >/tmp/recordingpid
|
||||||
updateicon "ﲠ"
|
updateicon "ﲠ"
|
||||||
}
|
}
|
||||||
|
|
||||||
video() { ffmpeg \
|
video() {
|
||||||
-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() { \
|
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f alsa -i default \
|
-f x11grab \
|
||||||
-c:a flac \
|
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||||
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
|
-i "$DISPLAY" \
|
||||||
echo $! > /tmp/recordingpid
|
-c:v libx264 -qp 0 -r 30 \
|
||||||
updateicon ""
|
"$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:")
|
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
screencast) screencast;;
|
screencast) screencast ;;
|
||||||
audio) audio;;
|
audio) audio ;;
|
||||||
video) video;;
|
video) video ;;
|
||||||
*selected) videoselected;;
|
*selected) videoselected ;;
|
||||||
webcam) webcam;;
|
webcam) webcam ;;
|
||||||
"webcam (hi-def)") webcamhidef;;
|
"webcam (hi-def)") webcamhidef ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
asktoend() { \
|
asktoend() {
|
||||||
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
||||||
[ "$response" = "Yes" ] && killrecording
|
[ "$response" = "Yes" ] && killrecording
|
||||||
}
|
}
|
||||||
|
|
||||||
videoselected()
|
videoselected() {
|
||||||
{
|
slop -f "%x %y %w %h" >/tmp/slop
|
||||||
slop -f "%x %y %w %h" > /tmp/slop
|
read -r X Y W H </tmp/slop
|
||||||
read -r X Y W H < /tmp/slop
|
|
||||||
rm /tmp/slop
|
rm /tmp/slop
|
||||||
|
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-framerate 60 \
|
-framerate 60 \
|
||||||
-video_size "$W"x"$H" \
|
-video_size "$W"x"$H" \
|
||||||
-i :0.0+"$X,$Y" \
|
-i :0.0+"$X,$Y" \
|
||||||
-c:v libx264 -qp 0 -r 30 \
|
-c:v libx264 -qp 0 -r 30 \
|
||||||
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||||
echo $! > /tmp/recordingpid
|
echo $! >/tmp/recordingpid
|
||||||
updateicon "ﲣ"
|
updateicon "ﲣ"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
screencast) screencast;;
|
screencast) screencast ;;
|
||||||
audio) audio;;
|
audio) audio ;;
|
||||||
video) video;;
|
video) video ;;
|
||||||
*selected) videoselected;;
|
*selected) videoselected ;;
|
||||||
kill) killrecording;;
|
kill) killrecording ;;
|
||||||
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
|
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -4,22 +4,25 @@
|
||||||
# Provides you with mounted partitions, select one to unmount.
|
# Provides you with mounted partitions, select one to unmount.
|
||||||
# Drives mounted at /, /boot and /home will not be options 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
|
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||||
|
|
||||||
case "$chosen" in
|
case "$chosen" in
|
||||||
*)
|
*)
|
||||||
chosen="${chosen#📱 }"
|
chosen="${chosen#📱 }"
|
||||||
sudo -A umount -l "$chosen"
|
sudo -A umount -l "$chosen"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
chosen="${chosen% (*}"
|
chosen="${chosen% (*}"
|
||||||
sudo -A umount -l "$chosen"
|
sudo -A umount -l "$chosen"
|
||||||
;;
|
;;
|
||||||
esac && notify-send "禍 Drive unmounted." "$chosen successfully unmounted." ||
|
esac && notify-send "禍 Drive unmounted." "$chosen successfully unmounted." ||
|
||||||
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
|
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
|
set -e
|
||||||
path="$1"
|
path="$1"
|
||||||
shift 1
|
shift 1
|
||||||
while [[ $path != / ]];
|
while [[ $path != / ]]; do
|
||||||
do
|
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
||||||
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
||||||
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
path="$(readlink -f "$path"/..)"
|
||||||
path="$(readlink -f "$path"/..)"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -13,15 +13,19 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$url" in
|
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*)
|
*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 ;;
|
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 & ;;
|
*png | *jpg | *jpe | *jpeg | *gif)
|
||||||
*pdf|*cbz|*cbr)
|
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 &
|
||||||
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*)
|
*pdf | *cbz | *cbr)
|
||||||
qndl "$url" 'curl -LO' >/dev/null 2>&1 ;;
|
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||||
*)
|
;;
|
||||||
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/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
|
esac
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,10 @@ output="$(date '+%y%m%d-%H%M-%S').png"
|
||||||
xclip_cmd="xclip -sel clip -t image/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
|
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}" ;;
|
"a selected area") maim -s pic-selected-"${output}" ;;
|
||||||
"current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
|
"current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
|
||||||
"full screen") maim -q -d 0.2 pic-full-"${output}" ;;
|
"full screen") maim -q -d 0.2 pic-full-"${output}" ;;
|
||||||
"a selected area (copy)") maim -s | ${xclip_cmd} ;;
|
"a selected area (copy)") maim -s | ${xclip_cmd} ;;
|
||||||
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${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} ;;
|
"full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
basename="${1%.*}"
|
basename="${1%.*}"
|
||||||
|
|
||||||
case "${*}" in
|
case "${*}" in
|
||||||
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/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 ;;
|
*.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
|
||||||
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
|
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Arbitrary but unique message tag
|
# Arbitrary but unique message tag
|
||||||
msgTag="volume"
|
msgTag="volume"
|
||||||
|
|
||||||
# Change the volume using alsa(might differ if you use pulseaudio)
|
# Change the volume using alsa(might differ if you use pulseaudio)
|
||||||
pamixer "$@" > /dev/null
|
pamixer "$@" >/dev/null
|
||||||
|
|
||||||
# Query amixer for the current volume and whether or not the speaker is muted
|
# Query amixer for the current volume and whether or not the speaker is muted
|
||||||
volume="$(pamixer --get-volume)"
|
volume="$(pamixer --get-volume)"
|
||||||
|
|
||||||
if [ "$volume" -gt "100" ]; then
|
if [ "$volume" -gt "100" ]; then
|
||||||
urgency="critical"
|
urgency="critical"
|
||||||
else
|
else
|
||||||
urgency="low"
|
urgency="low"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$volume" -gt "70" ]; then
|
if [ "$volume" -gt "70" ]; then
|
||||||
|
@ -25,10 +25,10 @@ fi
|
||||||
|
|
||||||
mute="$(pamixer --get-mute)"
|
mute="$(pamixer --get-mute)"
|
||||||
if [ "$volume" = 0 ] || [ "$mute" = "true" ]; then
|
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"
|
notify-send -a "changeVolume" -i "audio-volume-muted" -u $urgency -h string:x-dunst-stack-tag:$msgTag "Volume muted"
|
||||||
else
|
else
|
||||||
notify-send -a "changeVolume" -i "$icon" -u $urgency -h string:x-dunst-stack-tag:$msgTag \
|
notify-send -a "changeVolume" -i "$icon" -u $urgency -h string:x-dunst-stack-tag:$msgTag \
|
||||||
-h int:value:"$volume" "Volume: ${volume}%"
|
-h int:value:"$volume" "Volume: ${volume}%"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Play the volume changed sound
|
# Play the volume changed sound
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
# (with other things) by default and is used in some other places.
|
# (with other things) by default and is used in some other places.
|
||||||
|
|
||||||
for i in $(ls /tmp/mpvSockets/*); do
|
for i in $(ls /tmp/mpvSockets/*); do
|
||||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
|
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
|
||||||
done
|
done
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
# For example:
|
# For example:
|
||||||
# `./prompt "Do you want to shutdown?" "shutdown -h now"`
|
# `./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
|
[ -z "$line" ] && continue
|
||||||
url="${line%%[ ]*}"
|
url="${line%%[ ]*}"
|
||||||
qndl "$url" "curl -LO"
|
qndl "$url" "curl -LO"
|
||||||
done < "$queuefile"
|
done <"$queuefile"
|
||||||
|
|
||||||
echo > "$queuefile"
|
echo >"$queuefile"
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
index() {
|
index() {
|
||||||
echo "$groups" | cut -d ' ' -f "$1"
|
echo "$groups" | cut -d ' ' -f "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "-n" ]; then
|
if [ "$1" = "-n" ]; then
|
||||||
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||||
elif [ "$1" = "" ];
|
elif [ "$1" = "" ]; then
|
||||||
then
|
groups="us:dvorak de:nodeadkeys"
|
||||||
groups="us:dvorak de:nodeadkeys"
|
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
i=1
|
||||||
i=1
|
while [ ! "$found" ]; do
|
||||||
while [ ! "$found" ]; do
|
group=$(index $i)
|
||||||
group=$(index $i)
|
if [ "$group" = "$current" ]; then
|
||||||
if [ "$group" = "$current" ]; then
|
newgroup=$(index $((i + 1)))
|
||||||
newgroup=$(index $((i+1)))
|
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
found=true
|
||||||
found=true
|
elif [ -z "$group" ]; then
|
||||||
elif [ -z "$group" ]; then
|
newgroup=$(index 1)
|
||||||
newgroup=$(index 1)
|
found=true
|
||||||
found=true
|
fi
|
||||||
fi
|
i=$((i + 1))
|
||||||
i=$((i+1))
|
done
|
||||||
done
|
|
||||||
else
|
else
|
||||||
newgroup="$1"
|
newgroup="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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"
|
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
|
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
|
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||||
sleep 0.03
|
sleep 0.03
|
||||||
pkill -RTMIN+15 dwmblocks
|
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
|
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
|
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
|
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||||
sleep 0.03
|
sleep 0.03
|
||||||
pkill -RTMIN+15 dwmblocks
|
pkill -RTMIN+15 dwmblocks
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/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"
|
url="$1"
|
||||||
else
|
else
|
||||||
url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" |
|
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
|
if awk '{print $1}' "$RSSFILE" | grep "^$url$" >/dev/null; then
|
||||||
notify-send "You already have this RSS feed."
|
notify-send "You already have this RSS feed."
|
||||||
else
|
else
|
||||||
echo "$url" >> "$RSSFILE" && notify-send "RSS feed added."
|
echo "$url" >>"$RSSFILE" && notify-send "RSS feed added."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -10,8 +10,8 @@ for PID in $PIDlist; do
|
||||||
cwd=$(readlink /proc/"$PID"/cwd)
|
cwd=$(readlink /proc/"$PID"/cwd)
|
||||||
# zsh and lf won't be ignored even if it shows ~ or /
|
# zsh and lf won't be ignored even if it shows ~ or /
|
||||||
case "$cmdline" in
|
case "$cmdline" in
|
||||||
'lf -server') continue ;;
|
'lf -server') continue ;;
|
||||||
"${SHELL##*/}"|'lf'|'lf '*) break ;;
|
"${SHELL##*/}" | 'lf' | 'lf '*) break ;;
|
||||||
esac
|
esac
|
||||||
# git (and its sub-processes) will show the root of a repository instead of the actual cwd, so they're ignored
|
# 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
|
[ "$process_group_leader" = 'git' ] || [ ! -d "$cwd" ] && continue
|
||||||
|
|
|
@ -8,10 +8,13 @@
|
||||||
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
|
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
|
||||||
|
|
||||||
trueloc="$(readlink -f "$1")" &&
|
trueloc="$(readlink -f "$1")" &&
|
||||||
case "$(file --mime-type -b "$trueloc")" in
|
case "$(file --mime-type -b "$trueloc")" in
|
||||||
image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
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." ;;
|
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
|
notify-send "Error" "Not a valid image."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
xwallpaper --zoom "$bgloc"
|
xwallpaper --zoom "$bgloc"
|
||||||
|
|
|
@ -12,7 +12,7 @@ lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc"
|
||||||
|
|
||||||
# Remove, prepare files
|
# Remove, prepare files
|
||||||
rm -f "$shell_shortcuts" "$lf_files" "$lf_dirs" "$lf_shortcuts" "$zsh_named_dirs" 2>/dev/null
|
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.
|
# Format the `directories` file in the correct syntax and sent it to all three configs.
|
||||||
eval "echo \"$(cat "$bmdirs")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
|
eval "echo \"$(cat "$bmdirs")\"" | awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
vals=$(aptitude full-upgrade --simulate --assume-yes |\
|
vals=$(aptitude full-upgrade --simulate --assume-yes |
|
||||||
grep -m1 '^[0-9]\+ packages upgraded,' |\
|
grep -m1 '^[0-9]\+ packages upgraded,' |
|
||||||
tr -cd '0-9 ' |\
|
tr -cd '0-9 ' |
|
||||||
tr ' ' '\n' |\
|
tr ' ' '\n' |
|
||||||
grep '[0-9]\+' |\
|
grep '[0-9]\+' |
|
||||||
xargs echo)
|
xargs echo)
|
||||||
|
|
||||||
print=" "
|
print=" "
|
||||||
for i in $vals; do
|
for i in $vals; do
|
||||||
[ $i != 0 ] && icon="\033[11m\033[10m"
|
[ $i != 0 ] && icon="\033[11m\033[10m"
|
||||||
print="$print$i/"
|
print="$print$i/"
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$icon" ] && printf "$icon " && echo $print | sed 's/\/$//'
|
[ -n "$icon" ] && printf "$icon " && echo $print | sed 's/\/$//'
|
||||||
|
|
|
@ -6,41 +6,64 @@ green="\033[32m"
|
||||||
white="\033[37m"
|
white="\033[37m"
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
for battery in /sys/class/power_supply/BAT?*; do
|
for battery in /sys/class/power_supply/BAT?*; do
|
||||||
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
|
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
|
||||||
[ -n "${capacity+x}" ] && printf " "
|
[ -n "${capacity+x}" ] && printf " "
|
||||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||||
case "$(cat "$battery/status" 2>&1)" in
|
case "$(cat "$battery/status" 2>&1)" in
|
||||||
"Full") icon=""; color="$green" ;;
|
"Full")
|
||||||
"Charging") icon=""; color="$cyan" ;;
|
icon=""
|
||||||
"Not charging") icon=""; color="$white" ;;
|
color="$green"
|
||||||
"Unknown") icon=""; color="$orange" ;;
|
;;
|
||||||
"Discharging")
|
"Charging")
|
||||||
if [ "$capacity" -le 10 ]; then
|
icon=""
|
||||||
icon=""; color="$red"
|
color="$cyan"
|
||||||
elif [ "$capacity" -le 20 ]; then
|
;;
|
||||||
icon=""; color="$red"
|
"Not charging")
|
||||||
elif [ "$capacity" -le 30 ]; then
|
icon=""
|
||||||
icon=""; color="$white"
|
color="$white"
|
||||||
elif [ "$capacity" -le 40 ]; then
|
;;
|
||||||
icon=""; color="$white"
|
"Unknown")
|
||||||
elif [ "$capacity" -le 50 ]; then
|
icon=""
|
||||||
icon=""; color="$white"
|
color="$orange"
|
||||||
elif [ "$capacity" -le 60 ]; then
|
;;
|
||||||
icon=""; color="$white"
|
"Discharging")
|
||||||
elif [ "$capacity" -le 70 ]; then
|
if [ "$capacity" -le 10 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
elif [ "$capacity" -le 80 ]; then
|
color="$red"
|
||||||
icon=""; color="$white"
|
elif [ "$capacity" -le 20 ]; then
|
||||||
elif [ "$capacity" -le 90 ]; then
|
icon=""
|
||||||
icon=""; color="$white"
|
color="$red"
|
||||||
elif [ "$capacity" -le 95 ]; then
|
elif [ "$capacity" -le 30 ]; then
|
||||||
icon=""; color="$white"
|
icon=""
|
||||||
else
|
color="$white"
|
||||||
icon=""; color="$white"
|
elif [ "$capacity" -le 40 ]; then
|
||||||
fi
|
icon=""
|
||||||
|
color="$white"
|
||||||
;;
|
elif [ "$capacity" -le 50 ]; then
|
||||||
*) exit 1 ;;
|
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
|
esac
|
||||||
printf "$color%s$reset %d" "$icon" "$capacity";
|
printf "$color%s$reset %d" "$icon" "$capacity"
|
||||||
done && printf "\\n"
|
done && printf "\\n"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cache=/tmp/cpubarscache
|
cache=/tmp/cpubarscache
|
||||||
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
|
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")
|
old=$(cat "$cache")
|
||||||
printf "\033[11m\033[10m "
|
printf "\033[11m\033[10m "
|
||||||
echo "$stats" | while read -r row; do
|
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)
|
case "$(echo "$old" | awk '{if ($1 == id)
|
||||||
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
|
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
|
||||||
id="$id" total="$total" idle="$idle")" in
|
id="$id" total="$total" idle="$idle")" in
|
||||||
"0") printf "\033[32m▁";;
|
"0") printf "\033[32m▁" ;;
|
||||||
"1") printf "\033[32m▂";;
|
"1") printf "\033[32m▂" ;;
|
||||||
"2") printf "\033[32m▃";;
|
"2") printf "\033[32m▃" ;;
|
||||||
"3") printf "\033[33m▄";;
|
"3") printf "\033[33m▄" ;;
|
||||||
"4") printf "\033[33m▅";;
|
"4") printf "\033[33m▅" ;;
|
||||||
"5") printf "\033[33m▆";;
|
"5") printf "\033[33m▆" ;;
|
||||||
"6"|"7"|"8") printf "\033[31m▇";;
|
"6" | "7" | "8") printf "\033[31m▇" ;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
done; printf "\033[0m\n"
|
done
|
||||||
echo "$stats" > "$cache"
|
printf "\033[0m\n"
|
||||||
|
echo "$stats" >"$cache"
|
||||||
|
|
|
@ -12,7 +12,7 @@ url="wttr.in/Karlsruhe"
|
||||||
opt="?F"
|
opt="?F"
|
||||||
emojiopt="?format=1"
|
emojiopt="?format=1"
|
||||||
convertemoji() {
|
convertemoji() {
|
||||||
sed -i '
|
sed -i '
|
||||||
s/☀️//
|
s/☀️//
|
||||||
s/☁️//
|
s/☁️//
|
||||||
s/⛅️//
|
s/⛅️//
|
||||||
|
@ -26,11 +26,11 @@ s/🌩//
|
||||||
s/🌫//
|
s/🌫//
|
||||||
' "$emojifile"
|
' "$emojifile"
|
||||||
}
|
}
|
||||||
getforecast() { curl -sf "$url$opt" > "$weatherfile" && curl -sf "$url$emojiopt" > "$emojifile" || exit 1 ;}
|
getforecast() { curl -sf "$url$opt" >"$weatherfile" && curl -sf "$url$emojiopt" >"$emojifile" || exit 1; }
|
||||||
showweather() {
|
showweather() {
|
||||||
emoji="$(printf "\033[12m%s\033[10m" "$(cut -d ' ' -f 1 "$emojifile")")"
|
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 '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 "°"}';
|
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
|
getforecast && convertemoji
|
||||||
showweather
|
showweather
|
||||||
|
|
|
@ -2,27 +2,27 @@
|
||||||
shift=""
|
shift=""
|
||||||
|
|
||||||
if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
|
if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
|
||||||
for w in /sys/class/net/w*/; do
|
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:]")"
|
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:]")"
|
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"
|
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
|
||||||
shift=" "
|
shift=" "
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
|
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
|
||||||
for e in /sys/class/net/e*/operstate; do
|
for e in /sys/class/net/e*/operstate; do
|
||||||
if_icon="$(sed "s/down//;s/up//" $e)"
|
if_icon="$(sed "s/down//;s/up//" $e)"
|
||||||
printf "$shift\033[11m%s\033[10m" "$if_icon"
|
printf "$shift\033[11m%s\033[10m" "$if_icon"
|
||||||
shift=" "
|
shift=" "
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
|
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
|
||||||
for _ in /sys/class/net/tun*/operstate; do
|
for _ in /sys/class/net/tun*/operstate; do
|
||||||
printf "$shift\033[11m%s\033[10m" "嬨"
|
printf "$shift\033[11m%s\033[10m" "嬨"
|
||||||
shift=" "
|
shift=" "
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
filter() {
|
filter() {
|
||||||
if mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 3 ]; then
|
if mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 3 ]; then
|
||||||
song=$(mpc current -f "%artist% - %title%" | xargs -0 )
|
song=$(mpc current -f "%artist% - %title%" | xargs -0)
|
||||||
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
|
[ ${#song} -gt 35 ] && song="$(printf %.35s "$song")…"
|
||||||
mpc | awk 'NR==2' | grep -q playing && icon="" || icon=""
|
mpc | awk 'NR==2' | grep -q playing && icon="" || icon=""
|
||||||
echo "$icon $song"
|
echo "$icon $song"
|
||||||
elif mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 1 ]; then
|
elif mpc 1>/dev/null 2>&1 && [ "$(mpc | wc -l)" -eq 1 ]; then
|
||||||
echo "ﱙ"
|
echo "ﱙ"
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
pidof -x sbd-music >/dev/null 2>&1 || sbd-music >/dev/null 2>&1 &
|
pidof -x sbd-music >/dev/null 2>&1 || sbd-music >/dev/null 2>&1 &
|
||||||
filter
|
filter
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
update() {
|
update() {
|
||||||
sum=0
|
sum=0
|
||||||
for arg; do
|
for arg; do
|
||||||
read -r i < "$arg"
|
read -r i <"$arg"
|
||||||
sum=$(( sum + i ))
|
sum=$((sum + i))
|
||||||
done
|
done
|
||||||
cache=/tmp/${1##*/}
|
cache=/tmp/${1##*/}
|
||||||
[ -f "$cache" ] && read -r old < "$cache" || old=0
|
[ -f "$cache" ] && read -r old <"$cache" || old=0
|
||||||
printf %d\\n "$sum" > "$cache"
|
printf %d\\n "$sum" >"$cache"
|
||||||
printf %d\\n $(( sum - old ))
|
printf %d\\n $((sum - old))
|
||||||
}
|
}
|
||||||
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
||||||
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
|
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
|
||||||
|
|
|
@ -9,9 +9,9 @@ elif [ "$vol" -gt "30" ]; then
|
||||||
icon=""
|
icon=""
|
||||||
elif [ "$vol" -gt "0" ]; then
|
elif [ "$vol" -gt "0" ]; then
|
||||||
icon=""
|
icon=""
|
||||||
elif [ "$vol" -eq "0" ]; then
|
elif [ "$vol" -eq "0" ]; then
|
||||||
icon=""
|
icon=""
|
||||||
else
|
else
|
||||||
printf "\033[11m\033[10m " && exit
|
printf "\033[11m\033[10m " && exit
|
||||||
fi
|
fi
|
||||||
printf "\033[11m%s\033[10m %s\n" "$icon" "$vol"
|
printf "\033[11m%s\033[10m %s\n" "$icon" "$vol"
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# A dmenu wrapper script for system functions.
|
# A dmenu wrapper script for system functions.
|
||||||
case "$(readlink -f /sbin/init)" in
|
case "$(readlink -f /sbin/init)" in
|
||||||
*systemd*) ctl='systemctl' ;;
|
*systemd*) ctl='systemctl' ;;
|
||||||
*) ctl='loginctl' ;;
|
*) ctl='loginctl' ;;
|
||||||
esac
|
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
|
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;;
|
' lock')
|
||||||
'ﴚ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
|
xset s activate &
|
||||||
'累 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
|
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 ;;
|
# 'ﭦ hibernate') slock $ctl hibernate -i ;;
|
||||||
# ' sleep') slock $ctl suspend -i ;;
|
# ' sleep') slock $ctl suspend -i ;;
|
||||||
'ﰇ reboot') $ctl reboot ;;
|
'ﰇ reboot') $ctl reboot ;;
|
||||||
'襤 shutdown') $ctl poweroff ;;
|
'襤 shutdown') $ctl poweroff ;;
|
||||||
' display off') xset dpms force off ;;
|
' display off') xset dpms force off ;;
|
||||||
*) exit 1 ;;
|
*) exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
# I have vim run this file whenever I exit a .tex file.
|
# I have vim run this file whenever I exit a .tex file.
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*.tex)
|
*.tex)
|
||||||
file=$(readlink -f "$1")
|
file=$(readlink -f "$1")
|
||||||
dir=$(dirname "$file")
|
dir=$(dirname "$file")
|
||||||
base="${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")"
|
rm -rdf "$dir/_minted-$(basename -- "$base")"
|
||||||
;;
|
;;
|
||||||
*) printf "Give .tex file as argument.\\n" ;;
|
*) printf "Give .tex file as argument.\\n" ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -2,25 +2,25 @@
|
||||||
set -e
|
set -e
|
||||||
[ -e "$1" ] || exit 1
|
[ -e "$1" ] || exit 1
|
||||||
getfsroot() {
|
getfsroot() {
|
||||||
printf "%s" "$(df "$1" --output=target | tail -1)"
|
printf "%s" "$(df "$1" --output=target | tail -1)"
|
||||||
}
|
}
|
||||||
|
|
||||||
filepath="$(realpath "$1")"
|
filepath="$(realpath "$1")"
|
||||||
filename="$(basename "$1")"
|
filename="$(basename "$1")"
|
||||||
fsroot="$(getfsroot "$1")"
|
fsroot="$(getfsroot "$1")"
|
||||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
||||||
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
||||||
|| basedir="${fsroot}/.Trash"
|
basedir="${fsroot}/.Trash"
|
||||||
infodir="$basedir/info"
|
infodir="$basedir/info"
|
||||||
filedir="$basedir/files"
|
filedir="$basedir/files"
|
||||||
|
|
||||||
mkdir -p "$infodir" 1>/dev/null 2>&1
|
mkdir -p "$infodir" 1>/dev/null 2>&1
|
||||||
mkdir -p "$filedir" 1>/dev/null 2>&1
|
mkdir -p "$filedir" 1>/dev/null 2>&1
|
||||||
find "$filedir" -regex ".*$filename.*" | grep -oP '(?<=.\.~)\d+(?=~$)' | sort -n | tail -1 | (
|
find "$filedir" -regex ".*$filename.*" | grep -oP '(?<=.\.~)\d+(?=~$)' | sort -n | tail -1 | (
|
||||||
ext=$(($(cat /dev/stdin)+1))
|
ext=$(($(cat /dev/stdin) + 1))
|
||||||
filedest="$filedir/$filename.~$ext~"
|
filedest="$filedir/$filename.~$ext~"
|
||||||
command mv -f "$filepath" "$filedest"
|
command mv -f "$filepath" "$filedest"
|
||||||
cat <<EOF > "$infodir/$(basename "$filedest")"
|
cat <<EOF >"$infodir/$(basename "$filedest")"
|
||||||
[Trash Info]
|
[Trash Info]
|
||||||
Path=$filepath
|
Path=$filepath
|
||||||
DeletionDate=$(date +%Y%m%dT%T)
|
DeletionDate=$(date +%Y%m%dT%T)
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
getfsroot() {
|
getfsroot() {
|
||||||
printf "%s" "$(df "$1" --output=target | tail -1)"
|
printf "%s" "$(df "$1" --output=target | tail -1)"
|
||||||
}
|
}
|
||||||
list() {
|
list() {
|
||||||
# 1st arg is trash files directory
|
# 1st arg is trash files directory
|
||||||
# 2nd arg is directory to match trash files for
|
# 2nd arg is directory to match trash files for
|
||||||
[ ! "$(ls -A "$1")" ] && exit 1
|
[ ! "$(ls -A "$1")" ] && exit 1
|
||||||
for file in "$1"/* ; do
|
for file in "$1"/*; do
|
||||||
[ "$(head -1 "$file")" = "[Trash Info]" ] && \
|
[ "$(head -1 "$file")" = "[Trash Info]" ] &&
|
||||||
fpath=$(grep Path "$file" | cut -d '=' -f2) && \
|
fpath=$(grep Path "$file" | cut -d '=' -f2) &&
|
||||||
echo "$fpath" | grep -qP "^$2/[^/]+$" && \
|
echo "$fpath" | grep -qP "^$2/[^/]+$" &&
|
||||||
printf "%s %s %s\n" \
|
printf "%s %s %s\n" \
|
||||||
"$(basename "$file")" \
|
"$(basename "$file")" \
|
||||||
"$fpath" \
|
"$fpath" \
|
||||||
"$(date -d "$(grep Date "$file" | cut -d '=' -f2)" +'%x %X')"
|
"$(date -d "$(grep Date "$file" | cut -d '=' -f2)" +'%x %X')"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -n "$1" ] && dir="$(realpath "$1")" || dir="$(getfsroot "$PWD")"
|
[ -n "$1" ] && dir="$(realpath "$1")" || dir="$(getfsroot "$PWD")"
|
||||||
fsroot="$(getfsroot "$dir")"
|
fsroot="$(getfsroot "$dir")"
|
||||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
||||||
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
||||||
|| basedir="${fsroot}/.Trash"
|
basedir="${fsroot}/.Trash"
|
||||||
|
|
||||||
sel="$(list "$basedir/info" "$dir" | fzf)"
|
sel="$(list "$basedir/info" "$dir" | fzf)"
|
||||||
file="$basedir/files/$(echo "$sel" | cut -d ' ' -f1)"
|
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
|
[ ! -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"
|
inputaudio="$1"
|
||||||
|
|
||||||
|
@ -22,25 +25,24 @@ ext="opus"
|
||||||
#ext="${1#*.}"
|
#ext="${1#*.}"
|
||||||
|
|
||||||
# Get the total number of tracks from the number of lines.
|
# Get the total number of tracks from the number of lines.
|
||||||
total="$(wc -l < "$2")"
|
total="$(wc -l <"$2")"
|
||||||
|
|
||||||
while read -r x;
|
while read -r x; do
|
||||||
do
|
|
||||||
end="$(echo "$x" | cut -d' ' -f1)"
|
end="$(echo "$x" | cut -d' ' -f1)"
|
||||||
|
|
||||||
[ -n "$start" ] &&
|
[ -n "$start" ] &&
|
||||||
echo "From $start to $end; $track $title"
|
echo "From $start to $end; $track $title"
|
||||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||||
[ -n "$start" ] && echo "Splitting \"$title\"..." &&
|
[ -n "$start" ] && echo "Splitting \"$title\"..." &&
|
||||||
ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -to "$end" -vn -c copy "$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"
|
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||||
title="$(echo "$x" | cut -d' ' -f 2-)"
|
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")"
|
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"
|
start="$end"
|
||||||
done < "$2"
|
done <"$2"
|
||||||
# The last track must be done outside the loop.
|
# The last track must be done outside the loop.
|
||||||
echo "From $start to the end: $title"
|
echo "From $start to the end: $title"
|
||||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||||
echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" &&
|
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
|
if [ -f "$1" ]; then
|
||||||
# Try to get DOI from pdfinfo or pdftotext output.
|
# Try to get DOI from pdfinfo or pdftotext output.
|
||||||
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
||||||
doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
|
doi=$(pdftotext "$1" - 2>/dev/null | grep -io "doi:.*" -m 1) ||
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
doi="$1"
|
doi="$1"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,59 +1,59 @@
|
||||||
#!/usr/bin/sh
|
#!/usr/bin/sh
|
||||||
|
|
||||||
usage ()
|
usage() {
|
||||||
{
|
printf "Usage : noisereduce <input video file> <output video file>\n"
|
||||||
printf "Usage : noisereduce <input video file> <output video file>\n"
|
exit
|
||||||
exit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tests for requirements
|
# Tests for requirements
|
||||||
ifinstalled ffmpeg || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
ifinstalled ffmpeg || {
|
||||||
ifinstalled sox || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
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 ]
|
if [ "$#" -ne 2 ]; then
|
||||||
then
|
usage
|
||||||
usage
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "$1" ]
|
if [ ! -e "$1" ]; then
|
||||||
then
|
printf "File not found: %s\n" "$1"
|
||||||
printf "File not found: %s\n" "$1"
|
exit
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$2" ]
|
if [ -e "$2" ]; then
|
||||||
then
|
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
||||||
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
read -r yn
|
||||||
read -r yn
|
case $yn in
|
||||||
case $yn in
|
[Yy]*) ;;
|
||||||
[Yy]* ) ;;
|
*) exit ;;
|
||||||
* ) exit;;
|
esac
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
inBasename=$(basename "$1")
|
inBasename=$(basename "$1")
|
||||||
inExt="${inBasename##*.}"
|
inExt="${inBasename##*.}"
|
||||||
|
|
||||||
isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
|
isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
|
||||||
if [ -n "$isVideoStr" ]
|
if [ -n "$isVideoStr" ]; then
|
||||||
then
|
isVideo=1
|
||||||
isVideo=1
|
printf "Detected %s as a video file\n" "$inBasename"
|
||||||
printf "Detected %s as a video file\n" "$inBasename"
|
|
||||||
else
|
else
|
||||||
isVideo=0
|
isVideo=0
|
||||||
printf "Detected %s as an audio file\n" "$inBasename"
|
printf "Detected %s as an audio file\n" "$inBasename"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Sample noise start time [00:00:00]: "
|
printf "Sample noise start time [00:00:00]: "
|
||||||
read -r sampleStart
|
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]: "
|
printf "Sample noise end time [00:00:00.900]: "
|
||||||
read -r sampleEnd
|
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]: "
|
printf "Noise reduction amount [0.21]: "
|
||||||
read -r sensitivity
|
read -r sensitivity
|
||||||
if [ -z "$sensitivity" ] ; then sensitivity="0.21"; fi
|
if [ -z "$sensitivity" ]; then sensitivity="0.21"; fi
|
||||||
|
|
||||||
|
|
||||||
tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
|
tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
|
||||||
tmpAudFile="/tmp/noiseclean_tmpaud.wav"
|
tmpAudFile="/tmp/noiseclean_tmpaud.wav"
|
||||||
|
@ -64,18 +64,18 @@ tmpAudCleanFile="/tmp/noiseclean_tmpaud-clean.wav"
|
||||||
printf "Cleaning noise on %s...\n" "$1"
|
printf "Cleaning noise on %s...\n" "$1"
|
||||||
|
|
||||||
if [ $isVideo -eq "1" ]; then
|
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:v 0 -vcodec copy -an "$tmpVidFile"
|
||||||
ffmpeg -v warning -y -i "$1" -qscale:a 0 "$tmpAudFile"
|
ffmpeg -v warning -y -i "$1" -qscale:a 0 "$tmpAudFile"
|
||||||
else
|
else
|
||||||
cp "$1" "$tmpAudFile"
|
cp "$1" "$tmpAudFile"
|
||||||
fi
|
fi
|
||||||
ffmpeg -v warning -y -i "$1" -vn -ss "$sampleStart" -t "$sampleEnd" "$noiseAudFile"
|
ffmpeg -v warning -y -i "$1" -vn -ss "$sampleStart" -t "$sampleEnd" "$noiseAudFile"
|
||||||
sox "$noiseAudFile" -n noiseprof "$noiseProfFile"
|
sox "$noiseAudFile" -n noiseprof "$noiseProfFile"
|
||||||
sox "$tmpAudFile" "$tmpAudCleanFile" noisered "$noiseProfFile" "$sensitivity"
|
sox "$tmpAudFile" "$tmpAudCleanFile" noisered "$noiseProfFile" "$sensitivity"
|
||||||
if [ $isVideo -eq "1" ]; then
|
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
|
else
|
||||||
cp "$tmpAudCleanFile" "$2"
|
cp "$tmpAudCleanFile" "$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Done"
|
printf "Done"
|
||||||
|
|
|
@ -13,41 +13,45 @@ ifinstalled pass pass-otp
|
||||||
|
|
||||||
dir="${PASSWORD_STORE_DIR}"
|
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
|
case $choice in
|
||||||
🆕add )
|
🆕add)
|
||||||
ifinstalled maim zbar xclip || exit 1
|
ifinstalled maim zbar xclip || exit 1
|
||||||
|
|
||||||
temp="$dir/temp.png"
|
temp="$dir/temp.png"
|
||||||
otp="otp-test-script"
|
otp="otp-test-script"
|
||||||
trap 'shred -fu $temp; pass rm $otp' HUP INT QUIT TERM PWR EXIT
|
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
|
maim -s "$temp" || exit 1
|
||||||
info="$(zbarimg -q "$temp")"
|
info="$(zbarimg -q "$temp")"
|
||||||
info="${info#QR-Code:}"
|
info="${info#QR-Code:}"
|
||||||
issuer="$(echo "$info" | grep -o "issuer=[A-z0-9]\+")"
|
issuer="$(echo "$info" | grep -o "issuer=[A-z0-9]\+")"
|
||||||
name="${issuer#issuer=}"
|
name="${issuer#issuer=}"
|
||||||
|
|
||||||
if echo "$info" | pass otp insert "$otp"; then
|
if echo "$info" | pass otp insert "$otp"; then
|
||||||
while true ; do
|
while true; do
|
||||||
export name="$(prinf | dmenu -p "Give this One Time Password a one-word name:")"
|
export name="$(prinf | dmenu -p "Give this One Time Password a one-word name:")"
|
||||||
echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break
|
echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break
|
||||||
done
|
done
|
||||||
pass mv "$otp" "$name-otp"
|
pass mv "$otp" "$name-otp"
|
||||||
notify-send "Successfully added." "$name-otp has been created."
|
notify-send "Successfully added." "$name-otp has been created."
|
||||||
else
|
else
|
||||||
notify-send "No OTP data found." "Try to scan the image again more precisely."
|
notify-send "No OTP data found." "Try to scan the image again more precisely."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
🕙sync-time )
|
🕙sync-time)
|
||||||
ifinstalled ntp || exit 1
|
ifinstalled ntp || exit 1
|
||||||
notify-send -u low "🕙 Synchronizing Time..." "Synching time with remote NTP servers..."
|
notify-send -u low "🕙 Synchronizing Time..." "Synching time with remote NTP servers..."
|
||||||
updatedata="$(sudo ntpdate pool.ntp.org)" &&
|
updatedata="$(sudo ntpdate pool.ntp.org)" &&
|
||||||
notify-send -u low "🕙 Synchronizing Time..." "Done. Time changed by ${updatedata#*offset }"
|
notify-send -u low "🕙 Synchronizing Time..." "Done. Time changed by ${updatedata#*offset }"
|
||||||
;;
|
;;
|
||||||
*) pass otp -c ${choice}-otp ;;
|
*) pass otp -c ${choice}-otp ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -20,14 +20,18 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
|
||||||
r) redo="$OPTARG" ;;
|
r) redo="$OPTARG" ;;
|
||||||
s) ppt="$OPTARG" ;;
|
s) ppt="$OPTARG" ;;
|
||||||
e) endtime="$OPTARG" ;;
|
e) endtime="$OPTARG" ;;
|
||||||
x) res="$OPTARG"
|
x)
|
||||||
|
res="$OPTARG"
|
||||||
echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
|
echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
|
||||||
echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
|
echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
|
||||||
exit 1 ;;
|
exit 1
|
||||||
p) echo "Purge old build files in $cache? [y/N]"
|
;;
|
||||||
|
p)
|
||||||
|
echo "Purge old build files in $cache? [y/N]"
|
||||||
read -r confirm
|
read -r confirm
|
||||||
echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
|
echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
|
||||||
exit ;;
|
exit
|
||||||
|
;;
|
||||||
v) verbose=True ;;
|
v) verbose=True ;;
|
||||||
*) echo "$(basename "$0") usage:
|
*) echo "$(basename "$0") usage:
|
||||||
-i input timecode list (required)
|
-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
|
-d tmp directory
|
||||||
-r rerun imagemagick commands even if done previously (in case files or background has changed)
|
-r rerun imagemagick commands even if done previously (in case files or background has changed)
|
||||||
-p purge old build files instead of running
|
-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.
|
# 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 "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:00 first_image.jpg
|
||||||
00:00:03 otherdirectory/next_image.jpg
|
00:00:03 otherdirectory/next_image.jpg
|
||||||
|
@ -57,17 +61,20 @@ esac done
|
||||||
etc...
|
etc...
|
||||||
|
|
||||||
Timecodes and filenames must be separated by Tabs." &&
|
Timecodes and filenames must be separated by Tabs." &&
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "${audio+x}" ]; then
|
if [ -n "${audio+x}" ]; then
|
||||||
# Check that the audio file looks like an actual audio file.
|
# Check that the audio file looks like an actual audio file.
|
||||||
case "$(file --dereference --brief --mime-type -- "$audio")" in
|
case "$(file --dereference --brief --mime-type -- "$audio")" in
|
||||||
audio/*) ;;
|
audio/*) ;;
|
||||||
*) echo "That doesn't look like an audio file."; exit 1 ;;
|
*)
|
||||||
|
echo "That doesn't look like an audio file."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
||||||
endtime="$((totseconds-seconds))"
|
endtime="$((totseconds - seconds))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prepdir="${prepdir:-$cache/$file}"
|
prepdir="${prepdir:-$cache/$file}"
|
||||||
|
@ -78,43 +85,42 @@ prepfile="$prepdir/$file.prep"
|
||||||
mkdir -p "$prepdir"
|
mkdir -p "$prepdir"
|
||||||
|
|
||||||
{
|
{
|
||||||
while read -r x;
|
while read -r x; do
|
||||||
do
|
# Get the time from the first column.
|
||||||
# Get the time from the first column.
|
time="${x%% *}"
|
||||||
time="${x%% *}"
|
seconds="$(date '+%s' -d "$time")"
|
||||||
seconds="$(date '+%s' -d "$time")"
|
# Duration is not used on the first looped item.
|
||||||
# Duration is not used on the first looped item.
|
duration="$((seconds - prevseconds))"
|
||||||
duration="$((seconds - prevseconds))"
|
|
||||||
|
|
||||||
# Get the filename/text content from the rest.
|
# Get the filename/text content from the rest.
|
||||||
content="${x#* }"
|
content="${x#* }"
|
||||||
base="$(basename "$content")"
|
base="$(basename "$content")"
|
||||||
base="${base%.*}.jpg"
|
base="${base%.*}.jpg"
|
||||||
|
|
||||||
if [ -f "$content" ]; then
|
if [ -f "$content" ]; then
|
||||||
# If images have already been made in a previous run, do not recreate
|
# If images have already been made in a previous run, do not recreate
|
||||||
# them unless -r was given.
|
# them unless -r was given.
|
||||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
|
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ]; } &&
|
||||||
convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base"
|
convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base"
|
||||||
else
|
else
|
||||||
{ [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
|
{ [ ! -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"
|
convert -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the first line, do not write yet.
|
# If the first line, do not write yet.
|
||||||
[ "$time" = "00:00:00" ] || echo "file '$prevbase'
|
[ "$time" = "00:00:00" ] || echo "file '$prevbase'
|
||||||
duration $duration"
|
duration $duration"
|
||||||
|
|
||||||
# Keep the information required for the next file.
|
# Keep the information required for the next file.
|
||||||
prevbase="$base"
|
prevbase="$base"
|
||||||
prevtime="$time"
|
prevtime="$time"
|
||||||
prevseconds="$(date '+%s' -d "$prevtime")"
|
prevseconds="$(date '+%s' -d "$prevtime")"
|
||||||
done < "$file"
|
done <"$file"
|
||||||
# Do last file which must be given twice as follows
|
# Do last file which must be given twice as follows
|
||||||
echo "file '$base'
|
echo "file '$base'
|
||||||
duration ${endtime:-5}
|
duration ${endtime:-5}
|
||||||
file '$base'"
|
file '$base'"
|
||||||
} > "$prepfile"
|
} >"$prepfile"
|
||||||
if [ -n "${audio+x}" ]; then
|
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"
|
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
|
else
|
||||||
|
|
|
@ -11,7 +11,7 @@ Options:
|
||||||
-d: year of publication
|
-d: year of publication
|
||||||
-g: genre
|
-g: genre
|
||||||
-c: comment
|
-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
|
while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in
|
||||||
a) artist="${OPTARG}" ;;
|
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}" ;;
|
c) comment="${OPTARG}" ;;
|
||||||
f) file="${OPTARG}" ;;
|
f) file="${OPTARG}" ;;
|
||||||
*) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
|
*) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
|
||||||
esac done
|
esac done
|
||||||
|
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ file="$1"
|
||||||
[ -z "$track" ] && echo "Enter a track number." && read -r track
|
[ -z "$track" ] && echo "Enter a track number." && read -r track
|
||||||
|
|
||||||
case "$file" in
|
case "$file" in
|
||||||
*.ogg) echo "Title=$title
|
*.ogg) echo "Title=$title
|
||||||
Artist=$artist
|
Artist=$artist
|
||||||
Album=$album
|
Album=$album
|
||||||
Track=$track
|
Track=$track
|
||||||
|
@ -46,7 +46,7 @@ Total=$total
|
||||||
Date=$date
|
Date=$date
|
||||||
Genre=$genre
|
Genre=$genre
|
||||||
Comment=$comment" | vorbiscomment -w "$file" ;;
|
Comment=$comment" | vorbiscomment -w "$file" ;;
|
||||||
*.opus) echo "Title=$title
|
*.opus) echo "Title=$title
|
||||||
Artist=$artist
|
Artist=$artist
|
||||||
Album=$album
|
Album=$album
|
||||||
Track=$track
|
Track=$track
|
||||||
|
@ -54,8 +54,8 @@ Total=$total
|
||||||
Date=$date
|
Date=$date
|
||||||
Genre=$genre
|
Genre=$genre
|
||||||
Comment=$comment" | opustags -i -S "$file" ;;
|
Comment=$comment" | opustags -i -S "$file" ;;
|
||||||
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
|
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
|
||||||
*.flac) echo "TITLE=$title
|
*.flac) echo "TITLE=$title
|
||||||
ARTIST=$artist
|
ARTIST=$artist
|
||||||
ALBUM=$album
|
ALBUM=$album
|
||||||
TRACKNUMBER=$track
|
TRACKNUMBER=$track
|
||||||
|
@ -63,5 +63,5 @@ TOTALTRACKS=$total
|
||||||
DATE=$date
|
DATE=$date
|
||||||
GENRE=$genre
|
GENRE=$genre
|
||||||
DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;;
|
DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;;
|
||||||
*) echo "File type not implemented yet." ;;
|
*) echo "File type not implemented yet." ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -35,4 +35,3 @@ json="$(jq -r --arg "$movie" "$thumbnail" ". + {\"$movie\": \"$thumbnail\"}" <"$
|
||||||
echo "$json" >"$index"
|
echo "$json" >"$index"
|
||||||
|
|
||||||
echo "$cache/$thumbnail"
|
echo "$cache/$thumbnail"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue