Push code
@@ -1,2 +1,6 @@
|
|||||||
# Sway-Wallpaper
|
# Sway-Wallpaper
|
||||||
Random wallpapers with neofetch, for sway
|
Random wallpapers with neofetch, for sway
|
||||||
|
|
||||||
|
Icons are from https://github.com/dharmx/walls
|
||||||
|
|
||||||
|
This is meant to be for my sway configuration
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
import subprocess
|
||||||
|
import datetime
|
||||||
|
import os
|
||||||
|
import random
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
from PIL import ImageFilter
|
||||||
|
from PIL import ImageFont
|
||||||
|
from PIL import ImageDraw
|
||||||
|
import PIL.ImageOps
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.ulink("/tmp/wallpaper.png")
|
||||||
|
except:
|
||||||
|
x = None # Do nothing
|
||||||
|
|
||||||
|
#file = open("/home/astatin3/.config/sway/icon.txt","r")
|
||||||
|
#lines = file.readlines()
|
||||||
|
#file.close()
|
||||||
|
|
||||||
|
output = (subprocess.run(['neofetch', '--stdout'], capture_output=True, text=True).stdout).split("\n")
|
||||||
|
|
||||||
|
screenX = 0
|
||||||
|
screenY = 0
|
||||||
|
|
||||||
|
def getSubfolders(path):
|
||||||
|
try:
|
||||||
|
return os.listdir(path)
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def getRandWallpaper():
|
||||||
|
wallpapers = getSubfolders("/home/astatin3/.config/sway/wallpapers/")
|
||||||
|
return "/home/astatin3/.config/sway/wallpapers/" + random.choice(wallpapers)
|
||||||
|
|
||||||
|
for i in range(0, len(output)-2, 1):
|
||||||
|
#lines[i] = lines[i][:-1] + output[i]
|
||||||
|
|
||||||
|
#print(lines[i])
|
||||||
|
|
||||||
|
if i == 0:
|
||||||
|
output[0] += f"at ({datetime.datetime.now().strftime('%m-%d %H:%M:%S')})"
|
||||||
|
|
||||||
|
if i == 8:
|
||||||
|
res = output[i].split(" ")[1].split("x")
|
||||||
|
screenX = int(res[0])
|
||||||
|
screenY = int(res[1])
|
||||||
|
|
||||||
|
#neofetch = "\n".join(lines)
|
||||||
|
|
||||||
|
icon = Image.open("/home/astatin3/.config/sway/icon.png").convert("RGBA")
|
||||||
|
|
||||||
|
iconsizeX, iconsizeY = icon.size
|
||||||
|
|
||||||
|
neofetch = "\n".join(output)
|
||||||
|
|
||||||
|
textSize = 0.01
|
||||||
|
|
||||||
|
iconscale = 0.0005
|
||||||
|
|
||||||
|
textoffsetX = 0.0 #Percentages
|
||||||
|
textoffsetY = -0.16
|
||||||
|
|
||||||
|
iconoffsetX = -0.145
|
||||||
|
iconoffsetY = -0.16
|
||||||
|
|
||||||
|
color = (199,0,57)
|
||||||
|
# color = (255, 255, 255)
|
||||||
|
|
||||||
|
# img = Image.new('RGB', (screenX, screenY), (31, 26, 32))
|
||||||
|
img = Image.open(getRandWallpaper()).resize((screenX, screenY)).convert("RGB")
|
||||||
|
|
||||||
|
solidColorImage = Image.new('RGBA', (screenX, screenY),color)
|
||||||
|
blackImage = Image.new('RGBA', (screenX, screenY),(0,0,0,255))
|
||||||
|
invertImg = PIL.ImageOps.invert(img).convert('LA').filter(ImageFilter.BoxBlur(2))
|
||||||
|
# invertImg = invertImg.filter(ImageFilter.FIND_EDGES)
|
||||||
|
|
||||||
|
mask = Image.new('RGBA', (screenX, screenY),(0, 0, 0, 0))
|
||||||
|
draw = ImageDraw.Draw(mask)
|
||||||
|
font = ImageFont.truetype("/home/astatin3/.config/sway/UbuntuMonoNerdFontMono-Regular.ttf", textSize*screenX)
|
||||||
|
|
||||||
|
draw.text((textoffsetX*screenX+screenX/2, textoffsetY*screenY+screenY/2),neofetch,color,font=font)
|
||||||
|
|
||||||
|
icon = icon.resize((round(iconscale*iconsizeX*screenY), round(iconscale*iconsizeY*screenY)), Image.Resampling.LANCZOS)
|
||||||
|
mask.paste(icon, (round(iconoffsetX*screenX+screenX/2), round(iconoffsetY*screenY+screenY/2)), icon)
|
||||||
|
|
||||||
|
# Outline
|
||||||
|
mask2 = Image.new('RGBA', (screenX, screenY),(0, 0, 0, 0))
|
||||||
|
|
||||||
|
d = 1
|
||||||
|
|
||||||
|
mask2.paste(mask, (d, d), mask)
|
||||||
|
mask2.paste(mask, (d, -d), mask)
|
||||||
|
mask2.paste(mask, (-d, d), mask)
|
||||||
|
mask2.paste(mask, (-d, -d), mask)
|
||||||
|
|
||||||
|
mask2.paste(mask, (d, 0), mask)
|
||||||
|
mask2.paste(mask, (-d, 0), mask)
|
||||||
|
mask2.paste(mask, (0, d), mask)
|
||||||
|
mask2.paste(mask, (0, -d), mask)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
wallpaper = Image.composite(invertImg, img, mask2)
|
||||||
|
wallpaper = Image.composite(img, wallpaper, mask)
|
||||||
|
wallpaper.save("/tmp/wallpaper.png")
|
||||||
|
|
||||||
|
# img.save("/tmp/wallpaper.png")
|
||||||
|
#img.show()
|
||||||
|
|
||||||
|
subprocess.run(["swaybg", "-m", "fill", "-i", "/tmp/wallpaper.png"])
|
||||||
|
After Width: | Height: | Size: 42 MiB |
|
After Width: | Height: | Size: 464 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 290 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 218 KiB |
|
After Width: | Height: | Size: 280 KiB |
|
After Width: | Height: | Size: 266 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 6.7 MiB |
|
After Width: | Height: | Size: 163 KiB |
|
After Width: | Height: | Size: 206 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 314 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 9.7 MiB |
|
After Width: | Height: | Size: 426 KiB |
|
After Width: | Height: | Size: 3.5 MiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 340 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 540 KiB |
|
After Width: | Height: | Size: 305 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 384 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 482 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 1023 KiB |
|
After Width: | Height: | Size: 616 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 4.6 MiB |
|
After Width: | Height: | Size: 342 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 249 KiB |
|
After Width: | Height: | Size: 171 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 299 KiB |
|
After Width: | Height: | Size: 961 KiB |
|
After Width: | Height: | Size: 170 KiB |
|
After Width: | Height: | Size: 9.0 MiB |
|
After Width: | Height: | Size: 8.6 MiB |
|
After Width: | Height: | Size: 358 KiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 781 KiB |
|
After Width: | Height: | Size: 998 KiB |
|
After Width: | Height: | Size: 327 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 4.5 MiB |
|
After Width: | Height: | Size: 454 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 3.3 MiB |
|
After Width: | Height: | Size: 309 KiB |
|
After Width: | Height: | Size: 5.6 MiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 999 KiB |
|
After Width: | Height: | Size: 12 MiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 349 KiB |
|
After Width: | Height: | Size: 204 KiB |
|
After Width: | Height: | Size: 5.9 MiB |
|
After Width: | Height: | Size: 171 KiB |
|
After Width: | Height: | Size: 229 KiB |
|
After Width: | Height: | Size: 282 KiB |
|
After Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 536 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 848 KiB |
|
After Width: | Height: | Size: 4.5 MiB |
|
After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 11 MiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 12 MiB |
|
After Width: | Height: | Size: 717 KiB |
|
After Width: | Height: | Size: 337 KiB |
|
After Width: | Height: | Size: 399 KiB |
|
After Width: | Height: | Size: 694 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 949 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 500 KiB |