rand wallpaper
This commit is contained in:
parent
a0fa13432d
commit
a2b4bc9901
@ -1,11 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) Daniel Napora 2021-22 <napcok@gmail.com>
|
||||
# Dependencies: jgmenu, xdotool, xcolor, gcolor3, xdg-utils, xclip, notify-send
|
||||
# TODO Imagick colors - separate menu big around 700 named colors
|
||||
# Dependencies: jgmenu, xdotool, xcolor, gcolor3, gpick, pastel, xdg-utils, xclip, notify-send
|
||||
# TODO export to .gpl (GIMP,Inkscape)
|
||||
# TODO PL translation
|
||||
|
||||
VERSION="0.9.0"
|
||||
VERSION="0.9.1"
|
||||
TEMP_DIR=/tmp/colormenu
|
||||
ME=${0##*/}
|
||||
|
||||
@ -30,12 +28,16 @@ htmlcolors=yes
|
||||
picker=gpick
|
||||
#Show built in palettes? (slow)
|
||||
builtin_palettes=yes
|
||||
# Random wallpaper dir
|
||||
walldir=/usr/share/backgrounds
|
||||
#Position on screen: topleft, top, topright, left, center, right, bottomleft, bottom, bottomright
|
||||
position=left
|
||||
EOF
|
||||
fi
|
||||
source <(grep = $CNF_FILE)
|
||||
|
||||
RANDWALLDIR=${walldir:-/usr/share/backgrounds}
|
||||
|
||||
if [ ! -f $RECENT ]; then
|
||||
cat <<EOF > ${RECENT}
|
||||
#FFFFFF White
|
||||
@ -210,6 +212,7 @@ case $LANG in
|
||||
CLEAR_RECPICKED="<b>Usuń</b> ostatnio dodane"
|
||||
REMOVEONE="Usuń tylko jeden kolor..."
|
||||
WALLCOLORS="Kolory z tapety"
|
||||
RANDWALL="Ustaw <b>losową tapetę</b>"
|
||||
IMAGICKCOLORS="Kolory <b>Image Magick</b>"
|
||||
HTMLCOLORS="Kolory <b>HTML</b>"
|
||||
PALETTE="Paleta:"
|
||||
@ -235,6 +238,7 @@ case $LANG in
|
||||
CLEAR_RECPICKED="<b>Clear</b> recently picked"
|
||||
REMOVEONE="Just remove one color..."
|
||||
WALLCOLORS="Wallpaper colors"
|
||||
RANDWALL="Set <b>random wallpaper</b>"
|
||||
IMAGICKCOLORS="<b>Image Magick</b> Colors"
|
||||
HTMLCOLORS="<b>HTML</b> colors"
|
||||
PALETTE="Palette:"
|
||||
@ -262,7 +266,6 @@ mkconfigfile
|
||||
|
||||
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
|
||||
out+=("^sep($COLORMENU <sup><span font_weight='light'> [$action $format]</span></sup>)")
|
||||
#out+=("^sep(<span bgcolor='#800000'> </span><span fgcolor='#800000' bgcolor='#FABD2F'> mbx </span><span fgcolor='#FABD2F' bgcolor='#800000'> colors </span><span bgcolor='#FABD2F'> </span> <sup><span font_weight='light'>[$action $format]</span></sup>)")
|
||||
out+=("$PICK_FROM_SCREEN,$ME pickcolor")
|
||||
if hash gcolor3 2>/dev/null; then
|
||||
out+=("^sep()")
|
||||
@ -317,13 +320,15 @@ case "$expose" in
|
||||
read WALLPATH<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg" | cut -d'=' -f2)
|
||||
WALLPAPER=${WALLPATH##*/}
|
||||
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then
|
||||
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print $3}' > "$WALLPALDIR/$WALLPAPER.clr"
|
||||
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print $3}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$WALLPAPER.clr"
|
||||
fi
|
||||
#mapfile -t wallcolors < "$WALLPALDIR/$WALLPAPER.clr"
|
||||
out+=("^sep($WALLCOLORS)")
|
||||
while read -r color name;do
|
||||
out+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt> ,$ME getcolorcode '$color'")
|
||||
done < "$WALLPALDIR/$WALLPAPER.clr"
|
||||
out+=("^sep()")
|
||||
out+=("$RANDWALL,nitrogen --random ${RANDWALLDIR} --set-scaled --save;$ME")
|
||||
;;
|
||||
*)
|
||||
if [ -f "$DATA_DIR/palettes/$expose" ];then
|
||||
@ -354,6 +359,7 @@ out+=("$BUILTIN_PAL,^checkout(builtpalettes)")
|
||||
palettes
|
||||
fi
|
||||
# WALLPAPER COLORS
|
||||
if [ "$expose" != "wallpaper" ];then
|
||||
out+=("$WALLCOLORS,^checkout(wallcolors)")
|
||||
read WALLPAPER<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2")
|
||||
WALLPALDIR="$HOME/.config/mbxcolors/palettes/wallp"
|
||||
@ -361,7 +367,7 @@ mkdir -p "$WALLPALDIR"
|
||||
read WALLPATH<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg" | cut -d'=' -f2)
|
||||
WALLPAPER=${WALLPATH##*/}
|
||||
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then
|
||||
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print $3}' > "$WALLPALDIR/$WALLPAPER.clr"
|
||||
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print $3}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$WALLPAPER.clr"
|
||||
fi
|
||||
#mapfile -t wallcolors < "$WALLPALDIR/$WALLPAPER.clr"
|
||||
out2+=("^tag(wallcolors)")
|
||||
@ -371,6 +377,10 @@ out2+=("^sep()")
|
||||
while read -r color name;do
|
||||
out2+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt> ,$ME getcolorcode '$color'")
|
||||
done < "$WALLPALDIR/$WALLPAPER.clr"
|
||||
out2+=("^sep()")
|
||||
out2+=("$RANDWALL,nitrogen --random ${RANDWALLDIR} --set-scaled --save;$ME")
|
||||
fi
|
||||
|
||||
out1+=("$IMAGICKCOLORS,mbxcolors imagick")
|
||||
out1+=("^sep($SETTINGS)")
|
||||
out1+=("$PREFERENCES,^pipe($ME preferences)")
|
||||
|
Loading…
Reference in New Issue
Block a user