Merge branch 'dev' into venus

mail : [WIP] fix filtering for univ
        fix notifications through cronie
        add keymaps for next- and previous-new
displayselect: add "mode" variable for xrandr setup
        add external layout for docked setup
system: change default lockscreen to xss-lock
This commit is contained in:
David JULIEN 2022-11-25 21:18:11 +01:00
commit 0e4354faf3
Signed by: swytch
GPG Key ID: 498590A3AA82A06F
7 changed files with 47 additions and 10 deletions

View File

@ -17,7 +17,8 @@ setbg &
dwmblocks &
xrdb "$XDG_CONFIG_HOME/X11/xresources"
xrdb -merge "$XDG_STATE_HOME/xcolors"
xautolock -locker slock -time 5 -corners 000- &
xss-lock -- slock &
get_dbus &
cursor_setup "Logitech Gaming Mouse G502" &
setxkbmap 'fr(oss)'

View File

@ -13,6 +13,8 @@ macro index,pager im '<sync-mailbox><enter-command>source $XDG_CONFIG_HOME/neomu
# General rebindings
bind index j next-entry
bind index k previous-entry
bind index J next-new
bind index K previous-new
bind attach <return> view-mailcap
bind attach l view-mailcap
bind editor <space> noop

View File

@ -44,16 +44,28 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
}
default() {
primary=$(echo "$allposs" | grep -w "connected primary" | awk '{printf $1}')
primary=$(echo "$allposs" | grep -w "connected primary" | awk '{ print $1 }')
secondary=$(echo "$screens" | grep -v -w "$primary")
direction="left"
rotation="normal"
setup
}
external() {
internal=$(echo "$screens" | dmenu -i -p "Select internal display:")
screens=$(echo "$screens" | grep -v -w "eDP-1")
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
xrandr --output $primary --primary
default
}
setup() {
xrandr --output "$primary" --auto --scale 1.0x1.0 \
--output "$secondary" --"$direction"-of "$primary" --auto
[ -z "$mode" ] && mode="auto"
xrandr --output "$primary" --primary --auto --scale 1.0x1.0 \
--output "$secondary" --"$direction"-of "$primary" --$mode
[ -n "$internal" ] && xrandr --output "$internal" --off
}
morescreen() { # If multi-monitor is selected and there are more than two screens.
@ -78,9 +90,10 @@ allposs=$(xrandr -q | grep -w "connected")
screens=$(echo "$allposs" | awk '{print $1}')
# Get user choice including multi-monitor and manual selection:
chosen=$(printf "default\\nmulti-monitor\\n%s\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
chosen=$(printf "default\\nexternal\\nmulti-monitor\\n%s\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
case "$chosen" in
"default") default ;;
"external") external ;;
"manual selection") arandr ; exit ;;
"multi-monitor") multimon ;;
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;

18
.local/bin/get_dbus Executable file
View File

@ -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

View File

@ -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.

View File

@ -12,7 +12,7 @@ cache=/tmp/cpubarscache
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
[ ! -f $cache ] && echo "$stats" > "$cache"
old=$(cat "$cache")
printf " %s " " "
printf " %s " ""
echo "$stats" | while read -r row; do
id=${row%% *}
rest=${row#* }