Commit Graph
188 Commits
Author SHA1 Message Date
Alex 30dcd7a7ca fix(hyprland/workspaces): own debounce timer on main thread, fix UAF
The debounce timer added for flicker prevention was armed from the IPC
listener thread via Glib::signal_timeout().connect(), while its timeout
lambda and the m_updatePending flag ran on the GTK main thread — an
unsynchronized cross-thread data race on GLib timer/main-loop state.
Additionally ~Workspaces() never disconnected the timer, so a pending
timeout could fire on a freed 'this' (use-after-free).

Restore the pre-refactor threading model: onEvent now only mutates state
under m_mutex on the IPC thread and calls dp.emit() (Glib::Dispatcher is
thread-safe). The debounce timer is owned entirely by the main-thread
update() path, which arms/re-arms it on each dispatch and coalesces
bursts into a single refresh. ~Workspaces() disconnects the timer
(guarded) so none outlives the object. Debounce behavior is preserved.
2026-07-05 10:13:24 +02:00
Alexis Rouillard 37dbd59dac Merge pull request #3017 from 0x000C0A71/master
[hyprland/workspaces] Add tooltips to hyprland/workspaces
2026-07-04 01:12:10 +02:00
Alexis Rouillard 78b9a38532 Merge pull request #4320 from LoricAndre/master
feat(hyprland/workspaces): add uniqueIcons option
2026-07-04 01:12:05 +02:00
Alex 8276f6a629 Merge remote-tracking branch 'origin/master' into pr-3017
# Conflicts:
#	include/modules/hyprland/workspaces.hpp
#	man/waybar-hyprland-workspaces.5.scd
#	src/modules/hyprland/workspaces.cpp
2026-07-04 00:55:38 +02:00
Alexis Rouillard 24dba2bb24 Merge pull request #4694 from whymusticode/max-icons
feat(hyprland/workspaces): add deduplication and max-icons option to workspace-taskbar
2026-07-04 00:55:34 +02:00
Alex 05f32172df Merge remote-tracking branch 'origin/master' into pr-4320
# Conflicts:
#	include/modules/hyprland/workspaces.hpp
#	man/waybar-hyprland-workspaces.5.scd
#	src/modules/hyprland/workspace.cpp
#	src/modules/hyprland/workspaces.cpp
2026-07-04 00:51:21 +02:00
Alexis Rouillard 3cd93d849f Merge pull request #5032 from yyyumeniku/master
hyprland/workspaces: add debounce timer to prevent workspace button f…
2026-07-04 00:42:04 +02:00
Alex 08e457e3cd Merge remote-tracking branch 'origin/master' into pr-4694
# Conflicts:
#	src/modules/hyprland/workspace.cpp
2026-07-04 00:41:50 +02:00
Alexis Rouillard a3101a1ca0 Merge branch 'master' into feat-hyprland-submap-icon-handling 2026-07-04 00:32:12 +02:00
Alexis Rouillard 423ca224f5 Merge branch 'master' into master 2026-07-04 00:32:08 +02:00
Alex e792ed8f85 Merge remote-tracking branch 'origin/master' into pr-4861
# Conflicts:
#	src/modules/hyprland/workspace.cpp
2026-07-03 23:51:19 +02:00
Alexis Rouillard 2f6720c053 Merge pull request #4981 from xiyori/max-windows
Add max-windows option to hyprland/workspaces
2026-07-03 22:58:37 +02:00
Alexis Rouillard 8c4787bd88 Merge pull request #4529 from dimti/hyprland-language-class
Add css class to hyprland language module of short_name language code
2026-07-03 22:58:31 +02:00
Alexis Rouillard 3033e15868 Merge pull request #4958 from v-dermichev/feature/workspace-name-css-class
feat (hyprland/workspaces): expose workspace name as CSS class
2026-07-03 22:52:06 +02:00
Alexis Rouillard 5ff20943a9 Merge branch 'master' into hide-active 2026-07-03 22:22:24 +02:00
Alexis Rouillard 93db40b829 Merge branch 'master' into master 2026-07-03 22:22:21 +02:00
Alexis Rouillard 4700f2b423 Merge branch 'master' into max-windows 2026-07-03 22:22:16 +02:00
Alexis Rouillard 8ec7bd0939 Merge branch 'master' into hyprland-language-class 2026-07-03 22:22:11 +02:00
Alexis Rouillard 57689fe96b Merge branch 'master' into feature/workspace-name-css-class 2026-07-03 22:21:54 +02:00
Alex dc017d8fd3 fix(hyprland/workspaces): disconnect hover-check timeout on Workspace destruction
The hover-check Glib::signal_timeout re-arms every 50ms and is not owned by
the Workspace. Since Workspaces are destroyed at runtime, a workspace removed
while its check is armed would let the timeout fire on freed memory (use-after-
free, also touching the destroyed m_button). Add a destructor that calls
stopHoverCheck() to disconnect the source.
2026-07-03 21:32:55 +02:00
Adam Druzd ff76e96786 fix(hyprland): keep workspace hover over taskbar icons 2026-05-17 09:12:08 +02:00
yyyumeniku 2a05edaf6a hyprland/workspaces: add debounce timer to prevent workspace button flicker
When switching between workspaces rapidly (especially empty ones),
Hyprland sends createworkspace and destroyworkspace events slightly
out of order. This causes workspace buttons to render in wrong
positions for a split second before snapping to their correct spots.

