dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 080365dd22b967274833f50a5cd0cccc0790a658
parent 7b9277ae0b061af6890786a9149b7e26aa380e2b
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Sat, 11 Apr 2020 10:03:33 -0400

pgrep is a little slow, slower than ps | grep

Diffstat:
M.local/bin/cron/newsup | 2+-
M.local/bin/displayselect | 2+-
M.local/bin/launch_polybar | 2+-
M.local/bin/td-toggle | 2+-
M.local/bin/torwrap | 2+-
M.local/bin/transadd | 4++--
6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup @@ -7,7 +7,7 @@ ping -q -c 1 1.1.1.1 > /dev/null || exit /usr/bin/notify-send "📰 Updating RSS feeds..." -pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit +ps ax | grep -q newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit echo 🔃 > /tmp/newsupdate pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" diff --git a/.local/bin/displayselect b/.local/bin/displayselect @@ -69,4 +69,4 @@ esac setbg # Fix background if screen size/arangement has changed. remaps # Re-remap keys if keyboard added (for laptop bases) -pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen +{ killall dunst ; setsid dunst & } >/dev/null 2>&1 # Restart dunst to ensure proper location on screen diff --git a/.local/bin/launch_polybar b/.local/bin/launch_polybar @@ -4,7 +4,7 @@ killall -q polybar # Wait until the processes have been shut down -while pgrep -x polybar >/dev/null; do sleep 1; done +while ps ax | grep -q "\spolybar$"; do sleep 1; done for i in $(polybar -m | awk -F: '{print $1}'); do MONITOR=$i polybar default & done diff --git a/.local/bin/td-toggle b/.local/bin/td-toggle @@ -1,7 +1,7 @@ #!/bin/sh # If transmission-daemon is running, will ask to kill, else will ask to start. -if pgrep -x transmission-da >/dev/null ; +if ps ax | grep -q "\stransmission-daemon$" ; then [ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon killed." else diff --git a/.local/bin/torwrap b/.local/bin/torwrap @@ -2,6 +2,6 @@ ifinstalled tremc transmission-cli || exit -! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}" +! ps ax | grep -q "\stransmission-daemon$" && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}" & $TERMINAL -e tremc diff --git a/.local/bin/transadd b/.local/bin/transadd @@ -2,8 +2,8 @@ # Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running. -# transmission-daemon sometimes fails to take remote requests in its first moments. +# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. -pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") +ps ax | grep -q "\stransmission-daemon$" || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") & transmission-remote -a "$@" && notify-send "🔽 Torrent added."