File: wephyr

package info (click to toggle)
qtile 0.34.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,004 kB
  • sloc: python: 49,959; ansic: 4,371; xml: 324; sh: 260; makefile: 218
file content (59 lines) | stat: -rwxr-xr-x 1,435 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
#
# The Wayland backend's equivalent to the xephyr script
#
# The QTILE_XEPHYR environmental variable is set to 2 in this script, which can
# be used by configs to detect when they are run via this script.
#

import os
import signal
import subprocess
import sys
import time
from pathlib import Path

BASE_DIR = Path(__file__).parent.parent.resolve()
sys.path.insert(0, BASE_DIR)

from libqtile.utils import get_cache_dir, guess_terminal  # noqa: E402

CACHE_DIR = Path(get_cache_dir())
QTILE = BASE_DIR / "libqtile" / "scripts" / "main.py"


# This script can be configured with environmental variables and arguments:
outputs = os.environ.get("OUTPUTS", 1)
app = os.environ.get("APP", guess_terminal())
log_level = os.environ.get("LOG_LEVEL", "INFO")

cmd = [sys.executable, QTILE.as_posix(), "start", "-b", "wayland", "-l", log_level]
cmd.extend(sys.argv[1:])


# Find the display that the app needs
display = os.environ.get("WAYLAND_DISPLAY", "")
if display:
    display = display[:-1] + str(int(display[-1]) + 1)
else:
    display = "wayland-0"

os.environ["QTILE_XEPHYR"] = "2"
os.environ["WLR_X11_OUTPUTS"] = str(outputs)
os.environ["WLR_WL_OUTPUTS"] = str(outputs)

proc = subprocess.Popen(cmd)

time.sleep(1)
os.environ["WAYLAND_DISPLAY"] = display
app_proc = subprocess.Popen(app)


# Suppress KeyboardInterrupt messages
def noop(signal, frame):
    pass


signal.signal(signal.SIGINT, noop)

proc.wait()