-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separated glass-ghosts and glass-components
- Loading branch information
Egil
committed
May 16, 2024
1 parent
a829296
commit cda55d6
Showing
8 changed files
with
109 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import InfiniteGlass | ||
import glass_components.components | ||
import distutils.spawn | ||
import sys | ||
import traceback | ||
import signal | ||
import os | ||
import time | ||
import click | ||
|
||
if os.environ.get("GLASS_DEBUGGER", "") == "rpdb": | ||
import rpdb | ||
rpdb.handle_trap() | ||
rpdb.handle_trap() | ||
|
||
def substring_in_list(s, lst): | ||
for item in lst: | ||
if s in item: | ||
return True | ||
return False | ||
|
||
def setup_annotator(): | ||
preloads = [] | ||
if "LD_PRELOAD" in os.environ: | ||
preloads = os.environ["LD_PRELOAD"].split(" ") | ||
if not substring_in_list('glass-annotator', preloads): | ||
preloads.append(distutils.spawn.find_executable('glass-annotator')) | ||
os.environ["LD_PRELOAD"] = " ".join(preloads) | ||
|
||
@click.command() | ||
@InfiniteGlass.profilable | ||
def main(**kw): | ||
setup_annotator() | ||
manager = None | ||
try: | ||
with InfiniteGlass.Display() as display: | ||
overlay = display.root.composite_get_overlay_window().overlay_window | ||
overlay_geom = overlay.get_geometry() | ||
|
||
gc = overlay.create_gc( | ||
foreground = display.screen().black_pixel, | ||
background = display.screen().white_pixel) | ||
overlay.rectangle(gc, 0, 0, overlay_geom.width, overlay_geom.height, onerror = None) | ||
|
||
components = glass_components.components.Components(display, **kw) | ||
|
||
manager.components.shutdown() | ||
except Exception as e: | ||
print("Components manager systemic failure, restarting: %s" % (e,)) | ||
traceback.print_exc() | ||
try: | ||
if manager is not None and hasattr(manager, "components") and hasattr(manager.components, "components_by_pid"): | ||
for pid in manager.components.components_by_pid.keys(): | ||
os.kill(pid, signal.SIGINT) | ||
except Exception as e: | ||
print(e) | ||
traceback.print_exc() | ||
os.execlp(sys.argv[0], *sys.argv) | ||
print("END") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
|
||
import setuptools | ||
|
||
setuptools.setup(name='glass-components', | ||
version='0.1', | ||
description='Components manager for InfiniteGlass', | ||
long_description='Components manager for InfiniteGlass', | ||
long_description_content_type="text/markdown", | ||
author='Egil Moeller', | ||
author_email='[email protected]', | ||
url='https://github.com/redhog/InfiniteGlass', | ||
packages=setuptools.find_packages(), | ||
install_requires=[ | ||
"click", | ||
"pyyaml", | ||
"python-slugify", | ||
"rpdb" | ||
], | ||
entry_points={ | ||
'console_scripts': [ | ||
'glass-components = glass_components.main:main', | ||
], | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
restart_components: true | ||
|
||
components: | ||
glass-input: {"command": ["glass-input"]} | ||
glass-theme: {"command": ["glass-theme"]} | ||
glass-widgets: {"command": ["glass-widgets"]} | ||
glass-animator: {"command": ["glass-animator"]} | ||
glass-renderer: {"command": ["glass-renderer-wrapper.sh"]} | ||
glass-islands: {"command": ["glass-islands"]} | ||
xkb: {"command": ["setxkbmap", "-model", "pc101", "-layout", "us"]} | ||
root-cursor: {"command": ["xsetroot", "-cursor_name", "arrow"]} | ||
panelterm: | ||
command: ["xterm", "-title", "panelterm", "-xrm", "XTerm.vt100.allowTitleOps: false"] | ||
environment: { "IG_APP_ID": "panelterm" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters