Last active
March 4, 2026 01:17
-
-
Save caraboides/bd19f961e1475d433ca1ecf91c90f971 to your computer and use it in GitHub Desktop.
Quake-style Toggle for wezterm-gui on Hyprland
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bun | |
| // Quake-style Toggle for wezterm-gui on Hyprland | |
| // Add to your hyprland config: | |
| // bind = $mainMod, Space, exec, ~/.config/hypr/quake_toggle.ts quake | |
| // windowrule = float on, match:class quake | |
| // windowrule = move (cursor_x-(window_w*0.5)) (cursor_y-(window_h*0.5)), match:class quake | |
| // | |
| // or run ./quake_toggle.ts <class> | |
| import { $, spawn } from "bun"; | |
| const className = process.argv[2]; | |
| if (!className) { | |
| console.error("Usage: quake_toggle.ts <class>"); | |
| process.exit(1); | |
| } | |
| // Fenster-Info holen | |
| const clients: any[] = await $`hyprctl clients -j`.json(); | |
| const window = clients.find((c) => c.class === className); | |
| if (!window) { | |
| console.log("start new"); | |
| const proc = spawn(["wezterm-gui","start","--class", className], { | |
| stdout: "ignore", | |
| stderr: "inherit", | |
| detached: true, | |
| }); | |
| proc.unref(); | |
| process.exit(0); | |
| } | |
| const workspace: string = window.workspace?.name ?? false; | |
| const address: string = window.address; | |
| if (workspace === `special:scratch_${className}`) { | |
| console.log("show"); | |
| const activeWsId: number = (await $`hyprctl activeworkspace -j`.json()).id; | |
| clients | |
| .filter((c) => c.workspace?.name === `special:scratch_${className}`) | |
| .map((c) => c.address) | |
| .map( | |
| async (addr) => | |
| await $`hyprctl dispatch movetoworkspace ${activeWsId + ",address:" + addr}`, | |
| ); | |
| } else { | |
| console.log("hide"); | |
| await $`hyprctl dispatch movetoworkspacesilent ${"special:scratch_" + className + ",address:" + address}`; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment