dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit e1c5751bc5e7e798b595772c859e328363b4254c
parent 6c73395cba767192f3f42b303aa51d03132a1eba
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sun,  8 Sep 2019 19:35:34 -0400

my: Make calls to ps work for busybox

Diffstat:
M.bashrc | 2+-
M.local/bin/my | 11++++++++++-
M.local/bin/my-init | 2+-
M.zshrc | 1+
4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/.bashrc b/.bashrc @@ -27,7 +27,7 @@ _my() selector="${COMP_WORDS[1]}" opts="term lock wallpaper standby shutdown perms init open sound \ kbopts screen brightness battery status i3status copy paste \ - netrc dotfiles cron login_async login mailto search" + netrc dotfiles cron login_async login mailto search processes" case "$selector" in sound) diff --git a/.local/bin/my b/.local/bin/my @@ -23,7 +23,7 @@ __getlocker() { for locker in light-locker cinnamon-screensaver gnome-screensaver xscreensaver do - if type $locker-command > /dev/null 2>&1 && ps -U $LOGNAME -o command= | grep ^[^_[:space:]]*$locker > /dev/null 2>&1 + if my processes | grep $locker > /dev/null 2>&1 then echo $locker exit 0 @@ -416,5 +416,14 @@ case $command in login) my login_async & ;; + processes) + if [ -L /bin/ps ] + then + # busybox + ps -o user,comm= | grep $LOGNAME | awk '{print $2;}' + else + ps -U $LOGNAME -o comm= + fi + ;; *) echo "my: command $command not found" >&2 esac diff --git a/.local/bin/my-init b/.local/bin/my-init @@ -102,7 +102,7 @@ then lesskey fi -if ps -U $LOGNAME | grep systemd > /dev/null 2>&1 \ +if my processes | grep systemd > /dev/null 2>&1 \ && [ -n "$crontab_init" ] then echo " Installing systemd timers" diff --git a/.zshrc b/.zshrc @@ -70,6 +70,7 @@ _my() 'login:login' 'mailto:send email' 'search:search DuckDuckGo in the terminal' + 'processes:list current running processes' ) _describe -t subcommands 'my subcommand' subcommands && ret=0 ;;