It's a type of Planche
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

screensaver_start.sh 835B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. # MPRIS = Media Player Remote Interfacing Specification
  3. firefox_mpris_dbus=$(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep -Po "org.mpris.*firefox[^\"]+")
  4. if [ -n ${firefox_mpris_dbus} ]; then
  5. playback_string=$(dbus-send --print-reply --dest=${firefox_mpris_dbus} /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus' | grep -Po "(?<=string \")[^\"]+")
  6. fi
  7. # Suspend Firefox processes if not playing media
  8. if [ -z "${playback_string}" ] || [ "${playback_string}" != "Playing" ]; then
  9. ps aux | grep [f]irefox/[f]irefox | awk '{print $2}' | xargs -P0 -I {} kill -STOP {}
  10. fi
  11. # Suspend Atom processes
  12. ps aux | grep "/[a]tom" | awk '{print $2}' | xargs -P0 -I {} kill -STOP {}