add input disable

This commit is contained in:
Tomáš Mládek 2024-09-19 14:51:50 +02:00
parent 85c1491b92
commit 13fe7d490d
3 changed files with 38 additions and 2 deletions

11
disable-input.service Normal file
View file

@ -0,0 +1,11 @@
[Unit]
Description=Disable Keyboard and Mouse Input
After=graphical-session.target
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 60
ExecStart=%h/disable_input.sh
[Install]
WantedBy=default.target

8
disable_input.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
echo "Disabling input devices"
for id in $(xinput --list | grep -Eo 'id=[0-9]+' | cut -d= -f2); do
xinput --disable "$id"
echo "Disabled device ID $id"
done
echo "All devices disabled."

View file

@ -12,6 +12,14 @@
- mpv
- unclutter
- name: Copy disable-input script
copy:
src: disable_input.sh
dest: "/home/{{ ansible_user }}/disable_input.sh"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0755"
- name: Ensure systemd user directory exists
file:
path: "/home/{{ ansible_user }}/.config/systemd/user"
@ -28,7 +36,8 @@
group: "{{ ansible_user }}"
mode: "0644"
loop:
- parsifal.service
- parsifal-player.service
- disable-input.service
- unclutter.service
- name: Reload systemd user service
@ -38,7 +47,15 @@
daemon_reload: yes
scope: user
- name: Enable all services
- name: Enable input disable service
become: yes
become_user: "{{ ansible_user }}"
systemd:
name: disable-input
enabled: yes
scope: user
- name: Enable and start all services
become: yes
become_user: "{{ ansible_user }}"
systemd: