Hello community,

here is the log from the commit of package azote for openSUSE:Factory checked 
in at 2020-10-02 17:36:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/azote (Old)
 and      /work/SRC/openSUSE:Factory/.azote.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "azote"

Fri Oct  2 17:36:55 2020 rev:6 rq:838937 version:1.8.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/azote/azote.changes      2020-09-14 
12:34:56.337351584 +0200
+++ /work/SRC/openSUSE:Factory/.azote.new.4249/azote.changes    2020-10-02 
17:37:04.570730492 +0200
@@ -1,0 +2,8 @@
+Thu Oct  1 08:52:40 UTC 2020 - Michael Vetter <mvet...@suse.com>
+
+- Update to 1.8.0:
+  * added fix to avoid crashes on X11, when a display is connected, but turned 
off #110
+  * added CLI messages on missing optional dependencies #101
+  * screen height is deprecated #108 issue fixed in slightly tricky way
+
+-------------------------------------------------------------------

Old:
----
  azote-1.7.14.tar.gz

New:
----
  azote-1.8.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ azote.spec ++++++
--- /var/tmp/diff_new_pack.qVzYNR/_old  2020-10-02 17:37:06.050731375 +0200
+++ /var/tmp/diff_new_pack.qVzYNR/_new  2020-10-02 17:37:06.054731377 +0200
@@ -18,7 +18,7 @@
 
 %{!?python_sitelib: %global python_sitelib %(python -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
 Name:           azote
-Version:        1.7.14
+Version:        1.8.0
 Release:        0
 Summary:        Wallpaper manager for Sway, i3 and some other WMs
 License:        GPL-3.0-only

++++++ azote-1.7.14.tar.gz -> azote-1.8.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azote-1.7.14/CHANGELOG.md 
new/azote-1.8.0/CHANGELOG.md
--- old/azote-1.7.14/CHANGELOG.md       2020-09-12 02:05:21.000000000 +0200
+++ new/azote-1.8.0/CHANGELOG.md        2020-09-27 16:31:49.000000000 +0200
@@ -1,5 +1,31 @@
 # CHANGELOG
 
+## Development
+
+**Available for testing as azote-git (AUR)**
+
+- added fix to avoid crashes on X11, when a display is connected, but turned 
off 
+[#110](https://github.com/nwg-piotr/azote/issues/110);
+- added CLI messages on missing optional dependencies 
[#101](https://github.com/nwg-piotr/azote/issues/101):
+
+*There were several request to get Azote rid of dependencies unused in a 
certain environment. That's why I added some CLI messages. 
+If lack of a package won't allow Azote to work in detected environment, (e.g. 
`xorg-xrandr` on X11, `wlr-randr` or 
+`swaybg` on Wayfire), the program will display a message and terminate with 
exit code 1. If missing dependency just
+stops some feature from working, Azote displays a message and starts normally. 
This attitude has pros and cons: 
+no more unwanted dependencies installed by default, but - apart from sway - 
users must take care of dependencies on their own. 
+Finally it's up to packagers how to deal with dependencies.*
+
+- in wallpapers preview, the `Gtk.Grid` container has been replaced with 
`Gtk.FlowBox`. This allows to maximize and/or
+scale the Azote window on-the-fly without freezing its width.
+
+- Screen height is deprecated #108 fixed in slightly tricky way.
+
+*Since Gdk.Screen.height has been deprecated, there's no reasonable way to 
determine the screen dimensions. We need to 
+open a temporary window and measure its height to open the Azote window with 
maximum allowed vertical dimension.
+In `~/.config/azote/azoterc` you'll find the `"screen_measurement_delay": 
"300"` value. Different hardware and window 
+managers need different time to open the temporary window. Increase the value 
if the (floating) window does not scale 
+to the screen height. Decrease as much as possible to speed up launching 
Azote.*
+
 ## v1.7.14 (2020-09-12)
 - Added possibility to open images with 
[swappy](https://github.com/jtheoof/swappy) (.png only);
 - fixed crash on the stored wallpaper folder path not found 
[#102](https://github.com/nwg-piotr/azote/issues/102);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azote-1.7.14/README.md new/azote-1.8.0/README.md
--- old/azote-1.7.14/README.md  2020-09-12 02:05:21.000000000 +0200
+++ new/azote-1.8.0/README.md   2020-09-27 16:31:49.000000000 +0200
@@ -9,6 +9,22 @@
 The program is confirmed to work on sway, Wayfire, i3, Openbox, Fluxbox and 
dwm window managers. Wayland support is
 limited to wlroots-based compositors.
 
+Azote relies on numerous external packages. Some of them determine if the 
program is capable of working in a certain
+environment (sway / another wlroots-based compositor / X11). It's **up to the 
packager** which of them come preinstalled.
+It's recommendable to first run `azote` from terminal:
+
+- if one of missing packages disallows Azote to work at all (e.g. 
`xorg-xrandr` or `feh` on X11, `wlr-randr` or 
+`swaybg` on Wayfire), the program will display a message and terminate with 
exit code 1.
+
+- If a missing dependency just stops some feature from working, Azote will 
display a message and start normally.
+
+```text
+$ azote
+python-send2trash package not found - deleting pictures unavailable
+Running on Wayland, but not sway
+Available screen height: 1030 px; measurement delay: 5 ms
+```
+
 
![screenshot](http://nwg.pl/Lychee/uploads/big/78510b1f9358767e8407d66e933f1d8c.png)
 
 *Wallpapers above come from https://wallhaven.cc*
@@ -16,12 +32,12 @@
 ## Project assumptions
 
 The most commonly used *desktop background browser and setter* is aimed at X 
windows, and does not work with 
-[sway](https://swaywm.org). Since the `swaybg` command does everything we may 
need, it's enough to give it a GUI. 
+wlroots-based composers. Since the `swaybg` command does everything we may 
need, it's enough to give it a GUI. 
 In order not to limit the program usage to the single environment, Azote is 
also capable of using feh 
 when running on i3, Openbox or other X11 window managers.
 
-*The description below takes into account the latest release. All the features 
may or may not be available in the
-package already prepared for a certain Linux distribution. Some features rely 
on 
+*The description below takes into account the current `master` branch. All the 
features may or may not be available in the
+package already released for a certain Linux distribution. Some features rely 
on 
 [optional 
dependencies](https://github.com/nwg-piotr/azote#dependencies-as-used-in-the-azote-aur-package).*
 
 ### Main features:
@@ -159,7 +175,8 @@
   "color_icon_h": "50",
   "clip_prev_size": "30",
   "palette_quality": "10",
-  "tracking_interval_seconds": "5"
+  "tracking_interval_seconds": "5",
+  "screen_measurement_delay": "300"
 }
 ```
 
@@ -173,7 +190,12 @@
 - `palette_quality` - affects quality and time of generation of the colour 
palette on the basis of an image; the less - the
 better, but slower; default value is 10;
 - `tracking_interval_seconds` - determines how often the current wallpapers 
folder should be checked for file addition / 
-deletion.
+deletion;
+- `screen_measurement_delay` (ms) - introduced to resolve 
[#108](https://github.com/nwg-piotr/azote/issues/108).
+Since `Gdk.Screen.height` has been deprecated, there's no reasonable way to 
determine the screen dimensions. 
+We need to open a temporary window and measure its height to open the Azote 
window with maximum allowed vertical dimension.
+Different hardware and window managers need different time to accomplish the 
task. Increase the value if the (floating) 
+window does not scale to the screen height. Decrease as much as possible to 
speed up launching Azote.
 
 ## Command line arguments
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azote-1.7.14/azote/common.py 
new/azote-1.8.0/azote/common.py
--- old/azote-1.7.14/azote/common.py    2020-09-12 02:05:21.000000000 +0200
+++ new/azote-1.8.0/azote/common.py     2020-09-27 16:31:49.000000000 +0200
@@ -18,7 +18,7 @@
 INFO = 'info'
 DEBUG = 'debug'
 
-env = {"wm": '', "xrandr": False, "send2trash": False}
+env = {}
 sway = False
 
 lang = None             # dictionary "name": lang_string
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azote-1.7.14/azote/main.py 
new/azote-1.8.0/azote/main.py
--- old/azote-1.7.14/azote/main.py      2020-09-12 02:05:21.000000000 +0200
+++ new/azote-1.8.0/azote/main.py       2020-09-27 16:31:49.000000000 +0200
@@ -4,19 +4,12 @@
 """
 Wallpaper and colour manager for Sway, i3 and some other WMs, as a frontend to 
swaybg and feh
 
-Author: Piotr Miller
+Author: Piotr Miller & Contributors
 e-mail: nwg.pi...@gmail.com
 Website: http://nwg.pl
 Project: https://github.com/nwg-piotr/azote
 License: GPL3
 
-depends=('python' 'python-setuptools' 'python-gobject' 'python-pillow' 'gtk3' 
'feh' 'xorg-xrandr')
-optdepends=('python-send2trash: for trash support'
-            'grim: for screen color picker on Sway'
-            'slurp: for screen color picker on Sway'
-            'maim: for screen color picker on X11'
-            'imagemagick: for screen color picker on both Sway and X11'
-            'python-pyaml: (python3-yaml) for alacritty.yml toolbox')
 """
 import os
 import sys
@@ -25,6 +18,7 @@
 import common
 import gi
 import pkg_resources
+import cairo
 from PIL import Image
 
 # send2trash module may or may not be available
@@ -32,9 +26,9 @@
     from send2trash import send2trash
 
     common.env['send2trash'] = True
-except Exception as e:
+except Exception:
     common.env['send2trash'] = False
-    print('send2trash module not found', e)
+    print('python-send2trash package not found - deleting pictures 
unavailable')
 
 from colorthief import ColorThief
 
@@ -53,6 +47,7 @@
     common.env['app_indicator'] = True
 except:
     common.env['app_indicator'] = False
+    print('libappindicator-gtk3 package not found - tray icon unavailable')
 
 
 def get_files():
@@ -85,27 +80,21 @@
         self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)
 
         common.thumbnails_list = []
-        self.grid = Gtk.Grid()
-        self.grid.set_column_spacing(25)
-        self.grid.set_row_spacing(15)
+        self.grid = Gtk.FlowBox()
+        self.grid.set_valign(Gtk.Align.START)
+        #self.grid.set_max_children_per_line(30)
+        self.grid.set_selection_mode(Gtk.SelectionMode.NONE)
 
         create_thumbnails(common.settings.src_path)
         self.files_dict = dict([(f, None) for f in 
os.listdir(common.settings.src_path)])
 
-        col, row = 0, 0
         src_pictures = get_files()
 
         for file in src_pictures:
             if file_allowed(file):
                 thumbnail = Thumbnail(common.settings.src_path, file)
-                thumbnail.column = col
                 common.thumbnails_list.append(thumbnail)
-                self.grid.attach(thumbnail, col, row, 1, 1)
-                if col < common.cols - 1:
-                    col += 1
-                else:
-                    col = 0
-                    row += 1
+                self.grid.add(thumbnail)
 
         self.add(self.grid)
 
@@ -119,20 +108,14 @@
             self.grid.remove(thumbnail)
             thumbnail.destroy()
 
-        col, row = 0, 0
         src_pictures = get_files()
 
         for file in src_pictures:
             if file_allowed(file):
                 thumbnail = Thumbnail(common.settings.src_path, file)
-                thumbnail.column = col
                 common.thumbnails_list.append(thumbnail)
-                self.grid.attach(thumbnail, col, row, 1, 1)
-                if col < common.cols - 1:
-                    col += 1
-                else:
-                    col = 0
-                    row += 1
+                self.grid.add(thumbnail)
+
                 thumbnail.show_all()
                 thumbnail.toolbar.hide()
 
@@ -161,10 +144,6 @@
         self.image_button.set_image_position(2)  # TOP
         self.image_button.set_tooltip_text(common.lang['thumbnail_tooltip'])
 
-        # Workaround: column is a helper value to identify thumbnails placed 
in column 0. 
-        # They need different context menu gravity in Sway
-        self.column = 0
-
         if len(filename) > 30:
             filename = '…{}'.format(filename[-28::])
         self.image_button.set_label(filename)
@@ -522,17 +501,18 @@
 
     dialog.set_keep_above(True)
     dialog.set_logo(logo)
-    dialog.set_copyright('(c) 2019 Piotr Miller')
+    dialog.set_copyright('(c) 2019-2020 Piotr Miller')
     dialog.set_website('https://github.com/nwg-piotr/azote')
     dialog.set_comments(common.lang['app_desc'])
     dialog.set_license_type(Gtk.License.GPL_3_0)
-    dialog.set_authors(['Piotr Miller (nwg)', 'Head-on-a-Stick', 'Libraries 
and dependencies:',
+    dialog.set_authors(['Piotr Miller (nwg) and Contributors', 'Libraries and 
dependencies:',
                         '- colorthief python module (c) 2015 Shipeng Feng',
                         '- python-pillow (c) 1995-2011, Fredrik Lundh, 
2010-2019 Alex Clark and Contributors',
                         '- pygobject (c) 2005-2019 The GNOME Project',
                         '- GTK+ (c) 2007-2019 The GTK Team',
                         '- feh (c) 1999,2000 Tom Gilbert, 2010-2018 Daniel 
Friesel',
                         '- swaybg (c) 2016-2019 Drew DeVault',
+                        '- wlr-randr (c) 2019 Purism SPC and Contributors',
                         '- send2trash python module (c) 2017 Virgil Dupras',
                         '- grim, slurp (c) 2018 emersion',
                         '- maim, slop (c) 2014 Dalton Nell and Contributors',
@@ -673,22 +653,8 @@
             menu.show_all()
             # We don't want the menu to stick out of the window on Sway, as it 
may be partially not clickable
 
-            if widget.column:
-                if widget.column == 0:
-                    if not from_toolbar:
-                        menu.popup_at_widget(widget, Gdk.Gravity.CENTER, 
Gdk.Gravity.NORTH_WEST, None)
-                    else:
-                        menu.popup_at_widget(widget.toolbar, Gdk.Gravity.WEST, 
Gdk.Gravity.NORTH_WEST, None)
-                else:
-                    if not from_toolbar:
-                        menu.popup_at_widget(widget, Gdk.Gravity.CENTER, 
Gdk.Gravity.NORTH_EAST, None)
-                    else:
-                        menu.popup_at_widget(widget.toolbar, Gdk.Gravity.EAST, 
Gdk.Gravity.NORTH_EAST, None)
-            else:
-                if not from_toolbar:
-                    menu.popup_at_widget(widget, Gdk.Gravity.CENTER, 
Gdk.Gravity.NORTH, None)
-                else:
-                    menu.popup_at_widget(widget.toolbar, Gdk.Gravity.EAST, 
Gdk.Gravity.NORTH, None)
+            menu.popup_at_pointer(None)
+
         else:  # fallback in case mimeinfo.cache not found
             print("No registered program found. Does the 
/usr/share/applications/mimeinfo.cache file exist?")
             command = 'feh --start-at {} --scale-down --no-fehbg -d 
--output-dir {}'.format(
@@ -738,14 +704,42 @@
     Gtk.main_quit()
 
 
-class GUI:
+def check_height_and_start(window):
+    w, h = window.get_size()
+    window.destroy()
+    if common.sway or common.env['wm'] == "i3":
+        h = h * 0.95
+    print("Available screen height: {} px; measurement delay: {} ms".format(h, 
common.settings.screen_measurement_delay))
+    app = GUI(h)
+
+
+class TransparentWindow(Gtk.Window):
     def __init__(self):
+        Gtk.Window.__init__(self)
+        self.connect('draw', self.draw)
+        self.set_title("Checking...")
+        # Credits for transparency go to KurtJacobson:
+        # https://gist.github.com/KurtJacobson/374c8cb83aee4851d39981b9c7e2c22c
+        screen = self.get_screen()
+        visual = screen.get_rgba_visual()
+        if visual and screen.is_composited():
+            self.set_visual(visual)
+        self.set_app_paintable(True)
+    
+    def draw(self, widget, context):
+        context.set_source_rgba(0, 0, 0, 0.0)
+        context.set_operator(cairo.OPERATOR_SOURCE)
+        context.paint()
+        context.set_operator(cairo.OPERATOR_OVER)
+
+
+class GUI:
+    def __init__(self, height):
 
         window = Gtk.Window()
-        screen = window.get_screen()
-        h = screen.height()
+        h = height
 
-        window.set_default_size(common.settings.thumb_width * 
common.settings.columns + 160, h * 0.95)
+        window.set_default_size(common.settings.thumb_width * 
(common.settings.columns + 1), h)
         common.main_window = window
 
         window.set_title("Azote~")
@@ -770,7 +764,6 @@
 
         # This contains a Gtk.ScrolledWindow with Gtk.Grid() inside, filled 
with ThumbButton(Gtk.Button) instances
         common.preview = Preview()
-        window.connect('configure-event', on_configure_event)
 
         main_box.pack_start(common.preview, False, False, 0)
 
@@ -936,16 +929,6 @@
         common.progress_bar.hide()
 
 
-def on_configure_event(window, e):
-    cols = e.width // (common.settings.thumb_width + 40)
-    if cols != common.cols:
-        common.preview.hide()
-        if cols != common.cols:
-            common.cols = cols
-            common.preview.refresh(create_thumbs=False)
-        common.preview.show()
-
-
 def on_apply_to_all_button(button):
     """
     This will create a single command to set the same wallpaper to all 
displays, CONNECTED at the time OR NOT.
@@ -1802,11 +1785,21 @@
         exit()
 
     common.cols = len(common.displays) if len(common.displays) > 
common.settings.columns else common.settings.columns
-    app = GUI()
+
+    # We want Azote to take all the possible screen height. Since 
Gdk.Screen.height is deprecated, we need to measure
+    # the current screen height in another way. `w` is a temporary window.
+    w = TransparentWindow()
+    if common.sway or common.env['wm'] == "i3":
+        w.fullscreen()  # .maximize() doesn't work as expected on sway
+    else:
+        w.maximize()
+    w.present()
+
     if common.settings.track_files:
         GLib.timeout_add_seconds(common.settings.tracking_interval_seconds, 
track_changes)
     if common.env['app_indicator']:
         common.indicator = Indicator()
+    GLib.timeout_add(common.settings.screen_measurement_delay, 
check_height_and_start, w)
     Gtk.main()
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azote-1.7.14/azote/tools.py 
new/azote-1.8.0/azote/tools.py
--- old/azote-1.7.14/azote/tools.py     2020-09-12 02:05:21.000000000 +0200
+++ new/azote-1.8.0/azote/tools.py      2020-09-27 16:31:49.000000000 +0200
@@ -54,30 +54,27 @@
 
 
 def check_displays():
-    # Sway or not Sway? If so, the `swaymsg -t get_seats` command should 
return exit code 0
-    try:
-        result = subprocess.run(['swaymsg', '-t', 'get_seats'], 
stdout=subprocess.DEVNULL)
-        common.sway = result.returncode == 0
-    except:
-        common.sway = False
+    # Sway or not Sway?
+    common.sway = os.getenv('SWAYSOCK')
     if common.sway:
         common.env['wm'] = 'sway'
+
     else:
         if os.getenv('XDG_SESSION_DESKTOP'):
             common.env['wm'] = os.getenv('XDG_SESSION_DESKTOP')
         elif os.getenv('DESKTOP_SESSION'):
             common.env['wm'] = os.getenv('DESKTOP_SESSION')
+        elif os.getenv('I3SOCK'):
+            common.env['wm'] = "i3"
         else:
-            common.env['wm'] = 'not sway'
+            common.env['wm'] = 'undetected'
 
     # sway or not, we may be on Wayland anyway
     if not common.sway:
         common.env['wayland'] = os.getenv('WAYLAND_DISPLAY')
 
-    fnull = open(os.devnull, 'w')
-    common.env['xrandr'] = subprocess.call(["which", "xrandr"], stdout=fnull, 
stderr=subprocess.STDOUT) == 0
-
     if common.sway:
+        print("Running on sway")
         # We need swaymsg to check outputs on Sway
         try:
             displays = []
@@ -93,24 +90,18 @@
                     displays.append(display)
                     log("Output found: {}".format(display), common.INFO)
 
-            # Dummy display for testing
-            """display = {'name': 'HDMI-A-2',
-                       'x': 1920,
-                       'y': 0,
-                       'width': 1920,
-                       'height': 1080}
-            displays.append(display)
-            log("Output: {}".format(display), common.INFO)"""
-
             # sort displays list by x, y: from left to right, then from bottom 
to top
             displays = sorted(displays, key=lambda x: (x.get('x'), x.get('y')))
 
             return displays
 
         except Exception as e:
+            print("Failed checking displays: {}".format(e), common.ERROR)
             log("Failed checking displays: {}".format(e), common.ERROR)
+            exit(1)
 
     elif common.env['wayland']:
+        print("Running on Wayland, but not sway")
         lines = None
         try:
             lines = subprocess.check_output("wlr-randr", 
shell=True).decode("utf-8").strip().splitlines()
@@ -119,56 +110,90 @@
             log("Failed checking displays: {}".format(e), common.ERROR)
             exit(1)
 
-        name, w, h, x, y = None, None, None, None, None
-        displays = []
-        for line in lines:
-            if not line.startswith(" "):
-                name = line.split()[0]
-            elif "current" in line:
-                w_h = line.split()[0].split('x')
-                w = int(w_h[0])
-                h = int(w_h[1])
-            elif "Position" in line:
-                x_y = line.split()[1].split(',')
-                x = int(x_y[0])
-                y = int(x_y[1])
-                if name is not None and w is not None and h is not None and x 
is not None and y is not None:
-                    display = {'name': name,
-                               'x': x,
-                               'y': y,
-                               'width': w,
-                               'height': h}
-                    displays.append(display)
-                    log("Output found: {}".format(display), common.INFO)
+        if lines:
+            name, w, h, x, y = None, None, None, None, None
+            displays = []
+            for line in lines:
+                if not line.startswith(" "):
+                    name = line.split()[0]
+                elif "current" in line:
+                    w_h = line.split()[0].split('x')
+                    w = int(w_h[0])
+                    h = int(w_h[1])
+                elif "Position" in line:
+                    x_y = line.split()[1].split(',')
+                    x = int(x_y[0])
+                    y = int(x_y[1])
+                    if name is not None and w is not None and h is not None 
and x is not None and y is not None:
+                        display = {'name': name,
+                                   'x': x,
+                                   'y': y,
+                                   'width': w,
+                                   'height': h}
+                        displays.append(display)
+                        log("Output found: {}".format(display), common.INFO)
+            displays = sorted(displays, key=lambda x: (x.get('x'), x.get('y')))
+            return displays
 
-        displays = sorted(displays, key=lambda x: (x.get('x'), x.get('y')))
-        return displays
+        else:
+            print("Failed parsing wlr-ranrd output")
+            log("Failed parsing wlr-ranrd output", common.ERROR)
+            exit(1)
 
-    # On i3 we could use i3-msg here, but xrandr should also return what we 
need. If not on Sway - let's use xrandr
-    elif common.env['xrandr']:
-        names = subprocess.check_output("xrandr | awk '/ connected/{print 
$1}'", shell=True).decode(
-            "utf-8").splitlines()
-        res = subprocess.check_output("xrandr | awk '/*/{print $1}'", 
shell=True).decode("utf-8").splitlines()
-        coords = subprocess.check_output("xrandr --listmonitors | awk '{print 
$3}'", shell=True).decode("utf-8").splitlines()
-        displays = []
-        for i in range(len(names)):
-            w_h = res[i].split('x')
-            try:
-                x_y = coords[i + 1].split('+')
-            except:
-                x_y = (0, 0, 0)
-            display = {'name': names[i],
-                       'x': x_y[1],
-                       'y': x_y[2],
-                       'width': int(w_h[0]),
-                       'height': int(w_h[1])}
-            displays.append(display)
-            log("Output found: {}".format(display), common.INFO)
-        return displays
+        fnull = open(os.devnull, 'w')
+        try:
+            common.env['swaybg'] = subprocess.call(["swaybg", "-v"], 
stdout=fnull, stderr=subprocess.STDOUT) == 0
+        except Exception as e:
+            print("swaybg package required: {}".format(e))
+            log("swaybg package not found", common.ERROR)
+            exit(1)
 
     else:
-        log("Couldn't check displays", common.ERROR)
-        exit(1)
+        if common.env['wm'] == "i3":
+            print("Running on i3")
+        else:
+            print("Running on X11")
+        fnull = open(os.devnull, 'w')
+        try:
+            common.env['xrandr'] = subprocess.call(["xrandr", "-v"], 
stdout=fnull, stderr=subprocess.STDOUT) == 0
+        except Exception as e:
+            print("xorg-xrandr package required: {}".format(e))
+            log("xorg-xrandr package not found", common.ERROR)
+            exit(1)
+
+        try:
+            common.env['feh'] = subprocess.call(["feh", "-v"], stdout=fnull, 
stderr=subprocess.STDOUT) == 0
+        except Exception as e:
+            print("feh package required: {}".format(e))
+            log("feh package not found", common.ERROR)
+            exit(1)
+
+        try:
+            names = subprocess.check_output("xrandr | awk '/ connected/{print 
$1}'", shell=True).decode(
+                "utf-8").splitlines()
+            res = subprocess.check_output("xrandr | awk '/*/{print $1}'", 
shell=True).decode("utf-8").splitlines()
+            coords = subprocess.check_output("xrandr --listmonitors | awk 
'{print $3}'", shell=True).decode(
+                "utf-8").splitlines()
+            displays = []
+            for i in range(len(res)):
+                w_h = res[i].split('x')
+                try:
+                    x_y = coords[i + 1].split('+')
+                except:
+                    x_y = (0, 0, 0)
+                display = {'name': names[i],
+                           'x': x_y[1],
+                           'y': x_y[2],
+                           'width': int(w_h[0]),
+                           'height': int(w_h[1])}
+                displays.append(display)
+                log("Output found: {}".format(display), common.INFO)
+            return displays
+
+        except Exception as e:
+            print("Failed checking displays: {}".format(e), common.ERROR)
+            log("Failed checking displays: {}".format(e), common.ERROR)
+            exit(1)
 
 
 def current_display():
@@ -329,8 +354,6 @@
         clear_thumbnails(clear_all=True)
         common.settings.clear_thumbnails = False
 
-    log("Environment: {}".format(common.env), common.INFO)
-
     # check programs capable of opening files of allowed extensions
     if os.path.isfile('/usr/share/applications/mimeinfo.cache'):
         common.associations = {}  # Will stay None if the mimeinfo.cache file 
not found
@@ -396,23 +419,26 @@
         magick = subprocess.run(['convert', '-version'], 
stdout=subprocess.DEVNULL).returncode == 0
     except FileNotFoundError:
         magick = False
+        print('imagemagick package not found - color picked disabled')
     av = 'found' if magick else 'not found'
-    log("imagemagick library {}".format(av), common.INFO)
+    log("Color picker: imagemagick library {}".format(av), common.INFO)
 
     if common.sway or common.env['wayland']:
         try:
             grim = subprocess.run(['grim', '-h'], 
stdout=subprocess.DEVNULL).returncode == 0
         except FileNotFoundError:
             grim = False
+            print('grim package not found - color picked disabled')
         av = 'found' if grim else 'not found'
-        log("grim package {}".format(av), common.INFO)
+        log("Color picker/Wayland: grim package {}".format(av), common.INFO)
 
         try:
             slurp = subprocess.run(['slurp', '-h'], 
stdout=subprocess.DEVNULL).returncode == 0
         except FileNotFoundError:
             slurp = False
+            print('slurp package not found - color picked disabled')
         av = 'found' if slurp else 'not found'
-        log("slurp package {}".format(av), common.INFO)
+        log("Color picker/Wayland: slurp package {}".format(av), common.INFO)
 
         if magick and grim and slurp:
             log("Pick color from screen feature enabled", common.INFO)
@@ -421,18 +447,20 @@
             log("Pick color from screen feature needs imagemagick, grim and 
slurp packages packages", common.WARNING)
     else:
         try:
-            maim = subprocess.run(['maim', '-h'], 
stdout=subprocess.DEVNULL).returncode == 0
+            maim = subprocess.run(['maim', '-v'], 
stdout=subprocess.DEVNULL).returncode == 0
         except FileNotFoundError:
             maim = False
+            print('maim package not found - color picked disabled')
         av = 'found' if maim else 'not found'
-        log("maim package {}".format(av), common.INFO)
+        log("Color picker/X11: maim package {}".format(av), common.INFO)
 
         try:
-            slop = subprocess.run(['slop', '-h'], 
stdout=subprocess.DEVNULL).returncode == 0
+            slop = subprocess.run(['slop', '-v'], 
stdout=subprocess.DEVNULL).returncode == 0
         except FileNotFoundError:
             slop = False
+            print('slop package not found - color picked disabled')
         av = 'found' if slop else 'not found'
-        log("slurp package {}".format(av), common.INFO)
+        log("Color picker/X11: slurp package {}".format(av), common.INFO)
 
         if magick and maim and slop:
             log("Pick color from screen - feature available", common.INFO)
@@ -440,6 +468,8 @@
         else:
             log("Pick color from screen feature needs imagemagick, maim and 
slop packages installed", common.WARNING)
 
+    log("Environment: {}".format(common.env), common.INFO)
+
     # Find dotfiles
     if os.path.isfile(os.path.join(common.config_home, 
'alacritty/alacritty.yml')):
         common.alacritty_config = os.path.join(common.config_home, 
'alacritty/alacritty.yml')
@@ -450,6 +480,7 @@
     log('Alacritty config file: {}'.format(msg), common.INFO)
     if common.alacritty_config and not common.env['yaml']:
         log("python yaml module not found - alacritty.yml toolbox disabled", 
common.WARNING)
+        print('python-yaml module not found - alacritty.yml toolbox disabled')
 
     if os.path.isfile(os.path.join(os.getenv('HOME'), '.Xresources')):
         common.xresources = os.path.join(os.getenv('HOME'), '.Xresources')
@@ -789,13 +820,13 @@
             with open(self.rc_file, 'r') as f:
                 rc = json.load(f)
         except FileNotFoundError:
-            log('rc file not found, creating...', common.INFO)
+            log('{} file not found, creating...'.format(self.rc_file), 
common.INFO)
             self.save_rc(set_defaults=True)
 
         try:
             with open(self.rc_file, 'r') as f:
                 rc = json.load(f)
-            log('rc file loaded', common.INFO)
+            log('{} file loaded'.format(self.rc_file), common.INFO)
         except Exception as e:
             log('rc file error: {}'.format(e), common.ERROR)
 
@@ -853,6 +884,14 @@
         log('Files tracking interval: {} 
seconds'.format(self.tracking_interval_seconds),
             common.INFO)
 
+        try:
+            self.screen_measurement_delay = int(rc['screen_measurement_delay'])
+        except KeyError:
+            self.screen_measurement_delay = 300
+            save_needed = True
+        log('Screen measurement delay: {} 
ms'.format(self.screen_measurement_delay),
+            common.INFO)
+
         if save_needed:
             self.save_rc()
 
@@ -865,6 +904,7 @@
             self.clip_prev_size = 30
             self.palette_quality = 10
             self.tracking_interval_seconds = 5
+            self.screen_measurement_delay = 300
 
         rc = {'thumb_width': str(self.thumb_width),
               'columns': str(self.columns),
@@ -872,7 +912,8 @@
               'color_icon_h': str(self.color_icon_h),
               'clip_prev_size': str(self.clip_prev_size),
               'palette_quality': str(self.palette_quality),
-              'tracking_interval_seconds': str(self.tracking_interval_seconds)}
+              'tracking_interval_seconds': str(self.tracking_interval_seconds),
+              'screen_measurement_delay': str(self.screen_measurement_delay)}
 
         with open(self.rc_file, 'w') as f:
             json.dump(rc, f, indent=2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azote-1.7.14/setup.py new/azote-1.8.0/setup.py
--- old/azote-1.7.14/setup.py   2020-09-12 02:05:21.000000000 +0200
+++ new/azote-1.8.0/setup.py    2020-09-27 16:31:49.000000000 +0200
@@ -8,7 +8,7 @@
 
 setup(
     name='azote',
-    version='1.7.14',
+    version='1.8.0',
     description='Wallpaper manager for Sway, i3 and some other WMs',
     packages=['azote'],
     include_package_data=True,


Reply via email to