Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package nwg-displays for openSUSE:Factory checked in at 2023-10-02 20:05:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nwg-displays (Old) and /work/SRC/openSUSE:Factory/.nwg-displays.new.28202 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nwg-displays" Mon Oct 2 20:05:13 2023 rev:2 rq:1114464 version:0.3.8 Changes: -------- --- /work/SRC/openSUSE:Factory/nwg-displays/nwg-displays.changes 2023-07-31 15:24:18.831304981 +0200 +++ /work/SRC/openSUSE:Factory/.nwg-displays.new.28202/nwg-displays.changes 2023-10-02 20:06:48.787552574 +0200 @@ -1,0 +2,8 @@ +Fri Sep 29 23:50:37 UTC 2023 - Muhammad Akbar Yanuar Mantari <mantari...@pm.me> + +- Update to version 0.3.8 + + Added popup & countdown timer to restore from improper settings + ; close +- Simplify spec source url and requires typelib GtkLayerShell + +------------------------------------------------------------------- Old: ---- nwg-displays-0.3.7.tar.gz New: ---- nwg-displays-0.3.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nwg-displays.spec ++++++ --- /var/tmp/diff_new_pack.mMZunl/_old 2023-10-02 20:06:49.771587962 +0200 +++ /var/tmp/diff_new_pack.mMZunl/_new 2023-10-02 20:06:49.775588106 +0200 @@ -17,12 +17,12 @@ Name: nwg-displays -Version: 0.3.7 +Version: 0.3.8 Release: 0 Summary: A GTK3 wrapper to display text on the desktop for wlroots License: MIT URL: https://github.com/nwg-piotr/nwg-displays -Source0: https://github.com/nwg-piotr/nwg-displays/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: gtk-layer-shell-devel BuildRequires: pkgconfig BuildRequires: python3-devel @@ -31,7 +31,7 @@ Requires: libgtk-layer-shell0 Requires: python3-gobject Requires: python3-i3ipc -Requires: typelib-1_0-GtkLayerShell-0_1 +Requires: typelib(GtkLayerShell) Recommends: wlr-randr BuildArch: noarch ++++++ nwg-displays-0.3.7.tar.gz -> nwg-displays-0.3.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-displays-0.3.7/flake.nix new/nwg-displays-0.3.8/flake.nix --- old/nwg-displays-0.3.7/flake.nix 2023-07-13 03:26:32.000000000 +0200 +++ new/nwg-displays-0.3.8/flake.nix 2023-09-28 01:28:29.000000000 +0200 @@ -32,6 +32,7 @@ ]; propagatedBuildInputs = with pkgs; [ + wlr-randr pango gtk-layer-shell gdk-pixbuf diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-displays-0.3.7/nwg_displays/langs/en_US.json new/nwg-displays-0.3.8/nwg_displays/langs/en_US.json --- old/nwg-displays-0.3.7/nwg_displays/langs/en_US.json 2023-07-13 03:26:32.000000000 +0200 +++ new/nwg-displays-0.3.8/nwg_displays/langs/en_US.json 2023-09-28 01:28:29.000000000 +0200 @@ -7,11 +7,14 @@ "custom-mode": "Custom mode", "custom-mode-tooltip": "Adds '--custom' argument to set a mode \nnot listed in the list of available modes.\nUse this ONLY if you know what you're doing.", "dpms-tooltip": "Enables or disables output via DPMS. \nTo turn an output off (ie. blank the screen \nbut keep workspaces as-is), one can set DPMS to off.", + "keep": "Keep", + "keep-current-settings": "Keep current settings", "modes": "Modes", "modes-tooltip": "Displays a list of available \noutput modes to choose from.", "none": "None", "position-x": "Position X", "refresh": "Refresh", + "restore": "Restore", "scale": "Scale", "scale-filter": "Scale filter", "scale-filter-tooltip": "'Linear' is smoother and blurrier, 'nearest' is sharper and blockier.\nSetting 'smart' will apply nearest when the output has an integer\nscale factor, otherwise linear.", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-displays-0.3.7/nwg_displays/langs/pl_PL.json new/nwg-displays-0.3.8/nwg_displays/langs/pl_PL.json --- old/nwg-displays-0.3.7/nwg_displays/langs/pl_PL.json 2023-07-13 03:26:32.000000000 +0200 +++ new/nwg-displays-0.3.8/nwg_displays/langs/pl_PL.json 2023-09-28 01:28:29.000000000 +0200 @@ -7,11 +7,14 @@ "custom-mode": "Tryb niestandardowy", "custom-mode-tooltip": "Dodaje argument '--custom', by ustawiÄ tryb \nnie wystÄpujÄ cy na liÅcie dostÄpnych trybów.\nUżywaj TYLKO gdy dobrze wiesz co robisz.", "dpms-tooltip": "WÅÄ cza lub wyÅÄ cza wyjÅcie przez DPMS.\nAby wyÅÄ czyÄ wyjÅcie (tj. wygasiÄ ekran, ale zachowaÄ\nobszary robocze bez zmian), można wyÅÄ czyÄ DPMS.", + "keep": "Zachowaj", + "keep-current-settings": "ZachowaÄ bieÅ¼Ä ce ustawienia", "modes": "Tryby", "modes-tooltip": "WyÅwietla do wyboru listÄ dostÄpnych trybów.", "none": "Brak", "position-x": "Pozycja X", - "refresh": "OdÅwież.", + "refresh": "OdÅwież", + "restore": "PrzywróÄ", "scale": "Skala", "scale-filter": "Filtr skalowania", "scale-filter-tooltip": "'Linear' jest gÅadszy i bardziej rozmyty, 'nearest' jest ostrzejszy i blokowy.\nUstawienie 'smart' zastosuje 'nearest' gdy wyjÅcie na caÅkowity wspóÅczynnik\nskalowania w przeciwnym razie - 'linear'.", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-displays-0.3.7/nwg_displays/langs/ru_RU.json new/nwg-displays-0.3.8/nwg_displays/langs/ru_RU.json --- old/nwg-displays-0.3.7/nwg_displays/langs/ru_RU.json 2023-07-13 03:26:32.000000000 +0200 +++ new/nwg-displays-0.3.8/nwg_displays/langs/ru_RU.json 2023-09-28 01:28:29.000000000 +0200 @@ -7,11 +7,14 @@ "custom-mode": "ÐолÑзоваÑелÑÑкий Ñежим", "custom-mode-tooltip": "ÐобавлÑÐµÑ Ð°ÑгÑÐ¼ÐµÐ½Ñ '--custom' Ð´Ð»Ñ ÑÐºÐ°Ð·Ð°Ð½Ð¸Ñ Ñежима, \nоÑÑÑÑÑÑвÑÑÑего в ÑпиÑке. ÐÑполÑзÑйÑе ÑÑÑ Ð¾Ð¿ÑÐ¸Ñ \nТÐÐЬÐРеÑли Ð²Ñ Ð·Ð½Ð°ÐµÑе, ÑÑо делаеÑе.", "dpms-tooltip": "ÐклÑÑение или вÑклÑÑение вÑвода ÑеÑез DPMS. ЧÑÐ¾Ð±Ñ Ð¾ÑклÑÑиÑÑ Ð²Ñвод \n(Ñ.е. оÑклÑÑиÑÑ ÑкÑан, но оÑÑавиÑÑ ÑабоÑие пÑоÑÑÑанÑÑва без изменений), Ð²Ñ Ð¼Ð¾Ð¶ÐµÑе оÑклÑÑиÑÑ DPMS.", + "keep": "Ð¡Ð¾Ñ ÑаниÑÑ", + "keep-current-settings": "Ð¡Ð¾Ñ ÑаниÑÑ ÑекÑÑие наÑÑÑойки", "modes": "РежимÑ", "modes-tooltip": "СпиÑок доÑÑÑпнÑÑ Ñежимов вÑвода.", "none": "ÐеÑ", "position-x": "ÐозиÑÐ¸Ñ X", "refresh": "ЧаÑÑоÑа обновлениÑ", + "restore": "ÐоÑÑÑановиÑÑ", "scale": "ÐаÑÑÑаб", "scale-filter": "ФилÑÑÑ Ð¼Ð°ÑÑÑабиÑованиÑ", "scale-filter-tooltip": "'Linear' более мÑкгий и ÑазмÑÑÑй, 'nearest' более Ñезкий и блоÑнÑй.\nÐпÑÐ¸Ñ 'smart' пÑÐ¸Ð¼ÐµÐ½Ð¸Ñ nearest пÑи иÑполÑзовании ÑелоÑиÑленного \nмаÑÑÑабиÑованиÑ, в оÑÑалÑнÑÑ ÑлÑÑаÑÑ linear.", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-displays-0.3.7/nwg_displays/main.py new/nwg-displays-0.3.8/nwg_displays/main.py --- old/nwg-displays-0.3.7/nwg_displays/main.py 2023-07-13 03:26:32.000000000 +0200 +++ new/nwg-displays-0.3.8/nwg_displays/main.py 2023-09-28 01:28:29.000000000 +0200 @@ -16,6 +16,7 @@ import argparse import os.path import sys +import time import gi @@ -94,6 +95,9 @@ form_mirror = None dialog_win = None +confirm_win = None +src_tag = 0 +counter = 0 """ We need to rebuild the modes GtkComboBoxText on each DisplayButton click. Unfortunately appending an item fires the @@ -275,7 +279,10 @@ def update_form_from_widget(widget): form_name.set_text(widget.name) - form_description.set_text(widget.description) + if len(widget.description) > 48: + form_description.set_text(f"{widget.description[:47]}(â¦)") + else: + form_description.set_text(widget.description) form_dpms.set_active(widget.dpms) form_adaptive_sync.set_active(widget.adaptive_sync) form_custom_mode.set_active(widget.custom_mode) @@ -765,6 +772,196 @@ close_dialog(w, win) +def apply_settings(display_buttons, outputs_activity, outputs_path, use_desc=False): + now = datetime.datetime.now() + lines = ["# Generated by nwg-displays on {} at {}. Do not edit manually.\n".format( + datetime.datetime.strftime(now, '%Y-%m-%d'), + datetime.datetime.strftime(now, '%H:%M:%S'))] + cmds = [] + db_names = [] + # just active outputs have their buttons + if os.getenv("SWAYSOCK"): + for db in display_buttons: + name = db.name if not use_desc else db.description + db_names.append(name) + + lines.append('output "%s" {' % name) + cmd = 'output "{}"'.format(name) + + custom_mode_str = "--custom" if db.custom_mode else "" + lines.append( + " mode {} {}x{}@{}Hz".format(custom_mode_str, db.physical_width, db.physical_height, db.refresh)) + cmd += " mode {} {}x{}@{}Hz".format(custom_mode_str, db.physical_width, db.physical_height, db.refresh) + + lines.append(" pos {} {}".format(db.x, db.y)) + cmd += " pos {} {}".format(db.x, db.y) + + lines.append(" transform {}".format(db.transform)) + cmd += " transform {}".format(db.transform) + + lines.append(" scale {}".format(db.scale)) + cmd += " scale {}".format(db.scale) + + lines.append(" scale_filter {}".format(db.scale_filter)) + cmd += " scale_filter {}".format(db.scale_filter) + + a_s = "on" if db.adaptive_sync else "off" + lines.append(" adaptive_sync {}".format(a_s)) + cmd += " adaptive_sync {}".format(a_s) + + dpms = "on" if db.dpms else "off" + lines.append(" dpms {}".format(dpms)) + cmd += " dpms {}".format(dpms) + + lines.append("}") + cmds.append(cmd) + + if not use_desc: + for key in outputs_activity: + if key not in db_names: + lines.append('output "{}" disable'.format(key)) + cmds.append('output "{}" disable'.format(key)) + else: + for key in outputs_activity: + desc = inactive_output_description(key) + if desc not in db_names: + lines.append('output "{}" disable'.format(desc)) + cmds.append('output "{}" disable'.format(desc)) + + print("[Saving]") + for line in lines: + print(line) + + backup = load_text_file(outputs_path).splitlines() + save_list_to_text_file(lines, outputs_path) + + print("[Executing]") + for cmd in cmds: + print(cmd) + + i3 = Connection() + for cmd in cmds: + i3.command(cmd) + + create_confirm_win(backup, outputs_path) + + elif os.getenv("HYPRLAND_INSTANCE_SIGNATURE"): + transforms = {"normal": 0, "90": 1, "180": 2, "270": 3, "flipped": 4, "flipped-90": 5, "flipped-180": 6, + "flipped-270": 7} + for db in display_buttons: + name = db.name if not use_desc else "desc:{}".format(db.description) + db_names.append(name) + + if not db.mirror: + lines.append( + "monitor={},{}x{}@{},{}x{},{}".format(name, db.physical_width, db.physical_height, db.refresh, db.x, + db.y, db.scale)) + else: + lines.append( + "monitor={},{}x{}@{},{}x{},{},mirror,{}".format(name, db.physical_width, db.physical_height, + db.refresh, db.x, db.y, db.scale, db.mirror)) + if db.transform != "normal": + lines.append("monitor={},transform,{}".format(name, transforms[db.transform])) + + if name in outputs_activity and not outputs_activity[name]: + lines.append("monitor={},disable".format(name)) + + print("[Saving]") + for line in lines: + print(line) + + backup = load_text_file(outputs_path).splitlines() + save_list_to_text_file(lines, outputs_path) + create_confirm_win(backup, outputs_path) + + +def create_confirm_win(backup, path): + global confirm_win + if confirm_win: + confirm_win.destroy() + confirm_win = Gtk.Window() + confirm_win.set_resizable(False) + confirm_win.set_modal(True) + grid = Gtk.Grid() + grid.set_column_spacing(12) + grid.set_row_spacing(12) + grid.set_column_homogeneous(True) + grid.set_property("margin", 12) + confirm_win.add(grid) + lbl = Gtk.Label.new("{}?".format(voc["keep-current-settings"])) + grid.attach(lbl, 0, 0, 2, 1) + + cnt_lbl = Gtk.Label.new("10") + grid.attach(cnt_lbl, 0, 1, 2, 1) + btn_restore = Gtk.Button.new_with_label(voc["restore"]) + + btn_restore.connect("clicked", restore_old_settings, backup, path) + + grid.attach(btn_restore, 0, 2, 1, 1) + btn_keep = Gtk.Button.new_with_label(voc["keep"]) + btn_keep.connect("clicked", keep_current_settings) + grid.attach(btn_keep, 1, 2, 1, 1) + + confirm_win.show_all() + + global counter + counter = 10 + global src_tag + src_tag = GLib.timeout_add_seconds(1, count_down, cnt_lbl, backup, path) + + +def count_down(label, backup, path): + global counter + if counter > 0: + counter -= 1 + label.set_text(str(counter)) + return True + + restore_old_settings(None, backup, path) + + +def keep_current_settings(btn): + if src_tag > 0: + GLib.Source.remove(src_tag) + confirm_win.close() + + +def restore_old_settings(btn, backup, path): + print("Restoring old settings...") + if src_tag > 0: + GLib.Source.remove(src_tag) + + if os.getenv("SWAYSOCK"): + save_list_to_text_file(backup, path) + + # Parse backup file back to commands and execute them + single_line = "" + # omit comments & empty lines + for line in backup: + if not line.startswith("#") and line: + single_line += line + # remove "{" + single_line = single_line.replace("{", "") + # convert multiple spaces into single + single_line = ' '.join(single_line.split()) + cmds = single_line.split("}") + # execute line by line + i3 = Connection() + for cmd in cmds: + if cmd: + i3.command(cmd) + + confirm_win.close() + create_display_buttons() + + elif os.getenv("HYPRLAND_INSTANCE_SIGNATURE"): + save_list_to_text_file(backup, path) + confirm_win.close() + # Don't execute any command here, just save the file and wait for Hyprland to notice and apply the change. + # Let's give it some time to do it before refreshing UI. + GLib.timeout_add(2000, create_display_buttons) + + def main(): GLib.set_prgname('nwg-displays') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-displays-0.3.7/nwg_displays/tools.py new/nwg-displays-0.3.8/nwg_displays/tools.py --- old/nwg-displays-0.3.7/nwg_displays/tools.py 2023-07-13 03:26:32.000000000 +0200 +++ new/nwg-displays-0.3.8/nwg_displays/tools.py 2023-09-28 01:28:29.000000000 +0200 @@ -263,102 +263,7 @@ return "90" in transform or "270" in transform -def apply_settings(display_buttons, outputs_activity, outputs_path, use_desc=False): - now = datetime.datetime.now() - lines = ["# Generated by nwg-displays on {} at {}. Do not edit manually.\n".format( - datetime.datetime.strftime(now, '%Y-%m-%d'), - datetime.datetime.strftime(now, '%H:%M:%S'))] - cmds = [] - db_names = [] - # just active outputs have their buttons - if os.getenv("SWAYSOCK"): - for db in display_buttons: - name = db.name if not use_desc else db.description - db_names.append(name) - lines.append('output "%s" {' % name) - cmd = 'output "{}"'.format(name) - - custom_mode_str = "--custom" if db.custom_mode else "" - lines.append( - " mode {} {}x{}@{}Hz".format(custom_mode_str, db.physical_width, db.physical_height, db.refresh)) - cmd += " mode {} {}x{}@{}Hz".format(custom_mode_str, db.physical_width, db.physical_height, db.refresh) - - lines.append(" pos {} {}".format(db.x, db.y)) - cmd += " pos {} {}".format(db.x, db.y) - - lines.append(" transform {}".format(db.transform)) - cmd += " transform {}".format(db.transform) - - lines.append(" scale {}".format(db.scale)) - cmd += " scale {}".format(db.scale) - - lines.append(" scale_filter {}".format(db.scale_filter)) - cmd += " scale_filter {}".format(db.scale_filter) - - a_s = "on" if db.adaptive_sync else "off" - lines.append(" adaptive_sync {}".format(a_s)) - cmd += " adaptive_sync {}".format(a_s) - - dpms = "on" if db.dpms else "off" - lines.append(" dpms {}".format(dpms)) - cmd += " dpms {}".format(dpms) - - lines.append("}") - cmds.append(cmd) - - if not use_desc: - for key in outputs_activity: - if key not in db_names: - lines.append('output "{}" disable'.format(key)) - cmds.append('output "{}" disable'.format(key)) - else: - for key in outputs_activity: - desc = inactive_output_description(key) - if desc not in db_names: - lines.append('output "{}" disable'.format(desc)) - cmds.append('output "{}" disable'.format(desc)) - - print("[Saving]") - for line in lines: - print(line) - - save_list_to_text_file(lines, outputs_path) - - print("[Executing]") - for cmd in cmds: - print(cmd) - - i3 = Connection() - for cmd in cmds: - i3.command(cmd) - - elif os.getenv("HYPRLAND_INSTANCE_SIGNATURE"): - transforms = {"normal": 0, "90": 1, "180": 2, "270": 3, "flipped": 4, "flipped-90": 5, "flipped-180": 6, - "flipped-270": 7} - for db in display_buttons: - name = db.name if not use_desc else "desc:{}".format(db.description) - db_names.append(name) - - if not db.mirror: - lines.append( - "monitor={},{}x{}@{},{}x{},{}".format(name, db.physical_width, db.physical_height, db.refresh, db.x, - db.y, db.scale)) - else: - lines.append( - "monitor={},{}x{}@{},{}x{},{},mirror,{}".format(name, db.physical_width, db.physical_height, - db.refresh, db.x, db.y, db.scale, db.mirror)) - if db.transform != "normal": - lines.append("monitor={},transform,{}".format(name, transforms[db.transform])) - - if name in outputs_activity and not outputs_activity[name]: - lines.append("monitor={},disable".format(name)) - - print("[Saving]") - for line in lines: - print(line) - - save_list_to_text_file(lines, outputs_path) def inactive_output_description(name): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nwg-displays-0.3.7/setup.py new/nwg-displays-0.3.8/setup.py --- old/nwg-displays-0.3.7/setup.py 2023-07-13 03:26:32.000000000 +0200 +++ new/nwg-displays-0.3.8/setup.py 2023-09-28 01:28:29.000000000 +0200 @@ -9,7 +9,7 @@ setup( name='nwg-displays', - version='0.3.7', + version='0.3.8', description='nwg-shell output configuration utility', packages=find_packages(), include_package_data=True,