diff --git a/brotab_ulauncher/extension.py b/brotab_ulauncher/extension.py index 664233f..5191cc3 100644 --- a/brotab_ulauncher/extension.py +++ b/brotab_ulauncher/extension.py @@ -19,8 +19,6 @@ from brotab_ulauncher.client import BrotabClient from brotab_ulauncher.listeners import KeywordQueryEventListener, ItemEnterEventListener -DISPLAY_MAX_RESULTS = 20 - class BrotabExtension(Extension): """ Main Extension Class """ @@ -64,17 +62,29 @@ def search_tabs(self, event): items = [] tabs = self.brotab_client.search_tabs(event.get_argument()) - for tab in tabs[:DISPLAY_MAX_RESULTS]: + max_results = int(self.preferences["max_results"]) + + for tab in tabs[:max_results]: data = {"tab": tab["prefix"], "mode": self.mode} - items.append( - ExtensionSmallResultItem( - icon="images/%s" % tab["icon"], - name=tab["name"], - description=tab["url"], - on_enter=ExtensionCustomAction(data), - on_alt_enter=CopyToClipboardAction(tab["url"]), - )) + if self.preferences["show_url"] == "Yes": + items.append( + ExtensionResultItem( + icon="images/%s" % tab["icon"], + name=tab["name"], + description=tab["url"], + on_enter=ExtensionCustomAction(data), + on_alt_enter=CopyToClipboardAction(tab["url"]), + )) + else: + items.append( + ExtensionSmallResultItem( + icon="images/%s" % tab["icon"], + name=tab["name"], + description=tab["url"], + on_enter=ExtensionCustomAction(data), + on_alt_enter=CopyToClipboardAction(tab["url"]), + )) if not items: return self.show_no_results_message() diff --git a/manifest.json b/manifest.json index 14abcfa..d609bcc 100644 --- a/manifest.json +++ b/manifest.json @@ -21,6 +21,21 @@ "name": "Closetab", "description": "Close an active tab WARNING: Only is ready to accept cltab, cl or clt keywords", "default_value": "cltab" + }, + { + "id": "show_url", + "type": "select", + "name": "Show URL", + "description": "Show URL in search results", + "default_value": "No", + "options":["Yes","No"] + }, + { + "id": "max_results", + "type": "input", + "name": "Max Results", + "description": "Maximum number of search results to show.", + "default_value": 20 } ] }