Add pre-break audible alert
This commit is contained in:
parent
51e877e9c1
commit
8156f31886
|
@ -42,13 +42,15 @@ gi.require_version('Gdk', '3.0')
|
|||
|
||||
BIN_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
|
||||
HOME_DIRECTORY = os.environ.get('HOME') or os.path.expanduser('~')
|
||||
CONFIG_DIRECTORY = os.path.join(os.environ.get('XDG_CONFIG_HOME') or os.path.join(HOME_DIRECTORY, '.config'), 'safeeyes')
|
||||
CONFIG_DIRECTORY = os.path.join(os.environ.get(
|
||||
'XDG_CONFIG_HOME') or os.path.join(HOME_DIRECTORY, '.config'), 'safeeyes')
|
||||
CONFIG_FILE_PATH = os.path.join(CONFIG_DIRECTORY, 'safeeyes.json')
|
||||
CONFIG_RESOURCE = os.path.join(CONFIG_DIRECTORY, 'resource')
|
||||
SESSION_FILE_PATH = os.path.join(CONFIG_DIRECTORY, 'session.json')
|
||||
STYLE_SHEET_PATH = os.path.join(CONFIG_DIRECTORY, 'style/safeeyes_style.css')
|
||||
SYSTEM_CONFIG_FILE_PATH = os.path.join(BIN_DIRECTORY, "config/safeeyes.json")
|
||||
SYSTEM_STYLE_SHEET_PATH = os.path.join(BIN_DIRECTORY, "config/style/safeeyes_style.css")
|
||||
SYSTEM_STYLE_SHEET_PATH = os.path.join(
|
||||
BIN_DIRECTORY, "config/style/safeeyes_style.css")
|
||||
LOG_FILE_PATH = os.path.join(HOME_DIRECTORY, 'safeeyes.log')
|
||||
SYSTEM_PLUGINS_DIR = os.path.join(BIN_DIRECTORY, 'plugins')
|
||||
USER_PLUGINS_DIR = os.path.join(CONFIG_DIRECTORY, 'plugins')
|
||||
|
@ -65,7 +67,8 @@ def get_resource_path(resource_name):
|
|||
return None
|
||||
resource_location = os.path.join(CONFIG_RESOURCE, resource_name)
|
||||
if not os.path.isfile(resource_location):
|
||||
resource_location = os.path.join(BIN_DIRECTORY, 'resource', resource_name)
|
||||
resource_location = os.path.join(
|
||||
BIN_DIRECTORY, 'resource', resource_name)
|
||||
if not os.path.isfile(resource_location):
|
||||
# Resource not found
|
||||
resource_location = None
|
||||
|
@ -317,7 +320,8 @@ def initialize_safeeyes():
|
|||
delete(os.path.join(CONFIG_DIRECTORY, 'safeeyes.json'))
|
||||
|
||||
# Remove the startup file
|
||||
delete(os.path.join(HOME_DIRECTORY, os.path.join(startup_dir_path, 'safeeyes.desktop')))
|
||||
delete(os.path.join(HOME_DIRECTORY, os.path.join(
|
||||
startup_dir_path, 'safeeyes.desktop')))
|
||||
|
||||
# Create the ~/.config/safeeyes/style directory
|
||||
mkdir(style_dir_path)
|
||||
|
@ -328,7 +332,8 @@ def initialize_safeeyes():
|
|||
|
||||
# Copy the new startup file
|
||||
try:
|
||||
os.symlink("/usr/share/applications/safeeyes.desktop", os.path.join(startup_dir_path, 'safeeyes.desktop'))
|
||||
os.symlink("/usr/share/applications/safeeyes.desktop",
|
||||
os.path.join(startup_dir_path, 'safeeyes.desktop'))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
@ -343,12 +348,14 @@ def intialize_logging(debug):
|
|||
"""
|
||||
# Configure logging.
|
||||
root_logger = logging.getLogger()
|
||||
log_formatter = logging.Formatter('%(asctime)s [%(levelname)s]:[%(threadName)s] %(message)s')
|
||||
log_formatter = logging.Formatter(
|
||||
'%(asctime)s [%(levelname)s]:[%(threadName)s] %(message)s')
|
||||
|
||||
# Append the logs and overwrite once reached 1MB
|
||||
if debug:
|
||||
# Log to file
|
||||
file_handler = RotatingFileHandler(LOG_FILE_PATH, maxBytes=1024 * 1024, backupCount=5, encoding=None, delay=0)
|
||||
file_handler = RotatingFileHandler(
|
||||
LOG_FILE_PATH, maxBytes=1024 * 1024, backupCount=5, encoding=None, delay=0)
|
||||
file_handler.setFormatter(log_formatter)
|
||||
# Log to console
|
||||
console_handler = logging.StreamHandler()
|
||||
|
@ -387,6 +394,8 @@ def __update_plugin_config(plugin, plugin_config, config):
|
|||
# Add the new settings
|
||||
for setting in plugin_config['settings']:
|
||||
setting_ids.append(setting['id'])
|
||||
if 'settings' not in plugin:
|
||||
plugin['settings'] = {}
|
||||
if plugin['settings'].get(setting['id'], None) is None:
|
||||
plugin['settings'][setting['id']] = setting['default']
|
||||
# Remove the removed ids
|
||||
|
|
|
@ -248,7 +248,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -246,7 +246,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -250,8 +250,12 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Alerta sonora en finalitzar una pausa"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -249,8 +249,12 @@ msgid "Audible Alert"
|
|||
msgstr "Zvukové upozornění"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Přehrát na konci přestávek zvukové upozornění"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -247,7 +247,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -250,8 +250,12 @@ msgid "Audible Alert"
|
|||
msgstr "Akustischer Alarm"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Akustisches Signal am Ende der Pause"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -250,8 +250,12 @@ msgid "Audible Alert"
|
|||
msgstr "Audible Alert"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr "Play audible alert before and after breaks"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr "Play audible alert before breaks"
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -249,7 +249,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -249,8 +249,12 @@ msgid "Audible Alert"
|
|||
msgstr "Helisignaal"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Pausi lõpus mängitakse helisignaali"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -249,7 +249,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -253,8 +253,12 @@ msgid "Audible Alert"
|
|||
msgstr "Alerte audible"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Émettre une alerte audible à la fin des pauses"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -54,7 +54,6 @@ msgid "Lean back at your seat and relax"
|
|||
msgstr "अपनी सीट पर वापस झुक जाओ और आराम करो"
|
||||
|
||||
# Commandline arg description
|
||||
#, fuzzy
|
||||
msgid "show the about dialog"
|
||||
msgstr "बारे में दिखाएं"
|
||||
|
||||
|
@ -248,7 +247,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -248,8 +248,12 @@ msgid "Audible Alert"
|
|||
msgstr "Hang Figyelmeztetés"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Hangos figyelmeztetés a pihenők végénél"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -246,7 +246,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -253,8 +253,12 @@ msgid "Audible Alert"
|
|||
msgstr "Avviso sonoro"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Emette un avviso acustico alla fine delle pause"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -252,8 +252,12 @@ msgid "Audible Alert"
|
|||
msgstr "Garsinis signalas"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Pertraukų pabaigoje groti garsinį signalą"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -249,7 +249,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -247,8 +247,12 @@ msgid "Audible Alert"
|
|||
msgstr "Hørbar alarm"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Annonser pauseslutt med en lyd"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -252,8 +252,12 @@ msgid "Audible Alert"
|
|||
msgstr "Hoorbare waarschuwing"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Speel een hoorbare waarschuwing af aan het einde van pauzes"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -250,8 +250,12 @@ msgid "Audible Alert"
|
|||
msgstr "Powiadomienie Dźwiękowe"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Odtwórz powiadomienie dźwiękowe pod koniec przerwy"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -252,8 +252,12 @@ msgid "Audible Alert"
|
|||
msgstr "Alerta Sonoro"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Toque um alerta sonoro no fim da parada"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -248,8 +248,12 @@ msgid "Audible Alert"
|
|||
msgstr "Звуковой сигнал"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Подать звуковой сигнал в конце перерыва"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -235,7 +235,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -249,8 +249,12 @@ msgid "Audible Alert"
|
|||
msgstr "Zvukové upozornenie"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Zvukové upozornenie na konci prestávky"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -246,7 +246,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -252,8 +252,13 @@ msgid "Audible Alert"
|
|||
msgstr "ஒலிச் சமிக்ஞய்"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "இடைவேளைகளின் முடிவில் ஒலிச் சமிக்ஞய்"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr "இடைவேளைகளின் ஆரம்பத்திலும் முடிவிலும் ஒலிச் சமிக்ஞய்"
|
||||
|
||||
# plugin/audiblealert
|
||||
#, fuzzy
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr "இடைவேளைகளின் தொடக்கத்தில் ஒலிச் சமிக்ஞய்"
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -250,8 +250,12 @@ msgid "Audible Alert"
|
|||
msgstr "Duyulabilir İkaz"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Molaların sonunda sesli bir ikaz ver"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -246,7 +246,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -252,8 +252,12 @@ msgid "Audible Alert"
|
|||
msgstr "Звукове попередження"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Відтворювати звукове попередження в кінці перерви"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -250,8 +250,12 @@ msgid "Audible Alert"
|
|||
msgstr "Thông báo âm thanh"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "Phát âm báo ở cuối mỗi lần nghỉ"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -249,8 +249,12 @@ msgid "Audible Alert"
|
|||
msgstr "声音提示"
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgstr "在休息结束时播放声音提示"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do Not Disturb"
|
||||
|
|
|
@ -247,7 +247,11 @@ msgid "Audible Alert"
|
|||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play an audible alert at the end of breaks"
|
||||
msgid "Play audible alert before and after breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/audiblealert
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr ""
|
||||
|
||||
# plugin/donotdisturb
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"meta": {
|
||||
"config_version": "6.0.0"
|
||||
"config_version": "6.0.0"
|
||||
},
|
||||
"allow_postpone": false,
|
||||
"break_interval": 15,
|
||||
|
@ -15,8 +15,7 @@
|
|||
"shortcut_skip": 9,
|
||||
"shortcut_postpone": 65,
|
||||
"strict_break": false,
|
||||
"short_breaks": [
|
||||
{
|
||||
"short_breaks": [{
|
||||
"name": "Tightly close your eyes"
|
||||
},
|
||||
{
|
||||
|
@ -38,16 +37,14 @@
|
|||
"name": "Have some water"
|
||||
}
|
||||
],
|
||||
"long_breaks": [
|
||||
{
|
||||
"long_breaks": [{
|
||||
"name": "Walk for a while"
|
||||
},
|
||||
{
|
||||
"name": "Lean back at your seat and relax"
|
||||
}
|
||||
],
|
||||
"plugins": [
|
||||
{
|
||||
"plugins": [{
|
||||
"id": "donotdisturb",
|
||||
"enabled": true,
|
||||
"version": "0.0.2",
|
||||
|
@ -66,7 +63,10 @@
|
|||
{
|
||||
"id": "audiblealert",
|
||||
"enabled": true,
|
||||
"version": "0.0.1"
|
||||
"version": "0.0.2",
|
||||
"settings": {
|
||||
"pre_break_alert": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "trayicon",
|
||||
|
@ -74,8 +74,7 @@
|
|||
"version": "0.0.1",
|
||||
"settings": {
|
||||
"show_time_in_tray": false,
|
||||
"disable_options": [
|
||||
{
|
||||
"disable_options": [{
|
||||
"time": 30,
|
||||
"unit": "minute"
|
||||
},
|
||||
|
@ -117,4 +116,4 @@
|
|||
"version": "0.0.1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,16 +1,21 @@
|
|||
{
|
||||
"meta": {
|
||||
"name": "Audible Alert",
|
||||
"description": "Play an audible alert at the end of breaks",
|
||||
"version": "0.0.1"
|
||||
"description": "Play audible alert before and after breaks",
|
||||
"version": "0.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"python_modules": [],
|
||||
"shell_commands": ["aplay"],
|
||||
"operating_systems": [],
|
||||
"desktop_environments": [],
|
||||
"resources": ["alert.wav"]
|
||||
"resources": ["on_pre_break.wav", "on_stop_break.wav"]
|
||||
},
|
||||
"settings": [],
|
||||
"settings": [{
|
||||
"id": "pre_break_alert",
|
||||
"label": "Play audible alert before breaks",
|
||||
"type": "BOOL",
|
||||
"default": true
|
||||
}],
|
||||
"break_override_allowed": true
|
||||
}
|
|
@ -24,6 +24,25 @@ import logging
|
|||
from safeeyes import Utility
|
||||
|
||||
context = None
|
||||
pre_break_alert = False
|
||||
|
||||
|
||||
def play_sound(resource_name):
|
||||
"""Play the audio resource.
|
||||
|
||||
Arguments:
|
||||
resource_name {string} -- name of the wav file resource
|
||||
"""
|
||||
logging.info('Playing audible alert %s', resource_name)
|
||||
try:
|
||||
# Open the sound file
|
||||
path = Utility.get_resource_path(resource_name)
|
||||
if path is None:
|
||||
return
|
||||
Utility.execute_command('aplay', ['-q', path])
|
||||
|
||||
except BaseException:
|
||||
logging.error('Failed to play audible alert %s', resource_name)
|
||||
|
||||
|
||||
def init(ctx, safeeyes_config, plugin_config):
|
||||
|
@ -31,8 +50,20 @@ def init(ctx, safeeyes_config, plugin_config):
|
|||
Initialize the plugin.
|
||||
"""
|
||||
global context
|
||||
global pre_break_alert
|
||||
logging.debug('Initialize Audible Alert plugin')
|
||||
context = ctx
|
||||
pre_break_alert = plugin_config['pre_break_alert']
|
||||
|
||||
|
||||
def on_pre_break(break_obj):
|
||||
"""Play the pre_break sound if the option is enabled.
|
||||
|
||||
Arguments:
|
||||
break_obj {safeeyes.model.Break} -- the break object
|
||||
"""
|
||||
if pre_break_alert:
|
||||
play_sound('on_pre_break.wav')
|
||||
|
||||
|
||||
def on_stop_break():
|
||||
|
@ -42,14 +73,4 @@ def on_stop_break():
|
|||
# Do not play if the break is skipped or postponed
|
||||
if context['skipped'] or context['postponed']:
|
||||
return
|
||||
|
||||
logging.info('Playing audible alert')
|
||||
try:
|
||||
# Open the sound file
|
||||
path = Utility.get_resource_path('alert.wav')
|
||||
if path is None:
|
||||
return
|
||||
Utility.execute_command('aplay', ['-q', path])
|
||||
|
||||
except BaseException:
|
||||
logging.error('Failed to play audible alert')
|
||||
play_sound('on_stop_break.wav')
|
||||
|
|
|
@ -35,7 +35,7 @@ context = None
|
|||
skip_break_window_classes = []
|
||||
take_break_window_classes = []
|
||||
unfullscreen_allowed = True
|
||||
|
||||
dnd_while_on_battery = False
|
||||
|
||||
def is_active_window_skipped(pre_break):
|
||||
"""
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue