diff --git a/README.md b/README.md index f3b3f16..4868b9c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ ![](etc/rice_new.png) ![](etc/rice_gentoo.png) - # Keybind reference | Keybind | What it does | -|-----------|----------------------| +| --------- | -------------------- | | `SUPER+Q` | Terminal | | `SUPER+C` | Close current window | | `SUPER+E` | File Manager | @@ -17,50 +16,50 @@ | `SUPER+F` | Fullscreen | | Keybind | What it does | -|--------------------|--------------------| +| ------------------ | ------------------ | | `SUPER+RightArrow` | Move Focus (right) | | `SUPER+LeftArrow` | Move Focus (left) | | `SUPER+DownArrow` | Move Focus (down) | | `SUPER+UpArrow` | Move Focus (up) | -| Keybind | What it does | -|--------------------------|----------------------| -| `SUPER+SHIFT+RightArrow` | Window width +100 | -| `SUPER+SHIFT+LeftArrow` | Window width -100 | -| `SUPER+SHIFT+DownArrow` | Window height +100 | -| `SUPER+SHIFT+UpArrow` | Window height -100 | +| Keybind | What it does | +| ------------------------ | ------------------ | +| `SUPER+SHIFT+RightArrow` | Window width +100 | +| `SUPER+SHIFT+LeftArrow` | Window width -100 | +| `SUPER+SHIFT+DownArrow` | Window height +100 | +| `SUPER+SHIFT+UpArrow` | Window height -100 | | Keybind | What it does | -|-------------------------|-------------------------| +| ----------------------- | ----------------------- | | `SUPER+CTRL+RightArrow` | Swap window pos (right) | | `SUPER+CTRL+LeftArrow` | Swap window pos (left) | | `SUPER+CTRL+UpArrow` | Swap window pos (down) | | `SUPER+CTRL+DownArrow` | Swap window pos (up) | | Mouse Keybind | What it does | -|--------------------|----------------| +| ------------------ | -------------- | | `SUPER+MouseLeft` | Move window | | `SUPER+MouseRight` | Resize window | | `SUPER+ScrollUp` | Next workspace | | `SUPER+ScrollDown` | Prev workspace | | Keybind | What it does | -|---------------------|------------------------------------------| +| ------------------- | ---------------------------------------- | | `SUPER+[0-9]` | Switch to workspace X | | `SUPER+SHIFT+[0-9]` | Move active window to workspace X | | `SUPER+Z` | Special workspace | | `SUPER+SHIFT+Z` | Move current window to special Workspace | -| Keybind | What it does | -|-----------------|------------------------------------------| -| `SUPER+SHIFT+B` | Reload Waybar | -| `CTRL+ALT+DEL` | WLogout | -| `FN+F5` | Prev music track | -| `FN+F6` | Next music track | -| `FN+F7` | Play/Pause music | +| Keybind | What it does | +| --------------- | ---------------- | +| `SUPER+SHIFT+B` | Reload Waybar | +| `CTRL+ALT+DEL` | WLogout | +| `FN+F5` | Prev music track | +| `FN+F6` | Next music track | +| `FN+F7` | Play/Pause music | | Keybind | What it does | -|---------------------|------------------------------------------------------------------------------------------------------------------| +| ------------------- | ---------------------------------------------------------------------------------------------------------------- | | `SUPER+SHIFT+ENTER` | Change wallpaper | | `SUPER+F1` | Hide waybar | | `SUPER+F2` | [Roblox](https://roblox.com) [Roblox](https://sober.vinegarhq.org) [Roblox](https://github.com/ocbwoy3/tuxstrap) | diff --git a/config/fastfetch/config.jsonc b/config/fastfetch/config.jsonc index 9053261..d721e37 100644 --- a/config/fastfetch/config.jsonc +++ b/config/fastfetch/config.jsonc @@ -1,10 +1,10 @@ { "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", "logo": { - "source": "~/.config/fastfetch/ralsei.png" + "source": "~/.config/fastfetch/ralsei.png", }, "display": { - "color": "magenta" + "color": "magenta", }, "modules": [ "break", @@ -12,56 +12,56 @@ { "type": "title", "keyColor": "blue", - "format": "{user-name-colored}{at-symbol-colored}{host-name-colored}" + "format": "{user-name-colored}{at-symbol-colored}{host-name-colored}", }, - + "break", - + { "type": "os", "key": "OS", - "format": "{pretty-name}" - }, + "format": "{pretty-name}", + }, { "type": "kernel", - "format": "Linux 6.17.0-2-cachyos-ralsei-rt-bore-lto" + "format": "Linux 6.17.0-2-cachyos-ralsei-rt-bore-lto", }, // "packages", - + "break", - + "host", "uptime", - + "break", { "type": "cpu", "format": "{cores-logical}x {name} @ {freq-base} {temperature}", - "temp": true + "temp": true, }, { "type": "gpu", "format": "{name} [{type}] {temperature}", - "temp": true + "temp": true, }, "break", "memory", "disk", - + "break", - + { "type": "wm", "key": "WM", - "format": "{pretty-name}" + "format": "{pretty-name}", }, { "type": "shell", "key": "Shell", - "format": "{pretty-name}" + "format": "{pretty-name}", }, "terminal", "locale", @@ -82,19 +82,19 @@ { "type": "media", "key": "Song", - "format": "{artist} — {title}" + "format": "{artist} — {title}", }, { "type": "media", "key": "Album", - "format": "{album}" + "format": "{album}", }, "break", { "type": "colors", - "symbol": "circle" - } - ] + "symbol": "circle", + }, + ], } diff --git a/config/waybar/modules.json b/config/waybar/modules.json index cd860b2..cd59a76 100644 --- a/config/waybar/modules.json +++ b/config/waybar/modules.json @@ -15,7 +15,14 @@ }, "mpris": { - "players": ["chromium", "cmus", "elisa", "cider", "spotify", "OCbwoy3_s_iPhone"], + "players": [ + "chromium", + "cmus", + "elisa", + "cider", + "spotify", + "OCbwoy3_s_iPhone" + ], "interval": 1, "on-scroll-up": "playerctl -p chromium,cmus,elisa,cider,spotify,OCbwoy3_s_iPhone volume 0.05+", "on-scroll-down": "playerctl -p chromium,cmus,elisa,cider,spotify,OCbwoy3_s_iPhone volume 0.05-", @@ -63,7 +70,7 @@ "PORTAL 2 - (OpenGL|Vulkan)": "Portal 2", "HALF-LIFE 2 - (OpenGL|Vulkan)": "Half-Life 2", "(.*) - Google( Search| meklēšana)?": "$1", - + "Cider": "Apple Music", "swappy": "Swappy", "(.*) — (Firefox( Developer Edition)|Zen Browser)?": "$1" diff --git a/config/waybar/style.css b/config/waybar/style.css index 8393cbc..8c2908c 100644 --- a/config/waybar/style.css +++ b/config/waybar/style.css @@ -1,5 +1,5 @@ * { - font-family: 'SF Pro Display', SFProJPDisplay-Regular, 'Symbols Nerd Font'; + font-family: "SF Pro Display", SFProJPDisplay-Regular, "Symbols Nerd Font"; border: none; font-size: 15px; min-height: 10px; @@ -15,28 +15,44 @@ window#waybar { padding: 3px 5px 3px 5px; } -#workspaces, #mpris, #traygroup, #clock, #window, #custom-regretevator_state, #custom-cider { +#workspaces, +#mpris, +#traygroup, +#clock, +#window, +#custom-regretevator_state, +#custom-cider { border-radius: 8px; padding: 2px 5px 2px 5px; border: 2px solid #89b4fa; } #clock { - font-family: "SF Pro Display", SFProJPDisplay-Regular, 'Symbols Nerd Font'; + font-family: "SF Pro Display", SFProJPDisplay-Regular, "Symbols Nerd Font"; } -#traygroup, #mpris, #window, #workspaces, #custom-regretevator_state, #custom-cider { +#traygroup, +#mpris, +#window, +#workspaces, +#custom-regretevator_state, +#custom-cider { background-color: #1e1e2e; padding-left: 5px; padding-right: 5px; color: #b4befe; } -#custom-regretevator_state, #custom-cider { - font-family: 'DotfilesFont', SFProJPDisplay-Regular, 'Symbols Nerd Font', 'Geist'; +#custom-regretevator_state, +#custom-cider { + font-family: + "DotfilesFont", SFProJPDisplay-Regular, "Symbols Nerd Font", "Geist"; } -#mpris, #clock, #window, #custom-cider { +#mpris, +#clock, +#window, +#custom-cider { padding-left: 10px; padding-right: 10px; } @@ -89,13 +105,15 @@ window#waybar { background-color: transparent; } -#network, #bluetooth, #pulseaudio { +#network, +#bluetooth, +#pulseaudio { padding: 0px 5px 0px 5px; margin: 0px 0px 0px 0px; } #pulseaudio.lol { - padding: 0px 5px 0px 2px; + padding: 0px 5px 0px 2px; } #tray > .passive { @@ -103,10 +121,11 @@ window#waybar { } #tray > .needs-attention { - -gtk-icon-effect: highlight; + -gtk-icon-effect: highlight; } -.invisible, #mpris.stopped { +.invisible, +#mpris.stopped { padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; background-color: transparent; @@ -114,7 +133,7 @@ window#waybar { } tooltip { - font-family: 'SF Pro Display', SFProJPDisplay-Regular, 'Symbols Nerd Font'; + font-family: "SF Pro Display", SFProJPDisplay-Regular, "Symbols Nerd Font"; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; border-radius: 4px; @@ -125,7 +144,7 @@ tooltip { } tooltip * { - font-family: 'SF Pro Display', SFProJPDisplay-Regular, 'Symbols Nerd Font'; + font-family: "SF Pro Display", SFProJPDisplay-Regular, "Symbols Nerd Font"; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; color: #cdd6f4; diff --git a/config/wlogout/style.css b/config/wlogout/style.css index 359cbb3..7403671 100644 --- a/config/wlogout/style.css +++ b/config/wlogout/style.css @@ -1,7 +1,7 @@ * { background-image: none; box-shadow: none; - font-family: 'SF Pro Display', 'Symbols Nerd Font'; + font-family: "SF Pro Display", "Symbols Nerd Font"; font-size: 18px; } @@ -35,21 +35,15 @@ button:hover { } #lock { - background-image: image( - url("~/config/config/wlogout/assets/lock.png") - ); + background-image: image(url("~/config/config/wlogout/assets/lock.png")); } #logout { - background-image: image( - url("~/config/config/wlogout/assets/logout.png") - ); + background-image: image(url("~/config/config/wlogout/assets/logout.png")); } #suspend { - background-image: image( - url("~/config/config/wlogout/assets/suspend.png") - ); + background-image: image(url("~/config/config/wlogout/assets/suspend.png")); } #hibernate { @@ -59,13 +53,9 @@ button:hover { } #shutdown { - background-image: image( - url("~/config/config/wlogout/assets/shutdown.png") - ); + background-image: image(url("~/config/config/wlogout/assets/shutdown.png")); } #reboot { - background-image: image( - url("~/config/config/wlogout/assets/reboot.png") - ); + background-image: image(url("~/config/config/wlogout/assets/reboot.png")); } diff --git a/package.json b/package.json index eb0e917..1c6524d 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,21 @@ { - "name": "ocbwoy3s-dotfiles", - "module": "index.ts", - "type": "module", - "private": true, - "devDependencies": { - "@types/bun": "latest" - }, - "peerDependencies": { - "typescript": "^5" - }, - "dependencies": { - "@ocbwoy3/libocbwoy3": "^0.0.5", - "@types/commander": "^2.12.5", - "@types/dotenv": "^8.2.3", - "@types/sharp": "^0.32.0", - "commander": "^13.1.0", - "dotenv": "^16.4.7", - "sharp": "^0.33.5" - } -} \ No newline at end of file + "name": "ocbwoy3s-dotfiles", + "module": "index.ts", + "type": "module", + "private": true, + "devDependencies": { + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5" + }, + "dependencies": { + "@ocbwoy3/libocbwoy3": "^0.0.5", + "@types/commander": "^2.12.5", + "@types/dotenv": "^8.2.3", + "@types/sharp": "^0.32.0", + "commander": "^13.1.0", + "dotenv": "^16.4.7", + "sharp": "^0.33.5" + } +} diff --git a/scripts/bin/actWithMusic.ts b/scripts/bin/actWithMusic.ts index ac43220..b429820 100644 --- a/scripts/bin/actWithMusic.ts +++ b/scripts/bin/actWithMusic.ts @@ -1,49 +1,71 @@ import { $, sleep } from "bun"; -import { albumStuffF, fetchAlbumStuff } from "../lib/CiderV2Playing" +import { albumStuffF, fetchAlbumStuff } from "../lib/CiderV2Playing"; import { execFile } from "child_process"; import { rmSync } from "fs"; let x: albumStuffF | any = false; try { - x = await fetchAlbumStuff() as albumStuffF -} catch { } + x = (await fetchAlbumStuff()) as albumStuffF; +} catch {} -function notifyWithImage(song: string, artUrl: string, artist: string, album: string) { +function notifyWithImage( + song: string, + artUrl: string, + artist: string, + album: string, +) { execFile("dunstify", [ - "-t", (process.argv[3] === "rel" ? "1" : "2000"), - "-r", "67676767", - "-a", "ocbwoy3-whatsplaying", - "-I", artUrl, + "-t", + process.argv[3] === "rel" ? "1" : "2000", + "-r", + "67676767", + "-a", + "ocbwoy3-whatsplaying", + "-I", + artUrl, song, - `${artist}
`//${album !== "" ? `${album}` : ""}` + `${artist}
`, //${album !== "" ? `${album}` : ""}` ]); } -console.log(process.argv[3]) +console.log(process.argv[3]); function notifyBasic(song: string, artist: string, album: string) { execFile("dunstify", [ - "-t", (process.argv[3] === "rel" ? "1" : "2000"), - "-r", "67676767", - "-a", "ocbwoy3-whatsplaying", + "-t", + process.argv[3] === "rel" ? "1" : "2000", + "-r", + "67676767", + "-a", + "ocbwoy3-whatsplaying", song, - `${artist}`//
${album !== "" ? `${album}` : ""}` + `${artist}`, //
${album !== "" ? `${album}` : ""}` ]); } if (process.argv[2] === "waybar") { if (!x) { - process.stdout.write(JSON.stringify({ - class: "hidden" - })) + process.stdout.write( + JSON.stringify({ + class: "hidden", + }), + ); process.exit(0); } const y = x as albumStuffF; - process.stdout.write(JSON.stringify({ - // text: ` ${y.artist} — ${y.song}`.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">"), - text: ` ${y.artist} — ${y.song}`.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">"), - tooltip: `${y.album}`.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">") - })) + process.stdout.write( + JSON.stringify({ + // text: ` ${y.artist} — ${y.song}`.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">"), + text: ` ${y.artist} — ${y.song}` + .replaceAll("&", "&") + .replaceAll("<", "<") + .replaceAll(">", ">"), + tooltip: `${y.album}` + .replaceAll("&", "&") + .replaceAll("<", "<") + .replaceAll(">", ">"), + }), + ); } if (process.argv[2] === "notif") { @@ -55,6 +77,8 @@ if (process.argv[2] === "notif") { notifyWithImage(y.song, y.artUrl, y.artist, y.album); } catch { notifyBasic(y.song, y.artist, y.album); - try { rmSync(y.artUrl); } catch { } + try { + rmSync(y.artUrl); + } catch {} } } diff --git a/scripts/bin/betterSplash.ts b/scripts/bin/betterSplash.ts index 87b6332..9b36328 100644 --- a/scripts/bin/betterSplash.ts +++ b/scripts/bin/betterSplash.ts @@ -5,7 +5,7 @@ import { execSync } from "child_process"; const birthday = new Date(2009, 7, 16); const age = Math.floor( - (Date.now() - birthday.getTime()) / (1000 * 60 * 60 * 24 * 365) + (Date.now() - birthday.getTime()) / (1000 * 60 * 60 * 24 * 365), ); const isBirthday = @@ -37,14 +37,11 @@ function chooseRandom(array: string[]): string { return array[index]; } -const splashes = [ - "大好きラルセイ", - "ハイパーランド" -]; +const splashes = ["大好きラルセイ", "ハイパーランド"]; const debug: boolean = true as false | true; -const welcome = "ハイパーランド へようこそ!" // "Sveicināti Hyprland!" +const welcome = "ハイパーランド へようこそ!"; // "Sveicināti Hyprland!" if (debug === true) { splashes.forEach(async (a) => { diff --git a/scripts/bin/handleScreenshot.ts b/scripts/bin/handleScreenshot.ts index ffc6012..efcb00f 100755 --- a/scripts/bin/handleScreenshot.ts +++ b/scripts/bin/handleScreenshot.ts @@ -48,24 +48,29 @@ import { getRegretevatorState } from "../lib/RegretevatorUtil"; */ -const windowClassFriendyName: {[windowClass: string]: string} = { - "steam_app_1671210": "Deltarune", +const windowClassFriendyName: { [windowClass: string]: string } = { + steam_app_1671210: "Deltarune", "org.vinegarhq.Sober": "Roblox", - "steam_app_1690940": "Deltarune", // demo -} + steam_app_1690940: "Deltarune", // demo +}; async function getWMClass(): Promise { const windowClass = await $`hyprctl activewindow -j`.json(); - return windowClass.initialClass + return windowClass.initialClass; } async function getFilename(wmClass?: string): Promise { const _d = new Date(); - let ic = (wmClass && windowClassFriendyName[wmClass]) || wmClass || "Hyprland"; + let ic = + (wmClass && windowClassFriendyName[wmClass]) || wmClass || "Hyprland"; const isRoblox = wmClass === "org.vinegarhq.Sober"; - if (isRoblox) {ic = "Roblox"; }; + if (isRoblox) { + ic = "Roblox"; + } const regretevatorState = isRoblox ? getRegretevatorState() : null; - if (!!regretevatorState) {ic = "Regretevator";}; + if (!!regretevatorState) { + ic = "Regretevator"; + } // console.log(isRoblox, regretevatorState) return `${ic}-${_d.getTime()}${ !regretevatorState @@ -74,7 +79,7 @@ async function getFilename(wmClass?: string): Promise { regretevatorState.state === "INGAME" ? `-${regretevatorState.floor}` : "" - }` + }` }`; } @@ -115,7 +120,7 @@ async function transformImage(b: Buffer): Promise { return (await maskedImage.png().toBuffer()) as Buffer; */ - return b + return b; } (() => { diff --git a/scripts/bin/musicTest.ts b/scripts/bin/musicTest.ts index ebdf795..5e5fed4 100644 --- a/scripts/bin/musicTest.ts +++ b/scripts/bin/musicTest.ts @@ -5,23 +5,31 @@ import { existsSync, readFileSync, writeFileSync } from "fs"; setConsoleTitle("Music Test"); try { - const artUrl = await $`playerctl -s -p cider,chromium,OCbwoy3_s_iPhone metadata mpris:artUrl`.text(); - const title = await $`playerctl -s -p cider,chromium,OCbwoy3_s_iPhone metadata title`.text(); - const artist = await $`playerctl -s -p cider,chromium,OCbwoy3_s_iPhone metadata artist`.text(); - const album = await $`playerctl -s -p cider,chromium,OCbwoy3_s_iPhone metadata album`.text(); - + const artUrl = + await $`playerctl -s -p cider,chromium,OCbwoy3_s_iPhone metadata mpris:artUrl`.text(); + const title = + await $`playerctl -s -p cider,chromium,OCbwoy3_s_iPhone metadata title`.text(); + const artist = + await $`playerctl -s -p cider,chromium,OCbwoy3_s_iPhone metadata artist`.text(); + const album = + await $`playerctl -s -p cider,chromium,OCbwoy3_s_iPhone metadata album`.text(); const MT = `${artist.trim()},${album.trim()}`; - if (!existsSync("/tmp/.musictest-info") || readFileSync("/tmp/.musictest-info").toString("utf-8") !== MT) { - writeFileSync("/tmp/.musictest-info",MT) - - const x = await fetch(artUrl.trim()) - writeFileSync("/tmp/.musictest",await x.bytes()) + if ( + !existsSync("/tmp/.musictest-info") || + readFileSync("/tmp/.musictest-info").toString("utf-8") !== MT + ) { + writeFileSync("/tmp/.musictest-info", MT); + + const x = await fetch(artUrl.trim()); + writeFileSync("/tmp/.musictest", await x.bytes()); } - $`notify-send ${title.trim()} ${artist.trim()} -i /tmp/.musictest`.nothrow().catch(a => { }); + $`notify-send ${title.trim()} ${artist.trim()} -i /tmp/.musictest` + .nothrow() + .catch((a) => {}); } catch (e_) { - console.error(e_) - $`notify-send "music test" "lol"`.nothrow().catch(a => { }); + console.error(e_); + $`notify-send "music test" "lol"`.nothrow().catch((a) => {}); } diff --git a/scripts/bin/patchInternalRobloxStudio.ts b/scripts/bin/patchInternalRobloxStudio.ts index 21b922f..1e40e6a 100644 --- a/scripts/bin/patchInternalRobloxStudio.ts +++ b/scripts/bin/patchInternalRobloxStudio.ts @@ -6,16 +6,16 @@ import { setConsoleTitle } from "@ocbwoy3/libocbwoy3"; setConsoleTitle("Roblox Studio patcher"); const SIGNATURE = Buffer.from([ - 0x48, 0x81, 0xEC, 0x40, 0x03, 0x00, 0x00, 0x84, 0xD2, 0x74, 0x05, 0xE8 + 0x48, 0x81, 0xec, 0x40, 0x03, 0x00, 0x00, 0x84, 0xd2, 0x74, 0x05, 0xe8, ]); const PATCH = Buffer.from([ - 0x48, 0x81, 0xEC, 0x40, 0x03, 0x00, 0x00, 0x84, 0xD2, 0x90, 0x90, 0xE8 + 0x48, 0x81, 0xec, 0x40, 0x03, 0x00, 0x00, 0x84, 0xd2, 0x90, 0x90, 0xe8, ]); const baseDir = path.join( os.homedir(), - ".var/app/org.vinegarhq.Vinegar/data/vinegar/versions" + ".var/app/org.vinegarhq.Vinegar/data/vinegar/versions", ); function findSignature(buffer: Buffer, signature: Buffer): number { @@ -40,18 +40,25 @@ async function patchFile(folder: string) { try { binary = await fs.readFile(exePath); } catch (err) { - console.error(`[ERROR] Could not read ${exePath}/RobloxStudioBeta.exe:`, err); + console.error( + `[ERROR] Could not read ${exePath}/RobloxStudioBeta.exe:`, + err, + ); return; } if (findSignature(binary, PATCH)) { - console.log(`[SKIP] ${folder}/RobloxStudioBeta.exe has already been patched`); + console.log( + `[SKIP] ${folder}/RobloxStudioBeta.exe has already been patched`, + ); return; } const offset = findSignature(binary, SIGNATURE); if (offset === -1) { - console.error(`[FAIL] Signature not found in ${exePath}/RobloxStudioBeta.exe`); + console.error( + `[FAIL] Signature not found in ${exePath}/RobloxStudioBeta.exe`, + ); return; } @@ -85,7 +92,7 @@ async function main() { const start = Date.now(); await Promise.all(folders.map(patchFile)); console.log( - `[DONE] Patched internal Roblox Studio in ${Date.now() - start}ms` + `[DONE] Patched internal Roblox Studio in ${Date.now() - start}ms`, ); } diff --git a/scripts/bin/r2Upload.ts b/scripts/bin/r2Upload.ts index 9953e3f..f590939 100644 --- a/scripts/bin/r2Upload.ts +++ b/scripts/bin/r2Upload.ts @@ -11,18 +11,20 @@ setConsoleTitle("Screenshot Uploader"); try { const start = Date.now(); - $`notify-send -t 1000 "Screenshot" "Uploading.."`.nothrow().catch(a => { }); + $`notify-send -t 1000 "Screenshot" "Uploading.."` + .nothrow() + .catch((a) => {}); configDotenv({ - path: `${homedir()}/.ocbwoy3-dotfiles-SECRET-DO-NOT-TOUCH.env` + path: `${homedir()}/.ocbwoy3-dotfiles-SECRET-DO-NOT-TOUCH.env`, }); const screenshotsDir = join(homedir(), "Pictures", "Screenshots"); const files = readdirSync(screenshotsDir); let latestFile = files - .map(file => ({ + .map((file) => ({ file, - time: statSync(join(screenshotsDir, file)).mtime.getTime() + time: statSync(join(screenshotsDir, file)).mtime.getTime(), })) .sort((a, b) => b.time - a.time)[0].file; @@ -31,8 +33,9 @@ try { const url = await UploadToEZ(readFileSync(filePath)); execSync(`echo "${url}" | wl-copy -n`); - execSync(`notify-send "Ekrānuzņēmums" "Attēls augšuplādēts e-z.host ${Date.now() - start}ms"`); + execSync( + `notify-send "Ekrānuzņēmums" "Attēls augšuplādēts e-z.host ${Date.now() - start}ms"`, + ); } catch (e_) { execSync(`notify-send "Error" "${`${e_}`}"`); } - diff --git a/scripts/lib/CiderV2Playing.ts b/scripts/lib/CiderV2Playing.ts index d4c9b8d..e542fda 100644 --- a/scripts/lib/CiderV2Playing.ts +++ b/scripts/lib/CiderV2Playing.ts @@ -50,60 +50,61 @@ export type CiderNowPlaying = { [key: string]: any; }; - // cachedAlbumArt = /tmp/.ocbwoy3-ciderv2lib-md5(isrc+albumName).jpg export type albumStuffF = { - artist: string, - album: string, - song: string, - artUrl?: string -} + artist: string; + album: string; + song: string; + artUrl?: string; +}; -export const albumRewriteRegexes: { a: RegExp, b: string | false }[] = [ +export const albumRewriteRegexes: { a: RegExp; b: string | false }[] = [ { a: / \(Original( (Video )?Game)? Soundtrack.*\)$/i, - b: "" + b: "", }, { a: / - Single$/i, - b: false + b: false, }, { a: / Soundtrack$/i, - b: "" + b: "", }, { a: /^(DELTARUNE|Deltarune) (chapter|chapters) /i, - b: "Deltarune $2 " + b: "Deltarune $2 ", }, { a: / - EP$/i, - b: "" + b: "", }, { a: /^regretevator$/i, - b: false + b: false, }, -] +]; export function doRewritesRn(t: string) { let m = t; for (const x of albumRewriteRegexes) { if (x.a.test(m)) { if (x.b === false) return ""; - m = m.replace(x.a,x.b); + m = m.replace(x.a, x.b); } } return m; } export async function fetchAlbumStuff(): Promise { - const d = await fetch("http://localhost:10767/api/v1/playback/now-playing?token=z"); + const d = await fetch( + "http://localhost:10767/api/v1/playback/now-playing?token=z", + ); // console.log(d.status, d.statusText, await d.text()) const { info }: CiderNowPlaying = await d.json(); const special = MD5.hash(info.isrc + info.albumName, "hex"); - const path = `/tmp/.ocbwoy3-ciderv2lib-md5-${special}.jpg` + const path = `/tmp/.ocbwoy3-ciderv2lib-md5-${special}.jpg`; // console.log(existsSync(path), `hyprctl dispatch exec ${`wget -q --unlink -O ${path} ${info.artwork.url}`}`); @@ -116,15 +117,15 @@ export async function fetchAlbumStuff(): Promise { writeFileSync(path, data); // writeFileSync(path,await ct.body?.pipeTo) } catch { - rmSync(path) + rmSync(path); } } return { artist: info.artistName, album: doRewritesRn(info.albumName), song: info.name, - artUrl: existsSync(path) ? path : undefined - } + artUrl: existsSync(path) ? path : undefined, + }; } // await fetchAlbumStuff(); diff --git a/scripts/lib/EZUploader.ts b/scripts/lib/EZUploader.ts index 0b4ea49..def9743 100644 --- a/scripts/lib/EZUploader.ts +++ b/scripts/lib/EZUploader.ts @@ -10,7 +10,9 @@ const API_URL = "https://api.e-z.host/files"; */ export async function UploadToEZ(content: Buffer): Promise { if (!process.env.EZ_API_KEY) { - throw new Error(`Missing EZ_API_KEY, make sure you're loading the env from ${homedir()}/.ocbwoy3-dotfiles-SECRET-DO-NOT-TOUCH.env!`) + throw new Error( + `Missing EZ_API_KEY, make sure you're loading the env from ${homedir()}/.ocbwoy3-dotfiles-SECRET-DO-NOT-TOUCH.env!`, + ); } if (!(content[0] === 0x89 && content[1] === 0x50 && content[2] === 0x4e)) { @@ -21,7 +23,7 @@ export async function UploadToEZ(content: Buffer): Promise { form.append( "file", new Blob([content as any], { type: "image/png" }), - "screenshot.png" + "screenshot.png", ); const res = await fetch(API_URL, { @@ -34,7 +36,7 @@ export async function UploadToEZ(content: Buffer): Promise { if (!res.ok) { throw new Error( - `Upload failed with status ${res.status}: ${await res.text()}` + `Upload failed with status ${res.status}: ${await res.text()}`, ); } diff --git a/scripts/lib/RegretevatorUtil.ts b/scripts/lib/RegretevatorUtil.ts index 6c88d06..6d21d29 100644 --- a/scripts/lib/RegretevatorUtil.ts +++ b/scripts/lib/RegretevatorUtil.ts @@ -24,26 +24,28 @@ export type RegretevatorState = DeadUnknownState | InElevatorState; export function getRegretevatorState(): null | RegretevatorState { if (!existsSync(STATE_FILE_PATH)) return null; try { - const {text, tooltip}: { text: string, tooltip: string } = JSON.parse(readFileSync(STATE_FILE_PATH).toString('utf-8')) + const { text, tooltip }: { text: string; tooltip: string } = JSON.parse( + readFileSync(STATE_FILE_PATH).toString("utf-8"), + ); if (/^On Floor ([0-9]+)$/.test(tooltip)) { - const floorNum = tooltip.match(/^On Floor ([0-9]+)$/)![1] + const floorNum = tooltip.match(/^On Floor ([0-9]+)$/)![1]; return { floor: Number(floorNum), state: "INGAME", - isGoingUp: false - } + isGoingUp: false, + }; } if (/^Floor ([0-9]+)/.test(tooltip)) { - const floorNum = tooltip.match(/^Floor ([0-9]+)/)![1] + const floorNum = tooltip.match(/^Floor ([0-9]+)/)![1]; return { floor: Number(floorNum), state: "INGAME", - isGoingUp: true - } + isGoingUp: true, + }; } return { - state: "UNKNOWN" - } + state: "UNKNOWN", + }; } catch {} return null; } diff --git a/tsconfig.json b/tsconfig.json index f922565..4742aab 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,27 +1,27 @@ { - "compilerOptions": { - // Enable latest features - "lib": ["ESNext", "DOM"], - "target": "ESNext", - "module": "ESNext", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": false, - "noEmit": true, + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": false, + "noEmit": true, - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } }