Create a group for i3/sway containers to easily switch focus between
Project description
i3-focus-group
Create a group for i3/sway containers to easily switch focus between.
Installation
Using pip:
pip install i3-focus-group
If you are using Nix, you can install it from NUR.
Usage
i3-focus-group will listen at a Unix domain socket for incoming requests. Each request includes a single line of string as the name of command.
The following commands are supported:
Command | Description |
---|---|
add | Add the current container to the group |
remove | Remove the current container from the group |
toggle | Toggle the current container (add or remove) |
clear | Clear the group (remove all containers) |
switch | Focus next container in group and promote this container if in group |
peekNext | Focus next container in group but without changing order |
peekPrev | Focus previous container in group but without changing order |
You can use any program that supports Unix domain socket to send the request. For example:
echo "add" | socat - $XDG_RUNTIME_DIR/i3-focus-group.sock
echo "switch" | socat - $XDG_RUNTIME_DIR/i3-focus-group.sock
To use it with i3/sway, simply add keybindings to run the above commands:
bindsym Mod4+Tab exec echo "switch" | socat - $XDG_RUNTIME_DIR/i3-focus-group.sock
bindsym Mod4+grave exec echo "toggle" | socat - $XDG_RUNTIME_DIR/i3-focus-group.sock
bindsym Mod4+Shift+grave exec echo "clear" | socat - $XDG_RUNTIME_DIR/i3-focus-group.sock
bindsym Mod4+comma exec echo "peekPrev" | socat - $XDG_RUNTIME_DIR/i3-focus-group.sock
bindsym Mod4+period exec echo "peekNext" | socat - $XDG_RUNTIME_DIR/i3-focus-group.sock
For more command-line options, run i3-focus-group -h
.
Example
- To start with, the group with be empty.
- Then suppose two containers A, B, and C are added to the group and now C is focused.
The group becomes
[C] B A
. (bracket means current focus) - Suppose
switch
command is issued, it will focus on the next container B and promote it to the head. The group becomes[B] C A
. - Suppose
switch
command is issued again, the group will become[C] B A
. - Suppose
peekNext
is issued. The focus will change to B but without promoting the container. The group becomesC [B] A
. - Suppose
peekNext
is issued again. The focus will change to A. The group becomesC B [A]
. - Suppose
switch
is issued next. A will be promoted first and focus will switch to the next container C. The group becomes[C] A B
.
If the current focus not in the group, the next switch
or peek
command will focus on the first container in the group.
License
i3-focus-group
Copyright (C) 2024 DCsusnet
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file i3-focus-group-0.1.5.tar.gz
.
File metadata
- Download URL: i3-focus-group-0.1.5.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dd72e4610ebd212b60101becefa96f97d17290fbe0a8d14153e96a80fc400c8 |
|
MD5 | 08f4f278ba8b86f690ae468b9d974a87 |
|
BLAKE2b-256 | 87f115a39569687ebacab2c8fa01cc59daf100d07966a14e39f3b2885840c1f9 |
File details
Details for the file i3_focus_group-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: i3_focus_group-0.1.5-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 837edc63999b9c611b6c665920f9bbc2bc1d9cca055454afa3d533ba7865a653 |
|
MD5 | 773669e43af0bbaa580a777842390ddc |
|
BLAKE2b-256 | 54fd30565264c357f661b629dde5a38ab1d4743100bf8955ace70401e7de5e81 |