mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2024-11-23 17:13:11 +03:00
enable recording of window or screen
This commit is contained in:
parent
5f079b86f4
commit
75df858dbe
@ -32,6 +32,7 @@ pub struct Ffmpeg {
|
|||||||
pub unbound: Option<Sender<bool>>,
|
pub unbound: Option<Sender<bool>>,
|
||||||
pub window: Window,
|
pub window: Window,
|
||||||
pub record_wayland: WaylandRecorder,
|
pub record_wayland: WaylandRecorder,
|
||||||
|
pub record_window: Rc<RefCell<bool>>,
|
||||||
pub main_context: gtk::glib::MainContext,
|
pub main_context: gtk::glib::MainContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +146,11 @@ impl Ffmpeg {
|
|||||||
"{}.temp.without.audio.webm",
|
"{}.temp.without.audio.webm",
|
||||||
self.saved_filename.as_ref().unwrap()
|
self.saved_filename.as_ref().unwrap()
|
||||||
),
|
),
|
||||||
RecordTypes::Monitor,
|
if self.record_window.take() {
|
||||||
|
RecordTypes::Window
|
||||||
|
} else {
|
||||||
|
RecordTypes::Monitor
|
||||||
|
},
|
||||||
{
|
{
|
||||||
if self.record_mouse.is_active() {
|
if self.record_mouse.is_active() {
|
||||||
CursorModeTypes::Show
|
CursorModeTypes::Show
|
||||||
|
18
src/main.rs
18
src/main.rs
@ -436,16 +436,25 @@ pub fn build_ui(application: &Application) {
|
|||||||
|
|
||||||
let _area_chooser_window = area_chooser_window.clone();
|
let _area_chooser_window = area_chooser_window.clone();
|
||||||
let mut _area_capture = area_capture.clone();
|
let mut _area_capture = area_capture.clone();
|
||||||
|
let record_window: Rc<RefCell<bool>> = Rc::new(RefCell::new(false));
|
||||||
|
let _record_window: Rc<RefCell<bool>> = record_window.clone();
|
||||||
|
let __record_window: Rc<RefCell<bool>> = record_window.clone();
|
||||||
|
|
||||||
screen_grab_button.connect_clicked(move |_| {
|
screen_grab_button.connect_clicked(move |_| {
|
||||||
|
__record_window.swap(&RefCell::new(false));
|
||||||
_area_chooser_window.hide();
|
_area_chooser_window.hide();
|
||||||
_area_capture.borrow_mut().reset();
|
_area_capture.borrow_mut().reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
let _area_chooser_window = area_chooser_window.clone();
|
let _area_chooser_window: Window = area_chooser_window.clone();
|
||||||
let mut _area_capture = area_capture.clone();
|
let mut _area_capture: Rc<RefCell<area_capture::AreaCapture>> = area_capture.clone();
|
||||||
window_grab_button.connect_clicked(move |_| {
|
window_grab_button.connect_clicked(move |_| {
|
||||||
_area_chooser_window.hide();
|
_area_chooser_window.hide();
|
||||||
_area_capture.borrow_mut().get_area();
|
if is_wayland() {
|
||||||
|
record_window.swap(&RefCell::new(true));
|
||||||
|
} else {
|
||||||
|
_area_capture.borrow_mut().get_area();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let _delay_spin = delay_spin.clone();
|
let _delay_spin = delay_spin.clone();
|
||||||
@ -473,7 +482,8 @@ pub fn build_ui(application: &Application) {
|
|||||||
window: main_window.clone(),
|
window: main_window.clone(),
|
||||||
record_delay: delay_spin,
|
record_delay: delay_spin,
|
||||||
record_wayland: wayland_record,
|
record_wayland: wayland_record,
|
||||||
main_context: main_context,
|
record_window: _record_window,
|
||||||
|
main_context,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Record Button
|
// Record Button
|
||||||
|
@ -223,17 +223,4 @@ impl WaylandRecorder {
|
|||||||
println!("Recording Wayland screen cast...");
|
println!("Recording Wayland screen cast...");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[async_std::main]
|
|
||||||
// async fn main() -> Result<()> {
|
|
||||||
// let mut recorder = WaylandRecorder::new().await;
|
|
||||||
// recorder.start(RecordTypes::Monitor, CursorModeTypes::Show).await?;
|
|
||||||
|
|
||||||
// // wait for user input to stop recording
|
|
||||||
// let mut input = String::new();
|
|
||||||
// std::io::stdin().read_line(&mut input).unwrap();
|
|
||||||
|
|
||||||
// recorder.stop();
|
|
||||||
// Ok(())
|
|
||||||
// }
|
|
Loading…
Reference in New Issue
Block a user