예제 #1
0
파일: plugin.py 프로젝트: 0x73/Flashlight
def results(fields, original_query):
	paths = [fields['@file']['path']] + fields['@file']['otherPaths']
	files = [path for path in paths if path and not os.path.isdir(path)]
	if is_cloudapp_installed():
		if len(files):
			_, name = os.path.split(files[0])
			return {
				"title": u"Upload '{0}' to CloudApp".format(name),
				"run_args": [files[0]],
				"webview_transparent_background": True,
				"html": centered_text.centered_text(u"Upload <strong>'{0}'</strong> with CloudApp".format(name))
			}
		else:
			return {
				"title": "Upload to CloudApp",
				"webview_transparent_background": True,
				"html": centered_text.centered_text("Pick a file.")
			}
	else:
		return {
			"title": "Upload to CloudApp",
			"html": centered_text.centered_text("<a href='http://getcloudapp.com'>Install CloudApp</a> to share this file."),
			"webview_transparent_background": True,
			"webview_links_open_in_browser": True
		}
예제 #2
0
def results(fields, original_query):
	operation = None
	for op in ['move', 'copy', 'delete']:
		if op in fields:
			operation = op
	if operation:
		params = fields[operation]
		files = params.get('@file_all', [params['@file']])
		path1 = files[0]['path']
		path2 = files[1]['path'] if operation != 'delete' else TRASH
		if operation == 'copy':
			title = u"Copy {0} to {1}".format(name_for_path(path1), name_for_path(path2))
			html = centered_text(html_for_operation("copy to", path1, path2))
		elif operation == 'move':
			title = u"Move {0} to {1}".format(name_for_path(path1), name_for_path(path2))
			html = centered_text(html_for_operation("move to", path1, path2))
		elif operation == 'delete':
			title = u"Delete {0}".format(name_for_path(path1))
			html = centered_text(html_for_operation("move to", path1, path2))
		return {
			"title": title,
			"html": html,
			"webview_transparent_background": True,
			"run_args": [operation, path1, path2]
		}
예제 #3
0
def results(parsed, original_query):
    if '~unknown_language' in parsed:
      from centered_text import centered_text
      return {
        "title": "Translate",
        "html": centered_text(u"Unsupported language: {0}".format(parsed['~unknown_language'])),
        "webview_transparent_background": True
      }
    if 'clipboard' in parsed:
      from copy_to_clipboard import clipboard_text
      text = clipboard_text()
    else:
      text = parsed['~text']
    from_lang = "auto"
    to_lang = "english"
    for key, val in parsed.iteritems():
        if key.startswith('from_language/'):
            from_lang = key.split('/')[1]
        elif key.startswith('to_language/'):
            to_lang = key.split('/')[1]
    from dark_mode import dark_mode
    color = "white" if dark_mode() else "black"
    html = open("translate.html").read().replace("----text----", text).replace("----fromlang----", lang_codes[from_lang]).replace("----tolang----", lang_codes[to_lang]).replace("----color----", color)
    if from_lang == 'auto':
        title = "Translate \"{0}\" to {1}".format(text, to_lang)
    else:
        title = "Translate \"{0}\" from {1} to {2}".format(text, from_lang, to_lang)
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
        "pass_result_of_output_function_as_first_run_arg": True,
        "run_args": []
    }
예제 #4
0
def deriveddata():
	return {
		"title": "Delete Xcode Derived Data",
		"html": centered_text("Press enter to delete Xcode's derived data."),
		"webview_transparent_background": True,
		"run_args": ["rm -rf -r ~/Library/Developer/Xcode/DerivedData", "Deleted derived data!"]
	}
예제 #5
0
def results(parsed, original_query):
  	target = parsed.values()[0]

  	# target cases
	if target in ("up", "increase", "incr", "higher"):
  		title = "Adjust resolution a step higher"
  		script = "up"

	elif target in ("down", "decrease", "decr", "lower"):
		title = "Adjust resolution a step lower"
  		script = "down"

	elif target in ("max", "maximum", "maximize", "highest", "most"):
		title = "Adjust resolution to maximum"
  		script = "max"

	elif target in ("min", "minimum", "minimize", "lowest", "least"):
		title = "Adjust resolution to minimum"
  		script = "min"

  	elif target in ("default", "def", "reset", "standard"):
  		title = "Adjust resolution to default"
  		script = "default"

  	else: 
  		title = "Invalid target resolution"
  		script = "invalid"

	return {
		"title": title,
		"run_args": [script],
		"html": centered_text(title, hint_text="Press enter to apply."),
		"webview_transparent_background": True
	}
예제 #6
0
def results(parsed, original_query):
    target = parsed.values()[0]

    # target cases
    if target in ("up", "increase", "incr", "higher"):
        title = "Adjust resolution a step higher"
        script = "up"

    elif target in ("down", "decrease", "decr", "lower"):
        title = "Adjust resolution a step lower"
        script = "down"

    elif target in ("max", "maximum", "maximize", "highest", "most"):
        title = "Adjust resolution to maximum"
        script = "max"

    elif target in ("min", "minimum", "minimize", "lowest", "least"):
        title = "Adjust resolution to minimum"
        script = "min"

    elif target in ("default", "def", "reset", "standard"):
        title = "Adjust resolution to default"
        script = "default"

    else:
        title = "Invalid target resolution"
        script = "invalid"

    return {
        "title": title,
        "run_args": [script],
        "html": centered_text(title, hint_text="Press enter to apply."),
        "webview_transparent_background": True
    }
예제 #7
0
파일: plugin.py 프로젝트: habi/Flashlight
def results(parsed, original_query):
    if '~unknown_language' in parsed:
      from centered_text import centered_text
      return {
        "title": "Translate",
        "html": centered_text(u"Unsupported language: {0}".format(parsed['~unknown_language'])),
        "webview_transparent_background": True
      }
    text = parsed['~text']
    from_lang = "auto"
    to_lang = "english"
    for key, val in parsed.iteritems():
        if key.startswith('from_language/'):
            from_lang = key.split('/')[1]
        elif key.startswith('to_language/'):
            to_lang = key.split('/')[1]
    html = open("translate.html").read().replace("----text----", text).replace("----fromlang----", lang_codes[from_lang]).replace("----tolang----", lang_codes[to_lang])
    if from_lang == 'auto':
        title = "Translate \"{0}\" to {1}".format(text, to_lang)
    else:
        title = "Translate \"{0}\" from {1} to {2}".format(text, from_lang, to_lang)
    return {
        "title": title,
        "html": html
    }
예제 #8
0
파일: plugin.py 프로젝트: 0x73/Flashlight
def results(parsed, query):
  from centered_text import centered_text
  return {
    "title": i18n.localstr("Large Text"),
    "html": centered_text(parsed['~text'], hint_text=i18n.localstr("Press enter to show full-screen")),
    "webview_transparent_background": True,
    "run_args": [parsed['~text']]
  }
예제 #9
0
def results(fields, original_query):
	contact = find_contact(fields)
	phone = get_preferred_phone(fields, contact)
	facetime = 'facetime' in original_query
	action = 'FaceTime' if facetime else 'Call'
	name = contact.get('displayName', phone)
	title = u"{0} {1}".format(action, name)
	from centered_text import centered_text
	if name == phone:
		html = centered_text(u"<p><span class='icon-phone'></span> {0}</p>".format(phone))
	else:
		html = centered_text(u" <h1>{0}</h1> <p><span class='icon-phone'></span> {1}</p>  ".format(name, phone))
	return {
		"title": title,
		"html": html,
		"webview_transparent_background": True,
		"run_args": [phone, facetime]
	}
예제 #10
0
def results(fields, original_query):
	contact = find_contact(fields)
	phone = get_preferred_phone(fields, contact)	
	facetime = 'facetime' in original_query
	action = 'FaceTime' if facetime else 'Call'
	name = contact.get('displayName', phone)
	title = u"{0} {1}".format(action, name)
	from centered_text import centered_text
	if name == phone:
		html = u"<p><span class='icon-phone'></span> {0}</p>".format(centered_text(phone))
	else:
		html = centered_text(u" <h1>{0}</h1> <p><span class='icon-phone'></span> {1}</p>  ".format(name, phone))
	return {
		"title": title,
		"html": html,
		"webview_transparent_background": True,
		"run_args": [phone, facetime]
	}
예제 #11
0
def results(fields, original_query):
    from centered_text import centered_text

    application = fields["~application"]
    return {
        "title": "Merge All '{0}' Windows".format(application),
        "run_args": [application],
        "html": centered_text(u'Merge All "{0}" Windows'.format(application.capitalize())),
        "webview_transparent_background": True,
    }
