File tree Expand file tree Collapse file tree 3 files changed +50
-7
lines changed Expand file tree Collapse file tree 3 files changed +50
-7
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,18 @@ You might want to adapt the script to your needs ./usr/local/bin/monitor-hotplug
9
9
I was inspired by http://stackoverflow.com/questions/5469828/how-to-create-a-callback-for-monitor-plugged-on-an-intel-graphics
10
10
11
11
## Installation
12
- * clone the repo
13
- * sudo cp usr/local/bin/monitor-hotplug.sh /usr/local/bin/
14
- * sudo cp etc/udev/rules.d/99-monitor-hotplug.rules /etc/udev/rules.d/
15
- * sudo service udev restart
12
+ ``` git clone https://github.com/codingtony/udev-monitor-hotplug.git
13
+ sudo chmod +x ./install.sh
14
+ sudo ./install.sh```
16
15
17
16
## Debuging
18
- * sudo service udev stop
19
- * sudo udevd --debug 2>&1 | tee /tmp/udev.log
20
- * check what's happening when you plug/unplug your monitor
17
+ ```sudo journalctl -f```
18
+
19
+ OR
20
+
21
+ ```sudo service udev stop
22
+ sudo udevd --debug 2>&1 | tee /tmp/udev.log
23
+ check what's happening when you plug/unplug your monitor```
21
24
22
25
23
26
## License
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ USER=$( id -nu 1000)
4
+ WORKING_DIR=" $( dirname " $0 " ) "
5
+ SETTINGS_DIR=" /home/${USER} /.config/udev_hotplug/"
6
+ SETTINGS_FILE=" ${SETTINGS_DIR} /settings.sh"
7
+
8
+ if [[ ! -d " ${SETTINGS_DIR} " ]]; then
9
+ mkdir -p " ${SETTINGS_DIR} "
10
+ chown " ${USER} :${USER} " " ${SETTINGS_DIR} "
11
+ chmod 644 " ${SETTINGS_DIR} " " ${SETTINGS_DIR} "
12
+ echo " Created: ${SETTINGS_DIR} "
13
+ echo
14
+
15
+ fi
16
+
17
+ if [[ ! -f " ${SETTINGS_FILE} " ]]; then
18
+ if [[ -f " ${WORKING_DIR} /settings.sh" ]]; then
19
+ cp " ${WORKING_DIR} /settings.sh" " ${SETTINGS_FILE} "
20
+ echo " Copied: ${WORKING_DIR} /settings.sh"
21
+ chown " ${USER} :${USER} " " ${WORKING_DIR} /settings.sh"
22
+ chmod 644 " ${SETTINGS_FILE} " " ${WORKING_DIR} /settings.sh"
23
+ fi
24
+ echo
25
+ fi
26
+
27
+ if cp -r " ./etc" " /" ; then
28
+ echo " 'etc' dir copied"
29
+ else
30
+ echo " Error while coping 'etc'"
31
+ fi
32
+
33
+ if cp -r " ./usr" " /" ; then
34
+ echo " 'usr' dir copied"
35
+ else
36
+ echo " Error while coping 'usr'"
37
+ fi
38
+
39
+ sudo service udev restart
40
+ sudo systemctl restart acpid
You can’t perform that action at this time.
0 commit comments