feat: Add initial dock scripts
This commit is contained in:
parent
477afdf6f4
commit
642aacd358
13 changed files with 145 additions and 35 deletions
23
eww_laptop/scripts/test.py
Normal file
23
eww_laptop/scripts/test.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import socket
|
||||
|
||||
# Replace "your_user" with the actual username of the logged-in user.
|
||||
USER = "dashie"
|
||||
|
||||
def execute_script(event):
|
||||
# This function executes the script file as the specified user.
|
||||
os.system(f"/home/dashie/.config/eww/scripts/auto_dock.sh {event}")
|
||||
|
||||
# Create a socket object and connect to the acpid socket.
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
sock.connect("/var/run/acpid.socket")
|
||||
|
||||
# Listen for events and execute the script file.
|
||||
while True:
|
||||
data = sock.recv(1024).decode()
|
||||
if "button/lid" in data:
|
||||
event = data.split()[-1]
|
||||
execute_script(event)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue