This repository has been archived by the owner on Mar 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
updWallp.sh
executable file
·92 lines (75 loc) · 2.51 KB
/
updWallp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
#
# Name: updWallp.sh
# Function: Script to pick a random image from a folder, generate a dimmed & blured version of it and set it as wallpaper
# Usage:
# help: ./updWallp.sh -h
# version: ./updWallp.sh -v
# core function: ./updWallp.sh
#
# Github: https://github.com/yafp/updWallp
#
# ---------------------------------------------------------------------
# LOCAL CONFIG - no need to touch
# ---------------------------------------------------------------------
#set -o nounset # outputs warning if unset variables are detected
# #####################################################################
# SCRIPT-LOGIC
# #####################################################################
clear
projectPath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -f $projectPath/config.sh ]; then # found config file
source $projectPath/config.sh # load config file
cd $projectPath # change to project folder
source inc/loader.sh # source loader.sh (all other inc files are sources in loader.sh)
startUp
if [ "$#" -lt "1" ]; then # if max 1 parameter was commited to the script - it might be a valid input
case "$primaryParameter" in
"-h" | "--help")
displayAppHelp
;;
"-v" | "--version")
displayAppVersion
;;
"")
checkOperatingSystem # check operating system
checkRequirements # function to check for all required packages
# if configured to local mode
#if [ "$operationMode" = "1" ]; then
# getNewRandomLocalFilePath
#fi
# if configured to remote mode
#if [ "$operationMode" = "2" ]; then
# getRemoteMuzeiImage
#fi
case "$operationMode" in
[1])
getNewRandomLocalFilePath
;;
[2])
getRemoteMuzeiImage
;;
*)
printf "$error06"
exit 6
esac
generateNewWallpaper # generates a new wallpaper
if [ "$setWallpaperMode" = "1" ]; then
setLinuxWallpaper "$outputFilename" # set the linux wallpaper
then
cleanupUpdWallpDir # Cleaning up
exit 0 # exit with success-message
;;
*)
printf "$error03"
exit 3
;;
esac
else # > 1 parameter
printf "$error02"
exit 2
fi
else # unable to load config.sh
printf "ERROR\tUnable to load 'config.sh'. Exiting (errno 1)\n"
exit 1
fi