diff mbox series

[bug#56717,v2,2/2] gnu: Add i3-autotiling.

Message ID e3150809a19f9b719c202666d8bd396fc7b03c07.1658572827.git.hako@ultrarare.space
State Accepted
Headers show
Series gnu: Add python-i3ipc and i3-autotiling. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Hilton Chain July 23, 2022, 10:31 a.m. UTC
* gnu/packages/python-xyz.scm (i3-autotiling): New variable.

Signed-off-by: Hilton Chain <hako@ultrarare.space>
---
 gnu/packages/python-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

--
2.36.1

Comments

\( July 23, 2022, 10:52 a.m. UTC | #1
On Sat Jul 23, 2022 at 11:31 AM BST, Hilton Chain wrote:
> +    (synopsis
> +     "Automatically switch the horizontal/vertical window split orientation in
> + i3 and sway")
I think a synopsis that spills onto multiple lines is probably too long.
How about simply:

(synopsis "Automatically tile windows in i3 and Sway")

> +    (description "This script uses the i3ipc-python library to switch the layout
> +splith/splitv depending on the currently focused window dimensions. It works on
> +both sway and i3 window managers.")
Maybe something like:

(description
 "This package provides a script that automatically switches the layout
of an i3 or Sway desktop based on the dimensions of the focused window.")

(By the way, that's the standard formatting for a description: the
string is on a new line.)

    -- (
M July 23, 2022, 11:01 a.m. UTC | #2
On 23-07-2022 12:31, Hilton Chain via Guix-patches via wrote:
> +    (arguments (list #:tests? #f)) ;a working X environment is needed to run the tests

You can make a working X environment with "xvfb-run -- the-test-command" 
or with (IIRC) "Xvfb :1&" + (sleep 1) (preferably the former, as the 
latter is racy) -- search with "git grep -F xvfb-run" or "git grep -F 
Xvfb" for examples.

Greetings,
Maxime.
Hilton Chain July 23, 2022, 11:38 a.m. UTC | #3
Thanks!

xvfb-run works well, however some "Fontconfig error: No writable cache directories"
occurs. I don't know what to do with this, do you have any ideas?

* Below attaching part of the build log:
---
/gnu/store/65i3nhcwmz0p8rqbg48gaavyky4g4hwk-python-3.9.9/lib/python3.9/selectors.py:469: Failed
---------------------------- Captured stderr setup -----------------------------
Fontconfig error: No writable cache directories
Fontconfig error: No writable cache directories
----------------------------- Captured stderr call -----------------------------
Fontconfig error: No writable cache directories
Fontconfig error: No writable cache directories
------------------------------ Captured log call -------------------------------
ERROR    asyncio:base_events.py:1738 Task exception was never retrieved
future: <Task finished name='Task-82' coro=<Connection.command() done, defined at /gnu/store/gwsda4lb70rzazfh0kzx9z3wx5i4z43b-python-i3ipc-2.2.1/lib/python3.9/site-packages/i3ipc/aio/connection.py:503> exception=OSError(107, 'Transport endpoint is not connected')>
Traceback (most recent call last):
  File "/gnu/store/gwsda4lb70rzazfh0kzx9z3wx5i4z43b-python-i3ipc-2.2.1/lib/python3.9/site-packages/i3ipc/aio/connection.py", line 514, in command
    data = await self._message(MessageType.COMMAND, cmd)
  File "/gnu/store/gwsda4lb70rzazfh0kzx9z3wx5i4z43b-python-i3ipc-2.2.1/lib/python3.9/site-packages/i3ipc/aio/connection.py", line 407, in _message
    await self._loop.sock_sendall(self._cmd_socket, _pack(message_type, payload))
  File "/gnu/store/65i3nhcwmz0p8rqbg48gaavyky4g4hwk-python-3.9.9/lib/python3.9/asyncio/selector_events.py", line 446, in sock_sendall
    n = sock.send(data)
OSError: [Errno 107] Transport endpoint is not connected
ERROR    asyncio:base_events.py:1738 Future exception was never retrieved
future: <Future finished exception=FileNotFoundError(2, 'No such file or directory')>
Traceback (most recent call last):
  File "/gnu/store/gwsda4lb70rzazfh0kzx9z3wx5i4z43b-python-i3ipc-2.2.1/lib/python3.9/site-packages/i3ipc/aio/connection.py", line 383, in do_reconnect
    await self.connect()
  File "/gnu/store/gwsda4lb70rzazfh0kzx9z3wx5i4z43b-python-i3ipc-2.2.1/lib/python3.9/site-packages/i3ipc/aio/connection.py", line 359, in connect
    self._cmd_socket.connect(self.socket_path)
FileNotFoundError: [Errno 2] No such file or directory
M July 23, 2022, 12:17 p.m. UTC | #4
On 23-07-2022 13:38, Hilton Chain wrote:

> xvfb-run works well, however some "Fontconfig error: No writable cache directories"
> occurs. I don't know what to do with this, do you have any ideas?

For these kind of things, creating the relevant directory and setting an 
environment variable tends to work. Maybe try (setenv "HOME" 
(getcwd)))?  However, IIUC, these fontconfig errors can usually be 
ignored (probably because it's just a cache?), likely the "Transport 
endpoint is not connected" test failure is independent.

My guess is that it tries to connect to the WM i3, but that WM is not 
running in the build environment fails.

You could give starting the WM before running the test a try, but maybe 
it's not worth the effort.

Greetings,
Maxime.
\( July 23, 2022, 12:22 p.m. UTC | #5
On Sat Jul 23, 2022 at 1:17 PM BST, Maxime Devos wrote:
> For these kind of things, creating the relevant directory and setting an 
> environment variable tends to work. Maybe try (setenv "HOME" 
> (getcwd)))?  However, IIUC, these fontconfig errors can usually be 
> ignored (probably because it's just a cache?), likely the "Transport 
> endpoint is not connected" test failure is independent.
We got this working on IRC :)

> My guess is that it tries to connect to the WM i3, but that WM is not 
> running in the build environment fails.
>
> You could give starting the WM before running the test a try, but maybe 
> it's not worth the effort.
Looks like the tests do a popen on i3 themselves:
<https://github.com/altdesktop/i3ipc-python/blob/master/test/ipctest.py#L16>



    -- (
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 2115007a97..eeeced71b7 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30225,3 +30225,29 @@  (define-public python-i3ipc
     (synopsis "Python library for controlling i3wm and sway")
     (description "An improved Python library to control i3wm and sway.")
     (license license:bsd-3)))
+
+(define-public i3-autotiling
+  (package
+    (name "i3-autotiling")
+    (version "1.6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/nwg-piotr/autotiling")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1hjlvg7095s322gb43r9g7mqlsy3pj13l827jpnbn5x0918rq9rr"))))
+    (build-system python-build-system)
+    (arguments (list #:tests? #f)) ;a working X environment is needed to run the tests
+    (native-inputs (list python-wheel))
+    (propagated-inputs (list python-i3ipc))
+    (home-page "https://github.com/nwg-piotr/autotiling")
+    (synopsis
+     "Automatically switch the horizontal/vertical window split orientation in
+ i3 and sway")
+    (description "This script uses the i3ipc-python library to switch the layout
+splith/splitv depending on the currently focused window dimensions. It works on
+both sway and i3 window managers.")
+    (license license:gpl3)))