| Name | janela JSON |
| Version |
0.0.8
JSON |
| download |
| home_page | None |
| Summary | A simple tool to automate window management |
| upload_time | 2024-09-26 06:13:43 |
| maintainer | None |
| docs_url | None |
| author | Gustavo |
| requires_python | <4.0,>=3.8 |
| license | None |
| keywords |
|
| VCS |
|
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Janela
_Window handling for humans_
[](https://badge.fury.io/py/janela)
[](https://pypi.org/project/janela/)
[](https://pypi.org/project/janela/)
[](https://pypi.org/project/janela/)
A simple Python package for managing and manipulating application windows on **GUI** environments. **janela** provides an easy-to-use interface for moving, resizing, maximizing, minimizing, and arranging windows across multiple monitors.
**Note:** Currently, Janela supports **Linux** platforms. Support for **Windows** and **macOS** is in progress and will be available in future releases.
## Features
- **Move windows between monitors**: Easily transfer windows from one monitor to another.
- **Resize windows**: Adjust the size of windows programmatically.
- **Maximize and minimize windows**: Control window states effortlessly.
- **Focus on windows**: Bring specific windows to the foreground.
- **Close windows**: Programmatically close application windows.
- **Arrange windows in mosaic patterns**: Organize your windows in a mosaic layout across your monitors.
## Table of Contents
- [Installation](#installation)
- [Linux](#linux)
- [Windows (Coming Soon)](#windows-coming-soon)
- [macOS (Coming Soon)](#macos-coming-soon)
- [Requirements](#requirements)
- [Usage](#usage)
- [Basic Example](#basic-example)
- [Moving a Window to Another Monitor](#moving-a-window-to-another-monitor)
- [Resizing and Moving Windows](#resizing-and-moving-windows)
- [Maximizing and Minimizing Windows](#maximizing-and-minimizing-windows)
- [Focusing and Closing Windows](#focusing-and-closing-windows)
- [API Reference](#api-reference)
- [WindowManager](#windowmanager)
- [Window](#window)
- [Monitor](#monitor)
- [Tested Platforms](#tested-platforms)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgements](#acknowledgements)
## Installation
### Linux
First, ensure that you have the required system dependencies installed.
#### Install `xdotool` and `wmctrl`
On **Debian/Ubuntu-based systems**:
```bash
sudo apt-get update
sudo apt-get install xdotool wmctrl
```
#### Install Janela
You can install Janela from PyPI:
```bash
pip install janela
```
### Windows (Coming Soon)
Support for **Windows** platforms is currently under development. Stay tuned for upcoming releases that will include Windows support.
### macOS (Coming Soon)
Support for **macOS** platforms is in progress. We are working on bringing Janela's capabilities to macOS users in future updates.
## Requirements
- **Linux operating system**
- **Python 3.6 or higher**
- System packages (Linux only):
- [`xdotool`](https://www.semicomplete.com/projects/xdotool/)
- [`wmctrl`](http://tomas.styblo.name/wmctrl/)
- Python packages:
- [`python-xlib`](https://pypi.org/project/python-xlib/)
## Usage
**Note:** The following usage examples are applicable to **Linux** platforms. Support for Windows and macOS is coming soon.
### Basic Example
Arrange all windows in a mosaic pattern across all monitors:
```python
from janela import WindowManager, playground
# Initialize the window manager
wm = WindowManager()
# Arrange windows in a mosaic pattern
playground.mosaic(wm)
```
### Moving a Window to Another Monitor
```python
from janela import WindowManager
# Initialize the window manager
wm = WindowManager()
# Get a window by name
window = wm.get_window_by_name("Mozilla Firefox")
# Get the target monitor (e.g., monitor with ID 1)
target_monitor = wm.get_monitor_by_id(1)
# Move the window to the target monitor
if window and target_monitor:
window.move_to_monitor(target_monitor)
```
### Resizing and Moving Windows
```python
from janela import WindowManager
wm = WindowManager()
# Get the active window
window = wm.get_active_window()
if window:
# Move the window to position (100, 100)
window.set_position(100, 100)
# Resize the window to width 800 and height 600
window.resize(800, 600)
```
### Maximizing and Minimizing Windows
```python
from janela import WindowManager
wm = WindowManager()
# Get a window by name
window = wm.get_window_by_name("Terminal")
if window:
# Maximize the window
window.maximize()
# Check if the window is maximized
if window.is_maximized():
print(f"Window '{window.name}' is maximized.")
# Minimize the window
window.minimize()
```
### Focusing and Closing Windows
```python
from janela import WindowManager
wm = WindowManager()
# Get a window by name
window = wm.get_window_by_name("Text Editor")
if window:
# Focus the window
window.focus()
# Close the window
window.close()
```
## API Reference
### WindowManager
The `WindowManager` class is the main interface to manage windows and monitors.
**Methods:**
- `list_windows()`: List all open windows.
- `list_monitors()`: List all available monitors.
- `get_active_window()`: Get the currently active window.
- `get_window_by_name(name)`: Get a window by its name.
- `get_monitor_by_id(monitor_id)`: Get a monitor by its ID.
### Window
Represents a window in the system.
**Attributes:**
- `id`: The window ID.
- `name`: The window name.
- `x`, `y`: The position of the window.
- `width`, `height`: The dimensions of the window.
- `is_active`: Whether the window is currently active.
**Methods:**
- `set_position(x, y)`: Move the window to the specified position.
- `move(x, y)`: Move the window by the specified offset.
- `resize(width, height)`: Resize the window.
- `minimize()`: Minimize the window.
- `maximize()`: Maximize the window.
- `move_to_monitor(monitor)`: Move the window to the specified monitor.
- `is_maximized()`: Check if the window is maximized.
- `unmaximize()`: Unmaximize the window.
- `focus()`: Bring the window to the foreground.
- `close()`: Close the window.
### Monitor
Represents a monitor connected to the system.
**Attributes:**
- `id`: The monitor ID.
- `name`: The monitor name.
- `x`, `y`: The position of the monitor.
- `width`, `height`: The dimensions of the monitor.
**Methods:**
- `list_windows()`: List all windows on this monitor.
- `contains(x, y)`: Check if a point is within this monitor.
- `is_vertical()`: Check if the monitor is vertically oriented.
- `is_horizontal()`: Check if the monitor is horizontally oriented.
- `aspect_ratio()`: Get the aspect ratio of the monitor.
## Tested Platforms
The following table lists the operating systems and distributions where **Janela** has been tested. This helps track where the library works and where it might encounter issues.
| Operating System | Distribution | Version(s) | Status |
|------------------|--------------|-------------------------|------------------|
| **Linux** | Ubuntu (KDE) | 20.04 LTS, 22.04 LTS | ✅ Works |
| **Windows** | - | - | 🚧 In Progress |
| **macOS** | - | - | 🚧 In Progress |
*Note: As the library is designed specifically for Linux systems at the moment, Windows and macOS support is currently under development. We are actively working on bringing Janela's capabilities to these platforms in future releases.*
## Contributing
Contributions are welcome! Please submit a pull request or open an issue on [GitHub](https://github.com/yourusername/janela).
If you're interested in helping us bring support for Windows and macOS platforms, feel free to contribute to the project.
## License
This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.
## Acknowledgements
- [xdotool](https://www.semicomplete.com/projects/xdotool/) - Simulate keyboard input and mouse activity.
- [wmctrl](http://tomas.styblo.name/wmctrl/) - Interact with an X Window Manager.
- [python-xlib](https://pypi.org/project/python-xlib/) - Python interface to the X11 protocol client library.
Raw data
{
"_id": null,
"home_page": null,
"name": "janela",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Gustavo",
"author_email": "github.dxabr@aleeas.com",
"download_url": "https://files.pythonhosted.org/packages/ff/0f/2f78c8c2ea7133cc0f0e340f3956b1eda50b7bc37711bd9c2c881427f2b7/janela-0.0.8.tar.gz",
"platform": null,
"description": "# Janela\n\n_Window handling for humans_\n\n\n[](https://badge.fury.io/py/janela)\n[](https://pypi.org/project/janela/)\n[](https://pypi.org/project/janela/)\n[](https://pypi.org/project/janela/)\n\nA simple Python package for managing and manipulating application windows on **GUI** environments. **janela** provides an easy-to-use interface for moving, resizing, maximizing, minimizing, and arranging windows across multiple monitors.\n\n**Note:** Currently, Janela supports **Linux** platforms. Support for **Windows** and **macOS** is in progress and will be available in future releases.\n\n## Features\n\n- **Move windows between monitors**: Easily transfer windows from one monitor to another.\n- **Resize windows**: Adjust the size of windows programmatically.\n- **Maximize and minimize windows**: Control window states effortlessly.\n- **Focus on windows**: Bring specific windows to the foreground.\n- **Close windows**: Programmatically close application windows.\n- **Arrange windows in mosaic patterns**: Organize your windows in a mosaic layout across your monitors.\n\n## Table of Contents\n\n- [Installation](#installation)\n - [Linux](#linux)\n - [Windows (Coming Soon)](#windows-coming-soon)\n - [macOS (Coming Soon)](#macos-coming-soon)\n- [Requirements](#requirements)\n- [Usage](#usage)\n - [Basic Example](#basic-example)\n - [Moving a Window to Another Monitor](#moving-a-window-to-another-monitor)\n - [Resizing and Moving Windows](#resizing-and-moving-windows)\n - [Maximizing and Minimizing Windows](#maximizing-and-minimizing-windows)\n - [Focusing and Closing Windows](#focusing-and-closing-windows)\n- [API Reference](#api-reference)\n - [WindowManager](#windowmanager)\n - [Window](#window)\n - [Monitor](#monitor)\n- [Tested Platforms](#tested-platforms)\n- [Contributing](#contributing)\n- [License](#license)\n- [Acknowledgements](#acknowledgements)\n\n## Installation\n\n### Linux\n\nFirst, ensure that you have the required system dependencies installed.\n\n#### Install `xdotool` and `wmctrl`\n\nOn **Debian/Ubuntu-based systems**:\n\n```bash\nsudo apt-get update\nsudo apt-get install xdotool wmctrl\n```\n\n#### Install Janela\n\nYou can install Janela from PyPI:\n\n```bash\npip install janela\n```\n\n### Windows (Coming Soon)\n\nSupport for **Windows** platforms is currently under development. Stay tuned for upcoming releases that will include Windows support.\n\n### macOS (Coming Soon)\n\nSupport for **macOS** platforms is in progress. We are working on bringing Janela's capabilities to macOS users in future updates.\n\n## Requirements\n\n- **Linux operating system**\n- **Python 3.6 or higher**\n- System packages (Linux only):\n - [`xdotool`](https://www.semicomplete.com/projects/xdotool/)\n - [`wmctrl`](http://tomas.styblo.name/wmctrl/)\n- Python packages:\n - [`python-xlib`](https://pypi.org/project/python-xlib/)\n\n## Usage\n\n**Note:** The following usage examples are applicable to **Linux** platforms. Support for Windows and macOS is coming soon.\n\n### Basic Example\n\nArrange all windows in a mosaic pattern across all monitors:\n\n```python\nfrom janela import WindowManager, playground\n\n# Initialize the window manager\nwm = WindowManager()\n\n# Arrange windows in a mosaic pattern\nplayground.mosaic(wm)\n```\n\n### Moving a Window to Another Monitor\n\n```python\nfrom janela import WindowManager\n\n# Initialize the window manager\nwm = WindowManager()\n\n# Get a window by name\nwindow = wm.get_window_by_name(\"Mozilla Firefox\")\n\n# Get the target monitor (e.g., monitor with ID 1)\ntarget_monitor = wm.get_monitor_by_id(1)\n\n# Move the window to the target monitor\nif window and target_monitor:\n window.move_to_monitor(target_monitor)\n```\n\n### Resizing and Moving Windows\n\n```python\nfrom janela import WindowManager\n\nwm = WindowManager()\n\n# Get the active window\nwindow = wm.get_active_window()\n\nif window:\n # Move the window to position (100, 100)\n window.set_position(100, 100)\n\n # Resize the window to width 800 and height 600\n window.resize(800, 600)\n```\n\n### Maximizing and Minimizing Windows\n\n```python\nfrom janela import WindowManager\n\nwm = WindowManager()\n\n# Get a window by name\nwindow = wm.get_window_by_name(\"Terminal\")\n\nif window:\n # Maximize the window\n window.maximize()\n\n # Check if the window is maximized\n if window.is_maximized():\n print(f\"Window '{window.name}' is maximized.\")\n\n # Minimize the window\n window.minimize()\n```\n\n### Focusing and Closing Windows\n\n```python\nfrom janela import WindowManager\n\nwm = WindowManager()\n\n# Get a window by name\nwindow = wm.get_window_by_name(\"Text Editor\")\n\nif window:\n # Focus the window\n window.focus()\n\n # Close the window\n window.close()\n```\n\n## API Reference\n\n### WindowManager\n\nThe `WindowManager` class is the main interface to manage windows and monitors.\n\n**Methods:**\n\n- `list_windows()`: List all open windows.\n- `list_monitors()`: List all available monitors.\n- `get_active_window()`: Get the currently active window.\n- `get_window_by_name(name)`: Get a window by its name.\n- `get_monitor_by_id(monitor_id)`: Get a monitor by its ID.\n\n### Window\n\nRepresents a window in the system.\n\n**Attributes:**\n\n- `id`: The window ID.\n- `name`: The window name.\n- `x`, `y`: The position of the window.\n- `width`, `height`: The dimensions of the window.\n- `is_active`: Whether the window is currently active.\n\n**Methods:**\n\n- `set_position(x, y)`: Move the window to the specified position.\n- `move(x, y)`: Move the window by the specified offset.\n- `resize(width, height)`: Resize the window.\n- `minimize()`: Minimize the window.\n- `maximize()`: Maximize the window.\n- `move_to_monitor(monitor)`: Move the window to the specified monitor.\n- `is_maximized()`: Check if the window is maximized.\n- `unmaximize()`: Unmaximize the window.\n- `focus()`: Bring the window to the foreground.\n- `close()`: Close the window.\n\n### Monitor\n\nRepresents a monitor connected to the system.\n\n**Attributes:**\n\n- `id`: The monitor ID.\n- `name`: The monitor name.\n- `x`, `y`: The position of the monitor.\n- `width`, `height`: The dimensions of the monitor.\n\n**Methods:**\n\n- `list_windows()`: List all windows on this monitor.\n- `contains(x, y)`: Check if a point is within this monitor.\n- `is_vertical()`: Check if the monitor is vertically oriented.\n- `is_horizontal()`: Check if the monitor is horizontally oriented.\n- `aspect_ratio()`: Get the aspect ratio of the monitor.\n\n## Tested Platforms\n\nThe following table lists the operating systems and distributions where **Janela** has been tested. This helps track where the library works and where it might encounter issues.\n\n| Operating System | Distribution | Version(s) | Status |\n|------------------|--------------|-------------------------|------------------|\n| **Linux** | Ubuntu (KDE) | 20.04 LTS, 22.04 LTS | \u2705 Works |\n| **Windows** | - | - | \ud83d\udea7 In Progress |\n| **macOS** | - | - | \ud83d\udea7 In Progress |\n\n*Note: As the library is designed specifically for Linux systems at the moment, Windows and macOS support is currently under development. We are actively working on bringing Janela's capabilities to these platforms in future releases.*\n\n## Contributing\n\nContributions are welcome! Please submit a pull request or open an issue on [GitHub](https://github.com/yourusername/janela).\n\nIf you're interested in helping us bring support for Windows and macOS platforms, feel free to contribute to the project.\n\n## License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgements\n\n- [xdotool](https://www.semicomplete.com/projects/xdotool/) - Simulate keyboard input and mouse activity.\n- [wmctrl](http://tomas.styblo.name/wmctrl/) - Interact with an X Window Manager.\n- [python-xlib](https://pypi.org/project/python-xlib/) - Python interface to the X11 protocol client library.\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple tool to automate window management",
"version": "0.0.8",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3ad236698b21a9695fc10780a83b5c672bf7caed8de332362112c7e2a401db9b",
"md5": "132d5dd1aa68bdbdda8ea47ea5d535fd",
"sha256": "0bc1f474c73dc117aaf7363bf1a75229bd8bb4a8cbe4bf3df528d52140d3111d"
},
"downloads": -1,
"filename": "janela-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "132d5dd1aa68bdbdda8ea47ea5d535fd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 14758,
"upload_time": "2024-09-26T06:13:42",
"upload_time_iso_8601": "2024-09-26T06:13:42.378889Z",
"url": "https://files.pythonhosted.org/packages/3a/d2/36698b21a9695fc10780a83b5c672bf7caed8de332362112c7e2a401db9b/janela-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ff0f2f78c8c2ea7133cc0f0e340f3956b1eda50b7bc37711bd9c2c881427f2b7",
"md5": "af72d224a3ac22f5262e5f8bad8d9294",
"sha256": "2c8903a7a6d27dda99fa4c3884616237a69576ee12415bc0939ef5dd2a164fca"
},
"downloads": -1,
"filename": "janela-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "af72d224a3ac22f5262e5f8bad8d9294",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 13600,
"upload_time": "2024-09-26T06:13:43",
"upload_time_iso_8601": "2024-09-26T06:13:43.723211Z",
"url": "https://files.pythonhosted.org/packages/ff/0f/2f78c8c2ea7133cc0f0e340f3956b1eda50b7bc37711bd9c2c881427f2b7/janela-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-26 06:13:43",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "janela"
}