terminator-dbus 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. terminator_dbus-0.1.0/AI_POLICY.md +15 -0
  2. terminator_dbus-0.1.0/CHANGELOG.md +16 -0
  3. terminator_dbus-0.1.0/CODE_OF_CONDUCT.md +84 -0
  4. terminator_dbus-0.1.0/CONTRIBUTING.md +112 -0
  5. terminator_dbus-0.1.0/LICENSE +15 -0
  6. terminator_dbus-0.1.0/PKG-INFO +159 -0
  7. terminator_dbus-0.1.0/README.md +126 -0
  8. terminator_dbus-0.1.0/config/coverage.ini +25 -0
  9. terminator_dbus-0.1.0/config/git-changelog.toml +9 -0
  10. terminator_dbus-0.1.0/config/pytest.ini +16 -0
  11. terminator_dbus-0.1.0/config/ruff.toml +76 -0
  12. terminator_dbus-0.1.0/config/ty.toml +6 -0
  13. terminator_dbus-0.1.0/config/vscode/launch.json +56 -0
  14. terminator_dbus-0.1.0/config/vscode/settings.json +31 -0
  15. terminator_dbus-0.1.0/config/vscode/tasks.json +97 -0
  16. terminator_dbus-0.1.0/config/zed/debug.json +44 -0
  17. terminator_dbus-0.1.0/config/zed/settings.json +43 -0
  18. terminator_dbus-0.1.0/config/zed/tasks.json +72 -0
  19. terminator_dbus-0.1.0/docs/.overrides/main.html +18 -0
  20. terminator_dbus-0.1.0/docs/.overrides/partials/comments.html +57 -0
  21. terminator_dbus-0.1.0/docs/changelog.md +5 -0
  22. terminator_dbus-0.1.0/docs/code_of_conduct.md +5 -0
  23. terminator_dbus-0.1.0/docs/contributing.md +5 -0
  24. terminator_dbus-0.1.0/docs/credits.md +9 -0
  25. terminator_dbus-0.1.0/docs/css/apidocs.css +21 -0
  26. terminator_dbus-0.1.0/docs/index.md +7 -0
  27. terminator_dbus-0.1.0/docs/js/feedback.js +14 -0
  28. terminator_dbus-0.1.0/docs/license.md +11 -0
  29. terminator_dbus-0.1.0/docs/reference/api.md +7 -0
  30. terminator_dbus-0.1.0/duties.py +248 -0
  31. terminator_dbus-0.1.0/pyproject.toml +113 -0
  32. terminator_dbus-0.1.0/scripts/gen_credits.py +196 -0
  33. terminator_dbus-0.1.0/scripts/get_version.py +49 -0
  34. terminator_dbus-0.1.0/scripts/make +1 -0
  35. terminator_dbus-0.1.0/scripts/make.py +250 -0
  36. terminator_dbus-0.1.0/src/terminator_dbus/__init__.py +29 -0
  37. terminator_dbus-0.1.0/src/terminator_dbus/__main__.py +32 -0
  38. terminator_dbus-0.1.0/src/terminator_dbus/_internal/__init__.py +17 -0
  39. terminator_dbus-0.1.0/src/terminator_dbus/_internal/cli.py +74 -0
  40. terminator_dbus-0.1.0/src/terminator_dbus/_internal/client.py +294 -0
  41. terminator_dbus-0.1.0/src/terminator_dbus/_internal/debug.py +125 -0
  42. terminator_dbus-0.1.0/src/terminator_dbus/py.typed +0 -0
  43. terminator_dbus-0.1.0/tests/__init__.py +25 -0
  44. terminator_dbus-0.1.0/tests/conftest.py +19 -0
  45. terminator_dbus-0.1.0/tests/test_api.py +201 -0
  46. terminator_dbus-0.1.0/tests/test_cli.py +70 -0
  47. terminator_dbus-0.1.0/tests/test_client.py +237 -0
  48. terminator_dbus-0.1.0/zensical.toml +186 -0
