Esempio n. 1
0
def view_image(uri, duration):
    logging.debug('Displaying image %s for %s seconds.' % (uri, duration))

    if asset_is_accessible(uri):
        sh.feh(uri, scale_down=True, borderless=True, fullscreen=True, cycle_once=True, slideshow_delay=duration)
    else:
        logging.debug('Received non-200 status (or file not found if local) from %s. Skipping.' % (uri))
Esempio n. 2
0
def view_image(uri, duration):
    logging.debug('Displaying image %s for %s seconds.' % (uri, duration))

    if asset_is_accessible(uri):
        run = sh.feh(uri, scale_down=True, borderless=True, fullscreen=True, cycle_once=True, slideshow_delay=duration, _bt=True)
        # Wait until feh is starting before clearing the browser. This minimises delay between
        # web and image content.
        browser_clear()
        run.wait()
    else:
        logging.debug('Received non-200 status (or file not found if local) from %s. Skipping.' % (uri))
Esempio n. 3
0
def toggle_load_screen(status=True):
    """
    Toggle the load screen. Set status to either True or False.
    """
    load_screen = '/home/pi/screenly/loading.jpg'
    global load_screen_pid

    if (status and path.isfile(load_screen)):
        image_loader = sh.feh(load_screen, scale_down=True, borderless=True, fullscreen=True, _bg=True)
        load_screen_pid = image_loader.pid
        return image_loader.pid

    elif not status and load_screen_pid:
        kill(load_screen_pid, signal.SIGTERM)
        load_screen_pid = None
        return True
    else:
        return False
Esempio n. 4
0
def toggle_load_screen(status=True):
    """
    Toggle the load screen. Set status to either True or False.
    """

    load_screen = '/home/pi/screenly/loading.jpg'
    global load_screen_pid

    if status and path.isfile(load_screen):
        if not load_screen_pid:
            image_loader = sh.feh(load_screen, scale_down=True, borderless=True, fullscreen=True, _bg=True)
            load_screen_pid = image_loader.pid
            logging.debug("Load screen PID: %d." % load_screen_pid)
        else:
            # If we're already showing the load screen, just make sure it's on top.
            send_to_front("feh")
    elif not status and load_screen_pid:
        logging.debug("Killing load screen with PID: %d." % load_screen_pid)
        kill(load_screen_pid, signal.SIGTERM)
        load_screen_pid = None

    return load_screen_pid
Esempio n. 5
0
# this string if your java app doesn't work correctly. We may as well just lie
# and say that we're a working one by default.
#
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
# java that happens to be on java's whitelist.
wmname = "LG3D"

def ensure_running(proc_name, run_proc):
  def start_if_required():
    try:
      sh.pidof(proc_name)
    except sh.ErrorReturnCode:
      run_proc()
  return start_if_required

startup_apps = [lambda: sh.wmname(wmname),
                lambda: sh.dropbox("start", "-i", _bg=True),
                lambda: sh.feh("--bg-fill", "/home/tjarvstrand/Pictures/Wallpapers/1.jpeg", _bg=True),
                ensure_running("nm-applet", lambda: sh.nm_applet(_bg=True)),
                # TODO Run these from the xsession or something
                ensure_running("copyq", lambda: sh.copyq(_bg=True)),
                ensure_running("blueman-applet", lambda: sh.blueman_applet(_bg=True)),
                ensure_running("xfce4-power-manager", lambda: sh.xfce4_power_manager(_bg=True)),
                ensure_running("light-locker", lambda: sh.light_locker(_bg=True))
]

@hook.subscribe.startup_complete
def start_apps():
    for start_app in startup_apps:
        start_app()