Initial commit
This commit is contained in:
		
						commit
						354bcbb8a2
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
*.jpg
 | 
			
		||||
*.png
 | 
			
		||||
							
								
								
									
										2
									
								
								README.MD
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								README.MD
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
			
		||||
# Konachan Wallpaper for Gnome 3
 | 
			
		||||
This script periodically updates the wallpaper of a gnome 3 installation to a new picture from Konachan.
 | 
			
		||||
							
								
								
									
										23
									
								
								updateWallpaper.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								updateWallpaper.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,23 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
tag="scenic"
 | 
			
		||||
picdir=`realpath $(dirname "${BASH_SOURCE[0]}")`
 | 
			
		||||
 | 
			
		||||
while [ 0 ]; do
 | 
			
		||||
	json=`curl "http://konachan.com/post.json?tags=$tag%20order:random%20width:1600&limit=1"`
 | 
			
		||||
 | 
			
		||||
	id=`echo $json | jq -r '.[0].id'`
 | 
			
		||||
	url=`echo $json | jq -r '.[0].file_url'`
 | 
			
		||||
	ext=`echo $url | sed "s/.*\.//g"`
 | 
			
		||||
 | 
			
		||||
	local_url="$picdir/$id.$ext"
 | 
			
		||||
 | 
			
		||||
	if [ -f "$local_url" ]; then
 | 
			
		||||
		echo "Already set as wallpaper. Waiting for new one..."
 | 
			
		||||
	else
 | 
			
		||||
		echo "Updating wallpaper!"
 | 
			
		||||
		curl -o "$local_url" "$url"
 | 
			
		||||
	fi
 | 
			
		||||
	gsettings set org.gnome.desktop.background picture-uri "$local_url"
 | 
			
		||||
 | 
			
		||||
	sleep 1h
 | 
			
		||||
done
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user