-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkeyoff.sh
executable file
·80 lines (56 loc) · 2.1 KB
/
keyoff.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/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"
installed=$(which xinput)
two=$(which notify-send)
if [[ $installed == "/usr/bin/xinput" ]] && [[ $two == "/usr/bin/notify-send" ]]
then
cd
xinput > .xinpu_list.txt
echo "[*] Turning Off your builtin keybord"
key_txt=$(cat .xinpu_list.txt| grep "AT Translated Set 2 keyboard")
echo $key_txt
sleep 1
#echo "Enter Your Key Bord id Number"
#read keyid;
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 "]")
re='^[0-9]+$'
if [[ $master_no_not_tested =~ $re ]] ; then
cd
echo "$master_no_not_tested" > .master_no.txt
fi
key_id=`echo $key_id_space | sed 's/ *$//g'`
xinput -float $key_id ;
if [[ $master_no_not_tested == "floating slave" ]] ; then
echo "[*] Keybord Is Already Turned Off"
notify-send KeyOff "Laptop's Keybord is already turned off.. try: 'keyon or /opt/KeyOff/keyon.sh'"
else
echo "[*] Done Turning Off"
notify-send KeyOff "Laptop's Keybord is off.. try: 'keyon or /opt/KeyOff/keyon.sh'"
fi
echo "[*] To Turn it on use :"
cd
master_no=$(cat .master_no.txt)
echo "[*] 'keyon Or /opt/KeyOff/keyon.sh'"
echo "[*] xinput reattach $key_id $master_no"
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