💥 fix(ags/media): copy media link to clipboard freezing the whole shell
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { bind, GLib, Process } from "astal";
|
import { bind, execAsync, GLib } from "astal";
|
||||||
import { Gtk, Widget } from "astal/gtk3";
|
import { Gtk, Widget } from "astal/gtk3";
|
||||||
import AstalMpris from "gi://AstalMpris";
|
import AstalMpris from "gi://AstalMpris";
|
||||||
import { Separator, SeparatorProps } from "../Separator";
|
import { Separator, SeparatorProps } from "../Separator";
|
||||||
@@ -35,7 +35,7 @@ export function Media(): Gtk.Widget {
|
|||||||
tooltipText: "Copy link to Clipboard",
|
tooltipText: "Copy link to Clipboard",
|
||||||
visible: bind(players[0], "metadata").as((_metadata: GLib.HashTable) =>
|
visible: bind(players[0], "metadata").as((_metadata: GLib.HashTable) =>
|
||||||
players[0].get_meta("xesam:url") === null),
|
players[0].get_meta("xesam:url") === null),
|
||||||
onClick: () => Process.exec(`wl-copy ${players[0].get_meta("xesam:url")?.get_string()[0]}`)
|
onClick: () => execAsync(`sh -c "wl-copy \\"$(playerctl metadata 'xesam:url')\\""`)
|
||||||
} as Widget.ButtonProps),
|
} as Widget.ButtonProps),
|
||||||
new Widget.Button({
|
new Widget.Button({
|
||||||
className: "previous nf",
|
className: "previous nf",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AstalIO, bind, Binding, GLib, Process, timeout } from "astal";
|
import { AstalIO, bind, Binding, execAsync, GLib, timeout } from "astal";
|
||||||
import { Gtk, Widget } from "astal/gtk3";
|
import { Gtk, Widget } from "astal/gtk3";
|
||||||
import AstalMpris from "gi://AstalMpris";
|
import AstalMpris from "gi://AstalMpris";
|
||||||
|
|
||||||
@@ -51,11 +51,6 @@ export const BigMedia: Gtk.Widget = new Widget.Box({
|
|||||||
hexpand: true,
|
hexpand: true,
|
||||||
visible: bind(players[0], "canSeek"),
|
visible: bind(players[0], "canSeek"),
|
||||||
children: [
|
children: [
|
||||||
/*new Widget.Label({
|
|
||||||
className: "elapsed",
|
|
||||||
label: bind(players[0], "position").as((position: number) =>
|
|
||||||
Math.floor(position).toString())
|
|
||||||
}),*/
|
|
||||||
new Widget.Slider({
|
new Widget.Slider({
|
||||||
min: 0,
|
min: 0,
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
@@ -100,7 +95,7 @@ export const BigMedia: Gtk.Widget = new Widget.Box({
|
|||||||
tooltipText: "Copy link to Clipboard",
|
tooltipText: "Copy link to Clipboard",
|
||||||
visible: bind(players[0], "metadata").as((_meta: GLib.HashTable) =>
|
visible: bind(players[0], "metadata").as((_meta: GLib.HashTable) =>
|
||||||
players[0].get_meta("xesam:url") === null),
|
players[0].get_meta("xesam:url") === null),
|
||||||
onClick: () => Process.exec(`wl-copy ${players[0].get_meta("xesam:url")?.get_string()[0]}`)
|
onClick: () => execAsync(`sh -c "wl-copy \\"$(playerctl metadata 'xesam:url')\\""`)
|
||||||
} as Widget.ButtonProps),
|
} as Widget.ButtonProps),
|
||||||
new Widget.Button({
|
new Widget.Button({
|
||||||
className: "shuffle nf",
|
className: "shuffle nf",
|
||||||
|
|||||||
Reference in New Issue
Block a user