@@ -0,0 +1,15 @@
1
+ # AI Contribution Policy
2
+
3
+ We accept AI-*assisted* contributions, both for code and documentation, with the following expectations:
4
+
5
+ - AI-assisted contributions must disclaim their use of AI.
6
+ - Contributors must fully understand the proposed changes and be able to explain why they are the correct approach.
7
+ - Issues must be created before creating pull requests (unless there is already a relevant issue).
8
+ - Issue and pull request templates must be followed.
9
+ - Comments (including bodies) in issues and pull requests must be written by humans. If you use LLMs to translate from one language to another, please include your original comment and the translated one.
10
+ - Git commits must be authored by humans, not AI/bot accounts or identities.
11
+ - Git commit messages must be written by humans, in English. If you cannot write English, please state so in the pull request body and we will write the commit messages ourselves.
12
+
13
+ Failure to comply with any of these requirements will result in issues or pull requests being closed immediately without comment. Repeated violations of this policy will result in a ban of the offending accounts/identities from contributing to this project and any related project from the same author/organization.
14
+
15
+ We do not accept AI-generated content in community spaces we maintain or moderate, such as GitHub discussions or Matrix rooms.
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
+
8
+ <!-- insertion marker -->
9
+ ## [0.1.0](https://github.com/pawamoy/terminator-dbus/releases/tag/0.1.0) - 2026-09-26
10
+
11
+ <small>[Compare with first commit](https://github.com/pawamoy/terminator-dbus/compare/a9264b4e46ff2d7602c587aa3da07d0d73b3be89...0.1.0)</small>
12
+
13
+ ### Features
14
+
15
+ - Implement Python interface to Terminator ([05d5b03](https://github.com/pawamoy/terminator-dbus/commit/05d5b0304b5e1283e5fede7b8732420a4c6f0218) by Timothée Mazzucotelli).
16
+ - Generate project with copier-uv template ([a9264b4](https://github.com/pawamoy/terminator-dbus/commit/a9264b4e46ff2d7602c587aa3da07d0d73b3be89) by Timothée Mazzucotelli).
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ * Trolling, insulting or derogatory comments, and personal or political attacks
23
+ * Public or private harassment
24
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at dev@pawamoy.fr. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact**: A violation through a single incident or series of actions.
56
+
57
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62
+
63
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74
+
75
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
76
+
77
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
78
+
79
+ [homepage]: https://www.contributor-covenant.org
80
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
81
+ [Mozilla CoC]: https://github.com/mozilla/diversity
82
+ [FAQ]: https://www.contributor-covenant.org/faq
83
+ [translations]: https://www.contributor-covenant.org/translations
84
+
@@ -0,0 +1,112 @@
1
+ # Contributing
2
+
3
+ Contributions are welcome, and they are greatly appreciated. Every little bit helps, and credit will always be given.
4
+
5
+ **Please always create an issue before working on a new feature or a bug fix, so that we can discuss the implementation and make sure that your work will be merged.**
6
+
7
+ ## Environment setup
8
+
9
+ Install [uv](https://github.com/astral-sh/uv) and [direnv](https://direnv.net/), fork and clone the repository, then:
10
+
11
+ ```bash
12
+ cd terminator-dbus
13
+ direnv allow
14
+ make setup
15
+ ```
16
+
17
+ You now have the dependencies installed.
18
+
19
+ You can run the application with `make run terminator-dbus [ARGS...]`.
20
+
21
+ Run `make help` to see all the available actions!
22
+
23
+ ## Tasks
24
+
25
+ The entry-point to run commands and tasks is the `make` Python script, located in the `scripts` directory. Try running `make` to show the available commands and tasks. The *commands* do not need the Python dependencies to be installed, while the *tasks* do. The cross-platform tasks are written in Python, thanks to [duty](https://github.com/pawamoy/duty).
26
+
27
+ If you work in VSCode, we provide [an action to configure VSCode](https://pawamoy.github.io/copier-uv/work/#vscode-setup) for the project.
28
+
29
+ ## Development
30
+
31
+ As usual:
32
+
33
+ 1. create a new branch: `git switch -c feature-or-bugfix-name`
34
+ 1. edit the code and/or the documentation
35
+
36
+ **Before committing:**
37
+
38
+ 1. run `make format` to auto-format the code
39
+ 1. run `make check` to check everything (fix any warning)
40
+ 1. run `make test` to run the tests (fix any issue)
41
+ 1. if you updated the documentation or the project dependencies:
42
+ 1. run `make docs`
43
+ 1. go to http://localhost:8000 and check that everything looks good
44
+ 1. follow our [commit message convention](#commit-message-convention)
45
+
46
+ If you are unsure about how to fix or ignore a warning, just let the continuous integration fail, and we will help you during review.
47
+
48
+ Don't bother updating the changelog, we will take care of this.
49
+
50
+ ## Commit message convention
51
+
52
+ Commit messages must follow our convention based on the [Angular style](https://gist.github.com/stephenparish/9941e89d80e2bc58a153#format-of-the-commit-message) or the [Karma convention](https://karma-runner.github.io/4.0/dev/git-commit-msg.html):
53
+
54
+ ```
55
+ <type>[(scope)]: Subject
56
+
57
+ [Body]
58
+ ```
59
+
60
+ **Subject and body must be valid Markdown.** Subject must have proper casing (uppercase for first letter if it makes sense), but no dot at the end, and no punctuation in general.
61
+
62
+ Scope and body are optional. Type can be:
63
+
64
+ - `build`: About packaging, building wheels, etc.
65
+ - `chore`: About packaging or repo/files management.
66
+ - `ci`: About Continuous Integration.
67
+ - `deps`: Dependencies update.
68
+ - `docs`: About documentation.
69
+ - `feat`: New feature.
70
+ - `fix`: Bug fix.
71
+ - `perf`: About performance.
72
+ - `refactor`: Changes that are not features or bug fixes.
73
+ - `style`: A change in code style/format.
74
+ - `tests`: About tests.
75
+
76
+ If you write a body, please add trailers at the end (for example issues and PR references, or co-authors), without relying on GitHub's flavored Markdown:
77
+
78
+ ```
79
+ Body.
80
+
81
+ Issue #10: https://github.com/namespace/project/issues/10
82
+ Related to PR namespace/other-project#15: https://github.com/namespace/other-project/pull/15
83
+ ```
84
+
85
+ These "trailers" must appear at the end of the body, without any blank lines between them. The trailer title can contain any character except colons `:`. We expect a full URI for each trailer, not just GitHub autolinks (for example, full GitHub URLs for commits and issues, not the hash or the #issue-number).
86
+
87
+ We do not enforce a line length on commit messages summary and body, but please avoid very long summaries, and very long lines in the body, unless they are part of code blocks that must not be wrapped.
88
+
89
+ ## Pull requests guidelines
90
+
91
+ Link to any related issue in the Pull Request message.
92
+
93
+ During the review, we recommend using fixups:
94
+
95
+ ```bash
96
+ # SHA is the SHA of the commit you want to fix
97
+ git commit --fixup=SHA
98
+ ```
99
+
100
+ Once all the changes are approved, you can squash your commits:
101
+
102
+ ```bash
103
+ git rebase -i --autosquash main
104
+ ```
105
+
106
+ And force-push:
107
+
108
+ ```bash
109
+ git push -f
110
+ ```
111
+
112
+ If this seems all too complicated, you can push or force-push each new commit, and we will squash them ourselves if needed, before merging.
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026, Timothée Mazzucotelli and contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: terminator-dbus
3
+ Version: 0.1.0
4
+ Summary: Python library to interact with Terminator through D-Bus.
5
+ Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
6
+ License-Expression: ISC
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Documentation
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Utilities
21
+ Classifier: Typing :: Typed
22
+ Project-URL: Homepage, https://pawamoy.github.io/terminator-dbus
23
+ Project-URL: Documentation, https://pawamoy.github.io/terminator-dbus
24
+ Project-URL: Changelog, https://pawamoy.github.io/terminator-dbus/changelog
25
+ Project-URL: Repository, https://github.com/pawamoy/terminator-dbus
26
+ Project-URL: Issues, https://github.com/pawamoy/terminator-dbus/issues
27
+ Project-URL: Discussions, https://github.com/pawamoy/terminator-dbus/discussions
28
+ Project-URL: Gitter, https://gitter.im/terminator-dbus/community
29
+ Project-URL: Funding, https://github.com/sponsors/pawamoy
30
+ Requires-Python: >=3.10
31
+ Requires-Dist: dbus-python>=1.3.2
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Terminator D-Bus
35
+
36
+
37
+ [![ci](https://github.com/pawamoy/terminator-dbus/workflows/ci/badge.svg)](https://github.com/pawamoy/terminator-dbus/actions?query=workflow%3Aci)
38
+ [![documentation](https://img.shields.io/badge/docs-zensical-FF9100.svg?style=flat)](https://pawamoy.github.io/terminator-dbus/)
39
+ [![pypi version](https://img.shields.io/pypi/v/terminator-dbus.svg)](https://pypi.org/project/terminator-dbus/)
40
+ [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#terminator-dbus:gitter.im)
41
+
42
+
43
+ Python library to interact with Terminator through D-Bus.
44
+
45
+
46
+ ## Installation
47
+
48
+
49
+ ```bash
50
+ pip install terminator-dbus
51
+ ```
52
+
53
+
54
+ With [`uv`](https://docs.astral.sh/uv/):
55
+
56
+
57
+ ```bash
58
+ uv tool install terminator-dbus
59
+ ```
60
+
61
+
62
+ `dbus-python` needs the D-Bus development files when no system package or wheel is available.
63
+
64
+
65
+ ## Usage
66
+
67
+
68
+ Create one client and reuse it for all calls:
69
+
70
+
71
+ ```python
72
+ from terminator_dbus import Terminator
73
+
74
+ terminator = Terminator()
75
+ terminal = terminator.get_focused_terminal()
76
+
77
+ if terminal is not None:
78
+ new_terminal = terminator.vsplit(
79
+ terminal,
80
+ {"execute": "htop", "title": "Processes"},
81
+ )
82
+ terminator.switch_profile(new_terminal, {"profile": "work"})
83
+ ```
84
+
85
+
86
+ The client uses the current X11 or Wayland display by default. Pass `display` if the current environment does not identify the correct display:
87
+
88
+
89
+ ```python
90
+ terminator = Terminator(display=":1")
91
+ ```
92
+
93
+
94
+ Pass `bus_name` when you already know the complete D-Bus service name:
95
+
96
+
97
+ ```python
98
+ terminator = Terminator(bus_name="net.tenshu.Terminator2...")
99
+ ```
100
+
101
+
102
+ `dbus.DBusException` reports connection and remote method failures. Terminator itself returns strings that start with `ERROR:` for some tab and split failures.
103
+
104
+
105
+ ## D-Bus interface
106
+
107
+
108
+ This package follows the interface in [Terminator 2.1.6 `ipc.py`](https://github.com/gnome-terminator/terminator/blob/v2.1.6/terminatorlib/ipc.py).
109
+
110
+
111
+ - Base service and interface name: `net.tenshu.Terminator2`
112
+ - Object path: `/net/tenshu/Terminator2`
113
+ - Display-specific name: the base name followed by the MD5 digest of the GDK display name
114
+
115
+
116
+ Terminator removes the screen suffix before it creates the digest. Thus, `:0` and `:0.0` use the same service name.
117
+
118
+
119
+ The `Terminator` class exposes every method in the service:
120
+
121
+
122
+ | Python method | D-Bus input | Purpose | Result |
123
+ | --- | --- | --- | --- |
124
+ | `new_window_cmdline(options)` | `a{ss}` | Create a window from serialized command-line options. | `None` |
125
+ | `new_tab_cmdline(options)` | `a{ss}` | Create a tab from serialized command-line options. | `None` |
126
+ | `toggle_visibility_cmdline(options)` | `a{ss}` | Toggle all window visibility. | `None` |
127
+ | `unhide_cmdline(options)` | `a{ss}` | Show all hidden windows. | `None` |
128
+ | `new_window()` | empty | Create a window. | New terminal UUID or error string |
129
+ | `new_tab(uuid)` | `v` | Create a tab in a terminal's window. | New terminal UUID or error string |
130
+ | `reload_configuration()` | empty | Reload configuration for all terminals. | `None` |
131
+ | `bg_img_all(options)` | `v` | Set all background images from the `file` option. | `None` |
132
+ | `bg_img(uuid, options)` | `vv` | Set one background image from the `file` option. | `None` |
133
+ | `hsplit(uuid, options=None)` | `vv` | Split a terminal horizontally. | New terminal UUID or error string |
134
+ | `vsplit(uuid, options=None)` | `vv` | Split a terminal vertically. | New terminal UUID or error string |
135
+ | `get_terminals()` | empty | Get all terminal UUIDs. | `list[str]` |
136
+ | `get_focused_terminal()` | empty | Get the focused terminal UUID. | `str \| None` |
137
+ | `get_window(uuid)` | `v` | Get a terminal's window UUID. | `str` |
138
+ | `get_window_title(uuid)` | `v` | Get a terminal's window title. | `str` |
139
+ | `get_tab(uuid)` | `v` | Get a terminal's tab identifier. | `str \| None` |
140
+ | `get_tab_title(uuid)` | `v` | Get a terminal's tab title. | `str \| None` |
141
+ | `set_tab_title(uuid, options)` | `vv` | Set a tab title from the `tab-title` option. | `None` |
142
+ | `switch_profile(uuid, options)` | `vv` | Set one profile from the `profile` option. | `None` |
143
+ | `switch_profile_all(options)` | `v` | Set all profiles from the `profile` option. | `None` |
144
+
145
+
146
+ Terminator does not assign identifiers to tabs. Its `get_tab` method returns an empty string for a terminal in a notebook.
147
+
148
+
149
+ The four `*_cmdline` methods require string-to-string dictionaries. The window and tab creation methods require the complete option mapping from Terminator's command-line parser.
150
+
151
+
152
+ Terminator does not declare D-Bus output signatures. `dbus-python` infers each output signature from the value returned by the service method.
153
+
154
+
155
+ ## Sponsors
156
+
157
+
158
+ <!-- sponsors-start -->
159
+ <!-- sponsors-end -->
@@ -0,0 +1,126 @@
1
+ # Terminator D-Bus
2
+
3
+
4
+ [![ci](https://github.com/pawamoy/terminator-dbus/workflows/ci/badge.svg)](https://github.com/pawamoy/terminator-dbus/actions?query=workflow%3Aci)
5
+ [![documentation](https://img.shields.io/badge/docs-zensical-FF9100.svg?style=flat)](https://pawamoy.github.io/terminator-dbus/)
6
+ [![pypi version](https://img.shields.io/pypi/v/terminator-dbus.svg)](https://pypi.org/project/terminator-dbus/)
7
+ [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#terminator-dbus:gitter.im)
8
+
9
+
10
+ Python library to interact with Terminator through D-Bus.
11
+
12
+
13
+ ## Installation
14
+
15
+
16
+ ```bash
17
+ pip install terminator-dbus
18
+ ```
19
+
20
+
21
+ With [`uv`](https://docs.astral.sh/uv/):
22
+
23
+
24
+ ```bash
25
+ uv tool install terminator-dbus
26
+ ```
27
+
28
+
29
+ `dbus-python` needs the D-Bus development files when no system package or wheel is available.
30
+
31
+
32
+ ## Usage
33
+
34
+
35
+ Create one client and reuse it for all calls:
36
+
37
+
38
+ ```python
39
+ from terminator_dbus import Terminator
40
+
41
+ terminator = Terminator()
42
+ terminal = terminator.get_focused_terminal()
43
+
44
+ if terminal is not None:
45
+ new_terminal = terminator.vsplit(
46
+ terminal,
47
+ {"execute": "htop", "title": "Processes"},
48
+ )
49
+ terminator.switch_profile(new_terminal, {"profile": "work"})
50
+ ```
51
+
52
+
53
+ The client uses the current X11 or Wayland display by default. Pass `display` if the current environment does not identify the correct display:
54
+
55
+
56
+ ```python
57
+ terminator = Terminator(display=":1")
58
+ ```
59
+
60
+
61
+ Pass `bus_name` when you already know the complete D-Bus service name:
62
+
63
+
64
+ ```python
65
+ terminator = Terminator(bus_name="net.tenshu.Terminator2...")
66
+ ```
67
+
68
+
69
+ `dbus.DBusException` reports connection and remote method failures. Terminator itself returns strings that start with `ERROR:` for some tab and split failures.
70
+
71
+
72
+ ## D-Bus interface
73
+
74
+
75
+ This package follows the interface in [Terminator 2.1.6 `ipc.py`](https://github.com/gnome-terminator/terminator/blob/v2.1.6/terminatorlib/ipc.py).
76
+
77
+
78
+ - Base service and interface name: `net.tenshu.Terminator2`
79
+ - Object path: `/net/tenshu/Terminator2`
80
+ - Display-specific name: the base name followed by the MD5 digest of the GDK display name
81
+
82
+
83
+ Terminator removes the screen suffix before it creates the digest. Thus, `:0` and `:0.0` use the same service name.
84
+
85
+
86
+ The `Terminator` class exposes every method in the service:
87
+
88
+
89
+ | Python method | D-Bus input | Purpose | Result |
90
+ | --- | --- | --- | --- |
91
+ | `new_window_cmdline(options)` | `a{ss}` | Create a window from serialized command-line options. | `None` |
92
+ | `new_tab_cmdline(options)` | `a{ss}` | Create a tab from serialized command-line options. | `None` |
93
+ | `toggle_visibility_cmdline(options)` | `a{ss}` | Toggle all window visibility. | `None` |
94
+ | `unhide_cmdline(options)` | `a{ss}` | Show all hidden windows. | `None` |
95
+ | `new_window()` | empty | Create a window. | New terminal UUID or error string |
96
+ | `new_tab(uuid)` | `v` | Create a tab in a terminal's window. | New terminal UUID or error string |
97
+ | `reload_configuration()` | empty | Reload configuration for all terminals. | `None` |
98
+ | `bg_img_all(options)` | `v` | Set all background images from the `file` option. | `None` |
99
+ | `bg_img(uuid, options)` | `vv` | Set one background image from the `file` option. | `None` |
100
+ | `hsplit(uuid, options=None)` | `vv` | Split a terminal horizontally. | New terminal UUID or error string |
101
+ | `vsplit(uuid, options=None)` | `vv` | Split a terminal vertically. | New terminal UUID or error string |
102
+ | `get_terminals()` | empty | Get all terminal UUIDs. | `list[str]` |
103
+ | `get_focused_terminal()` | empty | Get the focused terminal UUID. | `str \| None` |
104
+ | `get_window(uuid)` | `v` | Get a terminal's window UUID. | `str` |
105
+ | `get_window_title(uuid)` | `v` | Get a terminal's window title. | `str` |
106
+ | `get_tab(uuid)` | `v` | Get a terminal's tab identifier. | `str \| None` |
107
+ | `get_tab_title(uuid)` | `v` | Get a terminal's tab title. | `str \| None` |
108
+ | `set_tab_title(uuid, options)` | `vv` | Set a tab title from the `tab-title` option. | `None` |
109
+ | `switch_profile(uuid, options)` | `vv` | Set one profile from the `profile` option. | `None` |
110
+ | `switch_profile_all(options)` | `v` | Set all profiles from the `profile` option. | `None` |
111
+
112
+
113
+ Terminator does not assign identifiers to tabs. Its `get_tab` method returns an empty string for a terminal in a notebook.
114
+
115
+
116
+ The four `*_cmdline` methods require string-to-string dictionaries. The window and tab creation methods require the complete option mapping from Terminator's command-line parser.
117
+
118
+
119
+ Terminator does not declare D-Bus output signatures. `dbus-python` infers each output signature from the value returned by the service method.
120
+
121
+
122
+ ## Sponsors
123
+
124
+
125
+ <!-- sponsors-start -->
126
+ <!-- sponsors-end -->
@@ -0,0 +1,25 @@
1
+ [coverage:run]
2
+ branch = true
3
+ parallel = true
4
+ source =
5
+ src/
6
+ tests/
7
+
8
+ [coverage:paths]
9
+ equivalent =
10
+ src/
11
+ .venv/lib/*/site-packages/
12
+ .venvs/*/lib/*/site-packages/
13
+
14
+ [coverage:report]
15
+ precision = 2
16
+ omit =
17
+ src/*/__init__.py
18
+ src/*/__main__.py
19
+ tests/__init__.py
20
+ exclude_lines =
21
+ pragma: no cover
22
+ if TYPE_CHECKING
23
+
24
+ [coverage:json]
25
+ output = htmlcov/coverage.json
@@ -0,0 +1,9 @@
1
+ bump = "auto"
2
+ convention = "angular"
3
+ in-place = true
4
+ output = "CHANGELOG.md"
5
+ parse-refs = false
6
+ parse-trailers = true
7
+ sections = ["build", "deps", "feat", "fix", "perf", "refactor"]
8
+ template = "keepachangelog"
9
+ versioning = "pep440"
@@ -0,0 +1,16 @@
1
+ [pytest]
2
+ python_files =
3
+ test_*.py
4
+ addopts =
5
+ --cov
6
+ --cov-config config/coverage.ini
7
+ testpaths =
8
+ tests
9
+
10
+ # action:message_regex:warning_class:module_regex:line
11
+ filterwarnings =
12
+ error
13
+ default::EncodingWarning
14
+ error::EncodingWarning:terminator_dbus
15
+ # TODO: remove once pytest-xdist 4 is released
16
+ ignore:.*rsyncdir:DeprecationWarning:xdist
@@ -0,0 +1,76 @@
1
+ target-version = "py310"
2
+ line-length = 120
3
+ output-format = "concise"
4
+
5
+ [lint]
6
+ exclude = [
7
+ "tests/fixtures/*.py",
8
+ ]
9
+ select = ["ALL"]
10
+ ignore = [
11
+ "A001", # Variable is shadowing a Python builtin
12
+ "ANN204", # Missing return type annotation for special method __str__
13
+ "ANN401", # Dynamically typed expressions (typing.Any) are disallowed
14
+ "ARG005", # Unused lambda argument
15
+ "C901", # Too complex
16
+ "D105", # Missing docstring in magic method
17
+ "D417", # Missing argument description in the docstring
18
+ "E501", # Line too long
19
+ "EM101", # String literal when raising exception
20
+ "EM102", # f-string when raising exception
21
+ "ERA001", # Commented out code
22
+ "FIX", # TODO, FIXME, etc.
23
+ "G004", # Logging statement uses f-string
24
+ "PLR0911", # Too many return statements
25
+ "PLR0912", # Too many branches
26
+ "PLR0913", # Too many arguments to function call
27
+ "PLR0915", # Too many statements
28
+ "SLF001", # Private member accessed
29
+ "TD002", # Missing author in TODO
30
+ "TD003", # Missing issue link for TODO
31
+ "TRY003", # Avoid specifying long messages outside the exception class
32
+ ]
33
+
34
+ [lint.per-file-ignores]
35
+ "src/**/cli.py" = [
36
+ "T201", # Print statement
37
+ ]
38
+ "src/*/debug.py" = [
39
+ "T201", # Print statement
40
+ ]
41
+ "!src/*/*.py" = [
42
+ "D100", # Missing docstring in public module
43
+ ]
44
+ "!src/**.py" = [
45
+ "D101", # Missing docstring in public class
46
+ "D103", # Missing docstring in public function
47
+ ]
48
+ "scripts/*.py" = [
49
+ "INP001", # File is part of an implicit namespace package
50
+ "T201", # Print statement
51
+ ]
52
+ "tests/**.py" = [
53
+ "ARG005", # Unused lambda argument
54
+ "FBT001", # Boolean positional arg in function definition
55
+ "PLR2004", # Magic value used in comparison
56
+ "S101", # Use of assert detected
57
+ ]
58
+
59
+ [lint.flake8-quotes]
60
+ docstring-quotes = "double"
61
+
62
+ [lint.flake8-tidy-imports]
63
+ ban-relative-imports = "all"
64
+
65
+ [lint.isort]
66
+ known-first-party = ["terminator_dbus"]
67
+
68
+ [lint.pydocstyle]
69
+ convention = "google"
70
+
71
+ [format]
72
+ exclude = [
73
+ "tests/fixtures/*.py",
74
+ ]
75
+ docstring-code-format = true
76
+ docstring-code-line-length = 80
@@ -0,0 +1,6 @@
1
+ [src]
2
+ exclude = ["tests/fixtures"]
3
+
4
+ [terminal]
5
+ error-on-warning = true
6
+ output-format = "concise"