Add a 7ms debounce timer that batches workspace events before
calling dp.emit(), preventing the visual glitch.

Fixes #4376
2026-05-12 20:09:13 -04:00
Higor Prado 97917db593 test(hyprland): expose dispatch internals for unit tests
Move buildLuaDispatch and isLuaProtocol from private to
protected/public so IPCTestHelper can access them.

Add 7 tests covering all buildLuaDispatch branches, dispatch
error path, and isLuaProtocol cache behavior.
2026-05-02 20:25:43 -03:00
Higor Prado e17c0d9f0a fix(hyprland/workspaces): adapt dispatch commands for Lua IPC protocol
Hyprland 0.54 replaced the text-based dispatch socket protocol with a
Lua-based one. Commands like "dispatch workspace 1" are now interpreted
as invalid Lua (return hl.dispatch(workspace 1)), breaking workspace
clicks and scroll navigation.

Add IPC::dispatch() that probes the running Hyprland on first call and
routes commands through the new hl.dsp Lua API when the Lua protocol is
detected, falling back to the old text format otherwise.
2026-04-29 16:41:11 -03:00
xiyori 503d99b128 Add max-windows option to hyprland/workspaces 2026-04-09 14:15:56 +03:00
vdermichev 2c2901e8f7 hyprland/workspaces: expose workspace name as CSS class
Enable per-workspace styling by adding the workspace name as a
CSS class to each workspace button. The name is sanitized to a
valid CSS identifier: lowercased, non-alphanumeric characters
collapsed to hyphens, digit-leading names prefixed with "ws-".

Examples: "IDE" → .ide, "special:telegram" → .telegram, "1" → .ws-1

Allows users to style individual workspaces:
  #workspaces button.telegram { color: #54a0e0; }
2026-04-05 11:44:56 +02:00
eonphi f5d2ef1c4c Merge remote-tracking branch 'upstream/master' 2026-03-10 14:27:40 +01:00
Austin Horstman dd47a2b826 fix(hyprland/workspaces): stabilize reload and event handling
Hyprland workspace reloads could stack duplicate scroll-event connections,
causing a single wheel gesture to switch multiple workspaces after repeated
config reloads. The persistent-workspaces monitor-array form also created the
monitor name instead of the configured workspace name.

Disconnect and replace the scroll handler on reinit, fix the persistent
workspace name selection, normalize urgent-window address matching, and reject
malformed workspace payloads before they corrupt the local state machine.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-07 21:06:30 -06:00
Austin Horstman b1a87f943c fix(hyprland/window): avoid stale state during IPC refresh
The window module re-entered the same shared_mutex while refreshing IPC state:
update() took the lock and then called queryActiveWorkspace(), which tried to
lock it again. That is undefined behavior for std::shared_mutex and could
manifest as a deadlock.

Remove the recursive lock path and reset the derived window state before each
IPC refresh. That keeps solo/floating/swallowing/fullscreen classes from
sticking around when the client lookup fails or a workspace becomes empty.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-07 21:06:30 -06:00
Alexis Rouillard 100d4ec4a4 Merge pull request #4891 from khaneliman/bugfix/stab-003-test-001-hyprland-ipc
fix(hyprland-ipc): harden fd lifecycle and listener loop
2026-03-04 22:41:30 +01:00
Austin Horstman 4c71b2bf9f perf(memory): optimize C++ string operations to reduce heap fragmentation
- Replaced pass-by-value std::string parameters with const std::string&
or std::string_view to prevent SSO overallocations.

