-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkeyon.sh
executable file
·65 lines (51 loc) · 1.9 KB
/
keyon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
echo -e "\e[38;05;196m ## ## "
echo "### # ### # # # # "
echo " # # # # # # "
echo " # # ## ## ## # # ### ### "
echo " ## # # # # # # # # "
echo " # # #### # # # # # # "
echo " # # # # # # # # "
echo "### ## ### # ### ### ### "
echo " # # "
echo " ## "
echo -e "\n[-_-] Created By De-Shoha.."
echo -e "[-_-] E-mail: deshoha@gmail.com \n\n\e[0m"
two=$(which notify-send)
installed=$(which xinput)
if [[ $installed == "/usr/bin/xinput" ]] && [[ $two == "/usr/bin/notify-send" ]]
then
cd
xinput > .xinpu_list.txt
cd
echo "[*] Turning On your builtin keybord"
key_txt=$(cat .xinpu_list.txt| grep "AT Translated Set 2 keyboard")
echo $key_txt
sleep 1
cd
key_id_space=$(cat .xinpu_list.txt| grep "AT Translated Set 2 keyboard" | rev |cut -d "=" -f 1 | rev | cut -d "[" -f 1 | sed 's/ *$//g')
cd
master_no_not_tested=$(cat .xinpu_list.txt| grep "AT Translated Set 2 keyboard" | rev | cut -d "[" -f 1 | rev | rev | cut -d "(" -f1 | rev | tr -d ")" | tr -d "]")
key_id=`echo $key_id_space | sed 's/ *$//g'`
cd
master_no=$(cat .master_no.txt)
re='^[0-9]+$'
if [[ $master_no_not_tested =~ $re ]] ; then
cd
echo "[*] Your Key Bord Is Onn..\n[*] It was never turned off.."
notify-send KeyOff "Laptop's KeyBord Is On..It was never turned off.."
else
#Info
xinput reattach $key_id $master_no
echo "[*] Done Turning On your KeyBord..."
echo "[*] You can turn it off by typing 'keyoff or /opt/KeyOff/keyoff.sh'"
notify-send KeyOff "Laptop's KeyBord Has Been Turned On"
fi
else
echo "[*] Xinput Is not installed.."
echo "[*] Installing Xinput..."
sleep 1
sudo apt install xinput -y
sudo apt install libnotify-bin -y
echo -e "\n\n\n\n\n[*] Re run this "
fi