dotfiles

My dotfiles: zsh, lf, sxiv, i3, ranger, mpd and more
Log | Files | Refs | Submodules | README | LICENSE

commit 11d4f16fb4c34834b1023c1ec808094dbca69d7b
parent 340995f6f9a8c7b80f8f0b4a8057f3c1ef4649c7
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Sat, 14 Nov 2020 15:09:25 -0500

close #832
proper user id

Diffstat:
D.local/bin/cron/IMPORTANT_NOTE.md | 11-----------
A.local/bin/cron/README.md | 11+++++++++++
M.local/bin/cron/cronbat | 2+-
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.local/bin/cron/IMPORTANT_NOTE.md b/.local/bin/cron/IMPORTANT_NOTE.md @@ -1,11 +0,0 @@ -# Important Note - -These cronjobs have components that require information about your current display to display notifications correctly. - -When you add them as cronjobs, I recommend you precede the command with commands as those below: - -``` -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here -``` - -This ensures that notifications will display, xdotool commands will function and environmental variables will work as well. diff --git a/.local/bin/cron/README.md b/.local/bin/cron/README.md @@ -0,0 +1,11 @@ +# Important Note + +These cronjobs have components that require information about your current display to display notifications correctly. + +When you add them as cronjobs, I recommend you precede the command with commands as those below: + +``` +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here +``` + +This ensures that notifications will display, xdotool commands will function and environmental variables will work as well. diff --git a/.local/bin/cron/cronbat b/.local/bin/cron/cronbat @@ -5,5 +5,5 @@ [ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit [ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] && -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus && +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus && notify-send -u critical "Battery critically low."