Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.76 KB | None | 0 0
  1. #! /bin/sh
  2.  
  3. #   Shell script to disable (almost) all beeps on Crunchbang Linux
  4. #   @author: Akshay Dandekar
  5. #   @version: 0 (there will be no other)
  6. #   This script is free to do whatever you want with it etc...
  7. #   and I am not responsible for the outcome
  8.  
  9. # Blacklist pcspkr
  10. if [ $(grep -c 'blacklist\ pcspkr' /etc/modprobe.d/pcspkr.conf) -eq 0 ]
  11. then
  12.     echo 'blacklist pcspkr' | tee -a /etc/modprobe.d/pcspkr.conf
  13.     rmmod pcspkr
  14. else
  15.     echo "blacklist pcspkr in pcspkr configuration"
  16. fi
  17.  
  18. #set PC speaker and PC Beep to mute on amixer
  19. amixer set 'PC speaker' 0% mute
  20. amixer set 'PC Beep' 0% mute
  21.  
  22. # remove gtk application beeps
  23. if [ $(grep -c 'gtk-error-bell\ \=\ 0' /home/$1/.gtkrc-2.0.mine) -eq 0 ]
  24. then
  25.     echo "gtk-error-bell = 0" >> /home/$1/.gtkrc-2.0.mine
  26.     chmod 755 /home/$1/.gtkrc-2.0.mine
  27. else
  28.     echo "gtk-error-bell already set to zero"
  29. fi
  30.  
  31. # remove console beeps in X
  32. if [ $(grep -c 'xset\ b\ off' /home/$1/.config/openbox/autostart.sh) -eq 0 ]
  33. then
  34.     echo "\n# remove console beeps in X --Added by $1 \nxset b off &" >> /home/$1/.config/openbox/autostart.sh
  35. else
  36.     echo "console beeps already off in autostart script"
  37. fi
  38.  
  39. # remove bash beeps
  40. sed -i 's/^#\ set\ bell\-style\ none/set\ bell\-style\ none/g' /etc/inputrc
  41.  
  42. # remove console beeps from the system console
  43. if [ $(grep -c 'setterm\ -blength\ 0' /etc/profile) -eq 0 ]
  44. then
  45.     echo "setterm -blength 0" >> /etc/profile
  46.     echo "setterm -bfreq 0" >> /etc/profile
  47. else
  48.     echo "console beeps already off in /etc/profile"
  49. fi
  50.  
  51. # remove login sound from gdm
  52. if [ $(grep -c 'SoundOnLogin=False' /etc/gdm/gdm.conf) -eq 0 ]
  53. then
  54.     sed -i 's/\[greeter\]/\[greeter\]\nSoundOnLogin\=False/' /etc/gdm/gdm.conf
  55. else
  56.     echo "login sound already off from gdm"
  57. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement