Add another candy! mpv.

This commit is contained in:
Vivianne 2022-03-18 02:50:34 -07:00
parent 00995b6d4c
commit a86a634f47
5 changed files with 92 additions and 47 deletions

View file

@ -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() {

14
src/candy/mpv.vala Normal file
View file

@ -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");
}
}
}

View file

@ -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());
}

View file

@ -4,7 +4,8 @@ deskcandy_sources = [
'desktop_window.vala',
'application.vala',
'candy/base.vala',
'candy/xscreensaver.vala'
'candy/xscreensaver.vala',
'candy/mpv.vala'
]

View file

@ -188,6 +188,7 @@
</object>
<object class="GtkAdjustment" id="opacity_adjustment">
<property name="upper">100</property>
<property name="value">100</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
@ -231,7 +232,6 @@
</mime-types>
</object>
<template class="DeskcandyWindow" parent="GtkApplicationWindow">
<property name="visible">False</property>
<property name="can-focus">False</property>
<property name="border-width">5</property>
<property name="window-position">center</property>
@ -619,7 +619,7 @@
<property name="adjustment">opacity_adjustment</property>
<property name="round-digits">1</property>
<property name="digits">0</property>
<property name="value-pos">right</property>
<property name="value-pos">left</property>
</object>
<packing>
<property name="expand">True</property>
@ -635,12 +635,74 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="low_priority_check">
<property name="label" translatable="yes">Low Priority</property>
<object class="GtkExpander">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="border-width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkCheckButton" id="low_priority_check">
<property name="label" translatable="yes">Low CPU Priority</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Extra Options</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="extra_options">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Advanced</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -648,41 +710,6 @@
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Extra Options</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="extra_options">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>