diff --git a/utils/aa-notify b/utils/aa-notify index 9c7b28be6..32c0285e9 100755 --- a/utils/aa-notify +++ b/utils/aa-notify @@ -34,7 +34,7 @@ use Getopt::Long; my %prefs; my $conf = "/etc/apparmor/notify.conf"; -my $user_conf = "$ENV{HOME}/.apparmor/notify.conf"; +my $user_conf = ""; my $notify_exe = "/usr/bin/notify-send"; my $notify_home = ""; my $notify_display = ""; @@ -156,6 +156,18 @@ if (-s $conf) { } } +# find user's notify.conf +if (-e "$ENV{HOME}/.apparmor/notify.conf" ) { + # use legacy path if the conf file is there + $user_conf = "$ENV{HOME}/.apparmor/notify.conf"; +} elsif (defined $ENV{XDG_CONFIG_HOME}) { + # use XDG_CONFIG_HOME if it is defined + $user_conf = "$ENV{XDG_CONFIG_HOME}/apparmor/notify.conf"; +} else { + # fallback to the default value of XDG_CONFIG_HOME + $user_conf = "$ENV{HOME}/.config/apparmor/notify.conf"; +} + if ($opt_p) { # notify-send is packaged in libnotify-bin on Debian/Ubuntu, libnotify-tools on openSUSE -x "$notify_exe" or _error("Could not find '$notify_exe'. Please install it (package libnotify-bin or libnotify-tools). Aborting");