Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package azote for openSUSE:Factory checked in at 2021-03-15 10:56:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/azote (Old) and /work/SRC/openSUSE:Factory/.azote.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "azote" Mon Mar 15 10:56:35 2021 rev:9 rq:879122 version:1.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/azote/azote.changes 2021-01-11 17:16:40.624646564 +0100 +++ /work/SRC/openSUSE:Factory/.azote.new.2401/azote.changes 2021-03-15 10:56:35.777373911 +0100 @@ -1,0 +2,11 @@ +Mon Mar 15 09:29:07 UTC 2021 - Michael Vetter <[email protected]> + +- Update to 1.9.0: + * Restore wallpapers in use on startup; + * some tricky fixes to xrandr / fehbg support on multi-headed setups + * double click no longer applies the selected wallpaper to + outputs, just to displays preview; + * added check buttons to split current image between selected + outputs only. + +------------------------------------------------------------------- Old: ---- azote-1.8.2.tar.gz New: ---- azote-1.9.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ azote.spec ++++++ --- /var/tmp/diff_new_pack.OHDgGE/_old 2021-03-15 10:56:36.269374664 +0100 +++ /var/tmp/diff_new_pack.OHDgGE/_new 2021-03-15 10:56:36.269374664 +0100 @@ -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.8.2 +Version: 1.9.0 Release: 0 Summary: Wallpaper manager for Sway, i3 and some other WMs License: GPL-3.0-only ++++++ azote-1.8.2.tar.gz -> azote-1.9.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/CHANGELOG.md new/azote-1.9.0/CHANGELOG.md --- old/azote-1.8.2/CHANGELOG.md 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/CHANGELOG.md 2021-03-13 01:46:52.000000000 +0100 @@ -1,5 +1,12 @@ # CHANGELOG +## v1.9.0 (2021.03.13) + +- Restore wallpapers in use on startup; +- some tricky fixes to xrandr/fehbg support on multi-headed setups; +- double click no longer applies the selected wallpaper to outputs, just to displays preview; + -added check buttons to split current image between selected outputs only. + ## v1.8.2 (2020.01.11) - sway: fixed crash on display connected, but turned off [#110](https://github.com/nwg-piotr/azote/issues/110) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/README.md new/azote-1.9.0/README.md --- old/azote-1.8.2/README.md 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/README.md 2021-03-13 01:46:52.000000000 +0100 @@ -25,7 +25,7 @@ Available screen height: 1030 px; measurement delay: 5 ms ``` - + *Wallpapers above come from https://wallhaven.cc* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/azote/languages/de_DE new/azote-1.9.0/azote/languages/de_DE --- old/azote-1.8.2/azote/languages/de_DE 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/azote/languages/de_DE 2021-03-13 01:46:52.000000000 +0100 @@ -34,6 +34,7 @@ grim_slurp_required = grim, slurp & imagemagick-Pakete erforderlich height = H??he image_menu_button = Bildmen??taste +include_when_splitting = beim Teilen einschlie??en maim_slop_required = maim & slop-Pakete erforderlich move = In den Papierkorb verschieben move_to_trash = Auswahl in den Papierkorb verschieben diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/azote/languages/en_EN new/azote-1.9.0/azote/languages/en_EN --- old/azote-1.8.2/azote/languages/en_EN 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/azote/languages/en_EN 2021-03-13 01:46:52.000000000 +0100 @@ -35,6 +35,7 @@ grim_slurp_required = grim, slurp & imagemagick packages required height = Height image_menu_button = Image menu button +include_when_splitting = Include when splitting maim_slop_required = maim & slop packages required move = To trash move_to_trash = Move selected to trash diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/azote/languages/fr_FR new/azote-1.9.0/azote/languages/fr_FR --- old/azote-1.8.2/azote/languages/fr_FR 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/azote/languages/fr_FR 2021-03-13 01:46:52.000000000 +0100 @@ -34,6 +34,7 @@ grim_slurp_required = paquets grim, slurp et imagemagick requis height = La taille image_menu_button = Bouton de menu Image +include_when_splitting = inclure lors du fractionnement maim_slop_required = paquets maim et slop requis move = Vers la corbeille move_to_trash = D??placer la s??lection vers la corbeille diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/azote/languages/pl_PL new/azote-1.9.0/azote/languages/pl_PL --- old/azote-1.8.2/azote/languages/pl_PL 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/azote/languages/pl_PL 2021-03-13 01:46:52.000000000 +0100 @@ -34,6 +34,7 @@ grim_slurp_required = Wymagane paczki grim, slurp i imagemagick height = Wysoko???? image_menu_button = Przycisk menu obrazu +include_when_splitting = Uwzgl??dniaj przy podziale maim_slop_required = Wymagane paczki maim & slop move = Do kosza move_to_trash = Przenie?? wybrany do kosza diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/azote/main.py new/azote-1.9.0/azote/main.py --- old/azote-1.8.2/azote/main.py 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/azote/main.py 2021-03-13 01:46:52.000000000 +0100 @@ -36,7 +36,8 @@ from gi.repository import Gtk, GdkPixbuf, Gdk, GLib from gi.repository.GdkPixbuf import InterpType from tools import set_env, hash_name, create_thumbnails, file_allowed, update_status_bar, flip_selected_wallpaper, \ - copy_backgrounds, create_pixbuf, split_selected_wallpaper, scale_and_crop, clear_thumbnails, current_display + copy_backgrounds, create_pixbuf, split_selected_wallpaper, scale_and_crop, clear_thumbnails, current_display, \ + save_json, load_json from color_tools import rgba_to_hex, hex_to_rgb, rgb_to_hex, rgb_to_rgba from plugins import Alacritty, Xresources from color_tools import WikiColours @@ -44,6 +45,7 @@ try: gi.require_version('AppIndicator3', '0.1') from gi.repository import AppIndicator3 + common.env['app_indicator'] = True except: common.env['app_indicator'] = False @@ -82,7 +84,7 @@ common.thumbnails_list = [] self.grid = Gtk.FlowBox() self.grid.set_valign(Gtk.Align.START) - #self.grid.set_max_children_per_line(30) + # self.grid.set_max_children_per_line(30) self.grid.set_selection_mode(Gtk.SelectionMode.NONE) create_thumbnails(common.settings.src_path) @@ -127,7 +129,7 @@ super().__init__() self.toolbar = ImageToolbar(self) self.add(self.toolbar) - + self.image_button = Gtk.Button() self.image_button.set_property("name", "thumb-btn") self.image_button.set_always_show_image(True) @@ -162,10 +164,10 @@ on_thumb_double_click(button) if event.button == 3: show_image_menu(self) - + def on_menu_button_press(self, button): show_image_menu(self) - + def select(self, thumbnail): if common.split_button: common.split_button.set_sensitive(True) @@ -184,18 +186,18 @@ if len(filename) > 30: filename = '???{}'.format(filename[-28::]) common.selected_picture_label.set_text("{} ({} x {})".format(filename, img.size[0], img.size[1])) - + def deselect(self, thumbnail): self.selected = False self.toolbar.hide() thumbnail.image_button.set_property("name", "thumb-btn") - + def deselect_all(): for thumbnail in common.thumbnails_list: thumbnail.deselect(thumbnail) - - + + class ImageToolbar(Gtk.HBox): def __init__(self, thumbnail): super().__init__() @@ -216,25 +218,31 @@ def on_menu_button_press(self, button, event): show_image_menu(self.parent_thumbnail, from_toolbar=True) - + class DisplayBox(Gtk.Box): """ The box contains elements to preview certain displays and assign wallpapers to them """ - def __init__(self, name, width, height): + def __init__(self, name, width, height, path=None, thumb=None, xrandr_idx=None): super().__init__() self.set_orientation(Gtk.Orientation.VERTICAL) # Values to assigned to corresponding display when apply button pressed self.display_name = name - self.wallpaper_path = None + self.wallpaper_path = path + self.thumbnail_path = thumb self.mode = 'fill' if common.sway or common.env['wayland'] else 'scale' self.color = None + self.xrandr_idx = xrandr_idx + self.include = True - pixbuf = GdkPixbuf.Pixbuf.new_from_file('images/empty.png') + if thumb and os.path.isfile(thumb): + pixbuf = GdkPixbuf.Pixbuf.new_from_file(thumb) + else: + pixbuf = GdkPixbuf.Pixbuf.new_from_file('images/empty.png') pixbuf = pixbuf.scale_simple(common.settings.thumb_size[0], common.settings.thumb_size[1], InterpType.BILINEAR) self.img = Gtk.Image.new_from_pixbuf(pixbuf) @@ -267,6 +275,12 @@ options_box.set_border_width(0) options_box.set_orientation(Gtk.Orientation.HORIZONTAL) self.pack_start(options_box, True, False, 0) + + check_button = Gtk.CheckButton() + check_button.set_active(self.include) + check_button.set_tooltip_text(common.lang["include_when_splitting"]) + check_button.connect("toggled", self.switch_included) + options_box.pack_start(check_button, False, False, 0) self.mode_combo = Gtk.ComboBox.new_with_model(mode_selector) self.mode_combo.set_active(2) @@ -301,6 +315,9 @@ self.flip_button.set_tooltip_text(common.lang['flip_wallpaper_horizontally']) options_box.pack_start(self.flip_button, True, True, 0) + def switch_included(self, ckb): + self.include = ckb.get_active() + def clear_color_selection(self): # If not on sway / swaybg, we have no color_button in UI if common.sway or common.env['wayland']: @@ -317,6 +334,7 @@ if common.selected_wallpaper: self.img.set_from_file(common.selected_wallpaper.thumb_file) self.wallpaper_path = common.selected_wallpaper.source_path + self.thumbnail_path = common.selected_wallpaper.thumb_file button.set_property("name", "display-btn-selected") self.flip_button.set_sensitive(True) @@ -349,6 +367,7 @@ images = flip_selected_wallpaper() self.img.set_from_file(images[0]) self.wallpaper_path = images[1] + self.thumbnail_path = images[0] self.flip_button.set_sensitive(False) @@ -422,6 +441,11 @@ copy_backgrounds() if common.sway or common.env['wayland']: + # On next startup we'll want to restore what we're setting here. Let's save it to json files + # instead of parsing .azoteb / .fehbg. We only save pictures. + restore_from_file = os.path.join(common.data_home, "swaybg.json") + restore_from = [] + # Prepare, save and execute the shell script for swaybg. It'll be placed in ~/.azotebg for further use. batch_content = ['#!/usr/bin/env bash', 'pkill swaybg'] for box in common.display_boxes_list: @@ -432,6 +456,22 @@ batch_content.append( "swaybg -o {} -i '{}' -m {} &".format(box.display_name, box.wallpaper_path, box.mode)) + # build the json file content + if box.wallpaper_path.startswith("{}/backgrounds-sway/flipped-".format(common.data_home)): + thumb = "thumbnail-{}".format(box.wallpaper_path.split("flipped-")[1]) + thumb = os.path.join(common.data_home, "backgrounds-sway", thumb) + + elif box.wallpaper_path.startswith("{}/backgrounds-sway/part".format(common.data_home)): + thumb = "thumb-part{}".format(box.wallpaper_path.split("part")[1]) + thumb = os.path.join(common.data_home, "backgrounds-sway", thumb) + + else: + thumb = "{}.png".format(hash_name(box.wallpaper_path)) + thumb = os.path.join(common.data_home, "thumbnails", thumb) + + entry = {"name": box.display_name, "path": box.wallpaper_path, "thumb": thumb} + restore_from.append(entry) + # save to ~/.azotebg with open(common.cmd_file, 'w') as f: for item in batch_content: @@ -441,23 +481,59 @@ os.chmod(common.cmd_file, st.st_mode | stat.S_IEXEC) subprocess.call(common.cmd_file, shell=True) + + save_json(restore_from, restore_from_file) + else: + # As above + restore_from_file = os.path.join(common.data_home, "feh.json") + restore_from = [] + # Prepare and execute the feh command. It's being saved automagically to ~/.fehbg mode = common.display_boxes_list[0].mode # They are all the same, just check the 1st one command = "feh --bg-{}".format(mode) - for box in common.display_boxes_list: + c = common.display_boxes_list.copy() + c = sorted(c, key=lambda x: x.xrandr_idx) + for box in c: command += " '{}'".format(box.wallpaper_path) + + # build the json file content + if box.wallpaper_path.startswith("{}/backgrounds-feh/flipped-".format(common.data_home)): + thumb = "thumbnail-{}".format(box.wallpaper_path.split("flipped-")[1]) + thumb = os.path.join(common.data_home, "backgrounds-feh", thumb) + + elif box.wallpaper_path.startswith("{}/backgrounds-feh/part".format(common.data_home)): + thumb = "thumb-part{}".format(box.wallpaper_path.split("part")[1]) + thumb = os.path.join(common.data_home, "backgrounds-feh", thumb) + + else: + thumb = "{}.png".format(hash_name(box.wallpaper_path)) + thumb = os.path.join(common.data_home, "thumbnails", thumb) + + entry = {"name": box.display_name, "path": box.wallpaper_path, + "thumb": thumb} + restore_from.append(entry) + subprocess.call(command, shell=True) + save_json(restore_from, restore_from_file) + def on_split_button(button): if common.selected_wallpaper: common.apply_button.set_sensitive(True) - paths = split_selected_wallpaper(len(common.displays)) - for i in range(len(paths)): - box = common.display_boxes_list[i] - box.wallpaper_path = paths[i][0] - box.img.set_from_file(paths[i][1]) + num_parts = 0 + for item in common.display_boxes_list: + if item.include: + num_parts += 1 + paths = split_selected_wallpaper(num_parts) + i = 0 + for box in common.display_boxes_list: + if box.include: + box.wallpaper_path = paths[i][0] + box.img.set_from_file(paths[i][1]) + box.thumbnail_path = paths[i][1] + i += 1 if common.display_boxes_list: for box in common.display_boxes_list: @@ -600,7 +676,8 @@ display = common.displays[cd] width, height = display['width'] * 2, display['height'] subitem = Gtk.MenuItem.new_with_label( - '{} x {} ({} {} {})'.format(width, height, common.lang['current'], display['name'], common.lang['dual_width'])) + '{} x {} ({} {} {})'.format(width, height, common.lang['current'], display['name'], + common.lang['dual_width'])) subitem.connect('activate', scale_and_crop, common.selected_wallpaper.source_path, width, height) submenu.append(subitem) @@ -608,7 +685,8 @@ display = common.displays[cd] width, height = display['width'], display['height'] * 2 subitem = Gtk.MenuItem.new_with_label( - '{} x {} ({} {} {})'.format(width, height, common.lang['current'], display['name'], common.lang['dual_height'])) + '{} x {} ({} {} {})'.format(width, height, common.lang['current'], display['name'], + common.lang['dual_height'])) subitem.connect('activate', scale_and_crop, common.selected_wallpaper.source_path, width, height) submenu.append(subitem) @@ -616,7 +694,8 @@ display = common.displays[cd] width, height = display['width'] * 3, display['height'] subitem = Gtk.MenuItem.new_with_label( - '{} x {} ({} {} {})'.format(width, height, common.lang['current'], display['name'], common.lang['triple_width'])) + '{} x {} ({} {} {})'.format(width, height, common.lang['current'], display['name'], + common.lang['triple_width'])) subitem.connect('activate', scale_and_crop, common.selected_wallpaper.source_path, width, height) submenu.append(subitem) @@ -624,7 +703,8 @@ display = common.displays[cd] width, height = display['width'], display['height'] * 3 subitem = Gtk.MenuItem.new_with_label( - '{} x {} ({} {} {})'.format(width, height, common.lang['current'], display['name'], common.lang['triple_height'])) + '{} x {} ({} {} {})'.format(width, height, common.lang['current'], display['name'], + common.lang['triple_height'])) subitem.connect('activate', scale_and_crop, common.selected_wallpaper.source_path, width, height) submenu.append(subitem) @@ -709,7 +789,8 @@ window.destroy() if common.sway or common.env['wm'] == "i3": h = int(h * 0.95) - print("Available screen height: {} px; measurement delay: {} ms".format(h, common.settings.screen_measurement_delay)) + print( + "Available screen height: {} px; measurement delay: {} ms".format(h, common.settings.screen_measurement_delay)) app = GUI(h) @@ -725,7 +806,7 @@ 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) @@ -775,11 +856,33 @@ displays_box.set_spacing(15) displays_box.set_orientation(Gtk.Orientation.HORIZONTAL) + # Restore saved wallpapers if any + f_name = "swaybg.json" if common.sway else "feh.json" + f_path = os.path.join(common.data_home, f_name) + + if os.path.isfile(f_path): + restore_from = load_json(f_path) + else: + restore_from = None + # Buttons below represent displays preview common.display_boxes_list = [] for display in common.displays: + name = display.get('name') + # Check if we have stored values + path, thumb = None, None + if restore_from: + for item in restore_from: + if item["name"] == name: + path = item["path"] + thumb = item["thumb"] + # Label format: name (width x height) - display_box = DisplayBox(display.get('name'), display.get('width'), display.get('height')) + try: + xrandr_idx = display.get('xrandr-idx') + except KeyError: + xrandr_idx = None + display_box = DisplayBox(name, display.get('width'), display.get('height'), path, thumb, xrandr_idx) common.display_boxes_list.append(display_box) displays_box.pack_start(display_box, True, False, 0) @@ -1122,7 +1225,7 @@ self.set_role("toolbox") self.set_resizable(False) self.set_type_hint(Gdk.WindowTypeHint.DIALOG) - #self.set_transient_for(common.main_window) + # self.set_transient_for(common.main_window) self.set_position(Gtk.WindowPosition.MOUSE) self.set_keep_above(True) self.all_buttons = [] @@ -1163,7 +1266,7 @@ button.set_tooltip_text('{}'.format(name)) else: button.set_tooltip_text(common.lang['copy']) - + button.connect_after('clicked', self.to_clipboard) self.all_buttons.append(button) @@ -1238,7 +1341,7 @@ button.set_property("name", "color-btn") # mark selected widget.set_property("name", "color-btn-selected") - + common.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) if common.settings.copy_as == 'r, g, b': @@ -1307,7 +1410,7 @@ self.set_role("toolbox") self.set_resizable(False) self.set_type_hint(Gdk.WindowTypeHint.DIALOG) - #self.set_transient_for(common.main_window) + # self.set_transient_for(common.main_window) self.set_position(Gtk.WindowPosition.MOUSE) self.set_keep_above(True) @@ -1319,7 +1422,7 @@ self.vbox = Gtk.VBox() self.vbox.set_spacing(5) self.vbox.set_border_width(5) - + rgba = rgb_to_rgba(color) self.color_button = Gtk.ColorButton() @@ -1336,7 +1439,7 @@ self.label = Gtk.Label() self.label.set_text(rgb_to_hex(color)) self.vbox.add(self.label) - + if common.settings.color_dictionary: self.closest_label = Gtk.Label() self.closest_label.set_property('name', 'closest') @@ -1581,22 +1684,9 @@ for box in common.display_boxes_list: box.img.set_from_file(common.selected_wallpaper.thumb_file) box.wallpaper_path = common.selected_wallpaper.source_path + box.thumbnail_path = common.selected_wallpaper.thumb_file - common.apply_button.set_sensitive(False) - - # Prepare, save and execute the shell script for swaybg. It'll be placed in ~/.azotebg for further use. - batch_content = ['#!/usr/bin/env bash', 'pkill swaybg', - "swaybg -o* -i '{}' -m {} &".format(common.selected_wallpaper.source_path, mode)] - - # save to ~/.azotebg - with open(common.cmd_file, 'w') as f: - for item in batch_content: - f.write("%s\n" % item) - # make the file executable - st = os.stat(common.cmd_file) - os.chmod(common.cmd_file, st.st_mode | stat.S_IEXEC) - - subprocess.call(common.cmd_file, shell=True) + common.apply_button.set_sensitive(True) def apply_to_all_feh(item, mode): @@ -1604,14 +1694,9 @@ for box in common.display_boxes_list: box.img.set_from_file(common.selected_wallpaper.thumb_file) box.wallpaper_path = common.selected_wallpaper.source_path + box.thumbnail_path = common.selected_wallpaper.thumb_file - common.apply_button.set_sensitive(False) - - # Prepare and execute the feh command. It's being saved automagically to ~/.fehbg - command = "feh --bg-{}".format(mode) - command += " '{}'".format(common.selected_wallpaper.source_path) - - subprocess.call(command, shell=True) + common.apply_button.set_sensitive(True) def print_help(): @@ -1636,7 +1721,8 @@ class Indicator(object): def __init__(self): - self.ind = AppIndicator3.Indicator.new('azote_status_icon', '', AppIndicator3.IndicatorCategory.APPLICATION_STATUS) + self.ind = AppIndicator3.Indicator.new('azote_status_icon', '', + AppIndicator3.IndicatorCategory.APPLICATION_STATUS) self.ind.set_icon_full('/usr/share/azote/indicator_active.png', 'Tracking off') self.ind.set_attention_icon_full('/usr/share/azote/indicator_attention.png', 'Tracking on') @@ -1650,14 +1736,14 @@ self.ind.set_icon_full('/usr/share/azote/indicator_active.png', 'Tracking off') self.ind.set_menu(self.menu()) - + def menu(self): menu = Gtk.Menu() item = Gtk.MenuItem.new_with_label(common.lang['clear_unused_thumbnails']) item.connect('activate', self.clear_unused) menu.append(item) - + item = Gtk.MenuItem.new_with_label(common.lang['about_azote']) item.connect('activate', on_about_button) menu.append(item) @@ -1668,10 +1754,10 @@ item = Gtk.MenuItem.new_with_label(common.lang['exit']) item.connect('activate', destroy) menu.append(item) - + menu.show_all() return menu - + def clear_unused(self, item): clear_thumbnails() common.preview.refresh() @@ -1740,7 +1826,7 @@ border-bottom: 1px solid #333; border-right: 1px solid #333; } - + button#display-btn { font-weight: normal; font-size: 12px; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/azote/tools.py new/azote-1.9.0/azote/tools.py --- old/azote-1.8.2/azote/tools.py 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/azote/tools.py 2021-03-13 01:46:52.000000000 +0100 @@ -191,9 +191,12 @@ 'x': x_y[1], 'y': x_y[2], 'width': int(w_h[0]), - 'height': int(w_h[1])} + 'height': int(w_h[1]), + 'xrandr-idx': i} displays.append(display) log("Output found: {}".format(display), common.INFO) + + displays = sorted(displays, key=lambda x: (x.get('x'), x.get('y'))) return displays except Exception as e: @@ -496,9 +499,19 @@ def copy_backgrounds(): - # Clear current folder content + used = [] + for item in common.display_boxes_list: + fn = item.wallpaper_path.split("/")[-1] + used.append(fn) + fn = item.thumbnail_path.split("/")[-1] + used.append(fn) + + # Clear unused files for file in os.listdir(common.bcg_dir): - os.remove(os.path.join(common.bcg_dir, file)) + f2delete = os.path.join(common.bcg_dir, file) + if file not in used: + os.remove(f2delete) + # Copy manipulated (flip, split) files from the temporary folder for file in os.listdir(common.tmp_dir): shutil.copyfile(os.path.join(common.tmp_dir, file), os.path.join(common.bcg_dir, file)) @@ -761,7 +774,7 @@ self.src_path = settings.src_path else: save_needed = True - + # In case the stored wallpapers directory no longer existed if not os.path.isdir(self.src_path): self.src_path = common.sample_dir @@ -925,6 +938,19 @@ json.dump(rc, f, indent=2) +def save_json(src_dict, path): + with open(path, 'w') as f: + json.dump(src_dict, f, indent=2) + + +def load_json(path): + try: + with open(path, 'r') as f: + return json.load(f) + except Exception as e: + print(e) + + class Language(dict): def __init__(self): super().__init__() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azote-1.8.2/setup.py new/azote-1.9.0/setup.py --- old/azote-1.8.2/setup.py 2021-01-11 01:53:36.000000000 +0100 +++ new/azote-1.9.0/setup.py 2021-03-13 01:46:52.000000000 +0100 @@ -8,7 +8,7 @@ setup( name='azote', - version='1.8.2', + version='1.9.0', description='Wallpaper manager for Sway, i3 and some other WMs', packages=['azote'], include_package_data=True,
