Skip to content
This repository was archived by the owner on May 4, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions gh/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self):
self.subscribe(ItemEnterEvent, ItemEnterEventListener())

self.icon_path = 'images/icon.png'
self.os_notifs = None
self.github: Github = None
self.user: AuthenticatedUser = None
self.cache = Cache(CACHE_DIR)
Expand All @@ -83,7 +84,7 @@ def fetch_data_from_github(self):
sync_service = GitHubDataSync(self.github, self.cache)

try:

self.preferences
self.show_notification("Indexing GitHub data")

start_time = time.time()
Expand Down Expand Up @@ -116,11 +117,12 @@ def show_message_no_results(self, search_query):

def show_notification(self, text: str):
"""
Shows a notification
Shows a notification, if notifications are enabled
Args:
text (str): The text to display on the notification
"""
Notify.Notification.new("Ulauncher GitHub", text).show()
if self.os_notifs == "true":
Notify.Notification.new("Ulauncher GitHub", text).show()

def handle_github_exception(self, e: GithubException):
logger.error(e)
Expand Down
2 changes: 2 additions & 0 deletions gh/listeners/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class PreferencesEventListener(EventListener):

def on_event(self, event, extension):
""" Handle event """
extension.os_notifs = event.preferences['os_notifs']
logger.error(extension.os_notifs)
extension.github = Github(event.preferences['access_token'])
try:
extension.refresh_user()
Expand Down
8 changes: 8 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@
"name": "GitHub access token",
"description": "The Personal Access token to authenticate on GitHub API",
"default_value": ""
},
{
"id": "os_notifs",
"type": "select",
"name": "Enable Notifications?",
"description": "Should a notification be sent",
"options": [true, false],
"default_value": true
}
]
}