Skip to content

Commit

Permalink
improve image conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
mifjpn committed Dec 29, 2022
1 parent 5d5a14a commit c1955fd
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 18 deletions.
Binary file modified scripts.tar.xz
Binary file not shown.
45 changes: 40 additions & 5 deletions scripts/set-plymouth
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MoePlymouthURL="https://github.com/mifjpn/Moebuntu-kawaiiUbuntu-ToysOriginal/raw
MoePlymouthFileName=`echo $MoePlymouthURL|awk -F"/" '{print $NF}'`
MoePlymouthDirName="mmspinner"
MoePlymouthBackGroundFile="/usr/share/plymouth/themes/mmspinner/background-tile.png"
MoePlymouthBackGroungFileName=`echo $MoePlymouthBackGroundFile|awk -F"/" '{print $NF}'`
PlymothThemePath="/usr/share/plymouth/themes"
MoeAlternativesPath="/usr/share/plymouth/themes/mmspinner/mmspinner.plymouth"
DetaultAlternativesPath="/usr/share/plymouth/themes/bgrt/bgrt.plymouth"
Expand Down Expand Up @@ -67,6 +68,15 @@ if [ ! $? -eq 0 ]; then
echo " already Installed"
fi

# Install imagemagick-2212291856
echo " Install imagemagick"
dpkg -s imagemagick >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
sudo apt install -y imagemagick
else
echo " Already Installed"
fi

# Download Plymouth
echo " download $MoePlymouthFileName "
curl -L $MoePlymouthURL --output "$TempDir/$MoePlymouthFileName"
Expand All @@ -90,8 +100,9 @@ echo " exist Moe Plymouth: `ls -d "$PlymothThemePath/$MoePlymouthDirName"`"
sudo update-alternatives --set default.plymouth "$MoeAlternativesPath" >/dev/null 2>/dev/null

# Change login screen
echo " Set Moebuntu basic plymouse screen image (Y)"
echo -n "Or Set Original(or Example) plymouth png-file(N)?:"
echo " Set Moebuntu basic plymouth screen image (Y)"
# fix word for update 2212291928
echo -n "Or Set Original(or Example) plymouth screen image(N)?:"
if askyn; then
# Moebuntu basic Change screen then not copy
# Remove tempdir
Expand All @@ -107,7 +118,7 @@ if askyn; then
exit 0
fi
# Choose Change Screen
read -p "Please drag-and-drop plymouth png-file or push to set return(Example):" FileDrop
read -p "Please drag-and-drop plymouth (png etc.)image file or push only return to set Example image:" FileDrop
if [ "$FileDrop" = "" ]; then
# Null return
# Set to default
Expand Down Expand Up @@ -152,8 +163,32 @@ if [ "$FileDrop" = "" ]; then
echo ""  
exit 0
fi
echo " set Plymouth tile picture to $PlymouthFile"
sudo cp $PlymouthFile $MoePlymouthBackGroundFile
# file conversion-2212291856
FileName=`echo $PlymouthFile|awk -F"/" '{print $NF}'`
FileExtension=`echo ${FileName##*.}`
echo "FileExtension is $FileExtension"
if [ $FileExtension = "png" ] || [ $FileExtension = "PNG" ]; then
echo " set Plymouth tile picture to $PlymouthFile"
sudo cp $PlymouthFile $MoePlymouthBackGroundFile
echo ""
else
echo " Convert $PlymouthFile to $TempDir/$MoePlymouthBackGroungFileName"
ReturnValue=`convert $PlymouthFile $TempDir/$MoePlymouthBackGroungFileName`
if [ "$ReturnValue" != "" ]; then
echo "Can't convert to PNG-image"
echo "Can not change Plymouth picture"
# remove temp-dir
rm -rf $TempDir
echo ""
echo -n "Hit Any Key:"
read -r -n 1 -s answer
echo ""  
exit 0
fi
sudo cp $TempDir/$MoePlymouthBackGroungFileName $MoePlymouthBackGroundFile
echo "Done"
echo ""
fi
fi
# remove temp-dir
rm -rf $TempDir
Expand Down
44 changes: 39 additions & 5 deletions scripts/set-theme
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ if [ ! $? -eq 0 ]; then
echo " Already Installed"
fi

# Install imagemagick-2212291856
echo " Install imagemagick"
dpkg -s imagemagick >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
sudo apt install -y imagemagick
else
echo " Already Installed"
fi

# Download Theme
echo " download $ThemeFileName"
curl -L $ThemeUrl --output "$TempDir/$ThemeFileName"
Expand Down Expand Up @@ -102,9 +111,10 @@ if askyn; then

