Step 1: Install xdotool

If you haven’t already, install xdotool using the following command:

sudo pacman -S xdotool

Step 2: Create the service file

Create a new service file, e.g., 1passlock.service in /etc/systemd/system/:

sudo nano /etc/systemd/system/1passlock.service

Add the following content to the service file:

[Unit]
Description=Simulate Ctrl+Shift+L keypress
 
[Service]
Type=oneshot
ExecStart=/usr/bin/xdotool key ctrl+shift+l

Step 3: Create the timer file

Next, create a timer file, e.g., 1passlock.timer in /etc/systemd/system/:

sudo nano /etc/systemd/system/1passlock.timer

Add the following content to the timer file:

[Unit]
Description=Run 1passlock.service every 15 minutes
 
[Timer]
OnActiveSec=15min
OnUnitActiveSec=15min
Unit=1passlock.service
 
[Install]
WantedBy=timers.target

Step 4: Enable and start the timer

Now, enable and start the timer with the following commands:

sudo systemctl enable 1passlock.timer
sudo systemctl start 1passlock.timer

Step 5: Check the timer status

You can check the status of your timer using:

systemctl --user list-timers

This setup will simulate the keypress ctrl+shift+l every 15 minutes using xdotool. Make sure that the X server is running and that the environment where xdotool is called has access to the display (e.g., it should be run in a user session).

Important Note

Be careful with automating key presses as it can lead to unintended actions if not carefully controlled.

Stop \ pause timers

# Stop it immediately
systemctl --user stop 1passlock.timer 1passlock.service
 
# Disable automatic start on login
systemctl --user disable 1passlock.timer
 
# Reload user systemd so changes take effect
systemctl --user daemon-reload
 

Re-enable it later

systemctl --user enable --now 1passlock.timer