Alt+Tab window switcher for Hyprland, written in C with GTK4.
  • C 93.7%
  • CMake 5%
  • Shell 1.3%
Find a file
ika 6f84ed73a3 Focus target window before destroying the popup
Calling hyprctl_focuswindow after gtk_window_destroy is a Wayland
timing hazard: Hyprland may pick a fallback focus target when the popup
surface disappears, racing with the focuswindow dispatch. On a quick
Alt+Tab tap the popup can vanish before Hyprland has given it keyboard
focus, making the race more likely to lose. Swapping the order also
eliminates a potential dangling-pointer read of addr_str, which is freed
as part of the widget teardown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 15:12:57 +02:00
.gdbinit add quick debug 2026-03-20 14:39:59 +01:00
.gitignore Gate hover selection until cursor moves MOUSE_MOVE_DELTA pixels 2026-03-26 11:14:59 +01:00
CLAUDE.md add CLAUDE.md 2026-03-18 14:08:11 +01:00
clean.sh init 2025-04-17 11:02:01 +02:00
CMakeLists.txt Look up app icon from .desktop file with fallback to class name 2026-03-26 09:53:18 +01:00
config.def.h Gate hover selection until cursor moves MOUSE_MOVE_DELTA pixels 2026-03-26 11:14:59 +01:00
debug.sh record windows state 2025-04-24 13:57:23 +02:00
go add CSS 2025-05-20 16:22:11 +02:00
ipc.c Reject blank activewindowv2 events in valid_window 2026-03-27 13:45:05 +01:00
ipc.h Focus window by address instead of title 2026-03-20 11:04:31 +01:00
LICENSE Add BSD 3-Clause license 2026-03-18 14:59:33 +01:00
main.c Focus target window before destroying the popup 2026-04-02 15:12:57 +02:00
README.md update doc 2026-03-18 16:01:16 +01:00
release.sh wip 2025-04-24 17:57:57 +02:00
test_ipc.c Focus window by address instead of title 2026-03-20 11:04:31 +01:00

hyprtab

Alt+Tab window switcher for Hyprland, written in C with GTK4.

How it works

hyprtab runs as a small resident GTK4 window. It listens to Hyprland's IPC event socket to maintain a most-recently-used (MRU) window list. When Alt+Tab is pressed, a popup appears showing all tracked windows with the selection starting at the previous window. Repeated presses cycle forward. Releasing Alt confirms the selection and focuses the chosen window via hyprctl.

Dependencies

  • GTK4
  • Hyprland
  • CMake ≥ 3.10

Build

cp config.def.h config.h   # create your local config (edit as needed)
./debug.sh                  # clean + cmake (Debug) + make
# or
./release.sh                # clean + cmake (Release) + make

The binary is placed in the build directory as hyprtab.

Configuration

Edit config.h before building to customize keybindings:

Define Default Meaning
TAB_STATE GDK_ALT_MASK Modifier required to trigger
TAB_KEYVAL GDK_KEY_Tab Key to cycle windows
TAB_RELEASE_KEYVAL GDK_KEY_Alt_L Key release that confirms selection

Hyprland setup

Add the following to your Hyprland configuration file ~/.config/hypr/hyprland.conf

bind = ALT, Tab, pass, class:fr.kanis.hyprtab

windowrule {
    name = hyprtab-main
    match:class = fr.kanis.hyprtab
    workspace = name:h
    no_initial_focus = true
}

windowrule {
    name = hyprtab-list
    match:title = hyprtab.list
    float = true
}

Then launch hyprtab at startup, for example:

exec-once = /path/to/hyprtab

License

BSD 3-Clause — see LICENSE. Copyright (c) 2026, Ivan Kanis.