summaryrefslogtreecommitdiff
path: root/config/nvim-2/undodir/%home%coast%projects%ruby%wayland-rec%main.rb
blob: 6d3af5cb4c4292336bae31b176064e0fe560df85 (plain)
ofshex dumpascii
0000 56 69 6d 9f 55 6e 44 6f e5 00 03 d4 10 6f 11 fb 67 19 83 d2 3f 6c 38 d5 8c 87 b3 04 7c b1 e0 43 Vim.UnDo.....o..g...?l8.....|..C
0020 41 c6 41 93 fe fb 35 91 59 26 0f 00 00 00 e5 00 00 00 27 20 20 6f 75 74 70 75 74 5f 66 69 6c 65 A.A...5.Y&........'..output_file
0040 20 3d 20 46 69 6c 65 2e 6a 6f 69 6e 28 6f 75 74 70 75 74 5f 64 69 72 2c 20 22 00 00 00 a7 00 00 .=.File.join(output_dir,."......
0060 00 27 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00 00 69 ff .'............................i.
0080 9e 89 04 01 00 00 00 04 00 5f d0 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 01 00 ........._......................
00a0 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
01a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
01c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
01e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0200 00 00 00 00 00 00 00 00 00 00 00 00 00 69 ff 9d ec 04 01 00 00 00 02 00 f5 18 00 00 00 96 00 00 .............i..................
0220 00 00 00 00 00 00 00 00 00 01 00 00 00 04 20 20 20 20 f5 18 00 00 00 97 00 00 00 00 00 00 00 00 ................................
0240 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 ................................
0260 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............5...................
0280 00 00 00 00 96 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 ................................
02a0 00 00 00 00 f5 18 00 00 00 00 96 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 5c 00 00 00 03 00 ..........................\.....
02c0 00 00 f9 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6f 08 00 00 00 00 00 00 35 81 5f d0 00 00 ..................o.......5._...
02e0 00 01 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ................................
0300 ff ff 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
03a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
03c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
03e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
0460 69 ff 9e 0c 04 01 00 00 00 03 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 00 00 00 i...............................
0480 13 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 72 75 62 79 00 00 00 00 00 00 00 0e 72 65 71 75 .#!/usr/bin/env.ruby........requ
04a0 69 72 65 20 27 6a 73 6f 6e 27 00 00 00 13 72 65 71 75 69 72 65 20 27 66 69 6c 65 75 74 69 6c 73 ire.'json'....require.'fileutils
04c0 27 00 00 00 12 72 65 71 75 69 72 65 20 27 6f 70 74 70 61 72 73 65 27 00 00 00 0f 72 65 71 75 69 '....require.'optparse'....requi
04e0 72 65 20 27 6f 70 65 6e 33 27 00 00 00 00 00 00 00 4c 63 6f 6e 66 69 67 5f 66 69 6c 65 20 3d 20 re.'open3'.......Lconfig_file.=.
0500 46 69 6c 65 2e 6a 6f 69 6e 28 44 69 72 2e 68 6f 6d 65 2c 20 27 2e 63 6f 6e 66 69 67 27 2c 20 27 File.join(Dir.home,.'.config',.'
0520 73 63 72 65 65 6e 5f 72 65 63 6f 72 64 65 72 27 2c 20 27 63 6f 6e 66 69 67 2e 72 62 27 29 00 00 screen_recorder',.'config.rb')..
0540 00 00 00 00 00 1b 69 66 20 46 69 6c 65 2e 65 78 69 73 74 3f 28 63 6f 6e 66 69 67 5f 66 69 6c 65 ......if.File.exist?(config_file
0560 29 00 00 00 12 20 20 6c 6f 61 64 20 63 6f 6e 66 69 67 5f 66 69 6c 65 00 00 00 04 65 6c 73 65 00 )......load.config_file....else.
0580 00 00 48 20 20 64 65 66 61 75 6c 74 5f 63 6f 6e 66 69 67 5f 64 69 72 20 3d 20 46 69 6c 65 2e 6a ..H..default_config_dir.=.File.j
05a0 6f 69 6e 28 44 69 72 2e 68 6f 6d 65 2c 20 27 2e 63 6f 6e 66 69 67 27 2c 20 27 73 63 72 65 65 6e oin(Dir.home,.'.config',.'screen
05c0 5f 72 65 63 6f 72 64 65 72 27 29 00 00 00 27 20 20 46 69 6c 65 55 74 69 6c 73 2e 6d 6b 64 69 72 _recorder')...'..FileUtils.mkdir
05e0 5f 70 28 64 65 66 61 75 6c 74 5f 63 6f 6e 66 69 67 5f 64 69 72 29 00 00 00 02 20 20 00 00 00 1a _p(default_config_dir)..........
0600 20 20 63 6f 6e 66 69 67 5f 63 6f 6e 74 65 6e 74 20 3d 20 3c 3c 7e 52 55 42 59 00 00 00 37 20 20 ..config_content.=.<<~RUBY...7..
0620 20 20 23 20 63 6f 6e 66 69 67 2e 72 62 20 2d 20 77 61 79 6c 61 6e 64 20 73 63 72 65 65 6e 20 72 ..#.config.rb.-.wayland.screen.r
0640 65 63 6f 72 64 65 72 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 04 20 20 20 20 00 00 00 ecorder.configuration...........
0660 3e 20 20 20 20 24 6f 75 74 70 75 74 5f 64 69 72 20 3d 20 46 69 6c 65 2e 6a 6f 69 6e 28 44 69 72 >....$output_dir.=.File.join(Dir
0680 2e 68 6f 6d 65 2c 20 27 76 69 64 65 6f 73 27 2c 20 27 73 63 72 65 65 6e 63 61 73 74 73 27 29 00 .home,.'videos',.'screencasts').
06a0 00 00 15 20 20 20 20 24 64 65 66 61 75 6c 74 5f 66 70 73 20 3d 20 33 30 00 00 00 1e 20 20 20 20 .......$default_fps.=.30........
06c0 24 64 65 66 61 75 6c 74 5f 63 6f 64 65 63 20 3d 20 27 6c 69 62 78 32 36 34 27 00 00 00 1e 20 20 $default_codec.=.'libx264'......
06e0 20 20 24 64 65 66 61 75 6c 74 5f 63 6f 6e 74 61 69 6e 65 72 20 3d 20 27 6d 70 34 27 00 00 00 19 ..$default_container.=.'mp4'....
0700 20 20 20 20 24 64 65 66 61 75 6c 74 5f 71 75 61 6c 69 74 79 20 3d 20 38 30 00 00 00 1a 20 20 20 ....$default_quality.=.80.......
0720 20 24 61 75 64 69 6f 5f 65 6e 61 62 6c 65 64 20 3d 20 66 61 6c 73 65 00 00 00 18 20 20 20 20 24 .$audio_enabled.=.false........$
0740 6d 69 63 5f 65 6e 61 62 6c 65 64 20 3d 20 66 61 6c 73 65 00 00 00 1a 20 20 20 20 24 73 65 6c 65 mic_enabled.=.false........$sele
0760 63 74 5f 72 65 67 69 6f 6e 20 3d 20 66 61 6c 73 65 00 00 00 06 20 20 52 55 42 59 00 00 00 02 20 ct_region.=.false......RUBY.....
0780 20 00 00 00 48 20 20 46 69 6c 65 2e 77 72 69 74 65 28 46 69 6c 65 2e 6a 6f 69 6e 28 64 65 66 61 ....H..File.write(File.join(defa
07a0 75 6c 74 5f 63 6f 6e 66 69 67 5f 64 69 72 2c 20 27 63 6f 6e 66 69 67 2e 72 62 27 29 2c 20 63 6f ult_config_dir,.'config.rb'),.co
07c0 6e 66 69 67 5f 63 6f 6e 74 65 6e 74 29 00 00 00 31 20 20 6c 6f 61 64 20 46 69 6c 65 2e 6a 6f 69 nfig_content)...1..load.File.joi
07e0 6e 28 64 65 66 61 75 6c 74 5f 63 6f 6e 66 69 67 5f 64 69 72 2c 20 27 63 6f 6e 66 69 67 2e 72 62 n(default_config_dir,.'config.rb
0800 27 29 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 16 64 65 66 20 63 68 65 63 6b 5f 64 65 70 65 6e ')....end........def.check_depen
0820 64 65 6e 63 69 65 73 00 00 00 21 20 20 64 65 70 73 20 3d 20 5b 27 77 66 2d 72 65 63 6f 72 64 65 dencies...!..deps.=.['wf-recorde
0840 72 27 2c 20 27 73 6c 75 72 70 27 5d 00 00 00 49 20 20 6d 69 73 73 69 6e 67 20 3d 20 64 65 70 73 r',.'slurp']...I..missing.=.deps
0860 2e 72 65 6a 65 63 74 20 7b 20 7c 64 65 70 7c 20 73 79 73 74 65 6d 28 22 77 68 69 63 68 20 23 7b .reject.{.|dep|.system("which.#{
0880 64 65 70 7d 20 3e 20 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 26 31 22 29 20 7d 00 00 00 02 20 20 00 dep}.>./dev/null.2>&1").}.......
08a0 00 00 17 20 20 75 6e 6c 65 73 73 20 6d 69 73 73 69 6e 67 2e 65 6d 70 74 79 3f 00 00 00 3d 20 20 .....unless.missing.empty?...=..
08c0 20 20 77 61 72 6e 20 22 65 72 72 6f 72 3a 20 6d 69 73 73 69 6e 67 20 64 65 70 65 6e 64 65 6e 63 ..warn."error:.missing.dependenc
08e0 69 65 73 3a 20 23 7b 6d 69 73 73 69 6e 67 2e 6a 6f 69 6e 28 27 2c 20 27 29 7d 22 00 00 00 18 20 ies:.#{missing.join(',.')}".....
0900 20 20 20 77 61 72 6e 20 22 69 6e 73 74 61 6c 6c 20 77 69 74 68 3a 22 00 00 00 33 20 20 20 20 77 ...warn."install.with:"...3....w
0920 61 72 6e 20 22 20 20 61 72 63 68 3a 20 73 75 64 6f 20 70 61 63 6d 61 6e 20 2d 53 20 77 66 2d 72 arn."..arch:.sudo.pacman.-S.wf-r
0940 65 63 6f 72 64 65 72 20 73 6c 75 72 70 22 00 00 00 37 20 20 20 20 77 61 72 6e 20 22 20 20 66 65 ecorder.slurp"...7....warn."..fe
0960 64 6f 72 61 3a 20 73 75 64 6f 20 64 6e 66 20 69 6e 73 74 61 6c 6c 20 77 66 2d 72 65 63 6f 72 64 dora:.sudo.dnf.install.wf-record
0980 65 72 20 73 6c 75 72 70 22 00 00 00 37 20 20 20 20 77 61 72 6e 20 22 20 20 75 62 75 6e 74 75 3a er.slurp"...7....warn."..ubuntu:
09a0 20 73 75 64 6f 20 61 70 74 20 69 6e 73 74 61 6c 6c 20 77 66 2d 72 65 63 6f 72 64 65 72 20 73 6c .sudo.apt.install.wf-recorder.sl
09c0 75 72 70 22 00 00 00 0a 20 20 20 20 65 78 69 74 20 31 00 00 00 05 20 20 65 6e 64 00 00 00 03 65 urp"........exit.1......end....e
09e0 6e 64 00 00 00 00 00 00 00 15 64 65 66 20 63 72 65 61 74 65 5f 6f 75 74 70 75 74 5f 64 69 72 00 nd........def.create_output_dir.
0a00 00 00 3f 20 20 46 69 6c 65 55 74 69 6c 73 2e 6d 6b 64 69 72 5f 70 28 24 6f 75 74 70 75 74 5f 64 ..?..FileUtils.mkdir_p($output_d
0a20 69 72 29 20 75 6e 6c 65 73 73 20 44 69 72 2e 65 78 69 73 74 3f 28 24 6f 75 74 70 75 74 5f 64 69 ir).unless.Dir.exist?($output_di
0a40 72 29 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 31 64 65 66 20 67 65 74 5f 61 75 64 69 6f 5f 64 r)....end.......1def.get_audio_d
0a60 65 76 69 63 65 73 28 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 2c 20 69 6e 63 6c 75 64 65 5f 6d 69 evices(include_audio,.include_mi
0a80 63 29 00 00 00 0e 20 20 64 65 76 69 63 65 73 20 3d 20 5b 5d 00 00 00 02 20 20 00 00 00 12 20 20 c)......devices.=.[]............
0aa0 69 66 20 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 00 00 00 2d 20 20 20 20 69 66 20 73 79 73 74 65 if.include_audio...-....if.syste
0ac0 6d 28 22 77 68 69 63 68 20 70 61 63 74 6c 20 3e 20 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 26 31 22 m("which.pactl.>./dev/null.2>&1"
0ae0 29 00 00 00 53 20 20 20 20 20 20 64 65 66 61 75 6c 74 5f 73 69 6e 6b 20 3d 20 60 70 61 63 74 6c )...S......default_sink.=.`pactl
0b00 20 69 6e 66 6f 20 7c 20 67 72 65 70 20 22 64 65 66 61 75 6c 74 20 73 69 6e 6b 22 20 7c 20 63 75 .info.|.grep."default.sink".|.cu
0b20 74 20 2d 64 3a 20 2d 66 32 20 7c 20 78 61 72 67 73 60 2e 73 74 72 69 70 00 00 00 45 20 20 20 20 t.-d:.-f2.|.xargs`.strip...E....
0b40 20 20 64 65 76 69 63 65 73 20 3c 3c 20 22 23 7b 64 65 66 61 75 6c 74 5f 73 69 6e 6b 7d 2e 6d 6f ..devices.<<."#{default_sink}.mo
0b60 6e 69 74 6f 72 22 20 75 6e 6c 65 73 73 20 64 65 66 61 75 6c 74 5f 73 69 6e 6b 2e 65 6d 70 74 79 nitor".unless.default_sink.empty
0b80 3f 00 00 00 30 20 20 20 20 65 6c 73 69 66 20 73 79 73 74 65 6d 28 22 77 68 69 63 68 20 77 70 63 ?...0....elsif.system("which.wpc
0ba0 74 6c 20 3e 20 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 26 31 22 29 00 00 00 29 20 20 20 20 20 20 77 tl.>./dev/null.2>&1")...)......w
0bc0 70 5f 6f 75 74 20 3d 20 60 77 70 63 74 6c 20 73 74 61 74 75 73 20 32 3e 2f 64 65 76 2f 6e 75 6c p_out.=.`wpctl.status.2>/dev/nul
0be0 6c 60 00 00 00 45 20 20 20 20 20 20 64 65 66 61 75 6c 74 5f 73 69 6e 6b 20 3d 20 77 70 5f 6f 75 l`...E......default_sink.=.wp_ou
0c00 74 2e 6d 61 74 63 68 28 2f 73 69 6e 6b 73 3a 2e 2a 3f 5c 6e 5c 73 2a 5c 2a 5c 73 2b 28 5c 64 2b t.match(/sinks:.*?\n\s*\*\s+(\d+
0c20 29 2f 6d 29 26 2e 5b 5d 28 31 29 00 00 00 2d 20 20 20 20 20 20 64 65 76 69 63 65 73 20 3c 3c 20 )/m)&.[](1)...-......devices.<<.
0c40 64 65 66 61 75 6c 74 5f 73 69 6e 6b 20 69 66 20 64 65 66 61 75 6c 74 5f 73 69 6e 6b 00 00 00 07 default_sink.if.default_sink....
0c60 20 20 20 20 65 6e 64 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 10 20 20 69 66 20 69 ....end......end............if.i
0c80 6e 63 6c 75 64 65 5f 6d 69 63 00 00 00 2d 20 20 20 20 69 66 20 73 79 73 74 65 6d 28 22 77 68 69 nclude_mic...-....if.system("whi
0ca0 63 68 20 70 61 63 74 6c 20 3e 20 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 26 31 22 29 00 00 00 57 20 ch.pactl.>./dev/null.2>&1")...W.
0cc0 20 20 20 20 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 20 3d 20 60 70 61 63 74 6c 20 69 6e 66 .....default_source.=.`pactl.inf
0ce0 6f 20 7c 20 67 72 65 70 20 22 64 65 66 61 75 6c 74 20 73 6f 75 72 63 65 22 20 7c 20 63 75 74 20 o.|.grep."default.source".|.cut.
0d00 2d 64 3a 20 2d 66 32 20 7c 20 78 61 72 67 73 60 2e 73 74 72 69 70 00 00 00 3c 20 20 20 20 20 20 -d:.-f2.|.xargs`.strip...<......
0d20 64 65 76 69 63 65 73 20 3c 3c 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 20 75 6e 6c 65 73 73 devices.<<.default_source.unless
0d40 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 2e 65 6d 70 74 79 3f 00 00 00 30 20 20 20 20 65 6c .default_source.empty?...0....el
0d60 73 69 66 20 73 79 73 74 65 6d 28 22 77 68 69 63 68 20 77 70 63 74 6c 20 3e 20 2f 64 65 76 2f 6e sif.system("which.wpctl.>./dev/n
0d80 75 6c 6c 20 32 3e 26 31 22 29 00 00 00 29 20 20 20 20 20 20 77 70 5f 6f 75 74 20 3d 20 60 77 70 ull.2>&1")...)......wp_out.=.`wp
0da0 63 74 6c 20 73 74 61 74 75 73 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 60 00 00 00 49 20 20 20 20 20 ctl.status.2>/dev/null`...I.....
0dc0 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 20 3d 20 77 70 5f 6f 75 74 2e 6d 61 74 63 68 28 2f .default_source.=.wp_out.match(/
0de0 73 6f 75 72 63 65 73 3a 2e 2a 3f 5c 6e 5c 73 2a 5c 2a 5c 73 2b 28 5c 64 2b 29 2f 6d 29 26 2e 5b sources:.*?\n\s*\*\s+(\d+)/m)&.[
0e00 5d 28 31 29 00 00 00 31 20 20 20 20 20 20 64 65 76 69 63 65 73 20 3c 3c 20 64 65 66 61 75 6c 74 ](1)...1......devices.<<.default
0e20 5f 73 6f 75 72 63 65 20 69 66 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 00 00 00 07 20 20 20 _source.if.default_source.......
0e40 20 65 6e 64 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 09 20 20 64 65 76 69 63 65 73 .end......end............devices
0e60 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 59 64 65 66 20 62 75 69 6c 64 5f 63 6f 6d 6d 61 6e 64 ....end.......Ydef.build_command
0e80 28 67 65 6f 6d 65 74 72 79 2c 20 66 70 73 2c 20 63 6f 64 65 63 2c 20 71 75 61 6c 69 74 79 2c 20 (geometry,.fps,.codec,.quality,.
0ea0 6f 75 74 70 75 74 5f 66 69 6c 65 2c 20 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 2c 20 69 6e 63 6c output_file,.include_audio,.incl
0ec0 75 64 65 5f 6d 69 63 29 00 00 00 17 20 20 63 6d 64 20 3d 20 5b 27 77 66 2d 72 65 63 6f 72 64 65 ude_mic)......cmd.=.['wf-recorde
0ee0 72 27 5d 00 00 00 02 20 20 00 00 00 25 20 20 63 6d 64 20 3c 3c 20 27 2d 67 27 20 3c 3c 20 67 65 r'].........%..cmd.<<.'-g'.<<.ge
0f00 6f 6d 65 74 72 79 20 69 66 20 67 65 6f 6d 65 74 72 79 00 00 00 02 20 20 00 00 00 21 20 20 69 66 ometry.if.geometry.........!..if
0f20 20 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 20 7c 7c 20 69 6e 63 6c 75 64 65 5f 6d 69 63 00 00 00 .include_audio.||.include_mic...
0f40 3b 20 20 20 20 64 65 76 69 63 65 73 20 3d 20 67 65 74 5f 61 75 64 69 6f 5f 64 65 76 69 63 65 73 ;....devices.=.get_audio_devices
0f60 28 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 2c 20 69 6e 63 6c 75 64 65 5f 6d 69 63 29 00 00 00 19 (include_audio,.include_mic)....
0f80 20 20 20 20 75 6e 6c 65 73 73 20 64 65 76 69 63 65 73 2e 65 6d 70 74 79 3f 00 00 00 2b 20 20 20 ....unless.devices.empty?...+...
0fa0 20 20 20 63 6d 64 20 3c 3c 20 27 2d 2d 61 75 64 69 6f 27 20 3c 3c 20 64 65 76 69 63 65 73 2e 6a ...cmd.<<.'--audio'.<<.devices.j
0fc0 6f 69 6e 28 27 2c 27 29 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 05 20 20 65 6e 64 00 00 00 02 oin(',')........end......end....
0fe0 20 20 00 00 00 0c 20 20 63 61 73 65 20 63 6f 64 65 63 00 00 00 10 20 20 77 68 65 6e 20 27 6c 69 ........case.codec......when.'li
1000 62 78 32 36 34 27 00 00 00 18 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 63 27 20 3c 3c 20 63 6f 64 bx264'........cmd.<<.'-c'.<<.cod
1020 65 63 00 00 00 22 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 22 70 72 65 73 65 74 ec..."....cmd.<<.'-p'.<<."preset
1040 3d 6d 65 64 69 75 6d 22 00 00 00 33 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 22 =medium"...3....cmd.<<.'-p'.<<."
1060 63 72 66 3d 23 7b 28 35 31 20 2d 20 71 75 61 6c 69 74 79 20 2f 20 32 29 2e 74 6f 5f 69 7d 22 00 crf=#{(51.-.quality./.2).to_i}".
1080 00 00 10 20 20 77 68 65 6e 20 27 6c 69 62 78 32 36 35 27 00 00 00 18 20 20 20 20 63 6d 64 20 3c .....when.'libx265'........cmd.<
10a0 3c 20 27 2d 63 27 20 3c 3c 20 63 6f 64 65 63 00 00 00 22 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d <.'-c'.<<.codec..."....cmd.<<.'-
10c0 70 27 20 3c 3c 20 22 70 72 65 73 65 74 3d 6d 65 64 69 75 6d 22 00 00 00 33 20 20 20 20 63 6d 64 p'.<<."preset=medium"...3....cmd
10e0 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 22 63 72 66 3d 23 7b 28 35 31 20 2d 20 71 75 61 6c 69 74 79 .<<.'-p'.<<."crf=#{(51.-.quality
1100 20 2f 20 32 29 2e 74 6f 5f 69 7d 22 00 00 00 0f 20 20 77 68 65 6e 20 27 6c 69 62 76 70 39 27 00 ./.2).to_i}"......when.'libvp9'.
1120 00 00 18 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 63 27 20 3c 3c 20 63 6f 64 65 63 00 00 00 33 20 .......cmd.<<.'-c'.<<.codec...3.
1140 20 20 20 63 6d 64 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 22 63 72 66 3d 23 7b 28 36 33 20 2d 20 71 ...cmd.<<.'-p'.<<."crf=#{(63.-.q
1160 75 61 6c 69 74 79 20 2f 20 32 29 2e 74 6f 5f 69 7d 22 00 00 00 1c 20 20 20 20 63 6d 64 20 3c 3c uality./.2).to_i}"........cmd.<<
1180 20 27 2d 70 27 20 3c 3c 20 22 73 70 65 65 64 3d 32 22 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 .'-p'.<<."speed=2"......end.....
11a0 20 00 00 00 20 20 20 63 6d 64 20 3c 3c 20 27 2d 72 27 20 3c 3c 20 66 70 73 2e 74 6f 5f 73 20 69 .......cmd.<<.'-r'.<<.fps.to_s.i
11c0 66 20 66 70 73 00 00 00 1c 20 20 63 6d 64 20 3c 3c 20 27 2d 6f 27 20 3c 3c 20 6f 75 74 70 75 74 f.fps......cmd.<<.'-o'.<<.output
11e0 5f 66 69 6c 65 00 00 00 02 20 20 00 00 00 05 20 20 63 6d 64 00 00 00 03 65 6e 64 00 00 00 00 00 _file............cmd....end.....
1200 00 00 0b 6f 70 74 69 6f 6e 73 20 3d 20 7b 00 00 00 18 20 20 61 75 64 69 6f 3a 20 24 61 75 64 69 ...options.=.{......audio:.$audi
1220 6f 5f 65 6e 61 62 6c 65 64 2c 00 00 00 14 20 20 6d 69 63 3a 20 24 6d 69 63 5f 65 6e 61 62 6c 65 o_enabled,......mic:.$mic_enable
1240 64 2c 00 00 00 14 20 20 66 70 73 3a 20 24 64 65 66 61 75 6c 74 5f 66 70 73 2c 00 00 00 19 20 20 d,......fps:.$default_fps,......
1260 72 65 67 69 6f 6e 3a 20 24 73 65 6c 65 63 74 5f 72 65 67 69 6f 6e 2c 00 00 00 0e 20 20 6f 75 74 region:.$select_region,......out
1280 70 75 74 3a 20 6e 69 6c 2c 00 00 00 18 20 20 63 6f 64 65 63 3a 20 24 64 65 66 61 75 6c 74 5f 63 put:.nil,......codec:.$default_c
12a0 6f 64 65 63 2c 00 00 00 13 20 20 64 69 72 3a 20 24 6f 75 74 70 75 74 5f 64 69 72 2c 00 00 00 1b odec,......dir:.$output_dir,....
12c0 20 20 71 75 61 6c 69 74 79 3a 20 24 64 65 66 61 75 6c 74 5f 71 75 61 6c 69 74 79 00 00 00 01 7d ..quality:.$default_quality....}
12e0 00 00 00 00 00 00 00 27 6f 70 74 5f 70 61 72 73 65 72 20 3d 20 4f 70 74 69 6f 6e 50 61 72 73 65 .......'opt_parser.=.OptionParse
1300 72 2e 6e 65 77 20 64 6f 20 7c 6f 70 74 73 7c 00 00 00 28 20 20 6f 70 74 73 2e 62 61 6e 6e 65 72 r.new.do.|opts|...(..opts.banner
1320 20 3d 20 22 75 73 61 67 65 3a 20 23 7b 24 30 7d 20 5b 6f 70 74 69 6f 6e 73 5d 22 00 00 00 02 20 .=."usage:.#{$0}.[options]".....
1340 20 00 00 00 35 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 61 27 2c 20 27 2d 2d 61 75 64 69 6f 27 2c 20 ....5..opts.on('-a',.'--audio',.
1360 27 69 6e 63 6c 75 64 65 20 73 79 73 74 65 6d 20 61 75 64 69 6f 27 29 20 64 6f 00 00 00 1a 20 20 'include.system.audio').do......
1380 20 20 6f 70 74 69 6f 6e 73 5b 3a 61 75 64 69 6f 5d 20 3d 20 74 72 75 65 00 00 00 05 20 20 65 6e ..options[:audio].=.true......en
13a0 64 00 00 00 02 20 20 00 00 00 31 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 6d 27 2c 20 27 2d 2d 6d 69 d.........1..opts.on('-m',.'--mi
13c0 63 27 2c 20 27 69 6e 63 6c 75 64 65 20 6d 69 63 72 6f 70 68 6f 6e 65 27 29 20 64 6f 00 00 00 18 c',.'include.microphone').do....
13e0 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 6d 69 63 5d 20 3d 20 74 72 75 65 00 00 00 05 20 20 65 6e ....options[:mic].=.true......en
1400 64 00 00 00 02 20 20 00 00 00 52 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 66 27 2c 20 27 2d 2d 66 70 d.........R..opts.on('-f',.'--fp
1420 73 20 4e 55 4d 27 2c 20 49 6e 74 65 67 65 72 2c 20 27 73 65 74 20 66 70 73 20 28 64 65 66 61 75 s.NUM',.Integer,.'set.fps.(defau
1440 6c 74 3a 20 23 7b 24 64 65 66 61 75 6c 74 5f 66 70 73 7d 29 27 29 20 64 6f 20 7c 66 7c 00 00 00 lt:.#{$default_fps})').do.|f|...
1460 15 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 66 70 73 5d 20 3d 20 66 00 00 00 05 20 20 65 6e 64 00 .....options[:fps].=.f......end.
1480 00 00 02 20 20 00 00 00 3a 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 73 27 2c 20 27 2d 2d 73 65 6c 65 ........:..opts.on('-s',.'--sele
14a0 63 74 27 2c 20 27 73 65 6c 65 63 74 20 72 65 67 69 6f 6e 20 77 69 74 68 20 73 6c 75 72 70 27 29 ct',.'select.region.with.slurp')
14c0 20 64 6f 00 00 00 1b 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 72 65 67 69 6f 6e 5d 20 3d 20 74 72 .do........options[:region].=.tr
14e0 75 65 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 51 20 20 6f 70 74 73 2e 6f 6e 28 27 ue......end.........Q..opts.on('
1500 2d 6f 27 2c 20 27 2d 2d 6f 75 74 70 75 74 20 4e 41 4d 45 27 2c 20 53 74 72 69 6e 67 2c 20 27 6f -o',.'--output.NAME',.String,.'o
1520 75 74 70 75 74 20 66 69 6c 65 6e 61 6d 65 20 28 6e 6f 20 65 78 74 65 6e 73 69 6f 6e 29 27 29 20 utput.filename.(no.extension)').
1540 64 6f 20 7c 6f 7c 00 00 00 18 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 6f 75 74 70 75 74 5d 20 3d do.|o|........options[:output].=
1560 20 6f 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 52 20 20 6f 70 74 73 2e 6f 6e 28 27 .o......end.........R..opts.on('
1580 2d 63 27 2c 20 27 2d 2d 63 6f 64 65 63 20 43 4f 44 45 43 27 2c 20 53 74 72 69 6e 67 2c 20 27 63 -c',.'--codec.CODEC',.String,.'c
15a0 6f 64 65 63 3a 20 6c 69 62 78 32 36 34 2c 20 6c 69 62 78 32 36 35 2c 20 6c 69 62 76 70 39 27 29 odec:.libx264,.libx265,.libvp9')
15c0 20 64 6f 20 7c 63 7c 00 00 00 17 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 63 6f 64 65 63 5d 20 3d .do.|c|........options[:codec].=
15e0 20 63 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 3f 20 20 6f 70 74 73 2e 6f 6e 28 27 .c......end.........?..opts.on('
1600 2d 64 27 2c 20 27 2d 2d 64 69 72 20 44 49 52 27 2c 20 53 74 72 69 6e 67 2c 20 27 6f 75 74 70 75 -d',.'--dir.DIR',.String,.'outpu
1620 74 20 64 69 72 65 63 74 6f 72 79 27 29 20 64 6f 20 7c 64 7c 00 00 00 15 20 20 20 20 6f 70 74 69 t.directory').do.|d|........opti
1640 6f 6e 73 5b 3a 64 69 72 5d 20 3d 20 64 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 60 ons[:dir].=.d......end.........`
1660 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 71 27 2c 20 27 2d 2d 71 75 61 6c 69 74 79 20 4e 55 4d 27 2c ..opts.on('-q',.'--quality.NUM',
1680 20 49 6e 74 65 67 65 72 2c 20 27 71 75 61 6c 69 74 79 20 31 2d 31 30 30 20 28 64 65 66 61 75 6c .Integer,.'quality.1-100.(defaul
16a0 74 3a 20 23 7b 24 64 65 66 61 75 6c 74 5f 71 75 61 6c 69 74 79 7d 29 27 29 20 64 6f 20 7c 71 7c t:.#{$default_quality})').do.|q|
16c0 00 00 00 19 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 71 75 61 6c 69 74 79 5d 20 3d 20 71 00 00 00 ........options[:quality].=.q...
16e0 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 29 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 68 27 2c 20 ...end.........)..opts.on('-h',.
1700 27 2d 2d 68 65 6c 70 27 2c 20 27 73 68 6f 77 20 68 65 6c 70 27 29 20 64 6f 00 00 00 0d 20 20 20 '--help',.'show.help').do.......
1720 20 70 75 74 73 20 6f 70 74 73 00 00 00 08 20 20 20 20 65 78 69 74 00 00 00 05 20 20 65 6e 64 00 .puts.opts........exit......end.
1740 00 00 03 65 6e 64 00 00 00 00 00 00 00 05 62 65 67 69 6e 00 00 00 13 20 20 6f 70 74 5f 70 61 72 ...end........begin......opt_par
1760 73 65 72 2e 70 61 72 73 65 21 00 00 00 27 72 65 73 63 75 65 20 4f 70 74 69 6f 6e 50 61 72 73 65 ser.parse!...'rescue.OptionParse
1780 72 3a 3a 49 6e 76 61 6c 69 64 4f 70 74 69 6f 6e 20 3d 3e 20 65 00 00 00 1c 20 20 77 61 72 6e 20 r::InvalidOption.=>.e......warn.
17a0 22 65 72 72 6f 72 3a 20 23 7b 65 2e 6d 65 73 73 61 67 65 7d 22 00 00 00 11 20 20 77 61 72 6e 20 "error:.#{e.message}"......warn.
17c0 6f 70 74 5f 70 61 72 73 65 72 00 00 00 08 20 20 65 78 69 74 20 31 00 00 00 03 65 6e 64 00 00 00 opt_parser......exit.1....end...
17e0 00 00 00 00 12 63 68 65 63 6b 5f 64 65 70 65 6e 64 65 6e 63 69 65 73 00 00 00 00 00 00 00 1b 24 .....check_dependencies........$
1800 6f 75 74 70 75 74 5f 64 69 72 20 3d 20 6f 70 74 69 6f 6e 73 5b 3a 64 69 72 5d 00 00 00 11 63 72 output_dir.=.options[:dir]....cr
1820 65 61 74 65 5f 6f 75 74 70 75 74 5f 64 69 72 00 00 00 00 00 00 00 2e 74 69 6d 65 73 74 61 6d 70 eate_output_dir........timestamp
1840 20 3d 20 54 69 6d 65 2e 6e 6f 77 2e 73 74 72 66 74 69 6d 65 28 27 25 59 25 6d 25 64 5f 25 48 25 .=.Time.now.strftime('%Y%m%d_%H%
1860 4d 25 53 27 29 00 00 00 13 69 66 20 6f 70 74 69 6f 6e 73 5b 3a 6f 75 74 70 75 74 5d 00 00 00 53 M%S')....if.options[:output]...S
1880 20 20 6f 75 74 70 75 74 5f 66 69 6c 65 20 3d 20 46 69 6c 65 2e 6a 6f 69 6e 28 24 6f 75 74 70 75 ..output_file.=.File.join($outpu
18a0 74 5f 64 69 72 2c 20 22 23 7b 6f 70 74 69 6f 6e 73 5b 3a 6f 75 74 70 75 74 5d 7d 2e 23 7b 24 64 t_dir,."#{options[:output]}.#{$d
18c0 65 66 61 75 6c 74 5f 63 6f 6e 74 61 69 6e 65 72 7d 22 29 00 00 00 04 65 6c 73 65 00 00 00 57 20 efault_container}")....else...W.
18e0 20 6f 75 74 70 75 74 5f 66 69 6c 65 20 3d 20 46 69 6c 65 2e 6a 6f 69 6e 28 24 6f 75 74 70 75 74 .output_file.=.File.join($output
1900 5f 64 69 72 2c 20 22 73 63 72 65 65 6e 63 61 73 74 5f 23 7b 74 69 6d 65 73 74 61 6d 70 7d 2e 23 _dir,."screencast_#{timestamp}.#
1920 7b 24 64 65 66 61 75 6c 74 5f 63 6f 6e 74 61 69 6e 65 72 7d 22 29 00 00 00 03 65 6e 64 00 00 00 {$default_container}")....end...
1940 00 00 00 00 0e 67 65 6f 6d 65 74 72 79 20 3d 20 6e 69 6c 00 00 00 13 69 66 20 6f 70 74 69 6f 6e .....geometry.=.nil....if.option
1960 73 5b 3a 72 65 67 69 6f 6e 5d 00 00 00 21 20 20 77 61 72 6e 20 22 73 65 6c 65 63 74 20 61 72 65 s[:region]...!..warn."select.are
1980 61 20 74 6f 20 72 65 63 6f 72 64 2e 2e 2e 22 00 00 00 26 20 20 67 65 6f 6d 65 74 72 79 20 3d 20 a.to.record..."...&..geometry.=.
19a0 60 73 6c 75 72 70 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 60 2e 73 74 72 69 70 00 00 00 14 20 20 69 `slurp.2>/dev/null`.strip......i
19c0 66 20 67 65 6f 6d 65 74 72 79 2e 65 6d 70 74 79 3f 00 00 00 24 20 20 20 20 77 61 72 6e 20 22 65 f.geometry.empty?...$....warn."e
19e0 72 72 6f 72 3a 20 6e 6f 20 72 65 67 69 6f 6e 20 73 65 6c 65 63 74 65 64 22 00 00 00 0a 20 20 20 rror:.no.region.selected".......
1a00 20 65 78 69 74 20 31 00 00 00 05 20 20 65 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 14 63 .exit.1......end....end........c
1a20 6d 64 20 3d 20 62 75 69 6c 64 5f 63 6f 6d 6d 61 6e 64 28 00 00 00 0b 20 20 67 65 6f 6d 65 74 72 md.=.build_command(......geometr
1a40 79 2c 00 00 00 10 20 20 6f 70 74 69 6f 6e 73 5b 3a 66 70 73 5d 2c 00 00 00 12 20 20 6f 70 74 69 y,......options[:fps],......opti
1a60 6f 6e 73 5b 3a 63 6f 64 65 63 5d 2c 00 00 00 14 20 20 6f 70 74 69 6f 6e 73 5b 3a 71 75 61 6c 69 ons[:codec],......options[:quali
1a80 74 79 5d 2c 00 00 00 0e 20 20 6f 75 74 70 75 74 5f 66 69 6c 65 2c 00 00 00 12 20 20 6f 70 74 69 ty],......output_file,......opti
1aa0 6f 6e 73 5b 3a 61 75 64 69 6f 5d 2c 00 00 00 0f 20 20 6f 70 74 69 6f 6e 73 5b 3a 6d 69 63 5d 00 ons[:audio],......options[:mic].
1ac0 00 00 01 29 00 00 00 00 00 00 00 1c 77 61 72 6e 20 22 73 74 61 72 74 69 6e 67 20 72 65 63 6f 72 ...)........warn."starting.recor
1ae0 64 69 6e 67 2e 2e 2e 22 00 00 00 1d 77 61 72 6e 20 22 6f 75 74 70 75 74 3a 20 23 7b 6f 75 74 70 ding..."....warn."output:.#{outp
1b00 75 74 5f 66 69 6c 65 7d 22 00 00 00 56 77 61 72 6e 20 22 66 70 73 3a 20 23 7b 6f 70 74 69 6f 6e ut_file}"...Vwarn."fps:.#{option
1b20 73 5b 3a 66 70 73 5d 7d 2c 20 63 6f 64 65 63 3a 20 23 7b 6f 70 74 69 6f 6e 73 5b 3a 63 6f 64 65 s[:fps]},.codec:.#{options[:code
1b40 63 5d 7d 2c 20 71 75 61 6c 69 74 79 3a 20 23 7b 6f 70 74 69 6f 6e 73 5b 3a 71 75 61 6c 69 74 79 c]},.quality:.#{options[:quality
1b60 5d 7d 22 00 00 00 25 77 61 72 6e 20 22 70 72 65 73 73 20 63 74 72 6c 2b 63 20 74 6f 20 73 74 6f ]}"...%warn."press.ctrl+c.to.sto
1b80 70 20 72 65 63 6f 72 64 69 6e 67 22 00 00 00 00 00 00 00 09 70 69 64 20 3d 20 6e 69 6c 00 00 00 p.recording"........pid.=.nil...
1ba0 0e 74 72 61 70 28 27 49 4e 54 27 29 20 64 6f 00 00 00 20 20 20 77 61 72 6e 20 22 5c 6e 73 74 6f .trap('INT').do......warn."\nsto
1bc0 70 70 69 6e 67 20 72 65 63 6f 72 64 69 6e 67 2e 2e 2e 22 00 00 00 22 20 20 50 72 6f 63 65 73 73 pping.recording..."..."..Process
1be0 2e 6b 69 6c 6c 28 27 54 45 52 4d 27 2c 20 70 69 64 29 20 69 66 20 70 69 64 00 00 00 1a 20 20 50 .kill('TERM',.pid).if.pid......P
1c00 72 6f 63 65 73 73 2e 77 61 69 74 28 70 69 64 29 20 69 66 20 70 69 64 00 00 00 40 20 20 69 66 20 rocess.wait(pid).if.pid...@..if.
1c20 46 69 6c 65 2e 65 78 69 73 74 3f 28 6f 75 74 70 75 74 5f 66 69 6c 65 29 20 26 26 20 46 69 6c 65 File.exist?(output_file).&&.File
1c40 2e 73 69 7a 65 28 6f 75 74 70 75 74 5f 66 69 6c 65 29 20 3e 20 31 30 30 30 30 30 00 00 00 33 20 .size(output_file).>.100000...3.
1c60 20 20 20 73 69 7a 65 5f 6d 62 20 3d 20 46 69 6c 65 2e 73 69 7a 65 28 6f 75 74 70 75 74 5f 66 69 ...size_mb.=.File.size(output_fi
1c80 6c 65 29 2e 74 6f 5f 66 20 2f 20 31 30 34 38 35 37 36 00 00 00 4c 20 20 20 20 77 61 72 6e 20 22 le).to_f./.1048576...L....warn."
1ca0 72 65 63 6f 72 64 69 6e 67 20 73 61 76 65 64 20 74 6f 3a 20 23 7b 6f 75 74 70 75 74 5f 66 69 6c recording.saved.to:.#{output_fil
1cc0 65 7d 20 28 73 69 7a 65 3a 20 23 7b 27 25 2e 32 66 27 20 25 20 73 69 7a 65 5f 6d 62 7d 20 6d 62 e}.(size:.#{'%.2f'.%.size_mb}.mb
1ce0 29 22 00 00 00 06 20 20 65 6c 73 65 00 00 00 34 20 20 20 20 77 61 72 6e 20 22 65 72 72 6f 72 3a )"......else...4....warn."error:
1d00 20 72 65 63 6f 72 64 69 6e 67 20 66 61 69 6c 65 64 20 6f 72 20 66 69 6c 65 20 74 6f 6f 20 73 6d .recording.failed.or.file.too.sm
1d20 61 6c 6c 22 00 00 00 05 20 20 65 6e 64 00 00 00 06 20 20 65 78 69 74 00 00 00 03 65 6e 64 00 00 all"......end......exit....end..
1d40 00 00 00 00 00 34 73 74 64 69 6e 2c 20 73 74 64 6f 75 74 2c 20 73 74 64 65 72 72 2c 20 77 61 69 .....4stdin,.stdout,.stderr,.wai
1d60 74 5f 74 68 72 20 3d 20 4f 70 65 6e 33 2e 70 6f 70 65 6e 33 28 2a 63 6d 64 29 00 00 00 12 70 69 t_thr.=.Open3.popen3(*cmd)....pi
1d80 64 20 3d 20 77 61 69 74 5f 74 68 72 2e 70 69 64 00 00 00 00 00 00 00 27 6f 75 74 5f 74 68 72 65 d.=.wait_thr.pid.......'out_thre
1da0 61 64 20 3d 20 54 68 72 65 61 64 2e 6e 65 77 20 7b 20 73 74 64 6f 75 74 2e 72 65 61 64 20 7d 00 ad.=.Thread.new.{.stdout.read.}.
1dc0 00 00 27 65 72 72 5f 74 68 72 65 61 64 20 3d 20 54 68 72 65 61 64 2e 6e 65 77 20 7b 20 73 74 64 ..'err_thread.=.Thread.new.{.std
1de0 65 72 72 2e 72 65 61 64 20 7d 00 00 00 00 00 00 00 0d 77 61 69 74 5f 74 68 72 2e 6a 6f 69 6e 00 err.read.}........wait_thr.join.
1e00 00 00 00 00 00 00 1d 73 74 64 6f 75 74 5f 73 74 72 20 3d 20 6f 75 74 5f 74 68 72 65 61 64 2e 76 .......stdout_str.=.out_thread.v
1e20 61 6c 75 65 00 00 00 1d 73 74 64 65 72 72 5f 73 74 72 20 3d 20 65 72 72 5f 74 68 72 65 61 64 2e alue....stderr_str.=.err_thread.
1e40 76 61 6c 75 65 00 00 00 00 00 00 00 59 69 66 20 77 61 69 74 5f 74 68 72 2e 76 61 6c 75 65 2e 73 value.......Yif.wait_thr.value.s
1e60 75 63 63 65 73 73 3f 20 26 26 20 46 69 6c 65 2e 65 78 69 73 74 3f 28 6f 75 74 70 75 74 5f 66 69 uccess?.&&.File.exist?(output_fi
1e80 6c 65 29 20 26 26 20 46 69 6c 65 2e 73 69 7a 65 28 6f 75 74 70 75 74 5f 66 69 6c 65 29 20 3e 20 le).&&.File.size(output_file).>.
1ea0 31 30 30 30 30 30 00 00 00 31 20 20 73 69 7a 65 5f 6d 62 20 3d 20 46 69 6c 65 2e 73 69 7a 65 28 100000...1..size_mb.=.File.size(
1ec0 6f 75 74 70 75 74 5f 66 69 6c 65 29 2e 74 6f 5f 66 20 2f 20 31 30 34 38 35 37 36 00 00 00 29 20 output_file).to_f./.1048576...).
1ee0 20 77 61 72 6e 20 22 72 65 63 6f 72 64 69 6e 67 20 63 6f 6d 70 6c 65 74 65 64 20 73 75 63 63 65 .warn."recording.completed.succe
1f00 73 73 66 75 6c 6c 79 22 00 00 00 1d 20 20 77 61 72 6e 20 22 66 69 6c 65 3a 20 23 7b 6f 75 74 70 ssfully"......warn."file:.#{outp
1f20 75 74 5f 66 69 6c 65 7d 22 00 00 00 25 20 20 77 61 72 6e 20 22 73 69 7a 65 3a 20 23 7b 27 25 2e ut_file}"...%..warn."size:.#{'%.
1f40 32 66 27 20 25 20 73 69 7a 65 5f 6d 62 7d 20 6d 62 22 00 00 00 04 65 6c 73 65 00 00 00 20 20 20 2f'.%.size_mb}.mb"....else......
1f60 77 61 72 6e 20 22 65 72 72 6f 72 3a 20 72 65 63 6f 72 64 69 6e 67 20 66 61 69 6c 65 64 22 00 00 warn."error:.recording.failed"..
1f80 00 2a 20 20 77 61 72 6e 20 73 74 64 65 72 72 5f 73 74 72 20 75 6e 6c 65 73 73 20 73 74 64 65 72 .*..warn.stderr_str.unless.stder
1fa0 72 5f 73 74 72 2e 65 6d 70 74 79 3f 00 00 00 08 20 20 65 78 69 74 20 31 00 00 00 03 65 6e 64 35 r_str.empty?......exit.1....end5
1fc0 81 35 81 5f d0 00 00 00 02 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 01 00 00 00 .5._............................
1fe0 00 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
2000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
2020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
2040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
2060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
2080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
20a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
20c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
20e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
2100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
2120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
2140 00 00 00 00 00 00 00 69 ff 9e 88 04 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 00 00 .......i........................
2160 00 00 00 f3 00 00 00 13 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 72 75 62 79 00 00 00 00 00 ........#!/usr/bin/env.ruby.....
2180 00 00 0e 72 65 71 75 69 72 65 20 27 6a 73 6f 6e 27 00 00 00 13 72 65 71 75 69 72 65 20 27 66 69 ...require.'json'....require.'fi
21a0 6c 65 75 74 69 6c 73 27 00 00 00 12 72 65 71 75 69 72 65 20 27 6f 70 74 70 61 72 73 65 27 00 00 leutils'....require.'optparse'..
21c0 00 0f 72 65 71 75 69 72 65 20 27 6f 70 65 6e 33 27 00 00 00 00 00 00 00 4c 63 6f 6e 66 69 67 5f ..require.'open3'.......Lconfig_
21e0 66 69 6c 65 20 3d 20 46 69 6c 65 2e 6a 6f 69 6e 28 44 69 72 2e 68 6f 6d 65 2c 20 27 2e 63 6f 6e file.=.File.join(Dir.home,.'.con
2200 66 69 67 27 2c 20 27 73 63 72 65 65 6e 5f 72 65 63 6f 72 64 65 72 27 2c 20 27 63 6f 6e 66 69 67 fig',.'screen_recorder',.'config
2220 2e 72 62 27 29 00 00 00 00 00 00 00 1b 69 66 20 46 69 6c 65 2e 65 78 69 73 74 3f 28 63 6f 6e 66 .rb')........if.File.exist?(conf
2240 69 67 5f 66 69 6c 65 29 00 00 00 12 20 20 6c 6f 61 64 20 63 6f 6e 66 69 67 5f 66 69 6c 65 00 00 ig_file)......load.config_file..
2260 00 04 65 6c 73 65 00 00 00 48 20 20 64 65 66 61 75 6c 74 5f 63 6f 6e 66 69 67 5f 64 69 72 20 3d ..else...H..default_config_dir.=
2280 20 46 69 6c 65 2e 6a 6f 69 6e 28 44 69 72 2e 68 6f 6d 65 2c 20 27 2e 63 6f 6e 66 69 67 27 2c 20 .File.join(Dir.home,.'.config',.
22a0 27 73 63 72 65 65 6e 5f 72 65 63 6f 72 64 65 72 27 29 00 00 00 27 20 20 46 69 6c 65 55 74 69 6c 'screen_recorder')...'..FileUtil
22c0 73 2e 6d 6b 64 69 72 5f 70 28 64 65 66 61 75 6c 74 5f 63 6f 6e 66 69 67 5f 64 69 72 29 00 00 00 s.mkdir_p(default_config_dir)...
22e0 02 20 20 00 00 00 1a 20 20 63 6f 6e 66 69 67 5f 63 6f 6e 74 65 6e 74 20 3d 20 3c 3c 7e 52 55 42 .........config_content.=.<<~RUB
2300 59 00 00 00 37 20 20 20 20 23 20 63 6f 6e 66 69 67 2e 72 62 20 2d 20 77 61 79 6c 61 6e 64 20 73 Y...7....#.config.rb.-.wayland.s
2320 63 72 65 65 6e 20 72 65 63 6f 72 64 65 72 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 04 creen.recorder.configuration....
2340 20 20 20 20 00 00 00 3e 20 20 20 20 24 6f 75 74 70 75 74 5f 64 69 72 20 3d 20 46 69 6c 65 2e 6a .......>....$output_dir.=.File.j
2360 6f 69 6e 28 44 69 72 2e 68 6f 6d 65 2c 20 27 76 69 64 65 6f 73 27 2c 20 27 73 63 72 65 65 6e 63 oin(Dir.home,.'videos',.'screenc
2380 61 73 74 73 27 29 00 00 00 15 20 20 20 20 24 64 65 66 61 75 6c 74 5f 66 70 73 20 3d 20 33 30 00 asts')........$default_fps.=.30.
23a0 00 00 1e 20 20 20 20 24 64 65 66 61 75 6c 74 5f 63 6f 64 65 63 20 3d 20 27 6c 69 62 78 32 36 34 .......$default_codec.=.'libx264
23c0 27 00 00 00 1e 20 20 20 20 24 64 65 66 61 75 6c 74 5f 63 6f 6e 74 61 69 6e 65 72 20 3d 20 27 6d '........$default_container.=.'m
23e0 70 34 27 00 00 00 19 20 20 20 20 24 64 65 66 61 75 6c 74 5f 71 75 61 6c 69 74 79 20 3d 20 38 30 p4'........$default_quality.=.80
2400 00 00 00 1a 20 20 20 20 24 61 75 64 69 6f 5f 65 6e 61 62 6c 65 64 20 3d 20 66 61 6c 73 65 00 00 ........$audio_enabled.=.false..
2420 00 18 20 20 20 20 24 6d 69 63 5f 65 6e 61 62 6c 65 64 20 3d 20 66 61 6c 73 65 00 00 00 1a 20 20 ......$mic_enabled.=.false......
2440 20 20 24 73 65 6c 65 63 74 5f 72 65 67 69 6f 6e 20 3d 20 66 61 6c 73 65 00 00 00 06 20 20 52 55 ..$select_region.=.false......RU
2460 42 59 00 00 00 02 20 20 00 00 00 48 20 20 46 69 6c 65 2e 77 72 69 74 65 28 46 69 6c 65 2e 6a 6f BY.........H..File.write(File.jo
2480 69 6e 28 64 65 66 61 75 6c 74 5f 63 6f 6e 66 69 67 5f 64 69 72 2c 20 27 63 6f 6e 66 69 67 2e 72 in(default_config_dir,.'config.r
24a0 62 27 29 2c 20 63 6f 6e 66 69 67 5f 63 6f 6e 74 65 6e 74 29 00 00 00 31 20 20 6c 6f 61 64 20 46 b'),.config_content)...1..load.F
24c0 69 6c 65 2e 6a 6f 69 6e 28 64 65 66 61 75 6c 74 5f 63 6f 6e 66 69 67 5f 64 69 72 2c 20 27 63 6f ile.join(default_config_dir,.'co
24e0 6e 66 69 67 2e 72 62 27 29 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 16 64 65 66 20 63 68 65 63 nfig.rb')....end........def.chec
2500 6b 5f 64 65 70 65 6e 64 65 6e 63 69 65 73 00 00 00 21 20 20 64 65 70 73 20 3d 20 5b 27 77 66 2d k_dependencies...!..deps.=.['wf-
2520 72 65 63 6f 72 64 65 72 27 2c 20 27 73 6c 75 72 70 27 5d 00 00 00 49 20 20 6d 69 73 73 69 6e 67 recorder',.'slurp']...I..missing
2540 20 3d 20 64 65 70 73 2e 72 65 6a 65 63 74 20 7b 20 7c 64 65 70 7c 20 73 79 73 74 65 6d 28 22 77 .=.deps.reject.{.|dep|.system("w
2560 68 69 63 68 20 23 7b 64 65 70 7d 20 3e 20 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 26 31 22 29 20 7d hich.#{dep}.>./dev/null.2>&1").}
2580 00 00 00 02 20 20 00 00 00 17 20 20 75 6e 6c 65 73 73 20 6d 69 73 73 69 6e 67 2e 65 6d 70 74 79 ............unless.missing.empty
25a0 3f 00 00 00 3d 20 20 20 20 77 61 72 6e 20 22 65 72 72 6f 72 3a 20 6d 69 73 73 69 6e 67 20 64 65 ?...=....warn."error:.missing.de
25c0 70 65 6e 64 65 6e 63 69 65 73 3a 20 23 7b 6d 69 73 73 69 6e 67 2e 6a 6f 69 6e 28 27 2c 20 27 29 pendencies:.#{missing.join(',.')
25e0 7d 22 00 00 00 18 20 20 20 20 77 61 72 6e 20 22 69 6e 73 74 61 6c 6c 20 77 69 74 68 3a 22 00 00 }"........warn."install.with:"..
2600 00 33 20 20 20 20 77 61 72 6e 20 22 20 20 61 72 63 68 3a 20 73 75 64 6f 20 70 61 63 6d 61 6e 20 .3....warn."..arch:.sudo.pacman.
2620 2d 53 20 77 66 2d 72 65 63 6f 72 64 65 72 20 73 6c 75 72 70 22 00 00 00 37 20 20 20 20 77 61 72 -S.wf-recorder.slurp"...7....war
2640 6e 20 22 20 20 66 65 64 6f 72 61 3a 20 73 75 64 6f 20 64 6e 66 20 69 6e 73 74 61 6c 6c 20 77 66 n."..fedora:.sudo.dnf.install.wf
2660 2d 72 65 63 6f 72 64 65 72 20 73 6c 75 72 70 22 00 00 00 37 20 20 20 20 77 61 72 6e 20 22 20 20 -recorder.slurp"...7....warn."..
2680 75 62 75 6e 74 75 3a 20 73 75 64 6f 20 61 70 74 20 69 6e 73 74 61 6c 6c 20 77 66 2d 72 65 63 6f ubuntu:.sudo.apt.install.wf-reco
26a0 72 64 65 72 20 73 6c 75 72 70 22 00 00 00 0a 20 20 20 20 65 78 69 74 20 31 00 00 00 05 20 20 65 rder.slurp"........exit.1......e
26c0 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 15 64 65 66 20 63 72 65 61 74 65 5f 6f 75 74 70 nd....end........def.create_outp
26e0 75 74 5f 64 69 72 00 00 00 3f 20 20 46 69 6c 65 55 74 69 6c 73 2e 6d 6b 64 69 72 5f 70 28 24 6f ut_dir...?..FileUtils.mkdir_p($o
2700 75 74 70 75 74 5f 64 69 72 29 20 75 6e 6c 65 73 73 20 44 69 72 2e 65 78 69 73 74 3f 28 24 6f 75 utput_dir).unless.Dir.exist?($ou
2720 74 70 75 74 5f 64 69 72 29 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 31 64 65 66 20 67 65 74 5f tput_dir)....end.......1def.get_
2740 61 75 64 69 6f 5f 64 65 76 69 63 65 73 28 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 2c 20 69 6e 63 audio_devices(include_audio,.inc
2760 6c 75 64 65 5f 6d 69 63 29 00 00 00 0e 20 20 64 65 76 69 63 65 73 20 3d 20 5b 5d 00 00 00 02 20 lude_mic)......devices.=.[].....
2780 20 00 00 00 12 20 20 69 66 20 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 00 00 00 2d 20 20 20 20 69 .......if.include_audio...-....i
27a0 66 20 73 79 73 74 65 6d 28 22 77 68 69 63 68 20 70 61 63 74 6c 20 3e 20 2f 64 65 76 2f 6e 75 6c f.system("which.pactl.>./dev/nul
27c0 6c 20 32 3e 26 31 22 29 00 00 00 53 20 20 20 20 20 20 64 65 66 61 75 6c 74 5f 73 69 6e 6b 20 3d l.2>&1")...S......default_sink.=
27e0 20 60 70 61 63 74 6c 20 69 6e 66 6f 20 7c 20 67 72 65 70 20 22 64 65 66 61 75 6c 74 20 73 69 6e .`pactl.info.|.grep."default.sin
2800 6b 22 20 7c 20 63 75 74 20 2d 64 3a 20 2d 66 32 20 7c 20 78 61 72 67 73 60 2e 73 74 72 69 70 00 k".|.cut.-d:.-f2.|.xargs`.strip.
2820 00 00 45 20 20 20 20 20 20 64 65 76 69 63 65 73 20 3c 3c 20 22 23 7b 64 65 66 61 75 6c 74 5f 73 ..E......devices.<<."#{default_s
2840 69 6e 6b 7d 2e 6d 6f 6e 69 74 6f 72 22 20 75 6e 6c 65 73 73 20 64 65 66 61 75 6c 74 5f 73 69 6e ink}.monitor".unless.default_sin
2860 6b 2e 65 6d 70 74 79 3f 00 00 00 30 20 20 20 20 65 6c 73 69 66 20 73 79 73 74 65 6d 28 22 77 68 k.empty?...0....elsif.system("wh
2880 69 63 68 20 77 70 63 74 6c 20 3e 20 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 26 31 22 29 00 00 00 29 ich.wpctl.>./dev/null.2>&1")...)
28a0 20 20 20 20 20 20 77 70 5f 6f 75 74 20 3d 20 60 77 70 63 74 6c 20 73 74 61 74 75 73 20 32 3e 2f ......wp_out.=.`wpctl.status.2>/
28c0 64 65 76 2f 6e 75 6c 6c 60 00 00 00 45 20 20 20 20 20 20 64 65 66 61 75 6c 74 5f 73 69 6e 6b 20 dev/null`...E......default_sink.
28e0 3d 20 77 70 5f 6f 75 74 2e 6d 61 74 63 68 28 2f 73 69 6e 6b 73 3a 2e 2a 3f 5c 6e 5c 73 2a 5c 2a =.wp_out.match(/sinks:.*?\n\s*\*
2900 5c 73 2b 28 5c 64 2b 29 2f 6d 29 26 2e 5b 5d 28 31 29 00 00 00 2d 20 20 20 20 20 20 64 65 76 69 \s+(\d+)/m)&.[](1)...-......devi
2920 63 65 73 20 3c 3c 20 64 65 66 61 75 6c 74 5f 73 69 6e 6b 20 69 66 20 64 65 66 61 75 6c 74 5f 73 ces.<<.default_sink.if.default_s
2940 69 6e 6b 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 ink........end......end.........
2960 10 20 20 69 66 20 69 6e 63 6c 75 64 65 5f 6d 69 63 00 00 00 2d 20 20 20 20 69 66 20 73 79 73 74 ...if.include_mic...-....if.syst
2980 65 6d 28 22 77 68 69 63 68 20 70 61 63 74 6c 20 3e 20 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 26 31 em("which.pactl.>./dev/null.2>&1
29a0 22 29 00 00 00 57 20 20 20 20 20 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 20 3d 20 60 70 61 ")...W......default_source.=.`pa
29c0 63 74 6c 20 69 6e 66 6f 20 7c 20 67 72 65 70 20 22 64 65 66 61 75 6c 74 20 73 6f 75 72 63 65 22 ctl.info.|.grep."default.source"
29e0 20 7c 20 63 75 74 20 2d 64 3a 20 2d 66 32 20 7c 20 78 61 72 67 73 60 2e 73 74 72 69 70 00 00 00 .|.cut.-d:.-f2.|.xargs`.strip...
2a00 3c 20 20 20 20 20 20 64 65 76 69 63 65 73 20 3c 3c 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 <......devices.<<.default_source
2a20 20 75 6e 6c 65 73 73 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 2e 65 6d 70 74 79 3f 00 00 00 .unless.default_source.empty?...
2a40 30 20 20 20 20 65 6c 73 69 66 20 73 79 73 74 65 6d 28 22 77 68 69 63 68 20 77 70 63 74 6c 20 3e 0....elsif.system("which.wpctl.>
2a60 20 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 26 31 22 29 00 00 00 29 20 20 20 20 20 20 77 70 5f 6f 75 ./dev/null.2>&1")...)......wp_ou
2a80 74 20 3d 20 60 77 70 63 74 6c 20 73 74 61 74 75 73 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 60 00 00 t.=.`wpctl.status.2>/dev/null`..
2aa0 00 49 20 20 20 20 20 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 20 3d 20 77 70 5f 6f 75 74 2e .I......default_source.=.wp_out.
2ac0 6d 61 74 63 68 28 2f 73 6f 75 72 63 65 73 3a 2e 2a 3f 5c 6e 5c 73 2a 5c 2a 5c 73 2b 28 5c 64 2b match(/sources:.*?\n\s*\*\s+(\d+
2ae0 29 2f 6d 29 26 2e 5b 5d 28 31 29 00 00 00 31 20 20 20 20 20 20 64 65 76 69 63 65 73 20 3c 3c 20 )/m)&.[](1)...1......devices.<<.
2b00 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 20 69 66 20 64 65 66 61 75 6c 74 5f 73 6f 75 72 63 65 default_source.if.default_source
2b20 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 09 20 20 ........end......end............
2b40 64 65 76 69 63 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 59 64 65 66 20 62 75 69 6c 64 5f devices....end.......Ydef.build_
2b60 63 6f 6d 6d 61 6e 64 28 67 65 6f 6d 65 74 72 79 2c 20 66 70 73 2c 20 63 6f 64 65 63 2c 20 71 75 command(geometry,.fps,.codec,.qu
2b80 61 6c 69 74 79 2c 20 6f 75 74 70 75 74 5f 66 69 6c 65 2c 20 69 6e 63 6c 75 64 65 5f 61 75 64 69 ality,.output_file,.include_audi
2ba0 6f 2c 20 69 6e 63 6c 75 64 65 5f 6d 69 63 29 00 00 00 17 20 20 63 6d 64 20 3d 20 5b 27 77 66 2d o,.include_mic)......cmd.=.['wf-
2bc0 72 65 63 6f 72 64 65 72 27 5d 00 00 00 02 20 20 00 00 00 25 20 20 63 6d 64 20 3c 3c 20 27 2d 67 recorder'].........%..cmd.<<.'-g
2be0 27 20 3c 3c 20 67 65 6f 6d 65 74 72 79 20 69 66 20 67 65 6f 6d 65 74 72 79 00 00 00 02 20 20 00 '.<<.geometry.if.geometry.......
2c00 00 00 21 20 20 69 66 20 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 20 7c 7c 20 69 6e 63 6c 75 64 65 ..!..if.include_audio.||.include
2c20 5f 6d 69 63 00 00 00 3b 20 20 20 20 64 65 76 69 63 65 73 20 3d 20 67 65 74 5f 61 75 64 69 6f 5f _mic...;....devices.=.get_audio_
2c40 64 65 76 69 63 65 73 28 69 6e 63 6c 75 64 65 5f 61 75 64 69 6f 2c 20 69 6e 63 6c 75 64 65 5f 6d devices(include_audio,.include_m
2c60 69 63 29 00 00 00 19 20 20 20 20 75 6e 6c 65 73 73 20 64 65 76 69 63 65 73 2e 65 6d 70 74 79 3f ic)........unless.devices.empty?
2c80 00 00 00 2b 20 20 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 2d 61 75 64 69 6f 27 20 3c 3c 20 64 65 ...+......cmd.<<.'--audio'.<<.de
2ca0 76 69 63 65 73 2e 6a 6f 69 6e 28 27 2c 27 29 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 05 20 20 vices.join(',')........end......
2cc0 65 6e 64 00 00 00 02 20 20 00 00 00 0c 20 20 63 61 73 65 20 63 6f 64 65 63 00 00 00 10 20 20 77 end............case.codec......w
2ce0 68 65 6e 20 27 6c 69 62 78 32 36 34 27 00 00 00 18 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 63 27 hen.'libx264'........cmd.<<.'-c'
2d00 20 3c 3c 20 63 6f 64 65 63 00 00 00 22 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 .<<.codec..."....cmd.<<.'-p'.<<.
2d20 22 70 72 65 73 65 74 3d 6d 65 64 69 75 6d 22 00 00 00 33 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d "preset=medium"...3....cmd.<<.'-
2d40 70 27 20 3c 3c 20 22 63 72 66 3d 23 7b 28 35 31 20 2d 20 71 75 61 6c 69 74 79 20 2f 20 32 29 2e p'.<<."crf=#{(51.-.quality./.2).
2d60 74 6f 5f 69 7d 22 00 00 00 10 20 20 77 68 65 6e 20 27 6c 69 62 78 32 36 35 27 00 00 00 18 20 20 to_i}"......when.'libx265'......
2d80 20 20 63 6d 64 20 3c 3c 20 27 2d 63 27 20 3c 3c 20 63 6f 64 65 63 00 00 00 22 20 20 20 20 63 6d ..cmd.<<.'-c'.<<.codec..."....cm
2da0 64 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 22 70 72 65 73 65 74 3d 6d 65 64 69 75 6d 22 00 00 00 33 d.<<.'-p'.<<."preset=medium"...3
2dc0 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 22 63 72 66 3d 23 7b 28 35 31 20 2d 20 ....cmd.<<.'-p'.<<."crf=#{(51.-.
2de0 71 75 61 6c 69 74 79 20 2f 20 32 29 2e 74 6f 5f 69 7d 22 00 00 00 0f 20 20 77 68 65 6e 20 27 6c quality./.2).to_i}"......when.'l
2e00 69 62 76 70 39 27 00 00 00 18 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 63 27 20 3c 3c 20 63 6f 64 ibvp9'........cmd.<<.'-c'.<<.cod
2e20 65 63 00 00 00 33 20 20 20 20 63 6d 64 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 22 63 72 66 3d 23 7b ec...3....cmd.<<.'-p'.<<."crf=#{
2e40 28 36 33 20 2d 20 71 75 61 6c 69 74 79 20 2f 20 32 29 2e 74 6f 5f 69 7d 22 00 00 00 1c 20 20 20 (63.-.quality./.2).to_i}".......
2e60 20 63 6d 64 20 3c 3c 20 27 2d 70 27 20 3c 3c 20 22 73 70 65 65 64 3d 32 22 00 00 00 05 20 20 65 .cmd.<<.'-p'.<<."speed=2"......e
2e80 6e 64 00 00 00 02 20 20 00 00 00 20 20 20 63 6d 64 20 3c 3c 20 27 2d 72 27 20 3c 3c 20 66 70 73 nd............cmd.<<.'-r'.<<.fps
2ea0 2e 74 6f 5f 73 20 69 66 20 66 70 73 00 00 00 1c 20 20 63 6d 64 20 3c 3c 20 27 2d 6f 27 20 3c 3c .to_s.if.fps......cmd.<<.'-o'.<<
2ec0 20 6f 75 74 70 75 74 5f 66 69 6c 65 00 00 00 02 20 20 00 00 00 05 20 20 63 6d 64 00 00 00 03 65 .output_file............cmd....e
2ee0 6e 64 00 00 00 00 00 00 00 0b 6f 70 74 69 6f 6e 73 20 3d 20 7b 00 00 00 18 20 20 61 75 64 69 6f nd........options.=.{......audio
2f00 3a 20 24 61 75 64 69 6f 5f 65 6e 61 62 6c 65 64 2c 00 00 00 14 20 20 6d 69 63 3a 20 24 6d 69 63 :.$audio_enabled,......mic:.$mic
2f20 5f 65 6e 61 62 6c 65 64 2c 00 00 00 14 20 20 66 70 73 3a 20 24 64 65 66 61 75 6c 74 5f 66 70 73 _enabled,......fps:.$default_fps
2f40 2c 00 00 00 19 20 20 72 65 67 69 6f 6e 3a 20 24 73 65 6c 65 63 74 5f 72 65 67 69 6f 6e 2c 00 00 ,......region:.$select_region,..
2f60 00 0e 20 20 6f 75 74 70 75 74 3a 20 6e 69 6c 2c 00 00 00 18 20 20 63 6f 64 65 63 3a 20 24 64 65 ....output:.nil,......codec:.$de
2f80 66 61 75 6c 74 5f 63 6f 64 65 63 2c 00 00 00 13 20 20 64 69 72 3a 20 24 6f 75 74 70 75 74 5f 64 fault_codec,......dir:.$output_d
2fa0 69 72 2c 00 00 00 1b 20 20 71 75 61 6c 69 74 79 3a 20 24 64 65 66 61 75 6c 74 5f 71 75 61 6c 69 ir,......quality:.$default_quali
2fc0 74 79 00 00 00 01 7d 00 00 00 00 00 00 00 27 6f 70 74 5f 70 61 72 73 65 72 20 3d 20 4f 70 74 69 ty....}.......'opt_parser.=.Opti
2fe0 6f 6e 50 61 72 73 65 72 2e 6e 65 77 20 64 6f 20 7c 6f 70 74 73 7c 00 00 00 28 20 20 6f 70 74 73 onParser.new.do.|opts|...(..opts
3000 2e 62 61 6e 6e 65 72 20 3d 20 22 75 73 61 67 65 3a 20 23 7b 24 30 7d 20 5b 6f 70 74 69 6f 6e 73 .banner.=."usage:.#{$0}.[options
3020 5d 22 00 00 00 02 20 20 00 00 00 35 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 61 27 2c 20 27 2d 2d 61 ]".........5..opts.on('-a',.'--a
3040 75 64 69 6f 27 2c 20 27 69 6e 63 6c 75 64 65 20 73 79 73 74 65 6d 20 61 75 64 69 6f 27 29 20 64 udio',.'include.system.audio').d
3060 6f 00 00 00 1a 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 61 75 64 69 6f 5d 20 3d 20 74 72 75 65 00 o........options[:audio].=.true.
3080 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 31 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 6d 27 .....end.........1..opts.on('-m'
30a0 2c 20 27 2d 2d 6d 69 63 27 2c 20 27 69 6e 63 6c 75 64 65 20 6d 69 63 72 6f 70 68 6f 6e 65 27 29 ,.'--mic',.'include.microphone')
30c0 20 64 6f 00 00 00 18 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 6d 69 63 5d 20 3d 20 74 72 75 65 00 .do........options[:mic].=.true.
30e0 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 52 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 66 27 .....end.........R..opts.on('-f'
3100 2c 20 27 2d 2d 66 70 73 20 4e 55 4d 27 2c 20 49 6e 74 65 67 65 72 2c 20 27 73 65 74 20 66 70 73 ,.'--fps.NUM',.Integer,.'set.fps
3120 20 28 64 65 66 61 75 6c 74 3a 20 23 7b 24 64 65 66 61 75 6c 74 5f 66 70 73 7d 29 27 29 20 64 6f .(default:.#{$default_fps})').do
3140 20 7c 66 7c 00 00 00 15 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 66 70 73 5d 20 3d 20 66 00 00 00 .|f|........options[:fps].=.f...
3160 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 3a 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 73 27 2c 20 ...end.........:..opts.on('-s',.
3180 27 2d 2d 73 65 6c 65 63 74 27 2c 20 27 73 65 6c 65 63 74 20 72 65 67 69 6f 6e 20 77 69 74 68 20 '--select',.'select.region.with.
31a0 73 6c 75 72 70 27 29 20 64 6f 00 00 00 1b 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 72 65 67 69 6f slurp').do........options[:regio
31c0 6e 5d 20 3d 20 74 72 75 65 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 51 20 20 6f 70 n].=.true......end.........Q..op
31e0 74 73 2e 6f 6e 28 27 2d 6f 27 2c 20 27 2d 2d 6f 75 74 70 75 74 20 4e 41 4d 45 27 2c 20 53 74 72 ts.on('-o',.'--output.NAME',.Str
3200 69 6e 67 2c 20 27 6f 75 74 70 75 74 20 66 69 6c 65 6e 61 6d 65 20 28 6e 6f 20 65 78 74 65 6e 73 ing,.'output.filename.(no.extens
3220 69 6f 6e 29 27 29 20 64 6f 20 7c 6f 7c 00 00 00 18 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 6f 75 ion)').do.|o|........options[:ou
3240 74 70 75 74 5d 20 3d 20 6f 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 52 20 20 6f 70 tput].=.o......end.........R..op
3260 74 73 2e 6f 6e 28 27 2d 63 27 2c 20 27 2d 2d 63 6f 64 65 63 20 43 4f 44 45 43 27 2c 20 53 74 72 ts.on('-c',.'--codec.CODEC',.Str
3280 69 6e 67 2c 20 27 63 6f 64 65 63 3a 20 6c 69 62 78 32 36 34 2c 20 6c 69 62 78 32 36 35 2c 20 6c ing,.'codec:.libx264,.libx265,.l
32a0 69 62 76 70 39 27 29 20 64 6f 20 7c 63 7c 00 00 00 17 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 63 ibvp9').do.|c|........options[:c
32c0 6f 64 65 63 5d 20 3d 20 63 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 3f 20 20 6f 70 odec].=.c......end.........?..op
32e0 74 73 2e 6f 6e 28 27 2d 64 27 2c 20 27 2d 2d 64 69 72 20 44 49 52 27 2c 20 53 74 72 69 6e 67 2c ts.on('-d',.'--dir.DIR',.String,
3300 20 27 6f 75 74 70 75 74 20 64 69 72 65 63 74 6f 72 79 27 29 20 64 6f 20 7c 64 7c 00 00 00 15 20 .'output.directory').do.|d|.....
3320 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 64 69 72 5d 20 3d 20 64 00 00 00 05 20 20 65 6e 64 00 00 00 ...options[:dir].=.d......end...
3340 02 20 20 00 00 00 60 20 20 6f 70 74 73 2e 6f 6e 28 27 2d 71 27 2c 20 27 2d 2d 71 75 61 6c 69 74 ......`..opts.on('-q',.'--qualit
3360 79 20 4e 55 4d 27 2c 20 49 6e 74 65 67 65 72 2c 20 27 71 75 61 6c 69 74 79 20 31 2d 31 30 30 20 y.NUM',.Integer,.'quality.1-100.
3380 28 64 65 66 61 75 6c 74 3a 20 23 7b 24 64 65 66 61 75 6c 74 5f 71 75 61 6c 69 74 79 7d 29 27 29 (default:.#{$default_quality})')
33a0 20 64 6f 20 7c 71 7c 00 00 00 19 20 20 20 20 6f 70 74 69 6f 6e 73 5b 3a 71 75 61 6c 69 74 79 5d .do.|q|........options[:quality]
33c0 20 3d 20 71 00 00 00 05 20 20 65 6e 64 00 00 00 02 20 20 00 00 00 29 20 20 6f 70 74 73 2e 6f 6e .=.q......end.........)..opts.on
33e0 28 27 2d 68 27 2c 20 27 2d 2d 68 65 6c 70 27 2c 20 27 73 68 6f 77 20 68 65 6c 70 27 29 20 64 6f ('-h',.'--help',.'show.help').do
3400 00 00 00 0d 20 20 20 20 70 75 74 73 20 6f 70 74 73 00 00 00 08 20 20 20 20 65 78 69 74 00 00 00 ........puts.opts........exit...
3420 05 20 20 65 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 05 62 65 67 69 6e 00 00 00 13 20 20 ...end....end........begin......
3440 6f 70 74 5f 70 61 72 73 65 72 2e 70 61 72 73 65 21 00 00 00 27 72 65 73 63 75 65 20 4f 70 74 69 opt_parser.parse!...'rescue.Opti
3460 6f 6e 50 61 72 73 65 72 3a 3a 49 6e 76 61 6c 69 64 4f 70 74 69 6f 6e 20 3d 3e 20 65 00 00 00 1c onParser::InvalidOption.=>.e....
3480 20 20 77 61 72 6e 20 22 65 72 72 6f 72 3a 20 23 7b 65 2e 6d 65 73 73 61 67 65 7d 22 00 00 00 11 ..warn."error:.#{e.message}"....
34a0 20 20 77 61 72 6e 20 6f 70 74 5f 70 61 72 73 65 72 00 00 00 08 20 20 65 78 69 74 20 31 00 00 00 ..warn.opt_parser......exit.1...
34c0 03 65 6e 64 00 00 00 00 00 00 00 12 63 68 65 63 6b 5f 64 65 70 65 6e 64 65 6e 63 69 65 73 00 00 .end........check_dependencies..
34e0 00 00 00 00 00 1b 24 6f 75 74 70 75 74 5f 64 69 72 20 3d 20 6f 70 74 69 6f 6e 73 5b 3a 64 69 72 ......$output_dir.=.options[:dir
3500 5d 00 00 00 11 63 72 65 61 74 65 5f 6f 75 74 70 75 74 5f 64 69 72 00 00 00 00 00 00 00 2e 74 69 ]....create_output_dir........ti
3520 6d 65 73 74 61 6d 70 20 3d 20 54 69 6d 65 2e 6e 6f 77 2e 73 74 72 66 74 69 6d 65 28 27 25 59 25 mestamp.=.Time.now.strftime('%Y%
3540 6d 25 64 5f 25 48 25 4d 25 53 27 29 00 00 00 13 69 66 20 6f 70 74 69 6f 6e 73 5b 3a 6f 75 74 70 m%d_%H%M%S')....if.options[:outp
3560 75 74 5d 00 00 00 53 20 20 6f 75 74 70 75 74 5f 66 69 6c 65 20 3d 20 46 69 6c 65 2e 6a 6f 69 6e ut]...S..output_file.=.File.join
3580 28 24 6f 75 74 70 75 74 5f 64 69 72 2c 20 22 23 7b 6f 70 74 69 6f 6e 73 5b 3a 6f 75 74 70 75 74 ($output_dir,."#{options[:output
35a0 5d 7d 2e 23 7b 24 64 65 66 61 75 6c 74 5f 63 6f 6e 74 61 69 6e 65 72 7d 22 29 00 00 00 04 65 6c ]}.#{$default_container}")....el
35c0 73 65 00 00 00 57 20 20 6f 75 74 70 75 74 5f 66 69 6c 65 20 3d 20 46 69 6c 65 2e 6a 6f 69 6e 28 se...W..output_file.=.File.join(
35e0 24 6f 75 74 70 75 74 5f 64 69 72 2c 20 22 73 63 72 65 65 6e 63 61 73 74 5f 23 7b 74 69 6d 65 73 $output_dir,."screencast_#{times
3600 74 61 6d 70 7d 2e 23 7b 24 64 65 66 61 75 6c 74 5f 63 6f 6e 74 61 69 6e 65 72 7d 22 29 00 00 00 tamp}.#{$default_container}")...
3620 03 65 6e 64 00 00 00 00 00 00 00 0e 67 65 6f 6d 65 74 72 79 20 3d 20 6e 69 6c 00 00 00 13 69 66 .end........geometry.=.nil....if
3640 20 6f 70 74 69 6f 6e 73 5b 3a 72 65 67 69 6f 6e 5d 00 00 00 21 20 20 77 61 72 6e 20 22 73 65 6c .options[:region]...!..warn."sel
3660 65 63 74 20 61 72 65 61 20 74 6f 20 72 65 63 6f 72 64 2e 2e 2e 22 00 00 00 26 20 20 67 65 6f 6d ect.area.to.record..."...&..geom
3680 65 74 72 79 20 3d 20 60 73 6c 75 72 70 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 60 2e 73 74 72 69 70 etry.=.`slurp.2>/dev/null`.strip
36a0 00 00 00 14 20 20 69 66 20 67 65 6f 6d 65 74 72 79 2e 65 6d 70 74 79 3f 00 00 00 24 20 20 20 20 ......if.geometry.empty?...$....
36c0 77 61 72 6e 20 22 65 72 72 6f 72 3a 20 6e 6f 20 72 65 67 69 6f 6e 20 73 65 6c 65 63 74 65 64 22 warn."error:.no.region.selected"
36e0 00 00 00 0a 20 20 20 20 65 78 69 74 20 31 00 00 00 05 20 20 65 6e 64 00 00 00 03 65 6e 64 00 00 ........exit.1......end....end..
3700 00 00 00 00 00 14 63 6d 64 20 3d 20 62 75 69 6c 64 5f 63 6f 6d 6d 61 6e 64 28 00 00 00 0b 20 20 ......cmd.=.build_command(......
3720 67 65 6f 6d 65 74 72 79 2c 00 00 00 10 20 20 6f 70 74 69 6f 6e 73 5b 3a 66 70 73 5d 2c 00 00 00 geometry,......options[:fps],...
3740 12 20 20 6f 70 74 69 6f 6e 73 5b 3a 63 6f 64 65 63 5d 2c 00 00 00 14 20 20 6f 70 74 69 6f 6e 73 ...options[:codec],......options
3760 5b 3a 71 75 61 6c 69 74 79 5d 2c 00 00 00 0e 20 20 6f 75 74 70 75 74 5f 66 69 6c 65 2c 00 00 00 [:quality],......output_file,...
3780 12 20 20 6f 70 74 69 6f 6e 73 5b 3a 61 75 64 69 6f 5d 2c 00 00 00 0f 20 20 6f 70 74 69 6f 6e 73 ...options[:audio],......options
37a0 5b 3a 6d 69 63 5d 00 00 00 01 29 00 00 00 00 00 00 00 1c 77 61 72 6e 20 22 73 74 61 72 74 69 6e [:mic]....)........warn."startin
37c0 67 20 72 65 63 6f 72 64 69 6e 67 2e 2e 2e 22 00 00 00 1d 77 61 72 6e 20 22 6f 75 74 70 75 74 3a g.recording..."....warn."output:
37e0 20 23 7b 6f 75 74 70 75 74 5f 66 69 6c 65 7d 22 00 00 00 56 77 61 72 6e 20 22 66 70 73 3a 20 23 .#{output_file}"...Vwarn."fps:.#
3800 7b 6f 70 74 69 6f 6e 73 5b 3a 66 70 73 5d 7d 2c 20 63 6f 64 65 63 3a 20 23 7b 6f 70 74 69 6f 6e {options[:fps]},.codec:.#{option
3820 73 5b 3a 63 6f 64 65 63 5d 7d 2c 20 71 75 61 6c 69 74 79 3a 20 23 7b 6f 70 74 69 6f 6e 73 5b 3a s[:codec]},.quality:.#{options[:
3840 71 75 61 6c 69 74 79 5d 7d 22 00 00 00 25 77 61 72 6e 20 22 70 72 65 73 73 20 63 74 72 6c 2b 63 quality]}"...%warn."press.ctrl+c
3860 20 74 6f 20 73 74 6f 70 20 72 65 63 6f 72 64 69 6e 67 22 00 00 00 00 00 00 00 09 70 69 64 20 3d .to.stop.recording"........pid.=
3880 20 6e 69 6c 00 00 00 0e 74 72 61 70 28 27 49 4e 54 27 29 20 64 6f 00 00 00 20 20 20 77 61 72 6e .nil....trap('INT').do......warn
38a0 20 22 5c 6e 73 74 6f 70 70 69 6e 67 20 72 65 63 6f 72 64 69 6e 67 2e 2e 2e 22 00 00 00 22 20 20 ."\nstopping.recording..."..."..
38c0 50 72 6f 63 65 73 73 2e 6b 69 6c 6c 28 27 54 45 52 4d 27 2c 20 70 69 64 29 20 69 66 20 70 69 64 Process.kill('TERM',.pid).if.pid
38e0 00 00 00 1a 20 20 50 72 6f 63 65 73 73 2e 77 61 69 74 28 70 69 64 29 20 69 66 20 70 69 64 00 00 ......Process.wait(pid).if.pid..
3900 00 40 20 20 69 66 20 46 69 6c 65 2e 65 78 69 73 74 3f 28 6f 75 74 70 75 74 5f 66 69 6c 65 29 20 .@..if.File.exist?(output_file).
3920 26 26 20 46 69 6c 65 2e 73 69 7a 65 28 6f 75 74 70 75 74 5f 66 69 6c 65 29 20 3e 20 31 30 30 30 &&.File.size(output_file).>.1000
3940 30 30 00 00 00 33 20 20 20 20 73 69 7a 65 5f 6d 62 20 3d 20 46 69 6c 65 2e 73 69 7a 65 28 6f 75 00...3....size_mb.=.File.size(ou
3960 74 70 75 74 5f 66 69 6c 65 29 2e 74 6f 5f 66 20 2f 20 31 30 34 38 35 37 36 00 00 00 4c 20 20 20 tput_file).to_f./.1048576...L...
3980 20 77 61 72 6e 20 22 72 65 63 6f 72 64 69 6e 67 20 73 61 76 65 64 20 74 6f 3a 20 23 7b 6f 75 74 .warn."recording.saved.to:.#{out
39a0 70 75 74 5f 66 69 6c 65 7d 20 28 73 69 7a 65 3a 20 23 7b 27 25 2e 32 66 27 20 25 20 73 69 7a 65 put_file}.(size:.#{'%.2f'.%.size
39c0 5f 6d 62 7d 20 6d 62 29 22 00 00 00 06 20 20 65 6c 73 65 00 00 00 34 20 20 20 20 77 61 72 6e 20 _mb}.mb)"......else...4....warn.
39e0 22 65 72 72 6f 72 3a 20 72 65 63 6f 72 64 69 6e 67 20 66 61 69 6c 65 64 20 6f 72 20 66 69 6c 65 "error:.recording.failed.or.file
3a00 20 74 6f 6f 20 73 6d 61 6c 6c 22 00 00 00 05 20 20 65 6e 64 00 00 00 06 20 20 65 78 69 74 00 00 .too.small"......end......exit..
3a20 00 03 65 6e 64 00 00 00 00 00 00 00 34 73 74 64 69 6e 2c 20 73 74 64 6f 75 74 2c 20 73 74 64 65 ..end.......4stdin,.stdout,.stde
3a40 72 72 2c 20 77 61 69 74 5f 74 68 72 20 3d 20 4f 70 65 6e 33 2e 70 6f 70 65 6e 33 28 2a 63 6d 64 rr,.wait_thr.=.Open3.popen3(*cmd
3a60 29 00 00 00 12 70 69 64 20 3d 20 77 61 69 74 5f 74 68 72 2e 70 69 64 00 00 00 00 00 00 00 27 6f )....pid.=.wait_thr.pid.......'o
3a80 75 74 5f 74 68 72 65 61 64 20 3d 20 54 68 72 65 61 64 2e 6e 65 77 20 7b 20 73 74 64 6f 75 74 2e ut_thread.=.Thread.new.{.stdout.
3aa0 72 65 61 64 20 7d 00 00 00 27 65 72 72 5f 74 68 72 65 61 64 20 3d 20 54 68 72 65 61 64 2e 6e 65 read.}...'err_thread.=.Thread.ne
3ac0 77 20 7b 20 73 74 64 65 72 72 2e 72 65 61 64 20 7d 00 00 00 00 00 00 00 0d 77 61 69 74 5f 74 68 w.{.stderr.read.}........wait_th
3ae0 72 2e 6a 6f 69 6e 00 00 00 00 00 00 00 1d 73 74 64 6f 75 74 5f 73 74 72 20 3d 20 6f 75 74 5f 74 r.join........stdout_str.=.out_t
3b00 68 72 65 61 64 2e 76 61 6c 75 65 00 00 00 1d 73 74 64 65 72 72 5f 73 74 72 20 3d 20 65 72 72 5f hread.value....stderr_str.=.err_
3b20 74 68 72 65 61 64 2e 76 61 6c 75 65 00 00 00 00 00 00 00 59 69 66 20 77 61 69 74 5f 74 68 72 2e thread.value.......Yif.wait_thr.
3b40 76 61 6c 75 65 2e 73 75 63 63 65 73 73 3f 20 26 26 20 46 69 6c 65 2e 65 78 69 73 74 3f 28 6f 75 value.success?.&&.File.exist?(ou
3b60 74 70 75 74 5f 66 69 6c 65 29 20 26 26 20 46 69 6c 65 2e 73 69 7a 65 28 6f 75 74 70 75 74 5f 66 tput_file).&&.File.size(output_f
3b80 69 6c 65 29 20 3e 20 31 30 30 30 30 30 00 00 00 31 20 20 73 69 7a 65 5f 6d 62 20 3d 20 46 69 6c ile).>.100000...1..size_mb.=.Fil
3ba0 65 2e 73 69 7a 65 28 6f 75 74 70 75 74 5f 66 69 6c 65 29 2e 74 6f 5f 66 20 2f 20 31 30 34 38 35 e.size(output_file).to_f./.10485
3bc0 37 36 00 00 00 29 20 20 77 61 72 6e 20 22 72 65 63 6f 72 64 69 6e 67 20 63 6f 6d 70 6c 65 74 65 76...)..warn."recording.complete
3be0 64 20 73 75 63 63 65 73 73 66 75 6c 6c 79 22 00 00 00 1d 20 20 77 61 72 6e 20 22 66 69 6c 65 3a d.successfully"......warn."file:
3c00 20 23 7b 6f 75 74 70 75 74 5f 66 69 6c 65 7d 22 00 00 00 25 20 20 77 61 72 6e 20 22 73 69 7a 65 .#{output_file}"...%..warn."size
3c20 3a 20 23 7b 27 25 2e 32 66 27 20 25 20 73 69 7a 65 5f 6d 62 7d 20 6d 62 22 00 00 00 04 65 6c 73 :.#{'%.2f'.%.size_mb}.mb"....els
3c40 65 00 00 00 20 20 20 77 61 72 6e 20 22 65 72 72 6f 72 3a 20 72 65 63 6f 72 64 69 6e 67 20 66 61 e......warn."error:.recording.fa
3c60 69 6c 65 64 22 00 00 00 2a 20 20 77 61 72 6e 20 73 74 64 65 72 72 5f 73 74 72 20 75 6e 6c 65 73 iled"...*..warn.stderr_str.unles
3c80 73 20 73 74 64 65 72 72 5f 73 74 72 2e 65 6d 70 74 79 3f 00 00 00 08 20 20 65 78 69 74 20 31 00 s.stderr_str.empty?......exit.1.
3ca0 00 00 03 65 6e 64 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 f3 00 00 00 00 00 00 00 01 00 ...end5.........................
3cc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 65 18 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 ..............e...............5.
3ce0 5f d0 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 01 00 00 00 00 00 00 _...............................
3d00 00 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3d20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3d40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3d60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3d80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3da0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3dc0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3de0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3e00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3e20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3e40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................................
3e60 00 00 00 00 69 ff 9e 88 04 01 00 00 00 04 00 f5 18 00 00 00 a6 00 00 00 00 00 00 00 00 00 00 00 ....i...........................
3e80 01 00 00 00 27 20 20 6f 75 74 70 75 74 5f 66 69 6c 65 20 3d 20 46 69 6c 65 2e 6a 6f 69 6e 28 6f ....'..output_file.=.File.join(o
3ea0 75 74 70 75 74 5f 64 69 72 2c 20 22 f5 18 00 00 00 a7 00 00 00 00 00 00 00 00 00 00 00 00 f5 18 utput_dir,."....................
3ec0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 ................................
3ee0 00 00 00 00 00 00 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a6 00 ......5.........................
3f00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 0f 00 00 00 00 00 00 f5 18 ..'.............................
3f20 00 00 00 00 a6 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 3e 00 00 00 03 00 00 00 f9 0f 00 00 ........'...........>...........
3f40 00 00 00 00 00 00 00 00 00 00 00 00 fd 05 00 00 00 00 00 00 35 81 e7 aa ....................5...