123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- """
- rescriptoon
- Copyright (C) 2018-2019 Fabian Peter Hammerle <fabian@hammerle.me>
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
- """
- import argparse
- import logging
- from Xlib import X, XK
- import rescriptoon
- _DEFAULT_TOGGLE_KEYSYM_NAME = "grave"
- def main() -> None:
- logging.basicConfig(level=logging.DEBUG)
- argparser = argparse.ArgumentParser(
- description="Attach resriptoon to running Toontown Rewritten engines.",
- )
- argparser.add_argument(
- "--toggle",
- "-t",
- metavar="KEYSYM_NAME",
- dest="toggle_keysym_name",
- default=_DEFAULT_TOGGLE_KEYSYM_NAME,
- help="key to turn extended keyboard controls on / off."
- + " any keysym name may be used"
- + " (see XStringToKeysym & X11/keysymdef.h, "
- + " default: %(default)s)",
- )
- args = argparser.parse_args()
- toggle_keysym = XK.string_to_keysym(args.toggle_keysym_name)
- if toggle_keysym == X.NoSymbol:
- raise ValueError(
- "controls toggle: unknown keysym name '{}'".format(args.toggle_keysym_name)
- )
- rescriptoon.Overlay(toggle_keysym=toggle_keysym).run()
|