Add mutable scratch functionality to qtile
Project description
qtile MutableScratch
This package is a series of functions and a class to create a "scratch" space
in qtile more similar to i3's. qtile has the ScratchPad group type, but the
(documented) purpose is to only host Dropdown windows that must be specified
ahead of time.
Instead, what MutableScratch does is piggybacks onto an "invisible" qtile
Group (ie. a group named '') and provide functions to dynamically add and
remove windows to this group. Viewing the "hidden" windows is done via a toggle
function, which cycles through the windows in the Scratch group. All windows
added to the MutableScratch group will be automatically converted to
floating. This emulates the scratch functionality of i3 as closely as possible.
See repository README for most up-to-date documentation.
Installation
You can now install via pip:
pip install qtile_mutable_scratch
Setup
Put the following default configuration in your config.py:
import qtile_mutable_scratch
from libqtile.config import EzKey
from libqtile import hook
...
mutscr = qtile_mutable_scratch.MutableScratch()
groups.append(Group('')) # Must be after `groups` is created
keys.extend( [
EzKey('M-S-<minus>', mutscr.add_current_window()),
EzKey('M-C-<minus>', mutscr.remove_current_window()),
EzKey('M-<minus>', mutscr.toggle()),
] )
hook.subscribe.startup_complete(mutscr.qtile_startup)
Each MutableScratch instance has two parameters to chose from, scratch_group_name and
win_attr.
It's not necessary to set these, as the default configuration
should work for every configuration.
scratch_group_name (default '', or the empty name group) sets the name of the group that will old the scratch windows.
win_attr (default mutscratch) sets the attribute that will be set on each window to tag it as being apart of the MutableScratch system.
Usage
- Add the current window to the
MutableScratchgroup viaMutableScratch.add_current_window()- This will move the window to the invisible group
- Rotate through windows in the
MutableScratchgroup viaMutableScratch.toggle()- If the current window is apart of the
MutableScratchgroup, then it will be moved back to the invisible group - If the current window is not apart of the
MutableScratch, then the nextMutableScratchwindow in the stack will be moved to the current group
- If the current window is apart of the
- To remove a window from the
MutableScratchgroup, useMutableScratch.remove()
Hastily thrown together demo video:
It's ugly, but it get's the point across...hopefully.
Implementation Details
Tracking members of the MutableScratch group
This is done by dynamically adding an attribute (by default mutscratch) to
the window object that simply stores a boolean.
Cycling through windows in MutableScratch
MutableScratch has something similar to qtile's focus_history for groups.
It's effectively just a stack of windows belonging to the MutableScratch group, where windows are pushed and popped from the stack.
Doing this,MutableScratch controls the order in which the windows are stored in the stack.
This ensures that the every window in the MutableScratch group can be accessed via toggle.
Initializing the MutableScratch on qtile start
When restarting qtile, the MutableScratch instance in config.py will be overwritten, losing the stack history and the floating window status of it's windows.
To stop this, we add a hook function to startup_complete that will reinitialize a new MutableScratch instance with the windows that are located in the MutableScratch.scratch_group_name.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qtile_mutable_scratch-0.0.4.tar.gz.
File metadata
- Download URL: qtile_mutable_scratch-0.0.4.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.2 cpython/3.14.2 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d0c20c1fb2f1585e355b33b48670c42edc00316800bea6ffad65bbba55fb1bb
|
|
| MD5 |
613aa5e1e35f5b56135f5f44bceae72b
|
|
| BLAKE2b-256 |
3b94a07351a17171d6b4ac1d3926e2bd0b36ce990a1498d6625eb093d51fed0b
|
File details
Details for the file qtile_mutable_scratch-0.0.4-py3-none-any.whl.
File metadata
- Download URL: qtile_mutable_scratch-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.2 cpython/3.14.2 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2574643b40969465f12c0541be6ac83f05016a3daff591d160e2db82d0c0a13
|
|
| MD5 |
a6f2a84671be1fa20a6a07c00fd6dce1
|
|
| BLAKE2b-256 |
9b043657ca5a686e5725f06ffb5031f304b346d7e075bb4293c4cbd7ff6d9c70
|