- Refactored static mapping functions in UPower to return
std::string_view instead of constructing std::string literals, enabling
perfect cache locality.

- Optimized string concatenation in hot loops (network IPs, inhibitor
lists, sway window marks) by using std::string::append() and
pre-reserving capacity instead of overloaded operator+ which produces
temporary heap instances.

These optimizations reduce high-frequency memory churn and overall heap
fragmentation within the main rendering loops.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 22:54:07 -06:00
Austin Horstman d0363313b8 fix(hyprland-ipc): harden fd lifecycle and listener loop
Hyprland IPC had fd lifecycle risks on failure/shutdown paths and used a
spin-sleep listener model.

I initialized fd state defensively, tightened connect/close/shutdown handling,
moved to blocking read with newline framing, and added RAII-style fd cleanup in
socket1 reply paths.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 08:09:44 -06:00
eonphi 736c053350 feat(hyprland/workspaces): grouping icons 2026-02-14 16:37:35 +01:00
vawvaw 5b595a4dfe hyprland/workspaces: Add enable-bar-scroll option 2026-02-13 20:48:59 +01:00
szbmrk 2475052326 Merge branch 'master' into feat-hyprland-submap-icon-handling 2026-02-04 12:38:49 +01:00
copilot-swe-agent[bot]andAlexays 330c77c87a Fix thread safety in Hyprland modules to prevent corrupted double-linked list crash
- Move GTK operations from IPC thread to GTK main thread in Window module
- Move GTK operations from IPC thread to GTK main thread in WindowCount module
- Move GTK style class operations from IPC thread to GTK main thread in Submap module
- Language and Workspaces modules already safe (only update internal state)

Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
2026-02-04 08:54:36 +00:00
szbmrk c38024bdec feat(hyprland/submap): add config option to specify different icons for submaps 2026-01-15 00:29:49 +01:00
mike b 85aac3fee7 feature to limit the number of icons displayed 2025-12-11 14:46:32 -05:00
dimti a36a5e89a9 Approach to dry pattern - separate remove/add css-classes logic to methods 2025-10-10 11:57:44 +03:00
dimti bdf501a8a5 make getLayout is not static and set css classes for short name keyboard layout in getLayout method 2025-10-10 11:35:47 +03:00
Alex 559079e9a6 fix: lint
clang-format / lint (push) Has been cancelled
freebsd / build (push) Has been cancelled
linux / build (c++20, alpine) (push) Has been cancelled
linux / build (c++20, archlinux) (push) Has been cancelled
linux / build (c++20, debian) (push) Has been cancelled
linux / build (c++20, fedora) (push) Has been cancelled
linux / build (c++20, gentoo) (push) Has been cancelled
linux / build (c++20, opensuse) (push) Has been cancelled
Nix-Tests / nix-flake-check (push) Has been cancelled
2025-10-05 10:56:24 +02:00
Alexis Rouillard a16d53b30d Merge branch 'master' into fix/zjeffer/thread-sanitizer-warning 2025-10-05 10:51:47 +02:00
Alexis Rouillard 4f16ec16f9 Merge pull request #4395 from pol-rivero/workspace-taskbar-improvements
[hyprland/workspaces] Taskbar improvements
2025-10-01 14:27:13 +02:00
Pol Rivero 5f1db15c2e Workspaces containing only ignored windows should be considered empty
This fixes #4479
2025-10-01 08:06:11 +02:00
Lukas Fleischer 5a29473080 Prevent child zombie process from tearing down Hyprland IPC
In rare circumstances, we may fork(), e.g., as part of a custom module,
and the child process may fail to exec() and exit. In those cases, the
IPC destructor will be called in the child process.

Prior to this commit, this call would then result in the shared socket
being closed. Prevent this by only closing the socket from the original
process.

Fixes #3975 and #4152.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
2025-08-22 18:58:53 -04:00
Pol Rivero 45d01ce6e5 Implement "active-window-position" 2025-08-18 21:23:36 +02:00
Pol Rivero 691b7d427b Implement "reverse-direction" 2025-08-18 20:49:14 +02:00
zjeffer 5079884b78 Hyprland IPC improvements, fix tsan warning, WindowCount shouldn't create a separate IPC 2025-08-12 19:39:36 +02:00
LoricAndre 383949795e feat(hyprland/workspaces): add uniqueIcons option 2025-07-23 17:38:25 +02:00
Pol Rivero c98cb7095d Merge remote-tracking branch 'upstream/master' 2025-07-06 10:18:59 +02:00