changeset 10:ed9556d0c5d7

bing4desktop-0.240205-4
author prymula <prymula76@outlook.com>
date Tue, 06 Feb 2024 00:30:36 +0100
parents b2ef499536b0
children c01d7edb9cb9
files bing4desktop/Changelog.txt bing4desktop/DEBIAN/HOWTO.txt bing4desktop/DEBIAN/debian.changelog bing4desktop/DEBIAN/debian.control bing4desktop/DEBIAN/debian.postinst bing4desktop/DEBIAN/debian.postrm bing4desktop/DEBIAN/debian.rules bing4desktop/DEBIAN/format.sh bing4desktop/DEBIAN/verysimpleslideshow.dsc bing4desktop/Makefile bing4desktop/PKG/PKGBUILD bing4desktop/RPM/bing4desktop.spec bing4desktop/bing.ico bing4desktop/bing.png bing4desktop/bing4desktop.desktop bing4desktop/bing4desktop.py bing4desktop/desktop.py
diffstat 17 files changed, 501 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/Changelog.txt	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,4 @@
+0.240205-4 - Przetwarzanie zdjęć w katalogu tymczasowym, buildy dla Arch, Fedory i Thumbleweed
+0.240205-3 - Wyświetla zdjęcia (jednak w osobnych oknach), oraz ustawia je jako tapetę, pisze informacje o zdjęciu
+0.240205-2 - Niszczenie frame i odtworzenie, jednak bez zadowalajacych efektów
+0.240205-0 - Inicjacja projektu
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/DEBIAN/HOWTO.txt	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,2 @@
+foramt zapisu nazwy pliku:
+	photocrop_0.221225-0~alpha.tar.gz
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/DEBIAN/debian.changelog	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,18 @@
+verysimpleslideshow (0.230909-1) unstable; urgency=low
+
+  * Last release
+
+ -- Przemysław R. Pietraszczyk  Thu, 09 Sep 2023 22:47:00 +0200
+
+
+verysimpleslideshow (0.230907-0) unstable; urgency=low
+
+  * Last release
+
+ -- Przemysław R. Pietraszczyk  Thu, 07 Sep 2023 19:30:00 +0200
+
+verysimpleslideshow (0.230903-3) unstable; urgency=low
+
+  * Last release
+
+ -- Przemysław R. Pietraszczyk  Sun, 03 Sep 2023 21:21:21 +0200
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/DEBIAN/debian.control	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,13 @@
+Source: verysimpleslideshow
+Section: python
+Priority: extra
+Maintainer: Przemysław R. Pietraszczyk
+Build-Depends: debhelper-compat (= 12), python3-all, dh-python, python3-pil, fakeroot
+Standards-Version: 3.9.6
+Homepage: http://prymula.ct8.pl
+
+
+Package: verysimpleslideshow
+Architecture: all
+Depends: ${misc:Depends}, python3-all, python3-pil, ffmpeg
+Description: CLI script for creating slideshows 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/DEBIAN/debian.postinst	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+
+chmod 0755 /usr/bin/verysimpleslideshow.py
+ln -s /usr/bin/verysimpleslideshow.py /usr/bin/vsss
+
+exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/DEBIAN/debian.postrm	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+  0) # last one out put out the lights
+    rm -f /usr/bin/vsss
+  ;;
+esac
+
+exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/DEBIAN/debian.rules	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,23 @@
+#!/usr/bin/make -f
+
+export DH_VERBOSE = 1
+
+clean:
+	@
+	
+build:
+	@
+
+install:
+	@
+
+binary:
+	mkdir -pm 0755 debian/verysimpleslideshow
+	mkdir -pm 0755 debian/verysimpleslideshow/usr/bin
+	mkdir -pm 0755 debian/verysimpleslideshow/usr/share
+	mkdir -pm 0755 debian/verysimpleslideshow/usr/share/verysimpleslideshow
+	cp verysimpleslideshow.py debian/verysimpleslideshow/usr/bin/
+	cp CzytajTo debian/verysimpleslideshow/usr/share/verysimpleslideshow/
+	#chmod 0755 /usr/bin/verysimpleslideshow.py
+	dh_gencontrol
+	dh_builddeb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/DEBIAN/format.sh	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,2 @@
+mkdir exec
+exec /usr/lib/build/debtransform ./ ./verysimpleslideshow.dsc ./exec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/DEBIAN/verysimpleslideshow.dsc	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,40 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+Format: 1.0
+Source: verysimpleslideshow
+Binary: verysimpleslideshow
+Architecture: all
+Version: 0.230913-0
+Maintainer: Przemysław R. Pietraszczyk <prymula76@outlook.com>
+Homepage: http://prymula.ct8.pl
+DEBTRANSFORM-TAR: verysimpleslideshow-0.230913-0.tar.gz
+ 
+Standards-Version: 0.230913-0
+Build-Depends: debhelper-compat (>= 12), python3-all, dh-python, python3-pil, fakeroot
+Package-List:
+ verysimpleslideshow deb x11 optional arch=all
+Files:
+ b31649bc23b2b7bca9ab70ea3410711a 128820 verysimpleslideshow_0.230913-0.tar.gz
+ 29e7e7e60bc81891e3da3871b9eeb549 764 verysimpleslideshow-0.230913-0.debian.tar.xz
+
+-----BEGIN PGP SIGNATURE-----
+
+mQENBGEf/c4BCAC2d4ymW0pRZV36qLtlt/WGb83kos5UX5UbwvkQrbUjAbOPOY8w
+DT3M1neYOAPZx38924aPTFKbZPcz+rK/7Wcv1kzgfux5zXQJTLeqpkhUYAgXUg2p
+oK9ZXsai82fOicTrClOyJLLYQ8C1vj8yUh7e3ERljEyp5Nxg/lY92rwcZ4WYR193
+nGDInlDl5JlWUcLlk/RFnC5bB+T6ZZr5FBX/eDnKAPEl+N3MWpDs2JLDy7EUPhcG
+U/60X0wuXHPTwMoNbB3ep/bWRxwEej0sFad5GXeCh7hKCroi/kLmLTDIxSD8lsRr
+Y4H/8H2lBBsQq7bRL88N6ZDGCocPo11V83kFABEBAAG0NmhvbWU6cHJ6ZW0gT0JT
+IFByb2plY3QgPGhvbWU6cHJ6ZW1AYnVpbGQub3BlbnN1c2Uub3JnPokBPgQTAQgA
+KAUCYR/9zgIbAwUJBB6wAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQcXEc
+NPcNefFEAAf+Kg4cs/C99kEIMv/PO85VW+p8rcTwCViOFUX5WrBhwsRyPAKrJPPG
+KD6PdnvoplcNQwhQ8nRsRiiaiUtPcj8Bvi6EdPgSgXXObKKJtCyaAa1rURdlb9iW
+CfvXA6oW+PGlii9BMnXOAtkeFIzZooO9oXd+wez66P+4VWFiFzxanLfLn/hwbWxQ
+68rlO3QNGbrMeODBgwh9s83XGmAg47mn2fldTAmTbJDf9tMi1LhX2MmLyN9wjqsd
+4IZ9JMri2JTnIhYfxWdKT9gsu7q0g8LqonaXMvlOEyHFRF1YQ0i7G6fFbvDcKCZN
+W1Eja55FdN7smv5Eck6UTIIYyWPuAv45uohGBBMRAgAGBQJhH/3PAAoJEDswEbdr
+nWUj4M0AniJ389dyvUjjgS91AcOb08E4moV9AJ9WDL3/7GYYUL/Azw43QucWPnXr
+uw==
+=+lfH
+-----END PGP SIGNATURE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/Makefile	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,10 @@
+prefix=/usr
+
+install: bing4desktop.py
+	mkdir -pm 0755 $(DESTDIR)$(prefix)/bin
+	mkdir -pm 0755 $(DESTDIR)$(prefix)/share/bing4desktop
+	mkdir -pm 0755 $(DESTDIR)/etc/xdg/autostart
+	install -m 0755 bing4desktop.py $(DESTDIR)$(prefix)/bin
+	install -m 0644 bing.ico $(DESTDIR)$(prefix)/share/bing4desktop
+	install -m 0755 bing4desktop.desktop $(DESTDIR)/etc/xdg/autostart
+.PHONY: install
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/PKG/PKGBUILD	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,26 @@
+# Maintainer: Przemyslaw R. Pietraszczyk <prymula76@outlook.com>
+
+pkgname=verysimpleslideshow
+pkgver=0.240205
+pkgrel=4
+pkgdesc="Beautify your desktop with photos from Bing search engine"
+arch=('any')
+url="prymula.ct8.pl"
+license=('Public Domain')
+groups=()
+provides=('bing4desktop')
+depends=('python' 'python-pillow' 'python-requests')
+makedepends=('python' 'python-pillow' 'python-requests')
+source=(${pkgname}-${pkgver}-${pkgrel}.tar.gz)
+noextract=()
+sha256sums=('f9b22dc950b1ac543f0daf8e2620b27d9c2a2064e9d41eaca7085e8a3b35d312') #generate with 'makepkg -g' || sha256sum
+
+#build() {
+	#cd "$srcdir/${pkgname}-${pkgver}-${pkgrel}"
+	#python -m build --wheel --no-isolation
+#}
+
+package() {
+	cd "$srcdir/${pkgname}-${pkgver}-${pkgrel}"
+	make DESTDIR="${pkgdir}" install
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/RPM/bing4desktop.spec	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,68 @@
+#
+# spec file for package bing4desktop
+#
+# Copyright (c) 2020 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+%define unmangled_version 0.240205-4
+Name:       bing4desktop
+Version:	0.240205
+Release:    4
+Summary:	Beautify your desktop with photos from Bing search engine
+License:	Public Domain
+URL:		https://prymula.ct8.pl
+Source0:	%{name}-%{unmangled_version}.tar.gz
+%if 0%{?suse_version}>=150000
+BuildRequires:	python3, python-Pillow, python3-requests
+Requires:       python3, python-Pillow, python3-requests
+%endif
+%if 0%{?fedora}>=36
+BuildRequires:	python3, python3-pillow-tk, python3-requests
+Requires:		python3, python3-pillow-tk, python3-requests
+%endif
+BuildArch:	noarch
+
+%description
+
+%prep
+%setup -n %{name}-%{unmangled_version} -n %{name}-%{unmangled_version}
+
+%build
+
+%install
+
+mkdir -p %{buildroot}/usr
+mkdir -p %{buildroot}/usr/bin
+mkdir -p %{buildroot}/usr/share
+mkdir -p %{buildroot}/usr/share/bing4desktop
+mkdir -p %{buildroot}/etc
+mkdir -p %{buildroot}/etc/xdg
+mkdir -p %{buildroot}/etc/xdg/autostart
+
+
+install -m 0755 bing4desktop.py %{buildroot}/usr/bin
+install -m 0644 bing.ico %{buildroot}/usr/share/bing4desktop
+install -m 0644 bing4desktop.desktop %{buildroot}/etc/xdg/autostart
+
+
+%files
+%defattr(0755,root,root)
+/usr/bin/bing4desktop.py
+/usr/share/bing4desktop/
+%defattr(0644,root,root)
+/usr/share/bing4desktop/bing.ico
+/etc/xdg/autostart/bing4desktop.desktop
+
+%changelog
+
Binary file bing4desktop/bing.ico has changed
Binary file bing4desktop/bing.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/bing4desktop.desktop	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,14 @@
+#!/usr/bin/env xdg-open
+
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Categories=Settings;
+
+Name=Bing4Desktop
+
+Exec=python3 /usr/bin/bing4desktop.py
+Terminal=false
+Icon=/usr/share/bing4desktop/bing.png
+
+Name[pl_PL]=Bing4Desktop
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/bing4desktop.py	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,257 @@
+#!/usr/bin/env python3
+# bing4desktop.py - skrypt tray dla Cinnamon oraz Matte i innych WM
+# inspiracja: https://pystray.readthedocs.io/en/latest/usage.html
+# oraz 'zasłyszane' w internecie :)
+# licencja: Public Domain
+# edytor: Geany
+# data: 05-II-2024
+# napisał: Prymula
+
+# python3-pillow-tk
+
+import pystray
+from pystray import Icon as icon, Menu as menu, MenuItem as item
+import tkinter as tk
+from tkinter import messagebox
+from PIL import ImageTk, Image
+
+import os, sys, subprocess
+import requests
+import json
+import tempfile
+import shutil
+
+ver = "0.240205-4"
+
+BING_URI_BASE = "http://www.bing.com"
+BING_WALLPAPER_PATH = "/HPImageArchive.aspx?format=js&idx=50&n=1&mkt=en-US"
+full_path=""
+actualImage = -1
+COPYRIGHT_TXT = ""
+
+tmp_path =  tempfile.mkdtemp()
+
+
+
+class WPaper:
+    def get(self):
+        global full_path, COPYRIGHT_TXT
+        # open the Bing HPImageArchive URI and ask for a JSON response
+        resp = requests.get(BING_URI_BASE + BING_WALLPAPER_PATH)
+
+        if resp.status_code == 200:
+            json_response = json.loads(resp.content)
+            wallpaper_path = json_response['images'][0]['url']
+            COPYRIGHT_TXT = json_response['images'][0]['copyright']
+            filename = wallpaper_path.split('/')[-1]
+            wallpaper_uri = BING_URI_BASE + wallpaper_path
+            filename_short = filename.split('&')
+            print ("filemname_short", filename_short[0])
+            # open the actual wallpaper uri, and write the response as an image on the filesystem
+            response = requests.get(wallpaper_uri)
+            if resp.status_code == 200:
+                desktop_env = os.environ.get('DESKTOP_SESSION')
+                if desktop_env=="windows":
+                    messagebox.showinfo("Błąd","Brak wsparcia dla Windows i Mac !")
+                    cleanup()
+                    exit
+                else:
+                    full_path = tmp_path + filename_short[0]
+                    with open(full_path, 'wb') as f:
+                        f.write(response.content)
+            else:
+                raise ValueError("[ERROR] non-200 response from Bing server for '{}'".format(wallpaper_uri))
+                COPYRIGHT_TXT = "[ERROR] non-200 response from Bing server for " + str(format(wallpaper_uri))
+                return False
+        else:
+            raise ValueError("[ERROR] non-200 response from Bing server for '{}'".format(BING_URI_BASE + BING_WALLPAPER_PATH))
+            COPYRIGHT_TXT = "[ERROR] non-200 response from Bing server for " + str(format(BING_URI_BASE + BING_WALLPAPER_PATH))
+            return False
+        return True
+        
+    def set(self,file_loc, first_run):
+        global full_path
+        desktop_env = os.environ.get('DESKTOP_SESSION')
+
+        if len(full_path) == 0:
+            messagebox.showinfo("Błąd","Niewybrano obrazu, najpierw wybierz obraz")
+            return
+        try:
+            if desktop_env in ["gnome-classic", "gnome", "unity", "default"]:
+                uri = "'file://%s'" % file_loc
+                try:
+                    SCHEMA = "org.gnome.desktop.background"
+                    KEY = "picture-uri"
+                    gsettings = Gio.Settings.new(SCHEMA)
+                    gsettings.set_string(KEY, uri)
+                except:
+                    args = ["gsettings", "set", "org.gnome.desktop.background", "picture-uri", uri]
+                    subprocess.Popen(args)
+            elif desktop_env in ["cinnamon"]:
+                uri = "'file://%s'" % file_loc
+                try:
+                    SCHEMA = "org.cinnamon.desktop.background"
+                    KEY = "picture-uri"
+                    gsettings = Gio.Settings.new(SCHEMA)
+                    gsettings.set_string(KEY, uri)
+                except:
+                    args = ["gsettings", "set", "org.cinnamon.desktop.background", "picture-uri", uri]
+                    subprocess.Popen(args)
+            elif desktop_env=="mate":
+                try: # MATE >= 1.6
+                    # info from http://wiki.mate-desktop.org/docs:gsettings
+                    args = ["gsettings", "set", "org.mate.background", "picture-filename", "'%s'" % file_loc]
+                    subprocess.Popen(args)
+                except: # MATE < 1.6
+                    # From https://bugs.launchpad.net/variety/+bug/1033918
+                    args = ["mateconftool-2","-t","string","--set","/desktop/mate/background/picture_filename",'"%s"' %file_loc]
+                    subprocess.Popen(args)
+            elif desktop_env=="gnome2": # Not tested
+                # From https://bugs.launchpad.net/variety/+bug/1033918
+                args = ["gconftool-2","-t","string","--set","/desktop/gnome/background/picture_filename", '"%s"' %file_loc]
+                subprocess.Popen(args)
+            ## KDE4 is difficult
+            ## see http://blog.zx2c4.com/699 for a solution that might work
+            elif desktop_env in ["kde3", "trinity"]:
+                # From http://ubuntuforums.org/archive/index.php/t-803417.html
+                args = 'dcop kdesktop KBackgroundIface setWallpaper 0 "%s" 6' % file_loc
+                subprocess.Popen(args,shell=True)
+
+            elif desktop_env=="xfce4":
+                #From http://www.commandlinefu.com/commands/view/2055/change-wallpaper-for-xfce4-4.6.0
+                if first_run:
+                    args0 = ["xfconf-query", "-c", "xfce4-desktop", "-p", "/backdrop/screen0/monitor0/image-path", "-s", file_loc]
+                    args1 = ["xfconf-query", "-c", "xfce4-desktop", "-p", "/backdrop/screen0/monitor0/image-style", "-s", "3"]
+                    args2 = ["xfconf-query", "-c", "xfce4-desktop", "-p", "/backdrop/screen0/monitor0/image-show", "-s", "true"]
+                    subprocess.Popen(args0)
+                    subprocess.Popen(args1)
+                    subprocess.Popen(args2)
+                args = ["xfdesktop","--reload"]
+                subprocess.Popen(args)
+
+            elif desktop_env in ["fluxbox","jwm","openbox","afterstep"]:
+                #http://fluxbox-wiki.org/index.php/Howto_set_the_background
+                # used fbsetbg on jwm too since I am too lazy to edit the XML configuration
+                # now where fbsetbg does the job excellent anyway.
+                # and I have not figured out how else it can be set on Openbox and AfterSTep
+                # but fbsetbg works excellent here too.
+                try:
+                    args = ["fbsetbg", file_loc]
+                    subprocess.Popen(args)
+                except:
+                    sys.stderr.write("ERROR: Failed to set wallpaper with fbsetbg!\n")
+                    sys.stderr.write("Please make sre that You have fbsetbg installed.\n")
+            elif desktop_env=="icewm":
+                # command found at http://urukrama.wordpress.com/2007/12/05/desktop-backgrounds-in-window-managers/
+                args = ["icewmbg", file_loc]
+                subprocess.Popen(args)
+            elif desktop_env=="blackbox":
+                # command found at http://blackboxwm.sourceforge.net/BlackboxDocumentation/BlackboxBackground
+                args = ["bsetbg", "-full", file_loc]
+                subprocess.Popen(args)
+            elif desktop_env=="lxde":
+                args = "pcmanfm --set-wallpaper %s --wallpaper-mode=scaled" % file_loc
+                subprocess.Popen(args,shell=True)
+            elif desktop_env=="WindowMaker":
+                # From http://www.commandlinefu.com/commands/view/3857/set-wallpaper-on-windowmaker-in-one-line
+                args = "wmsetbg -s -u %s" % file_loc
+                subprocess.Popen(args,shell=True)
+            elif desktop_env=="windows": #Not tested since I do not run this on Windows
+                #From https://stackoverflow.com/questions/1977694/change-desktop-background
+                import ctypes
+                SPI_SETDESKWALLPAPER = 20
+                ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, file_loc , 0)
+            else:
+                if first_run: #don't spam the user with the same message over and over again
+                    sys.stderr.write("Warning: Failed to set wallpaper. Your desktop environment is not supported.")
+                    sys.stderr.write("You can try manually to set Your wallpaper to %s" % file_loc)
+                return False
+            return True
+        except:
+            sys.stderr.write("ERROR: Failed to set wallpaper. There might be a bug.\n")
+            return False
+
+
+class Gui():
+    global COPYRIGHT_TXT
+    
+    def __init__(self):
+        self.window = tk.Tk()
+        self.image =  Image.open("bing.ico")
+        self.menu = (
+            item("Ustaw Tapetę", lambda icon, item: wp.set(full_path, True)),
+            item('Tapeta poprzednia', lambda icon, item: self.change_pic(1)),
+            item('Tapeta następna', lambda icon, item: self.change_pic(-1)),
+            item('Opis zdjęcia', lambda icon, item: icon.notify(COPYRIGHT_TXT)),
+            item('O Programie', lambda icon, item: self.about()),
+
+            item('Wyjdź', self.quit_window)
+            )
+        self.frame = tk.Frame(self.window, width=600, height=400)
+        self.frame.pack()
+        self.frame.place(anchor='center', relx=0.5, rely=5)
+        
+        #self.window.title("Bing4Desktop")
+        #self.window.geometry('800x600')
+        #self.window.protocol('WM_DELETE_WINDOW', self.withdraw_window)
+        self.withdraw_window()
+        self.window.mainloop()
+   
+    def about(self):
+        global ver
+        messagebox.showinfo("Bing4Desktop","Inspracja:\npystray.readthedocs.io/en/latest/usage.html\n\nNapisał: Prymula\n\nLuty 2024\n\nLicencja:\nPublic Domain\n\nWersja: "+ver)
+        # możliwe że nieprawidlowe
+        self.window.destroy()
+        self.window.update()
+
+   
+    def change_pic(self, n):
+        global actualImage, BING_WALLPAPER_PATH
+        BASE = "/HPImageArchive.aspx?format=js&idx="
+        OFF = "&n=1&mkt=en-US"
+
+        actualImage = actualImage + n;
+        if (actualImage < 0):
+             actualImage = 10
+        elif (actualImage > 10):
+             actualImage = 0
+             
+        print ("FULL: ", len(full_path))
+        
+        wp=WPaper()
+        if wp.get():
+            BING_WALLPAPER_PATH = BASE+str(actualImage)+OFF
+            if wp.get() == False:
+                cleanup()
+                exit
+            
+            img = Image.open(full_path) #.convert('RGBA')  # PIL solution
+            tmp = img.resize((600, 400), None, None, 3.0)
+            tmp.show()
+
+    def quit_window(self):
+        self.icon.stop()
+        self.window.destroy()
+
+
+    def show_window(self):
+        self.icon.stop()
+        self.window.protocol('WM_DELETE_WINDOW', self.withdraw_window)
+        self.window.after(0, self.window.deiconify)
+
+
+    def withdraw_window(self):
+        self.window.withdraw()
+        self.icon = pystray.Icon("name", self.image, "title", self.menu)
+        self.icon.run()
+
+def cleanup():
+    # NIEBEZPIECZNA ! lepiej niczym innym nie nadpisywać tych zmiennych
+    shutil.rmtree(tmp_path)    
+        
+if __name__ in '__main__':
+    wp=WPaper()
+    if wp.get():
+        wp.set(full_path, True)
+        g = Gui()
+        cleanup()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bing4desktop/desktop.py	Tue Feb 06 00:30:36 2024 +0100
@@ -0,0 +1,7 @@
+#!/usr/bin/env python3
+import os
+
+desktop_env = os.environ.get('DESKTOP_SESSION')
+
+print ("Moj desktop to: ", desktop_env)
+