Record button doesn't open monitor selection popup
Closed this issue · 1 comments
Describe the bug
When clicking on the record button in the dashboard (the one that uses gpu-screen-recorder
) I get these errors:
** (com.github.Aylur.ags:54932): CRITICAL **: 15:18:33.599: layer_surface_get_popup () called when the layer surface wayland object has not yet been created
** (com.github.Aylur.ags:54932): CRITICAL **: 15:18:33.599: xdg_popup_surface_map: assertion 'self->xdg_popup' failed
It worked before fine and at some point it stopped, I don't know the reason.
Manually starting/stopping the script with ./screen_record.sh start DP-1
for example works fine, so I guess the problem indeed comes from the recordingDropdown
component, but was unable to find a solution.
When trying to log the monitors, I get the correct monitor names constantly printing in the console:
...
setup: (self) => {
self.hook(hyprland, () => {
const displays = hyprland.monitors?.map((mon) => {
console.log(mon.name) // log here
return Widget.MenuItem({
label: `Display ${mon.name}`,
on_activate: () => {
App.closeWindow("dashboardmenu");
Utils.execAsync(
`${App.configDir}/services/screen_record.sh start ${mon?.name}`,
).catch((err) => console.error(err));
},
});
...
To Reproduce
Click the record button, nothing happens.
Expected behavior
Click the record button, popup with screen selections (DP-1 and DP-3 in my case) appears. Click one of the menu items and recording starts.
Desktop (please complete the following information):
- Distribution: Arch Linux
- Window Manager/Desktop Environment: Hyprland (non-git)
Additional context
I forked the repo and did some modifications that suit myself, but I haven't touched this component. I tried switching to the the original remote to see if I broke something, but it still doesn't work.
OK, I actually found the problem...
return Widget.Button({
vexpand: true,
tooltip_text: shortcut.tooltip,
class_name: className,
on_primary_click: (_, event) => {
App.closeWindow("dashboardmenu"); // <------- problem here
if (shortcut.command === "settings-dialog") {
App.toggleWindow("settings-dialog");
} else if (shortcut.command === "record") {
if (isRecording.value === true) {
App.closeWindow("dashboardmenu");
return Utils.execAsync(
`${App.configDir}/services/screen_record.sh stop`,
).catch((err) => console.error(err));
} else {
recordingDropdown.popup_at_pointer(event);
}
}
},
child: Widget.Label({
class_name: "button-label txt-icon",
label: shortcut.icon,
}),
});
It closes the dashboard popup, before it opens the screen selection popup. Moving the closeWindow
method solves it:
if (shortcut.command === "settings-dialog") {
App.closeWindow("dashboardmenu");
App.toggleWindow("settings-dialog");
}