# Free Software Foundation, version 3.
from dataclasses import dataclass
# Free Software Foundation, version 3.
from dataclasses import dataclass
+def make_filename() -> str:
+ directory = os.environ.get(
+ 'XDG_VIDEOS_DIR',
+ os.path.expanduser('~/Videos'))
+ os.makedirs(directory, exist_ok=True)
+ return os.path.join(directory, "screen-recording.mkv")
+
+
def on_start_recording(_: Gtk.Button, stack: Gtk.Stack) -> None:
global recording # pylint: disable=global-statement
assert recording is None
screen_size = '1366x768' # TODO
def on_start_recording(_: Gtk.Button, stack: Gtk.Stack) -> None:
global recording # pylint: disable=global-statement
assert recording is None
screen_size = '1366x768' # TODO
command = [
'ffmpeg',
'-video_size', screen_size,
'-framerate', '25',
'-f', 'x11grab', '-i', ':0.0+0,0',
'-f', 'pulse', '-ac', '2', '-i', 'default',
command = [
'ffmpeg',
'-video_size', screen_size,
'-framerate', '25',
'-f', 'x11grab', '-i', ':0.0+0,0',
'-f', 'pulse', '-ac', '2', '-i', 'default',
process=subprocess.Popen(command, stdin=subprocess.PIPE))
stack.set_visible_child_name("recording")
process=subprocess.Popen(command, stdin=subprocess.PIPE))
stack.set_visible_child_name("recording")