My Qtile window manager configuration
git clone https://github.com/m-col/qtile-config
Files | Refs | Readme

-rw-r--r-- scratchpad.py


      1 """
      2 Scratchpad and DropDowns
      3 ========================
      4 
      5 The scratchpads are the same with either backend, but the terminal used differs. I
      6 prefer these terminals over something like alacritty, which would be an easier
      7 alternative to configure because it works under both Wayland and X.
      8 """
      9 
     10 import os
     11 
     12 from libqtile import qtile
     13 from libqtile.config import DropDown, ScratchPad
     14 from libqtile.lazy import lazy
     15 
     16 HOME: str = os.path.expanduser("~")
     17 IS_WAYLAND: bool = qtile.core.name == "wayland"
     18 IS_XEPHYR: bool = int(os.environ.get("QTILE_XEPHYR", 0)) > 0
     19 mod = "mod1" if IS_XEPHYR else "mod4"
     20 
     21 
     22 if IS_WAYLAND:
     23     term = "foot "
     24 else:
     25     term = "xterm -e "
     26 
     27 
     28 conf = {
     29     "warp_pointer": False,
     30     "on_focus_lost_hide": False,
     31     "opacity": 1,
     32 }
     33 
     34 GHCI = "ghci"
     35 # GHCI = "ghci-9.2.2"
     36 
     37 dropdowns = [
     38     DropDown("tmux", term + "tmux", height=0.4, **conf),
     39     DropDown(
     40         "ncmpcpp", term + "ncmpcpp", x=0.12, y=0.2, width=0.56, height=0.7, **conf
     41     ),
     42     DropDown("python", term + "python", x=0.05, y=0.1, width=0.2, height=0.3, **conf),
     43     DropDown(GHCI, term + GHCI, y=0.6, height=0.4, **conf),
     44 ]
     45 
     46 
     47 # Keybindings to open each DropDown
     48 keys_scratchpad = [
     49     (
     50         [mod, "shift"],
     51         "Return",
     52         lazy.group["scratchpad"].dropdown_toggle("tmux"),
     53         "Toggle tmux scratchpad",
     54     ),
     55     (
     56         [mod, "control"],
     57         "m",
     58         lazy.group["scratchpad"].dropdown_toggle("ncmpcpp"),
     59         "Toggle ncmpcpp scratchpad",
     60     ),
     61     (
     62         [mod],
     63         "c",
     64         lazy.group["scratchpad"].dropdown_toggle("python"),
     65         "Toggle python scratchpad",
     66     ),
     67     (
     68         [mod],
     69         "g",
     70         lazy.group["scratchpad"].dropdown_toggle(GHCI),
     71         "Toggle GHCI scratchpad",
     72     ),
     73 ]
     74 
     75 scratchpad = ScratchPad("scratchpad", dropdowns)
     76