From 3222354d50c9cc5a50fc78059e69e423a7009d58 Mon Sep 17 00:00:00 2001 From: Kian Kasad Date: Sat, 30 May 2020 14:01:18 -0700 Subject: make use of setsid(1)'s `-f` flag (#652) Co-authored-by: Luke Smith --- .local/bin/compiler | 2 +- .local/bin/displayselect | 2 +- .local/bin/dmenuhandler | 10 +++++----- .local/bin/linkhandler | 6 +++--- .local/bin/opout | 6 +++--- .local/bin/statusbar/clock | 2 +- .local/bin/statusbar/cpu | 2 +- .local/bin/statusbar/mailbox | 4 ++-- .local/bin/statusbar/memory | 2 +- .local/bin/statusbar/music | 2 +- .local/bin/statusbar/news | 2 +- .local/bin/statusbar/pacpackages | 2 +- .local/bin/statusbar/torrent | 2 +- .local/bin/statusbar/volume | 4 ++-- .local/bin/statusbar/weather | 2 +- 15 files changed, 25 insertions(+), 25 deletions(-) (limited to '.local/bin') diff --git a/.local/bin/compiler b/.local/bin/compiler index 51d14f5..75ed347 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -35,6 +35,6 @@ case "$file" in *\.m) octave "$file" ;; *\.scad) openscad -o "$base".stl "$file" ;; *\.go) go run "$file" ;; - *\.sent) setsid sent "$file" 2>/dev/null & ;; + *\.sent) setsid -f sent "$file" 2>/dev/null ;; *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; esac diff --git a/.local/bin/displayselect b/.local/bin/displayselect index 57120ec..d5f534e 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -59,7 +59,7 @@ onescreen() { # If only one output available or chosen. postrun() { # Stuff to run to clean up. setbg # Fix background if screen size/arangement has changed. remaps # Re-remap keys if keyboard added (for laptop bases) - { killall dunst ; setsid dunst & } >/dev/null 2>&1 # Restart dunst to ensure proper location on screen + { killall dunst ; setsid -f dunst } >/dev/null 2>&1 # Restart dunst to ensure proper location on screen } # Get all possible displays diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index 8ada2f4..5bdd131 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -5,12 +5,12 @@ case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in "copy url") echo "$1" | xclip -selection clipboard ;; - mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; - "mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;; + mpv) setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;; + "mpv (loop)") setsid -f mpv -quiet --loop "$1" >/dev/null 2>&1 ;; "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; - browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; - feh) setsid feh "$1" >/dev/null 2>&1 & ;; + browser) setsid -f "$BROWSER" "$1" >/dev/null 2>&1 ;; + feh) setsid -f feh "$1" >/dev/null 2>&1 ;; w3m) w3m "$1" >/dev/null 2>&1 ;; - "mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; + "mpv (float)") setsid -f mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 ;; esac diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler index 0660011..931dd6d 100755 --- a/.local/bin/linkhandler +++ b/.local/bin/linkhandler @@ -11,12 +11,12 @@ case "$1" in *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) - setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; + setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;; *png|*jpg|*jpe|*jpeg|*gif) curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) - setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;; + setsid -f tsp curl -LO "$1" >/dev/null 2>&1 ;; *) if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1" - else setsid $BROWSER "$1" >/dev/null 2>&1 & fi ;; + else setsid -f $BROWSER "$1" >/dev/null 2>&1 fi ;; esac diff --git a/.local/bin/opout b/.local/bin/opout index 28af763..23f044e 100755 --- a/.local/bin/opout +++ b/.local/bin/opout @@ -7,7 +7,7 @@ basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" case "$1" in - *.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid xdg-open "$basename".pdf >/dev/null 2>&1 & ;; - *.html) setsid "$BROWSER" "$basename".html >/dev/null 2>&1 & ;; - *.sent) setsid sent "$1" >/dev/null 2>&1 & ;; + *.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;; + *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;; + *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;; esac diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock index 431a7f0..1b43392 100755 --- a/.local/bin/statusbar/clock +++ b/.local/bin/statusbar/clock @@ -20,7 +20,7 @@ esac case $BLOCK_BUTTON in 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; - 2) setsid "$TERMINAL" -e calcurse -D ~/.config/calcurse & ;; + 2) setsid -f "$TERMINAL" -e calcurse -D ~/.config/calcurse ;; 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` - Middle click opens calcurse if installed" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu index 9225c1e..1572b52 100755 --- a/.local/bin/statusbar/cpu +++ b/.local/bin/statusbar/cpu @@ -2,7 +2,7 @@ case $BLOCK_BUTTON in 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; - 2) setsid "$TERMINAL" -e htop & ;; + 2) setsid -f "$TERMINAL" -e htop ;; 3) notify-send "🖥 CPU module " "\- Shows CPU temperature. - Click to show intensive processes. - Middle click to open htop." ;; diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox index 8f87d75..ca77f5c 100755 --- a/.local/bin/statusbar/mailbox +++ b/.local/bin/statusbar/mailbox @@ -4,8 +4,8 @@ # When clicked, brings up `neomutt`. case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e neomutt & ;; - 2) setsid mailsync >/dev/null & ;; + 1) setsid -f "$TERMINAL" -e neomutt ;; + 2) setsid -f mailsync >/dev/null ;; 3) notify-send "📬 Mail module" "\- Shows unread mail - Shows 🔃 if syncing mail - Left click opens neomutt diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory index 07a0f41..01d3daf 100755 --- a/.local/bin/statusbar/memory +++ b/.local/bin/statusbar/memory @@ -2,7 +2,7 @@ case $BLOCK_BUTTON in 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; - 2) setsid "$TERMINAL" -e htop & ;; + 2) setsid -f "$TERMINAL" -e htop ;; 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. - Click to show memory hogs. - Middle click to open htop." ;; diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music index 54eced5..6bd44e5 100755 --- a/.local/bin/statusbar/music +++ b/.local/bin/statusbar/music @@ -5,7 +5,7 @@ filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playi pidof -x mpdup >/dev/null 2>&1 || mpdup & case $BLOCK_BUTTON in - 1) mpc status | filter ; setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause + 1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause 2) mpc toggle | filter ;; # right click, pause/unpause 3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing. - Italic when paused. diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news index cbd976a..b414981 100755 --- a/.local/bin/statusbar/news +++ b/.local/bin/statusbar/news @@ -5,7 +5,7 @@ case $BLOCK_BUTTON in 1) setsid "$TERMINAL" -e newsboat ;; - 2) setsid newsup >/dev/null & exit ;; + 2) setsid -f newsup >/dev/null exit ;; 3) notify-send "📰 News module" "\- Shows unread news items - Shows 🔃 if updating with \`newsup\` - Left click opens newsboat diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages index e61660c..a9b6cf7 100755 --- a/.local/bin/statusbar/pacpackages +++ b/.local/bin/statusbar/pacpackages @@ -18,7 +18,7 @@ # Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e popupgrade & ;; + 1) setsid -f "$TERMINAL" -e popupgrade ;; 2) notify-send "$(/usr/bin/pacman -Qu)" ;; 3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages - Left click to upgrade packages diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent index e9e7fce..9e1da3a 100755 --- a/.local/bin/statusbar/torrent +++ b/.local/bin/statusbar/torrent @@ -17,7 +17,7 @@ transmission-remote -l | grep % | s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' ' case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e tremc & ;; + 1) setsid -f "$TERMINAL" -e tremc ;; 2) td-toggle ;; 3) notify-send "🌱 Torrent module" "\- Left click to open tremc. - Middle click to toggle transmission. diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume index b64744f..2766ed2 100755 --- a/.local/bin/statusbar/volume +++ b/.local/bin/statusbar/volume @@ -4,11 +4,11 @@ # uncomment the ALSA lines if you remove PulseAudio. case $BLOCK_BUTTON in - # 1) setsid "$TERMINAL" -e alsamixer & ;; + # 1) setsid -f "$TERMINAL" -e alsamixer ;; # 2) amixer sset Master toggle ;; # 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;; # 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;; - 1) setsid "$TERMINAL" -e pulsemixer & ;; + 1) setsid -f "$TERMINAL" -e pulsemixer ;; 2) pamixer -t ;; 4) pamixer --allow-boost -i 1 ;; 5) pamixer --allow-boost -d 1 ;; diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather index 2599e91..9a6c40a 100755 --- a/.local/bin/statusbar/weather +++ b/.local/bin/statusbar/weather @@ -16,7 +16,7 @@ showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:-$HOME/.local/share} sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶" $1 "°","🌞" $2 "°"}' ;} case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" & ;; + 1) setsid -f "$TERMINAL" -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" ;; 2) getforecast && showweather ;; 3) notify-send "🌈 Weather module" "\- Left click for full forecast. - Middle click to update forecast. -- cgit v1.3.1