dotfiles/private_dot_config/sway/executable_colors.sh
array-in-a-matrix 1f64c84768 updated
2023-02-21 13:20:45 -05:00

41 lines
802 B
Bash

#!/bin/sh
# if no commandline argument is given, get location of a random image
if [[ -z $1 ]]; then
IMAGE=$(find -L $HOME/Pictures/Wallpapers/ -type f | shuf -n1)
else
IMAGE="$1"
fi
# generate color scheme of that image
wal -i "$IMAGE"
# make shell and tty that color
cat ~/.cache/wal/sequences
source ~/.cache/wal/colors-tty.sh
# update firefox's colors
pywalfox update
# update qt5
export QT_QPA_PLATFORMTHEME=qt5ct
# update background with new image if swaybg is being used
if [[ -n $(pgrep swaybg) ]]; then
killall swaybg
fi
if [[ $XDG_SESSION_DESKTOP == "sway" ]]; then
swaybg -i "$IMAGE" -m fill &
fi
if [[-n $(pgrep swaync) ]]; then
killall swaync
fi
swaync
# update peripherals
eruptionctl color-schemes import pywal
# print image used to stdout
chafa "$IMAGE"