initial commit
This commit is contained in:
18
nativemsg/bg.py
Normal file
18
nativemsg/bg.py
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env -S python3
|
||||
import sys
|
||||
import struct
|
||||
import subprocess
|
||||
|
||||
# Read a message from stdin and decode it.
|
||||
rawLength = sys.stdin.buffer.read(4)
|
||||
if len(rawLength) == 0:
|
||||
sys.exit(0)
|
||||
|
||||
# Read the length of the message
|
||||
messageLength: int = struct.unpack("@I", rawLength)[0]
|
||||
|
||||
# Decode the message
|
||||
message = sys.stdin.buffer.read(messageLength).decode("utf-8")
|
||||
|
||||
# Run the background setting with a link to the image
|
||||
_ = subprocess.run(["setbg", "-tw", message.replace('"', "")])
|
7
nativemsg/bg_app.json
Normal file
7
nativemsg/bg_app.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "bg_app",
|
||||
"description": "set background via native script",
|
||||
"path": "HOME/.mozilla/native-messaging-hosts/bg.py",
|
||||
"type": "stdio",
|
||||
"allowed_extensions": [ "misc@tils" ]
|
||||
}
|
Reference in New Issue
Block a user