diff --git a/1-software.sh b/1-software.sh index 3eb8ba2..acdf135 100755 --- a/1-software.sh +++ b/1-software.sh @@ -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 diff --git a/config/scripts/yt_blocker.sh b/config/scripts/yt_blocker.sh new file mode 100755 index 0000000..c253fbc --- /dev/null +++ b/config/scripts/yt_blocker.sh @@ -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 diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc index 67f0c7b..c099320 100755 --- a/config/sxhkd/sxhkdrc +++ b/config/sxhkd/sxhkdrc @@ -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 diff --git a/optional/sudoers.txt b/optional/sudoers.txt index 91bbe55..af5db4c 100644 --- a/optional/sudoers.txt +++ b/optional/sudoers.txt @@ -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