예제 #12
0
def results(parsed, query):
    from centered_text import centered_text
    return {
        "title":
        i18n.localstr("Large Text"),
        "html":
        centered_text(
            parsed['~text'],
            hint_text=i18n.localstr("Press enter to show full-screen")),
        "webview_transparent_background":
        True,
        "run_args": [parsed['~text']]
    }
예제 #13
0
def results(parsed, original_query):
    if '~unknown_language' in parsed:
      from centered_text import centered_text
      return {
        "title": "Translate",
        "html": centered_text(u"Unsupported language: {0}".format(parsed['~unknown_language'])),
        "webview_transparent_background": True
      }
    if 'clipboard' in parsed:
      from copy_to_clipboard import clipboard_text
      text = clipboard_text()
    else:
      text = parsed['~text']
    from_lang = "auto"
    to_lang = "english"
    for key, val in parsed.iteritems():
        if key.startswith('from_language/'):
            from_lang = key.split('/')[1]
        elif key.startswith('to_language/'):
            to_lang = key.split('/')[1]
    from dark_mode import dark_mode
    color = "white" if dark_mode() else "black"
    html = open("translate.html").read().replace("----text----", text).replace("----fromlang----", lang_codes[from_lang]).replace("----tolang----", lang_codes[to_lang]).replace("----color----", color)


    if from_lang == 'auto':
        title = u"Translate \"{0}\" to {1}".format(text, to_lang)
    else:
        title = u"Translate \"{0}\" from {1} to {2}".format(text, from_lang, to_lang)

    # Temporary Fix, adapted from Google Translate plugin
    url = 'https://translate.google.com/m/translate#<LANG_FROM>/<LANG_TO>/<TEXT>'
    url = url.replace('<LANG_FROM>', lang_codes[from_lang])
    url = url.replace('<LANG_TO>', lang_codes[to_lang])
    url = url.replace('<TEXT>', urllib.quote_plus(text))

    return {
        "title": title,
        "html": "<script>window.location=%s</script>" % json.dumps(url),
        "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
        "webview_links_open_in_browser": True,
        "run_args": [url]

        # Previous return fields
        '''
        "html": html,
        "webview_transparent_background": True,
        "pass_result_of_output_function_as_first_run_arg": True,
        "run_args": []
        '''
    }
예제 #14
0
파일: plugin.py 프로젝트: 0x73/Flashlight
def results(parsed, original_query):
	task = parsed.get('~task', 'New task')
	list_name = parsed.get('~list', '')
	tags = extract_tags(parsed)

	html = format_html(task, list_name, tags)
	run_args = [task, list_name]
	run_args.append(tags)

	return {
		'title': "Add a new task to 2Do",
		'run_args': run_args,
		'html': centered_text(html)
	}
예제 #15
0
def results(parsed, original_query):
    task = parsed.get('~task', 'New task')
    project = parsed.get('~project', 'Inbox')
    tags = extract_tags(parsed)

    html = format_html(task, project, tags)
    run_args = [task, project]
    run_args.append(tags)

    return {
        'title': "Add a new task to Tyme",
        'run_args': run_args,
        'html': centered_text(html)
    }
예제 #16
0
파일: plugin.py 프로젝트: 0x73/Flashlight
def results(parsed, original_query):
	task = parsed.get('~task', 'New task')
	project = parsed.get('~project', 'Inbox')
	tags = extract_tags(parsed)

	html = format_html(task, project, tags)
	run_args = [task, project]
	run_args.append(tags)

	return {
		'title': "Add a new task to Tyme",
		'run_args': run_args,
		'html': centered_text(html)
	}
예제 #17
0
def results(parsed, original_query):
    task = parsed.get('~task', 'New task')
    list_name = parsed.get('~list', '')
    tags = extract_tags(parsed)

    html = format_html(task, list_name, tags)
    run_args = [task, list_name]
    run_args.append(tags)

    return {
        'title': "Add a new task to 2Do",
        'run_args': run_args,
        'html': centered_text(html)
    }
예제 #18
0
def results(fields, original_query):
    paths = [fields['@file']['path']] + fields['@file']['otherPaths']
    files = [path for path in paths if path and not os.path.isdir(path)]
    if is_cloudapp_installed():
        if len(files):
            _, name = os.path.split(files[0])
            return {
                "title":
                u"Upload '{0}' to CloudApp".format(name),
                "run_args": [files[0]],
                "webview_transparent_background":
                True,
                "html":
                centered_text.centered_text(
                    u"Upload <strong>'{0}'</strong> with CloudApp".format(
                        name))
            }
        else:
            return {
                "title": "Upload to CloudApp",
                "webview_transparent_background": True,
                "html": centered_text.centered_text("Pick a file.")
            }
    else:
        return {
            "title":
            "Upload to CloudApp",
            "html":
            centered_text.centered_text(
                "<a href='http://getcloudapp.com'>Install CloudApp</a> to share this file."
            ),
            "webview_transparent_background":
            True,
            "webview_links_open_in_browser":
            True
        }
예제 #19
0
파일: plugin.py 프로젝트: 0x73/Flashlight
def results(fields, original_query):
	from centered_text import centered_text
	
	visible = 'show' in fields
	description = 'visible' if visible else 'hidden'
	if visible == icons_visible():
		return None
	else:
		text = "Show desktop icons" if visible else "Hide desktop icons"
		return {
			"title": text,
			"run_args": [visible],
			"html": centered_text(text, "PRESS ENTER"),
			"webview_transparent_background": True
		}
예제 #20
0
def results(fields, original_query):
    from centered_text import centered_text

    visible = 'show' in fields
    description = 'visible' if visible else 'hidden'
    if visible == icons_visible():
        return None
    else:
        text = "Show desktop icons" if visible else "Hide desktop icons"
        return {
            "title": text,
            "run_args": [visible],
            "html": centered_text(text, "PRESS ENTER"),
            "webview_transparent_background": True
        }
예제 #21
0
파일: plugin.py 프로젝트: 11liju/Flashlight
def results(fields, original_query):
  # print fields['@date']
  d = None
  has_time = False
  if '@date' in fields:
    timestamp, resolution = fields['@date']
    has_time = resolution < 24 * 60 * 60
    d = datetime.datetime.fromtimestamp(timestamp)
  date = "<p><strong>{0}</strong></p>".format(d.strftime("%A, %B %d %Y"))
  time = "<p>{0}</p>".format(d.strftime("%I:%M %p")) if has_time else ""
  return {
    "title": original_query,
    "html": centered_text(date + time, "Press Enter to open in Calendar"),
    "webview_transparent_background": True,
    "run_args": [timestamp]
  }
예제 #22
0
def results(fields, original_query):
	url = (fields.get('~url') if fields else original_query).strip().encode('utf-8')
	if ' ' in url: return []
	parsed = urlparse.urlparse(url)
	if not parsed.scheme:
		url = 'http://' + url
		parsed = urlparse.urlparse(url)
	if not parsed or '.' not in parsed.netloc: return []
	url = urlparse.urlunparse(parsed)
	link = "<a href='{0}'>{0}</a>".format(url)
	return {
	"title": "{0} - open URL".format(parsed.netloc),
	"run_args": [url],
	"html": centered_text(link, hint_text="Press enter to launch a browser"),
	"webview_transparent_background": True,
	"dont_force_top_hit": (not fields)
	}
예제 #23
0
파일: plugin.py 프로젝트: 0x73/Flashlight
def results(parsed, original_query):
		settings = json.load(open('preferences.json'))
		shortcuts = settings["shortcuts"]
		count = len(shortcuts)
		for i in range(count): 
				url = shortcuts[i]["url"]
				shortcut = shortcuts[i]["shortcut"]
				if shortcut.lower() == original_query.lower():
						if url.startswith('http') == False: 
								if not '//' in url: 
										url = "http://" + url
						link = "<a href='{0}'>{0}</a>".format(url)
						return {
						"title": u"Open " + url,
						"run_args": [url],
						"html": centered_text(link, hint_text="Press enter to launch a browser"),
						"webview_transparent_background": True,
						}
예제 #24
0
def results(fields, original_query):
  d = None
  has_time = False
  title = "now"
  if '@date' in fields:
    timestamp = fields['@date']['timestamp']
    resolution = fields['@date']['resolution']
    title = fields['@date']['text']
    has_time = resolution < 24 * 60 * 60
    d = datetime.datetime.fromtimestamp(timestamp)
  date = "<p><strong>{0}</strong></p>".format(d.strftime("%A, %B %d %Y"))
  time = "<p>{0}</p>".format(d.strftime("%I:%M %p")) if has_time else ""
  return {
    "title": u"Date: {0}".format(title),
    "html": centered_text(date + time, "Press Enter to open in Calendar"),
    "webview_transparent_background": True,
    "run_args": [timestamp]
  }
