# wledges
Active edges for Wayland compositors.
You might also be interested in [wlosd](https://github.com/fshaked/wlosd)
which provides on-screen display for Wayland compositors.
## Supported Desktops
Tested on [Sway](https://swaywm.org/), but should work on all Wayland
compositors that support the Layer Shell protocol. More precisely,
it should work on all
[desktops supported](https://github.com/wmww/gtk4-layer-shell?tab=readme-ov-file#supported-desktops)
by gtk4-layer-shell.
## Installation
### Dependencies:
Debian/Ubuntu:
```
sudo apt install libgirepository-1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0 libgtk4-layer-shell-dev
pip install pygobject
```
Fedora:
```
sudo dnf install gcc gobject-introspection-devel cairo-gobject-devel pkg-config python3-devel gtk4 gtk4-layer-shell-devel
pip install pygobject
```
Arch Linux:
```
sudo pacman -S python cairo pkgconf gobject-introspection gtk4 gcc gtk4-layer-shell
pip install pygobject
```
For other distributions, you will need:
- Python 3: [instructions](https://wiki.python.org/moin/BeginnersGuide/Download)
- pygobject: [instructions](https://pygobject.gnome.org/getting_started.html)
- gtk4-layer-shell: [instructions](https://github.com/wmww/gtk4-layer-shell)
### Install wledges:
From PyPi:
```
pip install wledges
```
Or clone this repository.
## Usage
wledges allocates for each screen edge, and corner, specified on the command
line, a rectangular area of the specified size.
Every time the mouse cursor interacts with those areas (moves in, clicked on,
scrolled on) wledges prints a line to standard output.
The line indicates which edge or corner was interacted with, and what was the
interaction.
For example, running the following command in a terminal allocates a 1 pixel
active line, 30% the length of the screen, at the top (centre) of the DP-1
output, and a 1 by 1 active pixel at the top-left corner of the screen.
```
wledges --top 30%x1 --top-left 1x1 DP-1
```
The command displays a slightly bigger rectangle (30%x50) to indicate that this
edge is active.
The `--css` command line argument can be used to pass a GTK4 style sheet (see
[style.css](https://github.com/fshaked/wledges/blob/main/style.css) for example,
and [overview](https://docs.gtk.org/gtk4/css-overview.html) and
[properties](https://docs.gtk.org/gtk4/css-properties.html) for documentation),
that can be used to style the indicator, to make it less obtrusive.
In any case, only input events from the (smaller) active area are captured by
wledges; other events are sent to the window below.
Moving the mouse cursor to the very top of the screen (being inside the
displayed 30%x50 rectangle is not enough, the cursor must be in the 30%x1 active
area) first prints (after a delay of 0.75 seconds) "top timeout", and then
repeatedly (every 0.75 second) "top repeat", until the cursor is moved out of
the rectangle.
Clicking the mouse left button while the cursor is in the active rectangle
prints "top press-1", and similarly for the other mouse buttons.
Scrolling the mouse wheel prints "top scroll-DIRECTION" where DIRECTION is one
of up, down, left, right.
Clicking or scrolling the mouse also cancels the timeout and repeat lines, until
the cursor moves out of the active area, and comes back in.
If you are using [Sway](https://swaywm.org/), the following Bash script can be
used to switch workspaces when the mouse cursor touches the left or right edges
of the screen (change the first line to match your output, see `swaymsg -t
get_outputs` for a list of outputs):
```
output='DP-1'
while IFS=' ' read -r line; do
case "${line}" in
left\ timeout | left\ repeat)
swaymsg "focus output ${output} ; workspace prev_on_output"
;;
right\ timeout | right\ repeat)
swaymsg "focus output ${output} ; workspace next_on_output"
;;
esac
done < <(python -m wledges --left 1x50% --right 1x50% "${output}")
```
## License
MIT, see [LICENSE](https://github.com/fshaked/wledges/blob/main/LICENSE)
Raw data
{
"_id": null,
"home_page": null,
"name": "wledges",
"maintainer": "Shaked Flur",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "edges, wayland, sway, layer-shell, wlr, wlroots",
"author": "Shaked Flur",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/79/97/19619f08d34bddb427ead5cab7f83652fd30cb534b8af720f2a2561237ae/wledges-1.tar.gz",
"platform": null,
"description": "# wledges\n\nActive edges for Wayland compositors.\n\nYou might also be interested in [wlosd](https://github.com/fshaked/wlosd)\nwhich provides on-screen display for Wayland compositors.\n\n## Supported Desktops\n\nTested on [Sway](https://swaywm.org/), but should work on all Wayland\ncompositors that support the Layer Shell protocol. More precisely,\nit should work on all\n[desktops supported](https://github.com/wmww/gtk4-layer-shell?tab=readme-ov-file#supported-desktops)\nby gtk4-layer-shell.\n\n## Installation\n\n### Dependencies:\n\nDebian/Ubuntu:\n\n```\nsudo apt install libgirepository-1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0 libgtk4-layer-shell-dev\npip install pygobject\n```\n\nFedora:\n\n```\nsudo dnf install gcc gobject-introspection-devel cairo-gobject-devel pkg-config python3-devel gtk4 gtk4-layer-shell-devel\npip install pygobject\n```\n\nArch Linux:\n\n```\nsudo pacman -S python cairo pkgconf gobject-introspection gtk4 gcc gtk4-layer-shell\npip install pygobject\n```\n\nFor other distributions, you will need:\n- Python 3: [instructions](https://wiki.python.org/moin/BeginnersGuide/Download)\n- pygobject: [instructions](https://pygobject.gnome.org/getting_started.html)\n- gtk4-layer-shell: [instructions](https://github.com/wmww/gtk4-layer-shell)\n\n### Install wledges:\nFrom PyPi:\n```\npip install wledges\n```\n\nOr clone this repository.\n\n## Usage\n\nwledges allocates for each screen edge, and corner, specified on the command\nline, a rectangular area of the specified size.\nEvery time the mouse cursor interacts with those areas (moves in, clicked on,\nscrolled on) wledges prints a line to standard output.\nThe line indicates which edge or corner was interacted with, and what was the\ninteraction.\n\nFor example, running the following command in a terminal allocates a 1 pixel\nactive line, 30% the length of the screen, at the top (centre) of the DP-1\noutput, and a 1 by 1 active pixel at the top-left corner of the screen.\n\n```\nwledges --top 30%x1 --top-left 1x1 DP-1\n```\n\nThe command displays a slightly bigger rectangle (30%x50) to indicate that this\nedge is active.\nThe `--css` command line argument can be used to pass a GTK4 style sheet (see\n[style.css](https://github.com/fshaked/wledges/blob/main/style.css) for example,\nand [overview](https://docs.gtk.org/gtk4/css-overview.html) and\n[properties](https://docs.gtk.org/gtk4/css-properties.html) for documentation),\nthat can be used to style the indicator, to make it less obtrusive.\nIn any case, only input events from the (smaller) active area are captured by\nwledges; other events are sent to the window below.\n\nMoving the mouse cursor to the very top of the screen (being inside the\ndisplayed 30%x50 rectangle is not enough, the cursor must be in the 30%x1 active\narea) first prints (after a delay of 0.75 seconds) \"top timeout\", and then\nrepeatedly (every 0.75 second) \"top repeat\", until the cursor is moved out of\nthe rectangle.\nClicking the mouse left button while the cursor is in the active rectangle\nprints \"top press-1\", and similarly for the other mouse buttons.\nScrolling the mouse wheel prints \"top scroll-DIRECTION\" where DIRECTION is one\nof up, down, left, right.\nClicking or scrolling the mouse also cancels the timeout and repeat lines, until\nthe cursor moves out of the active area, and comes back in.\n\nIf you are using [Sway](https://swaywm.org/), the following Bash script can be\nused to switch workspaces when the mouse cursor touches the left or right edges\nof the screen (change the first line to match your output, see `swaymsg -t\nget_outputs` for a list of outputs):\n\n```\noutput='DP-1'\n\nwhile IFS=' ' read -r line; do\n case \"${line}\" in\n left\\ timeout | left\\ repeat)\n swaymsg \"focus output ${output} ; workspace prev_on_output\"\n ;;\n right\\ timeout | right\\ repeat)\n swaymsg \"focus output ${output} ; workspace next_on_output\"\n ;;\n esac\ndone < <(python -m wledges --left 1x50% --right 1x50% \"${output}\")\n```\n\n## License\n\nMIT, see [LICENSE](https://github.com/fshaked/wledges/blob/main/LICENSE)\n",
"bugtrack_url": null,
"license": null,
"summary": "Active edges for wayland.",
"version": "1",
"project_urls": {
"Changelog": "https://github.com/fshaked/wledges/CHANGELOG.md",
"Documentation": "https://github.com/fshaked/wledges",
"Homepage": "https://github.com/fshaked/wledges",
"Issues": "https://github.com/fshaked/wledges/issues",
"Repository": "https://github.com/fshaked/wledges.git"
},
"split_keywords": [
"edges",
" wayland",
" sway",
" layer-shell",
" wlr",
" wlroots"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8d0f9391c06c18fcb3fcc1e3dc853e3a930d51eaac4655b435df44f45ed7df9b",
"md5": "87168f59985b487c8ae49c5266299fab",
"sha256": "0d8ee143fe4afb4b3c8033742b147df745400480def8d0cc161fdf94b5a54ca5"
},
"downloads": -1,
"filename": "wledges-1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "87168f59985b487c8ae49c5266299fab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8831,
"upload_time": "2024-12-22T10:39:22",
"upload_time_iso_8601": "2024-12-22T10:39:22.356379Z",
"url": "https://files.pythonhosted.org/packages/8d/0f/9391c06c18fcb3fcc1e3dc853e3a930d51eaac4655b435df44f45ed7df9b/wledges-1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "799719619f08d34bddb427ead5cab7f83652fd30cb534b8af720f2a2561237ae",
"md5": "d73bf787f6ddea4e2ca6314fd04c45dc",
"sha256": "ebc8a0e80a1c55701ca412a227d5bb3c45a63e1090939f87d4f0752b83e6a5da"
},
"downloads": -1,
"filename": "wledges-1.tar.gz",
"has_sig": false,
"md5_digest": "d73bf787f6ddea4e2ca6314fd04c45dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 10361,
"upload_time": "2024-12-22T10:39:23",
"upload_time_iso_8601": "2024-12-22T10:39:23.688291Z",
"url": "https://files.pythonhosted.org/packages/79/97/19619f08d34bddb427ead5cab7f83652fd30cb534b8af720f2a2561237ae/wledges-1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-22 10:39:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fshaked",
"github_project": "wledges",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "pycairo",
"specs": [
[
"==",
"1.27.0"
]
]
},
{
"name": "PyGObject",
"specs": [
[
"==",
"3.50.0"
]
]
}
],
"lcname": "wledges"
}