Skip to content

Commit f511501

Browse files
committed
desktop notifications will only be issued when running on a DE
1 parent 7c35564 commit f511501

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

pyradio/config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ force_transparency = False
141141
calculated_color_factor = 0
142142

143143
# Console theme
144-
# This is the theme to be used when a PyRasio is executed either in a linux
145-
# virtual console, or on a terminal that does not support color change.
144+
# This is the theme to be used when a PyRadio is executed either in a Linux
145+
# Virtual Console, or on a terminal that does not support color change.
146146
# Possible values: dark / light
147147
#
148148
# Default value: dark

pyradio/config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from .server import IPsWithNumbers
3434
from .xdg import XdgDirs, XdgMigrate, CheckDir
3535
from .install import get_a_linux_resource_opener
36+
from .html_help import is_graphical_environment_running
3637
HAS_REQUESTS = True
3738

3839
try:
@@ -1494,7 +1495,9 @@ def enable_mouse(self, val):
14941495

14951496
@property
14961497
def enable_notifications(self):
1497-
return self.opts['enable_notifications'][1]
1498+
if is_graphical_environment_running():
1499+
return self.opts['enable_notifications'][1]
1500+
return False
14981501

14991502
@enable_notifications.setter
15001503
def enable_notifications(self, val):

pyradio/html_help.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import subprocess
33
import logging
44
from sys import platform
5-
from os import path, environ, listdir
5+
from os import path, environ, listdir, getenv
66
from shutil import which
77
from .install import get_a_linux_resource_opener
88
try:
@@ -29,6 +29,9 @@ def convert_to_md(a_file):
2929

3030
def is_graphical_environment_running():
3131
global HAS_GRAPHICAL_ENV
32+
if getenv('TERM') == 'linux':
33+
HAS_GRAPHICAL_ENV = 2
34+
return False
3235
if HAS_GRAPHICAL_ENV == 1:
3336
return True
3437
elif HAS_GRAPHICAL_ENV == 2:

pyradio/log.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ def _show_notification(self, msg):
466466
self._repeat_notification.reset_timer()
467467

468468
else:
469-
if self._cnf._notification_command:
469+
if self._cnf._notification_command and \
470+
self._cnf.enable_notifications:
470471
d_title, d_msg = self._get_desktop_notification_data(msg)
471472
if d_msg:
472473
if self._cnf._current_notification_message != d_msg:

0 commit comments

Comments
 (0)