mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 07:08:08 +00:00
Fix cursor blur. Fix scrollLock on focus/blur. Rework binaries.
This commit is contained in:
43
scripts/butterfly
Executable file
43
scripts/butterfly
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
if (os.getenv('COLORTERM', '') != 'butterfly' and
|
||||
len(sys.argv) == 1) or (
|
||||
os.getenv('COLORTERM', '') == 'butterfly' and
|
||||
len(sys.argv) > 1 and sys.argv[1] == 'run'):
|
||||
os.execvp('butterfly.server.py', [
|
||||
'butterfly', '--unsecure', '--port=0', '--one-shot'])
|
||||
|
||||
path = os.getenv('BUTTERFLY_PATH')
|
||||
if not path:
|
||||
try:
|
||||
import butterfly
|
||||
path = os.path.join(
|
||||
os.path.dirname(butterfly.__file__), 'bin')
|
||||
except Exception:
|
||||
pass
|
||||
os.putenv('BUTTERFLY_PATH', path)
|
||||
if path is None:
|
||||
print("Can't get butterfly path. Aborting.")
|
||||
sys.exit(1)
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
description='Butterfly launcher. Please specify a command')
|
||||
parser.add_argument('-h', '--help', action="store_true",
|
||||
help="show this help message and exit")
|
||||
parser.add_argument(
|
||||
'command',
|
||||
nargs='?',
|
||||
choices=[x[:-3] for x in os.listdir(path) if x.endswith('.py')])
|
||||
|
||||
args, _ = parser.parse_known_args()
|
||||
|
||||
if not args.command:
|
||||
parser.print_help()
|
||||
else:
|
||||
file_ = os.path.join(path, '%s.py' % args.command)
|
||||
sys.argv = sys.argv[1:]
|
||||
exec(compile(open(file_).read(), file_, 'exec'))
|
||||
Reference in New Issue
Block a user