some fix
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
### Text ###
|
### Text ###
|
||||||
|
|
||||||
font = Geist Sans 10
|
font = Geist 10
|
||||||
line_height = 0
|
line_height = 0
|
||||||
markup = full
|
markup = full
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ const program = new Command("handle-screenshot");
|
|||||||
|
|
||||||
const SCREENSHOT_PATH = `/home/ocbwoy3/Pictures/Screenshots`;
|
const SCREENSHOT_PATH = `/home/ocbwoy3/Pictures/Screenshots`;
|
||||||
|
|
||||||
|
// useless
|
||||||
async function transformImage(b: Buffer): Promise<Buffer> {
|
async function transformImage(b: Buffer): Promise<Buffer> {
|
||||||
const image = sharp(b).ensureAlpha();
|
const image = sharp(b).ensureAlpha();
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ async function transformImage(b: Buffer): Promise<Buffer> {
|
|||||||
right: 16
|
right: 16
|
||||||
}).ensureAlpha();
|
}).ensureAlpha();
|
||||||
|
|
||||||
return await maskedImage.png().toBuffer();
|
return await maskedImage.png().toBuffer() as Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
@@ -45,13 +46,13 @@ async function transformImage(b: Buffer): Promise<Buffer> {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
};
|
};
|
||||||
const _BUF = await $`grim -t png -l 0 -g ${selection.stdout.toString().trim()} -`.arrayBuffer();
|
const _BUF = await $`grim -t png -l 0 -g ${selection.stdout.toString().trim()} -`.arrayBuffer();
|
||||||
const BUF = Buffer.from(_BUF);
|
let BUF = Buffer.from(_BUF) as Buffer;
|
||||||
|
|
||||||
const _d = new Date();
|
const _d = new Date();
|
||||||
const FILENAME = `${SCREENSHOT_PATH}/${_d.toISOString()}-${_d.getTime()}.png`
|
const FILENAME = `${SCREENSHOT_PATH}/${_d.toISOString()}-${_d.getTime()}.png`
|
||||||
|
|
||||||
const cb = await transformImage(BUF);
|
// BUF = await transformImage(BUF);
|
||||||
writeFileSync(FILENAME,cb);
|
writeFileSync(FILENAME,BUF);
|
||||||
console.log(FILENAME);
|
console.log(FILENAME);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -63,14 +64,14 @@ async function transformImage(b: Buffer): Promise<Buffer> {
|
|||||||
const selection = await $`hyprctl monitors | awk '/Monitor/{monitor=$2} /focused: yes/{print monitor; exit}'`.nothrow().text();
|
const selection = await $`hyprctl monitors | awk '/Monitor/{monitor=$2} /focused: yes/{print monitor; exit}'`.nothrow().text();
|
||||||
|
|
||||||
const _BUF = await $`grim -t png -l 0 -o ${selection.trim()} -`.arrayBuffer();
|
const _BUF = await $`grim -t png -l 0 -o ${selection.trim()} -`.arrayBuffer();
|
||||||
const BUF = Buffer.from(_BUF);
|
let BUF = Buffer.from(_BUF) as Buffer;
|
||||||
|
|
||||||
const _d = new Date();
|
const _d = new Date();
|
||||||
const FILENAME = `${SCREENSHOT_PATH}/${_d.toISOString()}-${_d.getTime()}.png`
|
const FILENAME = `${SCREENSHOT_PATH}/${_d.toISOString()}-${_d.getTime()}.png`
|
||||||
|
|
||||||
|
// BUF = await transformImage(BUF);
|
||||||
|
writeFileSync(FILENAME,BUF);
|
||||||
console.log(FILENAME)
|
console.log(FILENAME)
|
||||||
const cb = await transformImage(BUF);
|
|
||||||
writeFileSync(FILENAME,cb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user