mirror of
https://github.com/zedsalim/debian-z.git
synced 2025-12-06 03:19:28 +00:00
Add youtube blocker script
This commit is contained in:
parent
a9b7b183c4
commit
24dc2063b8
4 changed files with 36 additions and 1 deletions
|
|
@ -64,7 +64,7 @@ sudo systemctl enable bluetooth
|
|||
sudo nala install -y telegram-desktop
|
||||
|
||||
# Menu and Window Managers
|
||||
sudo nala install -y sxhkd numlockx rofi dunst libnotify-bin picom dmenu polybar
|
||||
sudo nala install -y sxhkd numlockx rofi dunst libnotify-bin picom dmenu polybar dbus-x11
|
||||
|
||||
# Archive Management
|
||||
sudo nala install -y unzip file-roller
|
||||
|
|
|
|||
30
config/scripts/yt_blocker.sh
Executable file
30
config/scripts/yt_blocker.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# YouTube domain to block
|
||||
youtube_domain="www.youtube.com"
|
||||
|
||||
# IP address to redirect to (localhost)
|
||||
redirect_ip="127.0.0.1"
|
||||
|
||||
# Prompt for the duration using dmenu
|
||||
duration=$(rofi -dmenu -p "Enter block duration (minutes): ")
|
||||
|
||||
# Backup the original hosts file
|
||||
cp /etc/hosts /etc/hosts.backup
|
||||
|
||||
# Add an entry to redirect YouTube to the specified IP address
|
||||
bash -c "echo $redirect_ip $youtube_domain >> /etc/hosts"
|
||||
|
||||
# Wait for the specified duration
|
||||
sleep "${duration}m"
|
||||
|
||||
# Remove the entry from the hosts file to unblock YouTube
|
||||
sed -i "/$youtube_domain/d" /etc/hosts
|
||||
|
||||
# Remove the backup file
|
||||
sudo rm /etc/hosts.backup
|
||||
|
||||
# Notification
|
||||
notify-send 'Y-Blocker' 'YouTube unblocked'
|
||||
|
||||
exit 0
|
||||
|
|
@ -22,6 +22,9 @@ alt + l
|
|||
alt + y
|
||||
source ~/.config/scripts/mpv-youtube.sh
|
||||
|
||||
alt + shift + y
|
||||
sudo /home/zed/.config/scripts/yt_blocker.sh
|
||||
|
||||
alt + p
|
||||
pavucontrol
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
zed ALL=(ALL) NOPASSWD: /usr/sbin/reboot,/usr/sbin/shutdown,/usr/bin/mount,/usr/bin/umount
|
||||
|
||||
zed ALL=(ALL) NOPASSWD: /home/zed/.config/scripts/yt_blocker.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue