diff --git a/.config/X11/xprofile b/.config/X11/xprofile index ea00bf3..6669614 100644 --- a/.config/X11/xprofile +++ b/.config/X11/xprofile @@ -17,6 +17,7 @@ dwmblocks & xrdb "$XDG_CONFIG_HOME/X11/xresources" xrdb -merge "$XDG_STATE_HOME/xcolors" xss-lock -- slock & +get_dbus & setxkbmap 'fr(oss)' remaps & diff --git a/.local/bin/displayselect b/.local/bin/displayselect index 3c58a34..a511af4 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -52,8 +52,9 @@ default() { } setup() { + [ -z "$mode" ] && mode="auto" xrandr --output "$primary" --auto --scale 1.0x1.0 \ - --output "$secondary" --"$direction"-of "$primary" --auto + --output "$secondary" --"$direction"-of "$primary" --$mode } morescreen() { # If multi-monitor is selected and there are more than two screens. diff --git a/.local/bin/get_dbus b/.local/bin/get_dbus new file mode 100755 index 0000000..4ec00aa --- /dev/null +++ b/.local/bin/get_dbus @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +###################################################################### +# @author : swytch +# @file : get_dbus +# @license : GPLv3 +# @created : Wednesday May 20, 2020 18:04:01 CEST +# +# @description : retrieve and store DBUS_SESSION_BUS_ADDRESS in case +# some utilitary needs it (e.g. cronie) +###################################################################### + + +env | grep DBUS_SESSION_BUS_ADDRESS > "$HOME/.dbus/Xdbus" +echo "export DBUS_SESSION_BUS_ADDRESS" >> "$HOME/.dbus/Xdbus" +chmod 600 $HOME/.dbus/Xdbus + +exit 0 diff --git a/.local/bin/mailsync b/.local/bin/mailsync index 2ce8de7..57d7f0e 100755 --- a/.local/bin/mailsync +++ b/.local/bin/mailsync @@ -23,16 +23,19 @@ eval "$(grep -h -- \ "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ "$XDG_CONFIG_HOME/zsh/.zprofile" "$HOME/.pam_environment" 2>/dev/null)" -case "$(readlink -f /sbin/init)" in - *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; -esac export GPG_TTY=$TTY +[ -r "$HOME/.dbus/Xdbus" ] && source "$HOME/.dbus/Xdbus" # Config file location must be passed at execution, not as envrionment variable [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" +pgrepoutput="$(pgrep -ax X\(\|org\|wayland\))" +displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" notify() { - notify-send "neomutt" " $2 new mail(s) in \`$1\` account." + [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do + export DISPLAY=$x + notify-send "neomutt" " $2 new mail(s) in \`$1\` account." + done; } # Check account for new mail. Notify if there is new content.