triple boot
This commit is contained in:
@@ -53,11 +53,15 @@ const windowcClassFriendyName: {[windowClass: string]: string} = {
|
||||
"steam_app_1690940": "Deltarune"
|
||||
}
|
||||
|
||||
async function getFilename(): Promise<string> {
|
||||
const _d = new Date();
|
||||
async function getWMClass(): Promise<string> {
|
||||
const windowClass = await $`hyprctl activewindow -j`.json();
|
||||
let ic = (windowClass.initialClass && windowcClassFriendyName[windowClass.initialClass]) || windowClass.windowClass || "Hyprland";
|
||||
const isRoblox = windowClass.initialClass === "org.vinegarhq.Sober";
|
||||
return windowClass.initialClass
|
||||
}
|
||||
|
||||
async function getFilename(wmClass?: string): Promise<string> {
|
||||
const _d = new Date();
|
||||
let ic = (wmClass && windowcClassFriendyName[wmClass]) || wmClass || "Hyprland";
|
||||
const isRoblox = wmClass === "org.vinegarhq.Sober";
|
||||
if (isRoblox) {ic = "Roblox"; };
|
||||
const regretevatorState = isRoblox ? getRegretevatorState() : null;
|
||||
if (!!regretevatorState) {ic = "Regretevator";};
|
||||
@@ -118,6 +122,7 @@ async function transformImage(b: Buffer): Promise<Buffer> {
|
||||
.command("selection")
|
||||
.description("Takes a screenshot from selection")
|
||||
.action(async () => {
|
||||
const _C = await getWMClass();
|
||||
const selection = await $`slurp -w 0 -d -b "#cdd6f444"`
|
||||
.nothrow()
|
||||
.quiet();
|
||||
@@ -133,7 +138,7 @@ async function transformImage(b: Buffer): Promise<Buffer> {
|
||||
.trim()} -`.arrayBuffer();
|
||||
let BUF = Buffer.from(_BUF) as Buffer;
|
||||
|
||||
const FILENAME = `${SCREENSHOT_PATH}/${await getFilename()}.png`;
|
||||
const FILENAME = `${SCREENSHOT_PATH}/${await getFilename(_C)}.png`;
|
||||
|
||||
// BUF = await transformImage(BUF);
|
||||
writeFileSync(FILENAME, BUF);
|
||||
@@ -151,11 +156,12 @@ async function transformImage(b: Buffer): Promise<Buffer> {
|
||||
.nothrow()
|
||||
.text();
|
||||
|
||||
const _C = await getWMClass();
|
||||
const _BUF =
|
||||
await $`grim -c -t png -l 0 -o ${selection.trim()} -`.arrayBuffer();
|
||||
let BUF = Buffer.from(_BUF) as Buffer;
|
||||
|
||||
const FILENAME = `${SCREENSHOT_PATH}/${await getFilename()}.png`;
|
||||
const FILENAME = `${SCREENSHOT_PATH}/${await getFilename(_C)}.png`;
|
||||
|
||||
// BUF = await transformImage(BUF);
|
||||
writeFileSync(FILENAME, BUF);
|
||||
|
||||
Reference in New Issue
Block a user