From 45550488f9f4effc3b9dc5bc0fc4c25c130d69fd Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Thu, 8 Aug 2024 11:01:06 +0200 Subject: mailsync: add wayland/x11 guard --- .local/bin/mailsync | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to '.local/bin/mailsync') diff --git a/.local/bin/mailsync b/.local/bin/mailsync index 40a2dee..abb4c18 100755 --- a/.local/bin/mailsync +++ b/.local/bin/mailsync @@ -27,7 +27,14 @@ command -v notify-send > /dev/null || echo 'Note that `libnotify` or `libnotify- # Required to display notifications if run as a cronjob: export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus -export DISPLAY=:0.0 + +SESH=$(loginctl show-session $(awk '/tty/ {print $1}' <(loginctl)) -p Type | awk -F= '{print $2}') + +if [[ "$SESH" = "wayland" ]]; then + export WAYLAND_DISPLAY=wayland-1 +else + export DISPLAY=:0.0 +fi # For individual configurations: [ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" -- cgit v1.2.3-70-g09d2