diff --git a/src/application.vala b/src/application.vala index 6e26f15..835ac5a 100644 --- a/src/application.vala +++ b/src/application.vala @@ -7,7 +7,7 @@ namespace Deskcandy { private Gtk.Window window; private Gtk.Window desktop_window; - public BaseCandy candy { get; private set; } + public BaseCandy[] candies { get; private set; } public bool enabled { get; set; } public Application() { @@ -18,12 +18,15 @@ namespace Deskcandy { this.add_action(toggle_enabled); this.set_up_actions(); - this.candy = new XScreensaver(); + this.candies = { new XScreensaver(), new Mpv() }; } private async void initialize_async() { - yield this.candy.initialize(); - initialized(this.candy); + foreach (var candy in this.candies) { + yield candy.initialize(); + } + + initialized(this.candies[1]); } private void on_toggle_enabled() { diff --git a/src/candy/mpv.vala b/src/candy/mpv.vala new file mode 100644 index 0000000..4d3c79b --- /dev/null +++ b/src/candy/mpv.vala @@ -0,0 +1,14 @@ +namespace Deskcandy.Candy { + class Mpv : BaseCandy { + public Mpv() { + } + + public override async void initialize() { + } + + public override Subprocess launch(uint socket_id) throws Error { + message("Launching mpv video..."); + return new Subprocess(SubprocessFlags.NONE, "mpv", @"--wid=$socket_id", "--no-audio", "--video-unscaled=downscale-big", "--video-zoom=20", "/home/vv/Videos/Sprite_Fright_-_Open_Movie_by_Blender_Studio.webm"); + } + } +} diff --git a/src/candy/xscreensaver.vala b/src/candy/xscreensaver.vala index 94ec703..588e1d1 100644 --- a/src/candy/xscreensaver.vala +++ b/src/candy/xscreensaver.vala @@ -11,7 +11,7 @@ namespace Deskcandy.Candy { } public override Subprocess launch(uint socket_id) throws Error { - message("Launching..."); + message("Launching XScreensaver..."); return new Subprocess(SubprocessFlags.NONE, @"$(this.path_dir)/abstractile", "-window-id", socket_id.to_string()); } diff --git a/src/meson.build b/src/meson.build index 5d7e27a..226f352 100644 --- a/src/meson.build +++ b/src/meson.build @@ -4,7 +4,8 @@ deskcandy_sources = [ 'desktop_window.vala', 'application.vala', 'candy/base.vala', - 'candy/xscreensaver.vala' + 'candy/xscreensaver.vala', + 'candy/mpv.vala' ] diff --git a/src/window.ui b/src/window.ui index 0196d6f..cdf26bd 100644 --- a/src/window.ui +++ b/src/window.ui @@ -188,6 +188,7 @@ 100 + 100 1 10 @@ -231,7 +232,6 @@