qtile lazy functions
Finally got them! Or maybe wasn’t clear in older versions of the docu.
Lazy objects — Qtile 0.1.dev50+g2b2cd60.d20220610 documentation
Option 1:
from libqtile.config import Key
from libqtile.lazy import lazy
@lazy.function
def my_function(qtile):
...
keys = [
Key(
["mod1"], "k",
my_function
)
]
Option 2:
from libqtile.lazy import lazy
from libqtile.log_utils import logger
def multiply(qtile, value, multiplier=10):
logger.warning(f"Multiplication results: {value * multiplier}")
keys = [
Key(
["mod1"], "k",
lazy.function(multiply, 10, multiplier=2)
)
]
Or decorated version
from libqtile.config import Key
from libqtile.lazy import lazy
from libqtile.log_utils import logger
@lazy.function
def multiply(qtile, value, multiplier=10):
logger.warning(f"Multiplication results: {value * multiplier}")
keys = [
Key(
["mod1"], "k",
multiply(10, multiplier=2)
)
]
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus