Fix maybe_source_env_file and implement better screenshotting

This commit is contained in:
Daniel Flanagan 2020-04-20 10:57:33 -05:00
parent 71b9ace58a
commit 151a649d94
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
5 changed files with 18 additions and 13 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME="$HOME/.config"
[ -z "$DOTFILES_PATH" ] && export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles"
@ -17,4 +17,4 @@ export SSH_AUTH_SOCK
xset r rate 250 80 & # keyrepeat
. maybe_source_env_file x/profile
source maybe_source_env_file x/profile

View file

@ -5,11 +5,12 @@ if is_wayland; then
else
pkill unclutter
sleep 0.1
import ~/.ss.png
chmod 700 ~/.ss.png
< ~/.ss.png xclip -t image/png -i -selection clipboard
< ~/.ss.png xclip -t image/png -i -selection primary
< ~/.ss.png xclip -t image/png -i -selection secondary
< ~/.ss.png xclip -t image/png -i -selection buffer-cut
fn="$SCROTS_PATH/clipshot_$(date +"%Y-%m-%d_%H-%M-%S").png"
import "$fn"
chmod 700 "$fn"
< "$fn" xclip -t image/png -i -selection clipboard
< "$fn" xclip -t image/png -i -selection primary
< "$fn" xclip -t image/png -i -selection secondary
< "$fn" xclip -t image/png -i -selection buffer-cut
unclutter &
fi

View file

@ -1,3 +1,7 @@
#!/usr/bin/env bash
f="$1"; shift; . source_if_exists "$ENV_PATH/$f" "$@"
set -xe
f="$1"; shift
[ -f "$f" ] && source "$f" "$@"
true

View file

@ -2,5 +2,5 @@
SCROT_DIR="$NICE_HOME/img/scrots"
mkdir -p "$SCROT_DIR/"
FILENAME="$SCROT_DIR/%Y-%m-%d_%H-%M-%S_\$wx\$h.png"
FILENAME="$SCROT_DIR/screenshot_%Y-%m-%d_%H-%M-%S_\$wx\$h.png"
scrot "$@" "${FILENAME}" >/dev/null && echo "Saved screenshot to: ${FILENAME}"

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
[ "$#" -lt 1 ] && { echo "No arguments provided" >&2 ; exit 1; }
[ "$#" -gt 1 ] && { echo "Too many arguments provided" >&2 ; exit 2; }
# shellcheck disable=SC1090
{ [ -f "$1" ] && . "$1"; } || { echo "$1 does not exist" >&2 ; exit 3; }
f="$1"; shift
{ [ -f "$f" ] && source "$f" "$@"; } || { echo "$f does not exist" >&2 ; exit 3; }