make use of setsid(1)'s -f flag (#652)

Co-authored-by: Luke Smith <luke@lukesmith.xyz>
This commit is contained in:
Kian Kasad 2020-05-30 14:01:18 -07:00 committed by GitHub
parent 52d9140820
commit 3222354d50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 34 additions and 37 deletions

View file

@ -32,7 +32,7 @@ bspc config focus_follows_pointer true
bspc rule -a Zathura state=tiled bspc rule -a Zathura state=tiled
dropdownname="dropdown" dropdownname="dropdown"
bspc query -N -n .hidden >/dev/null || setsid $TERMINAL -n "$dropdownname" -e dropdown >/dev/null 2>&1 & bspc query -N -n .hidden >/dev/null || setsid -f $TERMINAL -n "$dropdownname" -e dropdown >/dev/null 2>&1
bspc rule -a St:$dropdownname hidden=on bspc rule -a St:$dropdownname hidden=on
bspc rule -a St:$dropdownname sticky=on bspc rule -a St:$dropdownname sticky=on
bspc rule -a St:$dropdownname state=floating bspc rule -a St:$dropdownname state=floating

View file

@ -26,7 +26,7 @@ bspc config top_padding 24 # top_padding I set equal to polybar's height
bspc config focus_follows_pointer true bspc config focus_follows_pointer true
dropdownname="dropdown" dropdownname="dropdown"
bspc query -N -n .hidden >/dev/null || setsid $TERMINAL -n "$dropdownname" -e dropdown >/dev/null 2>&1 & bspc query -N -n .hidden >/dev/null || setsid -f $TERMINAL -n "$dropdownname" -e dropdown >/dev/null 2>&1
bspc rule -a St:$dropdownname hidden=on bspc rule -a St:$dropdownname hidden=on
bspc rule -a St:$dropdownname sticky=on bspc rule -a St:$dropdownname sticky=on
bspc rule -a St:$dropdownname state=floating bspc rule -a St:$dropdownname state=floating

View file

@ -15,17 +15,14 @@ $lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
# cmds/functions # cmds/functions
cmd open ${{ cmd open ${{
case $(file --mime-type $f -b) in case $(file --mime-type $f -b) in
image/vnd.djvu|application/pdf|application/octet-stream) setsid zathura $fx >/dev/null 2>&1 & ;; image/vnd.djvu|application/pdf|application/octet-stream) setsid -f zathura $fx >/dev/null 2>&1 ;;
text/*) $EDITOR $fx;; text/*) $EDITOR $fx;;
image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;; image/x-xcf|image/svg+xml) setsid -f gimp $f >/dev/null 2>&1 ;;
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\)\(_large\)*$" | setsid sxiv -aio 2>/dev/null | lf-select & ;; image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\)\(_large\)*$" | setsid -f sxiv -aio 2>/dev/null | lf-select ;;
audio/*) mpv --audio-display=no $f ;; audio/*) mpv --audio-display=no $f ;;
video/*) setsid mpv $f -quiet >/dev/null 2>&1 & ;; video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;; application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
application/epub+zip) setsid zathura $fx >/dev/null 2>&1 & ;; *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1 done;;
application/vnd.comicbook+zip) setsid zathura $fx >/dev/null 2>&1 & ;;
application/vnd.comicbook-rar) setsid zathura $fx >/dev/null 2>&1 & ;;
*) for f in $fx; do setsid $OPENER $f >/dev/null 2>&1 & done;;
esac esac
}} }}

View file

@ -37,7 +37,7 @@
# #
# Flags are single characters which slightly transform the command: # Flags are single characters which slightly transform the command:
# f | Fork the program, make it run in the background. # f | Fork the program, make it run in the background.
# | New command = setsid $command >& /dev/null & # | New command = setsid -f $command >& /dev/null
# r | Execute the command with root permissions # r | Execute the command with root permissions
# | New command = sudo $command # | New command = sudo $command
# t | Run the program in a new terminal. If $TERMCMD is not defined, # t | Run the program in a new terminal. If $TERMCMD is not defined,

View file

@ -35,6 +35,6 @@ case "$file" in
*\.m) octave "$file" ;; *\.m) octave "$file" ;;
*\.scad) openscad -o "$base".stl "$file" ;; *\.scad) openscad -o "$base".stl "$file" ;;
*\.go) go run "$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" ;; *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac esac

View file

@ -59,7 +59,7 @@ onescreen() { # If only one output available or chosen.
postrun() { # Stuff to run to clean up. postrun() { # Stuff to run to clean up.
setbg # Fix background if screen size/arangement has changed. setbg # Fix background if screen size/arangement has changed.
remaps # Re-remap keys if keyboard added (for laptop bases) 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 # Get all possible displays

View file

@ -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 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 ;; "copy url") echo "$1" | xclip -selection clipboard ;;
mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; mpv) setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
"mpv (loop)") setsid mpv -quiet --loop "$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 download") tsp curl -LO "$1" >/dev/null 2>&1 ;;
"queue youtube-dl") tsp youtube-dl --write-metadata -ic "$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 & ;; browser) setsid -f "$BROWSER" "$1" >/dev/null 2>&1 ;;
feh) setsid feh "$1" >/dev/null 2>&1 & ;; feh) setsid -f feh "$1" >/dev/null 2>&1 ;;
w3m) w3m "$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 esac

View file

@ -11,12 +11,12 @@
case "$1" in case "$1" in
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) *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) *png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*) *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" 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 esac

View file

@ -7,7 +7,7 @@
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
case "$1" in case "$1" in
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid xdg-open "$basename".pdf >/dev/null 2>&1 & ;; *.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
*.html) setsid "$BROWSER" "$basename".html >/dev/null 2>&1 & ;; *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;; *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
esac esac

View file

@ -20,7 +20,7 @@ esac
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;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\` 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" ;; - Middle click opens calcurse if installed" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;

View file

@ -2,7 +2,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; 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. 3) notify-send "🖥 CPU module " "\- Shows CPU temperature.
- Click to show intensive processes. - Click to show intensive processes.
- Middle click to open htop." ;; - Middle click to open htop." ;;

View file

@ -4,8 +4,8 @@
# When clicked, brings up `neomutt`. # When clicked, brings up `neomutt`.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e neomutt & ;; 1) setsid -f "$TERMINAL" -e neomutt ;;
2) setsid mailsync >/dev/null & ;; 2) setsid -f mailsync >/dev/null ;;
3) notify-send "📬 Mail module" "\- Shows unread mail 3) notify-send "📬 Mail module" "\- Shows unread mail
- Shows 🔃 if syncing mail - Shows 🔃 if syncing mail
- Left click opens neomutt - Left click opens neomutt

View file

@ -2,7 +2,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; 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. 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total.
- Click to show memory hogs. - Click to show memory hogs.
- Middle click to open htop." ;; - Middle click to open htop." ;;

View file

@ -5,7 +5,7 @@ filter() { mpc | sed "/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*/⏸/g;/\\[playi
pidof -x mpdup >/dev/null 2>&1 || mpdup & pidof -x mpdup >/dev/null 2>&1 || mpdup &
case $BLOCK_BUTTON in 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 2) mpc toggle | filter ;; # right click, pause/unpause
3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing. 3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing.
- Italic when paused. - Italic when paused.

View file

@ -5,7 +5,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e newsboat ;; 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 3) notify-send "📰 News module" "\- Shows unread news items
- Shows 🔃 if updating with \`newsup\` - Shows 🔃 if updating with \`newsup\`
- Left click opens newsboat - Left click opens newsboat

View file

@ -18,7 +18,7 @@
# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. # Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e popupgrade & ;; 1) setsid -f "$TERMINAL" -e popupgrade ;;
2) notify-send "$(/usr/bin/pacman -Qu)" ;; 2) notify-send "$(/usr/bin/pacman -Qu)" ;;
3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages 3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages
- Left click to upgrade packages - Left click to upgrade packages

View file

@ -17,7 +17,7 @@ transmission-remote -l | grep % |
s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' ' s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' '
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e tremc & ;; 1) setsid -f "$TERMINAL" -e tremc ;;
2) td-toggle ;; 2) td-toggle ;;
3) notify-send "🌱 Torrent module" "\- Left click to open tremc. 3) notify-send "🌱 Torrent module" "\- Left click to open tremc.
- Middle click to toggle transmission. - Middle click to toggle transmission.

View file

@ -4,11 +4,11 @@
# uncomment the ALSA lines if you remove PulseAudio. # uncomment the ALSA lines if you remove PulseAudio.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
# 1) setsid "$TERMINAL" -e alsamixer & ;; # 1) setsid -f "$TERMINAL" -e alsamixer ;;
# 2) amixer sset Master toggle ;; # 2) amixer sset Master toggle ;;
# 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;; # 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;;
# 5) 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 ;; 2) pamixer -t ;;
4) pamixer --allow-boost -i 1 ;; 4) pamixer --allow-boost -i 1 ;;
5) pamixer --allow-boost -d 1 ;; 5) pamixer --allow-boost -d 1 ;;

View file

@ -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 "°"}' ;} 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 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 ;; 2) getforecast && showweather ;;
3) notify-send "🌈 Weather module" "\- Left click for full forecast. 3) notify-send "🌈 Weather module" "\- Left click for full forecast.
- Middle click to update forecast. - Middle click to update forecast.