]> git.pld-linux.org Git - packages/ueberzug.git/commitdiff
new auto/th/ueberzug-18.1.9-1
authorJan Palus <atler@pld-linux.org>
Wed, 13 Jan 2021 10:02:09 +0000 (11:02 +0100)
committerJan Palus <atler@pld-linux.org>
Wed, 13 Jan 2021 10:03:34 +0000 (11:03 +0100)
single_process_terminals.patch [new file with mode: 0644]
ueberzug.spec [new file with mode: 0644]

diff --git a/single_process_terminals.patch b/single_process_terminals.patch
new file mode 100644 (file)
index 0000000..4f604aa
--- /dev/null
@@ -0,0 +1,73 @@
+From 160481b9922acb5f183bc5cb2af675cdc508db0c Mon Sep 17 00:00:00 2001
+From: Jan Palus <atler@pld-linux.org>
+Date: Wed, 13 Jan 2021 01:57:44 +0100
+Subject: [PATCH] add support for single process terminals
+
+some terminals (urxvt in daemon mode, mate-terminal) consist of single
+process having multiple X windows. This in turn breaks ueberzug which
+requires 1:1 mapping between PID and window id. If present use WINDOWID
+environment variable set by those terminals as a direct pointer to
+window which should be target for displayed image.
+---
+ ueberzug/xutil.py | 24 +++++++++++++++++++-----
+ 1 file changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/ueberzug/xutil.py b/ueberzug/xutil.py
+index 2c6c871..6864aa4 100644
+--- a/ueberzug/xutil.py
++++ b/ueberzug/xutil.py
+@@ -1,6 +1,7 @@
+ """This module contains x11 utils"""
+ import functools
+ import asyncio
++import os
+ import Xlib
+ import Xlib.display as Xdisplay
+@@ -84,6 +85,16 @@ def get_pid_by_window_id(display: Xdisplay.Display, window_id: int):
+             else None)
++def get_visible_window_ids(display: Xdisplay.Display = None):
++    d = display or get_display()
++    try:
++        return d.screen().root.get_full_property(
++                    d.intern_atom('_NET_CLIENT_LIST'),
++                    Xlib.X.AnyPropertyType).value
++    finally:
++        if not display:
++            d.close()
++
+ def get_pid_window_id_map():
+     """Determines the pid of each mapped window.
+@@ -92,11 +103,7 @@ def get_pid_window_id_map():
+     """
+     with get_display() as display:
+         root = display.screen().root
+-        visible_window_ids = \
+-            (root.get_full_property(
+-                display.intern_atom('_NET_CLIENT_LIST'),
+-                Xlib.X.AnyPropertyType)
+-             .value)
++        visible_window_ids = get_visible_window_ids(display)
+         return {**{
+             get_pid_by_window_id(display, window.id): window.id
+             for window in root.query_tree().children
+@@ -159,6 +166,13 @@ def get_parent_window_infos():
+     Returns:
+         list of TerminalWindowInfo
+     """
++
++    window_id = os.getenv('WINDOWID')
++
++    if window_id and window_id.isnumeric() and int(window_id) in get_visible_window_ids():
++        pty = get_first_pty(get_parent_pids(process.get_own_pid()))
++        return [TerminalWindowInfo(int(window_id), pty)]
++
+     window_infos = []
+     client_pids = {}
+-- 
+2.30.0
+
diff --git a/ueberzug.spec b/ueberzug.spec
new file mode 100644 (file)
index 0000000..4320ee0
--- /dev/null
@@ -0,0 +1,47 @@
+Summary:       Command line util which allows to draw images on terminals
+Name:          ueberzug
+Version:       18.1.9
+Release:       1
+License:       GPL v3+
+Group:         X11/Applications/Graphics
+Source0:       https://github.com/seebye/ueberzug/archive/%{version}/%{name}-%{version}.tar.gz 
+# Source0-md5: 9d6ee6e2ef75c68e318bdb224be71af1
+URL:           https://github.com/seebye/ueberzug
+Patch0:                single_process_terminals.patch
+BuildRequires: python3-modules >= 1:3.2
+BuildRequires: python3-setuptools
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.720
+BuildRequires: xorg-lib-libX11-devel
+BuildRequires: xorg-lib-libXext-devel
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Ɯberzug is a command line util which allows to draw images on
+terminals by using child windows.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+%py3_build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%py3_install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc README.md
+%attr(755,root,root) %{_bindir}/ueberzug
+%attr(755,root,root) %{py3_sitedir}/Xshm.cpython-3*.so
+%dir %{py3_sitedir}/ueberzug
+%{py3_sitedir}/ueberzug/*.py
+%{py3_sitedir}/ueberzug/__pycache__
+%{py3_sitedir}/ueberzug-%{version}-py*.egg-info
+%{py3_sitedir}/ueberzug/lib
This page took 0.096649 seconds and 4 git commands to generate.