feat(ags binto): add gpu-screen-recorder service
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
dbac899437
commit
3f121e0259
4 changed files with 79 additions and 12 deletions
|
@ -9,7 +9,6 @@
|
|||
inherit (lib) concatStringsSep removePrefix;
|
||||
hyprPkgs = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
||||
|
||||
# TODO: manage this with ags
|
||||
gsr = pkgs.stdenv.mkDerivation {
|
||||
name = "gpu-screen-recorder";
|
||||
version = gpu-screen-recorder-src.rev;
|
||||
|
@ -74,7 +73,6 @@ in {
|
|||
name = "gpu-save-replay";
|
||||
runtimeInputs = [procps];
|
||||
text = ''
|
||||
# TODO: add notif on success
|
||||
pkill --signal SIGUSR1 -f gpu-screen-recorder
|
||||
'';
|
||||
})
|
||||
|
@ -110,11 +108,7 @@ in {
|
|||
];
|
||||
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
bind = [",F8, exec, gpu-save-replay"];
|
||||
|
||||
exec-once = [
|
||||
"sleep 10; tmux new-session -s gsr -d gsr-start"
|
||||
];
|
||||
bind = [",F8, exec, ags -r 'GSR.saveReplay()'"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Pointers from './services/pointers.ts';
|
||||
import Brightness from './services/brightness.ts';
|
||||
import GSR from './services/gpu-screen-recorder.ts';
|
||||
import Pointers from './services/pointers.ts';
|
||||
|
||||
import AppLauncher from './ts/applauncher/main.ts';
|
||||
import Bar from './ts/bar/binto.ts';
|
||||
|
@ -13,10 +14,10 @@ App.config({
|
|||
icons: './icons',
|
||||
|
||||
onConfigParsed: () => {
|
||||
globalThis.Pointers = Pointers;
|
||||
|
||||
Brightness.capsName = 'input30::capslock';
|
||||
globalThis.Brightness = Brightness;
|
||||
globalThis.Pointers = Pointers;
|
||||
globalThis.GSR = GSR;
|
||||
},
|
||||
|
||||
windows: () => [
|
||||
|
|
74
modules/ags/config/services/gpu-screen-recorder.ts
Normal file
74
modules/ags/config/services/gpu-screen-recorder.ts
Normal file
|
@ -0,0 +1,74 @@
|
|||
const { execAsync, subprocess } = Utils;
|
||||
|
||||
const Notifications = await Service.import('notifications');
|
||||
|
||||
const APP_NAME = 'gpu-screen-recorder';
|
||||
const START_APP_ID = 2345;
|
||||
const ICON_NAME = 'nvidia';
|
||||
|
||||
|
||||
class GSR extends Service {
|
||||
static {
|
||||
Service.register(this, {}, {});
|
||||
}
|
||||
|
||||
#appID = START_APP_ID;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
subprocess(
|
||||
['gsr-start'],
|
||||
(path) => {
|
||||
Notifications.getNotification(this.#appID)?.close();
|
||||
|
||||
const notifId = Notifications.Notify(
|
||||
APP_NAME,
|
||||
++this.#appID,
|
||||
ICON_NAME,
|
||||
'Replay Saved',
|
||||
`Saved to ${path}`,
|
||||
['folder', 'Open Folder', 'video', 'Open Video'],
|
||||
{},
|
||||
Notifications.popupTimeout,
|
||||
);
|
||||
|
||||
Notifications.getNotification(notifId)?.connect(
|
||||
'invoked',
|
||||
(_, actionId: string) => {
|
||||
if (actionId === 'folder') {
|
||||
execAsync([
|
||||
'xdg-open',
|
||||
path.substring(0, path.lastIndexOf('/')),
|
||||
]).catch(print);
|
||||
}
|
||||
|
||||
else if (actionId === 'video') {
|
||||
execAsync(['xdg-open', path]).catch(print);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
logError,
|
||||
);
|
||||
}
|
||||
|
||||
saveReplay() {
|
||||
execAsync(['gpu-save-replay']).then(() => {
|
||||
Notifications.Notify(
|
||||
APP_NAME,
|
||||
this.#appID,
|
||||
ICON_NAME,
|
||||
'Saving Replay',
|
||||
'Last 20 minutes',
|
||||
[],
|
||||
{},
|
||||
Notifications.popupTimeout,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const gsrService = new GSR();
|
||||
|
||||
export default gsrService;
|
|
@ -52,8 +52,6 @@ export default () => Box({
|
|||
return;
|
||||
}
|
||||
|
||||
console.log(notif.attribute.hovered);
|
||||
|
||||
// If notif isn't hovered or was closed, slide away
|
||||
if (!notif.attribute.hovered || force) {
|
||||
notif.attribute.slideAway('Left');
|
||||
|
|
Loading…
Reference in a new issue