예제 #25
0
def results(parsed, original_query):
    if '~unknown_language' in parsed:
        from centered_text import centered_text
        return {
            "title":
            "Translate",
            "html":
            centered_text(u"Unsupported language: {0}".format(
                parsed['~unknown_language'])),
            "webview_transparent_background":
            True
        }
    if 'clipboard' in parsed:
        from copy_to_clipboard import clipboard_text
        text = clipboard_text()
    else:
        text = parsed['~text']
    from_lang = "auto"
    to_lang = "english"
    for key, val in parsed.iteritems():
        if key.startswith('from_language/'):
            from_lang = key.split('/')[1]
        elif key.startswith('to_language/'):
            to_lang = key.split('/')[1]
    from dark_mode import dark_mode
    color = "white" if dark_mode() else "black"
    html = open("translate.html").read().replace("----text----", text).replace(
        "----fromlang----", lang_codes[from_lang]).replace(
            "----tolang----",
            lang_codes[to_lang]).replace("----color----", color)

    if from_lang == 'auto':
        title = u"Translate \"{0}\" to {1}".format(text, to_lang)
    else:
        title = u"Translate \"{0}\" from {1} to {2}".format(
            text, from_lang, to_lang)
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
        "pass_result_of_output_function_as_first_run_arg": True,
        "run_args": []
    }
예제 #26
0
def results(fields, original_query):
    url = (fields.get('~url')
           if fields else original_query).strip().encode('utf-8')
    if ' ' in url: return []
    parsed = urlparse.urlparse(url)
    if not parsed.scheme:
        url = 'http://' + url
        parsed = urlparse.urlparse(url)
    if not parsed or '.' not in parsed.netloc: return []
    url = urlparse.urlunparse(parsed)
    link = "<a href='{0}'>{0}</a>".format(url)
    return {
        "title": "{0} - open URL".format(parsed.netloc),
        "run_args": [url],
        "html": centered_text(link,
                              hint_text="Press enter to launch a browser"),
        "webview_transparent_background": True,
        "dont_force_top_hit": (not fields)
    }
예제 #27
0
def results(fields, original_query):
    exp = fields['~expression']

    try:
        # A buffer time to try to fix "No results." bug
        time.sleep(0.2)

        ans = eval(format_for_eval(exp))

        if ans.is_integer():  # Takes of the decimal if possible
            ans = int(ans)
    except Exception as e:
        ans = 'N/A'
    from centered_text import centered_text
    equation_html = '<div id=\'exp\'>{0} =</div><hr><div id=\'ans\'>{1}</div>'.format(
        exp, ans)
    return {
        "title": "{0}".format(ans),
        "html": centered_text(equation_html),
        "webview_transparent_background": True
    }
예제 #28
0
def results(parsed, original_query):
    settings = json.load(open('preferences.json'))
    shortcuts = settings["shortcuts"]
    count = len(shortcuts)
    for i in range(count):
        url = shortcuts[i]["url"]
        shortcut = shortcuts[i]["shortcut"]
        if shortcut.lower() == original_query.lower():
            if url.startswith('http') == False:
                if not '//' in url:
                    url = "http://" + url
            link = "<a href='{0}'>{0}</a>".format(url)
            return {
                "title":
                u"Open " + url,
                "run_args": [url],
                "html":
                centered_text(link,
                              hint_text="Press enter to launch a browser"),
                "webview_transparent_background":
                True,
            }