# login png-file
echo "Set Moebuntu basic login picture(Y)"
echo -n " Or Original(or Example) login png-picture(N)?:"
# sentence modified at 2212291859
echo -n " Or Original(or Example) login image(N)?:"
if ! askyn; then
read -p "Please drag-and-drop login png-file or push to set return(Example):" FileDrop
read -p "Please drag-and-drop login png(or other)image-file or push to only return to set Example image:" FileDrop
if [ "$FileDrop" = "" ]; then
# set default login picture
# download default login picture
Expand Down Expand Up @@ -144,9 +154,33 @@ if askyn; then
echo ""  
exit 0
fi
sudo cp $LoginFile /usr/share/themes/$ThemeDirName/gnome-shell/moebuntu_bg.png
echo "Done"
echo ""
# file conversion-2212291856
FileName=`echo $LoginFile|awk -F"/" '{print $NF}'`
FileExtension=`echo ${FileName##*.}`
echo "FileExtension is $FileExtension"
if [ $FileExtension = "png" ] || [ $FileExtension = "PNG" ]; then
sudo cp $LoginFile /usr/share/themes/$ThemeDirName/gnome-shell/moebuntu_bg.png
echo "Done"
echo ""
else
echo " Convert $LoginFile to $TempDir/moebuntu_bg.png"
ReturnValue=`convert $LoginFile $TempDir/moebuntu_bg.png`
# echo " ReturnValue is $ReturnValue"
if [ "$ReturnValue" != "" ]; then
echo "Can't convert to PNG-image"
echo "Can not change login picture"
# remove temp-dir
rm -rf $TempDir
echo ""
echo -n "Hit Any Key:"
read -r -n 1 -s answer
echo ""  
exit 0
fi
sudo cp $TempDir/moebuntu_bg.png /usr/share/themes/$ThemeDirName/gnome-shell/moebuntu_bg.png
echo "Done"
echo ""
fi
fi
else
echo "=set login to Moe-ized="
Expand Down
57 changes: 49 additions & 8 deletions scripts/wallmanager
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ InstallCurl() {
fi
echo ""
}

# Install imagemagick-2212291856
InstallImagemagick() {
echo " Install imagemagick"
dpkg -s imagemagick >/dev/null 2>&1
if [ ! $? -eq 0 ]; then
sudo apt install -y imagemagick
else
echo " Already Installed"
fi
}

#Ask Yn
askyn() {
echo -n "(Y/N)? "
Expand All @@ -48,8 +60,9 @@ if [ "$1" = "install" ]; then
# install
echo "=Install Desktop Wallpaper="
InstallCurl;
InstallImagemagick;
# Ask filename of wallpaper
read -p "Please drag-and-drop wall jpg or png image file or push to set return(Example):" FileDrop
read -p "Please drag-and-drop wall (png etc) image file or push only return to set example image:" FileDrop
if [ "$FileDrop" = "" ]; then
# set default login picture
# download default login picture
Expand Down Expand Up @@ -107,15 +120,36 @@ if [ "$1" = "install" ]; then
ConstMoeWallFileName=$ConstWallFileNamePng
else
echo "extention is not jpg or png."
echo "please drag and drop jpg or png image file."
echo "can not change desktop wallpaper"
# remove temp-dir
echo " convert to png file"
# convert to png
ConstMoeWallFileName=$ConstWallFileNamePng
echo "FileExtension is $FileExtension"
echo " Convert $WallFileFullPath to $TempDir/$ConstMoeWallFileName"
ReturnValue=`convert $WallFileFullPath $TempDir/$ConstMoeWallFileName`
if [ "$ReturnValue" != "" ]; then
echo "Can't convert to PNG-image"
echo "Can not change wallpaper picture"
# remove temp-dir
rm -rf $TempDir
echo ""
echo -n "Hit Any Key:"
read -r -n 1 -s answer
echo ""  
exit 0
fi
sudo cp "$TempDir/$ConstMoeWallFileName" "$SYSWallDir/$ConstMoeWallFileName"
echo "Done"
echo " setting $TempDir/$ConstMoeWallFileName to $SYSWallDir/$ConstMoeWallFileName"
gsettings set org.gnome.desktop.background picture-uri "file://$SYSWallDir/$ConstMoeWallFileName"
gsettings set org.gnome.desktop.background picture-uri-dark "file://$SYSWallDir/$ConstMoeWallFileName"
echo "Done"
echo " remove temp folder $TempDir"
rm -rf $TempDir
echo ""
echo -n "Hit Any Key:"
read -r -n 1 -s answer
echo ""  
exit 0
echo ""
exit 0
fi
echo " copy $WallFileFullPath to $SYSWallDir"
sudo cp "$WallFileFullPath" "$SYSWallDir/$ConstMoeWallFileName"
Expand All @@ -124,14 +158,21 @@ if [ "$1" = "install" ]; then
gsettings set org.gnome.desktop.background picture-uri-dark "file://$SYSWallDir/$ConstMoeWallFileName"
echo "Done"
echo " remove temp folder $TempDir"
# remove temp-dir
rm -rf $TempDir
echo ""
echo -n "Hit Any Key:"
read -r -n 1 -s answer
echo ""
echo ""  
exit 0
fi
# remove
rm -rf $TempDir
echo ""
echo -n "Hit Any Key:"
read -r -n 1 -s answer
echo ""
exit 0
# remove
elif [ "$1" = "remove" ]; then
echo "=Remove Moe desktop wallpaper ${MoeWallFileName%.*} and set detault="
echo " seting to $DefaultWallFileName"
Expand Down

0 comments on commit c1955fd

Please sign in to comment.