update
This commit is contained in:
@@ -7,15 +7,11 @@ import tempfile
|
||||
import base64
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from warehouse import Media_flag, rand12
|
||||
|
||||
Recording_flag = "/tmp/screenshot_active"
|
||||
Recordings = Path.home() / "records"
|
||||
Tmp = tempfile.gettempdir()
|
||||
|
||||
def rand12():
|
||||
return base64.urlsafe_b64encode(os.urandom(9)).decode()[:12]
|
||||
|
||||
|
||||
def run(cmd):
|
||||
return subprocess.run(cmd)
|
||||
|
||||
@@ -46,7 +42,6 @@ def force_kill():
|
||||
pid = find_focused_pid(tree)
|
||||
|
||||
if not pid:
|
||||
print("No focused window PID found")
|
||||
return
|
||||
|
||||
os.kill(pid, 9)
|
||||
@@ -65,12 +60,12 @@ def record(fullscreen=False):
|
||||
if is_recording():
|
||||
subprocess.run(["killall", "wf-recorder"])
|
||||
try:
|
||||
os.remove(Recording_flag)
|
||||
os.remove(Media_flag)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
return
|
||||
|
||||
Path(Recording_flag).write_text("1")
|
||||
Path(Media_flag).write_text("1")
|
||||
|
||||
slurp_cmd = ["slurp"]
|
||||
if fullscreen:
|
||||
@@ -130,7 +125,7 @@ def resolve_output(out):
|
||||
|
||||
|
||||
def take_screenshot(output_path):
|
||||
Path(Recording_flag).write_text("1")
|
||||
Path(Media_flag).write_text("1")
|
||||
|
||||
try:
|
||||
time.sleep(0.2)
|
||||
@@ -164,7 +159,7 @@ def take_screenshot(output_path):
|
||||
|
||||
finally:
|
||||
try:
|
||||
os.remove(Recording_flag)
|
||||
os.remove(Media_flag)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user