예제 #29
0
def results(fields, original_query):
    from dark_mode import dark_mode
    items = menu_items()
    if items != None:
        # remove submenus from results:
        menus = set((i.parent_path() for i in items))
        items = [i for i in items if i.full_path() + u"/" not in menus]
        # filter items:
        if '~item' in fields:
            query = fields['~item']
            for item in items:
                item.score = item.match_score(query)
            items = [item for item in items if item.score > 0]
            items.sort(key=lambda x: -x.score)
        # truncate items:
        n_more = max(0, len(items) - 10)
        if n_more:
            items = items[:-n_more]
        # generate html:
        html = u"""
		<style>
		body {
			padding: 0;
			margin: 0;
			font-family: "HelveticaNeue";
		}
		body.dark {
			color: white;
		}
		body.light {
			color: black;
		}
		ol {
			list-style-type: none;
			padding: 0;
			cursor: default;
		}
		ol#items > li {
			border-bottom: 1px solid rgba(120,120,120,0.2);
			padding: 0.5em;
			font-size: small;
		}
		ol#items > li:last-child {
			border-bottom: none;
		}
		ol.path {
			display: inline;
		}
		ol.path > li {
			display: inline-block;
			opacity: 0.6;
		}
		ol.path > li:after {
			content: "⟩";
			display: inline-block;
			padding-left: 0.5em;
			padding-right: 0.5em;
			opacity: 0.7;
		}
		.title {
			font-weight: bold;
		}
		.nmore {
			text-align: center;
			font-size: small;
			opacity: 0.5;
		}
		
		ol#items > li:first-child {
			background-color: rgba(125, 125, 125, 0.3);
		}
		
		/*ol#items:not(:hover) > li:first-child, ol#items:hover > li:hover {
			background-color: rgba(125, 125, 125, 0.3);
		}*/
		
		</style>
		
		<ol id='items'>
		<!--ITEMS-->
		</ol>
		""".replace(u"<!--ITEMS-->",
              u"".join([i.html() for i in items
                        ])).replace("<!--COLOR-->",
                                    ("dark" if dark_mode() else "light"))
        if n_more:
            html += u"<p class='nmore'>{0} more...</p>".format(n_more)
    else:
        from centered_text import centered_text
        html = centered_text("""
		<style>
		p {
			margin: 10px;
			font-size: 15px;
		}
		</style>
		<p>Spotlight needs accessibility permissions to search menu items.</p>
		<p><img src='settings.png' style='max-width: 250px'/></p>
		<p><button onclick="flashlight.bash('open /System/Library/PreferencePanes/Security.prefPane')">Open Privacy Settings</button></p>
		""")
    d = {
        "title": "Search menu items",
        "html": html,
        "webview_transparent_background": True
    }
    if items and len(items) > 0:
        d['run_args'] = [items[0].applescript]
    return d
예제 #30
0
파일: plugin.py 프로젝트: 0x73/Flashlight
def results(fields, original_query):
	from dark_mode import dark_mode
	items = menu_items()
	if items != None:
		# remove submenus from results:
		menus = set((i.parent_path() for i in items))
		items = [i for i in items if i.full_path() + u"/" not in menus]
		# filter items:
		if '~item' in fields:
			query = fields['~item']
			for item in items:
				item.score = item.match_score(query)
			items = [item for item in items if item.score > 0]
			items.sort(key=lambda x: -x.score)
		# truncate items:
		n_more = max(0, len(items) - 10)
		if n_more:
			items = items[:-n_more]
		# generate html:
		html = u"""
		<style>
		body {
			padding: 0;
			margin: 0;
			font-family: "HelveticaNeue";
		}
		body.dark {
			color: white;
		}
		body.light {
			color: black;
		}
		ol {
			list-style-type: none;
			padding: 0;
			cursor: default;
		}
		ol#items > li {
			border-bottom: 1px solid rgba(120,120,120,0.2);
			padding: 0.5em;
			font-size: small;
		}
		ol#items > li:last-child {
			border-bottom: none;
		}
		ol.path {
			display: inline;
		}
		ol.path > li {
			display: inline-block;
			opacity: 0.6;
		}
		ol.path > li:after {
			content: "⟩";
			display: inline-block;
			padding-left: 0.5em;
			padding-right: 0.5em;
			opacity: 0.7;
		}
		.title {
			font-weight: bold;
		}
		.nmore {
			text-align: center;
			font-size: small;
			opacity: 0.5;
		}
		
		ol#items > li:first-child {
			background-color: rgba(125, 125, 125, 0.3);
		}
		
		/*ol#items:not(:hover) > li:first-child, ol#items:hover > li:hover {
			background-color: rgba(125, 125, 125, 0.3);
		}*/
		
		</style>
		
		<ol id='items'>
		<!--ITEMS-->
		</ol>
		""".replace(u"<!--ITEMS-->", u"".join([i.html() for i in items])).replace("<!--COLOR-->", ("dark" if dark_mode() else "light"))
		if n_more:
			html += u"<p class='nmore'>{0} more...</p>".format(n_more)
	else:
		from centered_text import centered_text
		html = centered_text("""
		<style>
		p {
			margin: 10px;
			font-size: 15px;
		}
		</style>
		<p>Spotlight needs accessibility permissions to search menu items.</p>
		<p><img src='settings.png' style='max-width: 250px'/></p>
		<p><button onclick="flashlight.bash('open /System/Library/PreferencePanes/Security.prefPane')">Open Privacy Settings</button></p>
		""")
	d = {
		"title": "Search menu items",
		"html": html,
		"webview_transparent_background": True
	}
	if items and len(items) > 0:
		d['run_args'] = [items[0].applescript]
	return d