File: dec_modes_query.py

package info (click to toggle)
python-blessed 1.25-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,812 kB
  • sloc: python: 14,645; makefile: 13; sh: 7
file content (19 lines) | stat: -rw-r--r-- 610 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3
from blessed import Terminal

term = Terminal()

# Query mouse support
mode = term.DecPrivateMode(term.DecPrivateMode.MOUSE_REPORT_CLICK)
response = term.get_dec_mode(mode)

print(f"Checking {mode.name} (mode {mode.value}) {mode.long_description}: ", end="")

if response.supported:
    status = "enabled" if response.enabled else "disabled"
    state = "permanently" if response.permanent else "temporarily"
    print(f"Supported and {status} {state}")
elif response.failed:
    print("Terminal does not support DEC mode queries")
else:
    print("Mode not supported by this terminal")