#hyprland #window-manager

app hyprscratch

Scratchpad functionality for Hyprland

15 releases

0.2.6 Feb 16, 2024
0.2.5 Feb 15, 2024
0.2.1 Jan 17, 2024
0.1.50 Dec 10, 2023
0.1.2 Jun 24, 2023

#73 in GUI

Download history 29/week @ 2023-11-02 11/week @ 2023-11-09 8/week @ 2023-11-16 12/week @ 2023-11-23 20/week @ 2023-11-30 53/week @ 2023-12-07 11/week @ 2023-12-14 20/week @ 2023-12-21 3/week @ 2023-12-28 37/week @ 2024-01-04 36/week @ 2024-01-11 11/week @ 2024-01-18 15/week @ 2024-01-25 47/week @ 2024-02-01 121/week @ 2024-02-08 605/week @ 2024-02-15

788 downloads per month

MIT and GPL-3.0-or-later

13KB
258 lines

Hyprscratch

A scratchpad utility for Hyprland

Installation

Using cargo (Make sure ~/.cargo/bin is in $PATH):

cargo install hyprscratch

Usage

In hyprland.conf:

exec-once = ~/.cargo/bin/hyprscratch [OPTIONS]

bind = $MOD, $KEY, exec, ~/.cargo/bin/hyprscratch $WINDOW_TITLE "$HYPRLAND_EXEC_COMMAND" [OPTIONS]

For example:

bind = $mainNod, b, exec, ~/.cargo/bin/hyprscratch btop "[float;size 70% 80%;center] kitty -e btop"

You can use the stack option so that the new scratchpad doesn't hide the old one. If you like stacking scratchpads, there is a command hyprscratch hideall that you can call to hide all scratchpads. If you want a scratchpad to spawn on startup, you can add onstart as an option.

The scratchpads are just floating windows so by default they remain on the workspace they are spawned if not explicitly hidden. To hide them on workspace change add:

exec-once = ~/.cargo/bin/hyprscratch clean

To also hide when losing focus to a non-floating window:

exec-once = ~/.cargo/bin/hyprscratch clean spotless

You can use the shiny option to prevent a specific scratchpad from being cleaned on focus change. It is useful for graphical program where you would want to drag and drop.

In order for the program to funtion properly after making changes to the config, you can use hyprscratch reload to reparse the config without restarting. Adding the shiny option to an existing scratchpad will not work with reload and requires the program to restarted.

Other Relevant information

If you have any issues with windows not spawning, try using hyrscratch get-config to see if your commands are being parsed propery.

To find the title needed for a scratchpad, run hyprctl clients and check the initialTitle field. An incorrect title results in the scratchpad not being hidden and a new one being spawned instead.

If there are multiple scratchpads with the same initial title, the program just grabs the first one it finds.

Scratchpads don't have to be floating. This can also be used to just spawn a specific window, where the binding also hides it or grabs it from another workspace. Non-floating scratchpads don't get cleaned.

If you want a scratchpad centered properly, the center option needs to be last.

The program doesn't use Hyprland's special workspace, it uses workspace 42.

Dependencies

~6–15MB
~167K SLoC