Compare commits

...

2053 Commits

Author SHA1 Message Date
vaxerski
5e577acf51 props: bump ver to 0.27.0 2023-07-12 13:11:11 +02:00
zakk4223
21f64b6660 Keep new mapped layer's alpha zero if the workspace has a fullscreen window (#2686)
Co-authored-by: Zakk <zakk@rsdio.com>
2023-07-12 12:58:45 +02:00
vaxerski
7a7e3ee6d9 screencopy: don't send frames on commits w/o a buffer 2023-07-12 00:30:42 +02:00
vaxerski
9c9f56743e groupbar: fix vram leak 2023-07-11 20:57:38 +02:00
Daniel Adolfsson
64e7d5345d Add support for smart splitting (#2676)
* Add support for smart splitting

* clang-format

* smart_split default to 0, and make smart_split behave like preserve_split
2023-07-11 13:37:25 +02:00
MightyPlaza
29d017f54b monitor desc default workspace but working now (#2678)
* fix desc check

* fixes crashes when nulptr
2023-07-11 11:29:19 +02:00
vaxerski
26579fa962 texture: fix styling 2023-07-11 00:27:13 +02:00
vaxerski
0c61a1530f plugins: fix config value usage in init 2023-07-10 14:13:23 +02:00
vaxerski
da7ea2b33d pluginapi: add configReloaded event 2023-07-10 13:54:06 +02:00
vaxerski
382af06406 render: resize subsurfaces with size resizes 2023-07-10 13:32:57 +02:00
vaxerski
515a363ecd render: move lastFrameDamage to CMonitor 2023-07-10 13:21:00 +02:00
vaxerski
fe54dcb4eb screencopy: send original damage, avoid extents 2023-07-10 13:17:21 +02:00
vaxerski
42f46aeac5 config: minor path handling fixes 2023-07-10 13:10:34 +02:00
MightyPlaza
4cc0e6de90 monitor desc default workspace (#2673) 2023-07-10 07:53:03 +02:00
MightyPlaza
d9f7f039e1 monitor desc support (#2670)
* monitor desc

* monitor desc
2023-07-09 23:10:35 +02:00
Tuur Vanhoutte
b99ac063ea Reuse same ID when reconnecting monitor, otherwise use minimum available ID (#2666)
Fixes #2601
2023-07-09 23:08:40 +02:00
vaxerski
b33d82734f input: schedule frame on mouse move 2023-07-09 00:44:32 +02:00
Ed Younis
f49af187bc Xdg config home support (#2047)
* config: Add support for XDG_CONFIG_HOME

Contributes-to: #1040
Co-authored-by: Björn Bidar <bjorn.bidar@thaodan.de>
Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>

* config: Log used config file

* config: Add GetConfigDir and minor fixes

* config: fixed minor nitpicks

---------

Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>
Co-authored-by: Björn Bidar <bjorn.bidar@thaodan.de>
2023-07-07 19:19:35 +02:00
vaxerski
e632bf176b config: fix reading touchpad values to non-touchpad per-device cfgs 2023-07-06 16:26:38 +02:00
Mykola Perehudov
41358c6fb5 Cleanup compositor deadcode (#2657)
* Remove dead code as it is a part of CCompositor::cleanup

* Unify sd_notify logic with Compositor lifetime
2023-07-06 15:24:49 +02:00
Mykola Perehudov
bbedb065e1 eventmanager: drop obsoleted ignore events flag (#2660)
This flag became obsoleted in commit
287e6c4ede
2023-07-06 15:23:11 +02:00
Mihai Fufezan
bc34713b29 Nix CI: fix typo 2023-07-06 13:02:56 +03:00
Mykola Perehudov
0c974b7236 Avoid passing control unix socket descriptors to children (#2656)
Add SOCK_CLOEXEC flags to server side connection FDs to make them
closed during execve(2).
2023-07-06 11:39:02 +02:00
nexec
8407a9af0a Close socket2 client descriptor on hangup (#2654) 2023-07-06 00:18:44 +02:00
Mihai Fufezan
c4f288582b flake.lock: update nixpkgs 2023-07-06 01:14:09 +03:00
Mihai Fufezan
981c71e60a Nix CI: split inputs and wlroots updating
Now there are separate update scripts for wlroots and for all other
inputs.
2023-07-05 16:46:02 +03:00
vaxerski
86e487e003 input: remove old redundant code 2023-07-05 13:20:40 +02:00
MightyPlaza
34d845da13 typo (#2643) 2023-07-04 22:03:19 +02:00
vaxerski
07d7962c7f swipe: fix mixup of r/m 2023-07-04 12:34:22 +02:00
vaxerski
18f9fb5e0f rules: add stayfocused 2023-07-04 12:05:25 +02:00
vaxerski
6f91997f06 layout: improve time restraints in window drag 2023-07-04 11:49:24 +02:00
MightyPlaza
283a8e77aa screenshot fix (#2640) 2023-07-04 11:40:28 +02:00
MightyPlaza
50755d26d4 lockgroups fix (#2636) 2023-07-03 15:53:04 +02:00
MightyPlaza
05047f60f4 groupbar fixes (#2630)
Fixes multiple groupbar decoration issues:

  -  togglegroup removes fullscreen to avoid to avoid weird state
 -   fixes issue where a group had multiple windows with head = true
 -   fixes issue where merging 2 groups would cause a window to have 2 groupbar decorations
  -  fixes issue where merging a group with more than 1 window into another group would make windows have no groupbar decoration
  -  fixes issue where ungrouping windows could just move them into another group on the same workspace


---------

Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
2023-07-03 12:49:56 +02:00
vaxerski
738ec900f4 config: fix floating rules with floating-by-rule windows 2023-07-02 13:02:48 +02:00
vaxerski
86ca283352 gestures: add workspace_swipe_use_r 2023-07-01 16:30:36 +02:00
vaxerski
6c28388420 layout: minor style fixes 2023-07-01 16:28:17 +02:00
vaxerski
e96fcb31f0 layout: set pseudo to float size in new window 2023-06-30 11:29:06 +02:00
Mihai Fufezan
64fc19cc81 Nix/portals.patch: conditionally check portals 2023-06-30 10:13:39 +03:00
vaxerski
1012e2735a shader: remove useless comment 2023-06-29 23:20:10 +02:00
MightyPlaza
990ad854bd Reloads animated decoration values set on window rules (#2594)
* Reloads dynamic window rules

* Update ConfigManager.cpp

* Update ConfigManager.cpp

* Reloads animated decoration values set on window rules

Reloads animated decoration values like border color and opacity set on window rule on config reload.
2023-06-28 11:40:16 +02:00
vaxerski
d83296c7a9 renderer: damage decos on damageWindow 2023-06-27 13:23:58 +02:00
Mihai Fufezan
62c75883d1 Nix: patch portals search dir 2023-06-27 00:51:04 +03:00
MightyPlaza
7ed66abe57 Reloads dynamic window rules (#2585)
* Reloads dynamic window rules

* Update ConfigManager.cpp

* Update ConfigManager.cpp
2023-06-26 13:03:51 +02:00
vaxerski
4294456cdc xwayland: remove spaces from output names 2023-06-25 13:52:24 +02:00
Mihai Fufezan
a82559f185 flake.lock: update nixpkgs 2023-06-24 16:38:23 +03:00
vaxerski
01f85a09a9 xwayland: send zero scaling to xwayland if enabled 2023-06-23 21:42:44 +02:00
vaxerski
69fae18e63 damage: account for popups in getFullWindowBoundingBox 2023-06-23 13:54:01 +02:00
vaxerski
c241da5ea5 crashreporter: log tag 2023-06-23 13:22:38 +02:00
vaxerski
0283c498d6 xwayland: fix minor force_zero_scaling bugs 2023-06-22 21:43:31 +02:00
vaxerski
fc59cef1ee keybinds: remove old todo 2023-06-21 21:20:26 +02:00
vaxerski
2f875aec79 includes: move workspace protocol header to includes 2023-06-21 21:17:05 +02:00
vaxerski
cfa4086b0b configmgr: fix idiotic comparisons in device configs 2023-06-21 20:58:35 +02:00
vaxerski
cbe9bf0e69 compositor: move group members properly in moveWindowToWorkspaceSafe 2023-06-21 20:51:18 +02:00
vaxerski
83ad6b9af8 groupbar: fix damage calcs 2023-06-21 13:16:10 +02:00
vaxerski
cabdf38ce4 internal: minor style fixes 2023-06-20 21:35:54 +02:00
vaxerski
2295bbdd80 xwaylandmanager: fixup style 2023-06-18 18:14:52 +02:00
Shemig
74ca81cc79 Partial revert of Commit 302ec13: (#2539)
Fix crash when screen size is 0x0 (#2523)

Reason: The disable of a monitor with 0x0 size
is causing issuses with some users.

https://github.com/hyprwm/Hyprland/issues/2537

Left the defensive code to resolve the crash.
Will continue to investigate and find a solution for the
dell xps disabled monitor

Co-authored-by: giladsx <gilad@spectalix.com>
2023-06-17 18:49:37 +02:00
vaxerski
5ac625d7bd format: fix hooksystem 2023-06-16 18:45:14 +02:00
solopasha
1d902a4621 fix updating revision in wlroots.wrap
revision gets updated to the previous one, not current.
2023-06-15 23:32:52 +03:00
Shemig
302ec1372c Fix crash when screen size is 0x0 (#2523)
(When booting into laptop clam mode in dell XPS)
and also ignore any screen with size 0x0 in the first place

Co-authored-by: giladsx <gilad@spectalix.com>
2023-06-15 22:07:58 +02:00
vaxerski
d768226de9 [gha] bump flake inputs 2023-06-15 08:53:30 +00:00
vaxerski
c55c28ec7f deps: update wlroots 2023-06-15 10:45:20 +02:00
vaxerski
c4dec4f796 internal: damage window on change group 2023-06-14 19:44:51 +02:00
vaxerski
0f1911a8d4 opengl: fix invalid tex references to tex-less shader 2023-06-14 13:47:57 +02:00
vaxerski
e43f7fc98d shader: init uniforms to -1 2023-06-14 13:29:12 +02:00
vaxerski
fbabb105c3 gamma: use wlr's new gamma manager event 2023-06-14 13:26:47 +02:00
outfoxxed
f0e4f6622e Implement pass binds (#2503)
* Implement pass binds

Pass binds run the associated dispatcher but do not prevent windows
from receiving the bind.

* Fix pass binds not working properly with release binds

* Rename `pass` to `nonConsuming`
2023-06-14 13:08:56 +02:00
JManch
9a88c19f1a screenshader: fix uniform variable checks (#2513) 2023-06-14 13:03:20 +02:00
vaxerski
7762ac0173 toplevelexport: ignore defunct windows 2023-06-13 20:13:21 +02:00
vaxerski
e8c6d0f51e compositor: don't set dim percent on disabled dim 2023-06-13 18:51:49 +02:00
vaxerski
807b52b019 animationmgr: warp on equal start and goal 2023-06-13 18:50:45 +02:00
vaxerski
0e31eaa157 shadow: drop useless damageEntire() 2023-06-13 18:50:45 +02:00
memchr
24ed9b061f feat: add variable to customize locked group border color (#2507)
added variables:
- general:col.group_border_locked
- general:col.group_border_locked_active
2023-06-13 12:04:54 +02:00
vaxerski
528cfc2889 [gha] bump flake inputs 2023-06-12 16:47:13 +00:00
vaxerski
91fbee24da deps: update wlroots 2023-06-12 18:35:33 +02:00
vaxerski
6beb79f27b xwayland: add force_zero_scaling 2023-06-11 21:52:13 +02:00
vaxerski
64ce06a353 xwayland: add nearest neighbor filtering as an opt 2023-06-11 21:33:59 +02:00
end-4
e1edfde539 Allow setting alpha value for ignorezero layer rule (#2477)
* rename ignorezero to ignorealpha

* allow setting ignorealpha value

This commit allows setting a float value (0-1) for the ignorealpha layer rule.
Does not yet have error handling; invalid ignorealpha layer rule will crash Hyprland.

* add brackets i forgot to add

* prevent crash with invalid ignorealpha value

prevents hyprland from immediately crashing with invalid ignorealpha layer rule
does not log

* don't try to set ignoreAlphaValue if alpha value not specified

* add catch to try, reintroduce ignorezero

- added catch after try cuz i was an idiot
- re-add ignorezero as an alternative to ignorealpha to not introduce a breaking change

* add logging for failed ignorealpha layer rule

* fix get ignorealpha's get VALUE

* check npos and use empty()

* rename VALUE cuz no longer const

* format Shader.hpp
2023-06-11 19:30:31 +02:00
Nicola Guerrera
10fd75c833 zoom: multiply by scale only on mouseZoomUseMouse (#2495) 2023-06-10 23:00:41 +02:00
vaxerski
7932e42507 screenshader: add output uniform 2023-06-10 16:10:26 +02:00
Nicola Guerrera
003993337a calculate zoom_center based on monitor scale (#2482) 2023-06-10 12:28:00 +02:00
memchr
bca3068db2 feat: add lockactivegroup dispatcher (#2478)
* feat: add lockactivegroup dispatcher

The `lockactivewindow` dispatcher takes `lock`, `toggle` or `unlock` as arguments. When a group is locked, no window or group can be added to it, nor can it be added to another group, but the `moveintogroup` and `moveoutofgroup` dispatches are not affected.

Implementation details:

the lock is implement via `SGroupData.locked` flag (defaults to false).

The flag is only relevant to the group head, and upon the group head's succession, the flag will be passed down to the new head. Meanwhile, the old head's flag will be set to false.

The flag is set to false when a group is dismissed.

New condition checks have been added to the dwindle and master layout to check if target group is unlocked (and if the source is also a group and unlocked) before adding windows to the target group.

* refactor: `lockactivegroup dispatcher code ordering
2023-06-09 23:44:18 +02:00
vaxerski
cf37922d42 input: update surface input on changeworkspace 2023-06-09 12:20:40 +02:00
eriedaberrie
d123835ef5 main: fix segfault when -c is given with no other arguments (#2470) 2023-06-09 12:15:18 +02:00
Michał
7f753cab9a chore: fix typos (#2463)
Some typos when spelling Hyprland
2023-06-07 20:18:39 +02:00
Franz Berger
4afeedbd56 Fix fractional scale updates in some cases (#2447)
* fix fractional scale update in moveWorkspaceToMonitor

* fix fractional scale update in moveToWorkspace

* Revert "fix fractional scale update in moveWorkspaceToMonitor"

This reverts commit 6612197a38.

* Revert "fix fractional scale update in moveToWorkspace"

This reverts commit 75d9795a06.

* move fractional scale code to updateSurfaceOutputs

* remove duplicate check

* remove superfluous setPreferredScale()
2023-06-06 09:48:07 +02:00
vaxerski
10db5a4fdb xwayland: disconnect events on destroy
thanks Kirill Primak
2023-06-05 20:51:47 +02:00
vaxerski
1a4e6e6a4b window: recalc on deco remove 2023-06-05 09:49:21 +02:00
staz
e4e6ddb075 Make movetoworkspace register previous workspace (#2436)
* Make movetoworkspace register previous workspace

* style: no braces + format with clang-format
2023-06-05 09:44:13 +02:00
vaxerski
4ef684f615 hyprctl: recalc layout on setprop 2023-06-04 21:35:23 +02:00
vaxerski
2629cfeeab layouts: make aware of borderSize prop 2023-06-04 21:35:23 +02:00
vaxerski
d83e5b8409 internal: make borderSize prop overridable 2023-06-04 21:35:23 +02:00
vaxerski
df98db5092 [gha] bump flake inputs 2023-06-03 16:07:31 +00:00
vaxerski
d87010f300 deps: update wlroots 2023-06-03 17:59:31 +02:00
vaxerski
c5a7202cd9 noxwl: add missing stubs 2023-06-03 13:01:32 +02:00
vaxerski
70e4162dcc [gha] bump flake inputs 2023-06-03 10:28:25 +00:00
vaxerski
147e962370 deps: update wlroots 2023-06-03 12:20:28 +02:00
Cyril Levis
d7db7040d4 feat: add ipc set title window event (#2419)
* feat: add ipc set title window event

* chore: add EMIT_HOOK_EVENT and change event name
2023-06-03 11:18:49 +02:00
vaxerski
67be8d89b5 [gha] build man pages 2023-06-03 09:11:37 +00:00
asdfer
18956144d5 Update ISSUE_GUIDELINES.md faq link to the wiki (#2424)
Co-authored-by: local <>
2023-06-03 11:11:13 +02:00
vaxerski
871ab24c6e internal: properly set monitor props on special windows 2023-06-02 20:14:34 +02:00
vaxerski
ce0f248d20 events: remove old comment 2023-06-02 19:50:02 +02:00
vaxerski
dd0bf87c01 [gha] bump flake inputs 2023-06-02 16:53:02 +00:00
vaxerski
6ba8310c13 deps: update wlroots 2023-06-02 18:44:05 +02:00
Sinkerine
ca3791fed8 [hyprctl] Expose the special workspace id and name of the monitor (#2392)
* [hyprctl] Expose the special workspace id of the monitor

So that we know if a special workspace is shown on a monitor

* [hyprctl] Add special workspace name to the output
2023-06-02 13:25:33 +02:00
vaxerski
9cf72a30fc debug: add WITH_ASAN flag in cmake 2023-06-01 17:08:11 +02:00
vaxerski
e76bd43f53 rules: add nodim 2023-05-31 21:11:20 +02:00
vaxerski
baf81cdc5d input: force focus on movefocus 2023-05-31 20:59:38 +02:00
vaxerski
9f72d508ae groupbars: fix damage calcs 2023-05-31 19:53:58 +02:00
vaxerski
1844e8adad [gha] bump flake inputs 2023-05-31 14:18:39 +00:00
vaxerski
b540d28849 deps: update wlroots 2023-05-31 16:09:25 +02:00
vaxerski
fd73a7f795 gradient: fix warn 2023-05-31 15:55:54 +02:00
vaxerski
51a930f802 version: bump to 0.26.0 2023-05-29 19:17:38 +02:00
vaxerski
a7cfbdb854 keybinds: fix tryMoveFocusToMonitor with special 2023-05-29 18:11:37 +02:00
vaxerski
1e3571eb5b layout: don't reset to floating size on drag tiled 2023-05-29 18:05:41 +02:00
vaxerski
5484411232 compositor: disallow sending pinned to special 2023-05-29 17:46:12 +02:00
Jan Beich
f1ad270ff8 vector: restore cmath include after 438d063ec6 (#2394)
src/helpers/Vector2D.cpp:27:26: error: no member named 'floor' in namespace 'std'
    return Vector2D(std::floor(x), std::floor(y));
                    ~~~~~^
src/helpers/Vector2D.cpp:27:41: error: no member named 'floor' in namespace 'std'
    return Vector2D(std::floor(x), std::floor(y));
                                   ~~~~~^
src/helpers/Vector2D.cpp:37:17: error: no member named 'sqrt' in namespace 'std'
    return std::sqrt(dx * dx + dy * dy);
           ~~~~~^
2023-05-29 15:12:00 +02:00
Jeremy Huang
b3a86952cf focus: fix #1675 window not scrollable after movefocus (#2390) 2023-05-29 09:52:36 +02:00
outfoxxed
409ff027f8 Fix UAF in animation end callback if callback deletes the animation (#2389)
Removes use after free when the end callback deletes the animation as
long as `m_bRemoveEndAfterRan` is false.
2023-05-29 09:51:58 +02:00
vaxerski
438d063ec6 vector: use c++ stdlib math functions instead of cmath 2023-05-28 22:50:13 +02:00
vaxerski
078ba6daa8 groupbars: add text color opt 2023-05-27 17:46:02 +02:00
Ruby Iris Juric
74b49de883 Add hyprland to waybar-hyprland path as fallback for hyprctl 2023-05-27 15:35:25 +03:00
Jeremy Huang
8afc2f45c7 focus: make cursor follow movewindow (#2374) 2023-05-27 12:16:50 +02:00
vaxerski
5f4659afef xdgshell: check and conform to rigid float sizes on commit 2023-05-26 14:49:03 +02:00
vaxerski
0887e2ee6e window: reveal current from group on toplevel activate 2023-05-26 13:44:59 +02:00
vaxerski
62e3953f5b master: guard monitor in recalc 2023-05-26 13:41:52 +02:00
vaxerski
9c9b74179c pluginapi: add separate window render events 2023-05-26 13:07:45 +02:00
vaxerski
a2bb95fc60 touch: fix double offset in local 2023-05-24 22:19:22 +02:00
vaxerski
12227d7b6a input: only configure newly added touch devices 2023-05-24 22:17:33 +02:00
vaxerski
a4c120d608 layouts: ignore direction forces on non-map 2023-05-24 19:23:10 +02:00
eriedaberrie
53285a75ad hyprctl: fix cut-off json outputs (#2352)
* hyprctl: fix cut-off json outputs

* Address comments
2023-05-24 17:46:56 +02:00
vaxerski
f877d68f4f launchanim: fix #2291 2023-05-24 15:49:31 +02:00
Xianhao Yu
5bfd5a9240 examples: fix incorrect link in per-device config comments (#2353) 2023-05-24 11:11:49 +02:00
vaxerski
eb1f832fce decos: recalc on add 2023-05-23 14:26:38 +02:00
vaxerski
799add8659 groupbars: fix reserved area on titles 2023-05-23 14:18:26 +02:00
vaxerski
90cb5fb672 groupbars: make gradients toggleable 2023-05-22 22:07:32 +02:00
vaxerski
d1ec314a03 groupbars: conserve VRAM by staticizing textures 2023-05-22 22:06:40 +02:00
vaxerski
7bcc01efb7 groupbars: fix minor alignment issues 2023-05-22 21:43:37 +02:00
vaxerski
206ac000b9 groupbars: add title and gradient rendering 2023-05-22 21:40:32 +02:00
vaxerski
1eb6cfd45c groupbar: make exclusive 2023-05-22 20:52:41 +02:00
vaxerski
088b4a68e6 moveActiveToWorkspace: update last window of old ws 2023-05-22 19:44:10 +02:00
vaxerski
086f724951 wlr_ext_workspaces: honor activate from client + format 2023-05-22 19:36:47 +02:00
Russell Greene
ad244190e0 1483: fix crash on last display disconnect (#2344) 2023-05-22 12:18:07 +02:00
maqrrr
9f8c5cb63c Fix broken pipe crash when event listener terminates (#2339) 2023-05-21 14:38:18 +02:00
vaxerski
5627b70981 input: reset cursor hide timer on tablet 2023-05-20 21:15:21 +02:00
vaxerski
79b8576df9 examples: update plugin makefile 2023-05-17 15:01:17 +01:00
vaxerski
ba714b3b71 examples: update plugin headers 2023-05-17 14:59:52 +01:00
Anthony Ruhier
d7935356da input: don't move monitor focus on wp change (#2320) 2023-05-17 13:32:59 +01:00
Anthony Ruhier
9ef7225532 don't swap workspaces if monitors are the same (#2322)
Return swapActiveWorkspaces early if MON1 and MON2 are equals, to avoid
buggy behavior.
2023-05-17 13:31:03 +01:00
outfoxxed
642030f959 Fix not finding function symbols for hooking (#2292)
Fixes no useful feedback about failing subcommand.
Fixes function hooks breaking when running under a path containing
spaces.

Replaced old usages with this function where possible.
Complex shell usages now use `execAndGetShell` which is equal to the
old function.
2023-05-16 23:39:14 +03:00
Mihai Fufezan
78826c6d18 meson & nix: install wlroots headers (#2287) 2023-05-16 20:50:18 +03:00
Eric_Luo
b5b9af508a bug fix (#2314)
fix float check logic

Co-authored-by: hnboy <hnywolf@gmail.ccom>
2023-05-16 17:43:04 +01:00
vaxerski
d68f8ea668 internal: make CAnimatedVariable non-move non-copy 2023-05-16 12:49:59 +01:00
vaxerski
5b84b0fb44 animationmgr: allow empty avars 2023-05-15 17:11:51 +01:00
Vaxry
621eac32d3 readme: update previews 2023-05-15 15:33:58 +01:00
vaxerski
824813fc6a internal: remove check for negative exact vector args 2023-05-15 15:16:06 +01:00
vaxerski
7c207243e4 input: check for matrix availability in touch config 2023-05-14 13:54:55 +01:00
vaxerski
b748b0734f input: don't refocus on closed window 2023-05-14 13:47:43 +01:00
vaxerski
896a78aaa0 lock: add allow_session_lock_restore 2023-05-13 12:36:36 +01:00
vaxerski
cc01550aff hyprctl: recalc layout on dynamic workspace 2023-05-12 01:16:27 +01:00
vaxerski
413a36a914 workspacerules: overwrite on existing 2023-05-12 01:15:32 +01:00
vaxerski
86ef85efae layershell: don't enter on unmapped ls 2023-05-12 01:07:46 +01:00
vaxerski
a483376591 pluginenv: copy built wlr headers 2023-05-11 20:17:26 +01:00
vaxerski
f2725a374a render: minor fixes to fullscreen rendering 2023-05-10 18:36:13 +01:00
vaxerski
7fde80f38e layers: fix wonky focus on multimon 2023-05-09 17:01:18 +01:00
vaxerski
cc4ccfdbfd internal: use i64 for workspaces in outofbounds 2023-05-09 14:08:05 +01:00
Andrei Alexeyev
2f87e4c2f3 renderer,config: add custom DRM modeline support (#2254)
This allows specifying custom display resolutions for the DRM backend.
This is useful for display overclocking, working around broken EDIDs,
etc. To use this feature, specify a modeline instead of a resolution
in the config, for example:

    monitor = DP-1, modeline 1071.101 3840 3848 3880 3920 2160 2263 2271 2277 +hsync -vsync, 0x0, 1

This example is a custom 3840x2160@120Hz mode with tightened timings.
I use it because the standard timings don't work with my monitor and GPU
combination (M28U with RX580).

The syntax is compatible with Sway and Xorg.
2023-05-09 14:01:45 +01:00
vaxerski
e7c2ea9724 layershell: focus if changed keyboard mode 2023-05-08 19:12:01 +01:00
scorpion-26
826dc61e5c Add "next on monitor or empty" workspace parameter (#2198)
* Add "next on monitor or empty" workspace parameter

Implements the following workspace parameter:
r+x/r-x (i.e. r+1): Behaves similar to the "m" parameter, but can also
select empty workspaces and it doesn't wrap around

* Improve code comments

* Implementation V2 for 'r' workspace param

* Rebase to upstream

Should fix CI

* Always set outName

* Include named workspaces

Currently only considers open/active named workspaces
2023-05-08 14:37:59 +01:00
vaxerski
a31dceb2c6 includes: remove redundant from screencopy 2023-05-07 00:11:33 +01:00
vaxerski
1ba7a09bf6 includes: use libdrm prefix for include 2023-05-07 00:11:01 +01:00
vaxerski
afe8d8dfec monitors: fix some bugs with re-plug 2023-05-06 16:50:15 +01:00
dtop129
7e5ba5e824 Fixed wrong focus changes when moving background workspaces (#2258) 2023-05-06 16:13:26 +01:00
vaxerski
83cd5e2ebd workspaces: minor fixes for multi-special 2023-05-06 16:10:51 +01:00
vaxerski
7f0738bcb3 varlist: allow using s for std::isspace 2023-05-06 01:16:20 +01:00
vaxerski
583b8842e7 configmanager: fix substr offset in default ws rule 2023-05-06 01:10:05 +01:00
Dashie
a8541d5f64 Add split preselection (#2240) 2023-05-06 01:02:18 +01:00
vaxerski
4ad03af544 compositor: don't focus pointer in focusWindow 2023-05-06 00:59:25 +01:00
vaxerski
0859944c9a input: add custom accel profiles 2023-05-05 16:06:13 +01:00
vaxerski
c0be1e2fd8 configmanager: remove useless log from handleWorkspaceRule 2023-05-05 15:42:02 +01:00
vaxerski
7b73a332ea configmanager: deprecate bindws 2023-05-05 15:41:25 +01:00
vaxerski
a5d63a0324 configmanager: store workspace rules as a deque 2023-05-05 15:33:31 +01:00
vaxerski
8435d6fc12 monitors: toggle special on changeworkspace with special 2023-05-05 15:01:31 +01:00
Mihai Fufezan
d1d4683c91 Issue template: request users to ping me for Nix 2023-05-05 11:46:20 +03:00
vaxerski
bf04c83e3d config: clear layer rules on reload 2023-05-04 18:28:45 +01:00
John Rinehart
0432804b18 Nix: expose/use flake's own hyprland-protocols in overlays.default (#2235) 2023-05-04 17:47:15 +03:00
solopasha
da093a8aec quote hash for the GIT_COMMIT_HASH macro (#2227)
otherwise compilation fails with smth like
```
../src/debug/../plugins/../defines.hpp:1:25:
error: ‘f27873a6f06dc2f87600edb890f3c38298bfb55f’ was not declared in this scope
```
2023-05-03 20:50:33 +01:00
vaxerski
f27873a6f0 ver: bump to 0.25.0 2023-05-03 17:15:08 +01:00
scorpion-26
c3b9326ba1 Honor debug:enable_stdout_logs on startup (#2197)
* Honor debug:enable_stdout_logs on startup

disableStdout is set via config in CConfigManager::init(), which is
called early in CCompositor::initServer(). initServer() always disables
stdout logs at the end though, even when stdout is enabled is config. With this commit,
the config is respected.

* Don't spam stdout message
2023-05-03 16:08:01 +01:00
vaxerski
fd3e6a3bfd workspaces: restore monitor on re-plug 2023-05-03 15:15:56 +01:00
vaxerski
0155b85950 rules: fix monitor rule with names 2023-05-03 14:58:51 +01:00
jacekpoz
a663823af2 only ignore no_gaps_when_only when the workspace rule specifies a border (#2217)
Co-authored-by: jacekpoz <jacekpoz@cock.li>
2023-05-03 14:48:46 +01:00
outfoxxed
5a3c144919 Add warning about setting hyprland config with home manager 2023-05-03 13:05:21 +03:00
outfoxxed
4fe5827598 Add plugin configuration to home manager module 2023-05-03 13:05:21 +03:00
Mihai Fufezan
2e28e88dfd flake.lock: update nixpkgs
flake.nix, nix/overlays.nix: remove wayland-latest overlay (1.22 now in nixpkgs)
2023-05-03 00:15:58 +03:00
vaxerski
72b118cd8f opengl: don't use new optim with xray off on special tiled 2023-05-02 21:23:53 +01:00
Jacob Birkett
80b2ac1cc5 Nix: fix recursion in package overlays (#2210)
* nix: flake: fix improperly using prev.callPackage

* flake: cleanup with let blocks

* flake: make overlays use recursive packages

flake: separate overlays into multiple, combine into default

* nix: overlays: extract to own file

* flake: devShells: remove stdenv override

* overlays: hl-pkgs: xdph: remove needless overlay

Since the packages are now built with the overlays combined from inputs
and self, overriding specific dependencies (anywhere) is no longer
necessary.

* nix: overlays: extras: include xdph and share-picker

* nix: overlays: hl-pkgs: remove stdenv override
2023-05-02 20:54:29 +03:00
vaxerski
79791c9ed4 internal: fix -Wsign-compare and -Wunused-variable warnings 2023-05-02 14:53:31 +01:00
Yavor Kolev
ac3edec14b Add activeworkspace hyprctl command (#2202)
* Add `activeworkspace` hyprctl command

* fix format in hyprctl

* Make stuff more shared in workspace hyprctl

---------

Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
2023-05-02 14:51:52 +01:00
vaxerski
cde7f79af0 xwayland: allow initial focus to dialogs 2023-05-02 14:44:21 +01:00
Jan Beich
609c7ab6b5 Unbreak CMake build on FreeBSD (#2209)
* cmake: unbreak on non-GNU after 474ada9267

CMake Error at CMakeLists.txt:121 (target_link_libraries):
  The keyword signature for target_link_libraries has already been used with
  the target "Hyprland".  All uses of target_link_libraries with a target
  must be either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * CMakeLists.txt:107 (target_link_libraries)

Fixes https://github.com/hyprwm/Hyprland/issues/1780

* cmake: always link with dependencies via imported targets

On BSD systems base compiler by default only looks for headers and
libraries from base system. For dependencies from packages extra flags
are necessary.

ld: error: unable to find library -lxcb
ld: error: unable to find library -lpixman-1
ld: error: unable to find library -lOpenGL
ld: error: unable to find library -lGLESv2

* make: use same make in recursive calls

On BSDs `make` is BSD make while `gmake` is GNU make

* make: work around GNU vs. BSD sed -i incompatibility

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254091

* make: replace GNU make extension with POSIX sh

`$(shell ...)` in GNU make is similar to `${:!..!}` in BSD make

* make: fall back when nproc isn't available

Only FreeBSD added nproc for compatibility with Linux.

* make: unbreak hyprctl on Clang-based systems

/bin/sh: g++: not found
error: invalid value 'c++23' in '-std=c++23'

* make: create lib/ before copying libwlroots.so there

$ make install PREFIX=/tmp/test
[...]
cp: directory /tmp/test/lib does not exist

* make: pass cp(1) flags before arguments

cp: -f is not a directory

* make: replace install -Dt with mkdir

install: illegal option -- t

* make: replace cp --parents with cpio -dump

cp: illegal option -- -

* make: limit pkg-config workaround to Linux when run as root

/usr/share/pkgconfig doesn't exist on BSDs or may not be writable.
2023-05-02 14:38:36 +01:00
levnikmyskin
c949173bc9 Added some workspace-specific rules (#1986)
* added some workspace-specific rules

* added some worskpace-specific rules, with windowrule like syntax

* monitor is not mandatory anymore

* pointers to config are now static

* fixed optional WorkspaceRule fields

* Windows can now specify border size

* removed CHyprOpenGLImpl::renderBorder borderSize default value

* stuff

---------

Co-authored-by: Alessio Molinari <alessiomolinari@gmail.com>
Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
2023-05-01 22:28:27 +01:00
Jan Beich
250d5cf78c config: add missing header for libc++ after 3a631e40db (#2208)
src/config/ConfigManager.cpp:1980:27: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
        std::stringstream error;
                          ^
/usr/include/c++/v1/iosfwd:134:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_stringstream;
                               ^
2023-05-01 22:24:51 +01:00
vaxerski
45b1e6dc5e keybinds: simulate workspace switch on focusWindow to another ws 2023-05-01 15:39:08 +01:00
vaxerski
d6b069458d input: don't refocus on dragging 2023-05-01 15:15:55 +01:00
outfoxxed
3a631e40db Declarative plugin management (#2180)
* Declarative plugin management

Allow declaring `plugin` entries in the hyprland configuration.

Plugins will be loaded if an entry is added and unloaded if that entry
is removed.

* Replace pointers with copying in updateconfigPlugins

* Include which plugin was declared twice in error
2023-05-01 15:10:53 +01:00
q234rty
dc469dc4c1 Prefer bundled wlroots headers to system ones (#2204)
In the case that the prefix is `/usr`, system wlroots headers installed in `/usr/include/wlr` will be preferred over those bundled by hyprland as `-I` directories are searched [from left to right](https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html), which is not great since the system wlroots headers might not be compatible with hyprland. Fix the order of cflags so bundled wlroots headers will be preferred over system ones.
2023-05-01 13:42:16 +01:00
vaxerski
11b7ce14f8 renderer: fix misused size -> transformed size 2023-05-01 02:53:43 +01:00
vaxerski
ddfeebad3d Renderer: add init animation 2023-05-01 02:49:41 +01:00
vaxerski
11e87986a2 makefile: put pkg-config file in the default dir 2023-05-01 01:13:57 +01:00
Vaxry
dbf0b92de7 Plugin header overhaul 2: fixes (Electric boogaloo) (#2201)
* Add wlroots headers to makefile + fix pluginenv with new headers

* Add wlroots to pc
2023-05-01 01:04:25 +01:00
vaxerski
02312cac59 renderer: more checks for background LS optimizations 2023-04-30 01:15:51 +01:00
vaxerski
6501bceb42 workspace: don't check LS-es in startAnim 2023-04-30 01:13:58 +01:00
vaxerski
3580f845e6 monitor: update fullscreen fade on workspace change 2023-04-30 01:12:20 +01:00
vaxerski
b7e69be51e windows: check for fullscreen after rules 2023-04-30 01:01:47 +01:00
scorpion-26
fdb772832f Keep fullscreen mode in moveWindowToWorkspaceSafe (#2191)
Moving a maximised window would always result in the window being
fullscreen instead of maximised
2023-04-29 23:39:09 +01:00
vaxerski
5c3684d0cc pluginenv: configure cmake to build protocols 2023-04-29 17:41:44 +01:00
vaxerski
5a3e3deb33 internal: warp workspace on change only if old mon is last 2023-04-29 13:32:59 +01:00
vaxerski
2946221195 renderer: fix fadingout render on fs 2023-04-29 13:29:32 +01:00
Jan Beich
ce6c13f86b cmake: sync pkg-config --cflags with meson (#2181) 2023-04-29 11:34:28 +03:00
vaxerski
fbb938fcf2 internal: don't change ws on active swap 2023-04-28 21:40:44 +01:00
Mihai Fufezan
093755d53f flake.lock: update nixpkgs 2023-04-28 19:59:31 +03:00
vaxerski
dbb6d9d174 rules: add noinitialfocus 2023-04-28 15:36:08 +01:00
vaxerski
f23455e592 makefile: use -f in copies to avoid errors on running hl 2023-04-27 14:56:43 +01:00
vaxerski
5ce76cd0b0 internal: add tag to version, send hash in release ci 2023-04-27 14:28:40 +01:00
q234rty
49f9ca06c7 Add subdir for cmake as well (#2163) 2023-04-27 13:56:03 +01:00
vaxerski
1a1656ddbf Revert "internal: include headers from protocols/"
This reverts commit 550700bed0.

We can't cuz meson
2023-04-27 13:55:13 +01:00
vaxerski
550700bed0 internal: include headers from protocols/ 2023-04-27 13:40:38 +01:00
Mihai Fufezan
72d2f33b34 Meson: add subdirs to pkg-config file 2023-04-27 01:34:40 +03:00
Ching Pei Yang
38bdbdb0f5 Plugin header overhaul (#2087)
* meson: install headers

* Meson/CMake: add pkg-config file for headers

* makefile: install headers and pkgconfig

* CMake: move protocols to cmake

Co-authored-by: Ching Pei Yang <badnam3o.0@gmail.com>

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
2023-04-27 00:59:16 +03:00
vaxerski
622132290f [gha] bump flake inputs 2023-04-26 16:33:53 +00:00
vaxerski
77223e1cad deps: update wlroots 2023-04-26 17:23:50 +01:00
vaxerski
4a1fb3e903 keybinds: fix move to named 2023-04-26 16:58:58 +01:00
vaxerski
28ca434fb5 Revert "input: make overlay layers precede constraints"
This reverts commit 1e526411b6.

Issues with input
2023-04-25 21:50:24 +01:00
vaxerski
1e526411b6 input: make overlay layers precede constraints 2023-04-25 17:02:20 +01:00
outfoxxed
849d657595 Window resizing for pseudotiled windows (#2140)
* Window resizing for pseudotiled windows

* Use `m_vRealSize` to determine scaled window size
2023-04-25 16:53:18 +01:00
vaxerski
bf27066fd7 IHyprLayout: add missing static modifiers to config vars 2023-04-25 16:53:01 +01:00
vaxerski
1f80154823 layouts: add missing static modifiers to config vars 2023-04-25 16:49:06 +01:00
outfoxxed
f40272d509 Add follow mouse mode to avoid refocusing under cursor (#2135)
* Add follow mouse mode to avoid refocusing under cursor
2023-04-25 16:00:34 +01:00
vaxerski
e195a51cd4 internal: update fullscreen fade on workspace move 2023-04-24 23:23:12 +01:00
vaxerski
247ff4e60d internal: improve fullscreen fade 2023-04-24 23:21:51 +01:00
vaxerski
eb570c88e6 screencopy: clamp damage to framebuffer 2023-04-24 20:01:44 +01:00
Mihai Fufezan
1a91c6ee60 flake.nix: override wayland 2023-04-24 01:22:26 +03:00
Tyler Schneider
67c73ec100 Fixed a crash when waking up monitors in power-saving mode (#2139) 2023-04-23 22:28:18 +01:00
Jan Beich
f7579fc923 internal: unhardcode sun_path size after a6cfe70428 (#2137)
hyprctl/main.cpp:83:5: warning: 'strncpy' size argument is too large; destination buffer has size 104, but size argument is 107 [-Wfortify-source]
    strncpy(serverAddress.sun_path, socketPath.c_str(), 107);
    ^
hyprctl/main.cpp:146:5: warning: 'strncpy' size argument is too large; destination buffer has size 104, but size argument is 107 [-Wfortify-source]
    strncpy(serverAddress.sun_path, socketPath.c_str(), 107);
    ^
src/managers/EventManager.cpp:70:9: warning: 'strncpy' size argument is too large; destination buffer has size 104, but size argument is 107 [-Wfortify-source]
        strncpy(SERVERADDRESS.sun_path, socketPath.c_str(), 107);
        ^
2023-04-23 21:20:29 +01:00
mekb
fbcbe947da Added moveCursor dispatcher (#2100)
* Added moveCursor dispatcher

* fix error message for moveCursor
2023-04-23 19:50:53 +01:00
vaxerski
97b0368765 xwayland: crude fix for qt dnds 2023-04-22 22:20:48 +01:00
vaxerski
c0f4e9f52e internal: moveToWorkspace before setting ws 2023-04-22 21:13:06 +01:00
vaxerski
4a92deec54 [gha] bump flake inputs 2023-04-22 12:20:19 +00:00
vaxerski
5bf1c32bc0 deps: update wlroots 2023-04-22 13:18:55 +01:00
vaxerski
49fb4cd94d renderer: improvements to layer render detection 2023-04-22 12:54:57 +01:00
vaxerski
99079f7094 cmake: ignore format-truncation 2023-04-22 12:38:04 +01:00
vaxerski
1911e4262b renderer: skip rendering bottom layers on fullscreen opaque 2023-04-22 12:36:54 +01:00
q234rty
d366fc48b8 Remove wlr_output_damage.h (#2121)
This is [removed](9ef98452a3) upstream and hyprland wasn't using it anyway.

This alone will probably not fix the CI but this will allow to clean build hyprland in many configurations.
2023-04-21 18:28:51 +01:00
vaxerski
7b5b4a1049 crashReporter: log on crash 2023-04-21 16:48:36 +01:00
vaxerski
458ea56b86 [gha] bump flake inputs 2023-04-21 14:43:34 +00:00
vaxerski
d03dcc3d99 deps: update wlroots 2023-04-21 15:42:08 +01:00
outfoxxed
2df0d034bc Fix dragging cursor being forced on fullscreen windows (#2115)
Fix two edge cases causing the dragging mouse cursor to be forced on
fullscreen windows:
- hovering over a window border and running the fullscreen dispatcher
- moving mouse focus from a monitor with the resize cursor set to a
different monitor with a fullscreen window
2023-04-21 13:36:55 +01:00
vaxerski
510db64860 hyprctl: allow spaces in cursor themes 2023-04-20 23:59:31 +01:00
vaxerski
b15803510c input: improve mouse release conditions 2023-04-20 00:46:42 +01:00
vaxerski
f914a5a06d input: release mouse buttons before refocuses 2023-04-19 21:36:08 +01:00
q234rty
6225591dbd Fix apps requesting fullscreen (#2099)
Otherwise e446db02f6 breaks fullscreening of image previews for nheko/telegram-desktop/...
2023-04-19 13:26:27 +01:00
DB
e446db02f6 Add windowrule fakeFullScreen (#2043)
Co-authored-by: xVermillionx <xVermillionx@notvalid>
2023-04-18 21:59:08 +01:00
vaxerski
a4330fe378 misc: scan ppids in exec rules 2023-04-18 11:48:56 +01:00
vaxerski
716d713b04 pluginAPI: add note about API expansion 2023-04-17 23:49:42 +01:00
vaxerski
1c50a11688 opengl: keep current rendered workspace in renderData 2023-04-17 23:47:12 +01:00
vaxerski
385fe4e301 events: add render event for plugins 2023-04-17 23:45:03 +01:00
vaxerski
412d46ff65 monitors: set special monitor ID on open 2023-04-17 22:58:59 +01:00
vaxerski
ae82c3a639 screencopy: improve consistency of share indicator 2023-04-17 22:57:24 +01:00
vaxerski
b4f75525d9 pluginAPI: make symbols static 2023-04-17 18:39:40 +01:00
vaxerski
8b3d8dc792 Format: use %lx for all addresses 2023-04-17 17:35:28 +01:00
vaxerski
5cb5b628b8 crashReporter: fix invalid format string 2023-04-17 17:32:07 +01:00
Vaxry
b0d86a7159 CI: Add CodeQL (#2088) 2023-04-17 17:16:19 +01:00
vaxerski
a6cfe70428 internal: avoid buffer overflows with socket paths 2023-04-17 16:38:52 +01:00
vaxerski
b6a7be7663 dispatchers: fix movetoworkspace with bound ws-es 2023-04-17 16:09:46 +01:00
vaxerski
25f14294a8 formats: fix endian ifdef 2023-04-17 15:36:49 +01:00
vaxerski
7c36a3e167 internal: move workspace special check higher in changeWorkspace 2023-04-17 13:32:35 +01:00
vaxerski
785fc8d669 dispatchers: fix missing log param 2023-04-17 13:30:37 +01:00
vaxerski
c62ab1bee7 internal: use setSpecialWorkspace on destroy in sanityCheck 2023-04-16 21:33:28 +01:00
vaxerski
f80f4f3194 dispatchers: fix named ws-es on changeworkspace 2023-04-16 21:32:32 +01:00
Mihai Fufezan
6e58428336 flake.lock: update nixpkgs
Fixes #2044
2023-04-16 20:55:46 +03:00
vaxerski
b05ff89c76 Render: add cursor_zoom 2023-04-16 14:48:38 +01:00
vaxerski
28dfe21584 blur: fixup optimization bool 2023-04-16 14:18:02 +01:00
dann-merlin
c86f06caa0 Fix possible usage of clamp with lo > hi in Vector2D (#2049) 2023-04-16 01:27:14 +01:00
vaxerski
afc887d941 monitor: recalc layout on switched ws 2023-04-16 01:11:57 +01:00
vaxerski
edad24c257 Screencopy: unify frame and client between impls + event
Adds a new event to both hooks and ipc: screencopy
2023-04-15 23:43:41 +01:00
vaxerski
12604b7676 compositor: ignore contraints on warp in moveWorkspaceToMonitor 2023-04-15 21:27:11 +01:00
Jan Beich
63841c8aac Disable systemctl when built without systemd support (#2066)
/bin/sh: systemctl: not found
2023-04-15 20:03:09 +01:00
vaxerski
8944db49be swallow: fix invalid regexes with empty vals 2023-04-15 19:15:59 +01:00
vaxerski
4c4fcc128b input: fix ls focus in non-input area 2023-04-15 16:53:31 +01:00
vaxerski
d6c4ae71d0 damage: fix damage on moves / workspace changes 2023-04-15 16:16:33 +01:00
vaxerski
a6d94eafba tick: don't tick on invalid session 2023-04-15 12:45:25 +01:00
vaxerski
29fc410a8f crashReporter: avoid segfault in deref plugin system 2023-04-15 10:58:46 +01:00
vaxerski
83f1616a65 keybinds: minor adjustments to workspace 2023-04-14 17:51:10 +01:00
vaxerski
7ec23254fd workspace: don't lose monitor with refocus on no warps 2023-04-14 17:03:12 +01:00
vaxerski
c2b5dd1be6 keybinds: only warp on different monitor ws 2023-04-14 16:22:55 +01:00
vaxerski
727160f0a4 workspaces: fixup workspaces not activating on workspace switch 2023-04-14 15:28:22 +01:00
vaxerski
3f2a18a435 keybinds: remove old comment 2023-04-14 15:16:59 +01:00
vaxerski
e329bc2c7b renderer: fix incorrect shouldRenderWindow calcs 2023-04-14 15:16:43 +01:00
vaxerski
8dd0c4fe74 workspaces: deactivate all on monitor switch 2023-04-14 15:08:27 +01:00
vaxerski
cf7c5e4dff misc: fix a warning 2023-04-14 15:06:22 +01:00
vaxerski
287e6c4ede internal: workspace manip handling rework 2023-04-14 15:03:53 +01:00
vaxerski
011600ac6e keybinds: more intelligent fallback on silent move 2023-04-14 01:42:55 +01:00
vaxerski
70eb74c356 fractional-scale: notify all surfaces on window move 2023-04-14 01:36:07 +01:00
vaxerski
260ef788f5 internal: don't sanity check workspaces on internal ws calls 2023-04-13 22:21:11 +01:00
vaxerski
6131e0bef7 keybinds: refocus properly on silent move 2023-04-13 22:20:31 +01:00
vaxerski
41c7d896e3 internal: prevent premature destroy in moveworkspace 2023-04-13 21:09:50 +01:00
Person1873
33d06fb0e5 Add ability to split master when only 1 additional window (#2025)
* fix: enable master split less than 2 windows

added a config flag  "master:allow_small_split"
added config to minimum windows check.
TODO: check that no bug added (remove all masters?)

* IMPL:FIX: multiple master windows full width

Implemented the ability to have multiple master windows filling the full
monitor width in master mode.
this is controlled by the config option master:allow_small_split
(true/false)
this defaults to false as it was the original behaviour before this
patch

* BUGFIX: corrected issue with blanks re: addmaster

FIX 1: Treat ORIENTATION_CENTER the same as ORIENTATION_LEFT unless
there are enough STACK_WINDOWS to fill both wings.
FIX 2: enforced last window always set as master in
MasterLayout::CHyperMasterLayout::calculateWorkspace();
FIX 3: fix 2, also fixed focus issues previously noted.

* Changes requested by vaxerski

changed how we access config variables (by reference not value)
fixed a regression previously missed prior to requested changes.
I had somehow broken the very functionality i meant to add.

* added static keyword to config variables

* removed superfluous static tags

I made a mistake with making too many variables static.
this made them only evaluate once per runtime breaking things majorly.
My appologies. I haven't touched C++ in nearly 20 years.

* remove annoying comment

---------

Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
2023-04-13 15:20:58 +01:00
vaxerski
4bc3f9adbe config: ignore invalid paths in configPaths 2023-04-12 22:00:39 +01:00
vaxerski
a22e1174ee screencopy: implement dmabuf 2023-04-12 21:40:51 +01:00
vaxerski
985764c8db listeners: more safety around change 2023-04-12 20:18:55 +01:00
vaxerski
5f000306f5 popups: send scale info 2023-04-12 18:00:07 +01:00
Kajetan Puchalski
efee6a1cda swallow: Add swallow_exception_regex (#2026)
Currently, if a window class is specified in the swallow_regex (e.g.
Kitty) it will swallow every other window spawned by it automatically.
Many other WMs implementing this functionality allow for defining
exceptions from this rule. For instance, we want Kitty to swallow sxiv
or zathura but we do not want Kitty to swallow something like wev.

This commit adds an additional regex - swallow_exception_regex where
these exceptions can be defined. This regex is then compared against the
title of the window about to be swallowed and if it happens to be a
match, aborts the swallowing.

This works because whenever an application that could be swallowed is
launched by a terminal, the class of the terminal remains the same while
the title changes to whatever the application's name is, thus letting it
be matched against a regex.
2023-04-12 13:38:15 +01:00
vaxerski
a68feb5aa0 internal: guarantee activeWindow event type 2023-04-12 13:11:38 +01:00
vaxerski
293df75b97 renderer: workspace rendering improvements 2023-04-12 13:05:57 +01:00
vaxerski
f00e11d457 renderer: fix incorrect delta calc 2023-04-12 12:50:20 +01:00
vaxerski
0fd09579a1 renderer: reset renderModif on fullscreen render 2023-04-12 12:45:16 +01:00
vaxerski
3ae33b951f renderer: add support for rendering workspaces 2023-04-12 12:41:23 +01:00
vaxerski
92fecb8ad4 internal: don't iterate special workspaces in move 2023-04-12 11:24:36 +01:00
Stanisław Zagórowski
ac2cd0f0dc plugins: Add "tick" event (#2029) 2023-04-12 11:18:33 +01:00
Max Verevkin
c2f29be9ba make ext_workspace_unstable impl more atomic (#2023) 2023-04-11 14:28:32 +01:00
vaxerski
16a034a34a keybinds: send pass with a null keymap 2023-04-10 22:42:05 +01:00
vaxerski
ea77622e04 input: send null keycodes on focusSurface 2023-04-10 22:37:55 +01:00
vaxerski
a38b0e736d hyprctl: don't assume output validity in hyprctl workspaces 2023-04-10 21:52:14 +01:00
Hilmar Wiegand
7b43f9f056 Implement window move (#2018) 2023-04-10 20:07:49 +01:00
vaxerski
fa4aef4531 args: print help on invalid arg 2023-04-10 18:26:36 +01:00
vaxerski
56a307d734 Revert "keybinds: avoid sending release on suppressed press"
Issues with XWayland

This reverts commit a1b1480c21.
2023-04-10 15:47:20 +01:00
Hilmar Wiegand
6a4bda60f2 Allow movefocus for empty workspaces (#2011)
* Allow switching to empty workspaces using movefocus

* Allow switching to other workspaces when no windows are focused

* Implement review feedback

* Add option to disable focus fallback

* Remove unnecessary braces
2023-04-10 14:40:03 +01:00
Mihai Fufezan
16d05a5c8b nix/*module: use mdDoc for documentation
Simplify and add more info to the docs.
2023-04-10 15:51:01 +03:00
Mihai Fufezan
7faead75bd nix: update xdph
workflows/nix-update: update all inputs
2023-04-10 14:53:50 +03:00
vaxerski
a1b1480c21 keybinds: avoid sending release on suppressed press 2023-04-10 00:56:08 +01:00
Mihai Fufezan
f3909cf2bf flake.lock: update hyprland-protocols and xdph 2023-04-09 22:03:00 +03:00
vaxerski
4ae784dc53 input: fix kb focus on top layers without interactive flag 2023-04-09 19:53:31 +01:00
vaxerski
dd2372d2e6 deps: update hyprland-protocols 2023-04-09 19:46:34 +01:00
vaxerski
c03db1a1cd props: bump to 0.24.1 2023-04-09 18:12:00 +01:00
vaxerski
3ade6c4a96 renderer: fixup damage repaint 2023-04-09 17:59:24 +01:00
Vaxry
046ad79d11 GlobalShortcuts protocol impl (#1886)
Implements the `hyprland-global-shortcuts-v1` protocol

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2023-04-09 13:48:20 +01:00
vaxerski
e4e653ada6 socket2: receive bytes to avoid endless loops 2023-04-08 23:14:12 +01:00
vaxerski
b32af6ebfb hyprctl: sanity check icons in notify 2023-04-08 18:53:54 +01:00
vaxerski
86852cdc78 textInput: don't double destroy TI 2023-04-08 15:39:14 +01:00
vaxerski
31963f823b screencopy: fix crash in invalid format reads 2023-04-08 13:35:36 +01:00
vaxerski
3ce19e67fe version: bump to 0.24.0 2023-04-08 13:08:56 +01:00
Mihai Fufezan
10b9e9bbe5 nix/xwayland-hidpi: update patch 2023-04-08 00:01:48 +03:00
scorpion-26
07e4ba9d80 Fix crash in CConfigManager::parseKeyword (#1983)
If debug:manual_crash is set on startup, parseKeyword tries
to call g_pHyprNotificationOverlay->addNotification, but
g_pHyprNotificationOverlay isn't initialized yet (is nullptr)

This commit adds a sanity check for that.
2023-04-07 20:15:11 +01:00
vaxerski
5e2d4d644a screencopy: fix crash 2023-04-07 19:21:47 +01:00
vaxerski
50876f1b15 screencopy: fix read on incorrect monitor render 2023-04-07 19:11:30 +01:00
vaxerski
c2a85c9d36 screencopy: minor fixes for damage_ring 2023-04-07 18:04:02 +01:00
vaxerski
41d1fdedf2 output: handle needs_frame 2023-04-07 17:25:56 +01:00
vaxerski
cd1b982b2a internal: listen to output.damage events 2023-04-07 16:31:55 +01:00
Andrew Nitrogenesis
a35ea4d242 Better and more secure argument parsing, and code reformatting (#1976)
* Better and more secure argument parsing, and code reformatting

* Changes to resolve PR conversation

* Formatted via clang-format, fixed typos

* More typos
2023-04-07 15:03:26 +01:00
vaxerski
d8645cd148 internal: release buttons on unmap 2023-04-07 12:54:11 +01:00
vaxerski
c9f7afbf78 subsurfaces: guard node's surface 2023-04-07 12:36:26 +01:00
Andrew Pritchard
dfb78e0593 Fix swiping onto a new workspace with multiple monitors. (#1971)
The previous code could run into issues into the following circumstances:

* The focused monitor is on its rightmost workspace with ID `i`.
* Another monitor has a workspace with ID `i+1`.
* `workspace_swipe_create_new` is enabled.

Then, swiping rightwards attempts to target a new workspace with ID
`i+1`: completing the swipe gesture unintentionally focuses that
workspace on whichever monitor it's already on while leaving the active
monitor in a broken state where it shows no windows but creates new
windows on the workspace it was previously on; and cancelling the swipe
gesture shifts the entire workspace `i+1` to the right by the width of
the active monitor.

By choosing an ID that doesn't exist, this problematic behavior is
avoided.  More specifically, it's the smallest ID greater than any
existing workspace's ID, because otherwise the new workspace that was
seemingly just created to the right of the rightmost workspace could end
up somewhere in the middle of the workspace order.
2023-04-07 12:18:53 +01:00
vaxerski
24ace03780 internal: migrate to damage_ring 2023-04-07 12:18:40 +01:00
vaxerski
569eaff04c swipe: block on locked session 2023-04-07 11:51:52 +01:00
vaxerski
801a17194c [gha] bump flake inputs 2023-04-06 20:09:01 +00:00
vaxerski
1a5d5bf620 deps: update wlroots 2023-04-06 21:03:53 +01:00
vaxerski
366ebc123b internal: don't remove x11 children on parent remove 2023-04-06 20:59:44 +01:00
vaxerski
bc4a51dbbb internal: make togglefloat better visible on small size deltas 2023-04-06 19:45:59 +01:00
vaxerski
80650b6722 keybinds: allow MOD1 as an alias of ALT 2023-04-06 19:28:09 +01:00
vaxerski
a740e3e517 internal: comply to nofocus on vectorToWindow 2023-04-06 13:17:15 +01:00
vaxerski
19809532df input: ignore constraints on touch 2023-04-06 11:34:18 +01:00
vaxerski
110f3fd658 screencopy: fix incorrect resource error post 2023-04-05 15:19:49 +01:00
vaxerski
a80ba54bbc renderer: don't use simple rect on alphazero stencil 2023-04-04 22:58:58 +01:00
vaxerski
00d199b477 monitors: guard scale in onConnect 2023-04-04 22:54:35 +01:00
vaxerski
eea99abc49 debug: allow manual crash from hyprctl 2023-04-04 22:13:36 +01:00
vaxerski
903d298381 [gha] bump flake inputs 2023-04-04 21:13:11 +00:00
vaxerski
49f0f53f51 deps: update wlroots 2023-04-04 22:11:21 +01:00
vaxerski
2dc02bbb39 [gha] bump flake inputs 2023-04-04 21:06:10 +00:00
vaxerski
e7185b338f debug: minor improvements to manual crash 2023-04-04 22:04:32 +01:00
vaxerski
6519c0308c [gha] bump flake inputs 2023-04-04 13:59:06 +00:00
vaxerski
d154a8da20 deps: update wlroots dep 2023-04-04 14:57:35 +01:00
vaxerski
7d9977d028 debug: added manual_crash 2023-04-04 14:50:03 +01:00
vaxerski
882be7765b toplevelExport: honor overlay_cursor 2023-04-04 00:58:30 +01:00
vaxerski
99314fbe71 render: plug missing software cursor unlocks 2023-04-04 00:46:58 +01:00
vaxerski
bab949599f [gha] build man pages 2023-04-03 22:47:26 +00:00
Vaxry
f81b3eef4f docs: update issue guidelines for asan env 2023-04-03 23:47:01 +01:00
vaxerski
c50df4c0c3 screencopy: allow on legacy renderer 2023-04-03 23:34:08 +01:00
vaxerski
ee85dd6b61 [gha] bump flake inputs 2023-04-03 22:29:28 +00:00
vaxerski
bae19cb10e deps: update wlroots dep 2023-04-03 23:24:09 +01:00
vaxerski
2f7fb2f553 input: don't set icon on held buttons without a drag 2023-04-03 23:17:06 +01:00
vaxerski
23001f6144 input: don't overset resize icons on drag 2023-04-03 23:15:33 +01:00
vaxerski
55d585ce17 input: fix click-to-refocus not working on loose 2023-04-03 23:09:44 +01:00
vaxerski
d3b0c90356 internal: rename ensureDPMS to ensureMonitorStatus 2023-04-03 22:52:09 +01:00
vaxerski
a43b18ae26 Feat: add initial class/title to hyprctl clients 2023-04-03 19:16:51 +01:00
Vaxry
0a099ca2ab Hyprland Screencopy impl (#1800)
---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2023-04-03 17:01:05 +01:00
vaxerski
e6211eef00 log: Move stdout log disabling to the end of init 2023-04-03 10:41:49 +01:00
vaxerski
b1426cad28 input: fix minor issue with holding focus 2023-04-02 13:42:57 +01:00
vaxerski
0fc145c52c input: hold focus on mouse buttons 2023-04-02 13:30:45 +01:00
vaxerski
c2b25f4701 swallow: move swallowed on workspace change 2023-04-02 10:24:17 +01:00
vaxerski
88a96110b7 config: default no direct scanout to true 2023-04-01 19:37:30 +01:00
vaxerski
2b4d96e0ef examples: pull correct wlr dirs in example plugin 2023-04-01 02:22:52 +01:00
Jan Beich
16bc5997bb Misc FreeBSD fixes (#1926)
* helpers: drop incomplete GNU/kFreeBSD bits

Debian with FreeBSD kernel lacks Wayland-related packages and is not
officially supported since Jessie.

* KeybindManager: check VT ioctl availability instead of hardcoding

* plugins: add missing header for libc++ after 430778293e

src/plugins/PluginAPI.cpp:299:33: error: implicit instantiation of undefined template 'std::basic_istringstream<char>'
    std::istringstream          inStream(SYMBOLS);
                                ^
/usr/include/c++/v1/iosfwd:140:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_istringstream;
                               ^

* plugins: prefer llvm-nm with Clang after 430778293e

nm: invalid option -- j
2023-03-31 20:39:04 +01:00
vaxerski
7680cd549c plugins: mark getFunctionAddressFromSignature deprecated 2023-03-31 18:43:00 +01:00
vaxerski
1df8b1957e plugins: use new lookups in example 2023-03-31 18:34:24 +01:00
vaxerski
430778293e plugins: Add an API entry for finding functions by name 2023-03-31 18:31:11 +01:00
vaxerski
de3b00b5ee renderer: go back to rendering layers without reverse 2023-03-31 17:44:36 +01:00
vaxerski
24ef5d888c [gha] build man pages 2023-03-31 12:17:19 +00:00
vaxerski
5688e24b8a docs: update crash report dirs 2023-03-31 13:16:52 +01:00
NotAShelf
3d9bf17f11 crashReporter: try $XDG_CACHE_HOME before $HOME (#1920) 2023-03-31 13:15:24 +01:00
vaxerski
614ea53ad7 Renderer: fix dim easing 2023-03-30 21:08:20 +01:00
vaxerski
b88de63abb Input: fix always_follow_on_dnd 2023-03-30 00:34:24 +01:00
Alexander Seiler
60527ab180 Fix some typos (#1907)
Signed-off-by: Alexander Seiler <seileralex@gmail.com>
2023-03-29 23:44:25 +01:00
vaxerski
d6241a3086 windows: only connect unmap when mapped 2023-03-28 20:17:47 +01:00
vaxerski
df54ab40ce layer: allow focus on top/overlay surfaces without a window 2023-03-28 17:21:11 +01:00
vaxerski
6fec5bfbeb keybinds: improve movefocus on fullscreen 2023-03-27 15:19:27 +01:00
Oliver Ni
e994b0c8b8 Fix nix build options 2023-03-27 11:00:37 +03:00
vaxerski
3343aac6bf feat: add forcergbx rule 2023-03-26 02:00:24 +01:00
vaxerski
41f7736c85 config: default manual animations to false 2023-03-24 22:24:12 +00:00
vaxerski
c418007c68 shaders: fix missing discardAlphaZero 2023-03-24 19:43:50 +00:00
vaxerski
cc2c270dde log: log wlr logs to stdout 2023-03-24 19:38:09 +00:00
vaxerski
70e3cb8151 feat: add debug:enable_stdout_logs 2023-03-24 19:37:37 +00:00
Vaxry
a80f8f257f Feat: Introduce render_ahead_of_time (#1863) 2023-03-24 19:23:16 +00:00
vaxerski
b3a70b565e subsurfaces: avoid reading destroyed surfaces 2023-03-24 18:44:42 +00:00
vaxerski
e73c6fd3b0 logs: disable stdout after init 2023-03-24 13:00:54 +00:00
vaxerski
a5a0434fff dbus: don't update vars in nests 2023-03-24 03:21:38 +00:00
vaxerski
463690a27a keybinds: allow code: prefix 2023-03-23 13:05:23 +00:00
vaxerski
471ac474a1 core: remove old redundant shutdown stuff 2023-03-23 03:07:57 +00:00
vaxerski
a3fda12ba1 window: unassign surface on unmap 2023-03-23 00:39:32 +00:00
vaxerski
0268bb9888 surface: set to nullptr after destroy() 2023-03-23 00:22:49 +00:00
vaxerski
3a3a3f7bdb popups: fix heap-use-after-free 2023-03-23 00:22:49 +00:00
Mihai Fufezan
cf51a31807 Nix: disable HiDPI for default package
NOTE: the package `hyprland-no-hidpi` was removed, and instead
`hyprland-hidpi` exists now.
2023-03-22 19:10:46 +02:00
Mihai Fufezan
5be42965ff Nix: rebase wlroots-hidpi patch 2023-03-22 19:10:46 +02:00
vaxerski
a8b3be2c9c config: add misc:suppress_portal_warnings 2023-03-22 12:17:16 +00:00
staz
5ce91bb0fd Added overflow check for blur radius (#1847)
* internal: added overflow check for blur radius

---------

Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
2023-03-21 19:01:24 +00:00
vaxerski
adf5d8a114 monitors: update surface outputs on recover from unsafe 2023-03-21 17:46:26 +00:00
vaxerski
cb229f6436 compositor: adjust xdp error cases 2023-03-20 22:26:54 +00:00
vaxerski
e80e93fcda [gha] bump flake inputs 2023-03-20 21:57:13 +00:00
vaxerski
37ced6aca4 wlroots: update dep 2023-03-20 21:53:00 +00:00
Mihai Fufezan
5ffe5dd594 Nix: add pango dep 2023-03-20 18:22:34 +02:00
lisuke
dc78c58c77 fix: a fullscreen bug. (#1821) (#1831) 2023-03-20 16:07:18 +00:00
vaxerski
22721a37d5 hyprctl: add notify 2023-03-20 16:00:54 +00:00
vaxerski
dd4270eadf notifs: add ICON_OK to icons 2023-03-20 15:49:46 +00:00
vaxerski
e2923a9385 meson: add pango deps 2023-03-20 15:39:43 +00:00
vaxerski
316674fecf notifs: use empty color for auto 2023-03-20 15:32:11 +00:00
vaxerski
34da16b7e6 plugin api: add addNotificationV2
Allows for issuing fancy notifs via api
2023-03-20 15:23:25 +00:00
vaxerski
71a95a581f feat: add pretty notifications 2023-03-20 15:03:09 +00:00
Vaxry
788a8f7c13 internal: wrap wlr surfaces (#1822) 2023-03-20 15:00:58 +00:00
vaxerski
d23bbd1687 workspaces: preserve pin on moves 2023-03-20 01:50:46 +00:00
vaxerski
7a514f41a3 Focus: warp cursor on movewindow 2023-03-20 01:42:21 +00:00
vaxerski
928de33447 monitors: more guards for safety 2023-03-19 02:19:52 +00:00
Mihai Fufezan
0624455591 Meson: add rdynamic ld flag 2023-03-18 21:01:24 +02:00
vaxerski
2ba5238b8e groups: fix moving between displays 2023-03-18 16:30:29 +00:00
vaxerski
00c2ca4697 config: improve ux on workspace and transform 2023-03-18 16:12:43 +00:00
vaxerski
d544c30551 LS: don't try to get rules on non-existent ls 2023-03-18 15:02:00 +00:00
vaxerski
ef80a69399 config: fix long variables being substrd 2023-03-18 14:57:59 +00:00
vaxerski
6e6971606d windowrules: allow monitor by str 2023-03-18 01:34:06 +00:00
vaxerski
e5ad53ac42 config: make default config use hyphenated dev names 2023-03-18 01:06:03 +00:00
vaxerski
e98ee49aee LS: fix support for legacy blurls 2023-03-17 23:36:36 +00:00
vaxerski
d797d9905d LS: support address: in layerrules 2023-03-17 23:33:03 +00:00
vaxerski
e5870d47c7 LS: add blur and ignorezero rules 2023-03-17 23:16:13 +00:00
vaxerski
91a565c7b0 monitors: don't refocus on apply rule 2023-03-17 20:34:33 +00:00
vaxerski
5b924aaf60 crashReporter: add hl ver 2023-03-17 11:51:16 +00:00
vaxerski
606cb2832a keybinds: remember last workspace on focusmonitor 2023-03-16 16:40:28 +00:00
vaxerski
4b52c1e68f monitors: remove from monitors on unsafe 2023-03-16 16:33:27 +00:00
vaxerski
e77ebec629 monitors: guard output in damageSurface 2023-03-16 16:32:03 +00:00
vaxerski
162f235972 switches: do not fire on no change in toggle 2023-03-16 16:30:22 +00:00
vaxerski
e8adae65fe debug: unbreak debug builds 2023-03-16 15:40:50 +00:00
vaxerski
96718d8b09 dpms: fix keyboard dpms 2023-03-16 15:29:48 +00:00
vaxerski
5d44ea802a monitors: guard output when read 2023-03-16 14:03:40 +00:00
vaxerski
d9d57ce39a monitors: fix segfault on non-unsafe remove 2023-03-16 01:04:54 +00:00
vaxerski
3e261b1fa7 dpms: fix key_press_enables_dpms 2023-03-16 00:30:07 +00:00
vaxerski
cee7f11d8b hyprctl: ignore null output monitors 2023-03-16 00:18:44 +00:00
Mihai Fufezan
1c67849bf1 Nix: fix meson patch again 2023-03-15 20:45:44 +02:00
Mihai Fufezan
595f2052c4 Nix: fix meson patch 2023-03-15 20:29:25 +02:00
vaxerski
f5669a7d6b events: guard output in change 2023-03-15 17:01:20 +00:00
vaxerski
25d3d73dbf monitors: fixes to unsafe mode 2023-03-15 15:11:41 +00:00
Mihai Fufezan
569ae86c90 props.json: update to 0.23.0 2023-03-15 00:29:21 +02:00
Vaxry
8531d1d7a6 Readme: update to mention plugins 2023-03-14 21:56:31 +00:00
stephan-cr
e4b6af41e5 Refactor CMake and Make file (#1766)
* Refactor CMake and Make file

- modernize CMake a bit
- "unscreamify" CMake commands
- replace undocumented CMake option -H by -S in Makefile
- remove unnecessary "cd" in Makefile

* Fix include path to wlroots generated header files
2023-03-14 21:50:30 +00:00
vaxerski
d63e8c8f45 ime: account for text height in popup calcs 2023-03-14 16:46:39 +00:00
vaxerski
7e5a3eb045 ime: fix panels overflowing on corners 2023-03-14 16:12:25 +00:00
vaxerski
f960f72785 input: minor fixes for tiv1 2023-03-14 14:37:00 +00:00
vaxerski
0807b8b95f tiv1: minor fixes for crashes 2023-03-14 13:51:08 +00:00
Vaxry
5dc1a5fec6 input: text-input-v1 support (#1778)
support zwp_text_input_v1

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2023-03-14 12:57:50 +00:00
vaxerski
e749af7b60 dispatchers: remember named workspaces in prev 2023-03-13 15:19:25 +00:00
vaxerski
17deeb07ad master: better cycle 2023-03-13 01:07:05 +00:00
vaxerski
bcd8fe9573 groups: add deco on moveIntoGroup 2023-03-13 00:47:57 +00:00
vaxerski
146d231ec5 config: add key_press_enables_dpms 2023-03-12 13:46:38 +00:00
vaxerski
71ef1bde7e dispatchers: disallow togglesplit on fullscreen 2023-03-11 17:58:34 +00:00
vaxerski
253286669a groups: fix fullscreen behavior with groups 2023-03-10 15:19:09 +00:00
Mihai Fufezan
0ad2d9f0b5 Nix: fix build on aarch64 2023-03-10 11:45:39 +02:00
vaxerski
c9167d9646 blurls: fix address substr length 2023-03-09 14:24:06 +00:00
vaxerski
ca1c1438e3 Compositor: fix crash on exit 2023-03-09 14:19:54 +00:00
vaxerski
878fe20409 [gha] build man pages 2023-03-09 10:55:40 +00:00
Benjamin Asbach
5a5c41301d bugifx: updated urls poiting to old wiki pages (#1738)
Co-authored-by: Benjamin Asbach <asbachb@users.noreply.github.com>
2023-03-09 10:55:17 +00:00
vaxerski
92d2331170 Events: Avoid sending std::nullptr_t in keyboardFocus 2023-03-08 09:46:17 +00:00
vaxerski
a85a6fa6c8 Dwindle: Added default_split_ratio 2023-03-07 14:24:10 +00:00
Stanisław Zagórowski
b11e2eaa3b Fix plugin argument-less hyprctl calls (#1723)
Handle hyprctl command whitespace trimming

might break
2023-03-07 10:42:33 +00:00
vaxerski
0aeb61a95a Opengl: Fix forcefully setting missing time prop to final shader 2023-03-06 19:02:08 +00:00
hillyu
4f647a8e8b fix mfact not applying to addmaster (#1715)
Co-authored-by: Hill <hillyu@live.com>
2023-03-06 09:03:49 +00:00
Jan Beich
7739b776cd config: explicitly use environ(7) after b03c8970e6 (#1708)
src/config/ConfigManager.cpp:40:23: error: use of undeclared identifier 'environ'
    for (char** env = environ; *env; ++env) {
                      ^
2023-03-05 18:39:46 +00:00
opsu
0c8d1ba4a8 Buffer overflow fix (#1707) 2023-03-05 18:16:42 +00:00
hillyu
7ce92f93ad add mfact setting for master layout (#1666)
* add mfact setting for master layout

---------

Co-authored-by: Hill <hillyu@live.com>
2023-03-05 16:29:23 +00:00
vaxerski
b03c8970e6 Allow environment in config 2023-03-05 14:54:32 +00:00
scorpion-26
de5f1b2a83 Optionally expose time to screen shaders (#1700)
* Optionally expose time to screen shaders

Since that collides with damage tracking, it will only be done, when
damage tracking is disabled, meaning this comes at no cost for everyone
not using time.

* Rename m_Timer to m_tGlobalTimer
2023-03-05 14:05:30 +00:00
vaxerski
dc7d783d14 Initialize priority managers before server init 2023-03-05 13:37:21 +00:00
vaxerski
8e5ee31f30 Add env to example cfgs 2023-03-05 13:37:05 +00:00
vaxerski
90c5715bc6 add env dbus opt 2023-03-05 13:15:12 +00:00
vaxerski
d5093f7af0 add env keyword to cfg 2023-03-05 13:12:01 +00:00
vaxerski
4abc608bc0 update dbus env on exec-once dispatches 2023-03-05 12:53:02 +00:00
Mihai Fufezan
7bae0823c8 Nix: move dependency overrides inside wlroots-hyprland call
This fixes overlays failing to build.
Fixes #1704
2023-03-05 14:10:55 +02:00
Mihai Fufezan
5184b542b1 nix: show commit in hyprctl 2023-03-04 18:22:36 +02:00
vaxerski
fea2031bfe systemd: expand sysd import env script 2023-03-04 15:21:27 +00:00
Mihai Fufezan
be22172a35 Nix: simplify CI 2023-03-04 17:03:33 +02:00
vaxerski
b69f40815f opengl: use a passthru shader for final wlr copy 2023-03-04 14:59:27 +00:00
scorpion-26
f678789dfd Fix clang compilation (#1697)
void* + integral type is not allowed on standard C++ and is a GNU
extension
2023-03-04 14:02:40 +00:00
Mihai Fufezan
c386c52cf9 Nix: fix hidpi patch 2023-03-04 15:51:54 +02:00
vaxerski
c444099325 Mirrors: remove accidentally leftover logs 2023-03-04 01:06:16 +00:00
vaxerski
31cd104286 fix warns 2023-03-04 00:53:42 +00:00
vaxerski
1ead6c46f4 Mirrors: minor fixes 2023-03-04 00:48:22 +00:00
vaxerski
fb45f8f2f9 crashReporter: remove inconsistent log from crash reports 2023-03-04 00:14:20 +00:00
Mihai Fufezan
c1217066d1 Nix: fix hyprland-no-hidpi 2023-03-04 00:37:00 +02:00
Froggo
3b41169395 Use ${PREFIX} rather than /usr directly in Makefile, and force the build to attempt compilation even if the user does not have ${PREFIX}/lib write permissions (#1688)
* Force the make process to use ${PREFIX} rather than /usr directly, and make the build attempt to continue even if the user does not have write permissions in ${PREFIX}/lib (for libwlroots)

* Prevent insufficient permissions error with make install

---------

Co-authored-by: Froggo8311 <Froggo8311@localhost>
2023-03-03 22:15:15 +00:00
vaxerski
8bfb2ad2b7 ci: fix arch ci 2023-03-03 21:50:02 +00:00
vaxerski
b602ac0970 [gha] bump flake inputs 2023-03-03 21:33:14 +00:00
vaxerski
a34b747661 update wlroots dep 2023-03-03 21:28:22 +00:00
vaxerski
fe007fd36a xwl: don't try to get unmanaged titles 2023-03-03 19:37:25 +00:00
Stanisław Zagórowski
141365cbc1 Fix plugin config breakage (#1687) 2023-03-03 19:32:44 +00:00
vaxerski
51ce3ddd67 layoutmgr: don't reenable layout on unchanged layout 2023-03-03 14:06:01 +00:00
vaxerski
64f35c0e31 Bezier: Fix incorrect binary search in bezier approx 2023-03-03 13:33:52 +00:00
vaxerski
9c0e2bba54 Renderer: Nuke onWindowResize{start/end} 2023-03-03 13:18:44 +00:00
vaxerski
62e0c9226e Up the bezier bake count 2023-03-03 13:17:11 +00:00
vaxerski
c5aa20f226 fix bezier step approx 2023-03-03 13:08:46 +00:00
vaxerski
66b8629964 Update the debug overlay 2023-03-03 12:15:59 +00:00
vaxerski
9e028d56c0 fix credentials of invalid surfaces 2023-03-03 11:17:43 +00:00
vaxerski
489ef7c51c add toggle group lock 2023-03-02 20:50:37 +00:00
vaxerski
34685a836a Move AnimationManager::tick() to an event loop 2023-03-02 17:30:50 +00:00
vaxerski
dea71875e4 add desc: to getMonitorFromString 2023-03-02 12:04:41 +00:00
vaxerski
76fc12869d nuke cursorSI due to crashes 2023-03-01 22:12:26 +00:00
vaxerski
556c7dd51f reset signal handlers in unrecoverable 2023-03-01 21:55:30 +00:00
vaxerski
52878161e4 add log tail to crash reports 2023-03-01 15:14:35 +00:00
vaxerski
6c250df77e generate coredumps on sigabrt too 2023-03-01 15:08:44 +00:00
vaxerski
7c5c7ced91 Convert reverse iterators to ranges 2023-03-01 14:06:52 +00:00
vaxerski
3cef005fec use XCURSOR_SIZE for internal cursor size 2023-03-01 13:54:48 +00:00
vaxerski
71496a0a3c Fix fatal aborts with X11 OR windows 2023-03-01 13:47:40 +00:00
vaxerski
86acdcf8b6 nuke unmanagedx11 vector 2023-03-01 13:15:51 +00:00
vaxerski
ea717731a4 Simplfy framebuffer erasing in cleanupFadingOut 2023-03-01 10:06:15 +00:00
vaxerski
72f528cb52 [gha] build man pages 2023-03-01 09:33:29 +00:00
vaxerski
0905515c40 use .txt for crash reports 2023-03-01 09:32:31 +00:00
Mihai Fufezan
50a4a74b4e CI/nix: update nix-install-action 2023-03-01 10:05:54 +02:00
Mihai Fufezan
7cbbf9a850 CI/nix: update nix-install-action 2023-03-01 10:03:21 +02:00
vaxerski
0e252d2c77 Don't set surface cursors for overriden 2023-02-28 23:17:27 +00:00
Stanisław Zagórowski
5c93f6947a Unload plugins on compositor cleanup (#1662) 2023-02-28 23:11:49 +00:00
vaxerski
07b98952bc Reset cursor to pointer on focus on interactable deco 2023-02-28 23:06:46 +00:00
vaxerski
cd2399715d Revert small incorrect change to dragging 2023-02-28 22:53:41 +00:00
vaxerski
2187c6cf43 Allow decos to request interactivity 2023-02-28 22:32:42 +00:00
vaxerski
984c2fdc68 Enable manual anims by default 2023-02-28 22:15:18 +00:00
vaxerski
a224d366ca Added mouseMove event 2023-02-28 21:47:00 +00:00
vaxerski
5e48e6b075 Added mouseButton event 2023-02-28 21:45:57 +00:00
vaxerski
72fc309fb1 make window reserved area less stupid 2023-02-28 21:18:13 +00:00
Dashie
7187ea443e Add option to disable/enable mouse window dragging animations (#1658) 2023-02-28 20:50:10 +00:00
vaxerski
91fd854e3b fix warn 2023-02-28 19:37:00 +00:00
vaxerski
4b20d4f1ad Added decoration reserved area 2023-02-28 19:36:36 +00:00
vaxerski
7beb9fd606 Draw HyprError on the last monitor 2023-02-28 19:18:13 +00:00
vaxerski
4d3f2ca96b minor fixes to touch handling 2023-02-28 19:02:30 +00:00
vaxerski
99b7d53817 deny configure requests on drag 2023-02-28 18:52:03 +00:00
vaxerski
7e523e4d5e minor fixes to X11 configure/or handling 2023-02-28 18:50:47 +00:00
vaxerski
89e7d812c8 Include unmapped and hidden windows in hyprctl clients 2023-02-28 12:41:46 +00:00
vaxerski
ac251d7a66 allow focus to grouped windows 2023-02-28 12:34:59 +00:00
vaxerski
49f423aa8f update decos on anim values update 2023-02-27 23:34:41 +00:00
vaxerski
18229043fa Remove useless rax preserve across callq 2023-02-27 19:47:42 +00:00
vaxerski
03d7651916 Plugin Hooks: fix original bytes on %rip accesses 2023-02-27 19:17:58 +00:00
vaxerski
c5d741fb39 Plugin Hooks: fix calls to %rip offsets 2023-02-27 18:34:53 +00:00
vaxerski
3bceabe29b add plugin support to readme 2023-02-27 15:26:44 +00:00
vaxerski
5da96132b9 fix make install 2023-02-27 14:36:59 +00:00
vaxerski
15d108fbc1 fix make install 2023-02-27 14:08:29 +00:00
Vaxry
8b81f41e52 Plugin System (#1590)
---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2023-02-27 12:32:38 +00:00
vaxerski
74a10f26a4 remove old unused animation cfgs 2023-02-26 23:14:26 +00:00
Marcus Kellerman
492f36f7df Added center orientation to master layout (#1642)
* Added center orientation to master layout to improve experience on ultra widescreen monitors.

* Added support for orientationcenter layout message for master layout

* Added ability to optionally always center master window when in centered master mode.
2023-02-26 23:12:14 +00:00
vaxerski
2e21ad875b fix cursor image on drag not resize 2023-02-26 23:08:20 +00:00
vaxerski
18ed73f091 Added moveoutofgroup dispatcher 2023-02-26 13:55:35 +00:00
vaxerski
55b412e0f4 Added moveintogroup dispatcher 2023-02-26 13:52:11 +00:00
Ryan Dwyer
3bfaeacf7d movefocus: Set new workspace as active when focusing new monitor (#1640) 2023-02-26 13:44:11 +00:00
Mihai Fufezan
e302724847 use corner cursors on resize (#1638) 2023-02-26 03:56:23 +02:00
vaxerski
edd0a141de don't snap on empty hint 2023-02-25 22:19:51 +00:00
vaxerski
cf566b59ce allow blurls by address 2023-02-25 17:39:26 +00:00
vaxerski
1089e858b4 fix changegroupactive back 2023-02-24 17:24:51 +00:00
vaxerski
60e37d727d fix cyclenext on empty focus 2023-02-23 14:27:43 +00:00
vaxerski
14a2de0d0e add mouse_left _right 2023-02-23 13:55:27 +00:00
vaxerski
2bf7f9e413 fixup constraint snapping on no hint 2023-02-22 23:16:11 +00:00
Ching Pei Yang
513bbb8047 Resize on border icon bug (#1608)
* fix: reset border hover icon on setting empty focus

* cleanup comment

* fix: reset border hover icon on layer surface
2023-02-21 23:57:38 +00:00
vaxerski
f1c9077139 unblock pure wayland compiles 2023-02-21 23:57:08 +00:00
vaxerski
66e3679ba3 Conform to X11 OR surfaces wanting focus 2023-02-21 20:47:02 +00:00
vaxerski
708bb014e9 use sans for fonts instead of noto sans 2023-02-21 19:07:30 +00:00
o69mar
ca3c8cdfae update license on main branch (#1604)
* Update LICENSE
2023-02-21 19:01:40 +00:00
vaxerski
a66ef50469 added a lockgroups dispatcher 2023-02-21 12:13:41 +00:00
vaxerski
431c74f111 remove -g from release compiles 2023-02-20 23:17:31 +00:00
vaxerski
f023126a73 bump ver to 22 2023-02-20 23:05:50 +00:00
Jan Beich
474ada9267 Unbreak CrashReporter on FreeBSD (#1589) 2023-02-20 14:15:15 +00:00
vaxerski
784cdd7638 abort instead of exiting on sigsegv 2023-02-20 11:02:44 +00:00
vaxerski
fc49a055c6 fix warn 2023-02-20 11:01:03 +00:00
vaxerski
be8cf8ea1e Generate symbol info in release for crash reports 2023-02-20 10:57:10 +00:00
vaxerski
0eee57aab9 fixup backtrace curpath 2023-02-20 10:28:16 +00:00
vaxerski
ecd0156265 fix group data in hyprctl 2023-02-20 09:28:42 +00:00
vaxerski
cd6640e890 unset hidden at grouped remove 2023-02-19 23:26:36 +00:00
vaxerski
40622a9e60 properly meld groups together 2023-02-19 22:19:40 +00:00
vaxerski
df2956b411 ignore hidden in allfloat 2023-02-19 22:14:37 +00:00
Vaxry
e5a4c0c986 Group/Tab Rework (#1580) 2023-02-19 21:07:32 +00:00
vaxerski
2363cc2572 bump ver to 21 2023-02-19 20:59:25 +00:00
Vaxry
1b56cc4e99 Added an Event Hook System (#1578)
* added an eventHookSystem

* Add all socket2 events to hooks
2023-02-19 20:54:53 +00:00
vaxerski
6e16627cbc Added execr 2023-02-19 13:59:47 +00:00
vaxerski
67e13fbb64 [gha] build man pages 2023-02-19 13:54:11 +00:00
vaxerski
ad28321a8d update issue guidelines for crash reports 2023-02-19 13:53:38 +00:00
vaxerski
0e5df91e3a adjust crash report paths 2023-02-19 13:51:40 +00:00
vaxerski
38c25bb50d Added a crash reporter 2023-02-19 13:45:56 +00:00
vaxerski
6548439f6c remove constraint recheck log 2023-02-19 12:15:33 +00:00
Ching Pei Yang
c92e0c05e4 Resize on border (#1347) 2023-02-18 22:35:31 +00:00
vaxerski
b944386ca5 reset focus on lock surface destroy 2023-02-18 01:09:01 +00:00
eriedaberrie
be2e4d9dd1 Fix VRR JSON output in hyprctl monitors (#1562) 2023-02-17 10:37:38 +00:00
vaxerski
dbfa6eea7b fixup stutter in rendering with toplevel_export 2023-02-16 22:51:38 +00:00
scorpion-26
f3d1ab55a2 Add vrr to hyprctl monitor (#1560)
Since the (re)addition of vrr in 127e80692f,
it is very useful to know, whether a given monitor has vrr enabled or not,
since not all monitors support it. Now hyprctl reports, whether a
monitor has vrr enabled or not.
2023-02-16 22:20:10 +00:00
vaxerski
ff95721ad9 fix compile for single_pixel_buffer_v1 2023-02-16 13:37:46 +00:00
vaxerski
d710e7347a enable single_pixel_buffer_v1 2023-02-16 12:55:52 +00:00
vaxerski
3fbef25ffc refocus on monitor attach 2023-02-16 12:55:52 +00:00
Mihai Fufezan
ab6a092dbc Nix CI: add GH token (#1557) 2023-02-15 20:45:23 +02:00
wsippel
1992f27a26 ignore VR headsets (#1555)
* ignore VR headsets

don't interact with screens that have the non_desktop property set, fixes #1553

* remove superfluous curly braces
2023-02-15 14:50:51 +00:00
vaxerski
f37866eb7e fix quick start link 2023-02-14 20:28:33 +00:00
vaxerski
87a4cc7654 rethink visible flag in animmgr 2023-02-14 17:44:09 +00:00
vaxerski
fdc847706a ignore damage on hidden windows in animationmanager 2023-02-14 17:14:09 +00:00
vaxerski
61c817319f don't loop border anim on disabled 2023-02-14 17:10:17 +00:00
vaxerski
127e80692f move no_vfr to vfr and add vrr 2023-02-14 17:08:42 +00:00
nub
98c95aa34d focusCurrentOrLast dispatcher (#1545) 2023-02-14 00:46:58 +00:00
vaxerski
6b7e409f05 properly clamp size in dragging floating corners 2023-02-12 22:24:47 +00:00
vaxerski
79ad93d536 clear focus on lockscreen refocus 2023-02-12 19:20:13 +00:00
vaxerski
7d914cd427 force monitor focus on refocus 2023-02-12 10:38:37 +00:00
vaxerski
287f31329e fix json output in hyprctl animations 2023-02-11 20:54:37 +00:00
Philipp Mildenberger
97e0f02621 Fix some issues with a lost focus of the maximized window after using swapwithmaster in fullscreen mode (#1524)
* Fix some issues with a lost focus of the maximized window after using swapwithmaster in fullscreen mode

* Keep current fullscreen mode when `prepareNewFocus` is executed
2023-02-11 13:00:05 +00:00
vaxerski
bda8208aaa render lockscreen in fullscreenworkspace 2023-02-10 22:03:28 +00:00
Philipp Mildenberger
42f4664022 Added support for layoutmsg params and added the param 'newfocus' for 'swapwithmaster' and 'focusmaster' (#1522)
* Added support for layoutmsg params and added the param 'newfocus' for 'swapwithmaster' and 'focusmaster', which lets the user decide what the new focused window should be
2023-02-10 19:13:38 +00:00
vaxerski
d1a7f1dd36 don't alter LS geom on unmap 2023-02-10 12:54:57 +00:00
vaxerski
1dde751da4 fixup LS fs-v1 calcs 2023-02-10 12:53:43 +00:00
David BELEY
7b05133af0 Only use true/false in default config to reduce confusion (#1517) 2023-02-10 00:43:01 +00:00
vaxerski
68f56130ba add misc:mouse_move_focuses_monitor 2023-02-09 15:29:02 +00:00
vaxerski
4ea4efb871 add prev to getWorkspaceIDFromString 2023-02-09 14:15:42 +00:00
Frank Tao
48c86ad863 Update CMakeLists.txt (#1514) 2023-02-09 08:57:26 +00:00
vaxerski
859d6b9b8a fixup ls geom calcs on wp-fs-v1 2023-02-08 22:54:26 +00:00
vaxerski
cb6c47098d use surface size to determine LS size 2023-02-08 22:37:30 +00:00
vaxerski
5eb98c0072 improve VRR state checking with updates to mosthz 2023-02-08 15:18:54 +00:00
vaxerski
863812a097 added activewindowv2 2023-02-06 13:16:59 +00:00
Saltaformajo
4a5c3c4861 explicit config path for autoreload config #1423 (#1494)
* respect explicit config path for autoreload config
2023-02-05 22:53:13 +00:00
eriedaberrie
15544c7544 Update blurriness of layersurfaces after hyprctl keyword blurls (#1493)
* Update blurriness of layersurfaces after hyprctl keyword blurls
2023-02-05 22:46:20 +00:00
Mihai Fufezan
53945cff31 libinput: add tap_button_map (#1495) 2023-02-05 14:17:23 +00:00
vaxerski
760b37f71d properly rid of whitespace chars from cfg lines 2023-02-04 15:22:03 +00:00
vaxerski
a431c1b01c bring back dynamic ls geom updates 2023-02-04 13:12:56 +00:00
Mihai Fufezan
bd2245d642 meson: build in release by default 2023-02-04 01:13:15 +02:00
Max Verevkin
be6325dd4b ext_workspace_unstable: send done after output_enter when wl_output is bound late (#1481) 2023-02-03 21:25:49 +00:00
vaxerski
fcf1bafb09 conform to unmanaged X11 activate requests 2023-02-03 21:21:19 +00:00
vaxerski
6688421240 minor adjustments to xwayland positioning 2023-02-03 21:21:19 +00:00
Max Verevkin
3e6601fa29 ext_workspace_unstable: send output_enter when wl_output is bound late (#1480) 2023-02-03 19:48:08 +00:00
vaxerski
a0bc0e4998 make a null surface focus reset lastfocus 2023-02-03 17:18:22 +00:00
vaxerski
d81f45e54a clear focus on failed unlock attempt 2023-02-03 17:06:07 +00:00
vaxerski
fd3a1cd086 fix crash with libc++ in appid 2023-02-03 16:17:37 +00:00
vaxerski
494103b521 add missing xwayland stub 2023-02-03 14:12:28 +00:00
vaxerski
8e6950e200 place sessionlock surfaces at correct coordinates 2023-02-03 14:00:23 +00:00
vaxerski
9e40e47a2e [gha] bump flake inputs 2023-02-03 12:47:47 +00:00
vaxerski
a46abd8b1a update wlroots dep 2023-02-03 12:43:43 +00:00
vaxerski
129e99a6f6 Implement ext-session-lock-v1 2023-02-03 11:58:55 +00:00
ozwaldorf
32d56fec97 feat: border angle animations (#1469)
Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
2023-02-01 21:06:01 +00:00
vaxerski
1a41f729a3 fix legacy system call to create hypr dir 2023-02-01 19:51:22 +00:00
ozwaldorf
445f8c71c5 fix(hyprctl): allow dispatcher to have no args (#1464)
* fix(hyprctl): allow dispatch to have no args

* chore: add .idea/ to gitignore
2023-02-01 10:01:56 +00:00
vaxerski
85c07c2fe0 scale the opaque region in blurring 2023-01-31 12:29:23 +00:00
vaxerski
eaf0fb14c9 reset layout-set render vars on floating 2023-01-31 12:15:40 +00:00
vaxerski
11234529db Simulate mouse movement on unmap of popups and subsurfaces 2023-01-31 00:26:15 +00:00
Jan Beich
f90ff8303b Unbreak build with libc++ (#1457) 2023-01-31 00:03:23 +00:00
vaxerski
d4e2a0fd16 simplify nullcheck in minimize 2023-01-30 14:00:02 +00:00
vaxerski
32381fe6c4 send a 1 on unknown minimize event 2023-01-29 17:02:55 +00:00
vaxerski
5d35c0432b add a minimize ipc event 2023-01-29 16:26:14 +00:00
vaxerski
4c4d3b3aa5 fix urgent hint order in code 2023-01-29 16:20:53 +00:00
vaxerski
b2314aa33a err on invalid transform in monitor cfg 2023-01-29 16:04:50 +00:00
vaxerski
ef12120270 fixup LS scaling impl 2023-01-29 15:58:36 +00:00
vaxerski
3d83a0bc5f enable UV calcs for all surfaces 2023-01-29 13:58:47 +00:00
vaxerski
38011c50ab notify of fractional scale for LS-es 2023-01-29 13:30:51 +00:00
Jan Beich
c3adc9ec56 Get active VT via ioctl instead of sysfs after e90c5c6347 (#1448) 2023-01-29 12:44:38 +00:00
Jan Beich
ff9bcb19fa Allow to disable X11 backend separately from Xwayland after 5a750b485a (#1445) 2023-01-29 12:43:18 +00:00
vaxerski
ce632b7a05 prevent early segfaults on default mouse pos 2023-01-28 18:28:38 +00:00
vaxerski
328e034472 fix clang error 2023-01-28 18:10:57 +00:00
vaxerski
1c1e688564 fix crash in nested non-mouse warps 2023-01-28 17:54:14 +00:00
vaxerski
86f4772bd6 fix clang warn 2023-01-28 17:52:32 +00:00
vaxerski
61c9e50bcd warp cursor on login to center 2023-01-28 12:26:38 +00:00
eriedaberrie
af37a3895f fix: cursor changing on window move and resize (#1371)
* Just use grab cursor for everything
2023-01-27 11:31:56 +00:00
vaxerski
666c805101 fix destroying addon in fractional scale impl 2023-01-27 11:29:56 +00:00
vaxerski
94b7b6b584 added binds:focus_preferred_method 2023-01-26 14:36:22 +00:00
vaxerski
06b17db227 don't set cursor when timeout reached 2023-01-26 10:39:06 +00:00
vaxerski
fc89e70a1f better ls noanim handling 2023-01-25 15:38:21 +00:00
vaxerski
8ae1fd0173 added layer rules 2023-01-25 15:34:13 +00:00
vaxerski
9813ba2f56 Add hyprctl animations 2023-01-25 15:16:28 +00:00
vaxerski
12e293e309 update animated deco values after setprop 2023-01-24 23:52:00 +00:00
vaxerski
da23ec847e fix deprecated-copy warn 2023-01-24 22:46:16 +00:00
vaxerski
84954f376f remove restrictions from setprop for ints 2023-01-24 21:44:54 +00:00
vaxerski
5de659cc7a add fakefullscreen prop to windows in hyprctl 2023-01-24 21:29:27 +00:00
vaxerski
e273717a27 fix typo 2023-01-24 19:31:16 +00:00
vaxerski
a2ae37396f add hyprctl setprop 2023-01-24 19:05:43 +00:00
pranaless
eb9fa8460f fix typo (#1420) 2023-01-24 19:20:50 +02:00
vaxerski
e3d1743722 Revert "use spawn in dbus-env activation"
This reverts commit 63babcba36.

oops.
2023-01-24 16:25:18 +00:00
vaxerski
63babcba36 use spawn in dbus-env activation 2023-01-24 14:05:59 +00:00
vaxerski
1cc7587789 recalculate layout on deco or border change 2023-01-24 14:04:01 +00:00
vaxerski
70b5c1b119 fix clamp in monitor relative 2023-01-23 20:56:43 +00:00
DB
7574b3db64 fix: hyprland crashing wenn moving window -1 from first monitor (#1419)
Co-authored-by: xVermillionx <xVermillionx@notvalid>
2023-01-23 20:56:05 +00:00
vaxerski
cb6e36d804 ignore null ls-es in cleanup 2023-01-23 18:23:44 +00:00
vaxerski
2a5ae435e1 allow preblur for opaque surfaces if alpha not 1 2023-01-23 13:55:11 +00:00
vaxerski
c074f260a1 use proper fade anims for hyprerror 2023-01-23 12:04:48 +00:00
vaxerski
cb98242ea7 remove old comment and fixup lsl var name 2023-01-22 17:03:25 +01:00
vaxerski
147be3e10b use goal size for uv calcs 2023-01-22 16:58:10 +01:00
vaxerski
b963a6624e more verbose logging on invalid var 1 in seterror 2023-01-22 16:51:32 +01:00
vaxerski
ef90a7ad13 fix rounding exceeding max in single-line errors 2023-01-22 16:48:45 +01:00
vaxerski
eb7927d278 fix color typo in hyprerror 2023-01-22 16:45:00 +01:00
vaxerski
8f57db28f7 added hyprctl seterror 2023-01-22 16:38:17 +01:00
vaxerski
7d754b7c22 fix cutting geometry on surfaces spilling out 2023-01-22 16:24:51 +01:00
Cyril Levis
fcbfd19393 feat: add focus to urgent or last window (#1402)
* feat: add focus to urgent or last window

* Rename dispatcher

Co-authored-by: Maxim Baz <git@maximbaz.com>
2023-01-21 11:18:55 +01:00
Mihai Fufezan
e811394603 Nix: update waybar-hyprland, add hyprland-nvidia (#1409)
Also add them to CI
2023-01-21 02:26:29 +02:00
vaxerski
434719611d fix focus history on workspace jumps 2023-01-20 20:57:35 +01:00
vaxerski
5814d9b2a0 make hyprerror follow fadein anim 2023-01-20 20:48:07 +01:00
vaxerski
18330dec4e scale hyprerror 2023-01-20 20:21:50 +01:00
Vaxry
60b880d931 wp-fractional-scaling-v1 impl (#1373)
* Initial fractional scaling impl

* apply UV after geom calcs

* fix scaling -> scale

* meson: add fractional scale proto

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2023-01-20 19:44:30 +01:00
vaxerski
cee7bc6e74 small hyprerror revamp 2023-01-20 19:32:41 +01:00
vaxerski
d345804cd5 fix font color in hyprerror 2023-01-20 19:19:07 +01:00
vaxerski
fb2679d5ef add a focus history vec 2023-01-20 19:15:15 +01:00
vaxerski
6f3548b184 add an urgent event 2023-01-20 19:03:17 +01:00
vaxerski
d5913a23ac reset dragged window on failed begin 2023-01-20 16:30:30 +01:00
vaxerski
3436486575 sanitize scale better 2023-01-20 16:03:52 +01:00
vaxerski
5112056fdb better log wl socket adding and use auto if failed 2023-01-19 16:44:23 +01:00
vaxerski
d8ee624e35 move monitor remove notice up 2023-01-19 16:27:04 +01:00
vaxerski
428063ff23 fix up log types 2023-01-18 16:12:44 +01:00
Mihai Fufezan
32c11bb212 Nix CI: build xdg-desktop-portal-hyprland 2023-01-18 12:54:56 +02:00
Cole Mickens
31ab2349f9 nix: react to another stdenv change (#1399) 2023-01-18 10:37:56 +02:00
scorpion-26
c31c627cf8 Don't ignore previous maximise on defullscreen req (#1393)
When defullscreening a window by the apps' request, we would return
the window to normal mode, even if the window was previously maximized.
Now a defullscreening request honors the previous maximized state.
2023-01-17 13:20:10 +01:00
vaxerski
f14e808847 dump monitor data after setting rules 2023-01-17 11:57:36 +01:00
vaxerski
5c83976977 added misc:hide_cursor_on_touch 2023-01-17 11:47:39 +01:00
vaxerski
2ec7e241cd send cursor updates on touch move 2023-01-17 11:34:57 +01:00
devil-may-c0de
6a56d1e4d0 change placement of isSwitchingToPrevious (#1388)
fixes #1218, but doesn't break functionality of allow_workspace_cycles.
2023-01-16 21:04:10 +01:00
vaxerski
589046ecf7 fix dimaround with transformed displays 2023-01-16 16:12:24 +01:00
ppenguin
040e99fd17 Add tablets calibration matrix for dynamic rotation with 2-in1/tablet PC usage (#1319) 2023-01-15 20:38:58 +01:00
vaxerski
b5b436e01d better error handling around getMonitorFromString 2023-01-14 20:45:28 +01:00
Maxim Baz
668d90c700 Implement urgency hint for workspaces (#1379)
When there are any unfocused windows that request activation, mark the workspace as urgent.
2023-01-14 20:31:11 +01:00
vaxerski
b3012d97ab [gha] bump flake inputs 2023-01-13 21:07:04 +00:00
vaxerski
0b5a751e52 update wlroots dep 2023-01-13 22:06:04 +01:00
Maxim Baz
7729fa9ac9 master layout: remember size & pos of floating windows on fullscreen 1 (#1374) 2023-01-13 21:58:14 +01:00
vaxerski
9c77415cda damage monitor on moveactive 2023-01-13 12:31:24 +01:00
vaxerski
cbd31ba481 damage on border change 2023-01-12 13:33:45 +01:00
vaxerski
8440aa3e9b repaint on dynamic decoration keywords 2023-01-12 12:14:57 +01:00
vaxerski
11afb66010 release mouse buttons on map from LS 2023-01-11 19:15:18 +01:00
vaxerski
c4e422644b move window to top if floating activate 2023-01-11 17:59:35 +01:00
vaxerski
df30f0519a damage monitor on stack rotations 2023-01-11 17:57:54 +01:00
vaxerski
8ba4f34a7c fix cmake systemd header detection 2023-01-11 17:41:03 +01:00
vaxerski
7afb7c85a7 handle fullscreen requests on maximized windows 2023-01-11 13:40:15 +01:00
vaxerski
b24f066c47 escape json strings in hyprctl binds 2023-01-11 12:17:27 +01:00
vaxerski
4ec034ad49 send enter for IME popups 2023-01-10 19:21:59 +01:00
vaxerski
20a1a47e66 replace java envvar 2023-01-09 21:26:19 +01:00
vaxerski
989ee6473f describe layers in hyprctl layers 2023-01-09 21:26:07 +01:00
vaxerski
a572321f61 remove old warn 2023-01-09 20:52:24 +01:00
vaxerski
ff11883482 added make model and serial to hyprctl monitors 2023-01-09 14:35:58 +01:00
Raffaele Mancuso
c0c7c12bb9 Pin dispatcher for a specific window (#1340)
Closes #1339
2023-01-08 18:37:24 +01:00
riChar
e5dcbf73d8 Add "on" and "off" for the bind of switch (#1342) 2023-01-08 16:35:24 +01:00
vaxerski
50e106f2e6 expand region twice in blur damage
we need to update possible blurriness above
2023-01-08 14:46:45 +01:00
Cyril Levis
3173fbdc4a feat: dispatcher, add workspace renaming (#1336)
* feat: dispatcher, add workspace renaming

Co-authored-by: vaxerski <vaxry@vaxry.net>
2023-01-08 14:19:18 +01:00
Mihai Fufezan
b1104b1ca7 nix: update xdph 2023-01-07 20:33:15 +02:00
Mihai Fufezan
809b7181a8 nix: add hyprland-protocols through pkgconfig (#1275) 2023-01-07 20:25:20 +02:00
vaxerski
af4b9700b7 bump ver to 0.20.1 2023-01-07 13:49:19 +01:00
vaxerski
2858e08ce0 remove color rassert to fix overshot beziers 2023-01-07 13:38:19 +01:00
vaxerski
2b248b25c8 clamp a instead of asserting 2023-01-07 13:12:08 +01:00
rubyowo
0d2e1e1270 fix crashes and bug wiki link (#1333) 2023-01-07 12:33:36 +01:00
vaxerski
464dd79246 fix crashes on monitor ls remove 2023-01-06 16:13:50 +01:00
Mihai Fufezan
85a71d15b6 CI: add jq to Arch Meson build 2023-01-06 16:43:10 +02:00
Mihai Fufezan
f3551021e0 Nix: add jq 2023-01-06 16:31:57 +02:00
Mihai Fufezan
a54247125f Build: use props file for versioning 2023-01-06 16:22:00 +02:00
vaxerski
98ce867104 added hyprctl binds 2023-01-06 14:32:25 +01:00
vaxerski
461fab0f27 minor fixes for fakefullscreen 2023-01-06 13:29:49 +01:00
Mihai Fufezan
e9a6c3b498 Nix & meson: 0.19.2 -> 0.20.0 2023-01-06 01:24:47 +02:00
vaxerski
c02ac5e08a fix un-normalized missed color 2023-01-05 23:30:24 +01:00
vaxerski
c56b2b99f5 [gha] bump flake inputs 2023-01-05 19:19:03 +00:00
jrun
0d14fd9136 add systemd support (#1253)
* add systemd support
motivation for this is is proper ordering of related/bound/required
services to Hyprland (e.g. swaybg) that would need to have a compositor
ready.

this could possibly be a build-time option of course.

see also:
example/ files for example of services

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>

* nix: add withSystemd flag

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
Co-authored-by: Vaxerski <vaxry@vaxry.net>
2023-01-05 20:17:55 +01:00
vaxerski
96198dae55 Normalize color storage
Colors are now normalized to 0 - 1 values instead of 0 - 255

causes calculations to be simpler and generally cleans up the codebase.
2023-01-05 19:25:45 +01:00
vaxerski
0e3547e0f6 add touchdevice to devicevalue 2023-01-03 15:51:43 +01:00
vaxerski
3d1b255199 update constraint on constraint state region commit 2023-01-03 13:06:18 +01:00
Cole Mickens
0b26b1eed6 s/pkgs.system/pkgs.hostPlatform.system/g 2023-01-03 13:56:23 +02:00
vaxerski
a33ecec61e destroy LS-es on disconnected monitor 2023-01-02 16:16:28 +01:00
vaxerski
9ba93f4b0a fix double remove in destroyKeyboard 2023-01-02 12:08:00 +01:00
vaxerski
85d1b06a79 clean draggedwindow in dragend 2023-01-02 12:06:06 +01:00
vaxerski
cb4f748226 added fakefullscreen 2023-01-01 16:54:13 +01:00
vaxerski
7525818097 account for dimAround in fullboundingbox 2022-12-31 19:23:02 +01:00
vaxerski
ddcae74e09 normalize gradients and denormalize in groupbar 2022-12-31 17:31:33 +01:00
vaxerski
228e630f40 fix group bar color calc 2022-12-31 17:04:41 +01:00
vaxerski
7f595ed0ca support gradients in dwindle group colors 2022-12-31 16:23:56 +01:00
vaxerski
a91d0a374a fix mouse resize on master orientations 2022-12-30 13:01:43 +01:00
vaxerski
0baef17a02 simplify workspace sanity checks 2022-12-29 17:06:30 +01:00
vaxerski
5d095bb9e1 use curves for special dim anim 2022-12-29 12:30:43 +01:00
vaxerski
759490689c fix damage issues with dimaround unmap 2022-12-29 12:19:11 +01:00
vaxerski
3e2200ed90 get window under cursor in kill 2022-12-29 11:52:46 +01:00
vaxerski
a55db95a3b ignore dim when pass popup 2022-12-28 19:56:18 +01:00
vaxerski
b4ebc18367 remove main_mod 2022-12-28 19:52:12 +01:00
vaxerski
a6699ef30c added dimaround 2022-12-28 15:39:17 +01:00
vaxerski
b5f5c26be3 added dim_special 2022-12-28 15:18:23 +01:00
vaxerski
d64fc7d336 remove useless log 2022-12-27 15:28:41 +01:00
vaxerski
659a5195d4 render overlay layers in reverse
prevents stuff leaking when locked
2022-12-27 15:25:51 +01:00
vaxerski
545e63d1dd sanity check workspaces after enabling mirror 2022-12-26 13:27:02 +01:00
vaxerski
fa79703b04 [gha] build man pages 2022-12-26 12:25:58 +00:00
vaxerski
d39ed9254a update debug coredump instructions 2022-12-26 13:25:32 +01:00
vaxerski
17b4a2786d clarify layout enum 2022-12-26 12:05:34 +01:00
vaxerski
cd08fa22fd added workspace_swipe_numbered 2022-12-25 15:42:11 +00:00
Mihai Fufezan
d87d2dac0b nix: update wlroots & fix updater 2022-12-24 02:20:02 +02:00
Mihai Fufezan
f7ce3c27ea nix: update xdph 2022-12-24 01:26:38 +02:00
vaxerski
5fe437da7e added maximize windowrule 2022-12-23 19:34:28 +00:00
vaxerski
e6cbb6072b update wlroots dep 2022-12-22 15:52:11 +00:00
vaxerski
fbc7a9391a downgrade wlroots due to issues 2022-12-22 15:19:54 +00:00
vaxerski
2b888d5106 ignore focus to empty input region ls-es 2022-12-22 15:03:32 +00:00
vaxerski
4b8d417fca update wlroots dep 2022-12-22 14:45:49 +00:00
vaxerski
21cc6d7ae5 update wlroots dep 2022-12-22 12:25:38 +00:00
vaxerski
6749c8abd7 fix dynamic monitor disables corrupting pmosthz 2022-12-22 12:15:07 +00:00
TheOnlyMrCat
8c094b0eec Make libinput tap-and-drag configurable (#1267) 2022-12-22 12:05:26 +00:00
vaxerski
eb9d063229 Added make configdebug 2022-12-22 01:25:04 +00:00
vaxerski
a1143521d3 Allow floats in % rules 2022-12-21 23:18:47 +00:00
Gaoyang Zhang
8a23b66c39 nix: handle reloading of multiple/dead instances on home manager generation switch
Signed-off-by: Gaoyang Zhang <gy@blurgy.xyz>
2022-12-22 00:07:38 +02:00
Rens Porre
de5e784e07 Nix & meson: 0.18.0 -> 0.19.2 2022-12-22 00:05:56 +02:00
vaxerski
96cb47fc64 Add sane permissions for /tmp/hypr 2022-12-21 15:41:02 +00:00
vaxerski
e9bd2ee996 move setActiveMonitor backup later in onDisconnect 2022-12-21 15:17:24 +00:00
vaxerski
41cdfb7420 allow binding tablets to outputs 2022-12-21 15:11:39 +00:00
vaxerski
fc37ce4a72 render pinned windows above floating separately 2022-12-20 23:07:25 +00:00
Maarten van Gompel
edcf4cd61d fix for gap in master layout orientation right #1171 (#1260) 2022-12-20 22:24:36 +00:00
vaxerski
261fbb5b62 adjust medium ppi values 2022-12-20 13:33:29 +00:00
vaxerski
4fd90144d1 touch up the clang format and format all files 2022-12-20 02:18:47 +00:00
vaxerski
3e2785b970 fix restack in xwayland stubs 2022-12-19 23:43:50 +00:00
Mihai Fufezan
ab7f2e847e nix/flake: remove merged overrides 2022-12-19 23:46:18 +02:00
Mihai Fufezan
781f0adad4 nix/hm-module: add disableAutoreload option 2022-12-19 23:39:37 +02:00
vaxerski
668cc93962 refocus on special move 2022-12-19 14:49:19 +00:00
Jan Beich
2f6b37e103 Drop Pango (unused) (#1251)
* Drop unused Pango dependency

* nix: explicitly depend on cairo (previously pulled via pango)

src/meson.build:4:0: ERROR: Dependency "cairo" not found, tried pkgconfig
2022-12-19 12:13:07 +00:00
Jan Beich
e2ee8b9f20 Drop X11 headers (unused) (#1252)
* Move libX11 header under Xwayland support

In file included from ../src/layout/../defines.hpp:1,
                 from ../src/layout/IHyprLayout.hpp:3,
                 from ../src/layout/IHyprLayout.cpp:1:
../src/layout/../includes.hpp:9:10: fatal error: X11/Xlib.h: No such file or directory
    9 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~

* Drop unused X11 headers
2022-12-19 12:12:58 +00:00
vaxerski
6424a1e398 mark blur dirty on dynamic blur keywords 2022-12-18 15:05:34 +00:00
vaxerski
a163ca9237 fix blur damage spam on no blurred windows 2022-12-18 12:41:19 +00:00
Mihai Fufezan
27b8561d25 nix/hm-module: add nvidiaPatches option 2022-12-18 13:43:56 +02:00
vaxerski
974739457f remove damage_entire_on_snapshot 2022-12-17 23:05:15 +00:00
vaxerski
563835404f remember master width on master close 2022-12-17 22:53:03 +00:00
Julian Schuler
2daabfa0e9 Add 'exact' option for 'splitratio' (#1245)
* Simplify getPlusMinusKeywordResult()

* Add an 'exact' option for 'splitratio'
2022-12-17 22:37:44 +00:00
vaxerski
0f3214714f respect ls protocol by forcing kb focus to kb interactive top and overlay 2022-12-17 22:35:51 +00:00
Mihai Fufezan
e7940569dd nix/wlroots: add nvidia patch 2022-12-17 21:41:22 +02:00
Mihai Fufezan
f59c9a805e nix/module: add nvidiaPatches option
Also fixes wrong package passing.
2022-12-17 21:41:22 +02:00
vaxerski
85f50a4a13 update wlroots dep 2022-12-17 18:34:06 +00:00
Julian Schuler
a3b37b0191 Fix focus not changing on (empty) workspace change (#1243) 2022-12-17 17:28:43 +00:00
Julian Schuler
11ba6afdd3 Fix cycleprev bug introduced in 46891b12cf (#1213) (#1242) 2022-12-17 14:37:10 +00:00
vaxerski
99ca1ad353 remember pos and size across fullscreen moves 2022-12-17 12:15:56 +00:00
vaxerski
2076905d6e remember size and pos on fullscreen 1 2022-12-17 12:14:43 +00:00
vaxerski
deb8d3d82e ignore self in candidate floating 2022-12-16 20:07:44 +00:00
vaxerski
f72c237d85 add disabling keyboards 2022-12-16 17:20:51 +00:00
Vaxry
98a4fa2b0d Added clang format (#1239)
* clang-format stuff and format files
2022-12-16 17:17:31 +00:00
vaxerski
7c33c7fc64 fix stupid typo 2022-12-16 11:47:02 +00:00
vaxerski
20899b597e log more in group creation 2022-12-16 00:22:23 +00:00
vaxerski
198b7cae12 ignore silent workspace rules to same workspace 2022-12-15 17:36:34 +00:00
vaxerski
121ea1fac2 set created over fullscreen in movetotop 2022-12-15 17:29:06 +00:00
vaxerski
3bd9ee0d32 minor xcursor and scale fixes 2022-12-15 17:17:15 +00:00
vaxerski
95a042691a Revert "Send initial focus to X11 type dialog"
This reverts commit efc686423a.

Issues with select dialogs.
2022-12-15 16:47:14 +00:00
Vaxry
702c0a0fbf update readme images 2022-12-15 14:32:36 +00:00
vaxerski
e405490593 fix workspace special rules 2022-12-15 12:49:39 +00:00
vaxerski
ac07e447b8 [gha] build man pages 2022-12-15 12:40:24 +00:00
NotAShelf
9702b8ce75 do not overwrite existing hyprland.desktop (#1228)
* copy desktop file only if does not exist

- Should no longer overwrite modified desktop files for pre-packaged versions of Hyprland.

* re-add cleaninstall with deprecation notice

Co-authored-by: NotAShelf <NotAShelf@users.noreply.github.com>
2022-12-15 12:39:55 +00:00
vaxerski
efc686423a Send initial focus to X11 type dialog 2022-12-15 12:38:47 +00:00
vaxerski
b89a07596e prevent moving to invalid workspaces 2022-12-14 18:42:48 +00:00
vaxerski
5a138bed6b use auto scale in fallback rule 2022-12-14 18:00:04 +00:00
vaxerski
a2ecca936e use auto scale in default cfgs 2022-12-14 17:57:45 +00:00
vaxerski
374571da96 add auto scale 2022-12-14 17:57:45 +00:00
vaxerski
f8188ed7f8 stuff 2022-12-14 17:57:45 +00:00
Mihai Fufezan
516949380d nix/hm-module: make config optional 2022-12-14 14:08:53 +02:00
Mihai Fufezan
5d66122689 nix: update xdph 2022-12-13 17:56:48 +02:00
Mihai Fufezan
de9396d2a1 nix: update xdph 2022-12-12 23:45:24 +02:00
vaxerski
f8a6799d4e verify lastmon status on connect 2022-12-12 20:51:20 +00:00
Vaxry
111d209bff Added toplevel handle sharing Rev2 (#1203)
* Added toplevel handle sharing

* nix: fix build

* update hyprland-protocols

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2022-12-12 14:56:42 +00:00
vaxerski
b45a213413 always build with ASan in debug 2022-12-12 14:38:50 +00:00
vaxerski
1a9ee959dd static-ize master opt 2022-12-12 14:37:49 +00:00
Maarten van Gompel
46891b12cf Master layout: lose or inherit fullscreen on deliberate window switching (#1213)
* Master layout: Lose fullscreen status when deliberately switching away from a fullscreen window

* Master layout: implemented inherit_fullscreen config parameter

When set, if you are on a fullscreen window and you cycle to the next,
swap master, etc, it will be automatically fullscreened.
2022-12-12 14:34:52 +00:00
vaxerski
0c1bec023f unset cursor image on end drag if it gets destroyed 2022-12-12 14:32:23 +00:00
vaxerski
80f58bc93f fix blur damage issues with scaled 2022-12-12 14:29:04 +00:00
vaxerski
06e6c6021e fix memory read-after-free in master layout 2022-12-12 14:18:43 +00:00
vaxerski
e8b99ae13a add override to opacity rules 2022-12-11 17:15:02 +00:00
vaxerski
bb99f151da fix pinned offset calc 2022-12-11 16:58:29 +00:00
vaxerski
f97289a3c0 fix rendering multi special ws 2022-12-11 16:53:59 +00:00
Maarten van Gompel
6381b6474f Implement orientation (placement of master area) for master layout (#1202)
* Implemented choosing placement of master area (#1059)

This implement a per workspace 'orientation' that can be set
to left, right, top or bottom. Reflecting placement of the master area.

Left (default) and right are horizontal layouts, top and bottom produce vertical
layouts. Orientation can be switched with: 'hyprctl dispatch layoutmsg orientationleft'
2022-12-10 21:59:16 +00:00
vaxerski
c3f1dc3f52 fix minor issues with move focus and follow mouse 0 2022-12-10 15:15:40 +00:00
vaxerski
62f4503f07 handle constraint cursor hints better 2022-12-10 14:43:46 +00:00
vaxerski
bf78dcecf0 add changefloatingmode event 2022-12-09 18:51:44 +00:00
vaxerski
d5352a5d12 find a default workspace smarter 2022-12-09 17:17:02 +00:00
vaxerski
fd43d2bea7 fix drag resizing on special ws-es 2022-12-09 17:08:04 +00:00
vaxerski
b9812f8bc0 use anim callbacks and don't spam config resets in drag 2022-12-09 15:00:58 +00:00
vaxerski
fba03540d5 fix sharing scaled windows 2022-12-09 14:44:20 +00:00
Mihai Fufezan
11a1a6c271 nix: add xdph to flake and enable it in the nixos module 2022-12-09 16:25:57 +02:00
vaxerski
ff12a41c40 minor focus fixes with LS-es and moving windows 2022-12-09 14:03:37 +00:00
vaxerski
629cca4816 fix string escaping in CMakeLists.txt 2022-12-09 13:57:39 +00:00
Mihai Fufezan
9fc143cf3d Revert "nix: add cachix to nixos module"
This reverts commit 5b7fec481b.
Will clarify better how to enable Cachix, in the wiki.
2022-12-09 13:36:23 +02:00
vaxerski
726732244a sort valid ws-es in relative 2022-12-08 21:24:55 +00:00
vaxerski
be6e1a33b1 ensure mapped state in addViewCoords 2022-12-08 18:52:48 +00:00
vaxerski
6e3bd440ba do not reject drags on visible windows over fullscreen 2022-12-08 17:45:25 +00:00
vaxerski
cba10ba5b7 fix memory safety in getWindowFromSurface 2022-12-08 17:43:15 +00:00
vaxerski
050693be2e fix up relative monitors 2022-12-08 12:09:48 +00:00
vaxerski
0803febac5 optimize m+- and e+- workspace opts 2022-12-08 12:08:41 +00:00
vaxerski
6259202c01 add missing c_str in debug log 2022-12-07 22:47:32 +00:00
vaxerski
e1d7a13333 unset fullscreen in onWindowRemoved 2022-12-07 18:57:02 +00:00
vaxerski
bf5844d607 add failsafe for dwindle windows 2022-12-07 18:57:02 +00:00
Mihai Fufezan
5b7fec481b nix: add cachix to nixos module 2022-12-07 19:18:15 +02:00
vaxerski
73b3bbe49b added nomaxsize rule 2022-12-07 16:08:44 +00:00
vaxerski
d8dcf670da fix lost windows clogging up memory 2022-12-07 14:32:24 +00:00
vaxerski
87b9313034 updated wlroots dep 2022-12-06 23:16:37 +00:00
vaxerski
993c382e74 minor fixes to special workspace behavior 2022-12-06 20:31:44 +00:00
vaxerski
3c9a7811b8 fix up moving to special workspace 2022-12-06 20:20:37 +00:00
vaxerski
6c8d993477 minor toplevel sharing fixups 2022-12-06 18:58:42 +00:00
vaxerski
dfa9277867 remove double semicolons 2022-12-06 15:06:27 +00:00
vaxerski
50e37419e9 fix the release CI 2022-12-06 13:25:24 +00:00
vaxerski
22978aa31e fix tarbomb with source tars 2022-12-06 13:15:18 +00:00
vaxerski
7ed401e5e0 fix group border oversaturation 2022-12-06 12:57:10 +00:00
vaxerski
da76a1ed9e block surface feedback on window sharing 2022-12-05 19:12:15 +00:00
vaxerski
9c67e08dbd ignore alpha when sharing window 2022-12-05 18:00:57 +00:00
vaxerski
6cf716f182 fix handle finding 2022-12-05 17:57:59 +00:00
vaxerski
9fb24ac1e9 avoid using wayland-0 as a socket name 2022-12-05 17:21:09 +00:00
Vaxry
66fb083003 Implement window sharing with the hl toplevel export proto (#1179)
* implement window sharing

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2022-12-05 17:05:15 +00:00
vaxerski
20b91f58f8 remove idiotic guard in processMouseDownNormal 2022-12-05 14:30:04 +00:00
vaxerski
ac0e675f3b better capability handling 2022-12-05 14:28:27 +00:00
Mihai Fufezan
f71f04db9e nix: add xdph to nixos module 2022-12-05 03:13:31 +02:00
vaxerski
9e4e98acfb fix crash in blurls remove 2022-12-04 22:34:30 +00:00
eriedaberrie
826e35f7a4 show groupings and swallowing in hyprctl (#1159)
* feat: show groupings and swallowing in hyprctl
2022-12-04 21:03:29 +00:00
Flafy
ffc580dda9 blur xray for layers (#1158)
* feat: apply blur_xray to non window surfaces

* don't blur optimize bottom and background layers
2022-12-04 20:57:41 +00:00
Mihai Fufezan
4557d13a32 nix: update nixpkgs (includes merged hwdata update) 2022-12-04 21:43:28 +02:00
Mihai Fufezan
215c7bd3cb nix: remove merged hwdata override 2022-12-04 21:24:34 +02:00
Flafy
ea2ef63de5 nix: add cmake and wlroots to devshell (#1155) 2022-12-04 19:58:45 +02:00
Paul
d9998f2ca5 Use internal device naming for Hyprctl devices (#1174)
* Use internal naming for Hyprctl devices

* Use c-strings rather than std::string
2022-12-04 17:32:55 +00:00
Flafy
686d6fc6d1 Fix wrong layout recalculate if statement (#1167)
* fix: wrong layout recalculate if statement

* change from find to contains
2022-12-04 17:32:27 +00:00
vaxerski
9e8df888eb fix warning 2022-12-04 00:03:48 +00:00
vaxerski
409ac12f23 avoid duplicate device names 2022-12-03 20:36:52 +00:00
vaxerski
6aa26582f6 added hyprctl switchxkblayout 2022-12-03 16:22:02 +00:00
vaxerski
056a45d035 fix shader destroy id unset 2022-12-03 14:45:10 +00:00
vaxerski
fbc839e8d9 reload shader on dynamic shader keyword 2022-12-03 14:45:10 +00:00
vaxerski
cb85eea261 [gha] build man pages 2022-12-02 20:15:25 +00:00
Hemish
439b827a08 Update wiki link in manpage (#1144)
As wiki is migrated to wiki.hyprland.org, I changed the github wiki link to wiki.hyprland.org in the manpage.
2022-12-02 20:15:03 +00:00
vaxerski
d39d6cc1e3 don't initial focus on LS keyboard grab 2022-12-02 20:10:15 +00:00
vaxerski
d6b3bfc48e don't attempt rendering on begin failure 2022-12-02 19:33:54 +00:00
vaxerski
70d4fadc39 schedule frames and reloads on session re-activate 2022-12-02 18:47:57 +00:00
vaxerski
a2a12018d9 minor changes to unsafe state handling 2022-12-02 18:45:45 +00:00
vaxerski
10d34ef818 added blur_xray 2022-12-02 18:37:11 +00:00
vaxerski
bf52545a91 [gha] bump flake inputs 2022-12-01 21:01:57 +00:00
vaxerski
c012e3d66b update wlroots dep 2022-12-01 21:00:54 +00:00
vaxerski
39a4f82460 fix crash with invalid frag dynamic shaders 2022-12-01 13:40:05 +00:00
vaxerski
7b020ffa84 Added screen shaders 2022-12-01 13:36:07 +00:00
Vaxry
b8ccf3dc3a updated the readme 2022-11-30 22:49:47 +00:00
vaxerski
869f0a0238 remove global var 2022-11-30 13:33:21 +00:00
vaxerski
ff4ea1a13a fix border inner offset in shader 2022-11-29 21:11:37 +00:00
vaxerski
51aebb2845 fix minor issues with blur w/o new optim 2022-11-29 11:21:03 +00:00
vaxerski
212f599412 fix AA on borders 2022-11-29 11:12:29 +00:00
vaxerski
55776df685 fix double free 2022-11-29 11:10:19 +00:00
vaxerski
3dd06b674a clean up blur code and fix minor issues 2022-11-28 19:19:07 +00:00
vaxerski
12df799572 recalculate layout only when needed on dynamic keywords 2022-11-28 19:05:50 +00:00
vaxerski
c341792092 fix minor issues with blur_new_optimize 2022-11-28 19:04:30 +00:00
Eric_Luo
afe12dc90b Fix a compiler warning (#1124)
Co-authored-by: hnboy <hnboy@users.noreply.github.com>
2022-11-28 19:04:24 +00:00
Jef
45d2d1e97d convert bordercolors to GradientValueData correctly (#1122)
Co-authored-by: Jef Steelant <jef.steelant_ext@softathome.com>
2022-11-28 11:44:31 +00:00
vaxerski
0a302901d2 Added handling more special workspaces 2022-11-27 22:42:22 +00:00
vaxerski
49063f949d find floating windows below closed one 2022-11-27 12:11:45 +00:00
vaxerski
7699d657d9 optimize border shader
Do not calculate gradient for discarded fragments
2022-11-27 00:30:44 +00:00
vaxerski
b2cb3b8bf2 use gradients in default configs 2022-11-27 00:26:13 +00:00
vaxerski
6cbaad896c use highp for pixcoord to fix nvidia border issues 2022-11-26 23:55:41 +00:00
vaxerski
9247f88d0c update readme 2022-11-26 20:56:18 +00:00
vaxerski
92f2e342a3 use unreachable instead of break on invalid cvd enum value 2022-11-26 20:46:39 +00:00
Dashie
e2f3f5fe63 Add nofullscreen to windowrules (#1107)
* feat: add windowrule to prevent fullscreen
2022-11-26 20:44:40 +00:00
vaxerski
0db75852f3 fix transformed border thickness 2022-11-26 20:36:05 +00:00
vaxerski
afe688e6ab allow 360 degrees of freedom in gradients 2022-11-26 19:37:20 +00:00
vaxerski
493fc00953 fix decorations missing after no_gaps_when_only toggle floating 2022-11-26 18:48:16 +00:00
vaxerski
c709dc5e8e fix fadeout with animated border 2022-11-26 18:41:30 +00:00
vaxerski
684c59e5bc optimize data feeding to gradient renderer 2022-11-26 18:09:57 +00:00
vaxerski
0948b078e1 added border gradients 2022-11-26 17:57:02 +00:00
vaxerski
52c0356900 monitor rule fixes 2022-11-26 15:41:08 +00:00
vaxerski
1c9a0be8c4 fix up the border shader 2022-11-26 13:51:30 +00:00
vaxerski
f45ec24977 don't focus back after dnd on follow mouse 1 2022-11-26 00:00:36 +00:00
vaxerski
75b7e661e7 damage windows after switch 2022-11-25 19:52:23 +00:00
vaxerski
381d7a4300 check for special workspace open in attemptDirectScanout 2022-11-25 18:25:04 +00:00
vaxerski
0e6e8461eb reset m_bEmptyFocusCursorSet on workspace switch 2022-11-25 11:34:52 +00:00
Mihai Fufezan
141456dd89 Nix & meson: 0.17.0 -> 0.18.0 2022-11-25 08:34:23 +02:00
vaxerski
9616dc7bd8 don't change alpha on special anims 2022-11-24 20:51:33 +00:00
vaxerski
379597e78f remove redundant strval_empty checks 2022-11-24 17:11:21 +00:00
vaxerski
f6067816fb skip covered windows on fullscreen workspaces in getWindowInDirection 2022-11-23 23:40:05 +00:00
vaxerski
750eb76df3 default blur new optimizations to 1 2022-11-23 15:41:19 +00:00
Julian Schuler
79a9bc9076 Add option for retrieving first empty workspace (#1085) 2022-11-23 14:10:26 +00:00
vaxerski
dcb6a0425c override force opaque rule on keybind 2022-11-23 09:55:52 +00:00
vaxerski
e15a9f3d7d damage monitor on group switch 2022-11-22 23:47:00 +00:00
vaxerski
b0f95c63c9 fix crash in setActiveMonitor null 2022-11-22 23:17:10 +00:00
vaxerski
5327565b33 remove resize transitions 2022-11-22 17:20:58 +00:00
vaxerski
95047fb083 return full monitor box for fullscreen windows in idealBB 2022-11-21 23:33:53 +00:00
CactiChameleon9
f00b2fd509 Fix swiping on the first workspace going to the last (#1067) 2022-11-21 23:30:26 +00:00
vaxerski
eb86e7967f add scroll_button libinput opt 2022-11-21 23:26:18 +00:00
Maks
88874fcfe2 Fix cmake error when using clang (#1009) 2022-11-21 21:20:51 +00:00
vaxerski
d504c1e5ab fix master resizes all 2022-11-21 18:14:25 +00:00
vaxerski
c78db1212b Unify rounding shaders 2022-11-21 18:09:47 +00:00
vaxerski
be03a6186c fix invisible windows on moving fullscreen out 2022-11-20 18:50:27 +00:00
Julian Schuler
41a8975bd1 Render focused window at last (#1060) 2022-11-20 18:50:01 +00:00
vaxerski
254c3d166f don't send motion events to lock constraints 2022-11-20 18:38:53 +00:00
vaxerski
137cf9e582 improve constraint handling 2022-11-20 17:35:13 +00:00
Mihai Fufezan
11e841580f Nix: add libdrm and wayland-protocols overlay
fixes #1055
2022-11-20 17:34:11 +02:00
vaxerski
f8b9138383 make focus/swap master layoutmsgs two-way 2022-11-20 11:55:50 +00:00
Narice
c03e4c36b0 Setting wayland environment variables at startup (#1045)
* Nix modules: removed GDK_BACKEND env variable

* setting wayland environment variables at startup

setting XDG_BACKEND and _JAVA_AWT_WM_NONREPARENTING in main.cpp
removed these variables from nix modules recommended environemnt
removed XCURSOR_SIZE from nix modules as it is already set

* Making _JAVA_AWT_WM_NONREPARENTING not overwritten
2022-11-19 19:37:16 +00:00
vaxerski
5530cf6e79 respect no_gaps_when_only in fullscreen 1 2022-11-19 17:35:37 +00:00
vaxerski
1f72237291 Fix incorrect layout positions in mirror re-add 2022-11-19 16:58:14 +00:00
vaxerski
e427d9f622 unify setting of the active monitor 2022-11-19 16:41:41 +00:00
vaxerski
f88feec02b [gha] bump flake inputs 2022-11-19 16:29:06 +00:00
vaxerski
df132e5ff3 update wlroots dep 2022-11-19 16:28:04 +00:00
vaxerski
0ffaa8d667 Fix minor issues with mirrors 2022-11-19 13:14:55 +00:00
vaxerski
e887149f25 minor fixes for mirrors & log more monitor events 2022-11-19 13:01:32 +00:00
vaxerski
250d61e0b3 find base surface if no subsurface found in ls 2022-11-18 20:35:15 +00:00
vaxerski
ba05c43ae3 minor monitor code fixups 2022-11-18 14:15:19 +00:00
vaxerski
82fe530045 don't set AS in onConnect 2022-11-18 14:08:34 +00:00
vaxerski
f91f3d1c81 Reset callbacks on remap 2022-11-18 13:53:54 +00:00
vaxerski
5d39223239 fix events in changeworkspace with bound ws-es 2022-11-17 21:58:22 +00:00
vaxerski
d2a7e22efd more memory safety around onDisconnect 2022-11-17 21:52:45 +00:00
vaxerski
724e411ffc avoid header clashes in make all 2022-11-17 18:27:50 +00:00
vaxerski
c02bfc3897 fix extents in shadow deco 2022-11-16 15:35:36 +00:00
vaxerski
878a20741b fix slide calcs for windows outside the viewport 2022-11-16 15:35:36 +00:00
vaxerski
d5eafe1926 set cursor to hand1 when moving a window 2022-11-15 10:39:05 +00:00
Mihai Fufezan
e2da4ff257 Nix CI: update actions (#1014) 2022-11-15 10:23:46 +00:00
Jef
dbb6732743 apply some rules dynamically when state of window changes (#1020)
Co-authored-by: Jef Steelant <jef.steelant_ext@softathome.com>
2022-11-15 10:21:26 +00:00
Jef
4034aa2c60 possible crash when current workspace does not exist (#1023)
Co-authored-by: Jef Steelant <jef.steelant_ext@softathome.com>
2022-11-15 10:18:04 +00:00
vaxerski
fcb5037a1d guard lastwindow in circlenext 2022-11-14 12:12:13 +00:00
vaxerski
0634abf168 remove quotes from commit messages in build 2022-11-13 20:01:30 +00:00
vaxerski
478fa7cafe Revert "Set child stdout and stderr to /dev/null (#1000)"
This reverts commit 1e5cab1ee7.

Breaks a bunch of stuff, e.g. Waybar.
2022-11-13 19:53:27 +00:00
Jef
549fdf63f6 Add bordercolor windowrule (#992)
* Add bordercolor windowrule

* remove spaces form bordercolor rule + typo

Co-authored-by: Jef Steelant <jef.steelant_ext@softathome.com>
2022-11-13 19:33:13 +00:00
Mihai Fufezan
1a14841a75 Nix: add hwdata overlay (#1010) 2022-11-13 19:32:15 +00:00
vaxerski
a7ed3a5e47 fix arch ci 2022-11-13 14:41:26 +00:00
vaxerski
884fc4f89c fix master window finding on closed 2022-11-13 14:31:12 +00:00
Thomas Voss
1e5cab1ee7 Set child stdout and stderr to /dev/null (#1000)
Some scripts or utilities check to see if stdout or stderr are connected
to a TTY or not to determine certain behaviors (for example, you might
want to prompt a user for input with fzf(1) if in a terminal but tofi(1)
or wofi(1) when spawned from your WM).  Since hyprland never closes
these output streams for spawned processes, they end up just spewing
their output onto the TTY while giving the user no real way to have a
script detect if it's being run from the shell or WM.

Instead of just closing stdout and stderr though, we close them and then
proceed to reopen them but connect them to /dev/null.  This allows
scripts and processes to not fail when attempting to write, but for that
writing to simply have no effect.
2022-11-13 11:58:20 +00:00
vaxerski
5a00f0c657 fix trailing comma in hyprctl activewindow 2022-11-13 11:12:11 +00:00
vaxerski
2cbb10d850 [gha] bump flake inputs 2022-11-13 11:05:51 +00:00
vaxerski
23cd1b8c66 update wlroots dep 2022-11-13 11:04:28 +00:00
vaxerski
be6f5ce831 fix commit message parsing in cmake 2022-11-13 10:58:46 +00:00
Jef
78a545112a streamline hypctl output of windows (#983)
Co-authored-by: Jef Steelant <jef.steelant_ext@softathome.com>
2022-11-13 00:39:21 +00:00
Vaxry
2cdabf581e Merge pull request #997 from leftas/main
Add keyboards' leds update on Key/Mod press
2022-11-12 21:00:38 +00:00
Leftas
34a7f17956 Add keyboard led update after keys/mod update 2022-11-12 13:12:37 +02:00
vaxerski
dd11434e90 notify idle on touch down 2022-11-11 23:41:04 +00:00
vaxerski
61995e3b4e guard empty str in isNumber 2022-11-11 14:04:35 +00:00
sioodmy
13befbd266 fix(nix): missing dependency 2022-11-11 14:43:45 +02:00
vaxerski
a5ffd44caf guard empty str in removeBeginEndSpacesTabs 2022-11-10 21:51:46 +00:00
vaxerski
0208dff574 fix invalid master slave pos calc on y != 0 2022-11-10 19:39:16 +00:00
vaxerski
3157bebed7 fix warning 2022-11-10 17:07:26 +00:00
vaxerski
c0bb4db15c add move cursor windowrule 2022-11-10 16:59:08 +00:00
Philip Jones
27cada2a02 Allow arguments to hyprctl dispatch exec commands. (#990) 2022-11-10 15:36:36 +00:00
vaxerski
153c99217d use spawn in config exec 2022-11-10 13:50:16 +00:00
vaxerski
851df11eb5 Added exec rules 2022-11-10 13:39:23 +00:00
vaxerski
5f2c741f49 remove spammy ime logs 2022-11-10 12:24:41 +00:00
vaxerski
9a9ecc25db added monitor cycling 2022-11-10 12:22:19 +00:00
vaxerski
34b145ee65 Added resizing individual master windows 2022-11-10 12:05:22 +00:00
vaxerski
f41fe59cb6 fix shadow extent & offset calculations 2022-11-09 22:39:19 +00:00
vaxerski
7ff1fd9d69 use goal values in changeWindowFloatingMode 2022-11-09 22:02:02 +00:00
vaxerski
d0b3cdc835 Fix crashes with DS and mirrors 2022-11-09 10:56:49 +00:00
vaxerski
1cf829c889 minor loose focus fixes 2022-11-08 20:28:41 +00:00
vaxerski
17992b633d minor fixes for follow_mouse 3 2022-11-08 14:48:17 +00:00
vaxerski
c545ab4993 Added multiple master layoutmsgs 2022-11-08 12:39:52 +00:00
vaxerski
1d2e4243dc clamp shadow scale to 1 2022-11-07 22:51:26 +00:00
vaxerski
aefc34b405 Minor fixes for virtual input devices 2022-11-07 22:22:13 +00:00
vaxerski
2a20cf5379 Added decoration:shadow_scale 2022-11-07 21:27:28 +00:00
vaxerski
e3a3837164 fix up formatting 2022-11-07 20:31:56 +00:00
Jan Beich
c86ab4694c meson: explicitly specify path for find(1) (#971)
src/meson.build:1:0: ERROR: Command "/usr/bin/find -name *.cpp" failed with status 1.
2022-11-07 20:27:06 +00:00
Jan Beich
5d5066570c helpers: implement getPPIDof on BSDs (#972)
Get PPID from `struct kinfo_proc` via sysctl for the specified PID.
Adjusted for minor differences between each BSD kernel.
2022-11-07 20:26:23 +00:00
abbadanor
1a55fb4170 Dispatcher to center floating window (#961)
Co-authored-by: Adam Nord <adam.nord@abbgymnasiet.se>
Co-authored-by: vaxerski <vaxry@vaxry.net>
2022-11-07 12:16:30 +00:00
vaxerski
efbc3f8194 resize transition fixes + default transitions to false 2022-11-06 18:10:53 +00:00
vaxerski
f755351511 Fix resize transitions on multimon + transformed 2022-11-06 18:04:30 +00:00
vaxerski
57817f7252 Added resize transitions 2022-11-06 17:52:09 +00:00
vaxerski
b4c45aa2e3 fix compiler warning 2022-11-06 14:28:15 +00:00
vaxerski
5295244026 Revert adding toggle for drm scanout flags
This reverts commit 12697d2b72.

Stupid idea.
2022-11-06 14:25:53 +00:00
vaxerski
082f439db2 fix issues with direct scanout's lack of surface frame feedback 2022-11-06 14:20:03 +00:00
vaxerski
12697d2b72 added toggle for drm scanout flags 2022-11-06 14:11:37 +00:00
vaxerski
976b44443a ignore constraints on exclusiveClient create 2022-11-05 18:34:26 +00:00
vaxerski
6553fb5a40 fix fullscreen maximize size 2022-11-05 18:25:32 +00:00
vaxerski
bee06f3507 add more wlroots flags for faster compile 2022-11-05 18:05:15 +00:00
vaxerski
5a750b485a Added creating / destroying outputs on a multi-backend + headless backend
See `hyprctl output`.
2022-11-05 18:04:44 +00:00
vaxerski
a71f44baa5 fix compiler warning 2022-11-05 13:49:55 +00:00
vaxerski
65db3a7bd3 fix relative protocol paths
CI fix
2022-11-05 13:46:58 +00:00
vaxerski
22384869a6 fix unregistering avars on sethidden 2022-11-05 13:37:57 +00:00
vaxerski
ff76fbe763 prevent double-registering of avars 2022-11-05 13:37:29 +00:00
vaxerski
cfbab453e8 move no_direct_scanout to misc 2022-11-05 13:22:18 +00:00
vaxerski
6a59b57ef8 remove spammy logs for DS 2022-11-05 13:06:48 +00:00
vaxerski
f50c786640 Added direct scanout 2022-11-05 12:50:47 +00:00
vaxerski
70aece8522 constraint focus simplifications 2022-11-04 18:09:40 +00:00
vaxerski
c9eb0f3aab fix missing stub for xwayland 2022-11-04 16:10:10 +00:00
vaxerski
206360177f Multiple animation optimization and xwayland wine fixes 2022-11-04 15:56:31 +00:00
vaxerski
34ad837fd9 don't update the env in session-less hl 2022-11-04 11:30:25 +00:00
vaxerski
e796157672 fix passing input to constrained windows without relative 2022-11-04 11:09:34 +00:00
vaxerski
b51222c004 fix ordering in mouse connect 2022-11-04 10:48:42 +00:00
vaxerski
9aad352789 automatically update dbus environment on start 2022-11-04 10:37:14 +00:00
vaxerski
ce8c20c1ed fix raw exec in configmanager 2022-11-04 10:33:05 +00:00
vaxerski
349afa0e7a guard header windows in layout messages 2022-11-03 22:55:44 +00:00
vaxerski
748a6965ca include utility in defines 2022-11-03 19:55:20 +00:00
vaxerski
97af7c416e added unset rules 2022-11-03 19:52:43 +00:00
vaxerski
47512dd6db remove redundant includes 2022-11-03 19:52:34 +00:00
vaxerski
653b9ed0e4 Fix missing focusedmon event on focusmonitor dispatcher 2022-11-03 19:34:26 +00:00
vaxerski
d0e47d9fe0 added workspace_swipe_forever 2022-11-03 13:35:34 +00:00
Mihai Fufezan
f978368a4e Nix HM: Fix invalid escapes
Fixes #949
2022-11-03 13:21:51 +02:00
vaxerski
c47581fc5a handle transforming displays in outputMgr 2022-11-03 09:06:44 +00:00
vaxerski
31aa357c17 fix safety over ls outputs 2022-11-03 08:56:47 +00:00
vaxerski
6ddfae0a07 remove ensureFDsValid, legacy 2022-11-02 21:28:08 +00:00
Mihai Fufezan
0d7176792b Nix HM: prevent race condition between dbus and systemd
Fixes #940
2022-11-02 21:36:07 +02:00
vaxerski
c1542da18a fix typo in focus 2022-11-02 18:54:41 +00:00
vaxerski
5b548f5bc3 update window values after map finish 2022-11-02 15:15:39 +00:00
vaxerski
5ac2005318 remove old comments 2022-11-02 14:52:36 +00:00
vaxerski
a2b8e3b34e fix the damageBox in damageMonitor 2022-11-02 11:04:17 +00:00
vaxerski
d78b53968f render the debug overlay only on visible monitors 2022-11-02 10:24:43 +00:00
abbadanor
61b950d942 Add focusmaster dispatcher (#942)
* added focusmaster dispatcher

* format

Co-authored-by: Adam Nord <adam.nord@abbgymnasiet.se>
Co-authored-by: vaxerski <43317083+vaxerski@users.noreply.github.com>
2022-11-02 10:15:11 +00:00
vaxerski
a16073a87b deprecate general:damage_tracking 2022-11-02 10:12:33 +00:00
vaxerski
603a90886f fix swipe on 2 detached workspaces 2022-11-02 10:01:13 +00:00
vaxerski
95bbac8791 remove redundant check in CShader 2022-11-01 18:46:51 +00:00
vaxerski
a69fd21a1a Add an idleinhibit windowrule 2022-10-31 12:26:07 +00:00
Mihai Fufezan
b6e33830af Nix & meson: 0.16.0 -> 0.17.0
Nix: make xwayland dependencies optional
2022-10-31 12:41:31 +02:00
wael
2c67c1c4f8 meson: use gl instead of GL
`/usr/lib/pkgconfig/gl.pc`
2022-10-31 12:39:04 +02:00
vaxerski
989deafd5e use lld instead of i in hyprctl getopt for accurate int reads 2022-10-30 22:45:03 +00:00
vaxerski
9f1d7f7fc7 properly scan for subsurfaces in fullscreen input refocus 2022-10-30 12:28:37 +00:00
vaxerski
6245c92bd0 avoid creating bound WS-es in moveWorkspaceToMonitor 2022-10-30 12:14:12 +00:00
vaxerski
2e32e202e9 set lastmonitor in onDisconnect 2022-10-29 22:45:01 +01:00
vaxerski
d994ad75e8 revert output smart layout reporting 2022-10-29 17:32:03 +01:00
vaxerski
2caebb3b10 fix default 0 in box passing test 2022-10-29 14:37:33 +01:00
vaxerski
05f3eebd96 avoid layout changes when unnecessary in applyMonitorRule 2022-10-29 12:24:44 +01:00
vaxerski
74d05d0adc ensure VRR for current display only in onConnect 2022-10-28 23:48:48 +01:00
vaxerski
341a0616aa avoid applying offset twice in onConnect 2022-10-28 23:23:23 +01:00
vaxerski
ea7f617df6 remove redundant check 2022-10-28 22:33:47 +01:00
vaxerski
644c64d79d lower IME errors to WARNs 2022-10-28 21:47:08 +01:00
vaxerski
d193d70ecf guard primaryFB tex in end() 2022-10-28 21:46:19 +01:00
vaxerski
9e227a52c0 allow cyclenext on null focus 2022-10-28 21:31:39 +01:00
vaxerski
1a767b021b fix minor focus oopsie 2022-10-28 20:12:17 +01:00
vaxerski
83e4006b16 properly find the constraint window 2022-10-28 19:35:02 +01:00
vaxerski
1759b0483c constrain mouse on focus change 2022-10-28 19:20:12 +01:00
vaxerski
f7174acc48 minor fixes for xwayland refocus 2022-10-28 19:18:10 +01:00
vaxerski
c2cd718e89 ignore pointer constraints in touch 2022-10-27 23:44:23 +01:00
Hilton Chain
c21808dd2d meson: Fallback to 'opengl' when 'GL' is not found.
This patch adds 'opengl' as a fallback to 'GL' for dependency lookup, to
link with libglvnd configured without X11 support.

For OpenGL, libglvnd provides two pkg-config files: `gl.pc' with GLX
support while `opengl.pc' not.  When building without X11 support, the
former won't be installed.
2022-10-28 00:50:58 +03:00
Vaxry
2c2e35eec1 Merge pull request #912 from riley-martin/hyprctl
Improve several hyprctl commands
2022-10-27 16:17:15 +01:00
Riley Martin
c064711d2a Improve hyprctl
Added better help for some hyprctl commands.
Failed commands should now 'fail' by returning a nonzero status to the shell

Fix typos
2022-10-27 10:39:21 -04:00
vaxerski
7d6ccca695 add 10bit support to displays 2022-10-27 13:26:47 +01:00
vaxerski
28c81fc71e add disabling pointer devices 2022-10-27 12:58:10 +01:00
Vaxry
d5a0610ea2 No xwayland overhaul (#920) 2022-10-27 11:26:35 +01:00
vaxerski
4aebb73de0 Added hyprctl cursorpos 2022-10-26 13:19:37 +01:00
vaxerski
46e51a81c4 unrestrict hyprctl message size 2022-10-26 13:11:05 +01:00
vaxerski
83ad59fae7 Allow 100%- for move rule 2022-10-26 12:34:26 +01:00
vaxerski
f9a7b6bf26 default focus_on_activate to false 2022-10-25 18:53:18 +01:00
vaxerski
cdb331076a allow # escaping in config 2022-10-25 14:32:25 +01:00
vaxerski
ba9a8a9ded unify LS unmap focus 2022-10-25 14:19:24 +01:00
vaxerski
34bd2cf803 respect wsbind in workspace silent rules 2022-10-25 10:30:25 +01:00
vaxerski
69f1d7b360 Rework workspace rules 2022-10-24 18:36:31 +01:00
vaxerski
e0bc952c83 minor fix to silent ws rules 2022-10-24 17:00:08 +01:00
vaxerski
cf869d9636 allow nofocus + workspace silent 2022-10-24 12:37:07 +01:00
vaxerski
077c1491a8 respect nofocus in candidate searching 2022-10-24 12:28:41 +01:00
vaxerski
c04563734e Rework candidate finding on close window 2022-10-24 12:25:36 +01:00
vaxerski
1d0d350fc3 fix silent + size windowrules 2022-10-24 12:03:15 +01:00
vaxerski
d55338a3f5 fix debug nest black screen 2022-10-24 11:58:07 +01:00
vaxerski
c6a3092b45 more safety around shutting down and mouse movements 2022-10-24 00:14:42 +01:00
vaxerski
10303259f7 always report sizes after a window unmap 2022-10-22 22:10:34 +01:00
Mihai Fufezan
3dca2fd61e Nix: override wayland-protocols 2022-10-23 00:01:55 +03:00
vaxerski
47eac4be1c disable adaptive sync with no_vfr off 2022-10-22 21:45:17 +01:00
vaxerski
2995867760 Transpose matrices on LEGACY_RENDERER 2022-10-22 21:10:49 +01:00
vaxerski
c132f5a91f [gha] bump flake inputs 2022-10-22 20:02:58 +00:00
vaxerski
24587492dd update wlroots dep 2022-10-22 21:01:45 +01:00
vaxerski
44cee0f5f8 more safety for focus requests 2022-10-22 16:45:33 +01:00
vaxerski
2c714eace5 handle activate requests 2022-10-22 16:43:47 +01:00
vaxerski
0d7d7a970d fix crash in event manager on hangup 2022-10-22 16:15:52 +01:00
Vaxry
3a27ef5e12 Merge pull request #893 from wael444/main
meson.build,CMakeLists.txt: use sh instead of bash
2022-10-22 11:57:36 +01:00
wael
6d273c8e44 CMakeLists.txt: use sh instead of bash 2022-10-22 09:23:52 +03:00
wael
c775153e01 meson.build: use sh instead of bash 2022-10-22 09:23:26 +03:00
vaxerski
b71d7c9007 minor workspace rule parsing fixes 2022-10-21 10:45:12 +01:00
vaxerski
ce5f025428 T1C: window dance compat 2022-10-20 22:38:49 +01:00
vaxerski
6df6aea1ba fix swipe with fullscreen maximized 2022-10-20 20:37:37 +01:00
Kainoa Kanter
ca2d2db0ef Add windowrules for noblur and noshadow (#884) 2022-10-20 20:36:27 +01:00
vaxerski
1ccb0b5f96 bump xdg ver to 5 2022-10-20 18:04:21 +01:00
vaxerski
c2545b3ae6 fix refocus on last window 2022-10-20 18:00:29 +01:00
vaxerski
dada872981 minor swipe on new fixes 2022-10-20 17:52:17 +01:00
vaxerski
1eec5161bd minor fix for swipes from empty workspaces 2022-10-20 15:47:35 +01:00
vaxerski
53c3644c29 fix minor anim issue with swipe new 2022-10-20 15:02:46 +01:00
vaxerski
6d66dde208 added swipe create new 2022-10-20 14:54:32 +01:00
vaxerski
1b349f79ac don't set custom mode in change 2022-10-19 22:12:02 +01:00
vaxerski
da8be82c9a Fix self-noding in changeWindowFloatingMode 2022-10-19 21:32:30 +01:00
vaxerski
8ffd244ef6 fix animate_manual_resizes with moves 2022-10-19 21:17:49 +01:00
vaxerski
bf9d31ce49 fix maximized windows not hiding tiled 2022-10-19 15:17:35 +01:00
vaxerski
98a32f5e52 render layer snapshot without blur 2022-10-19 11:00:59 +01:00
vaxerski
dc1737f128 allow glob wildcard in addreserved 2022-10-17 23:23:07 +01:00
Mihai Fufezan
48634d7e4a Nix & meson: 0.15.3 -> 0.16.0 2022-10-18 01:16:44 +03:00
vaxerski
ecf0cdaba4 a bit more default config nice addons 2022-10-17 16:59:52 +01:00
vaxerski
286cb90c48 ignore OR windows' size hints 2022-10-17 14:26:18 +01:00
vaxerski
3f77cde50e set XCURSOR_SIZE if not set in init 2022-10-17 14:01:04 +01:00
vaxerski
1145654987 default & example config overhaul 2022-10-17 13:48:21 +01:00
vaxerski
da4cfb9c32 use size hints when available in xwayland default geom 2022-10-17 11:18:45 +01:00
vaxerski
58375bc87a Add support for rgba() and rgb() colors in the config 2022-10-16 22:26:02 +01:00
Vaxry
83d99ce5bd Merge pull request #857 from K1llf0rce/max_size_rule
add maxsize window rule
2022-10-15 20:09:14 +01:00
K1llf0rce
dca30815b0 add maxsize window rule 2022-10-15 17:04:57 +02:00
vaxerski
edeb759bb1 add loose focus behavior 2022-10-15 14:13:21 +01:00
Mihai Fufezan
610d4d9473 Nix: update nixpkgs 2022-10-15 02:21:13 +03:00
Mihai Fufezan
f30e572e00 Nix & meson: 0.15.0beta -> 0.15.3beta
Nix: remove merged libdrm update
2022-10-15 01:40:25 +03:00
vaxerski
34cd8b125a rework focus system to be more safe and faster 2022-10-14 20:46:32 +01:00
vaxerski
b0544dbfff remove old log 2022-10-14 14:25:28 +01:00
vaxerski
a7bdfc06ca added bringactivetotop dispatcher 2022-10-14 14:22:31 +01:00
Narice
7e7cb40909 Nix modules: fix environment variables 2022-10-14 16:19:14 +03:00
vaxerski
724fa4a7d4 add touch binding to output 2022-10-14 12:38:44 +01:00
Vaxry
cee0645fd1 Merge pull request #813 from histausse/touch_dev_rotation
Add input:touchdevice:transform config
2022-10-14 12:26:31 +01:00
vaxerski
df9409b8a2 rename transform in DC to touch_transform 2022-10-14 12:23:11 +01:00
Vaxry
f274a70edf Merge pull request #852 from NotAShelf/patch-1
add `PKGBUILD` to ignored files
2022-10-14 11:11:28 +01:00
NotAShelf
ef24a27ade add PKGBUILD to ignored files 2022-10-14 11:46:34 +03:00
vaxerski
670d6ce8f4 fix windowsOut disabled with fadeOut enabled 2022-10-13 21:32:28 +01:00
Vaxry
f3917f2122 Merge pull request #844 from brodi1/hyprctl-json-fix
fix invalid json output by adding a missing comma
2022-10-13 15:32:46 +01:00
Brodi
5d6e56b67c fix invalid json output by adding a missing comma 2022-10-13 16:21:58 +02:00
vaxerski
624303bfb9 check for same workspace in workspace rule 2022-10-13 15:19:30 +01:00
vaxerski
eb3c132fc5 set workspace name in previous 2022-10-13 15:17:16 +01:00
vaxerski
170def35d7 simplify shouldRenderWindow and fix one cond 2022-10-12 18:37:11 +01:00
vaxerski
2ee9fb0675 don't recalc offset on monitor reload offset auto 2022-10-12 15:16:31 +01:00
vaxerski
1396d2a39b fix crash in renderWorkspaceWithFullscreenWindow 2022-10-11 20:29:51 +01:00
vaxerski
7ecc41db9c unsetenv on no XWayland 2022-10-11 12:00:06 +01:00
vaxerski
7ffe4eda12 [gha] build man pages 2022-10-11 10:58:53 +00:00
Simplykyle
25756afad5 Add debug coredump instructions (#812) 2022-10-11 11:58:26 +01:00
vaxerski
8880298f50 [gha] bump flake inputs 2022-10-11 09:33:36 +00:00
vaxerski
d89355f0a6 update wlroots 2022-10-11 10:32:11 +01:00
Vaxry
ae91f6610f Merge pull request #825 from Dickby/Fix_nproc_in_Makefile
Replace $(nproc) with $(shell nproc).
2022-10-10 22:36:10 +01:00
Felix Dick
6e7143e0f5 Replace $(nproc) with $(shell nproc). 2022-10-10 17:13:56 +02:00
Vaxry
f55f56f260 Merge pull request #823 from Dickby/simplify_matrix_calculations
Simplify matrix calculations
2022-10-10 15:59:25 +01:00
Histausse
6287f2b71b use static for transformation matrices 2022-10-10 12:52:12 +02:00
Felix Dick
7e781f24c5 Merge branch 'main' into simplify_matrix_calculations 2022-10-10 02:45:40 +02:00
Felix Dick
3bf7c5aea1 Change matrixProjection function stop use matrixFlip180 everywhere. 2022-10-10 01:35:42 +02:00
Felix Dick
092dbda88a Let openGL transpose the matrixes for us. 2022-10-10 01:32:04 +02:00
vaxerski
cb687c208c [gha] bump flake inputs 2022-10-09 20:30:56 +00:00
vaxerski
945b4d7139 update wlroots dep 2022-10-09 21:29:54 +01:00
vaxerski
881f828250 better subsurface handling on unmaps 2022-10-09 17:40:30 +01:00
vaxerski
0743dab3f0 use popup base surface instead of subsurface for addPopupGlobalCoords 2022-10-09 17:10:20 +01:00
vaxerski
496e37d044 ensure texture safety in clearWithTex() 2022-10-09 17:02:39 +01:00
Vaxry
1263bd5dcb Merge pull request #817 from Dickby/transform_box_in_renderRectWithDamage
inverse_transform the box in renderRectWithDamage.
2022-10-09 09:46:22 +01:00
Felix Dick
9ee78b1a92 inverse_transform the box in renderRectWithDamage. 2022-10-09 01:58:00 +02:00
Histausse
406b2fe6dc Add additionnal matrices and rename config var 2022-10-09 00:45:34 +02:00
vaxerski
90f2259f5e [gha] bump flake inputs 2022-10-08 17:01:31 +00:00
vaxerski
948f4978e7 update wlroots dep 2022-10-08 18:00:20 +01:00
Histausse
32ae0c51f0 Add input:touchdevice:td_rotation config
Add support for touch device roation. The rotation is
set globally with `input:touchdevice:td_rotation config` and by
device with `td_rotation` in a device block.
2022-10-08 15:25:46 +02:00
Vaxry
fe4a97f245 Merge pull request #794 from Dickby/pixman_early_outs
Check earlier if pixman_region is empty in some places.
2022-10-08 12:00:17 +01:00
Felix Dick
2f3528c076 Check earlier if pixman regions are empty. 2022-10-08 11:20:04 +02:00
vaxerski
1964bcb13f add open/close layer events 2022-10-07 22:25:00 +01:00
Vaxry
4b779ac142 Merge pull request #811 from Dickby/add_missing_pixman_region32_fini
Add missing pixman_region32_fini.
2022-10-07 22:20:35 +01:00
vaxerski
abc2d442dd fix a VRAM leak in destroyMonitorResources 2022-10-07 22:19:23 +01:00
Felix Dick
b64f1fc5c4 Add missing pixman_region32_fini. 2022-10-07 23:11:20 +02:00
vaxerski
33d264eaa7 release all fbs in destroyMonitorResources 2022-10-07 21:13:28 +01:00
Vaxry
5e3b8c3233 Merge pull request #807 from Dickby/fix_monitor_transforms
Transform the box data send to texture shaders.
2022-10-07 20:12:28 +01:00
Felix Dick
bbdfb7853d Transform the box data send to texture shaders. 2022-10-07 20:55:41 +02:00
vaxerski
a19b152e4a make swipe respect slidevert 2022-10-07 16:52:53 +01:00
vaxerski
1468001d3b offset floating windows out of bounds on ws anims 2022-10-07 12:34:54 +01:00
vaxerski
7faa3c367d Added clipping support, clip windows on slide anim 2022-10-07 10:43:51 +01:00
vaxerski
fd379db846 swallow improvements 2022-10-07 09:46:01 +01:00
vaxerski
28a6e0ce31 [gha] bump flake inputs 2022-10-06 21:09:10 +00:00
vaxerski
af7d60b3f8 revert wlroots ver to fix critical gpu issue 2022-10-06 22:08:08 +01:00
Vaxry
c4487534d2 Merge pull request #801 from fufexan/scrollfactor
Add input:touchpad:scroll_factor
2022-10-06 21:26:11 +01:00
Mihai Fufezan
e4820d1c71 Add input:touchpad:scroll_factor 2022-10-06 22:47:05 +03:00
vaxerski
b4a8efc1a7 fix naming when workspace back and forth 2022-10-06 20:40:58 +01:00
vaxerski
9480c0fb90 fix workspace previous with multi-mon ws moves 2022-10-06 20:18:49 +01:00
vaxerski
f901c60da5 return true on vt switch keysyms to avoid printing stuff 2022-10-06 19:31:32 +01:00
vaxerski
922e978f56 reset sigmask on fork 2022-10-06 19:02:03 +01:00
vaxerski
0508c7d384 more monitor checks for shutdown: 2022-10-06 18:43:50 +01:00
vaxerski
ee3b770cfd more checks in pid gathering 2022-10-06 17:58:38 +01:00
Vaxry
a29af89545 Merge pull request #793 from Dickby/fix_compiler_warnings
Fix compiler warnings.
2022-10-06 12:54:04 +01:00
Felix Dick
552c4b7361 Fix compiler warnings. 2022-10-06 13:42:52 +02:00
vaxerski
d7ef19e2e7 map touch to the correct output 2022-10-06 09:26:05 +01:00
vaxerski
190ddb5697 added a noanim rule 2022-10-06 09:16:40 +01:00
vaxerski
095688712d add minsize rule 2022-10-06 09:09:58 +01:00
vaxerski
d264fbd36a fix string corruption in hyprctl monitors -j 2022-10-06 09:04:46 +01:00
vaxerski
e4527c6b60 use goalv in clientsRequest 2022-10-06 08:54:09 +01:00
Vaxry
32e8eda40a Merge pull request #787 from fufexan/libinput
Add accel profile and scroll method
2022-10-05 21:58:40 +01:00
Mihai Fufezan
477ad2dd82 Add accel profile and scroll method 2022-10-05 23:51:08 +03:00
vaxerski
e90c5c6347 fix tty switch freeze 2022-10-05 21:41:27 +01:00
vaxerski
11ce468996 add dpms status info in hyprctl 2022-10-05 18:14:11 +01:00
vaxerski
9c5023ab1a monitor desc improvements 2022-10-05 17:38:36 +01:00
vaxerski
0e4a894edb add dpms per output 2022-10-05 10:31:47 +01:00
vaxerski
71e2562a41 add desc: to monitor rules 2022-10-05 10:22:33 +01:00
Vaxry
9153a81090 Merge pull request #781 from Dickby/fix_left_handed
Fix getDeviceInt string arg "input:left_handed"
2022-10-05 08:06:38 +01:00
Felix Dick
0d7f6eac9e Merge branch 'make_TTY_unsigned' into fix_left_handed 2022-10-05 04:51:48 +02:00
Felix Dick
6d46ed4011 Fix getDeviceInt string arg "input:left_handed" 2022-10-05 04:25:26 +02:00
Felix Dick
f825b87c2a Fix compiler warnig comparing signed and unsigned integers. 2022-10-05 02:42:51 +02:00
vaxerski
44da575ea8 [gha] bump flake inputs 2022-10-04 22:25:26 +00:00
vaxerski
a587909fd5 update wlroots dep 2022-10-04 23:24:31 +01:00
vaxerski
fd81ba5a4f [gha] bump flake inputs 2022-10-04 22:22:12 +00:00
Vaxry
934f81c93d Merge pull request #777 from Dickby/fix_shader_error
Remove texcoord from QUADFRAGSRC.
2022-10-04 23:20:52 +01:00
Felix Dick
e8be1507ef Remove texcoord from QUADFRAGSRC.
texcoord is unused in the rounding part of the textureshaders.
QUADFRAGSRC isn't using that variable inside the non rounding code.
Because of that opengl optimizes that variable out, and is complaining
if glGetAttribLocation is called on it.
2022-10-05 00:04:32 +02:00
vaxerski
60c414ccad add left_handed config for input 2022-10-04 21:46:41 +01:00
vaxerski
0d702b556d Add switch device handling and binds 2022-10-04 20:07:21 +01:00
vaxerski
9bbae5b8e2 ignore VT switches to current vt 2022-10-04 16:53:09 +01:00
vaxerski
719a5b4f0b use vectorToWindowIdeal in mouse binds 2022-10-04 16:08:55 +01:00
Vaxry
7bdfdaa28a Merge pull request #742 from Dickby/rework_rounding_shader
Rework rounding shader
2022-10-04 14:17:16 +01:00
vaxerski
a80e0cecfe fixes to window swallowing with same pid 2022-10-04 11:16:49 +01:00
vaxerski
3e3f6aef5e additional logic for identical pid swallowing 2022-10-04 10:17:10 +01:00
Vaxry
996938b7e7 Merge pull request #773 from lylac-1/main
focusedmon event check change
2022-10-04 10:04:10 +01:00
lylac
f9325b1655 focusedmon event check change
Compare PLASTWINDOW & PWINDOWTOCHANGETO m_iMonitorID's instead of PWINDOWTOCHANGETO->m_iMonitorID & g_pCompositor->m_pLastMonitor->ID
2022-10-04 18:19:14 +13:00
vaxerski
63dfe305dd log GPU info for debugging 2022-10-03 23:10:15 +01:00
Mihai Fufezan
ec0c6fa22a Nix & meson: 0.14.0 -> 0.15.0 2022-10-04 00:51:49 +03:00
vaxerski
ff5843bd85 anchor to proper quad in floating resize 2022-10-03 22:41:12 +01:00
vaxerski
3bb5971c2e [gha] bump flake inputs 2022-10-03 21:17:33 +00:00
vaxerski
a1d9404f9f update wlroots dep 2022-10-03 22:16:02 +01:00
vaxerski
ab82c4806d allow one less arg in bind 2022-10-03 21:01:08 +01:00
vaxerski
49ab3890aa remove polling from socket2, fully event based 2022-10-03 20:47:15 +01:00
vaxerski
85eea70be4 fix commas in free binds 2022-10-03 16:38:05 +01:00
vaxerski
174b593438 optimize removing trailing spaces 2022-10-03 14:36:56 +01:00
vaxerski
0a08830375 Unify arg lists, allow for trailing spaces in args 2022-10-03 14:29:45 +01:00
vaxerski
a97621b1cb Added window swallowing 2022-10-01 19:19:15 +01:00
vaxerski
355366714e minor OR XWayland fixes 2022-10-01 18:25:02 +01:00
vaxerski
590fbf808b send a focusedmon event on focus change mon 2022-10-01 10:38:53 +01:00
vaxerski
bbeed21e62 fix crash 2022-10-01 08:54:43 +01:00
Felix Dick
c6333ba796 Remove unused ignoreCorners variable from texture shaders. 2022-10-01 03:30:58 +02:00
Felix Dick
6fe103cf06 Cut the number of pixels that call length() in half. 2022-10-01 03:14:13 +02:00
Felix Dick
71733f68ef Merge branch 'fix_rounding_in_size_changing_windows' into rework_rounding_shader 2022-10-01 01:35:13 +02:00
vaxerski
e6c9e3f81d add case for empty strings in isNumber 2022-09-30 21:54:13 +01:00
vaxerski
7579e03b64 include shaders only in opengl.cpp 2022-09-30 18:38:10 +01:00
vaxerski
1ef23a304a remove redundant attrib setting 2022-09-30 17:04:33 +01:00
vaxerski
3c27d1ab13 optimize vector config value setting 2022-09-30 17:03:14 +01:00
vaxerski
59a3c43913 guard event in maximize request 2022-09-30 10:37:09 +01:00
Felix Dick
d867d42366 Merge branch 'main' into fix_rounding_in_size_changing_windows 2022-09-30 01:38:50 +02:00
Felix Dick
6eb7d00386 Send absolute screen coordinates to texture shaders. 2022-09-29 23:19:56 +02:00
vaxerski
2d73da1a79 enter outputs for non-interactive ls-es too 2022-09-29 22:16:43 +01:00
Vaxry
45fe185cb9 Merge pull request #736 from Dickby/fix_bordersize_again
Scale the border size, revert the window scaling according to border
2022-09-29 22:01:06 +01:00
Felix Dick
09268d756f Merge branch 'main' into rework_rounding_shader 2022-09-29 21:15:08 +02:00
Felix Dick
e5dced8b3f Merge branch 'main' into fix_rounding_in_size_changing_windows 2022-09-29 21:13:48 +02:00
Felix Dick
b38e7b596f Don't pass bottomRight to textureShaders compute it within. 2022-09-29 21:10:05 +02:00
vaxerski
da40bf823f apply new node data to all group windows on close 2022-09-29 19:46:33 +01:00
vaxerski
caeb0636fa fix crash on dwindle splitratio alter on single group 2022-09-29 19:41:49 +01:00
Felix Dick
1424539e4d Merge branch 'main' into rework_rounding_shader 2022-09-29 20:41:39 +02:00
vaxerski
bdd9680adf fix ipc event missing on silent movetoworkspace 2022-09-29 19:33:43 +01:00
vaxerski
ff4c22ca90 add fullscreen info to clients request 2022-09-29 19:30:49 +01:00
vaxerski
9f9129e536 focusable checks in nextWindow calls 2022-09-29 16:53:31 +01:00
Felix Dick
ab42e4bccf Merge branch 'main' into fix_bordersize_again 2022-09-29 14:29:03 +02:00
Felix Dick
425b07d1e5 Merge branch 'main' into rework_rounding_shader 2022-09-29 14:24:59 +02:00
vaxerski
2636abca2d use the event data for determining maximize status in requests 2022-09-29 10:24:54 +01:00
vaxerski
ead0e74471 handle maximize toplevel request 2022-09-29 10:20:17 +01:00
Vaxry
dcf5e34bfa Merge pull request #735 from Dickby/fix_splash_position
Splash position fix
2022-09-29 10:07:27 +01:00
Felix Dick
65fb526d5c Even less branching (taken more or less from the border shader). 2022-09-29 06:56:17 +02:00
Felix Dick
10c4f4ba35 Shift splash up if monitor has wider ratio than bgTexture. 2022-09-29 05:29:03 +02:00
Felix Dick
a1319e5110 Merge branch 'main' into fix_bordersize_again 2022-09-29 01:42:28 +02:00
Felix Dick
5233746ac5 Change scaledBorderSize to int. 2022-09-29 01:40:19 +02:00
Felix Dick
0549aa193f fixing your shit. 2022-09-28 23:33:18 +02:00
Felix Dick
168a326609 Merge branch 'main' into rework_rounding_shader 2022-09-28 23:11:11 +02:00
Vaxry
31cb4c49d9 Merge pull request #743 from Dickby/use_double_literals
Use double literals, don't cast integer or float literals to double.
2022-09-28 19:28:13 +01:00
Felix Dick
11ee78f88b Use double literals, don't cast a integer literal to double. 2022-09-28 20:08:41 +02:00
Felix Dick
7edbaea23d Make the rounding texture shaders smaller and more efficient. 2022-09-28 18:40:04 +02:00
vaxerski
ec5ffe8839 rewrite isNumber 2022-09-28 15:32:53 +01:00
vaxerski
e3b1d3c3c5 allow for pure workspace names in dispatchers 2022-09-28 15:26:41 +01:00
vaxerski
458ba3237b use goalv in movetoworkspace 2022-09-28 15:12:15 +01:00
Felix Dick
5ff44467d7 Avoid 38 files to compile every time a shader is modified. 2022-09-28 14:48:05 +02:00
Vaxry
7a775c0584 Merge pull request #737 from Dickby/use_max_instead_of_clamp_in_some_places
Replace clamp with max if there is no upper bound.
2022-09-26 20:49:56 +01:00
Felix Dick
87afc8c250 Replace clamp with max if there is no upper bound. 2022-09-26 21:10:24 +02:00
Felix Dick
cd2b2c4fba Scale the border size, revert the window scaling according to border 2022-09-26 17:38:08 +02:00
Felix Dick
c48336aac3 Scale the cairo matrix to fit the monitor dimensions. 2022-09-26 06:35:00 +02:00
Vaxry
f70b57f360 Merge pull request #732 from Dickby/main
Remove trailing whitespace.
2022-09-25 19:32:24 +01:00
Felix Dick
bf3f519eb7 Remove trailing whitespace. 2022-09-25 20:07:48 +02:00
Vaxry
190229942f Merge pull request #727 from Dickby/main
Scale border size in window size pos calculation
2022-09-25 17:21:31 +01:00
Dickby
e476382d08 scale border size in dwindle layout window sizes. 2022-09-25 18:12:42 +02:00
Dickby
c885afcbc6 Scale border size in calculations of windows 2022-09-25 12:42:39 +02:00
vaxerski
fad5fc587d guard kb settings in xkb translation state 2022-09-24 21:07:18 +01:00
vaxerski
73dbacd16d overwrite wsbind rules on existing 2022-09-24 13:42:18 +01:00
vaxerski
65fb0cf0f6 fix custom rules on null modelist 2022-09-24 13:10:11 +01:00
vaxerski
5101ddeff1 fix oopsies in rule code 2022-09-24 11:30:41 +01:00
Vaxry
959557ecc3 Merge pull request #716 from Dickby/main
Fixing my last change
2022-09-23 18:18:55 +01:00
Dickby
bccc81d306 Fixing my last change
It wasn't a problem with the bug i tried to fix.
But there  would be a problem if some function would dereference pPreviousGroupMember from the node that was PHEAD->pNextGroupMember.
Please don't be mean!
2022-09-23 19:13:05 +02:00
Vaxry
718de0d9fa Merge pull request #715 from Dickby/main
fix crash
2022-09-23 17:05:04 +01:00
vaxerski
fd6116c0cd style 2022-09-23 17:01:27 +01:00
Dickby
00b16888bf style fix 2022-09-23 17:59:33 +02:00
Vaxry
abee2da5bd Merge pull request #706 from DashieTM/main
Add "highest" mode to Monitor for autoconfiguration.
2022-09-23 16:50:24 +01:00
vaxerski
695411f1bd don't decorate on only no gaps 2022-09-23 16:47:58 +01:00
Dickby
f9d8b3096a fix crash
Fixes #711
2022-09-23 17:01:46 +02:00
vaxerski
e5d143b238 support more wlr_cursor events 2022-09-22 21:14:02 +01:00
vaxerski
37f2e1ddbe don't recalc pseudo on fullscreen 2022-09-22 20:57:09 +01:00
vaxerski
ef3eb37c7f support max in size rules 2022-09-22 18:13:23 +01:00
Mihai Fufezan
db551b8970 Nix & meson: bump to 0.14.0 2022-09-22 19:59:38 +03:00
vaxerski
c08218301b disallow pinning fullscreen 2022-09-22 16:48:40 +01:00
vaxerski
75aaf11a9c default pass_mouse_when_bound to 0 2022-09-22 16:33:45 +01:00
Fabio Lenherr
c4e782ca5d remove more silly mistakes 2022-09-22 00:50:23 +02:00
Fabio Lenherr
da2c2ddc21 remove empty line 2022-09-22 00:47:09 +02:00
Fabio Lenherr
5272588270 fix silly mistakes 2022-09-22 00:45:56 +02:00
Fabio Lenherr
215125bd66 add refreshrate or resolution preference 2022-09-22 00:22:39 +02:00
Fabio Lenherr
30d16373d0 fix Hz Log 2022-09-21 22:40:01 +02:00
Fabio Lenherr
c1feb683ce added high to monitor resolution 2022-09-21 22:29:52 +02:00
vaxerski
d3ffccd45f accept any case in binds 2022-09-21 17:41:26 +01:00
Mihai Fufezan
d49af1cc18 flake: add libdrm overlay until it gets updated 2022-09-21 18:10:35 +03:00
vaxerski
8b46d0b5a9 simplify some local vars 2022-09-21 15:11:09 +01:00
vaxerski
336883dda3 [gha] bump flake inputs 2022-09-21 14:09:05 +00:00
vaxerski
65ec8c7694 update wlroots dep 2022-09-21 15:07:57 +01:00
vaxerski
79c645f8cd handle touch devices internally as objects 2022-09-21 14:39:34 +01:00
vaxerski
d44cc9f112 [gha] bump flake inputs 2022-09-21 13:23:15 +00:00
vaxerski
1963da2d47 update wlroots dep 2022-09-21 14:22:05 +01:00
vaxerski
2b99dbb446 better cycling in fullscreen with pinned 2022-09-21 14:16:13 +01:00
vaxerski
d24f31de51 disallow fullscreen pinned 2022-09-21 14:09:26 +01:00
Fabio Lenherr / DashieTM
d51c7ca135 change Preferred mode to use highest refreshrate 2022-09-20 23:41:03 +02:00
vaxerski
8b11a2e1b1 minor mouse bind handling fixes 2022-09-20 22:23:02 +01:00
vaxerski
b4bcba935d disallow move/resize dispatchers on fullscreen windows 2022-09-20 19:58:08 +01:00
vaxerski
7f3750bd75 disable enabling groups on fullscreen windows 2022-09-20 18:08:10 +01:00
vaxerski
7a9423c782 better dwindle swapping with groups 2022-09-20 18:04:39 +01:00
vaxerski
6f98b3cbd8 fix pinned fade on fs 2022-09-20 15:33:53 +01:00
vaxerski
2dd1661aec fix groups with fullscreen 2022-09-20 12:17:34 +01:00
vaxerski
cde624ec6a fix moving between fullscreen workspaces 2022-09-20 10:16:58 +01:00
vaxerski
b82621c4ec fix mouse binds being stuck 2022-09-20 10:02:20 +01:00
vaxerski
5b6c8d5b0f fix misc fullscreen issues 2022-09-20 09:55:25 +01:00
vaxerski
4dca2b945b fix LS fading out on ws change 2022-09-20 09:46:55 +01:00
Vaxry
a8943246a7 Merge pull request #684 from tomahk/main
fix some bugs with attaching/disabling monitors
2022-09-19 21:08:48 +01:00
vaxerski
e42de0b778 export HYPRLAND_CMD for scripts 2022-09-19 21:06:44 +01:00
tomahk
5146165599 this is c++, use nullptr 2022-09-19 21:45:00 +02:00
tomahk
73e19aee6f prevent assert killing Hyprland after reenabling monitor 2022-09-19 20:44:33 +02:00
tomahk
3780361b95 fix hyprland freeze when undocking from docking station 2022-09-19 20:42:59 +02:00
vaxerski
ec6144e5da fix fadeout on unmap fullscreen 2022-09-19 19:09:21 +01:00
vaxerski
b6eaeffcf6 introduce new mouse binds in default and example cfgs 2022-09-19 19:06:22 +01:00
vaxerski
c24b45671a mouse binds overhaul 2022-09-19 19:04:48 +01:00
vaxerski
85c7aaf155 fade control for fullscreen action on windows 2022-09-19 17:26:11 +01:00
vaxerski
696253b348 fix special workspace dispatcher logic 2022-09-19 16:01:42 +01:00
vaxerski
abb6db9c37 don't apply alpha to fadingOut on setWindowFullscreen 2022-09-19 11:44:11 +01:00
vaxerski
18b483b8e1 fix ws switching with LS opacity 2022-09-19 10:40:42 +01:00
vaxerski
7c809a3059 fullscreen animation en-nice-ment 2022-09-19 10:23:13 +01:00
vaxerski
4070e1a148 fix wonky focus on movetoworkspace 2022-09-18 17:26:12 +01:00
vaxerski
dd61f88ed1 guard invalid FB allocs 2022-09-18 12:40:49 +01:00
vaxerski
29626989e7 fix focus follows mouse 0 event sending on wrong window 2022-09-18 12:35:05 +01:00
vaxerski
cf32d28082 fix groupbar being wonk on scaled 2022-09-18 12:13:16 +01:00
vaxerski
5131a4acaf fix special fullscreen 2022-09-17 15:07:03 +01:00
vaxerski
a72a39ebd5 minor swipe fixes 2022-09-17 15:05:12 +01:00
vaxerski
151e013241 fix refocus on same workspace 2022-09-17 12:10:06 +01:00
vaxerski
fa2d81b649 fix animation issues with workspace silent 2022-09-16 21:17:03 +01:00
vaxerski
037d4ed422 handle multi-ws swaps in layouts 2022-09-14 17:30:16 +02:00
vaxerski
9f82278d65 simplify dwindle swap 2022-09-14 17:24:45 +02:00
vaxerski
8e0f7b9b11 Various subsurface handling fixes 2022-09-14 16:34:41 +02:00
vaxerski
a96acc8fa4 only check for visible on xdg 2022-09-13 22:23:48 +02:00
vaxerski
5a146e9d90 guard surface in addsurfaceglobaloffset 2022-09-13 21:49:55 +02:00
vaxerski
da10022d84 fix an unholy memory safety issue 2022-09-13 20:27:07 +02:00
vaxerski
e518adf1ac don't iterate over subsurfaces in unmap 2022-09-13 15:44:50 +02:00
vaxerski
d8dbe26f31 tick config after reload request 2022-09-13 15:36:49 +02:00
vaxerski
e9f226797e Added monitor mirroring 2022-09-13 15:25:42 +02:00
vaxerski
7d4f0a3199 verify visibility of new geom in floating creation 2022-09-13 12:29:56 +02:00
vaxerski
0062281092 added wsbind 2022-09-12 21:05:52 +02:00
vaxerski
81f267dff9 add default speed to hyprctl devices mice 2022-09-12 17:09:04 +02:00
vaxerski
a09c614c2d more forceRendering checks in shouldRenderWindow 2022-09-12 15:33:25 +02:00
Vaxry
b49d7007b5 Merge pull request #659 from hyprwm/hyprctl-nopoll
hyprctl-nopoll
2022-09-11 20:48:22 +02:00
vaxerski
864e227f5d fix decos on pinned 2022-09-11 20:27:59 +02:00
vaxerski
82aa78916d hyprctl-nopoll 2022-09-10 21:21:28 +02:00
vaxerski
f024d7114f allow current in monitorfromstring 2022-09-10 19:57:57 +02:00
vaxerski
8808d40008 added misc:disable_autoreload 2022-09-10 17:28:41 +02:00
vaxerski
d94fe3d063 added window pinning 2022-09-10 13:11:02 +02:00
vaxerski
f663fa209c minor code styling fixes 2022-09-09 19:08:11 +02:00
Mihai Fufezan
9370c7aa8a Nix modules: add recommendedEnvironment option 2022-09-09 17:01:24 +03:00
vaxerski
928158bbfb prevent missed surface size updates on fullscreen window close 2022-09-08 23:02:29 +02:00
vaxerski
bacfae3084 guard drag in destroyDrag 2022-09-08 21:25:16 +02:00
vaxerski
0d95a0174c more guarding in cleanup pid gathering 2022-09-08 20:55:25 +02:00
vaxerski
0eb5ecafb9 consistent output of window addresses 2022-09-08 18:47:39 +02:00
vaxerski
49a55f136e fix addreserved lag 2022-09-08 14:11:32 +02:00
vaxerski
64be57b780 fix group decos on added windows 2022-09-07 20:36:39 +02:00
Vaxry
6e195a6b8c Merge pull request #636 from viperML/fix-man
docs: fix github workflow
2022-09-07 13:05:16 +02:00
Fernando Ayats
8d3f6c5d84 docs: fix github workflow 2022-09-07 12:44:20 +02:00
vaxerski
5c470d2e54 damage drag on destroy 2022-09-07 12:18:52 +02:00
Mihai Fufezan
26910a8b63 Nix HM module: fix build error
Apparently HM doesn't like having `lib.mkDefault` near strings.

Fixes #635
2022-09-07 13:11:03 +03:00
vaxerski
44a2d755c6 Added Xwayland and floating props to windowrulev2 2022-09-07 11:25:44 +02:00
Mars
cf5426f2d8 Fix typo in module.nix 2022-09-07 11:48:08 +03:00
Mihai Fufezan
1d631c8a23 Nix modules: add common environment variables 2022-09-07 01:24:09 +03:00
vaxerski
789eedd115 fix a minor bug with no gaps when only and groups 2022-09-06 19:59:59 +02:00
vaxerski
4a8274e5f0 fix dwindle no gaps when only when dissolving a group 2022-09-06 18:12:41 +02:00
vaxerski
4b7d28d2cb fix last partial commit 2022-09-06 18:12:25 +02:00
vaxerski
5fdd1dd60f simplify config monitor reloads and rearrange layers 2022-09-06 17:26:18 +02:00
vaxerski
e71a4d75de Added windowrulev2 2022-09-06 11:57:11 +02:00
vaxerski
f002bd1603 wrap lastwindow in quotes in hyprctl json 2022-09-05 23:07:56 +02:00
vaxerski
16f1d1b99b guard unsafe state in unmap ls 2022-09-05 22:35:41 +02:00
vaxerski
c1bc8d46e9 use lastMonitor in mapWindow 2022-09-05 22:04:49 +02:00
vaxerski
94ca386a8c set last monitor and dont refocus in some cases (changeworkspace) 2022-09-05 21:36:22 +02:00
vaxerski
2ba7cb2414 escape json strings in workspaces lastwindow title 2022-09-05 21:32:37 +02:00
vaxerski
5b5f36f494 fix transformed blur on new optimizations 2022-09-05 21:26:21 +02:00
vaxerski
a74b8033ca added a submap IPC event 2022-09-05 13:50:52 +02:00
vaxerski
41883e0522 fix wonky behavior with silent workspace rule 2022-09-05 11:44:43 +02:00
vaxerski
3ea89e6171 fix splash positioning 2022-09-05 11:31:54 +02:00
vaxerski
d6c06318af don't accumulate from virtual 2022-09-05 11:19:40 +02:00
vaxerski
cb839c9dcc guard pFoundWindow in CInputManager under fullscreen 2022-09-05 00:59:13 +02:00
vaxerski
3dd514a452 fix a damage issue with transformed blur 2022-09-04 23:08:04 +02:00
vaxerski
6afab12b91 fix blur on transformed displays 2022-09-04 19:27:38 +02:00
vaxerski
7a3b57c99c send accumulated modifiers to surfaces 2022-09-04 18:46:28 +02:00
vaxerski
ba0c5fe0bb fix mouse focus not returning from a LS on follow mouse 0 2022-09-04 18:42:11 +02:00
vaxerski
f6ecef0959 add lastwindow info to hyprctl workspaces 2022-09-04 18:32:03 +02:00
vaxerski
ff26531e11 use activateSurface in unconstrainMouse 2022-09-04 11:29:49 +02:00
vaxerski
fbd2b4799d Fix some more crimes against humanity 2022-09-03 22:49:52 +02:00
Mihai Fufezan
1664f81cae Nix: revert HM module import fix
fixes #619
2022-09-03 23:22:39 +03:00
vaxerski
c425e620af fix some minor crimes against humanity 2022-09-03 19:35:17 +02:00
vaxerski
f4add0ac6d refocus on reserved area 2022-09-03 15:35:53 +02:00
vaxerski
3c3f80c2fe simplify code and update monitor on warp 2022-09-03 11:55:19 +02:00
Mihai Fufezan
eee0cad4d0 Nix modules: fix imports 2022-09-03 02:20:20 +03:00
Mihai Fufezan
0ea96e87c0 flake: remove overlay warning 2022-09-03 01:55:28 +03:00
vaxerski
5d09bb647b fix up styling 2022-09-02 23:56:22 +02:00
vaxerski
f5697095bc unify monitor args 2022-09-02 11:53:12 +02:00
vaxerski
56203b1757 fix no_gaps_when_only with a group 2022-09-01 19:46:38 +02:00
Fernando Ayats
c0a7dffcdc nix: move wlroots and add nvidia patches (#608) 2022-09-01 20:35:50 +03:00
vaxerski
8581e71789 optimize calls in toggleSpecialWorkspace 2022-09-01 11:47:48 +02:00
vaxerski
bb90ff0461 sanity check on last window 2022-09-01 11:46:41 +02:00
vaxerski
1d4d2f4793 [gha] bump flake inputs 2022-09-01 09:25:26 +00:00
vaxerski
7f62cbc48a Update wlroots dep 2022-09-01 11:24:15 +02:00
vaxerski
f2d84a7e3a guard parent in X11TransientFor 2022-09-01 10:16:23 +02:00
vaxerski
095185cfe7 guard parent in X11TransientFor 2022-09-01 10:15:55 +02:00
vaxerski
f77fac9df9 warp only on another monitor in changeworkspace 2022-08-31 21:39:27 +02:00
vaxerski
dacaf72e02 remember last window on workspace 2022-08-31 17:02:49 +02:00
Mihai Fufezan
0ad261aa9c flake: formatting 2022-08-31 12:26:12 +03:00
Mihai Fufezan
7610c20761 Nix & meson: 0.11.1 -> 0.12.1
flake: add commit to wlroots version
2022-08-31 12:22:32 +03:00
vaxerski
4103bca056 default rounding to 0 2022-08-31 11:17:04 +02:00
vaxerski
21a1b62b6a remove tiling node when invalid 2022-08-31 11:14:33 +02:00
vaxerski
7f483dfdb0 guard psurface in activateSurface 2022-08-31 11:12:46 +02:00
vaxerski
1cf46fd6a2 added closewindow dispatcher 2022-08-30 21:35:27 +02:00
vaxerski
eb658dcb61 finally fixed transformed snapshots 2022-08-30 19:40:19 +02:00
vaxerski
195ec2b092 fix LS popup damage 2022-08-30 19:21:45 +02:00
vaxerski
dd6aba07e9 revert x11 size hints 2022-08-30 16:12:11 +02:00
vaxerski
d35d949bc5 use sizehints if existent for X11 default floating 2022-08-30 13:07:54 +02:00
vaxerski
48eb2e0d6f Added window dimming 2022-08-30 12:46:17 +02:00
vaxerski
179562b646 fix dwindle groupbars 2022-08-29 19:52:35 +02:00
vaxerski
20c050e890 set last monitor on move focus dispatcher 2022-08-29 18:50:10 +02:00
Mihai Fufezan
bdd20c401d Add HiDPI xwayland + wlroots patches (#591) 2022-08-29 16:51:39 +03:00
vaxerski
6865660e51 disable fullscreen and floating dispatchers on special 2022-08-29 14:55:11 +02:00
vaxerski
6c8ce734fb fix segfault in inactive sessions 2022-08-29 11:17:42 +02:00
vaxerski
09495375b5 ratelimit setting cursor 2022-08-28 22:45:05 +02:00
vaxerski
3c20ecb04d ignore oversized popups' dims in global coords 2022-08-28 21:20:18 +02:00
vaxerski
5da114477f move X11 transients to top on parent top 2022-08-28 19:47:06 +02:00
vaxerski
c757fa54e1 Allow passing the mouse as well in pass 2022-08-28 17:01:48 +02:00
vaxerski
16f8d46391 Force wlroots to not send leave events in pass to XWayland
Massive hack, kill me
2022-08-28 16:43:15 +02:00
vaxerski
5726f394b1 fix subsurface UV handling on oversized windows 2022-08-28 14:43:25 +02:00
vaxerski
f5f99c6700 reset uv on invalid buffer source box 2022-08-28 14:32:06 +02:00
vaxerski
cfa6c01df0 remove double drm and dmabuf creation 2022-08-28 12:32:26 +02:00
vaxerski
d413388761 Multiple improvements to the shutdown procedure 2022-08-28 11:19:08 +02:00
vaxerski
4203a61b69 minor fixes to the viewporter behavior 2022-08-28 10:41:47 +02:00
vaxerski
80b3a436d2 better find device cats 2022-08-28 10:25:48 +02:00
vaxerski
5d9d55a245 fix device closing 2022-08-28 10:20:26 +02:00
Vaxry
52c0ba544c Viewporter implementaion (#585)
Implementation of the `wp_viewporter` core protocol and some bugfixes
2022-08-28 10:14:43 +02:00
Vaxry
8b5c64c8fd Merge pull request #589 from alec-lefors/drm-leasing
fix more indents
2022-08-28 00:07:01 +02:00
Alec LeFors
2ea5f50f40 fix more indents, im sorry vaxry 2022-08-27 17:57:02 -04:00
Vaxry
1d97ad9856 Merge pull request #588 from alec-lefors/drm-leasing
implemented DRM leasing
2022-08-27 23:47:41 +02:00
Alec LeFors
1d43bb70d4 fix indents, change crit log to info 2022-08-27 17:24:36 -04:00
vaxerski
573cb0d4e0 fix parser in nested categories 2022-08-27 23:12:01 +02:00
Alec LeFors
59d7cfcd02 implemented DRM leasing for VR headsets 2022-08-27 17:10:13 -04:00
vaxerski
ed2cacc5d5 fix styling in const ptrs 2022-08-27 21:37:35 +02:00
Nicholas Cioli
df4c1c02a6 fix xwayland config option for nix (#587)
When building Hyprland in nix using the following home-manager recipe:

```nix
wayland.windowManager.hyprland = {
    enable = true;
    xwayland = false;
  };
```

The default nix configuration still makes reference to a compile argument `NO_XWAYLAND`, but the `meson_options.txt` only makes reference to `xwayland`. This causes the build to fail with:

```
meson.build:1:0: ERROR: Unknown options: "NO_XWAYLAND"
```

This change fixes that issue. This still doesn't allow you to build Hyprland without having XWayland installed (#178), but it should at least allow for valid nix configurations for when that issue gets resolved.
2022-08-27 21:45:48 +03:00
vaxerski
8122505825 pass press and release events separately 2022-08-27 19:29:28 +02:00
vaxerski
0964448f93 fix fullscreen in moving ws 2022-08-27 19:11:21 +02:00
vaxerski
5d63152219 added a forceinput rule 2022-08-27 13:01:55 +02:00
vaxerski
aaa834d0c3 fix logic in candidates on unmap 2022-08-27 12:02:25 +02:00
vaxerski
28966d85ae guard nullptr in unmap 2022-08-27 12:01:04 +02:00
vaxerski
a648b452dd fix internal keybinds 2022-08-26 19:19:34 +02:00
vaxerski
d53b0a6491 optimize options in dwindle 2022-08-26 19:07:33 +02:00
Mihai Fufezan
80d522cb26 nix & meson: update version to 0.11.1 2022-08-26 19:48:22 +03:00
vaxerski
dbd774fedb simplify a bit of code 2022-08-26 18:02:10 +02:00
Mihai Fufezan
bf00bf7963 Nix: add nixConfig 2022-08-26 18:58:42 +03:00
vaxerski
949655005a added an event for moving workspace 2022-08-26 16:05:02 +02:00
Vaxry
56caba5f01 updated readme previews 2022-08-26 11:41:07 +02:00
vaxerski
b09f157b93 fix fullscreen on workspace rule silent 2022-08-26 11:33:36 +02:00
vaxerski
10f529ada7 added a specialWorkspace anim leaf 2022-08-26 11:26:23 +02:00
vaxerski
f7c741317f fix shadows on silent rule 2022-08-26 01:08:11 +02:00
vaxerski
b16a57ceeb fix window rules 2022-08-26 00:38:20 +02:00
vaxerski
0eb86f4b0d fix silent workspaces with back and forth 2022-08-26 00:19:57 +02:00
vaxerski
7b01c3d028 allow specifying window for toggle floating 2022-08-25 22:34:53 +02:00
vaxerski
89018bfa95 remove leftover code that didnt work 2022-08-25 21:38:01 +02:00
vaxerski
0d1a9e4ba9 modify exit behaviour a bit 2022-08-25 21:35:47 +02:00
vaxerski
e327b0a835 added a swapactiveworkspaces dispatcher 2022-08-25 21:25:28 +02:00
vaxerski
de477a6ff5 don't focus silent windows 2022-08-25 16:47:33 +02:00
Vaxry
e92469121d Merge pull request #573 from NotAShelf/main
Add cleaninstall task
2022-08-24 22:05:27 +02:00
NotAShelf
a9761cb1c8 Merge branch 'hyprwm:main' into main 2022-08-24 23:05:22 +03:00
vaxerski
6c2175ed52 fixes to swapnext logic on dwindle 2022-08-24 22:01:25 +02:00
vaxerski
00ef40dda1 added swapnext and swapprev for master 2022-08-24 21:50:48 +02:00
vaxerski
9c3aeda9f9 added swapnext 2022-08-24 21:40:36 +02:00
NotAShelf
a4f7bd4bc2 fix typo
what is this, clash of clans?
2022-08-24 18:53:30 +03:00
NotAShelf
3fd903ee74 remove unintended whitespace 2022-08-24 18:51:57 +03:00
NotAShelf
83ef951c21 add clean install for those who build from source 2022-08-24 18:47:35 +03:00
NotAShelf
8bbb790d87 [gha] build man pages 2022-08-24 15:46:38 +00:00
vaxerski
ffaf14c19e minor damage fixes 2022-08-24 13:44:48 +02:00
vaxerski
9366c187dc don't find a new candidate to refocus on unfocused unmap 2022-08-24 11:14:11 +02:00
vaxerski
29696d046e remove general:sensitivity from the default config 2022-08-24 11:12:42 +02:00
vaxerski
09f3999b1e Unfocus first on non-internal ws changes 2022-08-23 23:34:36 +02:00
vaxerski
fba7ed97fb don't refocus if candidate is last window 2022-08-23 23:15:04 +02:00
vaxerski
fd70a9184b fix logic in fullscreen close candidates 2022-08-23 23:09:28 +02:00
vaxerski
0a9ac47030 remove unintuitive candidate behavior 2022-08-23 18:25:33 +02:00
vaxerski
e2450247c0 minor fixes to candidate finding 2022-08-23 18:18:18 +02:00
vaxerski
973540bbc5 minor fix on unfocus on fullscreen workspace 2022-08-23 18:01:22 +02:00
vaxerski
f9b2aa5468 don't round popups 2022-08-23 16:54:32 +02:00
vaxerski
451659ec34 fix oversized popup misalignment 2022-08-23 16:52:36 +02:00
vaxerski
a9e34cba93 move monitor damage to separate funcs 2022-08-23 16:07:47 +02:00
vaxerski
48c9e9d83d damage on force warp resize 2022-08-23 15:08:15 +02:00
vaxerski
23c5760538 IME Popup damage fixes 2022-08-23 11:16:35 +02:00
vaxerski
9bfa3ebc50 fix up keyword to accept spaced args 2022-08-22 23:25:11 +02:00
Mihai Fufezan
8feb6f7da1 Nix: add shortRev to version 2022-08-23 00:17:00 +03:00
vaxerski
fb0e81c18e fix up hyprctl dispatch 2022-08-22 19:16:35 +02:00
vaxerski
359df96d53 fix wlr logging 2022-08-22 18:58:29 +02:00
vaxerski
63493b5736 use a custom logging func for wlr 2022-08-22 18:50:38 +02:00
vaxerski
6565c31dbf fix IME grab on multiple open native inputs 2022-08-22 18:40:38 +02:00
vaxerski
575bfa40e5 added misc:float_switch_override_focus 2022-08-22 18:22:26 +02:00
vaxerski
429b2bffed fix minor refocus issue 2022-08-22 18:16:32 +02:00
vaxerski
c83948ea9a added HYPRLAND_LOG_WLR envvar 2022-08-22 15:50:08 +02:00
vaxerski
8a6e29974b [gha] build man pages 2022-08-22 13:16:57 +00:00
Vaxry
4c6d9b7d5a Merge pull request #555 from viperML/update-man
docs: build man pages to repo
2022-08-22 15:16:32 +02:00
Vaxry
9f5e099cd1 Merge pull request #562 from sp1ritCS/s/ospatches
openSUSE patches
2022-08-22 14:47:17 +02:00
vaxerski
8b39a1cf9b always use /usr/share/ for wayland-sessions 2022-08-22 14:46:53 +02:00
Florian sp1rit​
e9551731f0 improve compatability with older meson versions
- changed <compiler>.get_version() to <compiler>.version()

Signed-off-by: Florian "sp1rit"​ <sp1ritCS@protonmail.com>
2022-08-22 14:35:49 +02:00
Florian sp1rit​
39a9980fb1 dropped deprecated gethostbyname check
Done to avoid the rpmlint warning:
hyprland.x86_64: W: binary-or-shlib-calls-gethostbyname /usr/bin/hyprctl
The binary calls gethostbyname. Please port the code to use getaddrinfo.

Signed-off-by: Florian "sp1rit"​ <sp1ritCS@protonmail.com>
2022-08-22 14:35:41 +02:00
vaxerski
d0ec2b72ae report sizes to all windows on fullscreen 2022-08-22 14:22:21 +02:00
vaxerski
e97fa4e26b destroy monitor resources on exit 2022-08-22 14:17:25 +02:00
vaxerski
52318692f0 clean up temp logic in snapshots 2022-08-22 13:38:40 +02:00
vaxerski
86be6c3884 fix LS snapshot rendering logic 2022-08-22 13:36:00 +02:00
vaxerski
21bea0fcb4 typo 2022-08-22 11:37:00 +02:00
vaxerski
83f7fee3f5 fullscreen request only when mapped 2022-08-22 11:35:46 +02:00
vaxerski
f273ebed9c fix another edge case for fullscreen default windows 2022-08-21 23:24:57 +02:00
vaxerski
3cb30e7fb0 fix crash 2022-08-21 23:16:54 +02:00
vaxerski
3e9a8a7bc8 set new optimizations for blur in example configs 2022-08-21 22:59:19 +02:00
vaxerski
7ca50d7566 handle fullscreen pre-map
stupid-ass qt
2022-08-21 22:30:48 +02:00
vaxerski
ebe07c6656 fix incorrect popup handling on oversized 2022-08-21 21:23:05 +02:00
vaxerski
ce62a98470 fix warn 2022-08-21 18:35:45 +02:00
vaxerski
8faac0c9ac minor activewindow and focus fixes 2022-08-21 18:34:38 +02:00
Fernando Ayats
fea6d7deb0 docs: install manpages with meson 2022-08-21 18:00:04 +02:00
Fernando Ayats
463bc7ab13 doc: install mapages 2022-08-21 17:28:56 +02:00
Vaxry
c4ba11729f Merge pull request #557 from xDarksome/main
Add window{open/close/move} IPC events (#549)
2022-08-21 17:10:24 +02:00
vaxerski
5569e1f69c remove unused func 2022-08-21 17:09:35 +02:00
vaxerski
da725d7aa5 warn about outdated keybind cfg 2022-08-21 17:01:32 +02:00
Darksome
f7f3446882 CCompositor::moveWindowToWorkspace -> CWindow::moveToWorkspace 2022-08-21 18:01:26 +03:00
vaxerski
0f63077a07 use a custom translation state in keybinds 2022-08-21 16:43:22 +02:00
xDarksome
0f25f3aee3 Merge branch 'hyprwm:main' into main 2022-08-21 16:03:51 +03:00
Vaxry
5e1f2539cb Merge pull request #352 from CharlesEkkel/previous-workspace
Add switching to previous workspace
2022-08-21 14:16:52 +02:00
Charles Taylor
9dbdd66da4 fix retrieval of monitor 2022-08-21 22:11:40 +10:00
Charles Taylor
6ec932d11f fix bug which allowed a switch to workspace ID -1.
This only happened for the workspace_back_and_forth setting, since it
was missing a check.
2022-08-21 22:05:35 +10:00
Charles Taylor
3c8c605541 fix style conflicts and config + monitor retrieval 2022-08-21 21:58:46 +10:00
Charles Taylor
9ee42836d5 add general:allow_workspace_cycles option 2022-08-21 20:47:56 +10:00
Charles Taylor
d6ff7e40cf add general:workspace_back_and_forth option 2022-08-21 20:40:06 +10:00
Charles Taylor
04f0efadc3 add switching to previous workspace 2022-08-21 20:21:21 +10:00
viperML
12cdca7422 [gha] build man pages 2022-08-21 08:40:27 +00:00
Fernando Ayats
7ce2c91673 doc: build man pages to repo 2022-08-21 10:39:47 +02:00
Fernando Ayats
aaba11b7a2 gha: build man pages 2022-08-21 10:33:45 +02:00
vaxerski
9513031da3 fix a minor border issue 2022-08-20 22:45:30 +02:00
vaxerski
08e874bcf9 fix special workspace windows being xray with new optim 2022-08-20 20:16:04 +02:00
vaxerski
61aa4ff70e [gha] bump flake inputs 2022-08-20 18:07:29 +00:00
vaxerski
cc3f0ff9e7 update wlroots dep 2022-08-20 20:06:24 +02:00
vaxerski
7af193d921 reload on input and device hyprctl 2022-08-20 18:57:30 +02:00
vaxerski
132c96f867 multiple fixes for device configs 2022-08-20 18:47:48 +02:00
vaxerski
45a0e69286 Find a candidate better on window close 2022-08-20 18:12:59 +02:00
vaxerski
0ebef9a8ae no focus to OR Xwayland 2022-08-20 18:00:50 +02:00
vaxerski
185f93ae64 fix dwindle active for splits 2022-08-20 17:59:15 +02:00
Darksome
776750ee34 Merge branch 'main' of github.com:xDarksome/Hyprland 2022-08-20 13:26:31 +03:00
Darksome
37e1450a4d Impl CCompositor::moveWindowToWorkspace 2022-08-20 13:25:56 +03:00
vaxerski
1b1a0259a8 fix crash 2022-08-19 23:22:59 +02:00
Vaxry
223ca6e286 Merge pull request #548 from FlafyDev/main
add input:kb_file option to use a .xkb file.
2022-08-19 22:39:50 +02:00
FlafyDev
f0ad77251b move absolutePath to MiscFunctions 2022-08-19 23:18:09 +03:00
vaxerski
c2a3896cc9 added dwindle:use_active_for_splits 2022-08-19 22:03:41 +02:00
Vaxry
e749331f30 update wiki links in readme 2022-08-19 21:50:57 +02:00
FlafyDev
69d17bf424 add input:kb_file 2022-08-19 21:01:51 +03:00
vaxerski
946222f4a7 fix typo in swipe alpha control 2022-08-19 17:42:10 +02:00
vaxerski
504d07a87d fix swipe on workspace style fade 2022-08-19 17:36:01 +02:00
vaxerski
81b27be6bb reset lastwindow on full LS focus 2022-08-19 17:29:16 +02:00
vaxerski
f9e30e985c fix refocus on no window 2022-08-19 17:25:07 +02:00
vaxerski
6cae44e2c0 fix custom rounding in shadow deco 2022-08-19 14:52:18 +02:00
vaxerski
43aea417b0 Fix occasional hangups on exit 2022-08-18 22:36:58 +02:00
xDarksome
4af95d4253 Merge branch 'hyprwm:main' into main 2022-08-18 22:24:00 +03:00
Darksome
844c33c980 Add mapwindow, unmapwindow and movewindow IPC events 2022-08-18 22:23:28 +03:00
Vaxry
ece3ac97f9 Merge pull request #543 from Roger-Roger-debug/main
More fullscreen animation fixes
2022-08-18 19:51:37 +02:00
vaxerski
9b62328b22 minor changes to the activelayout event 2022-08-18 17:50:32 +02:00
vaxerski
c1a64a2b9d added main param to keyboards 2022-08-18 17:34:01 +02:00
vaxerski
b078a12eed Added an activelayout event 2022-08-18 17:17:33 +02:00
Roger Roger
eca6e53bd7 Animate workspaces with fullscreen windows 2022-08-18 12:42:21 +02:00
Roger Roger
f2d3aecf00 Don't draw fullscreen windows on other monitors 2022-08-18 12:41:10 +02:00
vaxerski
f3c597bfb7 fix crash 2022-08-18 07:28:07 +02:00
vaxerski
c5a4c83f78 better integrate touch with subsurfaces 2022-08-17 23:23:36 +02:00
vaxerski
f4d11d2d43 fix lastFocus on activateWindow 2022-08-17 22:59:40 +02:00
Vaxry
4c1dba643e Merge pull request #535 from Roger-Roger-debug/main
Fix workspace animation showing on other monitors
2022-08-17 12:35:03 +02:00
Roger Roger
5a20573e91 Fix workspace animation showing on other monitors 2022-08-17 12:12:16 +02:00
vaxerski
cd9c85a150 never animate moving floating windows 2022-08-16 22:40:16 +02:00
vaxerski
bbc6b5d5e0 added misc:animate_manual_resizes 2022-08-16 21:56:54 +02:00
vaxerski
a59641096c ignore dwindle reload on full window null 2022-08-16 21:32:12 +02:00
vaxerski
c6de4ee4b7 more checks in fullscreen event 2022-08-16 21:30:53 +02:00
vaxerski
317b6c430c damage monitor on workspace swipe end 2022-08-16 16:34:36 +02:00
vaxerski
095487ea5d disallow configure from fullscreen 2022-08-16 16:31:44 +02:00
vaxerski
daeb0d3418 force sending size on setWindowFullscreen 2022-08-16 16:30:10 +02:00
vaxerski
7cde50a018 scale hyprerror with the monitor res 2022-08-16 16:25:53 +02:00
vaxerski
bec7501365 fix borders on no_gaps_when_only 2022-08-16 16:19:52 +02:00
vaxerski
ea45c6bfe0 fix memory issue with hyprctl devices 2022-08-16 16:15:43 +02:00
vaxerski
6e2467cc24 fix active keymap in hyprctl devices 2022-08-16 16:10:20 +02:00
vaxerski
454d0d3f9f fix autogen config warning 2022-08-16 15:59:18 +02:00
vaxerski
d2011a4ba9 added support for window selection in moving to workspace 2022-08-15 16:12:53 +02:00
vaxerski
b0b3a5af10 added resizewindowpixel and movewindowpixel 2022-08-15 15:59:07 +02:00
vaxerski
d47bfe6af1 remove unused fixXWaylandWindowsOnWorkspace 2022-08-15 00:34:39 +02:00
Mihai Fufezan
c982312c07 Nix HM module: reload config-only 2022-08-15 00:47:56 +03:00
vaxerski
f0fe0c25d6 added config-only to hyprctl reload 2022-08-14 23:26:18 +02:00
vaxerski
d906617fb6 clean up fullscreen logic in fullscreenWindow event 2022-08-14 23:03:50 +02:00
Mihai Fufezan
ed1b72f37d Nix HM module: add XDG_SESSION_TYPE, fix reload 2022-08-14 23:45:55 +03:00
vaxerski
28867758c4 better fix the last fix 2022-08-14 16:39:56 +02:00
vaxerski
920727cbba fix crash with fullscreen requests 2022-08-14 16:34:40 +02:00
vaxerski
bfe0f844d2 fix wallpaper pixelation in some cases 2022-08-13 22:33:51 +02:00
vaxerski
214c2c7b1c fix groups not updating size on head change 2022-08-13 10:08:35 +02:00
vaxerski
9136783e9c default hardcoded rule to preferred auto 2022-08-12 22:26:35 +02:00
Vaxry
662b6003c6 Merge pull request #515 from SignalWalker/main
fix: support clang in meson build
2022-08-12 22:15:32 +02:00
Fernando Ayats
c136078239 nix: use cleanSource (#518) 2022-08-12 23:12:24 +03:00
Ash Walker
38056c0102 fix: support clang in meson build 2022-08-12 11:21:19 -04:00
vaxerski
db35a1c6d0 ensure egl is current in begin 2022-08-12 17:10:07 +02:00
vaxerski
66b0622bc5 fixed popup unmap damage 2022-08-12 17:04:26 +02:00
vaxerski
0e57651e2f fix segfault with cyclenext null 2022-08-11 22:56:16 +02:00
vaxerski
e5ab9643be enable layers_hog_keyboard_focus by default 2022-08-11 21:52:38 +02:00
vaxerski
b3c5809986 fix flags syntax in json 2022-08-11 21:29:31 +02:00
vaxerski
ae175fdda5 handle json for hyprctl version 2022-08-11 21:28:37 +02:00
vaxerski
9102471610 added hyprctl getoption 2022-08-11 21:16:38 +02:00
vaxerski
f85c765634 change activemon to focusedmon for consistency 2022-08-11 20:55:39 +02:00
vaxerski
37442db20e destroy program in shader destructor 2022-08-11 20:33:35 +02:00
vaxerski
b178891ab3 compile shaders for every context separately 2022-08-11 20:29:21 +02:00
vaxerski
073f08301a fix formatting in focused monitor hyprctl 2022-08-11 20:22:41 +02:00
vaxerski
8fb4669b85 fix cyclenext on fullscreen 2022-08-11 20:21:55 +02:00
vaxerski
008cc63dc0 fix error for popin 2022-08-11 20:17:23 +02:00
vaxerski
aba63a7f96 disallow nested groups creation 2022-08-11 19:56:29 +02:00
vaxerski
c9ed5bf77e fix cyclenext with fullscreen windows 2022-08-11 19:45:37 +02:00
vaxerski
f4f0495050 disable focus to menu x11 types 2022-08-11 19:36:15 +02:00
vaxerski
c319a2aba9 Completely rewrote Dwindle group code 2022-08-11 19:29:39 +02:00
vaxerski
cd75606f42 change active to focused in hyprctl monitors 2022-08-10 23:49:20 +02:00
vaxerski
c7350117f1 reinit render on disconnected displays 2022-08-10 23:19:15 +02:00
vaxerski
69db6207c0 don't damage in unsafe state 2022-08-10 23:14:53 +02:00
vaxerski
58ff04fdf3 added experimental monitor saving 2022-08-10 21:54:09 +02:00
vaxerski
9b39a0c2e0 Added hyprctl setcursor 2022-08-10 21:22:11 +02:00
vaxerski
f64f94ca56 scale rounding in shadows 2022-08-10 18:29:37 +02:00
vaxerski
76877d4b15 minor changes to monitor logging 2022-08-10 18:27:57 +02:00
vaxerski
96f3b62429 multiply by scale in rounding 2022-08-10 18:22:01 +02:00
vaxerski
0162da7a7c adjust curve size for scaled 2022-08-10 18:10:38 +02:00
vaxerski
9eb750c00b added misc:layers_hog_keyboard_focus 2022-08-10 17:46:01 +02:00
vaxerski
03f2e4d42a fix compile 2022-08-10 13:45:20 +02:00
vaxerski
15fc0892c7 further fixes to monitor disabling on launch 2022-08-10 13:44:04 +02:00
vaxerski
a564be73c5 set correct full params in disabled at launch 2022-08-10 13:31:58 +02:00
vaxerski
7e8666754f allow focus to override redirect 2022-08-10 12:49:45 +02:00
vaxerski
c043bcdee6 fixes to toplevel updates 2022-08-10 08:51:59 +02:00
vaxerski
8e5985d70e clean up unconstraining logic 2022-08-09 20:36:21 +02:00
vaxerski
9255a4d2ff ignore further keybinds on submap change 2022-08-09 19:54:06 +02:00
vaxerski
113ac67a16 focus monitor on monitor rule 2022-08-09 18:51:26 +02:00
vaxerski
862722412f handle fullscreen in dwindle groups better 2022-08-09 18:37:50 +02:00
vaxerski
a6d4a4d5f3 warn about incorrect bezier args 2022-08-09 18:15:37 +02:00
vaxerski
e2f61e267e add parse errors for invalid kb layouts 2022-08-09 18:13:13 +02:00
Mihai Fufezan
ecce027c02 flake: add aarch64-linux as supported platform 2022-08-09 13:17:47 +03:00
Mihai Fufezan
f28b71232a unhide window on requested size change 2022-08-09 11:57:09 +03:00
Yavor Kolev
af9d34ab77 Fix my idiotic mistake (#502)
When resolving conflicts i accepted the old changes 👨🏻🔫
2022-08-09 02:22:55 +03:00
Mihai Fufezan
2d33d4aebc nix & meson: update version to 0.10.0 2022-08-09 01:35:05 +03:00
Vaxry
aa39653ea1 Merge pull request #500 from yavko/fix-active-window-json-bools
Fix the fix
2022-08-08 22:58:34 +02:00
Yavor Kolev
6d788f0fc9 Merge branch 'main' into fix-active-window-json-bools 2022-08-08 13:51:08 -07:00
vaxerski
ab6a62f0fd Revert "Merge pull request #499 from yavko/fix-active-window-json-bools"
This reverts commit 5aed6f1bc7, reversing
changes made to 6f137938da.
2022-08-08 22:49:02 +02:00
Yavor Kolev
d460519c30 Fix the fix 2022-08-08 13:48:33 -07:00
vaxerski
b60b52c5cf fix movefocusto with null last 2022-08-08 22:46:11 +02:00
Vaxry
5aed6f1bc7 Merge pull request #499 from yavko/fix-active-window-json-bools
makes active windoe consistient with client json
2022-08-08 22:42:09 +02:00
Yavor Kolev
5cec6257e9 The fix 2022-08-08 13:39:02 -07:00
vaxerski
6f137938da send enter and leave events for surfaces 2022-08-08 21:20:41 +02:00
vaxerski
9fca4b5bc2 fix lastwindow in focusWindow null 2022-08-08 20:42:14 +02:00
vaxerski
87a2ecb90e notify of all mods in pass 2022-08-08 20:31:48 +02:00
vaxerski
bf9d358d3b fix refocus shenanigans with window data 2022-08-08 20:21:11 +02:00
vaxerski
9532ff4287 fix unconstrain coords 2022-08-07 21:27:30 +02:00
vaxerski
d64227e7c7 added basic touch controls 2022-08-07 21:17:03 +02:00
vaxerski
3a8dcf284a add more errors 2022-08-07 19:28:46 +02:00
vaxerski
1744be7bdd log more in output cfg 2022-08-07 19:28:31 +02:00
Vaxry
9fcfaaadb6 Merge pull request #484 from rubyist/unlock-then-sleep
unlock the event queue before sleeping
2022-08-06 23:32:05 +02:00
Scott Barron
355ee15039 unlock the event queue before sleeping 2022-08-06 17:21:54 -04:00
vaxerski
9564a4cd12 added misc:always_follow_on_dnd 2022-08-06 22:26:32 +02:00
vaxerski
64e80991ca added popin anim minimum % 2022-08-06 22:11:08 +02:00
Vaxry
3829b1626e Merge pull request #483 from rubyist/json-when-no-activewindow
Have hyprctl -j activewindows return empty json object if there are no activewindows
2022-08-06 21:56:16 +02:00
Scott Barron
5ce7c71cef use empty json object when no activewindow 2022-08-06 15:36:28 -04:00
vaxerski
793b23dbe6 fix crash in toplevel set appid 2022-08-06 21:15:50 +02:00
vaxerski
070db65a24 [gha] bump flake inputs 2022-08-06 19:11:51 +00:00
vaxerski
6aa448534f guard toplevel funcs 2022-08-06 21:10:37 +02:00
vaxerski
6357a92e46 update wlroots dep 2022-08-06 21:07:32 +02:00
vaxerski
68fd97fae9 change workspace in focusWindow if necessary 2022-08-06 21:05:19 +02:00
vaxerski
1b109d9242 [gha] bump flake inputs 2022-08-06 18:58:50 +00:00
vaxerski
69b8568ccf better foreign toplevel protocol obedience 2022-08-06 20:57:38 +02:00
Vaxry
ccd68049f7 Merge pull request #479 from rubyist/fix-json
output valid json when there are no clients
2022-08-06 01:06:21 +02:00
Scott Barron
206b7f4372 output valid json when there are no clients 2022-08-05 18:53:19 -04:00
Vaxry
aa7177a9e4 Merge pull request #478 from yavko/change-to-json-bools
Change more to json bools
2022-08-06 00:33:33 +02:00
yavko
59088decd0 Change to json bools 2022-08-05 15:23:38 -07:00
Vaxry
c77b571fa7 Merge pull request #474 from yavko/patch-1
Change monitor active to json bool
2022-08-05 23:54:33 +02:00
Vaxry
49f5ae2ef3 Updated the readme header 2022-08-05 22:54:27 +02:00
vaxerski
74cbfdcda4 guard zero border 2022-08-05 22:21:14 +02:00
vaxerski
f66365d9da fix crash in dwindle on create tiled 2022-08-05 20:00:17 +02:00
vaxerski
b30bb22bb8 fix crash in getMaxSizeForWindow 2022-08-05 19:41:50 +02:00
vaxerski
d72f1cc644 fix various shadow damage issues 2022-08-05 19:23:53 +02:00
vaxerski
78e4f274bc remove some spammy logs from IME 2022-08-05 19:03:03 +02:00
vaxerski
14026d4484 move IME panel below the cursor to not obstruct 2022-08-05 18:54:59 +02:00
Vaxry
f44af0366f mention IME in the readme 2022-08-05 18:52:55 +02:00
vaxerski
cd37a1533e reject tiling windows that do not meet the max size requirement 2022-08-05 18:10:59 +02:00
vaxerski
575434f1a4 fix rounding on switching only tiled 2022-08-05 18:08:23 +02:00
vaxerski
97e82fa4fb clamp resizing tiled to their max sizes 2022-08-05 17:58:08 +02:00
vaxerski
4ea37fe64d remember floating size between tiles 2022-08-05 17:52:14 +02:00
vaxerski
ad42392856 fix rare IME crash 2022-08-05 17:19:49 +02:00
vaxerski
e0ada97a24 support zwp_input_method_v2 popups 2022-08-05 17:07:01 +02:00
vaxerski
9a8a6317ff multiple IME fixes 2022-08-05 16:21:08 +02:00
vaxerski
cb5521ec6e fix possible crashes with IME 2022-08-05 13:19:16 +02:00
vaxerski
1c4d0e8c18 added IME protocol support 2022-08-05 13:03:37 +02:00
Yavor Kolev
9f11765707 Change monitor active to json bool 2022-08-04 16:25:56 -07:00
vaxerski
3947fe9e9f simplify border rendering when rounding is 0 2022-08-04 17:21:01 +02:00
vaxerski
c7c0149c08 [gha] bump flake inputs 2022-08-04 14:02:25 +00:00
vaxerski
d58233d08b update wlroots dep 2022-08-04 16:01:11 +02:00
vaxerski
07f68bf72a scale shadows properly 2022-08-04 11:18:33 +02:00
vaxerski
5e97fe8fcd use auto in default configs 2022-08-04 11:11:21 +02:00
vaxerski
81308a9cc3 add position auto for mon config 2022-08-04 11:10:26 +02:00
vaxerski
5dcbce550f only ensure DPMS in hyprctl monitors 2022-08-03 21:19:12 +02:00
vaxerski
5a96142cf8 guard monitor settings 2022-08-03 21:06:51 +02:00
vaxerski
9540106959 check for x11type and not nofocus in wcf 2022-08-03 21:03:08 +02:00
vaxerski
69558acb2e noInitialFocus in onWindowCreatedFloating as a check 2022-08-03 20:15:39 +02:00
vaxerski
37068cf4f0 fix crash with reenabling a monitor 2022-08-03 17:42:19 +02:00
vaxerski
587330d864 fix recursion bomb 2022-08-03 17:32:12 +02:00
vaxerski
9991db159c fix dynamic reenabling of a monitor 2022-08-03 17:29:05 +02:00
vaxerski
f488ec166d fix crash 2022-08-03 17:19:32 +02:00
vaxerski
871c81ac1a erase instead of overwriting monitor rules 2022-08-03 17:15:45 +02:00
vaxerski
36e563c79c reload monitors instantly on tickHyprCtl 2022-08-03 17:12:38 +02:00
vaxerski
69365c7609 fix monitor rule possible segv 2022-08-03 16:20:33 +02:00
vaxerski
c3edb20e04 make monitor IDs permanent 2022-08-03 16:19:00 +02:00
vaxerski
b9be405d32 clear ls lists on monitor disconnect 2022-08-03 16:12:05 +02:00
vaxerski
8dd88d901d guard onDisconnect 2022-08-03 16:05:25 +02:00
vaxerski
996e5a9e69 disallow swapping in fullscreen 2022-08-03 15:35:28 +02:00
vaxerski
fff7534721 fullscreen new window on fullscreen movefocus 2022-08-03 15:33:55 +02:00
vaxerski
cd483a7a37 ignore borders in nogapswhenonly 2022-08-03 15:25:30 +02:00
vaxerski
e13f2480ff fixed missing recursion of force in dwindle 2022-08-03 12:30:28 +02:00
vaxerski
f36cd350cc do not animate mouse resizes in layouts 2022-08-03 12:27:20 +02:00
vaxerski
c779a7c03b move refocus on only unmap 2022-08-03 12:03:18 +02:00
vaxerski
179e5188a4 remove incorrect border thickness calc 2022-08-03 12:03:15 +02:00
Vaxry
d3c96c248c Merge pull request #463 from luxus/patch-1
update flake to 0.9.1
2022-08-02 23:20:58 +02:00
Kai
3fabf1c483 update flake to 0.9.1
and again :D
2022-08-02 22:40:37 +02:00
vaxerski
02fbb3a417 fix preferred mode 2022-08-02 22:20:45 +02:00
vaxerski
9c8d32d1c2 default new blur optimiz to 0 2022-08-02 15:26:44 +02:00
vaxerski
a71f4114b0 added opaque windowrule 2022-08-02 00:08:31 +02:00
vaxerski
a6cd552980 bring back xdg current desktop 2022-08-01 23:31:25 +02:00
vaxerski
100d29d34d use nproc in makefile 2022-08-01 22:48:43 +02:00
vaxerski
00747fc6df fix preWindowPass with floating as first 2022-08-01 20:32:46 +02:00
vaxerski
523023aec7 mark blur dirty on monitor damage 2022-08-01 20:28:20 +02:00
vaxerski
024752bbe3 fix new blur optimizations with non-full damage 2022-08-01 20:18:26 +02:00
vaxerski
e794de1f4d guard texid in new optimized blur 2022-08-01 19:50:37 +02:00
vaxerski
1edd66618f added general:no_cursor_warps 2022-08-01 18:50:16 +02:00
vaxerski
338865e433 added follow_mouse 3 2022-08-01 18:42:11 +02:00
vaxerski
cb36456f40 optimize new blur rendering 2022-08-01 15:32:20 +02:00
vaxerski
b90159c089 revert blur changes 2022-08-01 15:29:49 +02:00
vaxerski
0ba17d4da3 fix oopsie with optim 2022-08-01 15:28:14 +02:00
vaxerski
d6e227ae0d don't stencil with new optimizations in blur 2022-08-01 15:24:42 +02:00
vaxerski
6427bb41d8 reload blur on cfg reload 2022-08-01 13:12:50 +02:00
vaxerski
60c16f77a6 added master:no_gaps_when_only 2022-08-01 12:57:37 +02:00
vaxerski
f892387b70 added dwindle:no_gaps_when_only 2022-08-01 12:51:52 +02:00
vaxerski
6378990bc3 fixes to the new blur system 2022-08-01 12:23:09 +02:00
vaxerski
070d7699a7 added decoration:blur_new_optimizations 2022-08-01 12:16:33 +02:00
vaxerski
8a4e04d789 check window validity in getfirstwindowonworkspace 2022-08-01 00:45:06 +02:00
vaxerski
46e18e08d1 contain for the hyprland default bg 2022-07-31 23:44:04 +02:00
Kai
9ac00fe52b update flake.nix to version 0.9.0beta (#451) 2022-07-31 22:44:51 +03:00
vaxerski
d44adb1bea [gha] bump flake inputs 2022-07-31 18:31:50 +00:00
vaxerski
40c652f23e update wlroots dep 2022-07-31 20:30:43 +02:00
vaxerski
575c3e071a fix ls fadeout on scaled 2022-07-31 17:20:33 +02:00
vaxerski
dba4596c7e focus to first window on not found in refocus 2022-07-31 17:07:39 +02:00
vaxerski
e95aa8ef26 minor fixes to render loop 2022-07-31 16:54:36 +02:00
vaxerski
a1d1ec4c46 added misc:mouse_move_enables_dpms 2022-07-31 15:46:42 +02:00
Mihai Fufezan
d9687c93ee Nix: add cachix (#448) 2022-07-31 15:19:28 +03:00
vaxerski
9be239dac6 remove wlr_viewporter, we do not support it 2022-07-31 14:10:21 +02:00
vaxerski
76f7c2510e account for geom in initial XDG window popups 2022-07-31 14:05:47 +02:00
vaxerski
2230f0ccaa move to XDG 4 2022-07-31 13:21:33 +02:00
vaxerski
04f8029fcc fix minor XDG issue 2022-07-31 13:14:56 +02:00
vaxerski
20cba2d707 damage monitor on dpms on 2022-07-31 12:39:49 +02:00
vaxerski
e2bc07d276 fix lack of return in tickHyprctl 2022-07-31 12:35:10 +02:00
vaxerski
edac94bed1 tick hyprctl separately 2022-07-31 00:27:32 +02:00
Mihai Fufezan
4610b3d864 protocols: add wlr-output-power-management-unstable-v1.xml to meson.build 2022-07-31 01:09:26 +03:00
vaxerski
0573d5987f dont account for scale in border thick 2022-07-31 00:07:35 +02:00
vaxerski
e5cef8fc96 account for scale in downrounding 2022-07-31 00:04:34 +02:00
vaxerski
382f851b30 account for border in rounding 2022-07-31 00:00:24 +02:00
vaxerski
2e3d42a9a9 added a dpms dispatcher 2022-07-30 23:51:13 +02:00
vaxerski
217ff1f401 do not call dmabuf_create twice 2022-07-30 23:45:27 +02:00
vaxerski
c2db3ad8ce fix minor memory issue 2022-07-30 23:04:31 +02:00
vaxerski
2e0dd4bea2 use pref in default configs 2022-07-30 22:55:20 +02:00
vaxerski
d6a649c1b3 added preferred to monitor cfg 2022-07-30 22:54:29 +02:00
vaxerski
f96b611651 support wlr-output-power-management 2022-07-30 22:41:24 +02:00
vaxerski
4211b37e22 added misc:damage_entire_on_snapshot 2022-07-30 22:26:46 +02:00
vaxerski
45747fb8e6 fix snapshots on scaled 2022-07-30 22:22:51 +02:00
vaxerski
adeab98831 some window fadeout fixes 2022-07-30 22:07:40 +02:00
vaxerski
036be18bf5 fix shader fix 2022-07-30 19:00:38 +02:00
Mihai Fufezan
59879e0bd1 Nix module: make package nullable part 3 2022-07-30 18:19:27 +03:00
Mihai Fufezan
132b5ba5b6 Nix module: make package nullable part 2 2022-07-30 18:14:46 +03:00
Mihai Fufezan
3c544e1c31 Nix module: make package nullable 2022-07-30 18:11:46 +03:00
vaxerski
191c02a4f4 update decos on configureX11 2022-07-30 15:22:34 +02:00
vaxerski
7c7690eb08 windowrules for floating remove hidden flag 2022-07-30 12:42:27 +02:00
Mihai Fufezan
66680a1149 Nix: fix failing module 2022-07-29 18:39:10 +03:00
Vaxry
fd74208453 Merge pull request #446 from IanManske/movecurrentworkspace-nullmonitor-fix
Fix crash from moving current workspace to nonexistent (null) monitor.
2022-07-29 17:19:25 +02:00
vaxerski
e56699826f Optimize shaders 2022-07-29 17:07:33 +02:00
Ian Manske
ef2417fbcb Fix crash from moving current workspace to nonexistent (null) monitor. 2022-07-29 10:59:31 -04:00
reptee
fd999100f0 Remove extra packages in nix module (#343)
Co-authored-by: Mihai Fufezan <fufexan@pm.me>
Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2022-07-29 14:35:38 +03:00
Mihai Fufezan
0eebf3ab16 meson: add -DGIT arguments (#321) 2022-07-29 13:21:19 +03:00
vaxerski
ac8e5fef10 even more damage scaled fixes 2022-07-29 11:52:56 +02:00
vaxerski
429a9bc6c3 hide only XWayland on incorrect size 2022-07-29 11:45:32 +02:00
vaxerski
233bad5011 Spam the protocols less with resizes of XDG 2022-07-28 23:55:00 +02:00
vaxerski
0f19bd99f8 more scaled surface damage fixes 2022-07-28 23:21:35 +02:00
vaxerski
f0cd784f79 fixes to surface damaging on scaled 3 2022-07-28 22:41:59 +02:00
vaxerski
7a2f296c93 surface damage fixes 2 2022-07-28 22:23:27 +02:00
vaxerski
0b0cd85085 surface damage fixes 2 2022-07-28 22:23:00 +02:00
vaxerski
3f62a386bf surface damage fixes 2022-07-28 22:15:56 +02:00
vaxerski
4076a3b6d7 fixed device configs 2022-07-28 21:38:30 +02:00
vaxerski
13d9c85e4e fix alpha with xwl opacity 2022-07-28 18:17:47 +02:00
vaxerski
9afa3953e9 fix crash oopsie 2022-07-28 17:56:11 +02:00
Vaxry
398662c75a Merge pull request #440 from Roger-Roger-debug/main
Fix hyprctl flags help
2022-07-28 17:47:56 +02:00
Roger Roger
5bc9534642 Fix hyprctl flags help 2022-07-28 16:42:18 +02:00
vaxerski
0e2038fedf minor fullscreen anim fixes 2022-07-28 16:33:45 +02:00
vaxerski
6d35d642ea fix fullscreen workspace slide anims 2022-07-28 15:56:55 +02:00
vaxerski
b0ab8afc58 fix some XWayland weird popups 2022-07-28 15:40:06 +02:00
vaxerski
578787b36d add gestures to example configs 2022-07-28 13:44:17 +02:00
vaxerski
f6c7a79988 update default configs for new anim config 2022-07-28 13:39:05 +02:00
vaxerski
9d5b76b757 fix typo in new anim handlers 2022-07-28 13:34:52 +02:00
vaxerski
920fdd6bff Animation config rework 2022-07-28 13:28:43 +02:00
vaxerski
9dd17a4be6 Added toggleopaque dispatcher 2022-07-28 12:07:41 +02:00
vaxerski
3904351678 Added layoutmsg and some master layout msgs 2022-07-28 12:00:10 +02:00
vaxerski
b6f2a4bc36 damage popups correctly 2022-07-28 11:37:27 +02:00
vaxerski
e102f9ec8c remove make man 2022-07-27 23:12:18 +02:00
vaxerski
ee15ad1215 render ls popups correctly 2022-07-27 18:02:20 +02:00
Gabriel Fontes
1d3e1472f2 nix: add home-manager module (#395) 2022-07-27 17:32:42 +03:00
Mihai Fufezan
b2627c05c4 flake & meson: 0.7.0 -> 0.8.1
nix: add legacyRenderer option
2022-07-27 14:57:59 +03:00
vaxerski
427bc35b6b fix empty workspace name on unspecified default 2022-07-27 13:56:01 +02:00
vaxerski
c9c4b14ef2 optimize xwayland has_alpha blur 2022-07-27 13:30:55 +02:00
vaxerski
cb1a36faf0 missed 2 structs 2022-07-27 12:36:56 +02:00
vaxerski
31a079b347 added DPMS 2022-07-27 12:32:00 +02:00
Vaxry
50b991674b Merge pull request #379 from volitank/main
docs: add man pages
2022-07-27 00:08:12 +02:00
vaxerski
28046e9da0 added binds:scroll_event_delay 2022-07-26 23:34:03 +02:00
vaxerski
cc146f0344 use transformed size in popup unconstrain 2022-07-26 22:58:25 +02:00
vaxerski
d3c1d3435c fix typo in XDG popup callbacks 2022-07-26 22:45:59 +02:00
vaxerski
57f5de68ae remove commit event cuz i forgot 2022-07-26 22:01:55 +02:00
vaxerski
eb30d9bdc8 fix typo in LS destroy event 2022-07-26 21:59:07 +02:00
vaxerski
98ef43496b listener fixes 2022-07-26 21:41:29 +02:00
vaxerski
1455442b9a fix swipe not cancelling constraints 2022-07-26 18:38:30 +02:00
vaxerski
71c1ff8ee3 log xwayland in hyprctl 2022-07-26 18:25:08 +02:00
vaxerski
b18a2738e3 schedule recalcs in LS 2022-07-26 18:22:34 +02:00
vaxerski
99ebbb36b2 README stuff 2022-07-26 17:34:53 +02:00
vaxerski
6f2368f809 Add a pass dispatcher 2022-07-26 17:30:30 +02:00
vaxerski
7dc014e967 r and e exclusivity in bind 2022-07-26 17:04:26 +02:00
vaxerski
66eac124e2 add binding to mouse buttons 2022-07-26 14:50:21 +02:00
vaxerski
d04f36c57d set moz env 2022-07-26 10:05:29 +02:00
vaxerski
7babcf7e6a arrange after switch 2022-07-25 23:53:43 +02:00
vaxerski
b0d91cbf3a simplify formats 2022-07-25 22:40:34 +02:00
vaxerski
db899e00e7 adjust ls fading out logic 2022-07-25 22:00:46 +02:00
vaxerski
6e16dfa5e5 use defines for unreachable 2022-07-25 21:34:57 +02:00
vaxerski
c998e946aa Wrap adding to fading out
needed to avoid memory safety issues, because sometimes there would be duplicates.
2022-07-25 21:08:54 +02:00
vaxerski
cde39e0b6e ls fixes 2022-07-25 20:47:56 +02:00
vaxerski
b1d3a1deea force unmap on direct destroy 2022-07-25 18:38:40 +02:00
vaxerski
e2594c79cc fix fading out layers without unmap 2022-07-25 18:35:53 +02:00
vaxerski
a0be6e19d8 fix shadowing with doesntHave 2022-07-25 16:12:06 +02:00
vaxerski
14176f01ca fix swiping with one workspace on monitor 2022-07-25 15:42:27 +02:00
Vaxry
574d950145 updated previews in readme 2022-07-25 15:05:23 +02:00
vaxerski
bb539f0a8d added keybind repeat flag 2022-07-25 14:42:49 +02:00
vaxerski
067e2d39f6 shadow with respect of keysym on press 2022-07-25 14:24:02 +02:00
vaxerski
e388a86c9d move floating windows manually on moveworkspacetomonitor 2022-07-25 14:22:32 +02:00
vaxerski
3e6abaf680 fix some swipe issues 2022-07-25 14:06:49 +02:00
vaxerski
6dc8c4b310 Shadowing Keybinds fixes 2022-07-24 14:35:58 +02:00
vaxerski
1ddd7ee713 remove forced envvars 2022-07-24 13:29:46 +02:00
vaxerski
92d1d21a3d added default touchpad settings to example configs 2022-07-24 12:23:31 +02:00
vaxerski
8dcc3032a8 fix keybinds shadowing multibinds 2022-07-24 12:16:26 +02:00
vaxerski
1626707b7f make layerSurfaces into RAII 2022-07-23 15:48:08 +02:00
Blake Lee
970bcc467c remove version 2022-07-22 15:32:56 -04:00
Mihai Fufezan
72700bf9dc layersurfaces: set default geometry 2022-07-22 20:28:43 +03:00
vaxerski
616ec22735 wrapped wl_listener fixes 2022-07-22 13:34:19 +02:00
vaxerski
d9b0edb786 remove newPopup handler for LS 2022-07-22 13:12:26 +02:00
vaxerski
3f169a937a fix wlr workspace names before init 2022-07-22 12:37:44 +02:00
vaxerski
fa1273f258 minor changes to swipes 2022-07-22 00:13:56 +02:00
vaxerski
8f66ddcad0 minor changes to swipes 2022-07-22 00:10:26 +02:00
vaxerski
4db1062af6 minor changes to swipes 2022-07-22 00:08:25 +02:00
vaxerski
0013ef9ef0 reload input after exec once 2022-07-21 20:30:48 +02:00
vaxerski
19cd04c85f shadow keybinds on drag events 2022-07-21 19:44:34 +02:00
Vaxry
a011c28227 Merge pull request #265 from xDarksome/main
Scroll workspaces with Super+MouseWheel
2022-07-21 19:40:15 +02:00
Darksome
d5ccca4fdb Consider scroll as a 'pressed' key 2022-07-21 20:31:38 +03:00
vaxerski
f512bf6b5a remove server from hyprctl as it's unused 2022-07-21 19:27:55 +02:00
Darksome
ce508f1cdc Fix merge 2022-07-21 19:48:34 +03:00
Darksome
eb8a1939e6 Merge upstream 2022-07-21 19:18:03 +03:00
Vaxry
7f660fed0d Merge pull request #404 from System-x64/new-hyprland.png
Updated assets/hyprland.png
2022-07-21 14:46:56 +02:00
vaxerski
75ce01b1a7 Make the thread manager into a wl event loop timer 2022-07-21 12:33:22 +02:00
Dikshant Namdeo
b9f8d900b3 updated-hyprland.png 2022-07-21 12:31:24 +05:30
vaxerski
189cbe9f09 added shadowing keybinds 2022-07-20 23:17:26 +02:00
vaxerski
fa2bd3b1a8 added keybinds on key up 2022-07-20 22:45:06 +02:00
vaxerski
fc33cae70c change bind flag parsing 2022-07-20 22:33:43 +02:00
vaxerski
641aaff998 minor code adjustments 2022-07-20 18:39:08 +02:00
vaxerski
9463e3eb0a fix transformed snapshots a bit 2022-07-20 16:28:05 +02:00
vaxerski
e6b151b6c3 fix memory read after free in damageSurface 2022-07-20 12:06:14 +02:00
vaxerski
d52446135b add sensitivity per device & reload mice on config 2022-07-19 19:26:53 +02:00
vaxerski
1ba600ca23 added workspace swipe fingers 2022-07-19 18:35:24 +02:00
vaxerski
0026414f9b fix workspace swipes mistake 2022-07-19 18:30:53 +02:00
vaxerski
ce8d655fad fix oopsie in log 2022-07-19 16:39:15 +02:00
vaxerski
d4690a5c5e minor change to unmanaged X11 geom requests 2022-07-19 16:38:27 +02:00
vaxerski
755245e752 adjust workspace on geom change x11 2022-07-19 16:21:35 +02:00
vaxerski
ec2afb563e fix oopsie include 2022-07-19 14:28:37 +02:00
vaxerski
59e34e311e fix oopsie include 2022-07-19 14:27:52 +02:00
vaxerski
c6c3d66373 fix hyprctl with relative negative 2022-07-19 14:24:03 +02:00
vaxerski
21217bcb2b notify enter on subsurfaces with follow mouse not 1 2022-07-19 14:05:12 +02:00
vaxerski
f905ae33c8 guard pSurface in unmapsubsurface 2022-07-19 13:54:42 +02:00
vaxerski
0281caa8e0 fix ASan error 2022-07-19 13:36:54 +02:00
Blake Lee
a312f8e0ac replace rst2man with pandoc 2022-07-18 18:56:46 -04:00
Vaxry
f35d513bf5 Merge pull request #391 from dgerblick/focuswindow-options
focuswindow options + other hyprctl bugs I found when testing
2022-07-18 23:19:12 +02:00
vaxerski
10a83853ac added ls noprocess 2022-07-18 21:16:01 +02:00
vaxerski
53b8263eb1 remove fixXwaylandwindowsonworkspace, not needed anymore 2022-07-18 21:15:46 +02:00
vaxerski
8bcfda2230 update moveactivetoworkspace logic 2022-07-18 20:53:29 +02:00
Daniel Gerblick
f2c0e6ef02 fixed issue causing hyprctl to output ill-formed json when strings include characters needing escaping 2022-07-18 14:47:28 -04:00
vaxerski
b669948737 fix logo center 2022-07-18 15:41:02 +02:00
vaxerski
a4b1d51c63 add new wallpapers 2022-07-18 15:31:59 +02:00
vaxerski
e7b8cda360 update logo 2022-07-18 15:23:26 +02:00
vaxerski
c466bd1219 fix webkit 2022-07-18 14:21:21 +02:00
vaxerski
ad19a15cef readme center 2022-07-18 14:20:43 +02:00
vaxerski
954a387cf9 fix center 2022-07-18 14:19:21 +02:00
vaxerski
a51f44d566 readme fix 2022-07-18 14:16:49 +02:00
vaxerski
423c9f9d56 new logo 2022-07-18 14:15:33 +02:00
vaxerski
900e6947e9 reject windows with tiny sizes, overwrite size 2022-07-18 13:14:31 +02:00
vaxerski
90d07d7b52 fix shadows on unmanaged and noborder 2022-07-18 12:39:57 +02:00
vaxerski
60cc33a53c added time logging 2022-07-18 11:46:42 +02:00
Daniel Gerblick
dc1f34c5fa added PID and address-based options for focuswindow, as well as updated hyprctl clients to be consistent with logs and hyprctl activewindow 2022-07-17 19:00:12 -04:00
vaxerski
afeb040684 fix selection events 2022-07-17 18:56:01 +02:00
vaxerski
f5bd30569f fix borders on scaled 2022-07-16 23:29:42 +02:00
vaxerski
6f1b9d6af9 add master:new_on_top 2022-07-16 23:24:42 +02:00
vaxerski
1848086abd reload layout on hyprctl layout 2022-07-16 22:44:29 +02:00
vaxerski
cb2989cec5 fix fade corner artifacts 2022-07-16 21:10:16 +02:00
vaxerski
16afa2c422 fix border rendering on certain windows
oversized subsurfaces had a tendency to be above borders, now they wont be
2022-07-16 20:57:59 +02:00
vaxerski
edcecae7a0 dont cycle on fullscreen 2022-07-16 19:55:40 +02:00
vaxerski
aac546b771 added center windowrule 2022-07-16 16:27:17 +02:00
vaxerski
ef24329495 pass through pinch events 2022-07-16 16:12:31 +02:00
vaxerski
5c836e6460 added master layout 2022-07-16 15:57:31 +02:00
Darksome
68cfc1a496 Merge branch 'main' of github.com:xDarksome/Hyprland 2022-07-16 15:35:47 +03:00
Darksome
08319dd1f5 Fix handleKeybinds debug log 2022-07-16 15:34:13 +03:00
xDarksome
4f9be67298 Merge branch 'hyprwm:main' into main 2022-07-16 15:30:32 +03:00
Darksome
ce9efb7ae3 Impl changeworkspace(e+{n}) 2022-07-16 15:28:17 +03:00
vaxerski
48e5bd96bc Added shadow colors animations and inactive col 2022-07-16 12:44:45 +02:00
Darksome
2ae088d631 Use correct wlroots commit 2022-07-16 12:47:37 +03:00
Darksome
fdbc54d97b Restore events/Devices.cpp formatting 2022-07-16 12:44:12 +03:00
Darksome
e56ff0fcb0 Merge remote-tracking branch 'upstream/main' into mouse-wheel-cfg 2022-07-16 12:40:02 +03:00
Darksome
43b7da0bb1 Rollback flake.lock 2022-07-16 12:30:07 +03:00
Blake Lee
88506d4284 Apply suggestions from code review 2022-07-15 22:34:35 -04:00
volitank
9fc74a708e Apply suggestions from code review
Co-authored-by: Mihai Fufezan <fufexan@pm.me>
2022-07-15 22:25:03 -04:00
Blake Lee
310a839700 docs: add man pages 2022-07-15 20:04:17 -04:00
vaxerski
b2650928ea obey xdg reqs better 2022-07-16 00:11:21 +02:00
Vaxry
069e3b2114 Merge pull request #376 from dgerblick/hyprctl-json-segfault-fix
Fixed SEGFAULT when running hyprctl with only the -j option
2022-07-15 23:21:46 +02:00
Daniel Gerblick
db693ec7e5 Fixed SEGFAULT when running hyprctl with only the -j option 2022-07-15 15:39:39 -04:00
xDarksome
16fecac2d1 [gha] bump flake inputs 2022-07-15 18:55:08 +00:00
Darksome
1eceae811f Try mouse wheel configuration 2022-07-15 21:54:05 +03:00
vaxerski
fbcc6936f4 fix dashes in hyprctl 2022-07-15 20:07:52 +02:00
vaxerski
90ebeaa881 fixed fullscreen opacity on fullscreen 1 2022-07-15 19:33:09 +02:00
vaxerski
1441856811 fix blur on oversized, default to enabled 2022-07-15 19:21:13 +02:00
vaxerski
19c646ab47 Minor changes to the renderer's overflow behavior
Won't squish base layers anymore
2022-07-15 19:07:06 +02:00
Darksome
5388b54442 Merge upstream 2022-07-15 19:42:03 +03:00
vaxerski
6306d4dae3 add remove, to blurls 2022-07-15 13:29:56 +02:00
Vaxry
5af26a451a Merge pull request #373 from fufexan/configpath
Add config flag
2022-07-15 12:03:50 +02:00
vaxerski
ba48e7ceea fixed up hyprctl flags 2022-07-15 11:58:09 +02:00
vaxerski
c0377457df don't poison wlr in make install 2022-07-15 11:39:11 +02:00
Mihai Fufezan
202fb4d8d4 add clangd cache in gitignore 2022-07-15 00:10:00 +03:00
Mihai Fufezan
d8fee02063 add simple help message 2022-07-15 00:09:31 +03:00
Mihai Fufezan
01fc3d6068 add config flag
you can now specify a config with -c <path>
2022-07-14 23:55:24 +03:00
vaxerski
634970a284 update deco values on fullscreen 2022-07-14 22:49:49 +02:00
vaxerski
642af5395e dont focus anything on constrained 2022-07-14 21:33:36 +02:00
Vaxry
316589406f Merge pull request #372 from bazuin-32/main
Fix error when running `hyprctl dispatch exec` with an arg that contains a `/`
2022-07-14 19:33:21 +02:00
bazuin-32
0085319c18 Fix error when running hyprctl dispatch exec with an arg that contains
a `/`
2022-07-14 11:23:18 -06:00
vaxerski
0488f17976 fix opacity inactive methodology 2022-07-14 18:46:42 +02:00
vaxerski
8b52858bb5 fix opacity active 2022-07-14 18:45:16 +02:00
Vaxry
b0dd370421 Merge pull request #342 from viperML/main
ci: add release workflow
2022-07-14 12:54:49 +02:00
vaxerski
65e75c0b44 fix backwards hyprctl compat 2022-07-14 11:43:15 +02:00
Vaxry
7c999fb9f5 Merge pull request #242 from calebowens/caleb-feature-add-width-multiplier
Added a multiplier for the width to height ratio
2022-07-14 11:38:49 +02:00
Kainoa Kanter
21da348826 hyprwm in readme links 2022-07-13 11:23:43 -07:00
vaxerski
c2215e4efb fix focus on fullscreen and over 2022-07-13 18:33:36 +02:00
vaxerski
49dbb586e3 fixed session-less envs 2022-07-13 18:31:09 +02:00
Vaxry
6708f3b133 Fixed TTY switching (#364) 2022-07-13 18:18:23 +02:00
vaxerski
ef7ee2fd0f added active keymap prop 2022-07-13 16:02:14 +02:00
vaxerski
e93b45615c better doc in help 2022-07-13 15:50:46 +02:00
vaxerski
0a16513946 fix warning 2022-07-13 15:48:47 +02:00
vaxerski
99e9503732 flag pos 2022-07-13 15:47:35 +02:00
Vaxry
be69098cb8 Merge pull request #360 from bazuin-32/main
Add hyprctl output in json when `-j` flag is used
2022-07-13 15:44:59 +02:00
Fernando Ayats
d7d5b1a4eb ci: fix repo source 2022-07-13 10:39:57 +02:00
Fernando Ayats
868fc6e0f3 Revert "FIXME: temp disable workflows"
This reverts commit 532ffe1681.
2022-07-13 10:36:47 +02:00
Fernando Ayats
9580ef4bc2 ci: upload source 2022-07-13 10:35:23 +02:00
Fernando Ayats
532ffe1681 FIXME: temp disable workflows 2022-07-13 10:26:11 +02:00
Fernando Ayats
0cfc97972f ci: upload source 2022-07-13 10:25:21 +02:00
bazuin-32
ab859ec9fc Fix issues with batch requests 2022-07-12 16:34:28 -06:00
bazuin-32
ac9ff795cd Fix calls to substr with invalid pos 2022-07-12 15:38:50 -06:00
vaxerski
4bea3467e0 update hyprctl help 2022-07-12 23:21:00 +02:00
vaxerski
bca93f4d3c code styling 2022-07-12 23:17:55 +02:00
vaxerski
bf762f566f Fix VRAM memory leak when releasing snapshots 2022-07-12 23:11:34 +02:00
bazuin-32
2402f2e364 Use enum for specifying hyprctl output format and change the way flags
are passed for json output
2022-07-12 14:59:36 -06:00
bazuin-32
036f431206 Add hyprctl output in json when -j flag is used 2022-07-12 11:57:33 -06:00
Darksome
cb8a6f881b Disallow scrolling into empty workspaces 2022-07-02 19:55:35 +03:00
xDarksome
185c4d6ea1 Merge branch 'hyprwm:main' into main 2022-07-02 19:43:52 +03:00
xDarksome
fc4b10d13c Remove empty line 2022-06-26 19:28:30 +03:00
xDarksome
504f76112a Merge branch 'hyprwm:main' into main 2022-06-26 19:20:20 +03:00
xDarksome
be460ea954 Merge branch 'hyprwm:main' into main 2022-06-24 18:58:11 +03:00
Darksome
776ca3baf2 Change workspace wheel scrolling direction 2022-06-24 18:57:14 +03:00
Darksome
8f62f6d4b0 Add workspace switching with mouse wheel 2022-06-20 22:47:28 +03:00
Caleb Owens
7d80327e7d fixed vertical swapping issue 2022-06-20 17:11:59 +01:00
Caleb Owens
3d46c73981 Added a multiplier for the width to height ratio 2022-06-20 14:37:27 +01:00
199 changed files with 28408 additions and 7056 deletions

65
.clang-format Normal file
View File

@@ -0,0 +1,65 @@
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
ColumnLimit: 180
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
IncludeBlocks: Preserve
IndentCaseLabels: true
IndentWidth: 4
PointerAlignment: Left
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Never
AllowShortEnumsOnASingleLine: false
BraceWrapping:
AfterEnum: false
AlignConsecutiveDeclarations: AcrossEmptyLines
NamespaceIndentation: All

View File

@@ -6,6 +6,7 @@ labels: bug
assignees: ''
---
<!-- For Nix issues, ping @fufexan -->
Please consult the issue guidelines at
https://github.com/vaxerski/Hyprland/blob/main/docs/ISSUE_GUIDELINES.md

View File

@@ -12,15 +12,14 @@ jobs:
run: |
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
pacman --noconfirm --noprogressbar -Syyu
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers xcb-util-errors xcb-util-renderutil xcb-util-wm xorg-fonts-encodings xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xwayland git cmake go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers xcb-util-errors xcb-util-renderutil xcb-util-wm xorg-fonts-encodings xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xwayland git cmake go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd python libliftoff
- name: Set up user
run: |
useradd -m githubuser
echo -e "root ALL=(ALL:ALL) ALL\ngithubuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
- name: Build wlroots
- name: Install libdisplay-info from the AUR
run: |
su githubuser -c "cd ~ && git clone https://gitlab.freedesktop.org/wlroots/wlroots"
su githubuser -c "cd ~/wlroots && meson build/ --prefix=/usr && ninja -C build/ && sudo ninja -C build/ install && cd .."
su githubuser -c "cd ~ && git clone https://aur.archlinux.org/libdisplay-info.git && cd ./libdisplay-info && makepkg -si --skippgpcheck --noconfirm --noprogressbar"
- name: Fix permissions for git
run: |
git config --global --add safe.directory /__w/Hyprland/Hyprland
@@ -41,7 +40,7 @@ jobs:
cp ./LICENSE hyprland/
cp build/Hyprland hyprland/
cp hyprctl/hyprctl hyprland/
cp subprojects/wlroots/build/libwlroots.so.11032 hyprland/
cp subprojects/wlroots/build/libwlroots.so.12032 hyprland/
cp build/Hyprland hyprland/
cp -r example/ hyprland/
cp -r assets/ hyprland/
@@ -62,7 +61,14 @@ jobs:
run: |
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
pacman --noconfirm --noprogressbar -Syyu
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers xcb-util-errors xcb-util-renderutil xcb-util-wm xorg-fonts-encodings xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xwayland git go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers git go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd cmake jq python libliftoff
- name: Set up user
run: |
useradd -m githubuser
echo -e "root ALL=(ALL:ALL) ALL\ngithubuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
- name: Install libdisplay-info from the AUR
run: |
su githubuser -c "cd ~ && git clone https://aur.archlinux.org/libdisplay-info.git && cd ./libdisplay-info && makepkg -si --skippgpcheck --noconfirm --noprogressbar"
- name: Checkout Hyprland
uses: actions/checkout@v3
with:
@@ -73,13 +79,30 @@ jobs:
-Ddefault_library=static
- name: Compile
run: ninja -C obj-x86_64-pc-linux-gnu
# - name: Compress artifacts
# run: |
# mkdir x86_64-pc-linux-gnu
# DESTDIR=$PWD/x86_64-pc-linux-gnu meson install -C obj-x86_64-pc-linux-gnu --tags runtime
# tar -cvf x86_64-pc-linux-gnu.tar.xz x86_64-pc-linux-gnu
# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: Build artifacts (x86_64-pc-linux-gnu)
# path: x86_64-pc-linux-gnu.tar.xz
noxwayland:
name: "Build Hyprland in pure Wayland (Arch)"
runs-on: ubuntu-latest
container:
image: archlinux
steps:
- name: Download dependencies
run: |
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
pacman --noconfirm --noprogressbar -Syyu
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers git cmake go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd libliftoff
- name: Set up user
run: |
useradd -m githubuser
echo -e "root ALL=(ALL:ALL) ALL\ngithubuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
- name: Install libdisplay-info from the AUR
run: |
su githubuser -c "cd ~ && git clone https://aur.archlinux.org/libdisplay-info.git && cd ./libdisplay-info && makepkg -si --skippgpcheck --noconfirm --noprogressbar"
- name: Checkout Hyprland
uses: actions/checkout@v3
with:
submodules: true
- name: Configure
run: mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DNO_XWAYLAND:STRING=true -H./ -B./build -G Ninja
- name: Compile
run: make config && make release

View File

@@ -1,30 +0,0 @@
name: Flawfinder
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
flawfinder:
name: Flawfinder Checks
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Scan with Flawfinder
uses: david-a-wheeler/flawfinder@8e4a779ad59dbfaee5da586aa9210853b701959c
with:
arguments: '--sarif ./'
output: 'flawfinder_results.sarif'
- name: Upload analysis results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{github.workspace}}/flawfinder_results.sarif

28
.github/workflows/man-update.yaml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Build man pages
on:
workflow_dispatch:
push:
paths:
- docs/**
branches:
- 'main'
jobs:
main:
name: Build man pages
runs-on: ubuntu-latest
steps:
- name: Install deps
run: sudo apt install pandoc
- name: Clone repository
uses: actions/checkout@v3
# Not needed
# with:
# submodules: recursive
- name: Build man pages
run: make man
- uses: stefanzweifel/git-auto-commit-action@v4
name: Commit
with:
commit_message: "[gha] build man pages"

View File

@@ -11,11 +11,16 @@ jobs:
with:
submodules: recursive
- name: Install nix
uses: cachix/install-nix-action@v17
uses: cachix/install-nix-action@v20
with:
install_url: https://releases.nixos.org/nix/nix-2.8.0/install
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- name: Build HyprLand with default settings
run: nix build --print-build-logs
- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build packages
run: nix flake check --print-build-logs --accept-flake-config

View File

@@ -1,26 +0,0 @@
name: "Nix & Meson: update version"
on: [workflow_dispatch]
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Update flake and meson version
run: |
REGEX="([0-9]+(\.[0-9a-zA-Z]+)+)"
CRT_REV=$(git show-ref --tags --head --abbrev | head -n 1 | head -c 7)
TAG_REV=$(git show-ref --tags --abbrev | tail -n 1 | head -c 7)
CRT_VER=$(sed -nEe "/$REGEX/{p;q;}" meson.build | awk -F\' '{print $2}')
VERSION=$(git show-ref --tags --abbrev | tail -n 1 | tail -c +20)
if [[ $TAG_REV = $CRT_REV ]] || [[ $CRT_VER != $VERSION ]]; then
sed -Ei "s/$REGEX/$VERSION/g" meson.build
sed -Ei "s/$REGEX/$VERSION/g" flake.nix
fi
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] bump flake and meson version"

View File

@@ -0,0 +1,40 @@
name: "Nix update"
on:
schedule:
- cron: '0 0 * * *'
jobs:
update:
name: "inputs"
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install nix
uses: cachix/install-nix-action@v20
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- name: Update lockfile
run: nix/update-inputs.sh
- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build packages
run: nix flake check --print-build-logs --accept-flake-config
- name: Build Waybar-Hyprland
run: nix build .#waybar-hyprland --print-build-logs
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Nix: bump inputs"

View File

@@ -0,0 +1,35 @@
name: "Nix update"
on: [push, workflow_dispatch]
jobs:
update:
name: "wlroots"
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install nix
uses: cachix/install-nix-action@v20
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- name: Update lockfile
run: nix/update-wlroots.sh
- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build packages
run: nix flake check --print-build-logs --accept-flake-config
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Nix: bump wlroots"

View File

@@ -1,22 +0,0 @@
name: "Nix: update lockfile"
on: [push, workflow_dispatch]
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install nix
uses: cachix/install-nix-action@v17
with:
install_url: https://releases.nixos.org/nix/nix-2.8.0/install
extra_nix_config: |
auto-optimise-store = true
experimental-features = nix-command flakes
- name: Update lockfile
run: nix/update-inputs.sh
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] bump flake inputs"

40
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Release artifacts
on:
release:
types: [published]
workflow_dispatch:
jobs:
source-tarball:
runs-on: ubuntu-latest
steps:
- name: Checkout Hyprland
id: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create tarball with submodules
id: tar
run: |
sed -i "1s/^/#define GIT_COMMIT_HASH \"$(git rev-parse HEAD)\"\n#define GIT_TAG \"$(git describe --tags)\"\n/" ./src/defines.hpp
mkdir hyprland-source; mv ./* ./hyprland-source || tar -czv --owner=0 --group=0 --no-same-owner --no-same-permissions -f source.tar.gz *
- id: whatrelease
name: Get latest release
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: hyprwm
repo: Hyprland
excludes: prerelease, draft
- name: Upload to release
id: upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: source.tar.gz
asset_name: source-${{ steps.whatrelease.outputs.release }}.tar.gz
tag: ${{ steps.whatrelease.outputs.release }}
overwrite: true

76
.github/workflows/security-checks.yml vendored Normal file
View File

@@ -0,0 +1,76 @@
name: Security Checks
on: [push, pull_request]
jobs:
flawfinder:
name: Flawfinder Checks
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Scan with Flawfinder
uses: david-a-wheeler/flawfinder@8e4a779ad59dbfaee5da586aa9210853b701959c
with:
arguments: '--sarif ./'
output: 'flawfinder_results.sarif'
- name: Upload analysis results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{github.workspace}}/flawfinder_results.sarif
codeql:
name: CodeQL
runs-on: ubuntu-latest
container:
image: archlinux
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Init Hyprland build
run: |
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
pacman --noconfirm --noprogressbar -Syyu
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers xcb-util-errors xcb-util-renderutil xcb-util-wm xorg-fonts-encodings xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xwayland git cmake go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd python libliftoff
useradd -m githubuser
echo -e "root ALL=(ALL:ALL) ALL\ngithubuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
su githubuser -c "cd ~ && git clone https://aur.archlinux.org/libdisplay-info.git && cd ./libdisplay-info && makepkg -si --skippgpcheck --noconfirm --noprogressbar"
git config --global --add safe.directory /__w/Hyprland/Hyprland
- name: Checkout Hyprland
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build Hyprland
run: |
git submodule sync --recursive && git submodule update --init --force --recursive
make all
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

9
.gitignore vendored
View File

@@ -10,17 +10,22 @@ CTestTestfile.cmake
_deps
build/
result
result*
/.vscode/
/.idea/
.envrc
.cache
*.o
*-protocol.c
*-protocol.h
.ccls-cache
*.so
hyprctl/hyprctl
gmon.out
*.out
*.tar.gz
*.tar.gz
PKGBUILD

6
.gitmodules vendored
View File

@@ -1,3 +1,9 @@
[submodule "wlroots"]
path = subprojects/wlroots
url = https://gitlab.freedesktop.org/wlroots/wlroots.git
[submodule "subprojects/hyprland-protocols"]
path = subprojects/hyprland-protocols
url = https://github.com/hyprwm/hyprland-protocols
[submodule "subprojects/udis86"]
path = subprojects/udis86
url = https://github.com/canihavesomecoffee/udis86

View File

@@ -1,11 +1,22 @@
cmake_minimum_required(VERSION 3.4)
project(Hyprland
cmake_minimum_required(VERSION 3.19)
include(CheckIncludeFile)
# Get version
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/props.json PROPS)
string(JSON VER GET ${PROPS} version)
project(Hyprland
DESCRIPTION "A Modern C++ Wayland Compositor"
VERSION ${VER}
)
set(HYPRLAND_VERSION ${VER})
set(PREFIX ${CMAKE_INSTALL_PREFIX})
configure_file(hyprland.pc.in hyprland.pc @ONLY)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
message(STATUS "Configuring Hyprland!")
message(STATUS "Gathering git info")
# Get git info
# hash and branch
@@ -22,54 +33,119 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND bash -c "git show ${GIT_COMMIT_HASH} | head -n 5 | tail -n 1"
COMMAND sh -c "git show ${GIT_COMMIT_HASH} | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g'"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_MESSAGE
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND bash -c "git diff-index --quiet HEAD -- || echo \"dirty\""
COMMAND sh -c "git diff-index --quiet HEAD -- || echo \"dirty\""
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DIRTY
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND sh -c "git describe --tags"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
#
#
include_directories(. PRIVATE "subprojects/wlroots/include/")
include_directories(. PRIVATE "subprojects/wlroots/build/include/")
add_compile_options(-std=c++23 -DWLR_USE_UNSTABLE )
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing)
find_program(WaylandScanner NAMES wayland-scanner)
message(STATUS "Found WaylandScanner at ${WaylandScanner}")
execute_process(
COMMAND pkg-config --variable=pkgdatadir wayland-protocols
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE WAYLAND_PROTOCOLS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Configuring Hyprland in Debug with CMake")
add_compile_definitions(HYPRLAND_DEBUG)
else()
add_compile_options(-O3)
message(STATUS "Configuring Hyprland in Release with CMake")
endif()
include_directories(
.
"subprojects/wlroots/include/"
"subprojects/wlroots/build/include/"
"subprojects/udis86/"
"protocols/")
set(CMAKE_CXX_STANDARD 23)
add_compile_definitions(WLR_USE_UNSTABLE)
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith)
add_link_options(-rdynamic)
set(CMAKE_ENABLE_EXPORTS TRUE)
message(STATUS "Checking deps...")
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo pango pangocairo libdrm egl xkbcommon libinput xcb) # we do not check for wlroots, as we provide it ourselves
find_package(OpenGL REQUIRED)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo libdrm xkbcommon libinput pango pangocairo pixman-1) # we do not check for wlroots, as we provide it ourselves
file(GLOB_RECURSE SRCFILES "src/*.cpp")
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
add_executable(Hyprland ${SRCFILES})
IF(LEGACY_RENDERER MATCHES true)
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Setting debug flags")
if (WITH_ASAN)
target_link_libraries(Hyprland asan)
add_compile_options(-fsanitize=address)
endif()
add_compile_options(-pg -no-pie -fno-builtin)
add_link_options(-pg -no-pie -fno-builtin)
endif()
include(CheckLibraryExists)
check_library_exists(execinfo backtrace "" HAVE_LIBEXECINFO)
if(HAVE_LIBEXECINFO)
target_link_libraries(Hyprland execinfo)
endif()
if(LEGACY_RENDERER)
message(STATUS "Using the legacy GLES2 renderer!")
add_definitions( -DLEGACY_RENDERER )
ENDIF(LEGACY_RENDERER MATCHES true)
add_compile_definitions(LEGACY_RENDERER)
endif()
IF(NO_XWAYLAND MATCHES true)
if(NO_XWAYLAND)
message(STATUS "Using the NO_XWAYLAND flag, disabling XWayland!")
add_definitions( -DNO_XWAYLAND )
ENDIF(NO_XWAYLAND MATCHES true)
add_compile_definitions(NO_XWAYLAND)
else()
message(STATUS "XWAYLAND Enabled (NO_XWAYLAND not defined) checking deps...")
pkg_check_modules(xcbdep REQUIRED IMPORTED_TARGET xcb)
target_link_libraries(Hyprland PkgConfig::xcbdep)
endif()
IF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Configuring Hyprland in Debug with CMake!")
add_definitions( -DHYPRLAND_DEBUG )
ELSE()
add_compile_options( -O3 )
message(STATUS "Configuring Hyprland in Release with CMake!")
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
if(NO_SYSTEMD)
message(STATUS "SYSTEMD support is disabled...")
else()
message(STATUS "SYSTEMD support is requested (NO_SYSTEMD not defined) checking deps...")
pkg_check_modules(LIBSYSTEMD libsystemd)
check_include_file("systemd/sd-daemon.h" SYSTEMDH)
if(LIBSYSTEMD_FOUND AND SYSTEMDH)
add_compile_definitions(USES_SYSTEMD)
target_link_libraries(Hyprland "${LIBSYSTEMD_LIBRARIES}")
else()
message(WARNING "Systemd support requested but libsystemd or systemd headers were not found")
endif()
endif()
target_compile_definitions(Hyprland PRIVATE "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
target_compile_definitions(Hyprland PRIVATE "-DGIT_BRANCH=\"${GIT_BRANCH}\"")
target_compile_definitions(Hyprland PRIVATE "-DGIT_COMMIT_MESSAGE=\"${GIT_COMMIT_MESSAGE}\"")
target_compile_definitions(Hyprland PRIVATE "-DGIT_DIRTY=\"${GIT_DIRTY}\"")
target_compile_definitions(Hyprland
PRIVATE
"GIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\""
"GIT_BRANCH=\"${GIT_BRANCH}\""
"GIT_COMMIT_MESSAGE=\"${GIT_COMMIT_MESSAGE}\""
"GIT_DIRTY=\"${GIT_DIRTY}\""
"GIT_TAG=\"${GIT_TAG}\"")
target_link_libraries(Hyprland rt)
@@ -77,20 +153,50 @@ set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
message(STATUS "Setting link libraries")
function(protocol protoPath protoName external)
if (external)
execute_process(
COMMAND ${WaylandScanner} server-header ${protoPath} protocols/${protoName}-protocol.h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
execute_process(
COMMAND ${WaylandScanner} private-code ${protoPath} protocols/${protoName}-protocol.c
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c)
else()
execute_process(
COMMAND ${WaylandScanner} server-header ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
execute_process(
COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.c
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c)
endif()
endfunction()
target_link_libraries(Hyprland PkgConfig::deps)
target_link_libraries(Hyprland
${CMAKE_SOURCE_DIR}/subprojects/wlroots/build/libwlroots.so.11032 # wlroots is provided by us
pixman-1
OpenGL
GLESv2
pthread
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_SOURCE_DIR}/ext-workspace-unstable-v1-protocol.o
${CMAKE_SOURCE_DIR}/subprojects/wlroots/build/libwlroots.so.12032 # wlroots is provided by us
OpenGL::EGL
OpenGL::GL
Threads::Threads
${CMAKE_SOURCE_DIR}/subprojects/udis86/build/libudis86/liblibudis86.a
)
IF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -no-pie -fno-builtin")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg -no-pie -fno-builtin")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg -no-pie -fno-builtin")
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
protocol("protocols/ext-workspace-unstable-v1.xml" "ext-workspace-unstable-v1" true)
protocol("protocols/idle.xml" "idle" true)
protocol("protocols/pointer-constraints-unstable-v1.xml" "pointer-constraints-unstable-v1" true)
protocol("protocols/tablet-unstable-v2.xml" "tablet-unstable-v2" true)
protocol("protocols/wlr-foreign-toplevel-management-unstable-v1.xml" "wlr-foreign-toplevel-management-unstable-v1" true)
protocol("protocols/wlr-layer-shell-unstable-v1.xml" "wlr-layer-shell-unstable-v1" true)
protocol("protocols/wlr-output-power-management-unstable-v1.xml" "wlr-output-power-management-unstable-v1" true)
protocol("protocols/wlr-screencopy-unstable-v1.xml" "wlr-screencopy-unstable-v1" true)
protocol("subprojects/hyprland-protocols/protocols/hyprland-global-shortcuts-v1.xml" "hyprland-global-shortcuts-v1" true)
protocol("subprojects/hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml" "hyprland-toplevel-export-v1" true)
protocol("stable/xdg-shell/xdg-shell.xml" "xdg-shell" false)
protocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml" "linux-dmabuf-unstable-v1" false)
protocol("unstable/xdg-output/xdg-output-unstable-v1.xml" "xdg-output-unstable-v1" false)
protocol("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false)
protocol("unstable/text-input/text-input-unstable-v1.xml" "text-input-unstable-v1" false)

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2022, vaxerski
Copyright (c) 2022-2023, vaxerski
All rights reserved.
Redistribution and use in source and binary forms, with or without

213
Makefile
View File

@@ -1,154 +1,139 @@
include config.mk
CFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99
WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
PKGS = wlroots wayland-server xcb xkbcommon libinput
CFLAGS += $(foreach p,$(PKGS),$(shell pkg-config --cflags $(p)))
LDLIBS += $(foreach p,$(PKGS),$(shell pkg-config --libs $(p)))
xdg-shell-protocol.h:
$(WAYLAND_SCANNER) server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c:
$(WAYLAND_SCANNER) private-code \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.o: xdg-shell-protocol.h
wlr-layer-shell-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-layer-shell-unstable-v1.xml $@
wlr-layer-shell-unstable-v1-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/wlr-layer-shell-unstable-v1.xml $@
wlr-layer-shell-unstable-v1-protocol.o: wlr-layer-shell-unstable-v1-protocol.h
wlr-screencopy-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-screencopy-unstable-v1.xml $@
wlr-screencopy-unstable-v1-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/wlr-screencopy-unstable-v1.xml $@
wlr-screencopy-unstable-v1-protocol.o: wlr-screencopy-unstable-v1-protocol.h
ext-workspace-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/ext-workspace-unstable-v1.xml $@
ext-workspace-unstable-v1-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/ext-workspace-unstable-v1.xml $@
ext-workspace-unstable-v1-protocol.o: ext-workspace-unstable-v1-protocol.h
pointer-constraints-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/pointer-constraints-unstable-v1.xml $@
pointer-constraints-unstable-v1-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/pointer-constraints-unstable-v1.xml $@
pointer-constraints-unstable-v1-protocol.o: pointer-constraints-unstable-v1-protocol.h
tablet-unstable-v2-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/tablet-unstable-v2.xml $@
tablet-unstable-v2-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/tablet-unstable-v2.xml $@
tablet-unstable-v2-protocol.o: tablet-unstable-v2-protocol.h
idle-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/idle.xml $@
idle-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/idle.xml $@
idle-protocol.o: idle-protocol.h
PREFIX = /usr/local
legacyrenderer:
mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DLEGACY_RENDERER:STRING=true -H./ -B./build -G Ninja
cmake --build ./build --config Release --target all -j 10
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
legacyrendererdebug:
mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DLEGACY_RENDERER:STRING=true -H./ -B./build -G Ninja
cmake --build ./build --config Release --target all -j 10
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
release:
mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -H./ -B./build -G Ninja
cmake --build ./build --config Release --target all -j 10
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
debug:
mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -H./ -B./build -G Ninja
cmake --build ./build --config Debug --target all -j 10
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -S . -B ./build -G Ninja
cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
clear:
rm -rf build
rm -f *.o *-protocol.h *-protocol.c
rm -f ./protocols/*-protocol.h ./protocols/*-protocol.c
rm -f ./hyprctl/hyprctl
rm -rf ./subprojects/wlroots/build
all:
make config
make release
cd ./hyprctl && make all && cd ..
$(MAKE) clear
$(MAKE) fixwlr
cd ./subprojects/wlroots && meson setup build/ --buildtype=release && ninja -C build/ && mkdir -p ${PREFIX}/lib/ && cp ./build/libwlroots.so.12032 ${PREFIX}/lib/ || echo "Could not install libwlroots to ${PREFIX}/lib/libwlroots.so.12032"
cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B./build -G Ninja && cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
$(MAKE) release
$(MAKE) -C hyprctl all
install:
[ ! -d /usr/include/wlr ] || mv /usr/include/wlr /usr/include/wlrBackup
[ ! -f /usr/lib/libwlroots.so ] || mv /usr/lib/libwlroots.so /usr/lib/libwlroots.so.backup
[ ! -f /usr/lib/pkgconfig/wlroots.pc ] || mv /usr/lib/pkgconfig/wlroots.pc /usr/lib/pkgconfig/wlroots.pc.backup
$(MAKE) clear
$(MAKE) fixwlr
cd ./subprojects/wlroots && meson setup build/ --buildtype=release && ninja -C build/ && mkdir -p ${PREFIX}/lib/ && cp ./build/libwlroots.so.12032 ${PREFIX}/lib/ || echo "Could not install libwlroots to ${PREFIX}/lib/libwlroots.so.12032"
cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B./build -G Ninja && cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` && cd ../..
$(MAKE) release
$(MAKE) -C hyprctl all
make all
mkdir -p ${PREFIX}/share/wayland-sessions
cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions/
mkdir -p ${PREFIX}/bin
cp ./build/Hyprland ${PREFIX}/bin
cp ./hyprctl/hyprctl ${PREFIX}/bin
cp -f ./build/Hyprland ${PREFIX}/bin
cp -f ./hyprctl/hyprctl ${PREFIX}/bin
if [ ! -f ${PREFIX}/share/wayland-sessions/hyprland.desktop ]; then cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions; fi
mkdir -p ${PREFIX}/share/hyprland
cp ./assets/wall_2K.png ${PREFIX}/share/hyprland
cp ./assets/wall_4K.png ${PREFIX}/share/hyprland
cp ./assets/wall_8K.png ${PREFIX}/share/hyprland
rm -rf /usr/include/wlr
rm -f /usr/lib/libwlroots.so
rm -f /usr/lib/pkgconfig/wlroots.pc
[ ! -d /usr/include/wlrBackup ] || mv /usr/include/wlrBackup /usr/include/wlr
[ ! -f /usr/lib/libwlroots.so.backup ] || mv -f /usr/lib/libwlroots.so.backup /usr/lib/libwlroots.so
[ ! -f /usr/lib/pkgconfig/wlroots.pc.backup ] || mv -f /usr/lib/pkgconfig/wlroots.pc.backup /usr/lib/pkgconfig/wlroots.pc
mkdir -p ${PREFIX}/share/man/man1
install -m644 ./docs/*.1 ${PREFIX}/share/man/man1
mkdir -p ${PREFIX}/include/hyprland
mkdir -p ${PREFIX}/include/hyprland/protocols
mkdir -p ${PREFIX}/include/hyprland/wlroots
mkdir -p ${PREFIX}/share/pkgconfig
find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland
cd subprojects/wlroots/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots && cd ../../..
cd subprojects/wlroots/build/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots && cd ../../../..
cp ./protocols/*-protocol.h ${PREFIX}/include/hyprland/protocols
cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig
if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi
cleaninstall:
echo -en "$(MAKE) cleaninstall has been DEPRECATED, you should avoid using it in the future.\nRunning $(MAKE) install instead...\n"
$(MAKE) install
uninstall:
rm -f ${PREFIX}/share/wayland-sessions/hyprland.desktop
rm -f ${PREFIX}/bin/Hyprland
rm -f ${PREFIX}/bin/hyprctl
rm -f /usr/lib/libwlroots.so.11032
rm -f ${PREFIX}/lib/libwlroots.so.12032
rm -rf ${PREFIX}/share/hyprland
protocols: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o wlr-screencopy-unstable-v1-protocol.o idle-protocol.o ext-workspace-unstable-v1-protocol.o pointer-constraints-unstable-v1-protocol.o tablet-unstable-v2-protocol.o
rm -f ${PREFIX}/share/man/man1/Hyprland.1
rm -f ${PREFIX}/share/man/man1/hyprctl.1
fixwlr:
sed -i -E 's/(soversion = 11)([^032]|$$)/soversion = 11032/g' subprojects/wlroots/meson.build
sed -E -i -e 's/(soversion = 12)([^032]|$$)/soversion = 12032/g' subprojects/wlroots/meson.build
rm -rf ./subprojects/wlroots/build
config:
make protocols
$(MAKE) fixwlr
make fixwlr
meson setup subprojects/wlroots/build subprojects/wlroots --prefix=${PREFIX} --buildtype=release -Dwerror=false -Dexamples=false
ninja -C subprojects/wlroots/build/
cd subprojects/wlroots && meson ./build --prefix=/usr --buildtype=release
cd subprojects/wlroots && ninja -C build/
ninja -C subprojects/wlroots/build/ install
cd subprojects/wlroots && ninja -C build/ install
cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja && cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
pluginenv:
cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja && cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
$(MAKE) fixwlr
meson setup subprojects/wlroots/build subprojects/wlroots --prefix=${PREFIX} --buildtype=release -Dwerror=false -Dexamples=false
ninja -C subprojects/wlroots/build/
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja
mkdir -p ${PREFIX}/include/hyprland
mkdir -p ${PREFIX}/include/hyprland/protocols
mkdir -p ${PREFIX}/include/hyprland/wlroots
mkdir -p ${PREFIX}/share/pkgconfig
find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland
cd subprojects/wlroots/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots && cd ../../..
cd subprojects/wlroots/build/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots && cd ../../../..
cp ./protocols/*-protocol.h ${PREFIX}/include/hyprland/protocols
cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig
if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi
configdebug:
$(MAKE) fixwlr
meson setup subprojects/wlroots/build subprojects/wlroots --prefix=${PREFIX} --buildtype=debug -Dwerror=false -Dexamples=false -Db_sanitize=address
ninja -C subprojects/wlroots/build/
ninja -C subprojects/wlroots/build/ install
man:
pandoc ./docs/Hyprland.1.rst \
--standalone \
--variable=header:"Hyprland User Manual" \
--variable=date:"${DATE}" \
--variable=section:1 \
--from rst \
--to man > ./docs/Hyprland.1
pandoc ./docs/hyprctl.1.rst \
--standalone \
--variable=header:"hyprctl User Manual" \
--variable=date:"${DATE}" \
--variable=section:1 \
--from rst \
--to man > ./docs/hyprctl.1

View File

@@ -1,12 +1,11 @@
<div align = center>
<img src="https://raw.githubusercontent.com/vaxerski/Hyprland/main/assets/header.svg" width="1000" height="500" alt="banner">
<img src="https://raw.githubusercontent.com/vaxerski/Hyprland/main/assets/header.svg" width="750" height="300" alt="banner">
<br>
![Badge Workflow]
[![Badge License]][License]
![Badge Lines]
![Badge Language]
[![Badge Pull Requests]][Pull Requests]
[![Badge Issues]][Issues]
@@ -17,9 +16,7 @@
Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks.
For Hyprland without the `land` part, see [Hypr], the Xorg window manager.
Please note, especially for folks moving from Hypr, that Hyprland and Hypr share a very different feature set and are not 1:1 experiences.
It supports multiple layouts, fancy effects, has a very flexible IPC model allowing for a lot of customization, a powerful plugin system and more.
<br>
<br>
@@ -42,33 +39,34 @@ Hyprland is still in pretty early development compared to some other Wayland com
Although Hyprland is pretty stable, it may have some bugs.
### Help Wanted
Hyprland needs testers! <br/>
Try it out and report bugs / suggestions!
# Features
- Easily expandable and readable codebase
- Plugin support
- Config reloaded instantly upon saving
- Custom bezier curve based animations
- `wlr_ext` workspaces protocol support
- Dual Kawase blur
- Drop shadows
- Rounded corners
- Gradient borders
- Fully dynamic workspaces
- Closely follows `wlroots-git`
- Global keybinds passed to your apps of choice
- A lot of customization
- Bundled wlroots
- Window/layer fade in/out
- Tiling/pseudotiling/floating/fullscreen windows
- Switching workspaces between window modes on the fly
- Special workspace (scratchpad)
- Special workspaces (scratchpads)
- Window/monitor rules
- Socket-based IPC
- `wlr_ext` workspaces protocol support
- Event system for bash scripts
- Rounded corners
- Full damage tracking
- Docks support
- Drawing tablet support
- Native IME + Input panels support
- and much more...
<br>
<br>
@@ -122,18 +120,18 @@ Try it out and report bugs / suggestions!
<!----------------------------------------------------------------------------->
[Configure]: https://github.com/vaxerski/Hyprland/wiki/Configuring-Hyprland
[Configure]: https://wiki.hyprland.org/Configuring/Configuring-Hyprland/
[Discord]: https://discord.gg/hQ9XvMUjjr
[Stars]: https://starchart.cc/vaxerski/Hyprland
[Hypr]: https://github.com/vaxerski/Hypr
[Stars]: https://starchart.cc/hyprwm/Hyprland
[Hypr]: https://github.com/hyprwm/Hypr
[Pull Requests]: https://github.com/vaxerski/Hyprland/pulls
[Issues]: https://github.com/vaxerski/Hyprland/issues
[Todo]: https://github.com/vaxerski/Hyprland/projects?type=beta
[Pull Requests]: https://github.com/hyprwm/Hyprland/pulls
[Issues]: https://github.com/hyprwm/Hyprland/issues
[Todo]: https://github.com/hyprwm/Hyprland/projects?type=beta
[Contribute]: https://github.com/vaxerski/Hyprland/wiki/Contributing-&-Debugging
[Install]: https://github.com/vaxerski/Hyprland/wiki/Installation
[Quick Start]: https://github.com/vaxerski/Hyprland/wiki/Quick-start
[Contribute]: https://wiki.hyprland.org/Contributing-and-Debugging/
[Install]: https://wiki.hyprland.org/Getting-Started/Installation/
[Quick Start]: https://wiki.hyprland.org/Getting-Started/Master-Tutorial/
[License]: LICENSE
@@ -149,19 +147,19 @@ Try it out and report bugs / suggestions!
<!----------------------------------{ Images }--------------------------------->
[Stars Preview]: https://starchart.cc/vaxerski/Hyprland.svg
[Preview A]: https://i.imgur.com/NbrTnZH.png
[Preview B]: https://i.imgur.com/ZA4Fa8R.png
[Preview C]: https://i.imgur.com/BpXxM8H.png
[Preview A]: https://cdn.discordapp.com/attachments/1091569872535814185/1107675866101723277/screenshot-summer.png
[Preview B]: https://i.ibb.co/SX7GbYR/winter-rice.png
[Preview C]: https://i.ibb.co/B3GJg28/20221126-20h53m26s-grim.png
<!----------------------------------{ Badges }--------------------------------->
[Badge Workflow]: https://github.com/vaxerski/Hyprland/actions/workflows/ci.yaml/badge.svg
[Badge Workflow]: https://github.com/hyprwm/Hyprland/actions/workflows/ci.yaml/badge.svg
[Badge Discord]: https://img.shields.io/badge/Join%20the-Discord%20server-6666ff
[Badge Issues]: https://img.shields.io/github/issues/vaxerski/Hyprland
[Badge Pull Requests]: https://img.shields.io/github/issues-pr/vaxerski/Hyprland
[Badge Language]: https://img.shields.io/github/languages/top/vaxerski/Hyprland
[Badge License]: https://img.shields.io/github/license/vaxerski/Hyprland
[Badge Lines]: https://img.shields.io/tokei/lines/github/vaxerski/Hyprland
[Badge Issues]: https://img.shields.io/github/issues/hyprwm/Hyprland
[Badge Pull Requests]: https://img.shields.io/github/issues-pr/hyprwm/Hyprland
[Badge Language]: https://img.shields.io/github/languages/top/hyprwm/Hyprland
[Badge License]: https://img.shields.io/github/license/hyprwm/Hyprland
[Badge Lines]: https://img.shields.io/tokei/lines/github/hyprwm/Hyprland
[Badge Hi Mom]: https://img.shields.io/badge/Hi-mom!-ff69b4

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 798 KiB

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

@@ -1,4 +0,0 @@
PREFIX = /usr/local
CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-result -Wdeclaration-after-statement
CFLAGS += -DXWAYLAND

46
docs/Hyprland.1 Normal file
View File

@@ -0,0 +1,46 @@
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "Hyprland" "1" "" "" "Hyprland User Manual"
.hy
.SH NAME
.PP
Hyprland - Dynamic tiling Wayland compositor
.SH SYNOPSIS
.PP
\f[B]Hyprland\f[R] [\f[I]arg [...]\f[R]].
.SH DESCRIPTION
.PP
\f[B]Hyprland\f[R] is a dynamic tiling Wayland compositor based on
wlroots that doesn\[aq]t sacrifice on its looks.
.PP
You can launch Hyprland by either going into a TTY and executing
\f[B]Hyprland\f[R], or with a login manager.
.SH NOTICE
.PP
Hyprland is still in pretty early development compared to some other
Wayland compositors.
.PP
Although Hyprland is pretty stable, it may have some bugs.
.SH CONFIGURATION
.PP
For configuration information please see
<\f[I]https://github.com/hyprwm/Hyprland/wiki\f[R]>.
.SH OPTIONS
.TP
\f[B]-h\f[R], \f[B]--help\f[R]
Show command usage.
.TP
\f[B]-c\f[R], \f[B]--config\f[R]
Specify config file to use.
.SH BUGS
.TP
Submit bug reports and request features online at:
<\f[I]https://github.com/hyprwm/Hyprland/issues\f[R]>
.SH SEE ALSO
.PP
Sources at: <\f[I]https://github.com/hyprwm/Hyprland\f[R]>
.SH COPYRIGHT
.PP
Copyright (c) 2022, vaxerski
.SH AUTHORS
Vaxerski <\f[I]https://github.com/vaxerski\f[R]>.

58
docs/Hyprland.1.rst Normal file
View File

@@ -0,0 +1,58 @@
:title: Hyprland
:author: Vaxerski <*https://github.com/vaxerski*>
NAME
====
Hyprland - Dynamic tiling Wayland compositor
SYNOPSIS
========
**Hyprland** [*arg [...]*].
DESCRIPTION
===========
**Hyprland** is a dynamic tiling Wayland compositor based on
wlroots that doesn't sacrifice on its looks.
You can launch Hyprland by either going into a TTY and
executing **Hyprland**, or with a login manager.
NOTICE
======
Hyprland is still in pretty early development compared to some other Wayland compositors.
Although Hyprland is pretty stable, it may have some bugs.
CONFIGURATION
=============
For configuration information please see <*https://github.com/hyprwm/Hyprland/wiki*>.
OPTIONS
=======
**-h**, **--help**
Show command usage.
**-c**, **--config**
Specify config file to use.
BUGS
====
Submit bug reports and request features online at:
<*https://github.com/hyprwm/Hyprland/issues*>
SEE ALSO
========
Sources at: <*https://github.com/hyprwm/Hyprland*>
COPYRIGHT
=========
Copyright (c) 2022, vaxerski

View File

@@ -2,15 +2,15 @@
First of all, please remember to:
- Check that your issue is not a duplicate
- Read the [FAQ](https://github.com/vaxerski/Hyprland/wiki/FAQ)
- Read the [Configuring Page](https://github.com/vaxerski/Hyprland/wiki/Configuring-Hyprland)
- Read the [FAQ](https://wiki.hyprland.org/FAQ/)
- Read the [Configuring Page](https://wiki.hyprland.org/Configuring/Configuring-Hyprland)
<br/>
# Reporting suggestions
Suggestions are welcome.
Many features can be implemented using bash scripts and Hyprland sockets, read up on those [Here](https://github.com/vaxerski/Hyprland/wiki/IPC). Please do not suggest features that can be implemented as such.
Many features can be implemented using bash scripts and Hyprland sockets, read up on those [Here](https://wiki.hyprland.org/IPC). Please do not suggest features that can be implemented as such.
<br/>
@@ -25,8 +25,9 @@ If your bug is one that doesn't crash Hyprland, but feels like invalid behavior,
If your bug crashes Hyprland, append additionally:
- The Hyprland log
- Coredump / Coredump analysis (with a stacktrace)
- Your config
- (v0.22.0beta and up) The Hyprland Crash Report
- (v0.21.0beta and below) Coredump / Coredump analysis (with a stacktrace)
**Important**: Please do NOT use any package for reporting bugs! Clone and compile from source.
@@ -44,7 +45,14 @@ cat /tmp/hypr/$(ls -t /tmp/hypr/ | head -n 2 | tail -n 1)/hyprland.log
basically, directories in /tmp/hypr are your sessions.
## Obtaining the Hyprland coredump
## Obtaining the Hyprland Crash Report (v0.22.0beta and up)
If you have `$XDG_CACHE_HOME` set, the crash report directory is `$XDG_CACHE_HOME/hyprland`. If not, it's `~/.hyprland`
Go to the crash report directory and you should find a file named `hyprlandCrashReport[XXXX].txt` where `[XXXX]` is the PID of the process that crashed.
Attach that file to your issue.
## Obtaining the Hyprland coredump (v0.21.0beta and below)
If you are on systemd, you can simply use
```
coredumpctl
@@ -57,3 +65,16 @@ coredumpctl info [PID]
```
where `[PID]` is the PID you remembered.
## Obtaining the debug Hyprland coredump
A debug coredump provides more information for debugging and may speed up the process of fixing the bug.
Make sure you're on latest git. Run `git pull --recurse-submodules` to sync everything.
1. [Compile Hyprland with debug mode](http://wiki.hyprland.org/Contributing-and-Debugging/#build-in-debug-mode)
> Note: The config file used will be `hyprlandd.conf` instead of `hyprland.conf`
2. `cd ~`
3. For your own convenience, launch Hyprland from a tty with the envvar `ASAN_OPTIONS="log_path=asan.log" ~/path/to/Hyprland`
4. Reproduce the crash. Hyprland should instantly close.
5. Check out your `~` and find a file called `asan.log.XXXXX` where `XXXXX` will be a number corresponding to the PID of the Hyprland instance that crashed.
6. That is your coredump. Attach it to your issue.

145
docs/hyprctl.1 Normal file
View File

@@ -0,0 +1,145 @@
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "hyprctl" "1" "" "" "hyprctl User Manual"
.hy
.SH NAME
.PP
hyprctl - Utility for controlling parts of Hyprland from a CLI or a
script
.SH SYNOPSIS
.PP
\f[B]hyprctl\f[R] [\f[I](opt)flags\f[R]] [\f[B]command\f[R]]
[\f[I](opt)args\f[R]]
.SH DESCRIPTION
.PP
\f[B]hyprctl\f[R] is a utility for controlling some parts of the
compositor from a CLI or a script.
.SH CONTROL COMMANDS
.PP
\f[B]dispatch\f[R]
.RS
.PP
Call a dispatcher with an argument.
.PP
An argument must be present.
For dispatchers without parameters it can be anything.
.PP
Returns: \f[I]ok\f[R] on success, and an error message on failure.
.TP
Examples:
\f[B]hyprctl\f[R] \f[I]dispatch exec kitty\f[R]
.RS
.PP
\f[B]hyprctl\f[R] \f[I]dispatch pseudo x\f[R]
.RE
.RE
.PP
\f[B]keyword\f[R]
.RS
.PP
Set a config keyword dynamically.
.PP
Returns: \f[I]ok\f[R] on success, and an error message on failure.
.TP
Examples:
\f[B]hyprctl\f[R] \f[I]keyword bind SUPER,0,pseudo\f[R]
.RS
.PP
\f[B]hyprctl\f[R] \f[I]keyword general:border_size 10\f[R]
.RE
.RE
.PP
\f[B]reload\f[R]
.RS
.PP
Force a reload of the config file.
.RE
.PP
\f[B]kill\f[R]
.RS
.PP
Enter kill mode, where you can kill an app by clicking on it.
You can exit by pressing ESCAPE.
.RE
.SH INFO COMMANDS
.PP
\f[B]version\f[R]
.RS
.PP
Prints the Hyprland version, flags, commit and branch of build.
.RE
.PP
\f[B]monitors\f[R]
.RS
.PP
Lists all the outputs with their properties.
.RE
.PP
\f[B]workspaces\f[R]
.RS
.PP
Lists all workspaces with their properties.
.RE
.PP
\f[B]clients\f[R]
.RS
.PP
Lists all windows with their properties.
.RE
.PP
\f[B]devices\f[R]
.RS
.PP
Lists all connected input devices.
.RE
.PP
\f[B]activewindow\f[R]
.RS
.PP
Returns the active window name.
.RE
.PP
\f[B]layers\f[R]
.RS
.PP
Lists all the layers.
.RE
.PP
\f[B]splash\f[R]
.RS
.PP
Returns the current random splash.
.RE
.SH OPTIONS
.PP
\f[B]--batch\f[R]
.RS
.PP
Specify a batch of commands to execute.
.TP
Example:
\f[B]hyprctl\f[R] \f[I]--batch \[dq]keyword general:border_size 2 ;
keyword general:gaps_out 20\[dq]\f[R]
.RS
.PP
\f[I];\f[R] separates the commands.
.RE
.RE
.PP
\f[B]-j\f[R]
.RS
.PP
Outputs information in JSON.
.RE
.SH BUGS
.TP
Submit bug reports and request features online at:
<\f[I]https://github.com/hyprwm/Hyprland/issues\f[R]>
.SH SEE ALSO
.PP
Sources at: <\f[I]https://github.com/hyprwm/Hyprland\f[R]>
.SH COPYRIGHT
.PP
Copyright (c) 2022, vaxerski
.SH AUTHORS
Vaxerski <\f[I]https://github.com/vaxerski\f[R]>.

121
docs/hyprctl.1.rst Normal file
View File

@@ -0,0 +1,121 @@
:title: hyprctl(1)
:author: Vaxerski <*https://github.com/vaxerski*>
NAME
====
hyprctl - Utility for controlling parts of Hyprland from a CLI or a script
SYNOPSIS
========
**hyprctl** [*(opt)flags*] [**command**] [*(opt)args*]
DESCRIPTION
===========
**hyprctl** is a utility for controlling some parts of the compositor from a CLI or a script.
CONTROL COMMANDS
================
**dispatch**
Call a dispatcher with an argument.
An argument must be present.
For dispatchers without parameters it can be anything.
Returns: *ok* on success, and an error message on failure.
Examples:
**hyprctl** *dispatch exec kitty*
**hyprctl** *dispatch pseudo x*
**keyword**
Set a config keyword dynamically.
Returns: *ok* on success, and an error message on failure.
Examples:
**hyprctl** *keyword bind SUPER,0,pseudo*
**hyprctl** *keyword general:border_size 10*
**reload**
Force a reload of the config file.
**kill**
Enter kill mode, where you can kill an app by clicking on it.
You can exit by pressing ESCAPE.
INFO COMMANDS
=============
**version**
Prints the Hyprland version, flags, commit and branch of build.
**monitors**
Lists all the outputs with their properties.
**workspaces**
Lists all workspaces with their properties.
**clients**
Lists all windows with their properties.
**devices**
Lists all connected input devices.
**activewindow**
Returns the active window name.
**layers**
Lists all the layers.
**splash**
Returns the current random splash.
OPTIONS
=======
**--batch**
Specify a batch of commands to execute.
Example:
**hyprctl** *--batch "keyword general:border_size 2 ; keyword general:gaps_out 20"*
*;* separates the commands.
**-j**
Outputs information in JSON.
BUGS
====
Submit bug reports and request features online at:
<*https://github.com/hyprwm/Hyprland/issues*>
SEE ALSO
========
Sources at: <*https://github.com/hyprwm/Hyprland*>
COPYRIGHT
=========
Copyright (c) 2022, vaxerski

2
docs/meson.build Normal file
View File

@@ -0,0 +1,2 @@
install_man ('Hyprland.1')
install_man ('hyprctl.1')

View File

@@ -0,0 +1,8 @@
# compile with HYPRLAND_HEADERS=<path_to_hl> make all
# make sure that the path above is to the root hl repo directory, NOT src/
# and that you have ran `make protocols` in the hl dir.
all:
$(CXX) -shared -fPIC --no-gnu-unique main.cpp customLayout.cpp customDecoration.cpp -o examplePlugin.so -g `pkg-config --cflags pixman-1 libdrm hyprland` -std=c++2b
clean:
rm ./examplePlugin.so

View File

@@ -0,0 +1,74 @@
#include "customDecoration.hpp"
#include <hyprland/src/Window.hpp>
#include <hyprland/src/Compositor.hpp>
#include "globals.hpp"
CCustomDecoration::CCustomDecoration(CWindow* pWindow) {
m_pWindow = pWindow;
m_vLastWindowPos = pWindow->m_vRealPosition.vec();
m_vLastWindowSize = pWindow->m_vRealSize.vec();
}
CCustomDecoration::~CCustomDecoration() {
damageEntire();
}
SWindowDecorationExtents CCustomDecoration::getWindowDecorationExtents() {
return m_seExtents;
}
void CCustomDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
if (!g_pCompositor->windowValidMapped(m_pWindow))
return;
if (!m_pWindow->m_sSpecialRenderData.decorate)
return;
static auto* const PCOLOR = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:example:border_color")->intValue;
static auto* const PROUNDING = &HyprlandAPI::getConfigValue(PHANDLE, "decoration:rounding")->intValue;
static auto* const PBORDERSIZE = &HyprlandAPI::getConfigValue(PHANDLE, "general:border_size")->intValue;
const auto ROUNDING = !m_pWindow->m_sSpecialRenderData.rounding ?
0 :
(m_pWindow->m_sAdditionalConfigData.rounding.toUnderlying() == -1 ? *PROUNDING : m_pWindow->m_sAdditionalConfigData.rounding.toUnderlying());
// draw the border
wlr_box fullBox = {(int)(m_vLastWindowPos.x - *PBORDERSIZE), (int)(m_vLastWindowPos.y - *PBORDERSIZE), (int)(m_vLastWindowSize.x + 2.0 * *PBORDERSIZE),
(int)(m_vLastWindowSize.y + 2.0 * *PBORDERSIZE)};
fullBox.x -= pMonitor->vecPosition.x;
fullBox.y -= pMonitor->vecPosition.y;
m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2},
{fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2,
fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}};
fullBox.x += offset.x;
fullBox.y += offset.y;
if (fullBox.width < 1 || fullBox.height < 1)
return; // don't draw invisible shadows
g_pHyprOpenGL->scissor((wlr_box*)nullptr);
scaleBox(&fullBox, pMonitor->scale);
g_pHyprOpenGL->renderBorder(&fullBox, CColor(*PCOLOR), *PROUNDING * pMonitor->scale + *PBORDERSIZE * 2, a);
}
eDecorationType CCustomDecoration::getDecorationType() {
return DECORATION_CUSTOM;
}
void CCustomDecoration::updateWindow(CWindow* pWindow) {
m_vLastWindowPos = pWindow->m_vRealPosition.vec();
m_vLastWindowSize = pWindow->m_vRealSize.vec();
damageEntire();
}
void CCustomDecoration::damageEntire() {
wlr_box dm = {(int)(m_vLastWindowPos.x - m_seExtents.topLeft.x), (int)(m_vLastWindowPos.y - m_seExtents.topLeft.y),
(int)(m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x), (int)m_seExtents.topLeft.y};
g_pHyprRenderer->damageBox(&dm);
}

View File

@@ -0,0 +1,29 @@
#pragma once
#define WLR_USE_UNSTABLE
#include <hyprland/src/render/decorations/IHyprWindowDecoration.hpp>
class CCustomDecoration : public IHyprWindowDecoration {
public:
CCustomDecoration(CWindow*);
virtual ~CCustomDecoration();
virtual SWindowDecorationExtents getWindowDecorationExtents();
virtual void draw(CMonitor*, float a, const Vector2D& offset);
virtual eDecorationType getDecorationType();
virtual void updateWindow(CWindow*);
virtual void damageEntire();
private:
SWindowDecorationExtents m_seExtents;
CWindow* m_pWindow = nullptr;
Vector2D m_vLastWindowPos;
Vector2D m_vLastWindowSize;
};

View File

@@ -0,0 +1,80 @@
#include "customLayout.hpp"
#include <hyprland/src/Compositor.hpp>
#include "globals.hpp"
void CHyprCustomLayout::onWindowCreatedTiling(CWindow* pWindow) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
const auto SIZE = PMONITOR->vecSize;
// these are used for focus and move calculations, and are *required* to touch for moving focus to work properly.
pWindow->m_vPosition = Vector2D{(SIZE.x / 2.0) * (m_vWindowData.size() % 2), (SIZE.y / 2.0) * (int)(m_vWindowData.size() > 1)};
pWindow->m_vSize = SIZE / 2.0;
// this is the actual pos and size of the window (where it's rendered)
pWindow->m_vRealPosition = pWindow->m_vPosition + Vector2D{10, 10};
pWindow->m_vRealSize = pWindow->m_vSize - Vector2D{20, 20};
const auto PDATA = &m_vWindowData.emplace_back();
PDATA->pWindow = pWindow;
}
void CHyprCustomLayout::onWindowRemovedTiling(CWindow* pWindow) {
std::erase_if(m_vWindowData, [&](const auto& other) { return other.pWindow == pWindow; });
}
bool CHyprCustomLayout::isWindowTiled(CWindow* pWindow) {
return std::find_if(m_vWindowData.begin(), m_vWindowData.end(), [&](const auto& other) { return other.pWindow == pWindow; }) != m_vWindowData.end();
}
void CHyprCustomLayout::recalculateMonitor(const int& eIdleInhibitMode) {
; // empty
}
void CHyprCustomLayout::recalculateWindow(CWindow* pWindow) {
; // empty
}
void CHyprCustomLayout::resizeActiveWindow(const Vector2D& delta, CWindow* pWindow) {
; // empty
}
void CHyprCustomLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode mode, bool on) {
; // empty
}
std::any CHyprCustomLayout::layoutMessage(SLayoutMessageHeader header, std::string content) {
return "";
}
SWindowRenderLayoutHints CHyprCustomLayout::requestRenderHints(CWindow* pWindow) {
return {};
}
void CHyprCustomLayout::switchWindows(CWindow* pWindowA, CWindow* pWindowB) {
; // empty
}
void CHyprCustomLayout::alterSplitRatio(CWindow* pWindow, float delta, bool exact) {
; // empty
}
std::string CHyprCustomLayout::getLayoutName() {
return "custom";
}
void CHyprCustomLayout::replaceWindowDataWith(CWindow* from, CWindow* to) {
; // empty
}
void CHyprCustomLayout::onEnable() {
for (auto& w : g_pCompositor->m_vWindows) {
if (w->isHidden() || !w->m_bIsMapped || w->m_bFadingOut || w->m_bIsFloating)
continue;
onWindowCreatedTiling(w.get());
}
}
void CHyprCustomLayout::onDisable() {
m_vWindowData.clear();
}

View File

@@ -0,0 +1,32 @@
#pragma once
#define WLR_USE_UNSTABLE
#include <hyprland/src/layout/IHyprLayout.hpp>
struct SWindowData {
CWindow* pWindow = nullptr;
};
class CHyprCustomLayout : public IHyprLayout {
public:
virtual void onWindowCreatedTiling(CWindow*);
virtual void onWindowRemovedTiling(CWindow*);
virtual bool isWindowTiled(CWindow*);
virtual void recalculateMonitor(const int&);
virtual void recalculateWindow(CWindow*);
virtual void resizeActiveWindow(const Vector2D&, CWindow* pWindow = nullptr);
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool);
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
virtual void switchWindows(CWindow*, CWindow*);
virtual void alterSplitRatio(CWindow*, float, bool);
virtual std::string getLayoutName();
virtual void replaceWindowDataWith(CWindow* from, CWindow* to);
virtual void onEnable();
virtual void onDisable();
private:
std::vector<SWindowData> m_vWindowData;
};

View File

@@ -0,0 +1,5 @@
#pragma once
#include <hyprland/src/plugins/PluginAPI.hpp>
inline HANDLE PHANDLE = nullptr;

View File

@@ -0,0 +1,99 @@
#define WLR_USE_UNSTABLE
#include "globals.hpp"
#include <hyprland/src/Window.hpp>
#include <hyprland/src/Compositor.hpp>
#include "customLayout.hpp"
#include "customDecoration.hpp"
#include <unistd.h>
#include <thread>
// Methods
inline std::unique_ptr<CHyprCustomLayout> g_pCustomLayout;
inline CFunctionHook* g_pFocusHook = nullptr;
inline CFunctionHook* g_pMotionHook = nullptr;
inline CFunctionHook* g_pMouseDownHook = nullptr;
typedef void (*origFocusWindow)(void*, CWindow*, wlr_surface*);
typedef void (*origMotion)(wlr_seat*, uint32_t, double, double);
typedef void (*origMouseDownNormal)(void*, wlr_pointer_button_event*);
// Do NOT change this function.
APICALL EXPORT std::string PLUGIN_API_VERSION() {
return HYPRLAND_API_VERSION;
}
static void onActiveWindowChange(void* self, std::any data) {
try {
auto* const PWINDOW = std::any_cast<CWindow*>(data);
HyprlandAPI::addNotification(PHANDLE, "[ExamplePlugin] Active window: " + (PWINDOW ? PWINDOW->m_szTitle : "None"), CColor{0.f, 0.5f, 1.f, 1.f}, 5000);
} catch (std::bad_any_cast& e) { HyprlandAPI::addNotification(PHANDLE, "[ExamplePlugin] Active window: None", CColor{0.f, 0.5f, 1.f, 1.f}, 5000); }
}
static void onNewWindow(void* self, std::any data) {
auto* const PWINDOW = std::any_cast<CWindow*>(data);
HyprlandAPI::addWindowDecoration(PHANDLE, PWINDOW, new CCustomDecoration(PWINDOW));
}
void hkFocusWindow(void* thisptr, CWindow* pWindow, wlr_surface* pSurface) {
// HyprlandAPI::addNotification(PHANDLE, getFormat("FocusWindow with %lx %lx", pWindow, pSurface), CColor{0.f, 1.f, 1.f, 1.f}, 5000);
(*(origFocusWindow)g_pFocusHook->m_pOriginal)(thisptr, pWindow, pSurface);
}
void hkNotifyMotion(wlr_seat* wlr_seat, uint32_t time_msec, double sx, double sy) {
// HyprlandAPI::addNotification(PHANDLE, getFormat("NotifyMotion with %lf %lf", sx, sy), CColor{0.f, 1.f, 1.f, 1.f}, 5000);
(*(origMotion)g_pMotionHook->m_pOriginal)(wlr_seat, time_msec, sx, sy);
}
void hkProcessMouseDownNormal(void* thisptr, wlr_pointer_button_event* e) {
// HyprlandAPI::addNotification(PHANDLE, "Mouse down normal!", CColor{0.8f, 0.2f, 0.5f, 1.0f}, 5000);
(*(origMouseDownNormal)g_pMouseDownHook->m_pOriginal)(thisptr, e);
}
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
HyprlandAPI::addNotification(PHANDLE, "Hello World from an example plugin!", CColor{0.f, 1.f, 1.f, 1.f}, 5000);
HyprlandAPI::registerCallbackDynamic(PHANDLE, "activeWindow", [&](void* self, std::any data) { onActiveWindowChange(self, data); });
HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, std::any data) { onNewWindow(self, data); });
g_pCustomLayout = std::make_unique<CHyprCustomLayout>();
HyprlandAPI::addLayout(PHANDLE, "custom", g_pCustomLayout.get());
HyprlandAPI::addConfigValue(PHANDLE, "plugin:example:border_color", SConfigValue{.intValue = configStringToInt("rgb(44ee44)")});
HyprlandAPI::addDispatcher(PHANDLE, "example", [](std::string arg) { HyprlandAPI::addNotification(PHANDLE, "Arg passed: " + arg, CColor{0.5f, 0.5f, 0.7f, 1.0f}, 5000); });
// Hook a public member
g_pFocusHook = HyprlandAPI::createFunctionHook(PHANDLE, (void*)&CCompositor::focusWindow, (void*)&hkFocusWindow);
// Hook a public non-member
g_pMotionHook = HyprlandAPI::createFunctionHook(PHANDLE, (void*)&wlr_seat_pointer_notify_motion, (void*)&hkNotifyMotion);
// Hook a private member
static const auto METHODS = HyprlandAPI::findFunctionsByName(PHANDLE, "processMouseDownNormal");
g_pMouseDownHook = HyprlandAPI::createFunctionHook(PHANDLE, METHODS[0].address, (void*)&hkProcessMouseDownNormal);
static auto* const PBORDERCOLOR = HyprlandAPI::getConfigValue(PHANDLE, "plugin:example:border_color");
// fancy notifications
HyprlandAPI::addNotificationV2(
PHANDLE,
{{"text", "Example hint, color " + std::to_string(PBORDERCOLOR->intValue)}, {"time", (uint64_t)10000}, {"color", CColor{PBORDERCOLOR->intValue}}, {"icon", ICON_HINT}});
// Enable our hooks
g_pFocusHook->hook();
g_pMotionHook->hook();
g_pMouseDownHook->hook();
HyprlandAPI::reloadConfig();
return {"ExamplePlugin", "An example plugin", "Vaxry", "1.0"};
}
APICALL EXPORT void PLUGIN_EXIT() {
HyprlandAPI::invokeHyprctlCommand("seterror", "disable");
}

View File

@@ -1,104 +1,162 @@
# This is an example Hyprland config file.
# Syntax is the same as in Hypr, but settings might differ.
#
# Refer to the wiki for more information.
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki (basic and advanced configuring)
# For a full list, see the wiki
#
monitor=,1280x720@60,0x0,1
workspace=DP-1,1
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,auto
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# Some default env vars.
env = XCURSOR_SIZE,24
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout=
kb_variant=
kb_model=
kb_options=
kb_rules=
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse=1
follow_mouse = 1
touchpad {
natural_scroll = false
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}
general {
sensitivity=1.0 # for mouse cursor
main_mod=SUPER
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in=5
gaps_out=20
border_size=2
col.active_border=0x66ee1111
col.inactive_border=0x66333333
gaps_in = 5
gaps_out = 20
border_size = 2
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = rgba(595959aa)
apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse)
damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer
layout = dwindle
}
decoration {
rounding=10
blur=1
blur_size=3 # minimum 1
blur_passes=1 # minimum 1, more passes = more resource intensive.
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
# if you want heavy blur, you need to up the blur_passes.
# the more passes, the more you can up the blur_size without noticing artifacts.
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10
blur = true
blur_size = 3
blur_passes = 1
blur_new_optimizations = true
drop_shadow = true
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled=1
animation=windows,1,7,default
animation=borders,1,10,default
animation=fadein,1,10,default
animation=workspaces,1,6,default
enabled = true
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
dwindle {
pseudotile=0 # enable pseudotiling on dwindle
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = true # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true # you probably want this
}
# example window rules
# for windows named/classed as abc and xyz
#windowrule=move 69 420,abc
#windowrule=size 420 69,abc
#windowrule=tile,xyz
#windowrule=float,abc
#windowrule=pseudo,abc
#windowrule=monitor 0,xyz
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = true
}
# example binds
bind=SUPER,Q,exec,kitty
bind=SUPER,C,killactive,
bind=SUPER,M,exit,
bind=SUPER,E,exec,dolphin
bind=SUPER,V,togglefloating,
bind=SUPER,R,exec,wofi --show drun -o DP-3
bind=SUPER,P,pseudo,
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = false
}
bind=SUPER,left,movefocus,l
bind=SUPER,right,movefocus,r
bind=SUPER,up,movefocus,u
bind=SUPER,down,movefocus,d
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
device:epic-mouse-v1 {
sensitivity = -0.5
}
bind=SUPER,1,workspace,1
bind=SUPER,2,workspace,2
bind=SUPER,3,workspace,3
bind=SUPER,4,workspace,4
bind=SUPER,5,workspace,5
bind=SUPER,6,workspace,6
bind=SUPER,7,workspace,7
bind=SUPER,8,workspace,8
bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
bind=ALT,1,movetoworkspace,1
bind=ALT,2,movetoworkspace,2
bind=ALT,3,movetoworkspace,3
bind=ALT,4,movetoworkspace,4
bind=ALT,5,movetoworkspace,5
bind=ALT,6,movetoworkspace,6
bind=ALT,7,movetoworkspace,7
bind=ALT,8,movetoworkspace,8
bind=ALT,9,movetoworkspace,9
bind=ALT,0,movetoworkspace,10
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, Q, exec, kitty
bind = $mainMod, C, killactive,
bind = $mainMod, M, exit,
bind = $mainMod, E, exec, dolphin
bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, wofi --show drun
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

12
example/hyprland.service Normal file
View File

@@ -0,0 +1,12 @@
; a primitive systemd --user example
[Unit]
Description = %p
BindsTo = graphical-session.target
Upholds = swaybg@333333.service
[Service]
Type = notify
ExecStart = /usr/bin/Hyprland
[Install]
WantedBy = default.target

16
example/screenShader.frag Normal file
View File

@@ -0,0 +1,16 @@
//
// Example blue light filter shader.
//
precision mediump float;
varying vec2 v_texcoord;
uniform sampler2D tex;
void main() {
vec4 pixColor = texture2D(tex, v_texcoord);
pixColor[2] *= 0.8;
gl_FragColor = pixColor;
}

13
example/swaybg@.service Normal file
View File

@@ -0,0 +1,13 @@
; a primitive systemd --user example
; see example/hyprland.service for more details
[Unit]
Description = %p
BindsTo = hyprland.service
Wants = hyprland.service
After = hyprland.service
[Service]
ExecStart = /usr/bin/swaybg --color #%i
[Install]
WantedBy = default.target

59
flake.lock generated
View File

@@ -1,12 +1,32 @@
{
"nodes": {
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1684265364,
"narHash": "sha256-AxNnWbthsuNx73HDQr0eBxrcE3+yfl/WsaXZqUFmkpQ=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "8c279b9fb0f2b031427dc5ef4eab53f2ed835530",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1657447684,
"narHash": "sha256-FCP9AuU1q6PE3vOeM5SFf58f/UKPBAsoSGDUGamNBbo=",
"lastModified": 1688500189,
"narHash": "sha256-djYYiY4lzJOlXOnTHytH6BUugrxHDZjuGxTSrU4gt4M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5f43d8b088d3771274bcfb69d3c7435b1121ac88",
"rev": "78419edadf0fabbe5618643bd850b2f2198ed060",
"type": "github"
},
"original": {
@@ -18,19 +38,21 @@
},
"root": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
"nixpkgs": "nixpkgs",
"wlroots": "wlroots"
"wlroots": "wlroots",
"xdph": "xdph"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1656865312,
"narHash": "sha256-xtQ0zwJZwN8sciruveM10CzKz6TWxBY8SyXa8E4jly4=",
"lastModified": 1686753331,
"narHash": "sha256-KovjVFwcuoUO0eu/UiWrnD3+m/K+SHSAVIz4xF9K1XA=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "5dc1d4671dd2ca3c1f0f09587c463fdbb542f0a4",
"rev": "7e7633abf09b362d0bad9e3fc650fd692369291d",
"type": "gitlab"
},
"original": {
@@ -39,6 +61,29 @@
"repo": "wlroots",
"type": "gitlab"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland-protocols"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1685385764,
"narHash": "sha256-r+XMyOoRXq+hlfjayb+fyi9kq2JK48TrwuNIAXqlj7U=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "4d9ff0c17716936e0b5ca577a39e263633901ed1",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",

View File

@@ -3,10 +3,22 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
wlroots = {
url = "gitlab:wlroots/wlroots?host=gitlab.freedesktop.org";
flake = false;
};
hyprland-protocols = {
url = "github:hyprwm/hyprland-protocols";
inputs.nixpkgs.follows = "nixpkgs";
};
xdph = {
url = "github:hyprwm/xdg-desktop-portal-hyprland";
inputs.nixpkgs.follows = "nixpkgs";
inputs.hyprland-protocols.follows = "hyprland-protocols";
};
};
outputs = inputs @ {
@@ -14,43 +26,55 @@
nixpkgs,
...
}: let
inherit (nixpkgs) lib;
lib = nixpkgs.lib.extend (import ./nix/lib.nix);
genSystems = lib.genAttrs [
# Add more systems if they are supported
"aarch64-linux"
"x86_64-linux"
];
pkgsFor = nixpkgs.legacyPackages;
mkDate = longDate: (lib.concatStringsSep "-" [
(__substring 0 4 longDate)
(__substring 4 2 longDate)
(__substring 6 2 longDate)
]);
pkgsFor = genSystems (system:
import nixpkgs {
inherit system;
overlays = [
self.overlays.hyprland-packages
self.overlays.wlroots-hyprland
inputs.hyprland-protocols.overlays.default
];
});
in {
overlays.default = _: prev: rec {
wlroots-hyprland = prev.wlroots.overrideAttrs (__: {
version = mkDate (inputs.wlroots.lastModifiedDate or "19700101");
src = inputs.wlroots;
});
hyprland = prev.callPackage ./nix/default.nix {
stdenv = prev.gcc12Stdenv;
version = "0.7.0beta" + "+date=" + (mkDate (self.lastModifiedDate or "19700101"));
wlroots = wlroots-hyprland;
overlays =
(import ./nix/overlays.nix {inherit self lib inputs;})
// {
default =
lib.mkJoinedOverlays
(with self.overlays; [
hyprland-packages
hyprland-extras
wlroots-hyprland
inputs.hyprland-protocols.overlays.default
]);
};
hyprland-debug = hyprland.override {debug = true;};
waybar-hyprland = prev.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
checks = genSystems (system:
(lib.filterAttrs
(n: _: (lib.hasPrefix "hyprland" n) && !(lib.hasSuffix "debug" n))
self.packages.${system})
// {
inherit (self.packages.${system}) xdg-desktop-portal-hyprland;
});
};
packages = genSystems (system:
(self.overlays.default null pkgsFor.${system})
(self.overlays.default pkgsFor.${system} pkgsFor.${system})
// {
default = self.packages.${system}.hyprland;
});
devShells = genSystems (system: {
default = pkgsFor.${system}.mkShell.override {stdenv = pkgsFor.${system}.gcc12Stdenv;} {
default = pkgsFor.${system}.mkShell {
name = "hyprland-shell";
nativeBuildInputs = with pkgsFor.${system}; [cmake];
buildInputs = [self.packages.${system}.wlroots-hyprland];
inputsFrom = [
self.packages.${system}.wlroots-hyprland
self.packages.${system}.hyprland
@@ -60,8 +84,12 @@
formatter = genSystems (system: pkgsFor.${system}.alejandra);
nixosModules.default = import ./nix/module.nix self;
nixosModules.default = import ./nix/module.nix inputs;
homeManagerModules.default = import ./nix/hm-module.nix self;
};
overlay = throw "Hyprland: .overlay output is deprecated, please use the .overlays.default output";
nixConfig = {
extra-substituters = ["https://hyprland.cachix.org"];
extra-trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
};
}

View File

@@ -1,4 +1,4 @@
all:
g++ -std=c++20 ./main.cpp -o ./hyprctl
$(CXX) -std=c++2b ./main.cpp -o ./hyprctl
clean:
rm ./hyprctl
rm ./hyprctl

View File

@@ -9,40 +9,62 @@
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <ranges>
#include <algorithm>
#include <iostream>
#include <string>
#include <fstream>
#include <string>
#include <deque>
const std::string USAGE = R"#(usage: hyprctl [command] [(opt)args]
const std::string USAGE = R"#(usage: hyprctl [(opt)flags] [command] [(opt)args]
commands:
monitors
workspaces
activeworkspace
clients
activewindow
layers
devices
binds
dispatch
keyword
version
kill
splash
hyprpaper
reload)#";
reload
setcursor
getoption
cursorpos
switchxkblayout
seterror
setprop
plugin
notify
globalshortcuts
void request(std::string arg) {
flags:
-j -> output in JSON
--batch -> execute a batch of commands, separated by ';'
)#";
#define PAD
void request(std::string arg, int minArgs = 0) {
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
if (SERVERSOCKET < 0) {
std::cout << "Couldn't open a socket (1)";
const auto ARGS = std::count(arg.begin(), arg.end(), ' ');
if (ARGS < minArgs) {
std::cout << "Not enough arguments, expected at least " << minArgs;
return;
}
const auto SERVER = gethostbyname("localhost");
if (!SERVER) {
std::cout << "Couldn't get host (2)";
if (SERVERSOCKET < 0) {
std::cout << "Couldn't open a socket (1)";
return;
}
@@ -57,11 +79,11 @@ void request(std::string arg) {
std::string instanceSigStr = std::string(instanceSig);
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
serverAddress.sun_family = AF_UNIX;
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock";
strcpy(serverAddress.sun_path, socketPath.c_str());
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
std::cout << "Couldn't connect to " << socketPath << ". (3)";
@@ -75,7 +97,8 @@ void request(std::string arg) {
return;
}
char buffer[8192] = {0};
std::string reply = "";
char buffer[8192] = {0};
sizeWritten = read(SERVERSOCKET, buffer, 8192);
@@ -84,9 +107,20 @@ void request(std::string arg) {
return;
}
reply += std::string(buffer, sizeWritten);
while (sizeWritten == 8192) {
sizeWritten = read(SERVERSOCKET, buffer, 8192);
if (sizeWritten < 0) {
std::cout << "Couldn't read (5)";
return;
}
reply += std::string(buffer, sizeWritten);
}
close(SERVERSOCKET);
std::cout << std::string(buffer);
std::cout << reply;
}
void requestHyprpaper(std::string arg) {
@@ -97,13 +131,6 @@ void requestHyprpaper(std::string arg) {
return;
}
const auto SERVER = gethostbyname("localhost");
if (!SERVER) {
std::cout << "Couldn't get host (2)";
return;
}
// get the instance signature
auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE");
@@ -115,11 +142,11 @@ void requestHyprpaper(std::string arg) {
std::string instanceSigStr = std::string(instanceSig);
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
serverAddress.sun_family = AF_UNIX;
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.hyprpaper.sock";
strcpy(serverAddress.sun_path, socketPath.c_str());
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
std::cout << "Couldn't connect to " << socketPath << ". (3)";
@@ -147,74 +174,215 @@ void requestHyprpaper(std::string arg) {
std::cout << std::string(buffer);
}
void dispatchRequest(int argc, char** argv) {
int dispatchRequest(int argc, char** argv) {
if (argc < 4) {
std::cout << "dispatch requires 2 params";
return;
if (argc < 3) {
std::cout << "Usage: hyprctl dispatch <dispatcher> <arg>\n\
Execute a hyprland keybind dispatcher with the given argument";
return 1;
}
std::string rq = "dispatch " + std::string(argv[2]) + " " + std::string(argv[3]);
std::string rq = "/dispatch";
request(rq);
}
void keywordRequest(int argc, char** argv) {
if (argc < 4) {
std::cout << "keyword requires 2 params";
return;
for (int i = 2; i < argc; i++) {
if (!strcmp(argv[i], "--"))
continue;
rq += " " + std::string(argv[i]);
}
std::string rq = "keyword " + std::string(argv[2]) + " " + std::string(argv[3]);
request(rq);
return 0;
}
void hyprpaperRequest(int argc, char** argv) {
int keywordRequest(int argc, char** argv) {
if (argc < 4) {
std::cout << "hyprpaper requires 2 params";
return;
std::cout << "Usage: hyprctl keyword <keyword> <arg>\n\
Execute a hyprland keyword with the given argument";
return 1;
}
std::string rq = "/keyword";
for (int i = 2; i < argc; i++)
rq += " " + std::string(argv[i]);
request(rq);
return 0;
}
int hyprpaperRequest(int argc, char** argv) {
if (argc < 4) {
std::cout << "Usage: hyprctl hyprpaper <command> <arg>\n\
Execute a hyprpaper command with the given argument";
return 1;
}
std::string rq = std::string(argv[2]) + " " + std::string(argv[3]);
requestHyprpaper(rq);
return 0;
}
void batchRequest(int argc, char** argv) {
std::string rq = "[[BATCH]]" + std::string(argv[2]);
int setcursorRequest(int argc, char** argv) {
if (argc < 4) {
std::cout << "Usage: hyprctl setcursor <theme> <size>\n\
Sets the cursor theme for everything except GTK and reloads the cursor";
return 1;
}
std::string rq = "setcursor ";
for (size_t i = 2; i < argc; ++i)
rq += std::string(argv[i]) + " ";
rq.pop_back();
request(rq);
return 0;
}
int outputRequest(int argc, char** argv) {
if (argc < 4) {
std::cout << "Usage: hyprctl output <mode> <name>\n\
creates / destroys a fake output\n\
with create, name is the backend name to use (available: auto, x11, wayland, headless)\n\
with destroy, name is the output name to destroy";
return 1;
}
std::string rq = "output " + std::string(argv[2]) + " " + std::string(argv[3]);
request(rq);
return 0;
}
void batchRequest(std::string arg) {
std::string rq = "[[BATCH]]" + arg.substr(arg.find_first_of(" ") + 1);
request(rq);
}
std::deque<std::string> splitArgs(int argc, char** argv) {
std::deque<std::string> result;
for (auto i = 1 /* skip the executable */; i < argc; ++i)
result.push_back(std::string(argv[i]));
return result;
}
bool isNumber(const std::string& str, bool allowfloat) {
if (str.empty())
return false;
return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); });
}
int main(int argc, char** argv) {
int bflag = 0, sflag = 0, index, c;
int bflag = 0, sflag = 0, index, c;
bool parseArgs = true;
if (argc < 2) {
printf("%s\n", USAGE.c_str());
return 1;
}
if (!strcmp(argv[1], "monitors")) request("monitors");
else if (!strcmp(argv[1], "clients")) request("clients");
else if (!strcmp(argv[1], "workspaces")) request("workspaces");
else if (!strcmp(argv[1], "activewindow")) request("activewindow");
else if (!strcmp(argv[1], "layers")) request("layers");
else if (!strcmp(argv[1], "version")) request("version");
else if (!strcmp(argv[1], "kill")) request("kill");
else if (!strcmp(argv[1], "splash")) request("splash");
else if (!strcmp(argv[1], "devices")) request("devices");
else if (!strcmp(argv[1], "reload")) request("reload");
else if (!strcmp(argv[1], "dispatch")) dispatchRequest(argc, argv);
else if (!strcmp(argv[1], "keyword")) keywordRequest(argc, argv);
else if (!strcmp(argv[1], "hyprpaper")) hyprpaperRequest(argc, argv);
else if (!strcmp(argv[1], "--batch")) batchRequest(argc, argv);
else if (!strcmp(argv[1], "--help")) printf("%s", USAGE.c_str());
std::string fullRequest = "";
std::string fullArgs = "";
const auto ARGS = splitArgs(argc, argv);
for (auto i = 0; i < ARGS.size(); ++i) {
if (ARGS[i] == "--") {
// Stop parsing arguments after --
parseArgs = false;
continue;
}
if (parseArgs && (ARGS[i][0] == '-') && !isNumber(ARGS[i], true) /* For stuff like -2 */) {
// parse
if (ARGS[i] == "-j" && !fullArgs.contains("j")) {
fullArgs += "j";
} else if (ARGS[i] == "--batch") {
fullRequest = "--batch ";
} else {
printf("%s\n", USAGE.c_str());
return 1;
}
continue;
}
fullRequest += ARGS[i] + " ";
}
if (fullRequest.empty()) {
printf("%s\n", USAGE.c_str());
return 1;
}
fullRequest.pop_back(); // remove trailing space
fullRequest = fullArgs + "/" + fullRequest;
int exitStatus = 0;
if (fullRequest.contains("/--batch"))
batchRequest(fullRequest);
else if (fullRequest.contains("/monitors"))
request(fullRequest);
else if (fullRequest.contains("/clients"))
request(fullRequest);
else if (fullRequest.contains("/workspaces"))
request(fullRequest);
else if (fullRequest.contains("/activeworkspace"))
request(fullRequest);
else if (fullRequest.contains("/activewindow"))
request(fullRequest);
else if (fullRequest.contains("/layers"))
request(fullRequest);
else if (fullRequest.contains("/version"))
request(fullRequest);
else if (fullRequest.contains("/kill"))
request(fullRequest);
else if (fullRequest.contains("/splash"))
request(fullRequest);
else if (fullRequest.contains("/devices"))
request(fullRequest);
else if (fullRequest.contains("/reload"))
request(fullRequest);
else if (fullRequest.contains("/getoption"))
request(fullRequest);
else if (fullRequest.contains("/binds"))
request(fullRequest);
else if (fullRequest.contains("/cursorpos"))
request(fullRequest);
else if (fullRequest.contains("/animations"))
request(fullRequest);
else if (fullRequest.contains("/globalshortcuts"))
request(fullRequest);
else if (fullRequest.contains("/switchxkblayout"))
request(fullRequest, 2);
else if (fullRequest.contains("/seterror"))
request(fullRequest, 1);
else if (fullRequest.contains("/setprop"))
request(fullRequest, 3);
else if (fullRequest.contains("/plugin"))
request(fullRequest, 1);
else if (fullRequest.contains("/notify"))
request(fullRequest, 2);
else if (fullRequest.contains("/output"))
exitStatus = outputRequest(argc, argv);
else if (fullRequest.contains("/setcursor"))
exitStatus = setcursorRequest(argc, argv);
else if (fullRequest.contains("/dispatch"))
exitStatus = dispatchRequest(argc, argv);
else if (fullRequest.contains("/keyword"))
exitStatus = keywordRequest(argc, argv);
else if (fullRequest.contains("/hyprpaper"))
exitStatus = hyprpaperRequest(argc, argv);
else if (fullRequest.contains("/--help"))
printf("%s", USAGE.c_str());
else {
printf("%s\n", USAGE.c_str());
return 1;
}
printf("\n");
return 0;
return exitStatus;
}

8
hyprland.pc.in Normal file
View File

@@ -0,0 +1,8 @@
prefix="@PREFIX@"
includedir="${prefix}/include"
Name: Hyprland
URL: https://github.com/hyprwm/Hyprland
Description: Hyprland header files
Version: @HYPRLAND_VERSION@
Cflags: -I"${includedir}/hyprland/protocols" -I"${includedir}/hyprland/wlroots" -I"${includedir}"

View File

@@ -1,8 +1,29 @@
project('Hyprland', 'cpp', 'c',
version : '0.7.0beta',
default_options : ['warning_level=2', 'default_library=static', 'optimization=3'])
version : run_command('jq', '-r', '.version', join_paths(meson.source_root(), 'props.json'), check: true).stdout().strip(),
default_options : [
'warning_level=2',
'default_library=static',
'optimization=3',
'buildtype=release',
'debug=false'
# 'cpp_std=c++23' # not yet supported by meson, as of version 0.63.0
])
add_global_arguments('-std=c++23', language: 'cpp')
# clang v14.0.6 uses C++2b instead of C++23, so we've gotta account for that
# replace the following with a project default option once meson gets support for C++23
cpp_compiler = meson.get_compiler('cpp')
if cpp_compiler.has_argument('-std=c++23')
add_global_arguments('-std=c++23', language: 'cpp')
elif cpp_compiler.has_argument('-std=c++2b')
add_global_arguments('-std=c++2b', language: 'cpp')
else
error('Could not configure current C++ compiler (' + cpp_compiler.get_id() + ' ' + cpp_compiler.version() + ') with required C++ standard (C++23)')
endif
GIT_BRANCH = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: false).stdout().strip()
GIT_COMMIT_HASH = run_command('git', 'rev-parse', 'HEAD', check: false).stdout().strip()
GIT_COMMIT_MESSAGE = run_command('sh', '-c', 'git show | head -n 5 | tail -n 1', check: false).stdout().strip()
GIT_DIRTY = run_command('sh', '-c', 'git diff-index --quiet HEAD -- || echo "dirty"', check: false).stdout().strip()
add_project_arguments(
[
@@ -10,6 +31,11 @@ add_project_arguments(
'-Wno-unused-value',
'-Wno-missing-field-initializers',
'-Wno-narrowing',
f'-DGIT_BRANCH="@GIT_BRANCH@"',
f'-DGIT_COMMIT_HASH="@GIT_COMMIT_HASH@"',
f'-DGIT_COMMIT_MESSAGE="@GIT_COMMIT_MESSAGE@"',
f'-DGIT_DIRTY="@GIT_DIRTY@"',
],
language: 'cpp')
@@ -17,21 +43,58 @@ wlroots = subproject('wlroots', default_options: ['examples=false'])
have_xwlr = wlroots.get_variable('features').get('xwayland')
xcb_dep = dependency('xcb', required: get_option('xwayland'))
cmake = import('cmake')
udis = cmake.subproject('udis86')
udis86 = udis.dependency('libudis86')
if get_option('xwayland').enabled() and not have_xwlr
error('Cannot enable Xwayland in Hyprland: wlroots has been built without Xwayland support')
endif
have_xwayland = xcb_dep.found() and have_xwlr
if not have_xwayland
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
endif
backtrace_dep = cpp_compiler.find_library('execinfo', required: false)
systemd_dep = dependency('libsystemd', required: get_option('systemd'))
if get_option('systemd').enabled()
if systemd_dep.found()
add_project_arguments('-DUSES_SYSTEMD', language: 'cpp')
else
error('Cannot enable systemd in Hyprland: libsystemd was not found')
endif
endif
if get_option('legacy_renderer').enabled()
add_project_arguments('-DLEGACY_RENDERER', language: 'cpp')
endif
if get_option('buildtype') == 'debug'
add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp')
endif
globber = run_command('find', 'src', '-name', '*.h*', check: true)
headers = globber.stdout().strip().split('\n')
foreach file : headers
install_headers(file, subdir: 'hyprland', preserve_path: true)
endforeach
subdir('protocols')
subdir('src')
subdir('hyprctl')
subdir('assets')
subdir('example')
subdir('docs')
pkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig')
import('pkgconfig').generate(
name: 'Hyprland',
filebase: 'hyprland',
url: 'https://github.com/hyprwm/Hyprland',
description: 'Hyprland header files',
install_dir: pkg_install_dir,
subdirs: ['', 'hyprland/protocols', 'hyprland/wlroots'],
)

View File

@@ -1 +1,3 @@
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
option('systemd', type: 'feature', value: 'auto', description: 'Enable systemd integration')
option('legacy_renderer', type: 'feature', value: 'disabled', description: 'Enable legacy renderer')

View File

@@ -1,78 +1,139 @@
{
lib,
stdenv,
fetchFromGitHub,
pkg-config,
makeWrapper,
meson,
ninja,
binutils,
cairo,
git,
hyprland-protocols,
jq,
libdrm,
libinput,
libxcb,
libxkbcommon,
mesa,
mount,
pango,
pciutils,
systemd,
udis86,
wayland,
wayland-protocols,
wayland-scanner,
wlroots,
xcbutilwm,
xwayland,
enableXWayland ? true,
version ? "git",
debug ? false,
}:
stdenv.mkDerivation {
pname = "hyprland" + lib.optionalString debug "-debug";
inherit version;
src = ../.;
nativeBuildInputs = [
meson
ninja
pkg-config
];
buildInputs =
[
libdrm
libinput
libxcb
libxkbcommon
mesa
pango
wayland
wayland-protocols
wayland-scanner
(wlroots.override {inherit enableXWayland;})
xcbutilwm
]
++ lib.optional enableXWayland xwayland;
mesonBuildType =
if debug
then "debug"
else "release";
mesonFlags = lib.optional (!enableXWayland) "-DNO_XWAYLAND=true";
patches = [
# make meson use the provided wlroots instead of the git submodule
./meson-build.patch
];
# Fix hardcoded paths to /usr installation
postPatch = ''
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
enableXWayland ? true,
hidpiXWayland ? false,
legacyRenderer ? false,
nvidiaPatches ? false,
withSystemd ? true,
wrapRuntimeDeps ? true,
version ? "git",
commit,
}: let
assertXWayland = lib.assertMsg (hidpiXWayland -> enableXWayland) ''
Hyprland: cannot have hidpiXWayland when enableXWayland is false.
'';
in
assert assertXWayland;
stdenv.mkDerivation {
pname = "hyprland" + lib.optionalString debug "-debug";
inherit version;
passthru.providedSessions = ["hyprland"];
src = lib.cleanSourceWith {
filter = name: type: let
baseName = baseNameOf (toString name);
in
! (
lib.hasSuffix ".nix" baseName
);
src = lib.cleanSource ../.;
};
meta = with lib; {
homepage = "https://github.com/vaxerski/Hyprland";
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
license = licenses.bsd3;
platforms = platforms.linux;
mainProgram = "Hyprland";
};
}
nativeBuildInputs = [
jq
meson
ninja
pkg-config
makeWrapper
];
outputs = [
"out"
"man"
"dev"
];
buildInputs =
[
git
cairo
hyprland-protocols
libdrm
libinput
libxkbcommon
mesa
pango
udis86
wayland
wayland-protocols
wayland-scanner
pciutils
(wlroots.override {inherit enableXWayland hidpiXWayland nvidiaPatches;})
]
++ lib.optionals enableXWayland [libxcb xcbutilwm xwayland]
++ lib.optionals withSystemd [systemd];
mesonBuildType =
if debug
then "debug"
else "release";
mesonFlags = builtins.concatLists [
["-Dauto_features=disabled"]
(lib.optional enableXWayland "-Dxwayland=enabled")
(lib.optional legacyRenderer "-Dlegacy_renderer=enabled")
(lib.optional withSystemd "-Dsystemd=enabled")
];
patches = [
# make meson use the provided wlroots instead of the git submodule
./meson-build.patch
# fixes portals search path to be picked up from $XDG_DESKTOP_PORTAL_DIR
./portals.patch
];
postPatch = ''
# Fix hardcoded paths to /usr installation
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
substituteInPlace meson.build \
--replace "@GIT_COMMIT_HASH@" '${commit}' \
--replace "@GIT_DIRTY@" '${
if commit == ""
then "dirty"
else ""
}'
'';
postInstall = ''
ln -s ${wlroots}/include/wlr $dev/include/hyprland/wlroots
${lib.optionalString wrapRuntimeDeps ''
wrapProgram $out/bin/Hyprland \
--suffix PATH : ${lib.makeBinPath [ binutils pciutils ]}
''}
'';
passthru.providedSessions = ["hyprland"];
meta = with lib; {
homepage = "https://github.com/vaxerski/Hyprland";
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
license = licenses.bsd3;
platforms = platforms.linux;
mainProgram = "Hyprland";
};
}

170
nix/hm-module.nix Normal file
View File

@@ -0,0 +1,170 @@
self: {
config,
lib,
pkgs,
...
}: let
cfg = config.wayland.windowManager.hyprland;
defaultHyprlandPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
enableXWayland = cfg.xwayland.enable;
hidpiXWayland = cfg.xwayland.hidpi;
inherit (cfg) nvidiaPatches;
};
in {
meta.maintainers = [lib.maintainers.fufexan];
options.wayland.windowManager.hyprland = {
enable =
lib.mkEnableOption null
// {
description = lib.mdDoc ''
Whether to enable Hyprland, the dynamic tiling Wayland compositor
that doesn't sacrifice on its looks.
You can manually launch Hyprland by executing {command}`Hyprland` on
a TTY.
See <https://wiki.hyprland.org> for more information.
'';
};
package = lib.mkOption {
type = with lib.types; nullOr package;
default = defaultHyprlandPackage;
defaultText = lib.literalExpression ''
hyprland.packages.''${pkgs.stdenv.hostPlatform.system}.default.override {
enableXWayland = config.wayland.windowManager.hyprland.xwayland.enable;
hidpiXWayland = config.wayland.windowManager.hyprland.xwayland.hidpi;
inherit (config.wayland.windowManager.hyprland) nvidiaPatches;
}
'';
description = lib.mdDoc ''
Hyprland package to use. Will override the 'xwayland' and
'nvidiaPatches' options.
Defaults to the one provided by the flake. Set it to
{package}`pkgs.hyprland` to use the one provided by nixpkgs or
if you have an overlay.
Set to null to not add any Hyprland package to your path. This should
be done if you want to use the NixOS module to install Hyprland.
'';
};
plugins = lib.mkOption {
type = with lib.types; listOf (either package path);
default = [];
description = lib.mdDoc ''
List of Hyprland plugins to use. Can either be packages or
absolute plugin paths.
'';
};
systemdIntegration = lib.mkOption {
type = lib.types.bool;
default = pkgs.stdenv.isLinux;
description = lib.mdDoc ''
Whether to enable {file}`hyprland-session.target` on
Hyprland startup. This links to {file}`graphical-session.target`.
Some important environment variables will be imported to systemd
and dbus user environment before reaching the target, including
- {env}`DISPLAY`
- {env}`HYPRLAND_INSTANCE_SIGNATURE`
- {env}`WAYLAND_DISPLAY`
- {env}`XDG_CURRENT_DESKTOP`
'';
};
disableAutoreload =
lib.mkEnableOption null
// {
description = lib.mdDoc ''
Whether to disable automatically reloading Hyprland's configuration when
rebuilding the Home Manager profile.
'';
};
xwayland = {
enable = lib.mkEnableOption (lib.mdDoc "XWayland") // {default = true;};
hidpi =
lib.mkEnableOption null
// {
description = lib.mdDoc ''
Enable HiDPI XWayland, based on [XWayland MR 733](https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733).
See <https://wiki.hyprland.org/Nix/Options-Overrides/#xwayland-hidpi> for more info.
'';
};
};
nvidiaPatches = lib.mkEnableOption (lib.mdDoc "patching wlroots for better Nvidia support.");
extraConfig = lib.mkOption {
type = lib.types.nullOr lib.types.lines;
default = "";
description = lib.mdDoc ''
Extra configuration lines to add to {file}`~/.config/hypr/hyprland.conf`.
'';
};
recommendedEnvironment =
lib.mkEnableOption null
// {
description = lib.mdDoc ''
Whether to set the recommended environment variables.
'';
};
};
config = lib.mkIf cfg.enable {
warnings =
if (cfg.systemdIntegration || cfg.plugins != []) && cfg.extraConfig == null then
[ ''You have enabled hyprland.systemdIntegration or listed plugins in hyprland.plugins.
Your Hyprland config will be linked by home manager.
Set hyprland.extraConfig or unset hyprland.systemdIntegration and hyprland.plugins to remove this warning.'' ]
else [];
home.packages =
lib.optional (cfg.package != null) cfg.package
++ lib.optional cfg.xwayland.enable pkgs.xwayland;
home.sessionVariables =
lib.mkIf cfg.recommendedEnvironment {NIXOS_OZONE_WL = "1";};
xdg.configFile."hypr/hyprland.conf" = lib.mkIf (cfg.systemdIntegration || cfg.extraConfig != null || cfg.plugins != []) {
text =
(lib.optionalString cfg.systemdIntegration ''
exec-once=${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && systemctl --user start hyprland-session.target
'')
+ lib.concatStrings (builtins.map (entry: let
plugin = if lib.types.package.check entry then "${entry}/lib/lib${entry.pname}.so" else entry;
in "plugin = ${plugin}\n") cfg.plugins)
+ (if cfg.extraConfig != null then cfg.extraConfig else "");
onChange = let
hyprlandPackage =
if cfg.package == null
then defaultHyprlandPackage
else cfg.package;
in
lib.mkIf (!cfg.disableAutoreload) ''
( # execute in subshell so that `shopt` won't affect other scripts
shopt -s nullglob # so that nothing is done if /tmp/hypr/ does not exist or is empty
for instance in /tmp/hypr/*; do
HYPRLAND_INSTANCE_SIGNATURE=''${instance##*/} ${hyprlandPackage}/bin/hyprctl reload config-only \
|| true # ignore dead instance(s)
done
)
'';
};
systemd.user.targets.hyprland-session = lib.mkIf cfg.systemdIntegration {
Unit = {
Description = "Hyprland compositor session";
Documentation = ["man:systemd.special(7)"];
BindsTo = ["graphical-session.target"];
Wants = ["graphical-session-pre.target"];
After = ["graphical-session-pre.target"];
};
};
};
}

8
nix/lib.nix Normal file
View File

@@ -0,0 +1,8 @@
final: prev: let
lib = final;
mkJoinedOverlays = overlays: final: prev:
lib.foldl' (attrs: overlay: attrs // (overlay final prev)) {} overlays;
in prev // {
inherit mkJoinedOverlays;
}

View File

@@ -1,36 +1,64 @@
diff --git a/meson.build b/meson.build
index 22ee4bf..5528613 100644
index f3802553..6a924a79 100644
--- a/meson.build
+++ b/meson.build
@@ -2,16 +2,10 @@ project('Hyprland', 'cpp', 'c',
version : '0.1',
default_options : ['warning_level=3', 'cpp_std=c++20', 'default_library=static'])
@@ -21,9 +21,9 @@ else
endif
GIT_BRANCH = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: false).stdout().strip()
-GIT_COMMIT_HASH = run_command('git', 'rev-parse', 'HEAD', check: false).stdout().strip()
+GIT_COMMIT_HASH = '@GIT_COMMIT_HASH@'
GIT_COMMIT_MESSAGE = run_command('sh', '-c', 'git show | head -n 5 | tail -n 1', check: false).stdout().strip()
-GIT_DIRTY = run_command('sh', '-c', 'git diff-index --quiet HEAD -- || echo "dirty"', check: false).stdout().strip()
+GIT_DIRTY = '@GIT_DIRTY@'
add_project_arguments(
[
@@ -39,21 +39,8 @@ add_project_arguments(
],
language: 'cpp')
-wlroots = subproject('wlroots', default_options: ['examples=false'])
-have_xwlr = wlroots.get_variable('features').get('xwayland')
+wlroots = dependency('wlroots', version: '>=0.16.0')
xcb_dep = dependency('xcb', required: get_option('xwayland'))
-xcb_dep = dependency('xcb', required: get_option('xwayland'))
-
-cmake = import('cmake')
-udis = cmake.subproject('udis86')
-udis86 = udis.dependency('libudis86')
-
-if get_option('xwayland').enabled() and not have_xwlr
- error('Cannot enable Xwayland in Hyprland: wlroots has been built without Xwayland support')
-endif
-have_xwayland = xcb_dep.found() and have_xwlr
-
-if not have_xwayland
+if not xcb_dep.found()
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
- add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
+if get_option('xwayland').disabled()
+ add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
endif
backtrace_dep = cpp_compiler.find_library('execinfo', required: false)
diff --git a/src/meson.build b/src/meson.build
index 5d64188..a676333 100644
index 7b658d31..60aa4057 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,7 +7,7 @@ executable('Hyprland', src,
@@ -7,16 +7,16 @@ executable('Hyprland', src,
server_protos,
dependency('wayland-server'),
dependency('wayland-client'),
- wlroots.get_variable('wlroots'),
+ wlroots,
+ dependency('wlroots'),
dependency('cairo'),
dependency('pango'),
dependency('pangocairo'),
dependency('libdrm'),
dependency('egl'),
dependency('xkbcommon'),
dependency('libinput'),
- xcb_dep,
+ dependency('xcb', required: get_option('xwayland')),
backtrace_dep,
systemd_dep,
- udis86,
+ dependency('udis86'),
dependency('pixman-1'),
dependency('gl', 'opengl'),

View File

@@ -1,5 +1,4 @@
# Copied from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/sway.nix
self: {
inputs: {
config,
lib,
pkgs,
@@ -7,56 +6,93 @@ self: {
}:
with lib; let
cfg = config.programs.hyprland;
defaultHyprlandPackage = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
enableXWayland = cfg.xwayland.enable;
hidpiXWayland = cfg.xwayland.hidpi;
inherit (cfg) nvidiaPatches;
};
in {
# disables Nixpkgs Hyprland module to avoid conflicts
disabledModules = ["programs/hyprland.nix"];
options.programs.hyprland = {
enable = mkEnableOption ''
Hyprland, the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
You can manually launch Hyprland by executing "exec Hyprland" on a TTY.
A configuration file will be generated in ~/.config/hypr/hyprland.conf.
See <link xlink:href="https://github.com/vaxerski/Hyprland/wiki" /> for
more information.
'';
enable =
mkEnableOption null
// {
description = mdDoc ''
Hyprland, the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
You can manually launch Hyprland by executing {command}`Hyprland` on a TTY.
A configuration file will be generated in {file}`~/.config/hypr/hyprland.conf`.
See <https://wiki.hyprland.org> for more information.
'';
};
package = mkOption {
type = types.package;
default = self.packages.${pkgs.system}.default;
defaultText = literalExpression "<Hyprland flake>.packages.<system>.default";
example = literalExpression "<Hyprland flake>.packages.<system>.default.override { }";
description = ''
Hyprland package to use.
type = types.path;
default = defaultHyprlandPackage;
defaultText = literalExpression ''
hyprland.packages.''${pkgs.stdenv.hostPlatform.system}.default.override {
enableXWayland = config.programs.hyprland.xwayland.enable;
hidpiXWayland = config.programs.hyprland.xwayland.hidpi;
inherit (config.programs.hyprland) nvidiaPatches;
}
'';
example = literalExpression "pkgs.hyprland";
description = mdDoc ''
The Hyprland package to use.
Setting this option will make {option}`programs.hyprland.xwayland` and
{option}`programs.hyprland.nvidiaPatches` not work.
'';
};
extraPackages = mkOption {
type = with types; listOf package;
default = with pkgs; [
kitty
wofi
swaybg
];
defaultText = literalExpression ''
with pkgs; [ kitty wofi swaybg ];
'';
example = literalExpression ''
with pkgs; [
alacritty wofi
]
'';
description = ''
Extra packages to be installed system wide.
'';
xwayland = {
enable = mkEnableOption (mdDoc "XWayland") // {default = true;};
hidpi =
mkEnableOption null
// {
description = mdDoc ''
Enable HiDPI XWayland, based on [XWayland MR 733](https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733).
See <https://wiki.hyprland.org/Nix/Options-Overrides/#xwayland-hidpi> for more info.
'';
};
};
nvidiaPatches = mkEnableOption (mdDoc "patching wlroots for better Nvidia support");
};
config = mkIf cfg.enable {
environment.systemPackages = [cfg.package] ++ cfg.extraPackages;
security.polkit.enable = true;
hardware.opengl.enable = mkDefault true;
environment = {
systemPackages = [cfg.package];
sessionVariables = {
NIXOS_OZONE_WL = mkDefault "1";
};
};
fonts.enableDefaultFonts = mkDefault true;
programs.dconf.enable = mkDefault true;
hardware.opengl.enable = mkDefault true;
programs = {
dconf.enable = mkDefault true;
xwayland.enable = mkDefault true;
};
security.polkit.enable = true;
services.xserver.displayManager.sessionPackages = [cfg.package];
programs.xwayland.enable = mkDefault true;
xdg.portal.enable = mkDefault true;
xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-wlr];
xdg.portal = {
enable = mkDefault true;
extraPortals = lib.mkIf (cfg.package != null) [
(inputs.xdph.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland.override {
hyprland-share-picker = inputs.xdph.packages.${pkgs.stdenv.hostPlatform.system}.hyprland-share-picker.override {
hyprland = cfg.package;
};
})
];
};
};
}

102
nix/overlays.nix Normal file
View File

@@ -0,0 +1,102 @@
{
self,
lib,
inputs,
}: let
props = builtins.fromJSON (builtins.readFile ../props.json);
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in {
# Packages for variations of Hyprland, and its dependencies.
hyprland-packages = final: prev: {
hyprland = final.callPackage ./default.nix {
version =
props.version
+ "+date="
+ (mkDate (self.lastModifiedDate or "19700101"))
+ "_"
+ (self.shortRev or "dirty");
wlroots = final.wlroots-hyprland;
commit = self.rev or "";
inherit (final) udis86 hyprland-protocols;
};
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
hyprland-debug = final.hyprland.override {debug = true;};
hyprland-hidpi = final.hyprland.override {hidpiXWayland = true;};
hyprland-nvidia = final.hyprland.override {nvidiaPatches = true;};
hyprland-no-hidpi =
builtins.trace
"hyprland-no-hidpi was removed. Please use the default package."
final.hyprland;
udis86 = final.callPackage ./udis86.nix {};
};
# Packages for extra software recommended for usage with Hyprland,
# including forked or patched packages for compatibility.
hyprland-extras = lib.mkJoinedOverlays [
# Include any inputs' specific overlays whose attributes should
# be re-exported by the Hyprland flake.
#
inputs.xdph.overlays.default
# Provides:
# - xdg-desktop-portal-hyprland
# - hyprland-share-picker
#
# Attributes for `hyprland-extras` defined by this flake can
# go in the oberlay below.
(final: prev: {
waybar-hyprland = prev.waybar.overrideAttrs (old: {
postPatch = ''
# use hyprctl to switch workspaces
sed -i 's/zext_workspace_handle_v1_activate(workspace_handle_);/const std::string command = "hyprctl dispatch workspace " + name_;\n\tsystem(command.c_str());/g' src/modules/wlr/workspace_manager.cpp
'';
postFixup = ''
wrapProgram $out/bin/waybar \
--suffix PATH : ${lib.makeBinPath [ prev.hyprland ]}
'';
mesonFlags = old.mesonFlags ++ ["-Dexperimental=true"];
});
})
];
# Patched version of wlroots for Hyprland.
# It is under a new package name so as to not conflict with
# the standard version in nixpkgs.
wlroots-hyprland = final: prev: {
wlroots-hyprland = final.callPackage ./wlroots.nix {
version =
mkDate (inputs.wlroots.lastModifiedDate or "19700101")
+ "_"
+ (inputs.wlroots.shortRev or "dirty");
src = inputs.wlroots;
libdisplay-info = prev.libdisplay-info.overrideAttrs (old: {
version = "0.1.1+date=2023-03-02";
src = final.fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "emersion";
repo = old.pname;
rev = "147d6611a64a6ab04611b923e30efacaca6fc678";
sha256 = "sha256-/q79o13Zvu7x02SBGu0W5yQznQ+p7ltZ9L6cMW5t/o4=";
};
});
libliftoff = prev.libliftoff.overrideAttrs (old: {
version = "0.5.0-dev";
src = final.fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "emersion";
repo = old.pname;
rev = "d98ae243280074b0ba44bff92215ae8d785658c0";
sha256 = "sha256-DjwlS8rXE7srs7A8+tHqXyUsFGtucYSeq6X0T/pVOc8=";
};
NIX_CFLAGS_COMPILE = toString ["-Wno-error=sign-conversion"];
});
};
};
}

26
nix/portals.patch Normal file
View File

@@ -0,0 +1,26 @@
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index a9d95f39..069a03ca 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -2340,14 +2340,18 @@ void CCompositor::performUserChecks() {
static auto* const PSUPPRESSPORTAL = &g_pConfigManager->getConfigValuePtr("misc:suppress_portal_warnings")->intValue;
- if (!*PSUPPRESSPORTAL) {
- if (std::ranges::any_of(BAD_PORTALS, [&](const std::string& portal) { return std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/" + portal + ".portal"); })) {
+ static auto* const PORTALDIRENV = getenv("XDG_DESKTOP_PORTAL_DIR");
+
+ static auto const PORTALDIR = PORTALDIRENV != NULL ? std::string(PORTALDIRENV) : "";
+
+ if (!*PSUPPRESSPORTAL && PORTALDIR != "") {
+ if (std::ranges::any_of(BAD_PORTALS, [&](const std::string& portal) { return std::filesystem::exists(PORTALDIR + "/" + portal + ".portal"); })) {
// bad portal detected
g_pHyprNotificationOverlay->addNotification("You have one or more incompatible xdg-desktop-portal impls installed. Please remove incompatible ones to avoid issues.",
CColor(0), 15000, ICON_ERROR);
}
- if (std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/hyprland.portal") && std::filesystem::exists("/usr/share/xdg-desktop-portal/portals/wlr.portal")) {
+ if (std::filesystem::exists(PORTALDIR + "/hyprland.portal") && std::filesystem::exists(PORTALDIR + "/wlr.portal")) {
g_pHyprNotificationOverlay->addNotification("You have xdg-desktop-portal-hyprland and -wlr installed simultaneously. Please uninstall one to avoid issues.", CColor(0),
15000, ICON_ERROR);
}

32
nix/udis86.nix Normal file
View File

@@ -0,0 +1,32 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
python3,
}:
stdenv.mkDerivation {
pname = "udis86";
version = "unstable-2022-10-13";
src = fetchFromGitHub {
owner = "canihavesomecoffee";
repo = "udis86";
rev = "5336633af70f3917760a6d441ff02d93477b0c86";
hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g=";
};
nativeBuildInputs = [autoreconfHook python3];
configureFlags = ["--enable-shared"];
outputs = ["bin" "out" "dev" "lib"];
meta = with lib; {
homepage = "https://udis86.sourceforge.net";
license = licenses.bsd2;
mainProgram = "udcli";
description = "Easy-to-use, minimalistic x86 disassembler library (libudis86)";
platforms = platforms.all;
};
}

View File

@@ -1,19 +1,25 @@
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#moreutils nixpkgs#jq -c bash
#!/usr/bin/env -S nix shell nixpkgs#jq -c bash
# get wlroots revision from submodule
SUB_REV=$(git submodule status | awk '{ print substr($1,2)}')
# and from lockfile
CRT_REV=$(jq < flake.lock '.nodes.wlroots.locked.rev' -r)
# Update inputs when the Mesa version is outdated. We don't want
# incompatibilities between the user's system and Hyprland.
if [ $SUB_REV != $CRT_REV ]; then
# update nixpkgs to latest version
nix flake lock --update-input nixpkgs
# get the current Nixpkgs revision
REV=$(jq <flake.lock '.nodes.nixpkgs.locked.rev' -r)
# check versions for current and remote nixpkgs' mesa
CRT_VER=$(nix eval --raw github:nixos/nixpkgs/"$REV"#mesa.version)
NEW_VER=$(nix eval --raw github:nixos/nixpkgs/nixos-unstable#mesa.version)
# update wlroots to submodule revision
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"
if [ "$CRT_VER" != "$NEW_VER" ]; then
echo "Updating Mesa $CRT_VER -> $NEW_VER and flake inputs"
# remove "dirty" mark from lockfile
jq < flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock
# keep wlroots rev, as we don't want to update it
WLR_REV=$(nix flake metadata --json | jq -r '.locks.nodes.wlroots.locked.rev')
# update inputs to latest versions
nix flake update
# hold back wlroots (nix/update-wlroots.nix handles updating that)
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$WLR_REV?host=gitlab.freedesktop.org"
else
echo "wlroots is up to date!"
echo "nixpkgs is up to date!"
fi

17
nix/update-wlroots.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#gnused nixpkgs#jq nixpkgs#ripgrep -c bash
# get wlroots revision from submodule
SUB_REV=$(git submodule status | rg wlroots | awk '{ print substr($1,2)}')
# and from lockfile
CRT_REV=$(jq <flake.lock '.nodes.wlroots.locked.rev' -r)
if [ "$SUB_REV" != "$CRT_REV" ]; then
echo "Updating wlroots..."
# update wlroots to submodule revision
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"
# fix revision in wlroots.wrap
sed -Ei "s/[a-z0-9]{40}/$SUB_REV/g" subprojects/wlroots.wrap
else
echo "wlroots is up to date!"
fi

164
nix/wlroots-hidpi.patch Normal file
View File

@@ -0,0 +1,164 @@
diff --git a/include/xwayland/xwm.h b/include/xwayland/xwm.h
index 3d540522..1c5a2e37 100644
--- a/include/xwayland/xwm.h
+++ b/include/xwayland/xwm.h
@@ -88,6 +88,7 @@ enum atom_name {
DND_ACTION_PRIVATE,
NET_CLIENT_LIST,
NET_CLIENT_LIST_STACKING,
+ XWAYLAND_GLOBAL_OUTPUT_SCALE,
ATOM_LAST // keep last
};
@@ -96,6 +97,7 @@ struct wlr_xwm {
struct wl_event_source *event_source;
struct wlr_seat *seat;
uint32_t ping_timeout;
+ uint32_t scale;
xcb_atom_t atoms[ATOM_LAST];
xcb_connection_t *xcb_conn;
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 5f857f24..21584ebd 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -19,6 +19,14 @@
#include <xcb/xfixes.h>
#include "xwayland/xwm.h"
+static int32_t scale(struct wlr_xwm *xwm, uint32_t val) {
+ return val * xwm->scale;
+}
+
+static int32_t unscale(struct wlr_xwm *xwm, uint32_t val) {
+ return (val + xwm->scale/2) / xwm->scale;
+}
+
static const char *const atom_map[ATOM_LAST] = {
[WL_SURFACE_ID] = "WL_SURFACE_ID",
[WL_SURFACE_SERIAL] = "WL_SURFACE_SERIAL",
@@ -90,6 +98,7 @@ static const char *const atom_map[ATOM_LAST] = {
[DND_ACTION_PRIVATE] = "XdndActionPrivate",
[NET_CLIENT_LIST] = "_NET_CLIENT_LIST",
[NET_CLIENT_LIST_STACKING] = "_NET_CLIENT_LIST_STACKING",
+ [XWAYLAND_GLOBAL_OUTPUT_SCALE] = "_XWAYLAND_GLOBAL_OUTPUT_SCALE",
};
#define STARTUP_INFO_REMOVE_PREFIX "remove: ID="
@@ -965,8 +974,8 @@ static void xwm_handle_create_notify(struct wlr_xwm *xwm,
return;
}
- xwayland_surface_create(xwm, ev->window, ev->x, ev->y,
- ev->width, ev->height, ev->override_redirect);
+ xwayland_surface_create(xwm, ev->window, unscale(xwm, ev->x), unscale(xwm, ev->y),
+ unscale(xwm, ev->width), unscale(xwm, ev->height), ev->override_redirect);
}
static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
@@ -997,10 +1006,10 @@ static void xwm_handle_configure_request(struct wlr_xwm *xwm,
struct wlr_xwayland_surface_configure_event wlr_event = {
.surface = surface,
- .x = mask & XCB_CONFIG_WINDOW_X ? ev->x : surface->x,
- .y = mask & XCB_CONFIG_WINDOW_Y ? ev->y : surface->y,
- .width = mask & XCB_CONFIG_WINDOW_WIDTH ? ev->width : surface->width,
- .height = mask & XCB_CONFIG_WINDOW_HEIGHT ? ev->height : surface->height,
+ .x = mask & XCB_CONFIG_WINDOW_X ? unscale(xwm, ev->x) : surface->x,
+ .y = mask & XCB_CONFIG_WINDOW_Y ? unscale(xwm, ev->y) : surface->y,
+ .width = mask & XCB_CONFIG_WINDOW_WIDTH ? unscale(xwm, ev->width) : surface->width,
+ .height = mask & XCB_CONFIG_WINDOW_HEIGHT ? unscale(xwm, ev->height) : surface->height,
.mask = mask,
};
@@ -1015,14 +1024,14 @@ static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
}
bool geometry_changed =
- (xsurface->x != ev->x || xsurface->y != ev->y ||
- xsurface->width != ev->width || xsurface->height != ev->height);
+ (xsurface->x != unscale(xwm, ev->x) || xsurface->y != unscale(xwm, ev->y) ||
+ xsurface->width != unscale(xwm, ev->width) || xsurface->height != unscale(xwm, ev->height));
if (geometry_changed) {
- xsurface->x = ev->x;
- xsurface->y = ev->y;
- xsurface->width = ev->width;
- xsurface->height = ev->height;
+ xsurface->x = unscale(xwm, ev->x);
+ xsurface->y = unscale(xwm, ev->y);
+ xsurface->width = unscale(xwm, ev->width);
+ xsurface->height = unscale(xwm, ev->height);
}
if (xsurface->override_redirect != ev->override_redirect) {
@@ -1133,6 +1142,20 @@ static void xwm_handle_property_notify(struct wlr_xwm *xwm,
xcb_property_notify_event_t *ev) {
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
if (xsurface == NULL) {
+ if (ev->atom == xwm->atoms[XWAYLAND_GLOBAL_OUTPUT_SCALE]) {
+ xcb_get_property_cookie_t cookie = xcb_get_property(xwm->xcb_conn, 0,
+ ev->window, ev->atom, XCB_ATOM_ANY, 0, 2048);
+ xcb_get_property_reply_t *reply = xcb_get_property_reply(xwm->xcb_conn,
+ cookie, NULL);
+ if (reply == NULL) {
+ return;
+ }
+ if (reply->type == XCB_ATOM_CARDINAL) {
+ xwm->scale = *(uint32_t*)xcb_get_property_value(reply);
+ }
+ free(reply);
+ }
+
return;
}
@@ -1760,16 +1783,17 @@ void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *xsurface,
int old_w = xsurface->width;
int old_h = xsurface->height;
+ struct wlr_xwm *xwm = xsurface->xwm;
+
xsurface->x = x;
xsurface->y = y;
xsurface->width = width;
xsurface->height = height;
- struct wlr_xwm *xwm = xsurface->xwm;
uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT |
XCB_CONFIG_WINDOW_BORDER_WIDTH;
- uint32_t values[] = {x, y, width, height, 0};
+ uint32_t values[] = {scale(xwm, x), scale(xwm, y), scale(xwm, width), scale(xwm, height), 0};
xcb_configure_window(xwm->xcb_conn, xsurface->window_id, mask, values);
// If the window size did not change, then we cannot rely on
@@ -1777,15 +1801,15 @@ void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *xsurface,
// we are supposed to send a synthetic event. See ICCCM part
// 4.1.5. But we ignore override-redirect windows as ICCCM does
// not apply to them.
- if (width == old_w && height == old_h && !xsurface->override_redirect) {
+ if (scale(xwm, width) == scale(xwm, old_w) && scale(xwm, height) == scale(xwm, old_h) && !xsurface->override_redirect) {
xcb_configure_notify_event_t configure_notify = {
.response_type = XCB_CONFIGURE_NOTIFY,
.event = xsurface->window_id,
.window = xsurface->window_id,
- .x = x,
- .y = y,
- .width = width,
- .height = height,
+ .x = scale(xwm, x),
+ .y = scale(xwm, y),
+ .width = scale(xwm, width),
+ .height = scale(xwm, height),
};
xcb_send_event(xwm->xcb_conn, 0, xsurface->window_id,
@@ -2122,6 +2146,7 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) {
wl_list_init(&xwm->pending_startup_ids);
xwm->ping_timeout = 10000;
+ xwm->scale = 1;
xwm->xcb_conn = xcb_connect_to_fd(wm_fd, NULL);
int rc = xcb_connection_has_error(xwm->xcb_conn);

76
nix/wlroots.nix Normal file
View File

@@ -0,0 +1,76 @@
{
version,
src,
#
wlroots,
xwayland,
fetchpatch,
lib,
hwdata,
libliftoff,
libdisplay-info,
hidpiXWayland ? true,
enableXWayland ? true,
nvidiaPatches ? false,
}:
assert (lib.assertMsg (hidpiXWayland -> enableXWayland) ''
wlroots-hyprland: cannot have hidpiXWayland when enableXWayland is false.
'');
(wlroots.overrideAttrs
(old: {
inherit version src;
pname =
old.pname
+ "-hyprland"
+ (
if hidpiXWayland
then "-hidpi"
else ""
)
+ (
if nvidiaPatches
then "-nvidia"
else ""
);
patches =
(old.patches or [])
++ (lib.optionals (enableXWayland && hidpiXWayland) [
# adapted from https://gitlab.freedesktop.org/lilydjwg/wlroots/-/commit/6c5ffcd1fee9e44780a6a8792f74ecfbe24a1ca7
./wlroots-hidpi.patch
(fetchpatch {
url = "https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/18595000f3a21502fd60bf213122859cc348f9af.diff";
sha256 = "sha256-jvfkAMh3gzkfuoRhB4E9T5X1Hu62wgUjj4tZkJm0mrI=";
revert = true;
})
])
++ (lib.optionals nvidiaPatches [
(fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-nvidia-format-workaround.patch?h=hyprland-nvidia-screenshare-git";
sha256 = "A9f1p5EW++mGCaNq8w7ZJfeWmvTfUm4iO+1KDcnqYX8=";
})
]);
postPatch =
(old.postPatch or "")
+ (
if nvidiaPatches
then ''
substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();"
''
else ""
);
buildInputs = old.buildInputs ++ [hwdata libliftoff libdisplay-info];
NIX_CFLAGS_COMPILE = toString [
"-Wno-error=maybe-uninitialized"
];
}))
.override {
xwayland = xwayland.overrideAttrs (old: {
patches =
(old.patches or [])
++ (lib.optionals hidpiXWayland [
./xwayland-vsync.patch
./xwayland-hidpi.patch
]);
});
}

493
nix/xwayland-hidpi.patch Normal file
View File

@@ -0,0 +1,493 @@
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index e3c1aaa50..eba29b5ba 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -164,6 +164,8 @@ xwl_cursor_attach_pixmap(struct xwl_seat *xwl_seat,
}
wl_surface_attach(xwl_cursor->surface, buffer, 0, 0);
+ wl_surface_set_buffer_scale(xwl_cursor->surface,
+ xwl_seat->xwl_screen->global_output_scale);
xwl_surface_damage(xwl_seat->xwl_screen, xwl_cursor->surface, 0, 0,
xwl_seat->x_cursor->bits->width,
xwl_seat->x_cursor->bits->height);
@@ -195,6 +197,7 @@ xwl_cursor_clear_frame_cb(struct xwl_cursor *xwl_cursor)
void
xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
{
+ struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
struct xwl_cursor *xwl_cursor = &xwl_seat->cursor;
PixmapPtr pixmap;
CursorPtr cursor;
@@ -225,8 +228,8 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
wl_pointer_set_cursor(xwl_seat->wl_pointer,
xwl_seat->pointer_enter_serial,
xwl_cursor->surface,
- xwl_seat->x_cursor->bits->xhot,
- xwl_seat->x_cursor->bits->yhot);
+ xwl_scale_to(xwl_screen, xwl_seat->x_cursor->bits->xhot),
+ xwl_scale_to(xwl_screen, xwl_seat->x_cursor->bits->yhot));
xwl_cursor_attach_pixmap(xwl_seat, xwl_cursor, pixmap);
}
@@ -235,6 +238,7 @@ void
xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *xwl_tablet_tool)
{
struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
+ struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
struct xwl_cursor *xwl_cursor = &xwl_tablet_tool->cursor;
PixmapPtr pixmap;
CursorPtr cursor;
@@ -263,8 +267,9 @@ xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *xwl_tablet_tool)
zwp_tablet_tool_v2_set_cursor(xwl_tablet_tool->tool,
xwl_tablet_tool->proximity_in_serial,
xwl_cursor->surface,
- xwl_seat->x_cursor->bits->xhot,
- xwl_seat->x_cursor->bits->yhot);
+ xwl_scale_to(xwl_screen, xwl_seat->x_cursor->bits->xhot),
+ xwl_scale_to(xwl_screen, xwl_seat->x_cursor->bits->yhot));
+ wl_surface_set_buffer_scale(xwl_cursor->surface, xwl_screen->global_output_scale);
xwl_cursor_attach_pixmap(xwl_seat, xwl_cursor, pixmap);
}
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 6e0600e4e..4a22ebff0 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -507,8 +507,8 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
DeviceIntPtr dev = get_pointer_device(xwl_seat);
DeviceIntPtr master;
int i;
- int sx = wl_fixed_to_int(sx_w);
- int sy = wl_fixed_to_int(sy_w);
+ int sx = wl_fixed_to_int(sx_w) * xwl_seat->xwl_screen->global_output_scale;
+ int sy = wl_fixed_to_int(sy_w) * xwl_seat->xwl_screen->global_output_scale;
int dx, dy;
ScreenPtr pScreen = xwl_seat->xwl_screen->screen;
ValuatorMask mask;
@@ -731,13 +731,14 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
{
struct xwl_seat *xwl_seat = data;
+ int32_t scale = xwl_seat->xwl_screen->global_output_scale;
if (!xwl_seat->focus_window)
return;
xwl_seat->pending_pointer_event.has_absolute = TRUE;
- xwl_seat->pending_pointer_event.x = sx_w;
- xwl_seat->pending_pointer_event.y = sy_w;
+ xwl_seat->pending_pointer_event.x = sx_w * scale;
+ xwl_seat->pending_pointer_event.y = sy_w * scale;
if (wl_proxy_get_version((struct wl_proxy *) xwl_seat->wl_pointer) < 5)
dispatch_pointer_motion_event(xwl_seat);
@@ -887,12 +888,13 @@ relative_pointer_handle_relative_motion(void *data,
wl_fixed_t dy_unaccelf)
{
struct xwl_seat *xwl_seat = data;
+ int32_t scale = xwl_seat->xwl_screen->global_output_scale;
xwl_seat->pending_pointer_event.has_relative = TRUE;
- xwl_seat->pending_pointer_event.dx = wl_fixed_to_double(dxf);
- xwl_seat->pending_pointer_event.dy = wl_fixed_to_double(dyf);
- xwl_seat->pending_pointer_event.dx_unaccel = wl_fixed_to_double(dx_unaccelf);
- xwl_seat->pending_pointer_event.dy_unaccel = wl_fixed_to_double(dy_unaccelf);
+ xwl_seat->pending_pointer_event.dx = wl_fixed_to_double(dxf) * scale;
+ xwl_seat->pending_pointer_event.dy = wl_fixed_to_double(dyf) * scale;
+ xwl_seat->pending_pointer_event.dx_unaccel = wl_fixed_to_double(dx_unaccelf) * scale;
+ xwl_seat->pending_pointer_event.dy_unaccel = wl_fixed_to_double(dy_unaccelf) * scale;
if (!xwl_seat->focus_window)
return;
@@ -1382,8 +1384,8 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
xwl_touch->window = wl_surface_get_user_data(surface);
xwl_touch->id = id;
- xwl_touch->x = wl_fixed_to_int(sx_w);
- xwl_touch->y = wl_fixed_to_int(sy_w);
+ xwl_touch->x = wl_fixed_to_int(sx_w) * xwl_seat->xwl_screen->global_output_scale;
+ xwl_touch->y = wl_fixed_to_int(sy_w) * xwl_seat->xwl_screen->global_output_scale;
xorg_list_add(&xwl_touch->link_touch, &xwl_seat->touches);
xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchBegin);
@@ -1419,8 +1421,8 @@ touch_handle_motion(void *data, struct wl_touch *wl_touch,
if (!xwl_touch)
return;
- xwl_touch->x = wl_fixed_to_int(sx_w);
- xwl_touch->y = wl_fixed_to_int(sy_w);
+ xwl_touch->x = wl_fixed_to_int(sx_w) * xwl_seat->xwl_screen->global_output_scale;
+ xwl_touch->y = wl_fixed_to_int(sy_w) * xwl_seat->xwl_screen->global_output_scale;
xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchUpdate);
}
@@ -2110,8 +2112,8 @@ tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *tool,
struct xwl_tablet_tool *xwl_tablet_tool = data;
struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
int32_t dx, dy;
- double sx = wl_fixed_to_double(x);
- double sy = wl_fixed_to_double(y);
+ double sx = wl_fixed_to_double(x) * xwl_seat->xwl_screen->global_output_scale;
+ double sy = wl_fixed_to_double(y) * xwl_seat->xwl_screen->global_output_scale;
if (!xwl_seat->tablet_focus_window)
return;
@@ -3152,6 +3154,7 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
int x,
int y)
{
+ struct xwl_screen *xwl_screen;
struct zwp_locked_pointer_v1 *locked_pointer =
warp_emulator->locked_pointer;
WindowPtr window;
@@ -3163,6 +3166,7 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
if (!warp_emulator->xwl_seat->focus_window)
return;
+ xwl_screen = warp_emulator->xwl_seat->xwl_screen;
window = warp_emulator->xwl_seat->focus_window->window;
if (x >= window->drawable.x ||
y >= window->drawable.y ||
@@ -3171,8 +3175,8 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
sx = x - window->drawable.x;
sy = y - window->drawable.y;
zwp_locked_pointer_v1_set_cursor_position_hint(locked_pointer,
- wl_fixed_from_int(sx),
- wl_fixed_from_int(sy));
+ wl_fixed_from_int(xwl_scale_to(xwl_screen, sx)),
+ wl_fixed_from_int(xwl_scale_to(xwl_screen, sy)));
wl_surface_commit(warp_emulator->xwl_seat->focus_window->surface);
}
}
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 661e1828d..6c60aba34 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -186,6 +186,9 @@ update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height)
static void
update_screen_size(struct xwl_screen *xwl_screen, int width, int height)
{
+ width *= xwl_screen->global_output_scale;
+ height *= xwl_screen->global_output_scale;
+
xwl_screen->width = width;
xwl_screen->height = height;
@@ -597,14 +600,15 @@ xwl_output_set_emulated_mode(struct xwl_output *xwl_output, ClientPtr client,
new_emulated_height);
}
-static void
-apply_output_change(struct xwl_output *xwl_output)
+void
+xwl_output_apply_changes(struct xwl_output *xwl_output)
{
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
struct xwl_output *it;
int mode_width, mode_height, count;
int width = 0, height = 0, has_this_output = 0;
RRModePtr *randr_modes;
+ int32_t scale = xwl_screen->global_output_scale;
/* Clear out the "done" received flags */
xwl_output->wl_output_done = FALSE;
@@ -623,10 +627,10 @@ apply_output_change(struct xwl_output *xwl_output)
}
if (xwl_output->randr_output) {
/* Build a fresh modes array using the current refresh rate */
- randr_modes = output_get_rr_modes(xwl_output, mode_width, mode_height, &count);
+ randr_modes = output_get_rr_modes(xwl_output, mode_width * scale, mode_height * scale, &count);
RROutputSetModes(xwl_output->randr_output, randr_modes, count, 1);
RRCrtcNotify(xwl_output->randr_crtc, randr_modes[0],
- xwl_output->x, xwl_output->y,
+ xwl_output->x * scale, xwl_output->y * scale,
xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
/* RROutputSetModes takes ownership of the passed in modes, so we only
* have to free the pointer array.
@@ -686,7 +690,7 @@ output_handle_done(void *data, struct wl_output *wl_output)
*/
if (xwl_output->xdg_output_done || !xwl_output->xdg_output ||
zxdg_output_v1_get_version(xwl_output->xdg_output) >= 3)
- apply_output_change(xwl_output);
+ xwl_output_apply_changes(xwl_output);
}
static void
@@ -746,7 +750,7 @@ xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output)
xwl_output->xdg_output_done = TRUE;
if (xwl_output->wl_output_done &&
zxdg_output_v1_get_version(xdg_output) < 3)
- apply_output_change(xwl_output);
+ xwl_output_apply_changes(xwl_output);
}
static void
@@ -857,6 +861,8 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id,
RRCrtcGammaSetSize(xwl_output->randr_crtc, 256);
RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1);
RROutputSetConnection(xwl_output->randr_output, RR_Connected);
+
+ xwl_output->scale = 1;
}
/* We want the output to be in the list as soon as created so we can
* use it when binding to the xdg-output protocol...
diff --git a/hw/xwayland/xwayland-output.h b/hw/xwayland/xwayland-output.h
index a95288e4f..46d1ead2a 100644
--- a/hw/xwayland/xwayland-output.h
+++ b/hw/xwayland/xwayland-output.h
@@ -53,7 +53,7 @@ struct xwl_output {
struct wl_output *output;
struct zxdg_output_v1 *xdg_output;
uint32_t server_output_id;
- int32_t x, y, width, height, refresh;
+ int32_t x, y, width, height, refresh, scale;
Rotation rotation;
Bool wl_output_done;
Bool xdg_output_done;
@@ -102,6 +102,8 @@ void xwl_output_set_emulated_mode(struct xwl_output *xwl_output,
void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
WindowPtr window);
+void xwl_output_apply_changes(struct xwl_output *xwl_output);
+
void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
#endif /* XWAYLAND_OUTPUT_H */
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 189e7cfd6..555434031 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -764,6 +764,8 @@ xwl_present_flip(WindowPtr present_window,
/* We can flip directly to the main surface (full screen window without clips) */
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
+ wl_surface_set_buffer_scale(xwl_window->surface,
+ xwl_window->xwl_screen->global_output_scale);
if (xorg_list_is_empty(&xwl_present_window->frame_callback_list)) {
xorg_list_add(&xwl_present_window->frame_callback_list,
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index 46ab4fed7..b2d7022e6 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -51,6 +51,7 @@
#include "xwayland-pixmap.h"
#include "xwayland-present.h"
#include "xwayland-shm.h"
+#include "xwayland-window-buffers.h"
#ifdef MITSHM
#include "shmint.h"
@@ -111,6 +112,12 @@ xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen)
return xwl_screen->rootless && xwl_screen_has_viewport_support(xwl_screen);
}
+int
+xwl_scale_to(struct xwl_screen *xwl_screen, int value)
+{
+ return value / (double)xwl_screen->global_output_scale + 0.5;
+}
+
/* Return the output @ 0x0, falling back to the first output in the list */
struct xwl_output *
xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
@@ -128,6 +135,38 @@ xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
return xorg_list_first_entry(&xwl_screen->output_list, struct xwl_output, link);
}
+static void
+xwl_screen_set_global_scale_from_property(struct xwl_screen *screen,
+ PropertyPtr prop)
+{
+ CARD32 *propdata;
+
+ if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) {
+ // TODO: handle warnings more cleanly.
+ LogMessageVerb(X_WARNING, 0, "Bad value for property %s.\n",
+ NameForAtom(prop->propertyName));
+ return;
+ }
+
+ propdata = prop->data;
+ xwl_screen_set_global_scale(screen, propdata[0]);
+}
+
+static void
+xwl_screen_update_property(struct xwl_screen *screen,
+ PropertyStateRec *propstate)
+{
+ switch (propstate->state) {
+ case PropertyNewValue:
+ xwl_screen_set_global_scale_from_property(screen, propstate->prop);
+ break;
+ case PropertyDelete:
+ xwl_screen_set_global_scale(screen, 1);
+ break;
+ }
+}
+
+
struct xwl_output *
xwl_screen_get_fixed_or_first_output(struct xwl_screen *xwl_screen)
{
@@ -144,19 +183,24 @@ xwl_property_callback(CallbackListPtr *pcbl, void *closure,
ScreenPtr screen = closure;
PropertyStateRec *rec = calldata;
struct xwl_screen *xwl_screen;
- struct xwl_window *xwl_window;
if (rec->win->drawable.pScreen != screen)
return;
- xwl_window = xwl_window_get(rec->win);
- if (!xwl_window)
- return;
-
xwl_screen = xwl_screen_get(screen);
- if (rec->prop->propertyName == xwl_screen->allow_commits_prop)
- xwl_window_update_property(xwl_window, rec);
+ if (rec->prop->propertyName == xwl_screen->allow_commits_prop) {
+ struct xwl_window *xwl_window;
+
+ xwl_window = xwl_window_get(rec->win);
+ if (!xwl_window)
+ return;
+
+ xwl_window_update_property(xwl_window, rec);
+ }
+ else if (rec->prop->propertyName == xwl_screen->global_output_scale_prop) {
+ xwl_screen_update_property(xwl_screen, rec);
+ }
}
static void
@@ -638,8 +682,14 @@ void xwl_surface_damage(struct xwl_screen *xwl_screen,
{
if (wl_surface_get_version(surface) >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
wl_surface_damage_buffer(surface, x, y, width, height);
- else
+ else {
+ x = xwl_scale_to(xwl_screen, x);
+ y = xwl_scale_to(xwl_screen, y);
+ width = xwl_scale_to(xwl_screen, width);
+ height = xwl_scale_to(xwl_screen, height);
+
wl_surface_damage(surface, x, y, width, height);
+ }
}
void
@@ -655,6 +705,30 @@ xwl_screen_roundtrip(struct xwl_screen *xwl_screen)
xwl_give_up("could not connect to wayland server\n");
}
+void
+xwl_screen_set_global_scale(struct xwl_screen *xwl_screen, int32_t scale)
+{
+ struct xwl_output *it;
+ struct xwl_window *xwl_window;
+
+ xwl_screen->global_output_scale = scale;
+
+ /* change randr resolutions and positions */
+ xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
+ xwl_output_apply_changes(it);
+ }
+
+ if (!xwl_screen->rootless && xwl_screen->screen->root) {
+ /* Clear all the buffers, so that they'll be remade with the new sizes
+ * (this doesn't occur automatically because as far as Xorg is
+ * concerned, the window's size is the same) */
+ xorg_list_for_each_entry(xwl_window, &xwl_screen->window_list, link_window) {
+ xwl_window_buffers_recycle(xwl_window);
+ }
+ }
+}
+
+
static int
xwl_server_grab(ClientPtr client)
{
@@ -712,6 +786,7 @@ Bool
xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
{
static const char allow_commits[] = "_XWAYLAND_ALLOW_COMMITS";
+ static const char global_output_scale[] = "_XWAYLAND_GLOBAL_OUTPUT_SCALE";
struct xwl_screen *xwl_screen;
Pixel red_mask, blue_mask, green_mask;
int ret, bpc, green_bpc, i;
@@ -746,6 +821,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
#ifdef XWL_HAS_GLAMOR
xwl_screen->glamor = 1;
#endif
+ xwl_screen->global_output_scale = 1;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-rootless") == 0) {
@@ -988,6 +1064,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
if (xwl_screen->allow_commits_prop == BAD_RESOURCE)
return FALSE;
+ xwl_screen->global_output_scale_prop = MakeAtom(global_output_scale,
+ strlen(global_output_scale),
+ TRUE);
+ if (xwl_screen->global_output_scale_prop == BAD_RESOURCE)
+ return FALSE;
+
+
AddCallback(&PropertyStateCallback, xwl_property_callback, pScreen);
AddCallback(&RootWindowFinalizeCallback, xwl_root_window_finalized_callback, pScreen);
diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h
index fadd0526e..2ce6ce5ab 100644
--- a/hw/xwayland/xwayland-screen.h
+++ b/hw/xwayland/xwayland-screen.h
@@ -87,6 +87,7 @@ struct xwl_screen {
struct xorg_list damage_window_list;
struct xorg_list window_list;
+ int32_t global_output_scale;
int wayland_fd;
struct wl_display *display;
struct wl_registry *registry;
@@ -134,6 +135,7 @@ struct xwl_screen {
struct glamor_context *glamor_ctx;
Atom allow_commits_prop;
+ Atom global_output_scale_prop;
/* The preferred GLVND vendor. If NULL, "mesa" is assumed. */
const char *glvnd_vendor;
@@ -166,6 +168,8 @@ void xwl_screen_roundtrip (struct xwl_screen *xwl_screen);
void xwl_surface_damage(struct xwl_screen *xwl_screen,
struct wl_surface *surface,
int32_t x, int32_t y, int32_t width, int32_t height);
+int xwl_scale_to(struct xwl_screen *xwl_screen, int value);
+void xwl_screen_set_global_scale(struct xwl_screen *xwl_screen, int32_t scale);
int xwl_screen_get_next_output_serial(struct xwl_screen * xwl_screen);
#endif /* XWAYLAND_SCREEN_H */
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 6b7f38605..2f1e0dee1 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -788,7 +788,8 @@ xwl_create_root_surface(struct xwl_window *xwl_window)
}
wl_region_add(region, 0, 0,
- window->drawable.width, window->drawable.height);
+ xwl_scale_to(xwl_screen, window->drawable.width),
+ xwl_scale_to(xwl_screen, window->drawable.height));
wl_surface_set_opaque_region(xwl_window->surface, region);
wl_region_destroy(region);
@@ -1322,6 +1323,7 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
#endif
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
+ wl_surface_set_buffer_scale(xwl_window->surface, xwl_screen->global_output_scale);
/* Arbitrary limit to try to avoid flooding the Wayland
* connection. If we flood it too much anyway, this could

12
nix/xwayland-vsync.patch Normal file
View File

@@ -0,0 +1,12 @@
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -824,7 +824,8 @@
dixDestroyPixmap(vblank->pixmap, vblank->pixmap->drawable.id);
vblank->pixmap = NULL;
- if (xwl_present_queue_vblank(screen, window, vblank->crtc,
+ if (vblank->target_msc > crtc_msc &&
+ xwl_present_queue_vblank(screen, window, vblank->crtc,
vblank->event_id, crtc_msc + 1)
== Success)
return;

3
props.json Normal file
View File

@@ -0,0 +1,3 @@
{
"version": "0.27.0"
}

View File

@@ -3,7 +3,14 @@ wayland_protos = dependency('wayland-protocols',
fallback: 'wayland-protocols',
default_options: ['tests=false'],
)
hyprland_protos = dependency('hyprland-protocols',
version: '>=0.2',
fallback: 'hyprland-protocols',
)
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
hl_protocol_dir = hyprland_protos.get_variable('pkgdatadir')
wayland_scanner_dep = dependency('wayland-scanner', native: true)
wayland_scanner = find_program(
@@ -13,11 +20,20 @@ wayland_scanner = find_program(
protocols = [
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml'],
['wlr-foreign-toplevel-management-unstable-v1.xml'],
['wlr-layer-shell-unstable-v1.xml'],
['wlr-output-power-management-unstable-v1.xml'],
['wlr-screencopy-unstable-v1.xml'],
['ext-workspace-unstable-v1.xml'],
['pointer-constraints-unstable-v1.xml'],
['tablet-unstable-v2.xml'],
['idle.xml']
['idle.xml'],
[hl_protocol_dir, 'protocols/hyprland-toplevel-export-v1.xml'],
[hl_protocol_dir, 'protocols/hyprland-global-shortcuts-v1.xml']
]
wl_protos_src = []
wl_protos_headers = []
@@ -32,6 +48,8 @@ foreach p : protocols
wl_protos_headers += custom_target(
xml.underscorify() + '_server_h',
input: xml,
install: true,
install_dir: join_paths(get_option('includedir'), 'hyprland/protocols'),
output: '@BASENAME@-protocol.h',
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
)

View File

@@ -0,0 +1,270 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_foreign_toplevel_management_unstable_v1">
<copyright>
Copyright © 2018 Ilia Bozhinov
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that copyright notice and this permission
notice appear in supporting documentation, and that the name of
the copyright holders not be used in advertising or publicity
pertaining to distribution of the software without specific,
written prior permission. The copyright holders make no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied
warranty.
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
</copyright>
<interface name="zwlr_foreign_toplevel_manager_v1" version="3">
<description summary="list and control opened apps">
The purpose of this protocol is to enable the creation of taskbars
and docks by providing them with a list of opened applications and
letting them request certain actions on them, like maximizing, etc.
After a client binds the zwlr_foreign_toplevel_manager_v1, each opened
toplevel window will be sent via the toplevel event
</description>
<event name="toplevel">
<description summary="a toplevel has been created">
This event is emitted whenever a new toplevel window is created. It
is emitted for all toplevels, regardless of the app that has created
them.
All initial details of the toplevel(title, app_id, states, etc.) will
be sent immediately after this event via the corresponding events in
zwlr_foreign_toplevel_handle_v1.
</description>
<arg name="toplevel" type="new_id" interface="zwlr_foreign_toplevel_handle_v1"/>
</event>
<request name="stop">
<description summary="stop sending events">
Indicates the client no longer wishes to receive events for new toplevels.
However the compositor may emit further toplevel_created events, until
the finished event is emitted.
The client must not send any more requests after this one.
</description>
</request>
<event name="finished" type="destructor">
<description summary="the compositor has finished with the toplevel manager">
This event indicates that the compositor is done sending events to the
zwlr_foreign_toplevel_manager_v1. The server will destroy the object
immediately after sending this request, so it will become invalid and
the client should free any resources associated with it.
</description>
</event>
</interface>
<interface name="zwlr_foreign_toplevel_handle_v1" version="3">
<description summary="an opened toplevel">
A zwlr_foreign_toplevel_handle_v1 object represents an opened toplevel
window. Each app may have multiple opened toplevels.
Each toplevel has a list of outputs it is visible on, conveyed to the
client with the output_enter and output_leave events.
</description>
<event name="title">
<description summary="title change">
This event is emitted whenever the title of the toplevel changes.
</description>
<arg name="title" type="string"/>
</event>
<event name="app_id">
<description summary="app-id change">
This event is emitted whenever the app-id of the toplevel changes.
</description>
<arg name="app_id" type="string"/>
</event>
<event name="output_enter">
<description summary="toplevel entered an output">
This event is emitted whenever the toplevel becomes visible on
the given output. A toplevel may be visible on multiple outputs.
</description>
<arg name="output" type="object" interface="wl_output"/>
</event>
<event name="output_leave">
<description summary="toplevel left an output">
This event is emitted whenever the toplevel stops being visible on
the given output. It is guaranteed that an entered-output event
with the same output has been emitted before this event.
</description>
<arg name="output" type="object" interface="wl_output"/>
</event>
<request name="set_maximized">
<description summary="requests that the toplevel be maximized">
Requests that the toplevel be maximized. If the maximized state actually
changes, this will be indicated by the state event.
</description>
</request>
<request name="unset_maximized">
<description summary="requests that the toplevel be unmaximized">
Requests that the toplevel be unmaximized. If the maximized state actually
changes, this will be indicated by the state event.
</description>
</request>
<request name="set_minimized">
<description summary="requests that the toplevel be minimized">
Requests that the toplevel be minimized. If the minimized state actually
changes, this will be indicated by the state event.
</description>
</request>
<request name="unset_minimized">
<description summary="requests that the toplevel be unminimized">
Requests that the toplevel be unminimized. If the minimized state actually
changes, this will be indicated by the state event.
</description>
</request>
<request name="activate">
<description summary="activate the toplevel">
Request that this toplevel be activated on the given seat.
There is no guarantee the toplevel will be actually activated.
</description>
<arg name="seat" type="object" interface="wl_seat"/>
</request>
<enum name="state">
<description summary="types of states on the toplevel">
The different states that a toplevel can have. These have the same meaning
as the states with the same names defined in xdg-toplevel
</description>
<entry name="maximized" value="0" summary="the toplevel is maximized"/>
<entry name="minimized" value="1" summary="the toplevel is minimized"/>
<entry name="activated" value="2" summary="the toplevel is active"/>
<entry name="fullscreen" value="3" summary="the toplevel is fullscreen" since="2"/>
</enum>
<event name="state">
<description summary="the toplevel state changed">
This event is emitted immediately after the zlw_foreign_toplevel_handle_v1
is created and each time the toplevel state changes, either because of a
compositor action or because of a request in this protocol.
</description>
<arg name="state" type="array"/>
</event>
<event name="done">
<description summary="all information about the toplevel has been sent">
This event is sent after all changes in the toplevel state have been
sent.
This allows changes to the zwlr_foreign_toplevel_handle_v1 properties
to be seen as atomic, even if they happen via multiple events.
</description>
</event>
<request name="close">
<description summary="request that the toplevel be closed">
Send a request to the toplevel to close itself. The compositor would
typically use a shell-specific method to carry out this request, for
example by sending the xdg_toplevel.close event. However, this gives
no guarantees the toplevel will actually be destroyed. If and when
this happens, the zwlr_foreign_toplevel_handle_v1.closed event will
be emitted.
</description>
</request>
<request name="set_rectangle">
<description summary="the rectangle which represents the toplevel">
The rectangle of the surface specified in this request corresponds to
the place where the app using this protocol represents the given toplevel.
It can be used by the compositor as a hint for some operations, e.g
minimizing. The client is however not required to set this, in which
case the compositor is free to decide some default value.
If the client specifies more than one rectangle, only the last one is
considered.
The dimensions are given in surface-local coordinates.
Setting width=height=0 removes the already-set rectangle.
</description>
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="x" type="int"/>
<arg name="y" type="int"/>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
</request>
<enum name="error">
<entry name="invalid_rectangle" value="0"
summary="the provided rectangle is invalid"/>
</enum>
<event name="closed">
<description summary="this toplevel has been destroyed">
This event means the toplevel has been destroyed. It is guaranteed there
won't be any more events for this zwlr_foreign_toplevel_handle_v1. The
toplevel itself becomes inert so any requests will be ignored except the
destroy request.
</description>
</event>
<request name="destroy" type="destructor">
<description summary="destroy the zwlr_foreign_toplevel_handle_v1 object">
Destroys the zwlr_foreign_toplevel_handle_v1 object.
This request should be called either when the client does not want to
use the toplevel anymore or after the closed event to finalize the
destruction of the object.
</description>
</request>
<!-- Version 2 additions -->
<request name="set_fullscreen" since="2">
<description summary="request that the toplevel be fullscreened">
Requests that the toplevel be fullscreened on the given output. If the
fullscreen state and/or the outputs the toplevel is visible on actually
change, this will be indicated by the state and output_enter/leave
events.
The output parameter is only a hint to the compositor. Also, if output
is NULL, the compositor should decide which output the toplevel will be
fullscreened on, if at all.
</description>
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
</request>
<request name="unset_fullscreen" since="2">
<description summary="request that the toplevel be unfullscreened">
Requests that the toplevel be unfullscreened. If the fullscreen state
actually changes, this will be indicated by the state event.
</description>
</request>
<!-- Version 3 additions -->
<event name="parent" since="3">
<description summary="parent change">
This event is emitted whenever the parent of the toplevel changes.
No event is emitted when the parent handle is destroyed by the client.
</description>
<arg name="parent" type="object" interface="zwlr_foreign_toplevel_handle_v1" allow-null="true"/>
</event>
</interface>
</protocol>

View File

@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_output_power_management_unstable_v1">
<copyright>
Copyright © 2019 Purism SPC
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<description summary="Control power management modes of outputs">
This protocol allows clients to control power management modes
of outputs that are currently part of the compositor space. The
intent is to allow special clients like desktop shells to power
down outputs when the system is idle.
To modify outputs not currently part of the compositor space see
wlr-output-management.
Warning! The protocol described in this file is experimental and
backward incompatible changes may be made. Backward compatible changes
may be added together with the corresponding interface version bump.
Backward incompatible changes are done by bumping the version number in
the protocol and interface names and resetting the interface version.
Once the protocol is to be declared stable, the 'z' prefix and the
version number in the protocol and interface names are removed and the
interface version number is reset.
</description>
<interface name="zwlr_output_power_manager_v1" version="1">
<description summary="manager to create per-output power management">
This interface is a manager that allows creating per-output power
management mode controls.
</description>
<request name="get_output_power">
<description summary="get a power management for an output">
Create a output power management mode control that can be used to
adjust the power management mode for a given output.
</description>
<arg name="id" type="new_id" interface="zwlr_output_power_v1"/>
<arg name="output" type="object" interface="wl_output"/>
</request>
<request name="destroy" type="destructor">
<description summary="destroy the manager">
All objects created by the manager will still remain valid, until their
appropriate destroy request has been called.
</description>
</request>
</interface>
<interface name="zwlr_output_power_v1" version="1">
<description summary="adjust power management mode for an output">
This object offers requests to set the power management mode of
an output.
</description>
<enum name="mode">
<entry name="off" value="0"
summary="Output is turned off."/>
<entry name="on" value="1"
summary="Output is turned on, no power saving"/>
</enum>
<enum name="error">
<entry name="invalid_mode" value="1" summary="inexistent power save mode"/>
</enum>
<request name="set_mode">
<description summary="Set an outputs power save mode">
Set an output's power save mode to the given mode. The mode change
is effective immediately. If the output does not support the given
mode a failed event is sent.
</description>
<arg name="mode" type="uint" enum="mode" summary="the power save mode to set"/>
</request>
<event name="mode">
<description summary="Report a power management mode change">
Report the power management mode change of an output.
The mode event is sent after an output changed its power
management mode. The reason can be a client using set_mode or the
compositor deciding to change an output's mode.
This event is also sent immediately when the object is created
so the client is informed about the current power management mode.
</description>
<arg name="mode" type="uint" enum="mode"
summary="the output's new power management mode"/>
</event>
<event name="failed">
<description summary="object no longer valid">
This event indicates that the output power management mode control
is no longer valid. This can happen for a number of reasons,
including:
- The output doesn't support power management
- Another client already has exclusive power management mode control
for this output
- The output disappeared
Upon receiving this event, the client should destroy this object.
</description>
</event>
<request name="destroy" type="destructor">
<description summary="destroy this power management">
Destroys the output power management mode control object.
</description>
</request>
</interface>
</protocol>

File diff suppressed because it is too large Load Diff

View File

@@ -15,153 +15,212 @@
#include "managers/KeybindManager.hpp"
#include "managers/AnimationManager.hpp"
#include "managers/EventManager.hpp"
#include "managers/ProtocolManager.hpp"
#include "managers/SessionLockManager.hpp"
#include "managers/HookSystemManager.hpp"
#include "debug/HyprDebugOverlay.hpp"
#include "debug/HyprNotificationOverlay.hpp"
#include "helpers/Monitor.hpp"
#include "helpers/Workspace.hpp"
#include "Window.hpp"
#include "render/Renderer.hpp"
#include "render/OpenGL.hpp"
#include "hyprerror/HyprError.hpp"
#include "plugins/PluginSystem.hpp"
enum eManagersInitStage {
STAGE_PRIORITY = 0,
STAGE_LATE
};
class CCompositor {
public:
public:
CCompositor();
~CCompositor();
// ------------------ WLR BASICS ------------------ //
wl_display* m_sWLDisplay;
wlr_backend* m_sWLRBackend;
wlr_renderer* m_sWLRRenderer;
wlr_allocator* m_sWLRAllocator;
wlr_compositor* m_sWLRCompositor;
wlr_subcompositor* m_sWLRSubCompositor;
wlr_data_device_manager* m_sWLRDataDevMgr;
wlr_xdg_activation_v1* m_sWLRXDGActivation;
wlr_output_layout* m_sWLROutputLayout;
wlr_idle* m_sWLRIdle;
wlr_layer_shell_v1* m_sWLRLayerShell;
wlr_xdg_shell* m_sWLRXDGShell;
wlr_cursor* m_sWLRCursor;
wlr_xcursor_manager* m_sWLRXCursorMgr;
wlr_virtual_keyboard_manager_v1* m_sWLRVKeyboardMgr;
wlr_output_manager_v1* m_sWLROutputMgr;
wlr_presentation* m_sWLRPresentation;
wlr_scene* m_sWLRScene;
wlr_input_inhibit_manager* m_sWLRInhibitMgr;
wl_display* m_sWLDisplay;
wl_event_loop* m_sWLEventLoop;
wlr_backend* m_sWLRBackend;
wlr_session* m_sWLRSession;
wlr_renderer* m_sWLRRenderer;
wlr_allocator* m_sWLRAllocator;
wlr_compositor* m_sWLRCompositor;
wlr_subcompositor* m_sWLRSubCompositor;
wlr_data_device_manager* m_sWLRDataDevMgr;
wlr_drm* m_sWRLDRM;
wlr_drm_lease_v1_manager* m_sWRLDRMLeaseMgr;
wlr_xdg_activation_v1* m_sWLRXDGActivation;
wlr_output_layout* m_sWLROutputLayout;
wlr_idle* m_sWLRIdle;
wlr_layer_shell_v1* m_sWLRLayerShell;
wlr_xdg_shell* m_sWLRXDGShell;
wlr_cursor* m_sWLRCursor;
wlr_xcursor_manager* m_sWLRXCursorMgr;
wlr_virtual_keyboard_manager_v1* m_sWLRVKeyboardMgr;
wlr_output_manager_v1* m_sWLROutputMgr;
wlr_xdg_output_manager_v1* m_sWLRXDGOutputMgr;
wlr_presentation* m_sWLRPresentation;
wlr_scene* m_sWLRScene;
wlr_input_inhibit_manager* m_sWLRInhibitMgr;
wlr_keyboard_shortcuts_inhibit_manager_v1* m_sWLRKbShInhibitMgr;
wlr_egl* m_sWLREGL;
int m_iDRMFD;
wlr_ext_workspace_manager_v1* m_sWLREXTWorkspaceMgr;
wlr_linux_dmabuf_v1* m_sWLRDmabuf;
wlr_pointer_constraints_v1* m_sWLRPointerConstraints;
wlr_relative_pointer_manager_v1* m_sWLRRelPointerMgr;
wlr_server_decoration_manager* m_sWLRServerDecoMgr;
wlr_xdg_decoration_manager_v1* m_sWLRXDGDecoMgr;
wlr_virtual_pointer_manager_v1* m_sWLRVirtPtrMgr;
wlr_foreign_toplevel_manager_v1* m_sWLRToplevelMgr;
wlr_tablet_manager_v2* m_sWLRTabletManager;
wlr_xdg_foreign_registry* m_sWLRForeignRegistry;
wlr_idle_inhibit_manager_v1* m_sWLRIdleInhibitMgr;
wlr_pointer_gestures_v1* m_sWLRPointerGestures;
wlr_egl* m_sWLREGL;
int m_iDRMFD;
wlr_ext_workspace_manager_v1* m_sWLREXTWorkspaceMgr;
wlr_pointer_constraints_v1* m_sWLRPointerConstraints;
wlr_relative_pointer_manager_v1* m_sWLRRelPointerMgr;
wlr_server_decoration_manager* m_sWLRServerDecoMgr;
wlr_xdg_decoration_manager_v1* m_sWLRXDGDecoMgr;
wlr_virtual_pointer_manager_v1* m_sWLRVirtPtrMgr;
wlr_foreign_toplevel_manager_v1* m_sWLRToplevelMgr;
wlr_tablet_manager_v2* m_sWLRTabletManager;
wlr_xdg_foreign_registry* m_sWLRForeignRegistry;
wlr_idle_inhibit_manager_v1* m_sWLRIdleInhibitMgr;
wlr_pointer_gestures_v1* m_sWLRPointerGestures;
wlr_output_power_manager_v1* m_sWLROutputPowerMgr;
wlr_input_method_manager_v2* m_sWLRIMEMgr;
wlr_text_input_manager_v3* m_sWLRTextInputMgr;
wlr_xdg_activation_v1* m_sWLRActivation;
wlr_linux_dmabuf_v1* m_sWLRLinuxDMABuf;
wlr_backend* m_sWLRHeadlessBackend;
wlr_session_lock_manager_v1* m_sWLRSessionLockMgr;
wlr_gamma_control_manager_v1* m_sWLRGammaCtrlMgr;
// ------------------------------------------------- //
std::string m_szWLDisplaySocket = "";
std::string m_szInstanceSignature = "";
std::string m_szCurrentSplash = "error";
const char* m_szWLDisplaySocket;
std::string m_szInstanceSignature = "";
std::string m_szCurrentSplash = "error";
std::vector<std::shared_ptr<CMonitor>> m_vMonitors;
std::vector<std::shared_ptr<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
std::vector<std::unique_ptr<CWindow>> m_vWindows;
std::vector<std::unique_ptr<SXDGPopup>> m_vXDGPopups;
std::vector<std::unique_ptr<CWorkspace>> m_vWorkspaces;
std::vector<std::unique_ptr<SSubsurface>> m_vSubsurfaces;
std::vector<CWindow*> m_vWindowsFadingOut;
std::vector<SLayerSurface*> m_vSurfacesFadingOut;
std::vector<std::unique_ptr<SMonitor>> m_vMonitors;
std::vector<std::unique_ptr<CWindow>> m_vWindows;
std::deque<std::unique_ptr<CWindow>> m_dUnmanagedX11Windows;
std::vector<std::unique_ptr<SXDGPopup>> m_vXDGPopups;
std::vector<std::unique_ptr<CWorkspace>> m_vWorkspaces;
std::vector<std::unique_ptr<SSubsurface>> m_vSubsurfaces;
std::vector<CWindow*> m_vWindowsFadingOut;
std::vector<SLayerSurface*> m_vSurfacesFadingOut;
std::unordered_map<std::string, int64_t> m_mMonitorIDMap;
void startCompositor();
void cleanupExit();
void initServer();
void startCompositor();
void cleanup();
wlr_surface* m_pLastFocus = nullptr;
CWindow* m_pLastWindow = nullptr;
SMonitor* m_pLastMonitor = nullptr;
SSeat m_sSeat;
wlr_surface* m_pLastFocus = nullptr;
CWindow* m_pLastWindow = nullptr;
CMonitor* m_pLastMonitor = nullptr;
bool m_bReadyToProcess = false;
std::vector<CWindow*> m_vWindowFocusHistory; // first element is the most recently focused.
SSeat m_sSeat;
bool m_bReadyToProcess = false;
bool m_bSessionActive = true;
bool m_bDPMSStateON = true;
bool m_bUnsafeState = false; // unsafe state is when there is no monitors.
bool m_bIsShuttingDown = false;
// ------------------------------------------------- //
SMonitor* getMonitorFromID(const int&);
SMonitor* getMonitorFromName(const std::string&);
SMonitor* getMonitorFromCursor();
SMonitor* getMonitorFromVector(const Vector2D&);
void removeWindowFromVectorSafe(CWindow*);
void focusWindow(CWindow*, wlr_surface* pSurface = nullptr);
void focusSurface(wlr_surface*, CWindow* pWindowOwner = nullptr);
bool windowExists(CWindow*);
bool windowValidMapped(CWindow*);
CWindow* vectorToWindow(const Vector2D&);
CWindow* vectorToWindowIdeal(const Vector2D&); // used only for finding a window to focus on, basically a "findFocusableWindow"
CWindow* vectorToWindowTiled(const Vector2D&);
wlr_surface* vectorToLayerSurface(const Vector2D&, std::list<SLayerSurface*>*, Vector2D*, SLayerSurface**);
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
CWindow* windowFromCursor();
CWindow* windowFloatingFromCursor();
SMonitor* getMonitorFromOutput(wlr_output*);
CWindow* getWindowForPopup(wlr_xdg_popup*);
CWindow* getWindowFromSurface(wlr_surface*);
bool isWorkspaceVisible(const int&);
CWorkspace* getWorkspaceByID(const int&);
CWorkspace* getWorkspaceByName(const std::string&);
CWorkspace* getWorkspaceByString(const std::string&);
void sanityCheckWorkspaces();
void updateWorkspaceWindowDecos(const int&);
int getWindowsOnWorkspace(const int&);
CWindow* getFirstWindowOnWorkspace(const int&);
void fixXWaylandWindowsOnWorkspace(const int&);
CWindow* getFullscreenWindowOnWorkspace(const int&);
bool doesSeatAcceptInput(wlr_surface*);
bool isWindowActive(CWindow*);
void moveWindowToTop(CWindow*);
void cleanupFadingOut();
CWindow* getWindowInDirection(CWindow*, char);
void deactivateAllWLRWorkspaces(wlr_ext_workspace_handle_v1* exclude = nullptr);
CWindow* getNextWindowOnWorkspace(CWindow*);
CWindow* getPrevWindowOnWorkspace(CWindow*);
int getNextAvailableNamedWorkspace();
bool isPointOnAnyMonitor(const Vector2D&);
CWindow* getConstraintWindow(SMouse*);
SMonitor* getMonitorInDirection(const char&);
void updateAllWindowsAnimatedDecorationValues();
void updateWindowAnimatedDecorationValues(CWindow*);
void moveWindowToWorkspace(CWindow*, const std::string&);
int getNextAvailableMonitorID();
void moveWorkspaceToMonitor(CWorkspace*, SMonitor*);
bool workspaceIDOutOfBounds(const int&);
void setWindowFullscreen(CWindow*, bool, eFullscreenMode);
void moveUnmanagedX11ToWindows(CWindow*);
CWindow* getX11Parent(CWindow*);
CMonitor* getMonitorFromID(const int&);
CMonitor* getMonitorFromName(const std::string&);
CMonitor* getMonitorFromDesc(const std::string&);
CMonitor* getMonitorFromCursor();
CMonitor* getMonitorFromVector(const Vector2D&);
void removeWindowFromVectorSafe(CWindow*);
void focusWindow(CWindow*, wlr_surface* pSurface = nullptr);
void focusSurface(wlr_surface*, CWindow* pWindowOwner = nullptr);
bool windowExists(CWindow*);
bool windowValidMapped(CWindow*);
CWindow* vectorToWindow(const Vector2D&);
CWindow* vectorToWindowIdeal(const Vector2D&); // used only for finding a window to focus on, basically a "findFocusableWindow"
CWindow* vectorToWindowTiled(const Vector2D&);
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
CWindow* windowFromCursor();
CWindow* windowFloatingFromCursor();
CMonitor* getMonitorFromOutput(wlr_output*);
CWindow* getWindowForPopup(wlr_xdg_popup*);
CWindow* getWindowFromSurface(wlr_surface*);
CWindow* getWindowFromHandle(uint32_t);
CWindow* getWindowFromZWLRHandle(wl_resource*);
bool isWorkspaceVisible(const int&);
CWorkspace* getWorkspaceByID(const int&);
CWorkspace* getWorkspaceByName(const std::string&);
CWorkspace* getWorkspaceByString(const std::string&);
CWorkspace* getWorkspaceByWorkspaceHandle(const wlr_ext_workspace_handle_v1*);
void sanityCheckWorkspaces();
void updateWorkspaceWindowDecos(const int&);
int getWindowsOnWorkspace(const int&);
CWindow* getUrgentWindow();
bool hasUrgentWindowOnWorkspace(const int&);
CWindow* getFirstWindowOnWorkspace(const int&);
CWindow* getFullscreenWindowOnWorkspace(const int&);
bool doesSeatAcceptInput(wlr_surface*);
bool isWindowActive(CWindow*);
void moveWindowToTop(CWindow*);
void cleanupFadingOut(const int& monid);
CWindow* getWindowInDirection(CWindow*, char);
void deactivateAllWLRWorkspaces(wlr_ext_workspace_handle_v1* exclude = nullptr);
CWindow* getNextWindowOnWorkspace(CWindow*, bool focusableOnly = false);
CWindow* getPrevWindowOnWorkspace(CWindow*, bool focusableOnly = false);
int getNextAvailableNamedWorkspace();
bool isPointOnAnyMonitor(const Vector2D&);
CWindow* getConstraintWindow(SMouse*);
CMonitor* getMonitorInDirection(const char&);
void updateAllWindowsAnimatedDecorationValues();
void updateWindowAnimatedDecorationValues(CWindow*);
int getNextAvailableMonitorID(std::string const & name);
void moveWorkspaceToMonitor(CWorkspace*, CMonitor*);
void swapActiveWorkspaces(CMonitor*, CMonitor*);
CMonitor* getMonitorFromString(const std::string&);
bool workspaceIDOutOfBounds(const int64_t&);
void setWindowFullscreen(CWindow*, bool, eFullscreenMode);
void updateFullscreenFadeOnWorkspace(CWorkspace*);
CWindow* getX11Parent(CWindow*);
void scheduleFrameForMonitor(CMonitor*);
void addToFadingOutSafe(SLayerSurface*);
void addToFadingOutSafe(CWindow*);
CWindow* getWindowByRegex(const std::string&);
void warpCursorTo(const Vector2D&, bool force = false);
SLayerSurface* getLayerSurfaceFromWlr(wlr_layer_surface_v1*);
SLayerSurface* getLayerSurfaceFromSurface(wlr_surface*);
void closeWindow(CWindow*);
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
void forceReportSizesToWindowsOnWorkspace(const int&);
bool cursorOnReservedArea();
CWorkspace* createNewWorkspace(const int&, const int&, const std::string& name = ""); // will be deleted next frame if left empty and unfocused!
void renameWorkspace(const int&, const std::string& name = "");
void setActiveMonitor(CMonitor*);
bool isWorkspaceSpecial(const int&);
int getNewSpecialID();
void performUserChecks();
void moveWindowToWorkspaceSafe(CWindow* pWindow, CWorkspace* pWorkspace);
CWindow* getForceFocus();
private:
void initAllSignals();
void setRandomSplash();
std::string explicitConfigPath;
private:
void initAllSignals();
void setRandomSplash();
void initManagers(eManagersInitStage stage);
uint64_t m_iHyprlandPID = 0;
};
inline std::unique_ptr<CCompositor> g_pCompositor;
// For XWayland
inline std::map<std::string, xcb_atom_t> HYPRATOMS = {
HYPRATOM("_NET_WM_WINDOW_TYPE"),
HYPRATOM("_NET_WM_WINDOW_TYPE_NORMAL"),
HYPRATOM("_NET_WM_WINDOW_TYPE_DOCK"),
HYPRATOM("_NET_WM_WINDOW_TYPE_DIALOG"),
HYPRATOM("_NET_WM_WINDOW_TYPE_UTILITY"),
HYPRATOM("_NET_WM_WINDOW_TYPE_TOOLBAR"),
HYPRATOM("_NET_WM_WINDOW_TYPE_SPLASH"),
HYPRATOM("_NET_WM_WINDOW_TYPE_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_POPUP_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_TOOLTIP"),
HYPRATOM("_NET_WM_WINDOW_TYPE_NOTIFICATION")};
inline std::map<std::string, xcb_atom_t> HYPRATOMS = {HYPRATOM("_NET_WM_WINDOW_TYPE"),
HYPRATOM("_NET_WM_WINDOW_TYPE_NORMAL"),
HYPRATOM("_NET_WM_WINDOW_TYPE_DOCK"),
HYPRATOM("_NET_WM_WINDOW_TYPE_DIALOG"),
HYPRATOM("_NET_WM_WINDOW_TYPE_UTILITY"),
HYPRATOM("_NET_WM_WINDOW_TYPE_TOOLBAR"),
HYPRATOM("_NET_WM_WINDOW_TYPE_SPLASH"),
HYPRATOM("_NET_WM_WINDOW_TYPE_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_POPUP_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_TOOLTIP"),
HYPRATOM("_NET_WM_WINDOW_TYPE_NOTIFICATION"),
HYPRATOM("_KDE_NET_WM_WINDOW_TYPE_OVERRIDE")};

25
src/SharedDefs.hpp Normal file
View File

@@ -0,0 +1,25 @@
#pragma once
enum eIcons
{
ICON_WARNING = 0,
ICON_INFO,
ICON_HINT,
ICON_ERROR,
ICON_CONFUSED,
ICON_OK,
ICON_NONE
};
enum eRenderStage
{
RENDER_PRE = 0, /* Before binding the gl context */
RENDER_BEGIN, /* Just when the rendering begins, nothing has been rendered yet. Damage, current render data in opengl valid. */
RENDER_PRE_WINDOWS, /* Pre windows, post bottom and overlay layers */
RENDER_POST_WINDOWS, /* Post windows, pre top/overlay layers, etc */
RENDER_LAST_MOMENT, /* Last moment to render with the gl context */
RENDER_POST, /* After rendering is finished, gl context not available anymore */
RENDER_POST_MIRROR, /* After rendering a mirror */
RENDER_PRE_WINDOW, /* Before rendering a window (any pass) Note some windows (e.g. tiled) may have 2 passes (main & popup) */
RENDER_POST_WINDOW, /* After rendering a window (any pass) */
};

View File

@@ -3,18 +3,21 @@
#include "render/decorations/CHyprDropShadowDecoration.hpp"
CWindow::CWindow() {
m_vRealPosition.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:windows_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:windows")->intValue, &g_pConfigManager->getConfigValuePtr("animations:windows_curve")->strValue, (void*) this, AVARDAMAGE_ENTIRE);
m_vRealSize.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:windows_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:windows")->intValue, &g_pConfigManager->getConfigValuePtr("animations:windows_curve")->strValue, (void*)this, AVARDAMAGE_ENTIRE);
m_cRealBorderColor.create(AVARTYPE_COLOR, &g_pConfigManager->getConfigValuePtr("animations:borders_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:borders")->intValue, &g_pConfigManager->getConfigValuePtr("animations:borders_curve")->strValue, (void*)this, AVARDAMAGE_BORDER);
m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:fadein_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:fadein")->intValue, &g_pConfigManager->getConfigValuePtr("animations:fadein_curve")->strValue, (void*)this, AVARDAMAGE_ENTIRE);
m_fActiveInactiveAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:fadein_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:fadein")->intValue, &g_pConfigManager->getConfigValuePtr("animations:fadein_curve")->strValue, (void*)this, AVARDAMAGE_ENTIRE);
m_vRealPosition.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE);
m_vRealSize.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE);
m_fBorderFadeAnimationProgress.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("border"), (void*)this, AVARDAMAGE_BORDER);
m_fBorderAngleAnimationProgress.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("borderangle"), (void*)this, AVARDAMAGE_BORDER);
m_fAlpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), (void*)this, AVARDAMAGE_ENTIRE);
m_fActiveInactiveAlpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), (void*)this, AVARDAMAGE_ENTIRE);
m_cRealShadowColor.create(AVARTYPE_COLOR, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), (void*)this, AVARDAMAGE_SHADOW);
m_fDimPercent.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeDim"), (void*)this, AVARDAMAGE_ENTIRE);
m_dWindowDecorations.emplace_back(std::make_unique<CHyprDropShadowDecoration>(this)); // put the shadow so it's the first deco (has to be rendered first)
}
CWindow::~CWindow() {
if (g_pCompositor->isWindowActive(this)) {
g_pCompositor->m_pLastFocus = nullptr;
g_pCompositor->m_pLastFocus = nullptr;
g_pCompositor->m_pLastWindow = nullptr;
}
}
@@ -22,7 +25,12 @@ CWindow::~CWindow() {
wlr_box CWindow::getFullWindowBoundingBox() {
static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
SWindowDecorationExtents maxExtents = {{*PBORDERSIZE + 1, *PBORDERSIZE + 1}, {*PBORDERSIZE + 1, *PBORDERSIZE + 1}};
if (m_sAdditionalConfigData.dimAround) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
}
SWindowDecorationExtents maxExtents = {{*PBORDERSIZE + 2, *PBORDERSIZE + 2}, {*PBORDERSIZE + 2, *PBORDERSIZE + 2}};
for (auto& wd : m_dWindowDecorations) {
@@ -41,12 +49,41 @@ wlr_box CWindow::getFullWindowBoundingBox() {
maxExtents.bottomRight.y = EXTENTS.bottomRight.y;
}
if (m_pWLSurface.exists() && !m_bIsX11) {
wlr_box surfaceExtents = {0, 0, 0, 0};
// TODO: this could be better, perhaps make a getFullWindowRegion?
wlr_xdg_surface_for_each_popup_surface(
m_uSurface.xdg,
[](wlr_surface* surf, int sx, int sy, void* data) {
wlr_box* pSurfaceExtents = (wlr_box*)data;
if (sx < pSurfaceExtents->x)
pSurfaceExtents->x = sx;
if (sy < pSurfaceExtents->y)
pSurfaceExtents->y = sy;
if (sx + surf->current.width > pSurfaceExtents->width)
pSurfaceExtents->width = sx + surf->current.width - pSurfaceExtents->x;
if (sy + surf->current.height > pSurfaceExtents->height)
pSurfaceExtents->height = sy + surf->current.height - pSurfaceExtents->y;
},
&surfaceExtents);
if (-surfaceExtents.x > maxExtents.topLeft.x)
maxExtents.topLeft.x = -surfaceExtents.x;
if (-surfaceExtents.y > maxExtents.topLeft.y)
maxExtents.topLeft.y = -surfaceExtents.y;
if (surfaceExtents.x + surfaceExtents.width > m_pWLSurface.wlr()->current.width + maxExtents.bottomRight.x)
maxExtents.bottomRight.x = surfaceExtents.x + surfaceExtents.width - m_pWLSurface.wlr()->current.width;
if (surfaceExtents.y + surfaceExtents.height > m_pWLSurface.wlr()->current.height + maxExtents.bottomRight.y)
maxExtents.bottomRight.y = surfaceExtents.y + surfaceExtents.height - m_pWLSurface.wlr()->current.height;
}
// Add extents to the real base BB and return
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x,
m_vRealPosition.vec().y - maxExtents.topLeft.y,
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x,
m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y,
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
return finalBox;
}
@@ -54,8 +91,15 @@ wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
auto POS = m_vPosition;
auto SIZE = m_vSize;
auto POS = m_vPosition;
auto SIZE = m_vSize;
if (m_bIsFullscreen) {
POS = PMONITOR->vecPosition;
SIZE = PMONITOR->vecSize;
return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
}
if (DELTALESSTHAN(POS.y - PMONITOR->vecPosition.y, PMONITOR->vecReservedTopLeft.y, 1)) {
POS.y = PMONITOR->vecPosition.y;
@@ -75,31 +119,611 @@ wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
}
wlr_box CWindow::getWindowInputBox() {
static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
if (m_sAdditionalConfigData.dimAround) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
}
SWindowDecorationExtents maxExtents = {{*PBORDERSIZE + 2, *PBORDERSIZE + 2}, {*PBORDERSIZE + 2, *PBORDERSIZE + 2}};
for (auto& wd : m_dWindowDecorations) {
if (!wd->allowsInput())
continue;
const auto EXTENTS = wd->getWindowDecorationExtents();
if (EXTENTS.topLeft.x > maxExtents.topLeft.x)
maxExtents.topLeft.x = EXTENTS.topLeft.x;
if (EXTENTS.topLeft.y > maxExtents.topLeft.y)
maxExtents.topLeft.y = EXTENTS.topLeft.y;
if (EXTENTS.bottomRight.x > maxExtents.bottomRight.x)
maxExtents.bottomRight.x = EXTENTS.bottomRight.x;
if (EXTENTS.bottomRight.y > maxExtents.bottomRight.y)
maxExtents.bottomRight.y = EXTENTS.bottomRight.y;
}
// Add extents to the real base BB and return
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y,
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
return finalBox;
}
SWindowDecorationExtents CWindow::getFullWindowReservedArea() {
SWindowDecorationExtents extents;
for (auto& wd : m_dWindowDecorations) {
const auto RESERVED = wd->getWindowDecorationReservedArea();
if (RESERVED.bottomRight == Vector2D{} && RESERVED.topLeft == Vector2D{})
continue;
extents.topLeft = extents.topLeft + RESERVED.topLeft;
extents.bottomRight = extents.bottomRight + RESERVED.bottomRight;
}
return extents;
}
void CWindow::updateWindowDecos() {
for (auto& wd : m_dWindowDecorations)
wd->updateWindow(this);
bool recalc = false;
for (auto& wd : m_vDecosToRemove) {
for (auto it = m_dWindowDecorations.begin(); it != m_dWindowDecorations.end(); it++) {
if (it->get() == wd) {
it = m_dWindowDecorations.erase(it);
it = m_dWindowDecorations.erase(it);
recalc = true;
if (it == m_dWindowDecorations.end())
break;
}
}
}
if (recalc)
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
m_vDecosToRemove.clear();
}
pid_t CWindow::getPID() {
pid_t PID = -1;
if (!m_bIsX11) {
const auto CLIENT = wl_resource_get_client(m_uSurface.xdg->resource);
wl_client_get_credentials(CLIENT, &PID, nullptr, nullptr);
if (!m_bIsMapped)
return -1;
wl_client_get_credentials(wl_resource_get_client(m_uSurface.xdg->resource), &PID, nullptr, nullptr);
} else {
PID = m_uSurface.xwayland->pid;
}
return PID;
}
IHyprWindowDecoration* CWindow::getDecorationByType(eDecorationType type) {
for (auto& wd : m_dWindowDecorations) {
if (wd->getDecorationType() == type)
return wd.get();
}
return nullptr;
}
void CWindow::createToplevelHandle() {
if (m_bIsX11 && (m_bX11DoesntWantBorders || m_iX11Type == 2))
return; // don't create a toplevel
m_phForeignToplevel = wlr_foreign_toplevel_handle_v1_create(g_pCompositor->m_sWLRToplevelMgr);
wlr_foreign_toplevel_handle_v1_set_app_id(m_phForeignToplevel, g_pXWaylandManager->getAppIDClass(this).c_str());
wlr_foreign_toplevel_handle_v1_output_enter(m_phForeignToplevel, g_pCompositor->getMonitorFromID(m_iMonitorID)->output);
wlr_foreign_toplevel_handle_v1_set_title(m_phForeignToplevel, m_szTitle.c_str());
wlr_foreign_toplevel_handle_v1_set_maximized(m_phForeignToplevel, false);
wlr_foreign_toplevel_handle_v1_set_minimized(m_phForeignToplevel, false);
wlr_foreign_toplevel_handle_v1_set_fullscreen(m_phForeignToplevel, false);
// handle events
hyprListener_toplevelActivate.initCallback(
&m_phForeignToplevel->events.request_activate,
[&](void* owner, void* data) {
if (isHidden() && m_sGroupData.pNextWindow) {
// grouped, change the current to us
setGroupCurrent(this);
}
g_pCompositor->focusWindow(this);
},
this, "Toplevel");
hyprListener_toplevelFullscreen.initCallback(
&m_phForeignToplevel->events.request_fullscreen,
[&](void* owner, void* data) {
const auto EV = (wlr_foreign_toplevel_handle_v1_fullscreen_event*)data;
g_pCompositor->setWindowFullscreen(this, EV->fullscreen, FULLSCREEN_FULL);
},
this, "Toplevel");
hyprListener_toplevelClose.initCallback(
&m_phForeignToplevel->events.request_close, [&](void* owner, void* data) { g_pCompositor->closeWindow(this); }, this, "Toplevel");
m_iLastToplevelMonitorID = m_iMonitorID;
}
void CWindow::destroyToplevelHandle() {
if (!m_phForeignToplevel)
return;
hyprListener_toplevelActivate.removeCallback();
hyprListener_toplevelClose.removeCallback();
hyprListener_toplevelFullscreen.removeCallback();
wlr_foreign_toplevel_handle_v1_destroy(m_phForeignToplevel);
m_phForeignToplevel = nullptr;
}
void CWindow::updateToplevel() {
updateSurfaceOutputs();
if (!m_phForeignToplevel)
return;
wlr_foreign_toplevel_handle_v1_set_title(m_phForeignToplevel, m_szTitle.c_str());
wlr_foreign_toplevel_handle_v1_set_fullscreen(m_phForeignToplevel, m_bIsFullscreen);
if (m_iLastToplevelMonitorID != m_iMonitorID) {
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iLastToplevelMonitorID); PMONITOR && PMONITOR->m_bEnabled)
wlr_foreign_toplevel_handle_v1_output_leave(m_phForeignToplevel, PMONITOR->output);
wlr_foreign_toplevel_handle_v1_output_enter(m_phForeignToplevel, g_pCompositor->getMonitorFromID(m_iMonitorID)->output);
m_iLastToplevelMonitorID = m_iMonitorID;
}
}
void sendEnterIter(wlr_surface* pSurface, int x, int y, void* data) {
const auto OUTPUT = (wlr_output*)data;
wlr_surface_send_enter(pSurface, OUTPUT);
}
void sendLeaveIter(wlr_surface* pSurface, int x, int y, void* data) {
const auto OUTPUT = (wlr_output*)data;
wlr_surface_send_leave(pSurface, OUTPUT);
}
void CWindow::updateSurfaceOutputs() {
if (m_iLastSurfaceMonitorID == m_iMonitorID || !m_bIsMapped || m_bHidden || !m_bMappedX11)
return;
const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(m_iLastSurfaceMonitorID);
m_iLastSurfaceMonitorID = m_iMonitorID;
const auto PNEWMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
if (PLASTMONITOR && PLASTMONITOR->m_bEnabled)
wlr_surface_for_each_surface(m_pWLSurface.wlr(), sendLeaveIter, PLASTMONITOR->output);
wlr_surface_for_each_surface(m_pWLSurface.wlr(), sendEnterIter, PNEWMONITOR->output);
wlr_surface_for_each_surface(
m_pWLSurface.wlr(),
[](wlr_surface* surf, int x, int y, void* data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(((CWindow*)data)->m_iMonitorID);
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(surf, PMONITOR ? PMONITOR->scale : 1.f);
},
this);
}
void CWindow::moveToWorkspace(int workspaceID) {
if (m_iWorkspaceID == workspaceID)
return;
m_iWorkspaceID = workspaceID;
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
if (PWORKSPACE) {
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%lx,%s", this, PWORKSPACE->m_szName.c_str())});
EMIT_HOOK_EVENT("moveWindow", (std::vector<void*>{this, PWORKSPACE}));
}
if (m_pSwallowed) {
m_pSwallowed->moveToWorkspace(workspaceID);
m_pSwallowed->m_iMonitorID = m_iMonitorID;
}
}
CWindow* CWindow::X11TransientFor() {
if (!m_bIsX11)
return nullptr;
if (!m_uSurface.xwayland->parent)
return nullptr;
auto PPARENT = g_pCompositor->getWindowFromSurface(m_uSurface.xwayland->parent->surface);
while (g_pCompositor->windowValidMapped(PPARENT) && PPARENT->m_uSurface.xwayland->parent) {
PPARENT = g_pCompositor->getWindowFromSurface(PPARENT->m_uSurface.xwayland->parent->surface);
}
if (!g_pCompositor->windowValidMapped(PPARENT))
return nullptr;
return PPARENT;
}
void CWindow::removeDecorationByType(eDecorationType type) {
for (auto& wd : m_dWindowDecorations) {
if (wd->getDecorationType() == type)
m_vDecosToRemove.push_back(wd.get());
}
updateWindowDecos();
}
void unregisterVar(void* ptr) {
((CAnimatedVariable*)ptr)->unregister();
}
void CWindow::onUnmap() {
if (g_pCompositor->m_pLastWindow == this)
g_pCompositor->m_pLastWindow = nullptr;
m_vRealPosition.setCallbackOnEnd(unregisterVar);
m_vRealSize.setCallbackOnEnd(unregisterVar);
m_fBorderFadeAnimationProgress.setCallbackOnEnd(unregisterVar);
m_fBorderAngleAnimationProgress.setCallbackOnEnd(unregisterVar);
m_fActiveInactiveAlpha.setCallbackOnEnd(unregisterVar);
m_fAlpha.setCallbackOnEnd(unregisterVar);
m_cRealShadowColor.setCallbackOnEnd(unregisterVar);
m_fDimPercent.setCallbackOnEnd(unregisterVar);
m_vRealSize.setCallbackOnBegin(nullptr);
std::erase_if(g_pCompositor->m_vWindowFocusHistory, [&](const auto& other) { return other == this; });
m_pWLSurface.unassign();
hyprListener_unmapWindow.removeCallback();
}
void CWindow::onMap() {
m_pWLSurface.assign(g_pXWaylandManager->getWindowSurface(this));
// JIC, reset the callbacks. If any are set, we'll make sure they are cleared so we don't accidentally unset them. (In case a window got remapped)
m_vRealPosition.resetAllCallbacks();
m_vRealSize.resetAllCallbacks();
m_fBorderFadeAnimationProgress.resetAllCallbacks();
m_fBorderAngleAnimationProgress.resetAllCallbacks();
m_fActiveInactiveAlpha.resetAllCallbacks();
m_fAlpha.resetAllCallbacks();
m_cRealShadowColor.resetAllCallbacks();
m_fDimPercent.resetAllCallbacks();
m_vRealPosition.registerVar();
m_vRealSize.registerVar();
m_fBorderFadeAnimationProgress.registerVar();
m_fBorderAngleAnimationProgress.registerVar();
m_fActiveInactiveAlpha.registerVar();
m_fAlpha.registerVar();
m_cRealShadowColor.registerVar();
m_fDimPercent.registerVar();
m_fBorderAngleAnimationProgress.setCallbackOnEnd([&](void* ptr) { onBorderAngleAnimEnd(ptr); }, false);
m_fBorderAngleAnimationProgress.setValueAndWarp(0.f);
m_fBorderAngleAnimationProgress = 1.f;
g_pCompositor->m_vWindowFocusHistory.push_back(this);
hyprListener_unmapWindow.initCallback(m_bIsX11 ? &m_uSurface.xwayland->surface->events.unmap : &m_uSurface.xdg->surface->events.unmap, &Events::listener_unmapWindow, this,
"CWindow");
}
void CWindow::onBorderAngleAnimEnd(void* ptr) {
const auto PANIMVAR = (CAnimatedVariable*)ptr;
const std::string STYLE = PANIMVAR->getConfig()->pValues->internalStyle;
if (STYLE != "loop" || !PANIMVAR->getConfig()->pValues->internalEnabled)
return;
PANIMVAR->setCallbackOnEnd(nullptr); // we remove the callback here because otherwise setvalueandwarp will recurse this
PANIMVAR->setValueAndWarp(0);
*PANIMVAR = 1.f;
PANIMVAR->setCallbackOnEnd([&](void* ptr) { onBorderAngleAnimEnd(ptr); }, false);
}
void CWindow::setHidden(bool hidden) {
m_bHidden = hidden;
if (hidden && g_pCompositor->m_pLastWindow == this) {
g_pCompositor->m_pLastWindow = nullptr;
}
}
bool CWindow::isHidden() {
return m_bHidden;
}
void CWindow::applyDynamicRule(const SWindowRule& r) {
if (r.szRule == "noblur") {
m_sAdditionalConfigData.forceNoBlur = true;
} else if (r.szRule == "noborder") {
m_sAdditionalConfigData.forceNoBorder = true;
} else if (r.szRule == "noshadow") {
m_sAdditionalConfigData.forceNoShadow = true;
} else if (r.szRule == "nodim") {
m_sAdditionalConfigData.forceNoDim = true;
} else if (r.szRule == "forcergbx") {
m_sAdditionalConfigData.forceRGBX = true;
} else if (r.szRule == "opaque") {
if (!m_sAdditionalConfigData.forceOpaqueOverridden)
m_sAdditionalConfigData.forceOpaque = true;
} else if (r.szRule.find("rounding") == 0) {
try {
m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
} catch (std::exception& e) { Debug::log(ERR, "Rounding rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
} else if (r.szRule.find("opacity") == 0) {
try {
CVarList vars(r.szRule, 0, ' ');
for (size_t i = 1 /* first item is "opacity" */; i < vars.size(); ++i) {
if (i == 1) {
// first arg, alpha
m_sSpecialRenderData.alpha = std::stof(vars[i]);
} else {
if (vars[i] == "override") {
if (i == 2) {
m_sSpecialRenderData.alphaOverride = true;
} else {
m_sSpecialRenderData.alphaInactiveOverride = true;
}
} else {
m_sSpecialRenderData.alphaInactive = std::stof(vars[i]);
}
}
}
} catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
} else if (r.szRule == "noanim") {
m_sAdditionalConfigData.forceNoAnims = true;
} else if (r.szRule.find("animation") == 0) {
auto STYLE = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
m_sAdditionalConfigData.animationStyle = STYLE;
} else if (r.szRule.find("bordercolor") == 0) {
try {
std::string colorPart = removeBeginEndSpacesTabs(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
if (colorPart.contains(' ')) {
// we have a space, 2 values
m_sSpecialRenderData.activeBorderColor = configStringToInt(colorPart.substr(0, colorPart.find_first_of(' ')));
m_sSpecialRenderData.inactiveBorderColor = configStringToInt(colorPart.substr(colorPart.find_first_of(' ') + 1));
} else {
m_sSpecialRenderData.activeBorderColor = configStringToInt(colorPart);
}
} catch (std::exception& e) { Debug::log(ERR, "BorderColor rule \"%s\" failed with: %s", r.szRule.c_str(), e.what()); }
} else if (r.szRule == "dimaround") {
m_sAdditionalConfigData.dimAround = true;
}
}
void CWindow::updateDynamicRules() {
m_sSpecialRenderData.activeBorderColor = -1;
m_sSpecialRenderData.inactiveBorderColor = -1;
m_sSpecialRenderData.alpha = 1.f;
m_sSpecialRenderData.alphaInactive = -1.f;
m_sAdditionalConfigData.forceNoBlur = false;
m_sAdditionalConfigData.forceNoBorder = false;
m_sAdditionalConfigData.forceNoShadow = false;
m_sAdditionalConfigData.forceNoDim = false;
if (!m_sAdditionalConfigData.forceOpaqueOverridden)
m_sAdditionalConfigData.forceOpaque = false;
m_sAdditionalConfigData.forceNoAnims = false;
m_sAdditionalConfigData.animationStyle = std::string("");
m_sAdditionalConfigData.rounding = -1;
m_sAdditionalConfigData.dimAround = false;
m_sAdditionalConfigData.forceRGBX = false;
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(this);
for (auto& r : WINDOWRULES) {
applyDynamicRule(r);
}
}
// check if the point is "hidden" under a rounded corner of the window
// it is assumed that the point is within the real window box (m_vRealPosition, m_vRealSize)
// otherwise behaviour is undefined
bool CWindow::isInCurvedCorner(double x, double y) {
static auto* const ROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue;
static auto* const BORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
if (BORDERSIZE >= ROUNDING || ROUNDING == 0)
return false;
// (x0, y0), (x0, y1), ... are the center point of rounding at each corner
double x0 = m_vRealPosition.vec().x + *ROUNDING;
double y0 = m_vRealPosition.vec().y + *ROUNDING;
double x1 = m_vRealPosition.vec().x + m_vRealSize.vec().x - *ROUNDING;
double y1 = m_vRealPosition.vec().y + m_vRealSize.vec().y - *ROUNDING;
if (x < x0 && y < y0) {
return Vector2D{x0, y0}.distance(Vector2D{x, y}) > (double)*ROUNDING;
}
if (x > x1 && y < y0) {
return Vector2D{x1, y0}.distance(Vector2D{x, y}) > (double)*ROUNDING;
}
if (x < x0 && y > y1) {
return Vector2D{x0, y1}.distance(Vector2D{x, y}) > (double)*ROUNDING;
}
if (x > x1 && y > y1) {
return Vector2D{x1, y1}.distance(Vector2D{x, y}) > (double)*ROUNDING;
}
return false;
}
void findExtensionForVector2D(wlr_surface* surface, int x, int y, void* data) {
const auto DATA = (SExtensionFindingData*)data;
wlr_box box = {DATA->origin.x + x, DATA->origin.y + y, surface->current.width, surface->current.height};
if (wlr_box_contains_point(&box, DATA->vec.x, DATA->vec.y))
*DATA->found = surface;
}
// checks if the wayland window has a popup at pos
bool CWindow::hasPopupAt(const Vector2D& pos) {
if (m_bIsX11)
return false;
wlr_surface* resultSurf = nullptr;
Vector2D origin = m_vRealPosition.vec();
SExtensionFindingData data = {origin, pos, &resultSurf};
wlr_xdg_surface_for_each_popup_surface(m_uSurface.xdg, findExtensionForVector2D, &data);
return resultSurf;
}
CWindow* CWindow::getGroupHead() {
CWindow* curr = this;
while (!curr->m_sGroupData.head)
curr = curr->m_sGroupData.pNextWindow;
return curr;
}
CWindow* CWindow::getGroupTail() {
CWindow* curr = this;
while (!curr->m_sGroupData.pNextWindow->m_sGroupData.head)
curr = curr->m_sGroupData.pNextWindow;
return curr;
}
CWindow* CWindow::getGroupCurrent() {
CWindow* curr = this;
while (curr->isHidden())
curr = curr->m_sGroupData.pNextWindow;
return curr;
}
void CWindow::setGroupCurrent(CWindow* pWindow) {
CWindow* curr = this->m_sGroupData.pNextWindow;
bool isMember = false;
while (curr != this) {
if (curr == pWindow) {
isMember = true;
break;
}
curr = curr->m_sGroupData.pNextWindow;
}
if (!isMember && pWindow != this)
return;
const auto PCURRENT = getGroupCurrent();
const bool FULLSCREEN = PCURRENT->m_bIsFullscreen;
const auto WORKSPACE = g_pCompositor->getWorkspaceByID(PCURRENT->m_iWorkspaceID);
const auto PWINDOWSIZE = PCURRENT->m_vRealSize.goalv();
const auto PWINDOWPOS = PCURRENT->m_vRealPosition.goalv();
const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_pLastWindow;
if (FULLSCREEN)
g_pCompositor->setWindowFullscreen(PCURRENT, false, WORKSPACE->m_efFullscreenMode);
PCURRENT->setHidden(true);
pWindow->setHidden(false);
g_pLayoutManager->getCurrentLayout()->replaceWindowDataWith(PCURRENT, pWindow);
if (PCURRENT->m_bIsFloating) {
pWindow->m_vRealPosition.setValueAndWarp(PWINDOWPOS);
pWindow->m_vRealSize.setValueAndWarp(PWINDOWSIZE);
}
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
if (CURRENTISFOCUS)
g_pCompositor->focusWindow(pWindow);
if (FULLSCREEN)
g_pCompositor->setWindowFullscreen(pWindow, true, WORKSPACE->m_efFullscreenMode);
g_pHyprRenderer->damageWindow(pWindow);
}
void CWindow::insertWindowToGroup(CWindow* pWindow) {
const auto PHEAD = getGroupHead();
const auto PTAIL = getGroupTail();
if (pWindow->m_sGroupData.pNextWindow) {
const auto PHEAD = pWindow->getGroupHead();
std::vector<CWindow*> members;
CWindow* curr = PHEAD;
do {
const auto PLAST = curr;
members.push_back(curr);
curr = curr->m_sGroupData.pNextWindow;
PLAST->m_sGroupData.pNextWindow = nullptr;
PLAST->m_sGroupData.head = false;
PLAST->m_sGroupData.locked = false;
} while (curr != PHEAD);
for (auto& w : members) {
insertWindowToGroup(w);
}
return;
}
PTAIL->m_sGroupData.pNextWindow = pWindow;
pWindow->m_sGroupData.pNextWindow = PHEAD;
}
void CWindow::updateGroupOutputs() {
if (!m_sGroupData.pNextWindow)
return;
CWindow* curr = m_sGroupData.pNextWindow;
while (curr != this) {
curr->m_iMonitorID = m_iMonitorID;
curr->moveToWorkspace(m_iWorkspaceID);
curr->m_vRealPosition = m_vRealPosition.goalv();
curr->m_vRealSize = m_vRealSize.goalv();
curr = curr->m_sGroupData.pNextWindow;
}
}
Vector2D CWindow::middle() {
return m_vRealPosition.goalv() + m_vRealSize.goalv() / 2.f;
}
bool CWindow::opaque() {
if (m_bIsX11)
return !m_uSurface.xwayland->has_alpha;
if (m_uSurface.xdg->surface->opaque)
return true;
const auto EXTENTS = pixman_region32_extents(&m_uSurface.xdg->surface->opaque_region);
if (EXTENTS->x2 - EXTENTS->x1 >= m_uSurface.xdg->surface->current.buffer_width && EXTENTS->y2 - EXTENTS->y1 >= m_uSurface.xdg->surface->current.buffer_height)
return true;
return false;
}

View File

@@ -6,20 +6,139 @@
#include "helpers/AnimatedVariable.hpp"
#include "render/decorations/IHyprWindowDecoration.hpp"
#include <deque>
#include "config/ConfigDataValues.hpp"
#include "helpers/Vector2D.hpp"
#include "helpers/WLSurface.hpp"
enum eIdleInhibitMode
{
IDLEINHIBIT_NONE = 0,
IDLEINHIBIT_ALWAYS,
IDLEINHIBIT_FULLSCREEN,
IDLEINHIBIT_FOCUS
};
template <typename T>
class CWindowOverridableVar {
public:
CWindowOverridableVar(T val) {
value = val;
}
~CWindowOverridableVar() = default;
CWindowOverridableVar<T>& operator=(CWindowOverridableVar<T> other) {
if (locked)
return *this;
locked = other.locked;
value = other.value;
return *this;
}
T operator=(T& other) {
if (locked)
return value;
value = other;
return other;
}
void forceSetIgnoreLocked(T val, bool lock = false) {
value = val;
locked = lock;
}
T operator*(T& other) {
return value * other;
}
T operator+(T& other) {
return value + other;
}
bool operator==(T& other) {
return other == value;
}
bool operator>=(T& other) {
return value >= other;
}
bool operator<=(T& other) {
return value <= other;
}
bool operator>(T& other) {
return value > other;
}
bool operator<(T& other) {
return value < other;
}
explicit operator bool() {
return static_cast<bool>(value);
}
T toUnderlying() {
return value;
}
bool locked = false;
private:
T value;
};
struct SWindowSpecialRenderData {
float alpha = 1.f;
float alphaInactive = -1.f; // -1 means unset
};
CWindowOverridableVar<bool> alphaOverride = false;
CWindowOverridableVar<float> alpha = 1.f;
CWindowOverridableVar<bool> alphaInactiveOverride = false;
CWindowOverridableVar<float> alphaInactive = -1.f; // -1 means unset
CWindowOverridableVar<int64_t> activeBorderColor = -1; // -1 means unset
CWindowOverridableVar<int64_t> inactiveBorderColor = -1; // -1 means unset
// set by the layout
CWindowOverridableVar<int> borderSize = -1; // -1 means unset
bool rounding = true;
bool border = true;
bool decorate = true;
};
struct SWindowAdditionalConfigData {
std::string animationStyle = "";
int rounding = -1; // -1 means no
bool forceNoBlur = false;
std::string animationStyle = std::string("");
CWindowOverridableVar<int> rounding = -1; // -1 means no
CWindowOverridableVar<bool> forceNoBlur = false;
CWindowOverridableVar<bool> forceOpaque = false;
CWindowOverridableVar<bool> forceOpaqueOverridden = false; // if true, a rule will not change the forceOpaque state. This is for the force opaque dispatcher.
CWindowOverridableVar<bool> forceAllowsInput = false;
CWindowOverridableVar<bool> forceNoAnims = false;
CWindowOverridableVar<bool> forceNoBorder = false;
CWindowOverridableVar<bool> forceNoShadow = false;
CWindowOverridableVar<bool> forceNoDim = false;
CWindowOverridableVar<bool> windowDanceCompat = false;
CWindowOverridableVar<bool> noMaxSize = false;
CWindowOverridableVar<bool> dimAround = false;
CWindowOverridableVar<bool> forceRGBX = false;
};
struct SWindowRule {
std::string szRule;
std::string szValue;
bool v2 = false;
std::string szTitle;
std::string szClass;
int bX11 = -1; // -1 means "ANY"
int bFloating = -1;
int bFullscreen = -1;
int bPinned = -1;
};
class CWindow {
public:
public:
CWindow();
~CWindow();
@@ -31,93 +150,194 @@ public:
DYNLISTENER(setGeometryX11U);
DYNLISTENER(fullscreenWindow);
DYNLISTENER(newPopupXDG);
// DYNLISTENER(newSubsurfaceWindow);
DYNLISTENER(requestMove);
DYNLISTENER(requestMinimize);
DYNLISTENER(requestMaximize);
DYNLISTENER(requestResize);
DYNLISTENER(activateX11);
DYNLISTENER(configureX11);
DYNLISTENER(toplevelClose);
DYNLISTENER(toplevelActivate);
DYNLISTENER(toplevelFullscreen);
DYNLISTENER(setOverrideRedirect);
DYNLISTENER(associateX11);
DYNLISTENER(dissociateX11);
// DYNLISTENER(newSubsurfaceWindow);
CWLSurface m_pWLSurface;
std::list<CWLSurface> m_lPopupSurfaces;
union {
wlr_xdg_surface* xdg;
wlr_xdg_surface* xdg;
wlr_xwayland_surface* xwayland;
} m_uSurface;
// this is the position and size of the "bounding box"
Vector2D m_vPosition = Vector2D(0,0);
Vector2D m_vSize = Vector2D(0,0);
Vector2D m_vPosition = Vector2D(0, 0);
Vector2D m_vSize = Vector2D(0, 0);
// this is the real position and size used to draw the thing
CAnimatedVariable m_vRealPosition;
CAnimatedVariable m_vRealSize;
// for not spamming the protocols
Vector2D m_vReportedPosition;
Vector2D m_vReportedSize;
// for restoring floating statuses
Vector2D m_vLastFloatingSize;
Vector2D m_vLastFloatingPosition;
// this is used for pseudotiling
bool m_bIsPseudotiled = false;
Vector2D m_vPseudoSize = Vector2D(0,0);
bool m_bIsPseudotiled = false;
Vector2D m_vPseudoSize = Vector2D(0, 0);
uint64_t m_iTags = 0;
bool m_bIsFloating = false;
bool m_bDraggingTiled = false; // for dragging around tiled windows
bool m_bIsFullscreen = false;
uint64_t m_iMonitorID = -1;
std::string m_szTitle = "";
int m_iWorkspaceID = -1;
bool m_bFirstMap = false; // for layouts
bool m_bIsFloating = false;
bool m_bDraggingTiled = false; // for dragging around tiled windows
bool m_bIsFullscreen = false;
bool m_bWasMaximized = false;
uint64_t m_iMonitorID = -1;
std::string m_szTitle = "";
std::string m_szInitialTitle = "";
std::string m_szInitialClass = "";
int m_iWorkspaceID = -1;
bool m_bIsMapped = false;
bool m_bIsMapped = false;
bool m_bRequestsFloat = false;
bool m_bRequestsFloat = false;
// This is for fullscreen apps
bool m_bCreatedOverFullscreen = false;
bool m_bCreatedOverFullscreen = false;
// XWayland stuff
bool m_bIsX11 = false;
bool m_bMappedX11 = false;
CWindow* m_pX11Parent = nullptr;
uint64_t m_iX11Type = 0;
bool m_bIsModal = false;
bool m_bX11DoesntWantBorders = false;
DYNLISTENER(activateX11);
DYNLISTENER(configureX11);
bool m_bIsX11 = false;
bool m_bMappedX11 = false;
CWindow* m_pX11Parent = nullptr;
uint64_t m_iX11Type = 0;
bool m_bIsModal = false;
bool m_bX11DoesntWantBorders = false;
bool m_bX11ShouldntFocus = false;
float m_fX11SurfaceScaledBy = 1.f;
//
// For nofocus
bool m_bNoFocus = false;
bool m_bNoInitialFocus = false;
bool m_bNoFocus = false;
bool m_bNoInitialFocus = false;
// initial fullscreen and fullscreen disabled
bool m_bWantsInitialFullscreen = false;
bool m_bNoFullscreenRequest = false;
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
// Animated border
CAnimatedVariable m_cRealBorderColor;
CGradientValueData m_cRealBorderColor = {0};
CGradientValueData m_cRealBorderColorPrevious = {0};
CAnimatedVariable m_fBorderFadeAnimationProgress;
CAnimatedVariable m_fBorderAngleAnimationProgress;
// Fade in-out
CAnimatedVariable m_fAlpha;
bool m_bFadingOut = false;
bool m_bReadyToDelete = false;
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
Vector2D m_vOriginalClosedSize; // drawing the closing animations
bool m_bFadingOut = false;
bool m_bReadyToDelete = false;
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
Vector2D m_vOriginalClosedSize; // drawing the closing animations
// For hidden windows and stuff
bool m_bHidden = false;
// For pinned (sticky) windows
bool m_bPinned = false;
// urgency hint
bool m_bIsUrgent = false;
// fakefullscreen
bool m_bFakeFullscreenState = false;
// for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window.
CWindow* m_pLastCycledWindow = nullptr;
// Foreign Toplevel proto
wlr_foreign_toplevel_handle_v1* m_phForeignToplevel = nullptr;
// Window decorations
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
// Special render data, rules, etc
SWindowSpecialRenderData m_sSpecialRenderData;
SWindowSpecialRenderData m_sSpecialRenderData;
SWindowAdditionalConfigData m_sAdditionalConfigData;
// for alpha
CAnimatedVariable m_fActiveInactiveAlpha;
// animated shadow color
CAnimatedVariable m_cRealShadowColor;
// animated tint
CAnimatedVariable m_fDimPercent;
// swallowing
CWindow* m_pSwallowed = nullptr;
// focus stuff
bool m_bStayFocused = false;
// for toplevel monitor events
uint64_t m_iLastToplevelMonitorID = -1;
uint64_t m_iLastSurfaceMonitorID = -1;
// for idle inhibiting windows
eIdleInhibitMode m_eIdleInhibitMode = IDLEINHIBIT_NONE;
// for groups
struct SGroupData {
CWindow* pNextWindow = nullptr; // nullptr means no grouping. Self means single group.
bool head = false;
bool locked = false;
} m_sGroupData;
// For the list lookup
bool operator==(const CWindow& rhs) {
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize && m_bFadingOut == rhs.m_bFadingOut;
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize &&
m_bFadingOut == rhs.m_bFadingOut;
}
// methods
wlr_box getFullWindowBoundingBox();
wlr_box getWindowIdealBoundingBoxIgnoreReserved();
void updateWindowDecos();
pid_t getPID();
wlr_box getFullWindowBoundingBox();
wlr_box getWindowInputBox();
wlr_box getWindowIdealBoundingBoxIgnoreReserved();
void updateWindowDecos();
pid_t getPID();
IHyprWindowDecoration* getDecorationByType(eDecorationType);
void removeDecorationByType(eDecorationType);
void createToplevelHandle();
void destroyToplevelHandle();
void updateToplevel();
void updateSurfaceOutputs();
void moveToWorkspace(int);
CWindow* X11TransientFor();
void onUnmap();
void onMap();
void setHidden(bool hidden);
bool isHidden();
void applyDynamicRule(const SWindowRule& r);
void updateDynamicRules();
SWindowDecorationExtents getFullWindowReservedArea();
Vector2D middle();
bool opaque();
void onBorderAngleAnimEnd(void* ptr);
bool isInCurvedCorner(double x, double y);
bool hasPopupAt(const Vector2D& pos);
CWindow* getGroupHead();
CWindow* getGroupTail();
CWindow* getGroupCurrent();
void setGroupCurrent(CWindow* pWindow);
void insertWindowToGroup(CWindow* pWindow);
void updateGroupOutputs();
private:
// For hidden windows and stuff
bool m_bHidden = false;
};

View File

@@ -0,0 +1,51 @@
#pragma once
#include "../defines.hpp"
#include <vector>
enum eConfigValueDataTypes {
CVD_TYPE_INVALID = -1,
CVD_TYPE_GRADIENT = 0
};
interface ICustomConfigValueData {
public:
virtual ~ICustomConfigValueData() = 0;
virtual eConfigValueDataTypes getDataType() = 0;
};
class CGradientValueData : public ICustomConfigValueData {
public:
CGradientValueData(CColor col) {
m_vColors.push_back(col);
};
virtual ~CGradientValueData(){};
virtual eConfigValueDataTypes getDataType() {
return CVD_TYPE_GRADIENT;
}
void reset(CColor col) {
m_vColors.clear();
m_vColors.emplace_back(col);
m_fAngle = 0;
}
/* Vector containing the colors */
std::vector<CColor> m_vColors;
/* Float corresponding to the angle (rad) */
float m_fAngle = 0;
//
bool operator==(const CGradientValueData& other) const {
if (other.m_vColors.size() != m_vColors.size() || m_fAngle != other.m_fAngle)
return false;
for (size_t i = 0; i < m_vColors.size(); ++i)
if (m_vColors[i] != other.m_vColors[i])
return false;
return true;
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -10,126 +10,282 @@
#include <deque>
#include <algorithm>
#include <regex>
#include <optional>
#include <xf86drmMode.h>
#include "../Window.hpp"
#include "../helpers/WLClasses.hpp"
#include "defaultConfig.hpp"
#include "ConfigDataValues.hpp"
#define STRVAL_EMPTY "[[EMPTY]]"
struct SConfigValue {
int64_t intValue = -1;
float floatValue = -1;
std::string strValue = "";
#define INITANIMCFG(name) animationConfig[name] = {}
#define CREATEANIMCFG(name, parent) animationConfig[name] = {false, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]}
bool set = false; // used for device configs
#define HANDLE void*
struct SConfigValue {
int64_t intValue = -INT64_MAX;
float floatValue = -__FLT_MAX__;
std::string strValue = "";
Vector2D vecValue = Vector2D(-__FLT_MAX__, -__FLT_MAX__);
std::shared_ptr<ICustomConfigValueData> data;
bool set = false; // used for device configs
};
struct SMonitorRule {
std::string name = "";
Vector2D resolution = Vector2D(1280,720);
Vector2D offset = Vector2D(0,0);
float scale = 1;
float refreshRate = 60;
std::string defaultWorkspace = "";
bool disabled = false;
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
std::string name = "";
Vector2D resolution = Vector2D(1280, 720);
Vector2D offset = Vector2D(0, 0);
float scale = 1;
float refreshRate = 60;
bool disabled = false;
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
std::string mirrorOf = "";
bool enable10bit = false;
drmModeModeInfo drmMode = {};
};
struct SWorkspaceRule {
std::string monitor = "";
std::string workspaceString = "";
std::string workspaceName = "";
int workspaceId = -1;
bool isDefault = false;
std::optional<int64_t> gapsIn;
std::optional<int64_t> gapsOut;
std::optional<int64_t> borderSize;
std::optional<int> border;
std::optional<int> rounding;
std::optional<int> decorate;
};
struct SMonitorAdditionalReservedArea {
int top = 0;
int bottom = 0;
int left = 0;
int right = 0;
int top = 0;
int bottom = 0;
int left = 0;
int right = 0;
};
struct SWindowRule {
std::string szRule;
std::string szValue;
struct SAnimationPropertyConfig {
bool overridden = true;
std::string internalBezier = "";
std::string internalStyle = "";
float internalSpeed = 0.f;
int internalEnabled = -1;
SAnimationPropertyConfig* pValues = nullptr;
SAnimationPropertyConfig* pParentAnimation = nullptr;
};
struct SExecRequestedRule {
std::string szRule = "";
uint64_t iPid = 0;
};
class CVarList {
public:
/* passing 's' as a separator will use std::isspace */
CVarList(const std::string& in, long unsigned int lastArgNo = 0, const char separator = ',') {
std::string curitem = "";
std::string argZ = in;
const bool SPACESEP = separator == 's';
auto nextItem = [&]() {
auto idx = lastArgNo != 0 && m_vArgs.size() >= lastArgNo - 1 ? std::string::npos : ([&]() -> size_t {
if (!SPACESEP)
return argZ.find_first_of(separator);
uint64_t pos = -1;
while (!std::isspace(argZ[++pos]) && pos < argZ.length())
;
return pos < argZ.length() ? pos : std::string::npos;
}());
if (idx != std::string::npos) {
curitem = argZ.substr(0, idx);
argZ = argZ.substr(idx + 1);
} else {
curitem = argZ;
argZ = STRVAL_EMPTY;
}
};
nextItem();
while (curitem != STRVAL_EMPTY) {
m_vArgs.push_back(removeBeginEndSpacesTabs(curitem));
nextItem();
}
};
~CVarList() = default;
size_t size() const {
return m_vArgs.size();
}
std::string operator[](const long unsigned int& idx) const {
if (idx >= m_vArgs.size())
return "";
return m_vArgs[idx];
}
// for range-based loops
std::vector<std::string>::iterator begin() {
return m_vArgs.begin();
}
std::vector<std::string>::const_iterator begin() const {
return m_vArgs.begin();
}
std::vector<std::string>::iterator end() {
return m_vArgs.end();
}
std::vector<std::string>::const_iterator end() const {
return m_vArgs.end();
}
private:
std::vector<std::string> m_vArgs;
};
class CConfigManager {
public:
public:
CConfigManager();
void tick();
void init();
void tick();
void init();
int getInt(const std::string&);
float getFloat(const std::string&);
std::string getString(const std::string&);
void setFloat(std::string, float);
void setInt(std::string, int);
void setString(std::string, std::string);
int getInt(const std::string&);
float getFloat(const std::string&);
std::string getString(const std::string&);
void setFloat(const std::string&, float);
void setInt(const std::string&, int);
void setString(const std::string&, const std::string&);
int getDeviceInt(const std::string&, const std::string&);
float getDeviceFloat(const std::string&, const std::string&);
std::string getDeviceString(const std::string&, const std::string&);
bool deviceConfigExists(const std::string&);
bool shouldBlurLS(const std::string&);
int getDeviceInt(const std::string&, const std::string&, std::optional<bool> touchpad = {});
float getDeviceFloat(const std::string&, const std::string&, std::optional<bool> touchpad = {});
std::string getDeviceString(const std::string&, const std::string&, std::optional<bool> touchpad = {});
bool deviceConfigExists(const std::string&);
bool shouldBlurLS(const std::string&);
SConfigValue* getConfigValuePtr(std::string);
SConfigValue* getConfigValuePtr(const std::string&);
SConfigValue* getConfigValuePtrSafe(const std::string&);
static std::string getConfigDir();
static std::string getMainConfigPath();
SMonitorRule getMonitorRuleFor(std::string);
SMonitorRule getMonitorRuleFor(const std::string&, const std::string& displayName = "");
SWorkspaceRule getWorkspaceRuleFor(CWorkspace*);
std::string getDefaultWorkspaceFor(const std::string&);
std::vector<SWindowRule> getMatchingRules(CWindow*);
CMonitor* getBoundMonitorForWS(const std::string&);
std::string getBoundMonitorStringForWS(const std::string&);
const std::deque<SWorkspaceRule>& getAllWorkspaceRules();
std::vector<SWindowRule> getMatchingRules(CWindow*);
std::vector<SLayerRule> getMatchingRules(SLayerSurface*);
std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas;
std::unordered_map<std::string, SAnimationPropertyConfig> getAnimationConfig();
void addPluginConfigVar(HANDLE handle, const std::string& name, const SConfigValue& value);
void removePluginConfig(HANDLE handle);
// no-op when done.
void dispatchExecOnce();
void dispatchExecOnce();
void performMonitorReload();
bool m_bWantsMonitorReload = false;
bool m_bForceReload = false;
void performMonitorReload();
bool m_bWantsMonitorReload = false;
bool m_bForceReload = false;
bool m_bNoMonitorReload = false;
void ensureMonitorStatus();
void ensureVRR(CMonitor* pMonitor = nullptr);
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);
private:
std::deque<std::string> configPaths; // stores all the config paths
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
std::unordered_map<std::string, std::string> configDynamicVars; // stores dynamic vars declared by the user
std::unordered_map<std::string, SConfigValue> configValues;
std::unordered_map<std::string, std::unordered_map<std::string, SConfigValue>> deviceConfigs; // stores device configs
void addParseError(const std::string&);
std::string configCurrentPath;
SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&);
std::string currentCategory = ""; // For storing the category of the current item
void addExecRule(const SExecRequestedRule&);
std::string parseError = ""; // For storing a parse error to display later
void handlePluginLoads();
std::string m_szCurrentSubmap = ""; // For storing the current keybind submap
std::string configCurrentPath;
bool isFirstLaunch = true; // For exec-once
private:
std::deque<std::string> configPaths; // stores all the config paths
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
std::vector<std::pair<std::string, std::string>> configDynamicVars; // stores dynamic vars declared by the user
std::unordered_map<std::string, SConfigValue> configValues;
std::unordered_map<std::string, std::unordered_map<std::string, SConfigValue>> deviceConfigs; // stores device configs
std::deque<SMonitorRule> m_dMonitorRules;
std::deque<SWindowRule> m_dWindowRules;
std::deque<std::string> m_dBlurLSNamespaces;
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values
bool firstExecDispatched = false;
std::deque<std::string> firstExecRequests;
std::string currentCategory = ""; // For storing the category of the current item
std::string parseError = ""; // For storing a parse error to display later
std::string m_szCurrentSubmap = ""; // For storing the current keybind submap
std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty
std::vector<std::string> m_vDeclaredPlugins;
std::unordered_map<HANDLE, std::unique_ptr<std::unordered_map<std::string, SConfigValue>>> pluginConfigs; // stores plugin configs
bool isFirstLaunch = true; // For exec-once
std::deque<SMonitorRule> m_dMonitorRules;
std::deque<SWorkspaceRule> m_dWorkspaceRules;
std::deque<SWindowRule> m_dWindowRules;
std::deque<SLayerRule> m_dLayerRules;
std::deque<std::string> m_dBlurLSNamespaces;
bool firstExecDispatched = false;
bool m_bManualCrashInitiated = false;
std::deque<std::string> firstExecRequests;
std::vector<std::pair<std::string, std::string>> environmentVariables;
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
// internal methods
void setDefaultVars();
void setDeviceDefaultVars(const std::string&);
void setDefaultVars();
void setDefaultAnimationVars();
void setDeviceDefaultVars(const std::string&);
void populateEnvironment();
void applyUserDefinedVars(std::string&, const size_t);
void loadConfigLoadVars();
SConfigValue getConfigValueSafe(const std::string&);
SConfigValue getConfigValueSafeDevice(const std::string&, const std::string&);
void parseLine(std::string&);
void configSetValueSafe(const std::string&, const std::string&);
void handleDeviceConfig(const std::string&, const std::string&);
void handleRawExec(const std::string&, const std::string&);
void handleMonitor(const std::string&, const std::string&);
void handleBind(const std::string&, const std::string&, bool locked = false);
void handleUnbind(const std::string&, const std::string&);
void handleWindowRule(const std::string&, const std::string&);
void handleDefaultWorkspace(const std::string&, const std::string&);
void handleBezier(const std::string&, const std::string&);
void handleAnimation(const std::string&, const std::string&);
void handleSource(const std::string&, const std::string&);
void handleSubmap(const std::string&, const std::string&);
void handleBlurLS(const std::string&, const std::string&);
void setAnimForChildren(SAnimationPropertyConfig* const);
void updateBlurredLS(const std::string&, const bool);
void applyUserDefinedVars(std::string&, const size_t);
void loadConfigLoadVars();
SConfigValue getConfigValueSafe(const std::string&);
SConfigValue getConfigValueSafeDevice(const std::string&, const std::string&, std::optional<bool> touchpad);
void parseLine(std::string&);
void configSetValueSafe(const std::string&, const std::string&);
void handleDeviceConfig(const std::string&, const std::string&);
void handleRawExec(const std::string&, const std::string&);
void handleMonitor(const std::string&, const std::string&);
void handleBind(const std::string&, const std::string&);
void handleUnbind(const std::string&, const std::string&);
void handleWindowRule(const std::string&, const std::string&);
void handleLayerRule(const std::string&, const std::string&);
void handleWindowRuleV2(const std::string&, const std::string&);
void handleWorkspaceRules(const std::string&, const std::string&);
void handleBezier(const std::string&, const std::string&);
void handleAnimation(const std::string&, const std::string&);
void handleSource(const std::string&, const std::string&);
void handleSubmap(const std::string&, const std::string&);
void handleBlurLS(const std::string&, const std::string&);
void handleBindWS(const std::string&, const std::string&);
void handleEnv(const std::string&, const std::string&);
void handlePlugin(const std::string&, const std::string&);
};
inline std::unique_ptr<CConfigManager> g_pConfigManager;
inline std::unique_ptr<CConfigManager> g_pConfigManager;

View File

@@ -9,106 +9,164 @@ PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
########################################################################################
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki (basic and advanced configuring)
# For a full list, see the wiki
#
autogenerated=1 # remove this line to get rid of the warning on top.
autogenerated = 1 # remove this line to remove the warning
monitor=,1920x1080@60,0x0,1
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,auto
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# Some default env vars.
env = XCURSOR_SIZE,24
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout=
kb_variant=
kb_model=
kb_options=
kb_rules=
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse=1
follow_mouse = 1
touchpad {
natural_scroll = no
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}
general {
sensitivity=1.0 # for mouse cursor
main_mod=SUPER
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in=5
gaps_out=20
border_size=2
col.active_border=0x66ee1111
col.inactive_border=0x66333333
gaps_in = 5
gaps_out = 20
border_size = 2
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = rgba(595959aa)
apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse)
damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer
layout = dwindle
}
decoration {
rounding=10
blur=1
blur_size=3 # minimum 1
blur_passes=1 # minimum 1, more passes = more resource intensive.
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
# if you want heavy blur, you need to up the blur_passes.
# the more passes, the more you can up the blur_size without noticing artifacts.
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10
blur = yes
blur_size = 3
blur_passes = 1
blur_new_optimizations = on
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled=1
animation=windows,1,7,default
animation=borders,1,10,default
animation=fadein,1,10,default
animation=workspaces,1,6,default
enabled = yes
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
dwindle {
pseudotile=0 # enable pseudotiling on dwindle
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = yes # you probably want this
}
# example window rules
# for windows named/classed as abc and xyz
#windowrule=move 69 420,abc
#windowrule=size 420 69,abc
#windowrule=tile,xyz
#windowrule=float,abc
#windowrule=pseudo,abc
#windowrule=monitor 0,xyz
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = true
}
# example binds
bind=SUPER,Q,exec,kitty
bind=SUPER,RETURN,exec,alacritty
bind=SUPER,C,killactive,
bind=SUPER,M,exit,
bind=SUPER,E,exec,dolphin
bind=SUPER,V,togglefloating,
bind=SUPER,R,exec,wofi --show drun -o DP-3
bind=SUPER,P,pseudo,
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = off
}
bind=SUPER,left,movefocus,l
bind=SUPER,right,movefocus,r
bind=SUPER,up,movefocus,u
bind=SUPER,down,movefocus,d
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
device:epic-mouse-v1 {
sensitivity = -0.5
}
bind=SUPER,1,workspace,1
bind=SUPER,2,workspace,2
bind=SUPER,3,workspace,3
bind=SUPER,4,workspace,4
bind=SUPER,5,workspace,5
bind=SUPER,6,workspace,6
bind=SUPER,7,workspace,7
bind=SUPER,8,workspace,8
bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
bind=ALT,1,movetoworkspace,1
bind=ALT,2,movetoworkspace,2
bind=ALT,3,movetoworkspace,3
bind=ALT,4,movetoworkspace,4
bind=ALT,5,movetoworkspace,5
bind=ALT,6,movetoworkspace,6
bind=ALT,7,movetoworkspace,7
bind=ALT,8,movetoworkspace,8
bind=ALT,9,movetoworkspace,9
bind=ALT,0,movetoworkspace,10
)#";
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, Q, exec, kitty
bind = $mainMod, C, killactive,
bind = $mainMod, M, exit,
bind = $mainMod, E, exec, dolphin
bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, wofi --show drun
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
)#";

167
src/debug/CrashReporter.cpp Normal file
View File

@@ -0,0 +1,167 @@
#include "CrashReporter.hpp"
#include <random>
#include <sys/utsname.h>
#include <execinfo.h>
#include <fstream>
#include <signal.h>
#include "../plugins/PluginSystem.hpp"
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/sysctl.h>
#endif
std::string getRandomMessage() {
const std::vector<std::string> MESSAGES = {"Sorry, didn't mean to...",
"This was an accident, I swear!",
"Calm down, it was a misinput! MISINPUT!",
"Oops",
"Vaxry is going to be upset.",
"Who tried dividing by zero?!",
"Maybe you should try dusting your PC in the meantime?",
"I tried so hard, and got so far...",
"I don't feel so good...",
"*thud*",
"Well this is awkward.",
"\"stable\"",
"I hope you didn't have any unsaved progress.",
"All these computers..."};
std::random_device dev;
std::mt19937 engine(dev());
std::uniform_int_distribution<> distribution(0, MESSAGES.size() - 1);
return MESSAGES[distribution(engine)];
}
void CrashReporter::createAndSaveCrash(int sig) {
// get the backtrace
const int PID = getpid();
std::string finalCrashReport = "";
finalCrashReport += "--------------------------------------------\n Hyprland Crash Report\n--------------------------------------------\n";
finalCrashReport += getRandomMessage() + "\n\n";
finalCrashReport += getFormat("Hyprland received signal %d (%s)\n\n", sig, strsignal(sig));
finalCrashReport += getFormat("Version: %s\nTag: %s\n\n", GIT_COMMIT_HASH, GIT_TAG);
if (g_pPluginSystem && !g_pPluginSystem->getAllPlugins().empty()) {
finalCrashReport += "Hyprland seems to be running with plugins. This crash might not be Hyprland's fault.\nPlugins:\n";
for (auto& p : g_pPluginSystem->getAllPlugins()) {
finalCrashReport += getFormat("\t%s (%s) %s\n", p->name.c_str(), p->author.c_str(), p->version.c_str());
}
finalCrashReport += "\n\n";
}
finalCrashReport += "System info:\n";
struct utsname unameInfo;
uname(&unameInfo);
finalCrashReport +=
getFormat("\tSystem name: %s\n\tNode name: %s\n\tRelease: %s\n\tVersion: %s\n\n", unameInfo.sysname, unameInfo.nodename, unameInfo.release, unameInfo.version);
#if defined(__DragonFly__) || defined(__FreeBSD__)
const std::string GPUINFO = execAndGet("pciconf -lv | fgrep -A4 vga");
#else
const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA");
#endif
finalCrashReport += "GPU:\n\t" + GPUINFO;
finalCrashReport += getFormat("\n\nos-release:\n\t%s\n\n\n", replaceInString(execAndGet("cat /etc/os-release"), "\n", "\n\t").c_str());
finalCrashReport += "Backtrace:\n";
void* bt[1024];
size_t btSize;
char** btSymbols;
btSize = backtrace(bt, 1024);
btSymbols = backtrace_symbols(bt, btSize);
#if defined(KERN_PROC_PATHNAME)
int mib[] = {
CTL_KERN,
#if defined(__NetBSD__)
KERN_PROC_ARGS,
-1,
KERN_PROC_PATHNAME,
#else
KERN_PROC,
KERN_PROC_PATHNAME,
-1,
#endif
};
u_int miblen = sizeof(mib) / sizeof(mib[0]);
char exe[PATH_MAX] = "";
size_t sz = sizeof(exe);
sysctl(mib, miblen, &exe, &sz, NULL, 0);
const auto FPATH = std::filesystem::canonical(exe);
#elif defined(__OpenBSD__)
// Neither KERN_PROC_PATHNAME nor /proc are supported
const auto FPATH = std::filesystem::canonical("/usr/local/bin/Hyprland");
#else
const auto FPATH = std::filesystem::canonical("/proc/self/exe");
#endif
for (size_t i = 0; i < btSize; ++i) {
finalCrashReport += getFormat("\t#%lu | %s\n", i, btSymbols[i]);
#ifdef __clang__
const auto CMD = getFormat("llvm-addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]);
#else
const auto CMD = getFormat("addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]);
#endif
const auto ADDR2LINE = replaceInString(execAndGet(CMD.c_str()), "\n", "\n\t\t");
finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2);
}
free(btSymbols);
finalCrashReport += "\n\nLog tail:\n";
finalCrashReport += execAndGet(("cat \"" + Debug::logFile + "\" | tail -n 50").c_str());
const auto HOME = getenv("HOME");
const auto CACHE_HOME = getenv("XDG_CACHE_HOME");
if (!HOME)
return;
std::ofstream ofs;
std::string path;
if (!CACHE_HOME) {
if (!std::filesystem::exists(std::string(HOME) + "/.hyprland")) {
std::filesystem::create_directory(std::string(HOME) + "/.hyprland");
std::filesystem::permissions(std::string(HOME) + "/.hyprland", std::filesystem::perms::all, std::filesystem::perm_options::replace);
}
path = std::string(HOME) + "/.hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt";
ofs.open(path, std::ios::trunc);
} else if (CACHE_HOME) {
if (!std::filesystem::exists(std::string(CACHE_HOME) + "/hyprland")) {
std::filesystem::create_directory(std::string(CACHE_HOME) + "/hyprland");
std::filesystem::permissions(std::string(CACHE_HOME) + "/hyprland", std::filesystem::perms::all, std::filesystem::perm_options::replace);
}
path = std::string(CACHE_HOME) + "/hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt";
ofs.open(path, std::ios::trunc);
} else {
return;
}
ofs << finalCrashReport;
ofs.close();
Debug::disableStdout = false;
Debug::log(CRIT, "Hyprland has crashed :( Consult the crash report at %s for more information.", path.c_str());
}

View File

@@ -0,0 +1,7 @@
#pragma once
#include "../defines.hpp"
namespace CrashReporter {
void createAndSaveCrash(int sig);
};

File diff suppressed because it is too large Load Diff

View File

@@ -5,13 +5,22 @@
#include "../helpers/MiscFunctions.hpp"
namespace HyprCtl {
void startHyprCtlSocket();
void tickHyprCtl();
void startHyprCtlSocket();
std::string makeDynamicCall(const std::string& input);
// very simple thread-safe request method
inline bool requestMade = false;
inline bool requestReady = false;
inline std::string request = "";
inline bool requestMade = false;
inline bool requestReady = false;
inline std::string request = "";
inline std::ifstream requestStream;
inline std::ifstream requestStream;
inline wl_event_source* hyprCtlTickSource = nullptr;
inline int iSocketFD = -1;
enum eHyprCtlOutputFormat {
FORMAT_NORMAL = 0,
FORMAT_JSON
};
};

View File

@@ -1,7 +1,7 @@
#include "HyprDebugOverlay.hpp"
#include "../Compositor.hpp"
void CHyprMonitorDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
m_dLastRenderTimes.push_back(µs / 1000.f);
if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
@@ -11,7 +11,7 @@ void CHyprMonitorDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
m_pMonitor = pMonitor;
}
void CHyprMonitorDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs) {
void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
m_dLastRenderTimesNoOverlay.push_back(µs / 1000.f);
if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
@@ -21,7 +21,7 @@ void CHyprMonitorDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs
m_pMonitor = pMonitor;
}
void CHyprMonitorDebugOverlay::frameData(SMonitor* pMonitor) {
void CHyprMonitorDebugOverlay::frameData(CMonitor* pMonitor) {
m_dLastFrametimes.push_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f);
if (m_dLastFrametimes.size() > (long unsigned int)pMonitor->refreshRate)
@@ -31,6 +31,15 @@ void CHyprMonitorDebugOverlay::frameData(SMonitor* pMonitor) {
if (!m_pMonitor)
m_pMonitor = pMonitor;
// anim data too
const auto PMONITORFORTICKS = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor : g_pCompositor->m_pLastMonitor;
if (PMONITORFORTICKS) {
if (m_dLastAnimationTicks.size() > (long unsigned int)PMONITORFORTICKS->refreshRate)
m_dLastAnimationTicks.pop_front();
m_dLastAnimationTicks.push_back(g_pAnimationManager->m_fLastTickTime);
}
}
int CHyprMonitorDebugOverlay::draw(int offset) {
@@ -38,34 +47,68 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
if (!m_pMonitor)
return 0;
int yOffset = offset;
int yOffset = offset;
cairo_text_extents_t cairoExtents;
float maxX = 0;
std::string text = "";
float maxX = 0;
std::string text = "";
// get avg fps
float avgFrametime = 0;
float maxFrametime = 0;
float minFrametime = 9999;
for (auto& ft : m_dLastFrametimes) {
if (ft > maxFrametime)
maxFrametime = ft;
if (ft < minFrametime)
minFrametime = ft;
avgFrametime += ft;
}
float varFrametime = maxFrametime - minFrametime;
avgFrametime /= m_dLastFrametimes.size() == 0 ? 1 : m_dLastFrametimes.size();
float avgRenderTime = 0;
float maxRenderTime = 0;
float minRenderTime = 9999;
for (auto& rt : m_dLastRenderTimes) {
if (rt > maxRenderTime)
maxRenderTime = rt;
if (rt < minRenderTime)
minRenderTime = rt;
avgRenderTime += rt;
}
float varRenderTime = maxRenderTime - minRenderTime;
avgRenderTime /= m_dLastRenderTimes.size() == 0 ? 1 : m_dLastRenderTimes.size();
float avgRenderTimeNoOverlay = 0;
float maxRenderTimeNoOverlay = 0;
float minRenderTimeNoOverlay = 9999;
for (auto& rt : m_dLastRenderTimesNoOverlay) {
if (rt > maxRenderTimeNoOverlay)
maxRenderTimeNoOverlay = rt;
if (rt < minRenderTimeNoOverlay)
minRenderTimeNoOverlay = rt;
avgRenderTimeNoOverlay += rt;
}
float varRenderTimeNoOverlay = maxRenderTimeNoOverlay - minRenderTimeNoOverlay;
avgRenderTimeNoOverlay /= m_dLastRenderTimes.size() == 0 ? 1 : m_dLastRenderTimes.size();
const float FPS = 1.f / (avgFrametime / 1000.f); // frametimes are in ms
float avgAnimMgrTick = 0;
float maxAnimMgrTick = 0;
float minAnimMgrTick = 9999;
for (auto& at : m_dLastAnimationTicks) {
if (at > maxAnimMgrTick)
maxAnimMgrTick = at;
if (at < minAnimMgrTick)
minAnimMgrTick = at;
avgAnimMgrTick += at;
}
float varAnimMgrTick = maxAnimMgrTick - minAnimMgrTick;
avgAnimMgrTick /= m_dLastAnimationTicks.size() == 0 ? 1 : m_dLastAnimationTicks.size();
const float FPS = 1.f / (avgFrametime / 1000.f); // frametimes are in ms
const float idealFPS = m_dLastFrametimes.size();
cairo_select_font_face(g_pDebugOverlay->m_pCairo, "Noto Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face(g_pDebugOverlay->m_pCairo, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 10);
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
@@ -75,7 +118,8 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
text = m_pMonitor->szName;
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
if (cairoExtents.width > maxX)
maxX = cairoExtents.width;
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 16);
@@ -88,53 +132,66 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 17;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
text = std::string(std::to_string((int)FPS) + " FPS");
text = std::string(getFormat("%i FPS", (int)FPS));
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
if (cairoExtents.width > maxX)
maxX = cairoExtents.width;
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 10);
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
text = std::string("Avg Frametime: " + std::to_string((int)avgFrametime) + "." + std::to_string((int)(avgFrametime * 10.f) % 10) + "ms");
text = std::string(getFormat("Avg Frametime: %.2fms (var %.2fms)", avgFrametime, varFrametime));
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
if (cairoExtents.width > maxX)
maxX = cairoExtents.width;
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
text = std::string("Avg Rendertime: " + std::to_string((int)avgRenderTime) + "." + std::to_string((int)(avgRenderTime * 10.f) % 10) + "ms");
text = std::string(getFormat("Avg Rendertime: %.2fms (var %.2fms)", avgRenderTime, varRenderTime));
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
if (cairoExtents.width > maxX)
maxX = cairoExtents.width;
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
text = std::string("Avg Rendertime (no overlay): " + std::to_string((int)avgRenderTimeNoOverlay) + "." + std::to_string((int)(avgRenderTimeNoOverlay * 10.f) % 10) + "ms");
text = std::string(getFormat("Avg Rendertime (No Overlay): %.2fms (var %.2fms)", avgRenderTimeNoOverlay, varRenderTimeNoOverlay));
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX) maxX = cairoExtents.width;
if (cairoExtents.width > maxX)
maxX = cairoExtents.width;
yOffset += 11;
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
text = std::string(getFormat("Avg Anim Tick: %.2fms (var %.2fms) (%.2f TPS)", avgAnimMgrTick, varAnimMgrTick, 1.0 / (avgAnimMgrTick / 1000.0)));
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
if (cairoExtents.width > maxX)
maxX = cairoExtents.width;
yOffset += 11;
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset - 1, (int)maxX + 2, yOffset - offset + 2};
m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset - 1, (int)maxX + 2,
yOffset - offset + 2};
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
return yOffset - offset;
}
void CHyprDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
m_mMonitorOverlays[pMonitor].renderData(pMonitor, µs);
}
void CHyprDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs) {
void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, µs);
}
void CHyprDebugOverlay::frameData(SMonitor* pMonitor) {
void CHyprDebugOverlay::frameData(CMonitor* pMonitor) {
m_mMonitorOverlays[pMonitor].frameData(pMonitor);
}
@@ -143,8 +200,8 @@ void CHyprDebugOverlay::draw() {
const auto PMONITOR = g_pCompositor->m_vMonitors.front().get();
if (!m_pCairoSurface || !m_pCairo) {
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
m_pCairo = cairo_create(m_pCairoSurface);
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
m_pCairo = cairo_create(m_pCairoSurface);
}
// clear the pixmap
@@ -174,8 +231,8 @@ void CHyprDebugOverlay::draw() {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
#endif
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecSize.x, PMONITOR->vecSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
wlr_box pMonBox = {0,0,PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 255.f);
wlr_box pMonBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
}

View File

@@ -7,41 +7,45 @@
#include <cairo/cairo.h>
#include <unordered_map>
class CHyprRenderer;
class CHyprMonitorDebugOverlay {
public:
int draw(int offset);
public:
int draw(int offset);
void renderData(SMonitor* pMonitor, float µs);
void renderDataNoOverlay(SMonitor* pMonitor, float µs);
void frameData(SMonitor* pMonitor);
void renderData(CMonitor* pMonitor, float µs);
void renderDataNoOverlay(CMonitor* pMonitor, float µs);
void frameData(CMonitor* pMonitor);
private:
std::deque<float> m_dLastFrametimes;
std::deque<float> m_dLastRenderTimes;
std::deque<float> m_dLastRenderTimesNoOverlay;
private:
std::deque<float> m_dLastFrametimes;
std::deque<float> m_dLastRenderTimes;
std::deque<float> m_dLastRenderTimesNoOverlay;
std::deque<float> m_dLastAnimationTicks;
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
SMonitor* m_pMonitor = nullptr;
wlr_box m_wbLastDrawnBox;
CMonitor* m_pMonitor = nullptr;
wlr_box m_wbLastDrawnBox;
friend class CHyprRenderer;
};
class CHyprDebugOverlay {
public:
public:
void draw();
void renderData(SMonitor*, float µs);
void renderDataNoOverlay(SMonitor*, float µs);
void frameData(SMonitor*);
void renderData(CMonitor*, float µs);
void renderDataNoOverlay(CMonitor*, float µs);
void frameData(CMonitor*);
private:
private:
std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
std::unordered_map<SMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
CTexture m_tTexture;
CTexture m_tTexture;
friend class CHyprMonitorDebugOverlay;
friend class CHyprRenderer;
};
inline std::unique_ptr<CHyprDebugOverlay> g_pDebugOverlay;

View File

@@ -0,0 +1,225 @@
#include "HyprNotificationOverlay.hpp"
#include "../Compositor.hpp"
#include <pango/pangocairo.h>
CHyprNotificationOverlay::CHyprNotificationOverlay() {
g_pHookSystem->hookDynamic("focusedMon", [&](void* self, std::any param) {
if (m_dNotifications.size() == 0)
return;
g_pHyprRenderer->damageBox(&m_bLastDamage);
});
// check for the icon backend
std::string fonts = execAndGet("fc-list");
std::string fontsLower = fonts;
std::transform(fontsLower.begin(), fontsLower.end(), fontsLower.begin(), [&](char& i) { return std::tolower(i); });
size_t index = 0;
if (index = fontsLower.find("nerd"); index != std::string::npos) {
m_eIconBackend = ICONS_BACKEND_NF;
} else if (index = fontsLower.find("font awesome"); index != std::string::npos) {
m_eIconBackend = ICONS_BACKEND_FA;
} else if (index = fontsLower.find("fontawesome"); index != std::string::npos) {
m_eIconBackend = ICONS_BACKEND_FA;
} else {
return;
}
const auto LASTNEWLINE = fonts.find_last_of('\n', index);
const auto COLON = fonts.find(':', LASTNEWLINE);
const auto COMMA = fonts.find(',', COLON);
const auto NEWLINE = fonts.find('\n', COLON);
const auto LASTCHAR = COMMA < NEWLINE ? COMMA : NEWLINE;
m_szIconFontName = fonts.substr(COLON + 2, LASTCHAR - (COLON + 2));
}
void CHyprNotificationOverlay::addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon) {
const auto PNOTIF = m_dNotifications.emplace_back(std::make_unique<SNotification>()).get();
PNOTIF->text = text;
PNOTIF->color = color == CColor(0) ? ICONS_COLORS[icon] : color;
PNOTIF->started.reset();
PNOTIF->timeMs = timeMs;
PNOTIF->icon = icon;
}
wlr_box CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
static constexpr auto ANIM_DURATION_MS = 600.0;
static constexpr auto ANIM_LAG_MS = 100.0;
static constexpr auto NOTIF_LEFTBAR_SIZE = 5.0;
static constexpr auto ICON_PAD = 3.0;
static constexpr auto ICON_SCALE = 0.9;
static constexpr auto GRADIENT_SIZE = 60.0;
float offsetY = 10;
float maxWidth = 0;
const auto SCALE = pMonitor->scale;
const auto FONTSIZE = std::clamp((int)(13.f * ((pMonitor->vecPixelSize.x * SCALE) / 1920.f)), 8, 40);
const auto MONSIZE = pMonitor->vecPixelSize;
cairo_text_extents_t cairoExtents;
int iconW = 0, iconH = 0;
PangoLayout* pangoLayout;
PangoFontDescription* pangoFD;
pangoLayout = pango_cairo_create_layout(m_pCairo);
pangoFD = pango_font_description_from_string(("Sans " + std::to_string(FONTSIZE * ICON_SCALE)).c_str());
pango_layout_set_font_description(pangoLayout, pangoFD);
cairo_select_font_face(m_pCairo, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(m_pCairo, FONTSIZE);
const auto PBEZIER = g_pAnimationManager->getBezier("default");
for (auto& notif : m_dNotifications) {
const auto ICONPADFORNOTIF = notif->icon == ICON_NONE ? 0 : ICON_PAD;
// first rect (bg, col)
const float FIRSTRECTANIMP =
(notif->started.getMillis() > (ANIM_DURATION_MS - ANIM_LAG_MS) ?
(notif->started.getMillis() > notif->timeMs - (ANIM_DURATION_MS - ANIM_LAG_MS) ? notif->timeMs - notif->started.getMillis() : (ANIM_DURATION_MS - ANIM_LAG_MS)) :
notif->started.getMillis()) /
(ANIM_DURATION_MS - ANIM_LAG_MS);
const float FIRSTRECTPERC = FIRSTRECTANIMP >= 0.99f ? 1.f : PBEZIER->getYForPoint(FIRSTRECTANIMP);
// second rect (fg, black)
const float SECONDRECTANIMP = (notif->started.getMillis() > ANIM_DURATION_MS ?
(notif->started.getMillis() > notif->timeMs - ANIM_DURATION_MS ? notif->timeMs - notif->started.getMillis() : ANIM_DURATION_MS) :
notif->started.getMillis()) /
ANIM_DURATION_MS;
const float SECONDRECTPERC = SECONDRECTANIMP >= 0.99f ? 1.f : PBEZIER->getYForPoint(SECONDRECTANIMP);
// third rect (horiz, col)
const float THIRDRECTPERC = notif->started.getMillis() / notif->timeMs;
// get text size
cairo_text_extents(m_pCairo, notif->text.c_str(), &cairoExtents);
const auto ICON = ICONS_ARRAY[m_eIconBackend][notif->icon];
const auto ICONCOLOR = ICONS_COLORS[notif->icon];
pango_layout_set_text(pangoLayout, ICON.c_str(), -1);
pango_layout_set_font_description(pangoLayout, pangoFD);
pango_cairo_update_layout(m_pCairo, pangoLayout);
pango_layout_get_size(pangoLayout, &iconW, &iconH);
iconW /= PANGO_SCALE;
iconH /= PANGO_SCALE;
cairo_set_source_rgba(m_pCairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
const auto NOTIFSIZE = Vector2D{cairoExtents.width + 20 + iconW + 2 * ICONPADFORNOTIF, cairoExtents.height + 10};
// draw rects
cairo_rectangle(m_pCairo, MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, offsetY, (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, NOTIFSIZE.y);
cairo_fill(m_pCairo);
cairo_set_source_rgb(m_pCairo, 0.f, 0.f, 0.f);
cairo_rectangle(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC, offsetY, NOTIFSIZE.x * SECONDRECTPERC, NOTIFSIZE.y);
cairo_fill(m_pCairo);
cairo_set_source_rgba(m_pCairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
cairo_rectangle(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + 3, offsetY + NOTIFSIZE.y - 4, THIRDRECTPERC * (NOTIFSIZE.x - 6), 2);
cairo_fill(m_pCairo);
// draw gradient
if (notif->icon != ICON_NONE) {
cairo_pattern_t* pattern;
pattern = cairo_pattern_create_linear(MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, offsetY,
MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC + GRADIENT_SIZE, offsetY);
cairo_pattern_add_color_stop_rgba(pattern, 0, ICONCOLOR.r, ICONCOLOR.g, ICONCOLOR.b, ICONCOLOR.a / 3.0);
cairo_pattern_add_color_stop_rgba(pattern, 1, ICONCOLOR.r, ICONCOLOR.g, ICONCOLOR.b, 0);
cairo_rectangle(m_pCairo, MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, offsetY, GRADIENT_SIZE, NOTIFSIZE.y);
cairo_set_source(m_pCairo, pattern);
cairo_fill(m_pCairo);
cairo_pattern_destroy(pattern);
// draw icon
cairo_set_source_rgb(m_pCairo, 1.f, 1.f, 1.f);
cairo_move_to(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + ICONPADFORNOTIF - 1, offsetY + std::round((NOTIFSIZE.y - iconH - 4) / 2.0));
pango_cairo_show_layout(m_pCairo, pangoLayout);
}
// draw text
cairo_set_font_size(m_pCairo, FONTSIZE);
cairo_set_source_rgb(m_pCairo, 1.f, 1.f, 1.f);
cairo_move_to(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + iconW + 2 * ICONPADFORNOTIF, offsetY + FONTSIZE + (FONTSIZE / 10.0));
cairo_show_text(m_pCairo, notif->text.c_str());
// adjust offset and move on
offsetY += NOTIFSIZE.y + 10;
if (maxWidth < NOTIFSIZE.x)
maxWidth = NOTIFSIZE.x;
}
pango_font_description_free(pangoFD);
g_object_unref(pangoLayout);
// cleanup notifs
std::erase_if(m_dNotifications, [](const auto& notif) { return notif->started.getMillis() > notif->timeMs; });
return wlr_box{(int)(pMonitor->vecPosition.x + pMonitor->vecSize.x - maxWidth - 20), (int)pMonitor->vecPosition.y, (int)maxWidth + 20, (int)offsetY + 10};
}
void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
if (m_pLastMonitor != pMonitor || !m_pCairo || !m_pCairoSurface) {
if (m_pCairo && m_pCairoSurface) {
cairo_destroy(m_pCairo);
cairo_surface_destroy(m_pCairoSurface);
}
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
m_pCairo = cairo_create(m_pCairoSurface);
m_pLastMonitor = pMonitor;
}
// Draw the notifications
if (m_dNotifications.size() == 0)
return;
// Render to the monitor
// clear the pixmap
cairo_save(m_pCairo);
cairo_set_operator(m_pCairo, CAIRO_OPERATOR_CLEAR);
cairo_paint(m_pCairo);
cairo_restore(m_pCairo);
cairo_surface_flush(m_pCairoSurface);
wlr_box damage = drawNotifications(pMonitor);
g_pHyprRenderer->damageBox(&damage);
g_pHyprRenderer->damageBox(&m_bLastDamage);
g_pCompositor->scheduleFrameForMonitor(pMonitor);
m_bLastDamage = damage;
// copy the data to an OpenGL texture we have
const auto DATA = cairo_image_surface_get_data(m_pCairoSurface);
m_tTexture.allocate();
glBindTexture(GL_TEXTURE_2D, m_tTexture.m_iTexID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
#ifndef GLES2
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
#endif
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
wlr_box pMonBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
}

View File

@@ -0,0 +1,63 @@
#pragma once
#include "../defines.hpp"
#include "../helpers/Timer.hpp"
#include "../helpers/Monitor.hpp"
#include "../render/Texture.hpp"
#include "../SharedDefs.hpp"
#include <deque>
#include <cairo/cairo.h>
enum eIconBackend
{
ICONS_BACKEND_NONE = 0,
ICONS_BACKEND_NF,
ICONS_BACKEND_FA
};
static const std::array<std::array<std::string, ICON_NONE + 1>, 3 /* backends */> ICONS_ARRAY = {
std::array<std::string, ICON_NONE + 1>{"[!]", "[i]", "[Hint]", "[Err]", "[?]", "[ok]", ""}, std::array<std::string, ICON_NONE + 1>{"", "", "", "", "", "󰸞", ""},
std::array<std::string, ICON_NONE + 1>{"", "", "", "", "", ""}};
static const std::array<CColor, ICON_NONE + 1> ICONS_COLORS = {CColor{255.0 / 255.0, 204 / 255.0, 102 / 255.0, 1.0},
CColor{128 / 255.0, 255 / 255.0, 255 / 255.0, 1.0},
CColor{179 / 255.0, 255 / 255.0, 204 / 255.0, 1.0},
CColor{255 / 255.0, 77 / 255.0, 77 / 255.0, 1.0},
CColor{255 / 255.0, 204 / 255.0, 153 / 255.0, 1.0},
CColor{128 / 255.0, 255 / 255.0, 128 / 255.0, 1.0},
CColor{0, 0, 0, 1.0}};
struct SNotification {
std::string text = "";
CColor color;
CTimer started;
float timeMs = 0;
eIcons icon = ICON_NONE;
};
class CHyprNotificationOverlay {
public:
CHyprNotificationOverlay();
void draw(CMonitor* pMonitor);
void addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon = ICON_NONE);
private:
wlr_box drawNotifications(CMonitor* pMonitor);
wlr_box m_bLastDamage;
std::deque<std::unique_ptr<SNotification>> m_dNotifications;
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;
CMonitor* m_pLastMonitor = nullptr;
CTexture m_tTexture;
eIconBackend m_eIconBackend = ICONS_BACKEND_NONE;
std::string m_szIconFontName = "Sans";
};
inline std::unique_ptr<CHyprNotificationOverlay> g_pHyprNotificationOverlay;

View File

@@ -5,11 +5,27 @@
#include <fstream>
#include <iostream>
void Debug::init(std::string IS) {
if (ISDEBUG)
logFile = "/tmp/hypr/" + IS + "/hyprlandd.log";
else
logFile = "/tmp/hypr/" + IS + "/hyprland.log";
void Debug::init(const std::string& IS) {
logFile = "/tmp/hypr/" + IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
}
void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
char* outputStr = nullptr;
std::ofstream ofs;
ofs.open(logFile, std::ios::out | std::ios::app);
vasprintf(&outputStr, fmt, args);
std::string output = std::string(outputStr);
free(outputStr);
ofs << "[wlr] " << output << "\n";
ofs.close();
if (!disableStdout)
std::cout << output << "\n";
}
void Debug::log(LogLevel level, const char* fmt, ...) {
@@ -22,56 +38,46 @@ void Debug::log(LogLevel level, const char* fmt, ...) {
ofs.open(logFile, std::ios::out | std::ios::app);
switch (level) {
case LOG:
ofs << "[LOG] ";
break;
case WARN:
ofs << "[WARN] ";
break;
case ERR:
ofs << "[ERR] ";
break;
case CRIT:
ofs << "[CRITICAL] ";
break;
case INFO:
ofs << "[INFO] ";
break;
default:
break;
case LOG: ofs << "[LOG] "; break;
case WARN: ofs << "[WARN] "; break;
case ERR: ofs << "[ERR] "; break;
case CRIT: ofs << "[CRITICAL] "; break;
case INFO: ofs << "[INFO] "; break;
default: break;
}
char buf[LOGMESSAGESIZE] = "";
char* outputStr;
int logLen;
// print date and time to the ofs
if (disableTime && !*disableTime) {
auto timet = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
const auto MILLIS = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() % 1000;
ofs << std::put_time(std::localtime(&timet), "[%H:%M:%S:");
if (MILLIS > 99)
ofs << MILLIS;
else if (MILLIS > 9)
ofs << "0" << MILLIS;
else
ofs << "00" << MILLIS;
ofs << "] ";
}
char* outputStr = nullptr;
va_list args;
va_start(args, fmt);
logLen = vsnprintf(buf, sizeof buf, fmt, args);
vasprintf(&outputStr, fmt, args);
va_end(args);
if ((long unsigned int)logLen < sizeof buf) {
outputStr = strdup(buf);
} else {
outputStr = (char*)malloc(logLen + 1);
std::string output = std::string(outputStr);
free(outputStr);
if (!outputStr) {
printf("CRITICAL: Cannot alloc size %d for log! (Out of memory?)", logLen + 1);
return;
}
va_start(args, fmt);
vsnprintf(outputStr, logLen + 1U, fmt, args);
va_end(args);
}
ofs << outputStr << "\n";
ofs << output << "\n";
ofs.close();
// log it to the stdout too.
std::cout << outputStr << "\n";
// free the log
free(outputStr);
if (!disableStdout)
std::cout << output << "\n";
}

View File

@@ -1,11 +1,13 @@
#pragma once
#include <string>
#include <wlr/util/log.h>
#define LOGMESSAGESIZE 1024
enum LogLevel {
enum LogLevel
{
NONE = -1,
LOG = 0,
LOG = 0,
WARN,
ERR,
CRIT,
@@ -13,9 +15,12 @@ enum LogLevel {
};
namespace Debug {
void init(std::string IS);
void log(LogLevel level, const char* fmt, ...);
void init(const std::string& IS);
void log(LogLevel level, const char* fmt, ...);
void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
inline std::string logFile;
inline int64_t* disableLogs = nullptr;
inline int64_t* disableLogs = nullptr;
inline int64_t* disableTime = nullptr;
inline bool disableStdout = false;
};

View File

@@ -4,7 +4,7 @@
#include "helpers/WLListener.hpp"
#include "helpers/Color.hpp"
#include "wlrunstable/wlr_ext_workspace_v1.hpp"
#include <utility>
#ifndef NDEBUG
#ifdef HYPRLAND_DEBUG
@@ -16,37 +16,44 @@
#define ISDEBUG false
#endif
#define LISTENER(name) void listener_##name(wl_listener*, void*); inline wl_listener listen_##name = { .notify = listener_##name };
#define DYNLISTENFUNC(name) void listener_##name(void*, void*);
#define DYNLISTENER(name) CHyprWLListener hyprListener_##name;
#define DYNMULTILISTENER(name) wl_listener listen_##name;
#define LISTENER(name) \
void listener_##name(wl_listener*, void*); \
inline wl_listener listen_##name = {.notify = listener_##name}
#define DYNLISTENFUNC(name) void listener_##name(void*, void*)
#define DYNLISTENER(name) CHyprWLListener hyprListener_##name
#define DYNMULTILISTENER(name) wl_listener listen_##name
#define VECINRECT(vec, x1, y1, x2, y2) (vec.x >= (x1) && vec.x <= (x2) && vec.y >= (y1) && vec.y <= (y2))
#define VECINRECT(vec, x1, y1, x2, y2) ((vec).x >= (x1) && (vec).x <= (x2) && (vec).y >= (y1) && (vec).y <= (y2))
#define DELTALESSTHAN(a, b, delta) (abs((a) - (b)) < delta)
#define DELTALESSTHAN(a, b, delta) (abs((a) - (b)) < (delta))
#define PIXMAN_DAMAGE_FOREACH(region) int rectsNum = 0; \
const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \
#define PIXMAN_DAMAGE_FOREACH(region) \
int rectsNum = 0; \
const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \
for (int i = 0; i < rectsNum; ++i)
#define PIXMAN_REGION_FOREACH(region) PIXMAN_DAMAGE_FOREACH(region)
#define interface class
#define STICKS(a, b) abs((a) - (b)) < 2
#define ALPHA(c) ((double)(((c) >> 24) & 0xff) / 255.0)
#define RED(c) ((double)(((c) >> 16) & 0xff) / 255.0)
#define RED(c) ((double)(((c) >> 16) & 0xff) / 255.0)
#define GREEN(c) ((double)(((c) >> 8) & 0xff) / 255.0)
#define BLUE(c) ((double)(((c)) & 0xff) / 255.0)
#define BLUE(c) ((double)(((c)) & 0xff) / 255.0)
#define HYPRATOM(name) {name, 0}
#define HYPRATOM(name) \
{ name, 0 }
#ifndef __INTELLISENSE__
#define RASSERT(expr, reason, ...) \
if (!(expr)) { \
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", getFormat(reason, ##__VA_ARGS__).c_str(), __LINE__, ([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \
printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
*((int*)nullptr) = 1; /* so that we crash and get a coredump */ \
#define RASSERT(expr, reason, ...) \
if (!(expr)) { \
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", \
getFormat(reason, ##__VA_ARGS__).c_str(), __LINE__, \
([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \
printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
*((int*)nullptr) = 1; /* so that we crash and get a coredump */ \
}
#else
#define RASSERT(expr, reason, ...)
@@ -54,6 +61,16 @@
#define ASSERT(expr) RASSERT(expr, "?")
#if ISDEBUG
#define UNREACHABLE() \
{ \
Debug::log(CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); \
*((int*)nullptr) = 1; \
}
#else
#define UNREACHABLE() std::unreachable();
#endif
// git stuff
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "?"
@@ -67,5 +84,10 @@
#ifndef GIT_DIRTY
#define GIT_DIRTY "?"
#endif
#ifndef GIT_TAG
#define GIT_TAG "?"
#endif
#define SPECIAL_WORKSPACE_ID -99
#define SPECIAL_WORKSPACE_START (-99)
#define PI 3.14159265358979

View File

@@ -19,7 +19,7 @@ void Events::listener_keyboardDestroy(void* owner, void* data) {
SKeyboard* PKEYBOARD = (SKeyboard*)owner;
g_pInputManager->destroyKeyboard(PKEYBOARD);
Debug::log(LOG, "Destroyed keyboard %x", PKEYBOARD);
Debug::log(LOG, "Destroyed keyboard %lx", PKEYBOARD);
}
void Events::listener_keyboardKey(void* owner, void* data) {
@@ -49,9 +49,7 @@ void Events::listener_mouseButton(wl_listener* listener, void* data) {
}
void Events::listener_mouseAxis(wl_listener* listener, void* data) {
const auto E = (wlr_pointer_axis_event*)data;
wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, E->time_msec, E->orientation, E->delta, E->delta_discrete, E->source);
g_pInputManager->onMouseWheel((wlr_pointer_axis_event*)data);
}
void Events::listener_requestMouse(wl_listener* listener, void* data) {
@@ -63,7 +61,7 @@ void Events::listener_requestMouse(wl_listener* listener, void* data) {
void Events::listener_newInput(wl_listener* listener, void* data) {
const auto DEVICE = (wlr_input_device*)data;
switch(DEVICE->type) {
switch (DEVICE->type) {
case WLR_INPUT_DEVICE_KEYBOARD:
Debug::log(LOG, "Attached a keyboard with name %s", DEVICE->name);
g_pInputManager->newKeyboard(DEVICE);
@@ -74,8 +72,7 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
break;
case WLR_INPUT_DEVICE_TOUCH:
Debug::log(LOG, "Attached a touch device with name %s", DEVICE->name);
Debug::log(WARN, "!!!! Hyprland does not directly support touchscreens, bugs may occur !!!!");
wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, DEVICE);
g_pInputManager->newTouchDevice(DEVICE);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
Debug::log(LOG, "Attached a tablet tool with name %s", DEVICE->name);
@@ -85,23 +82,25 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
Debug::log(LOG, "Attached a tablet pad with name %s", DEVICE->name);
g_pInputManager->newTabletPad(DEVICE);
break;
default:
Debug::log(WARN, "Unrecognized input device plugged in: %s", DEVICE->name);
case WLR_INPUT_DEVICE_SWITCH:
Debug::log(LOG, "Attached a switch device with name %s", DEVICE->name);
g_pInputManager->newSwitch(DEVICE);
break;
default: Debug::log(WARN, "Unrecognized input device plugged in: %s", DEVICE->name); break;
}
g_pInputManager->updateCapabilities(DEVICE);
g_pInputManager->updateCapabilities();
}
void Events::listener_newConstraint(wl_listener* listener, void* data) {
const auto PCONSTRAINT = (wlr_pointer_constraint_v1*)data;
Debug::log(LOG, "New mouse constraint at %x", PCONSTRAINT);
Debug::log(LOG, "New mouse constraint at %lx", PCONSTRAINT);
g_pInputManager->m_lConstraints.emplace_back();
const auto CONSTRAINT = &g_pInputManager->m_lConstraints.back();
CONSTRAINT->pMouse = g_pCompositor->m_sSeat.mouse;
CONSTRAINT->pMouse = g_pCompositor->m_sSeat.mouse;
CONSTRAINT->constraint = PCONSTRAINT;
CONSTRAINT->hyprListener_destroyConstraint.initCallback(&PCONSTRAINT->events.destroy, &Events::listener_destroyConstraint, CONSTRAINT, "Constraint");
@@ -109,6 +108,9 @@ void Events::listener_newConstraint(wl_listener* listener, void* data) {
if (g_pCompositor->m_pLastFocus == PCONSTRAINT->surface) {
g_pInputManager->constrainMouse(CONSTRAINT->pMouse, PCONSTRAINT);
if (!CONSTRAINT->hintSet)
CONSTRAINT->positionHint = Vector2D{-1, -1};
}
}
@@ -120,24 +122,24 @@ void Events::listener_destroyConstraint(void* owner, void* data) {
const auto PWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse);
if (PWINDOW) {
if (PWINDOW && PCONSTRAINT->positionHint != Vector2D{-1, -1}) {
if (PWINDOW->m_bIsX11) {
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr,
PCONSTRAINT->constraint->current.cursor_hint.x + PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y + PCONSTRAINT->constraint->current.cursor_hint.y);
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, PCONSTRAINT->positionHint.x + PWINDOW->m_uSurface.xwayland->x,
PWINDOW->m_uSurface.xwayland->y + PCONSTRAINT->positionHint.y);
wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->constraint->current.cursor_hint.x, PCONSTRAINT->constraint->current.cursor_hint.y);
wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->positionHint.x, PCONSTRAINT->positionHint.y);
} else {
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr,
PCONSTRAINT->constraint->current.cursor_hint.x + PWINDOW->m_vRealPosition.vec().x, PCONSTRAINT->constraint->current.cursor_hint.y + PWINDOW->m_vRealPosition.vec().y);
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, PCONSTRAINT->positionHint.x + PWINDOW->m_vRealPosition.vec().x,
PCONSTRAINT->positionHint.y + PWINDOW->m_vRealPosition.vec().y);
wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->constraint->current.cursor_hint.x, PCONSTRAINT->constraint->current.cursor_hint.y);
wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->positionHint.x, PCONSTRAINT->positionHint.y);
}
}
PCONSTRAINT->pMouse->currentConstraint = nullptr;
}
Debug::log(LOG, "Unconstrained mouse from %x", PCONSTRAINT->constraint);
Debug::log(LOG, "Unconstrained mouse from %lx", PCONSTRAINT->constraint);
g_pInputManager->m_lConstraints.remove(*PCONSTRAINT);
}
@@ -147,9 +149,9 @@ void Events::listener_setConstraintRegion(void* owner, void* data) {
}
void Events::listener_newVirtPtr(wl_listener* listener, void* data) {
const auto EV = (wlr_virtual_pointer_v1_new_pointer_event*)data;
const auto EV = (wlr_virtual_pointer_v1_new_pointer_event*)data;
const auto POINTER = EV->new_pointer;
const auto DEVICE = &POINTER->pointer.base;
const auto DEVICE = &POINTER->pointer.base;
g_pInputManager->newMouse(DEVICE, true);
}
@@ -177,3 +179,48 @@ void Events::listener_swipeEnd(wl_listener* listener, void* data) {
g_pInputManager->onSwipeEnd(EVENT);
}
void Events::listener_pinchBegin(wl_listener* listener, void* data) {
const auto EV = (wlr_pointer_pinch_begin_event*)data;
wlr_pointer_gestures_v1_send_pinch_begin(g_pCompositor->m_sWLRPointerGestures, g_pCompositor->m_sSeat.seat, EV->time_msec, EV->fingers);
}
void Events::listener_pinchUpdate(wl_listener* listener, void* data) {
const auto EV = (wlr_pointer_pinch_update_event*)data;
wlr_pointer_gestures_v1_send_pinch_update(g_pCompositor->m_sWLRPointerGestures, g_pCompositor->m_sSeat.seat, EV->time_msec, EV->dx, EV->dy, EV->scale, EV->rotation);
}
void Events::listener_pinchEnd(wl_listener* listener, void* data) {
const auto EV = (wlr_pointer_pinch_end_event*)data;
wlr_pointer_gestures_v1_send_pinch_end(g_pCompositor->m_sWLRPointerGestures, g_pCompositor->m_sSeat.seat, EV->time_msec, EV->cancelled);
}
void Events::listener_newVirtualKeyboard(wl_listener* listener, void* data) {
const auto WLRKB = (wlr_virtual_keyboard_v1*)data;
g_pInputManager->newVirtualKeyboard(&WLRKB->keyboard.base);
}
void Events::listener_touchBegin(wl_listener* listener, void* data) {
g_pInputManager->onTouchDown((wlr_touch_down_event*)data);
}
void Events::listener_touchEnd(wl_listener* listener, void* data) {
g_pInputManager->onTouchUp((wlr_touch_up_event*)data);
}
void Events::listener_touchUpdate(wl_listener* listener, void* data) {
g_pInputManager->onTouchMove((wlr_touch_motion_event*)data);
}
void Events::listener_touchFrame(wl_listener* listener, void* data) {
wlr_seat_touch_notify_frame(g_pCompositor->m_sSeat.seat);
}
void Events::listener_holdBegin(wl_listener* listener, void* data) {
g_pInputManager->onPointerHoldBegin((wlr_pointer_hold_begin_event*)data);
}
void Events::listener_holdEnd(wl_listener* listener, void* data) {
g_pInputManager->onPointerHoldEnd((wlr_pointer_hold_end_event*)data);
}

View File

@@ -12,6 +12,9 @@ namespace Events {
LISTENER(change);
LISTENER(newOutput);
// DRM events
LISTENER(leaseRequest);
// Layer events
LISTENER(newLayerSurface);
DYNLISTENFUNC(destroyLayerSurface);
@@ -28,7 +31,7 @@ namespace Events {
DYNLISTENFUNC(commitSubsurface);
// Popups
DYNLISTENFUNC(newPopup); // LayerSurface
DYNLISTENFUNC(newPopup); // LayerSurface
DYNLISTENFUNC(newPopupXDG);
DYNLISTENFUNC(mapPopupXDG);
@@ -39,6 +42,7 @@ namespace Events {
// Surface XDG (window)
LISTENER(newXDGSurface);
LISTENER(activateXDG);
// Window events
DYNLISTENFUNC(commitWindow);
@@ -50,9 +54,16 @@ namespace Events {
DYNLISTENFUNC(activateX11);
DYNLISTENFUNC(configureX11);
DYNLISTENFUNC(unmanagedSetGeometry);
DYNLISTENFUNC(requestMove);
DYNLISTENFUNC(requestResize);
DYNLISTENFUNC(requestMinimize);
DYNLISTENFUNC(requestMaximize);
DYNLISTENFUNC(setOverrideRedirect);
DYNLISTENFUNC(associateX11);
DYNLISTENFUNC(dissociateX11);
// Window subsurfaces
// LISTENER(newSubsurfaceWindow);
// LISTENER(newSubsurfaceWindow);
// Input events
LISTENER(mouseMove);
@@ -60,7 +71,7 @@ namespace Events {
LISTENER(mouseButton);
LISTENER(mouseAxis);
LISTENER(mouseFrame);
LISTENER(newInput);
// Virt Ptr
@@ -70,7 +81,7 @@ namespace Events {
DYNLISTENFUNC(keyboardKey);
DYNLISTENFUNC(keyboardMod);
DYNLISTENFUNC(keyboardDestroy);
DYNLISTENFUNC(commitConstraint);
LISTENER(newConstraint);
DYNLISTENFUNC(setConstraintRegion);
@@ -80,7 +91,6 @@ namespace Events {
LISTENER(requestMouse);
LISTENER(requestSetSel);
LISTENER(requestSetPrimarySel);
DYNLISTENFUNC(activate);
// outputMgr
LISTENER(outputMgrApply);
@@ -89,6 +99,11 @@ namespace Events {
// Monitor part 2 the sequel
DYNLISTENFUNC(monitorFrame);
DYNLISTENFUNC(monitorDestroy);
DYNLISTENFUNC(monitorStateRequest);
DYNLISTENFUNC(monitorDamage);
DYNLISTENFUNC(monitorNeedsFrame);
DYNLISTENFUNC(monitorCommit);
DYNLISTENFUNC(monitorBind);
// XWayland
LISTENER(readyXWayland);
@@ -116,7 +131,43 @@ namespace Events {
LISTENER(newIdleInhibitor);
// session
LISTENER(sessionActive);
// Touchpad shit
LISTENER(swipeBegin);
LISTENER(swipeEnd);
LISTENER(swipeUpdate);
};
LISTENER(pinchBegin);
LISTENER(pinchUpdate);
LISTENER(pinchEnd);
// Power
LISTENER(powerMgrSetMode);
// IME
LISTENER(newIME);
LISTENER(newTextInput);
LISTENER(newVirtualKeyboard);
// IME Popups
DYNLISTENFUNC(mapInputPopup);
DYNLISTENFUNC(unmapInputPopup);
DYNLISTENFUNC(commitInputPopup);
DYNLISTENFUNC(destroyInputPopup);
// Touch
LISTENER(touchBegin);
LISTENER(touchEnd);
LISTENER(touchUpdate);
LISTENER(touchFrame);
LISTENER(holdBegin);
LISTENER(holdEnd);
// Session Lock
LISTENER(newSessionLock);
// Gamma control
LISTENER(setGamma);
};

View File

@@ -31,47 +31,58 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
WLRLAYERSURFACE->output = PMONITOR->output;
}
const auto PMONITOR = (SMonitor*)g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output);
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].emplace_back(new SLayerSurface());
auto PMONITOR = (CMonitor*)g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output);
if (!WLRLAYERSURFACE->output || !PMONITOR || PMONITOR->pMirrorOf) {
PMONITOR = g_pCompositor->m_vMonitors.front().get();
WLRLAYERSURFACE->output = PMONITOR->output; // TODO: current mon
}
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLayers[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique<SLayerSurface>()).get();
layerSurface->szNamespace = WLRLAYERSURFACE->_namespace;
if (!WLRLAYERSURFACE->output) {
WLRLAYERSURFACE->output = g_pCompositor->m_vMonitors.front()->output; // TODO: current mon
}
layerSurface->hyprListener_commitLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.commit, &Events::listener_commitLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_destroyLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.destroy, &Events::listener_destroyLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_mapLayerSurface.initCallback(&WLRLAYERSURFACE->events.map, &Events::listener_mapLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_unmapLayerSurface.initCallback(&WLRLAYERSURFACE->events.unmap, &Events::listener_unmapLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_destroyLayerSurface.initCallback(&WLRLAYERSURFACE->events.destroy, &Events::listener_destroyLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_mapLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.map, &Events::listener_mapLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_unmapLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.unmap, &Events::listener_unmapLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_newPopup.initCallback(&WLRLAYERSURFACE->events.new_popup, &Events::listener_newPopup, layerSurface, "layerSurface");
layerSurface->layerSurface = WLRLAYERSURFACE;
layerSurface->layer = WLRLAYERSURFACE->current.layer;
WLRLAYERSURFACE->data = layerSurface;
layerSurface->monitorID = PMONITOR->ID;
layerSurface->layer = WLRLAYERSURFACE->current.layer;
WLRLAYERSURFACE->data = layerSurface;
layerSurface->monitorID = PMONITOR->ID;
layerSurface->forceBlur = g_pConfigManager->shouldBlurLS(layerSurface->szNamespace);
Debug::log(LOG, "LayerSurface %x (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer, PMONITOR->szName.c_str());
Debug::log(LOG, "LayerSurface %lx (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer,
PMONITOR->szName.c_str());
}
void Events::listener_destroyLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner;
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
Debug::log(LOG, "LayerSurface %lx destroyed", layersurface->layerSurface);
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID))
Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)");
if (!layersurface->fadingOut && PMONITOR) {
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
layersurface->alpha.setValueAndWarp(0.f);
layersurface->fadingOut = true;
if (!layersurface->fadingOut) {
if (layersurface->mapped) {
Debug::log(LOG, "Forcing an unmap of a LS that did a straight destroy!");
listener_unmapLayerSurface(layersurface, nullptr);
} else {
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
layersurface->alpha.setValueAndWarp(0.f);
layersurface->fadingOut = true;
g_pCompositor->addToFadingOutSafe(layersurface);
}
}
layersurface->noProcess = true;
layersurface->hyprListener_commitLayerSurface.removeCallback();
layersurface->hyprListener_destroyLayerSurface.removeCallback();
layersurface->hyprListener_mapLayerSurface.removeCallback();
@@ -81,25 +92,29 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
// rearrange to fix the reserved areas
if (PMONITOR) {
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
PMONITOR->scheduledRecalc = true;
// and damage
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed);
}
layersurface->readyToDelete = true;
layersurface->layerSurface = nullptr;
layersurface->layerSurface = nullptr;
}
void Events::listener_mapLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner;
Debug::log(LOG, "LayerSurface %x mapped", layersurface->layerSurface);
Debug::log(LOG, "LayerSurface %lx mapped", layersurface->layerSurface);
layersurface->layerSurface->mapped = true;
layersurface->mapped = true;
layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive;
layersurface->surface = layersurface->layerSurface->surface;
wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output);
// anim
layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
// fix if it changed its mon
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
@@ -107,76 +122,134 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
if (!PMONITOR)
return;
layersurface->applyRules();
if ((uint64_t)layersurface->monitorID != PMONITOR->ID) {
const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID);
POLDMON->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].push_back(layersurface);
layersurface->monitorID = PMONITOR->ID;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
for (auto it = POLDMON->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) {
if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].emplace_back(std::move(*it));
POLDMON->m_aLayerSurfaceLayers[layersurface->layer].erase(it);
break;
}
}
layersurface->monitorID = PMONITOR->ID;
PMONITOR->scheduledRecalc = true;
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
}
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
if (layersurface->layerSurface->current.keyboard_interactive && (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint)) // don't focus if constrained
wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output);
if (layersurface->layerSurface->current.keyboard_interactive &&
(!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint)) { // don't focus if constrained
g_pCompositor->focusSurface(layersurface->layerSurface->surface);
// mouse enter always, keeb only when needed
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y);
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y);
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
const auto LOCAL =
g_pInputManager->getMouseCoordsInternal() - Vector2D(layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y);
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y);
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
}
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed);
const auto WORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
const bool FULLSCREEN = WORKSPACE->m_bHasFullscreenWindow && WORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL;
layersurface->alpha.setValue(0);
layersurface->alpha = 255.f;
layersurface->alpha = ((layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP && FULLSCREEN) ? 0.f : 1.f);
layersurface->readyToDelete = false;
layersurface->fadingOut = false;
layersurface->fadingOut = false;
g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", std::string(layersurface->layerSurface->_namespace ? layersurface->layerSurface->_namespace : "")});
EMIT_HOOK_EVENT("openLayer", layersurface);
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale);
}
void Events::listener_unmapLayerSurface(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner;
Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface);
Debug::log(LOG, "LayerSurface %lx unmapped", layersurface->layerSurface);
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID)) {
g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", std::string(layersurface->layerSurface->_namespace ? layersurface->layerSurface->_namespace : "")});
EMIT_HOOK_EVENT("closeLayer", layersurface);
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID) || g_pCompositor->m_bUnsafeState) {
Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
g_pCompositor->addToFadingOutSafe(layersurface);
layersurface->mapped = false;
layersurface->fadingOut = true;
layersurface->alpha.setValueAndWarp(0.f);
return;
}
// anim
layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
// make a snapshot and start fade
g_pHyprOpenGL->makeLayerSnapshot(layersurface);
layersurface->alpha = 0.f;
layersurface->mapped = false;
layersurface->fadingOut = true;
g_pCompositor->m_vSurfacesFadingOut.push_back(layersurface);
if (layersurface->layerSurface->mapped)
layersurface->layerSurface->mapped = false;
g_pCompositor->addToFadingOutSafe(layersurface);
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == layersurface->layerSurface->surface;
layersurface->surface = nullptr;
if (!PMONITOR)
return;
// refocus if needed
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus) {
if (WASLASTFOCUS) {
g_pInputManager->releaseAllMouseButtons();
Vector2D surfaceCoords;
SLayerSurface* pFoundLayerSurface = nullptr;
wlr_surface* foundSurface = nullptr;
g_pCompositor->m_pLastFocus = nullptr;
g_pInputManager->refocus();
// find LS-es to focus
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
&surfaceCoords, &pFoundLayerSurface);
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
&surfaceCoords, &pFoundLayerSurface);
if (!foundSurface) {
// if there isn't any, focus the last window
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
g_pCompositor->focusWindow(nullptr);
g_pCompositor->focusWindow(PLASTWINDOW);
} else {
// otherwise, full refocus
g_pInputManager->refocus();
}
}
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed);
geomFixed = {layersurface->geometry.x + (int)PMONITOR->vecPosition.x, layersurface->geometry.y + (int)PMONITOR->vecPosition.y, (int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
geomFixed = {layersurface->geometry.x + (int)PMONITOR->vecPosition.x, layersurface->geometry.y + (int)PMONITOR->vecPosition.y,
(int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
g_pHyprRenderer->damageBox(&geomFixed);
geomFixed = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
layersurface->geometry = geomFixed; // because the surface can overflow... for some reason?
}
void Events::listener_commitLayerSurface(void* owner, void* data) {
@@ -190,35 +263,81 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
if (!PMONITOR)
return;
if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd
wlr_box geomFixed = {layersurface->geometry.x, layersurface->geometry.y, layersurface->geometry.width, layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed);
// fix if it changed its mon
if ((uint64_t)layersurface->monitorID != PMONITOR->ID) {
const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID);
POLDMON->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].push_back(layersurface);
layersurface->monitorID = PMONITOR->ID;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
for (auto it = POLDMON->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) {
if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].emplace_back(std::move(*it));
POLDMON->m_aLayerSurfaceLayers[layersurface->layer].erase(it);
break;
}
}
layersurface->monitorID = PMONITOR->ID;
PMONITOR->scheduledRecalc = true;
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
}
if (layersurface->layerSurface->current.committed != 0) {
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
if (layersurface->layer != layersurface->layerSurface->current.layer) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].push_back(layersurface);
for (auto it = PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) {
if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLayers[layersurface->layerSurface->current.layer].emplace_back(std::move(*it));
PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].erase(it);
break;
}
}
layersurface->layer = layersurface->layerSurface->current.layer;
if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd
}
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
PMONITOR->scheduledRecalc = true;
} else {
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
// update geom if it changed
if (layersurface->layerSurface->surface->current.scale == 1 && PMONITOR->scale != 1.f && layersurface->layerSurface->surface->current.viewport.has_dst) {
// fractional scaling. Dirty hack.
layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, (int)(layersurface->layerSurface->surface->current.viewport.dst_width),
(int)(layersurface->layerSurface->surface->current.viewport.dst_height)};
} else {
// this is because some apps like e.g. rofi-lbonn can't fucking use the protocol correctly.
layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->surface->current.width,
(int)layersurface->layerSurface->surface->current.height};
}
}
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
if (layersurface->layerSurface->current.keyboard_interactive &&
(!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) // don't focus if constrained
&& !layersurface->keyboardExclusive && layersurface->mapped) {
g_pCompositor->focusSurface(layersurface->layerSurface->surface);
// update geom if it changed
layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, layersurface->layerSurface->surface->current.width, layersurface->layerSurface->surface->current.height};
const auto LOCAL =
g_pInputManager->getMouseCoordsInternal() - Vector2D(layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y);
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y);
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
} else if (!layersurface->layerSurface->current.keyboard_interactive && (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) &&
layersurface->keyboardExclusive) {
g_pInputManager->refocus();
}
layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive;
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
}
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale);
}

View File

@@ -25,6 +25,15 @@ void Events::listener_outputMgrTest(wl_listener* listener, void* data) {
g_pHyprRenderer->outputMgrApplyTest(CONFIG, true);
}
void Events::listener_leaseRequest(wl_listener* listener, void* data) {
const auto REQUEST = (wlr_drm_lease_request_v1*)data;
struct wlr_drm_lease_v1* lease = wlr_drm_lease_request_v1_grant(REQUEST);
if (!lease) {
Debug::log(ERR, "Failed to grant lease request!");
wlr_drm_lease_request_v1_reject(REQUEST);
}
}
void Events::listener_requestSetPrimarySel(wl_listener* listener, void* data) {
const auto EVENT = (wlr_seat_request_set_primary_selection_event*)data;
wlr_seat_set_primary_selection(g_pCompositor->m_sSeat.seat, EVENT->source, EVENT->serial);
@@ -36,8 +45,9 @@ void Events::listener_requestSetSel(wl_listener* listener, void* data) {
}
void Events::listener_readyXWayland(wl_listener* listener, void* data) {
#ifndef NO_XWAYLAND
const auto XCBCONNECTION = xcb_connect(g_pXWaylandManager->m_sWLRXWayland->display_name, NULL);
const auto ERR = xcb_connection_has_error(XCBCONNECTION);
const auto ERR = xcb_connection_has_error(XCBCONNECTION);
if (ERR) {
Debug::log(LogLevel::ERR, "XWayland -> xcb_connection_has_error failed with %i", ERR);
return;
@@ -45,7 +55,7 @@ void Events::listener_readyXWayland(wl_listener* listener, void* data) {
for (auto& ATOM : HYPRATOMS) {
xcb_intern_atom_cookie_t cookie = xcb_intern_atom(XCBCONNECTION, 0, ATOM.first.length(), ATOM.first.c_str());
xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(XCBCONNECTION, cookie, NULL);
xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(XCBCONNECTION, cookie, NULL);
if (!reply) {
Debug::log(LogLevel::ERR, "XWayland -> Atom failed: %s", ATOM.first.c_str());
@@ -59,10 +69,14 @@ void Events::listener_readyXWayland(wl_listener* listener, void* data) {
const auto XCURSOR = wlr_xcursor_manager_get_xcursor(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", 1);
if (XCURSOR) {
wlr_xwayland_set_cursor(g_pXWaylandManager->m_sWLRXWayland, XCURSOR->images[0]->buffer, XCURSOR->images[0]->width * 4, XCURSOR->images[0]->width, XCURSOR->images[0]->height, XCURSOR->images[0]->hotspot_x, XCURSOR->images[0]->hotspot_y);
wlr_xwayland_set_cursor(g_pXWaylandManager->m_sWLRXWayland, XCURSOR->images[0]->buffer, XCURSOR->images[0]->width * 4, XCURSOR->images[0]->width,
XCURSOR->images[0]->height, XCURSOR->images[0]->hotspot_x, XCURSOR->images[0]->hotspot_y);
}
xcb_disconnect(XCBCONNECTION);
g_pXWaylandManager->updateXWaylandScale();
#endif
}
void Events::listener_requestDrag(wl_listener* listener, void* data) {
@@ -78,7 +92,7 @@ void Events::listener_requestDrag(wl_listener* listener, void* data) {
}
void Events::listener_startDrag(wl_listener* listener, void* data) {
if (g_pInputManager->m_sDrag.drag)
return; // don't handle multiple drags
@@ -86,33 +100,36 @@ void Events::listener_startDrag(wl_listener* listener, void* data) {
wlr_drag* wlrDrag = (wlr_drag*)data;
Debug::log(LOG, "Started drag %x", wlrDrag);
Debug::log(LOG, "Started drag %lx", wlrDrag);
wlrDrag->data = data;
g_pInputManager->m_sDrag.hyprListener_destroy.initCallback(&wlrDrag->events.destroy, &Events::listener_destroyDrag, &g_pInputManager->m_sDrag, "Drag");
if (wlrDrag->icon) {
Debug::log(LOG, "Drag started with an icon %x", wlrDrag->icon);
Debug::log(LOG, "Drag started with an icon %lx", wlrDrag->icon);
g_pInputManager->m_sDrag.dragIcon = wlrDrag->icon;
wlrDrag->icon->data = g_pInputManager->m_sDrag.dragIcon;
wlrDrag->icon->data = g_pInputManager->m_sDrag.dragIcon;
g_pInputManager->m_sDrag.hyprListener_mapIcon.initCallback(&wlrDrag->icon->events.map, &Events::listener_mapDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
g_pInputManager->m_sDrag.hyprListener_unmapIcon.initCallback(&wlrDrag->icon->events.unmap, &Events::listener_unmapDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
g_pInputManager->m_sDrag.hyprListener_mapIcon.initCallback(&wlrDrag->icon->surface->events.map, &Events::listener_mapDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
g_pInputManager->m_sDrag.hyprListener_unmapIcon.initCallback(&wlrDrag->icon->surface->events.unmap, &Events::listener_unmapDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
g_pInputManager->m_sDrag.hyprListener_destroyIcon.initCallback(&wlrDrag->icon->events.destroy, &Events::listener_destroyDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
g_pInputManager->m_sDrag.hyprListener_commitIcon.initCallback(&wlrDrag->icon->surface->events.commit, &Events::listener_commitDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
g_pInputManager->m_sDrag.hyprListener_commitIcon.initCallback(&wlrDrag->icon->surface->events.commit, &Events::listener_commitDragIcon, &g_pInputManager->m_sDrag,
"DragIcon");
}
}
void Events::listener_destroyDrag(void* owner, void* data) {
Debug::log(LOG, "Drag destroyed.");
g_pInputManager->m_sDrag.drag = nullptr;
if (g_pInputManager->m_sDrag.drag && g_pInputManager->m_sDrag.dragIcon && g_pInputManager->m_sDrag.dragIcon->surface)
g_pHyprRenderer->damageBox(g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4,
g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4);
g_pInputManager->m_sDrag.drag = nullptr;
g_pInputManager->m_sDrag.dragIcon = nullptr;
g_pInputManager->m_sDrag.hyprListener_destroy.removeCallback();
g_pInputManager->refocus();
}
void Events::listener_mapDragIcon(void* owner, void* data) {
@@ -142,8 +159,8 @@ void Events::listener_commitDragIcon(void* owner, void* data) {
}
void Events::listener_InhibitActivate(wl_listener* listener, void* data) {
Debug::log(LOG, "Activated exclusive for %x.", g_pCompositor->m_sSeat.exclusiveClient);
Debug::log(LOG, "Activated exclusive for %lx.", g_pCompositor->m_sSeat.exclusiveClient);
g_pInputManager->refocus();
g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client;
}
@@ -157,4 +174,62 @@ void Events::listener_InhibitDeactivate(wl_listener* listener, void* data) {
void Events::listener_RendererDestroy(wl_listener* listener, void* data) {
Debug::log(LOG, "!!Renderer destroyed!!");
}
}
void Events::listener_sessionActive(wl_listener* listener, void* data) {
Debug::log(LOG, "Session got activated!");
g_pCompositor->m_bSessionActive = true;
for (auto& m : g_pCompositor->m_vMonitors) {
g_pCompositor->scheduleFrameForMonitor(m.get());
}
g_pConfigManager->m_bWantsMonitorReload = true;
}
void Events::listener_powerMgrSetMode(wl_listener* listener, void* data) {
Debug::log(LOG, "PowerMgr set mode!");
const auto EVENT = (wlr_output_power_v1_set_mode_event*)data;
wlr_output_enable(EVENT->output, EVENT->mode == 1);
if (!wlr_output_commit(EVENT->output))
Debug::log(ERR, "Couldn't set power mode");
}
void Events::listener_newIME(wl_listener* listener, void* data) {
Debug::log(LOG, "New IME added!");
g_pInputManager->m_sIMERelay.onNewIME((wlr_input_method_v2*)data);
}
void Events::listener_newTextInput(wl_listener* listener, void* data) {
Debug::log(LOG, "New TextInput added!");
g_pInputManager->m_sIMERelay.onNewTextInput((wlr_text_input_v3*)data);
}
void Events::listener_newSessionLock(wl_listener* listener, void* data) {
Debug::log(LOG, "New session lock!");
g_pSessionLockManager->onNewSessionLock((wlr_session_lock_v1*)data);
}
void Events::listener_setGamma(wl_listener* listener, void* data) {
Debug::log(LOG, "New Gamma event at %lx", data);
const auto E = (wlr_gamma_control_manager_v1_set_gamma_event*)data;
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(E->output);
if (!PMONITOR) {
Debug::log(ERR, "Gamma event object references non-existent output %lx ?", E->output);
return;
}
PMONITOR->gammaChanged = true;
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
}

View File

@@ -15,336 +15,160 @@
// //
// --------------------------------------------------------- //
SMonitor* pMostHzMonitor = nullptr;
void Events::listener_change(wl_listener* listener, void* data) {
// layout got changed, let's update monitors.
const auto CONFIG = wlr_output_configuration_v1_create();
if (!CONFIG)
return;
for (auto& m : g_pCompositor->m_vMonitors) {
if (!m->output)
continue;
const auto CONFIGHEAD = wlr_output_configuration_head_v1_create(CONFIG, m->output);
// TODO: clients off of disabled
wlr_box BOX;
wlr_box BOX;
wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, m->output, &BOX);
//m->vecSize.x = BOX.width;
// m->vecSize.y = BOX.height;
// m->vecSize.y = BOX.height;
m->vecPosition.x = BOX.x;
m->vecPosition.y = BOX.y;
CONFIGHEAD->state.enabled = m->output->enabled;
CONFIGHEAD->state.mode = m->output->current_mode;
CONFIGHEAD->state.x = m->vecPosition.x;
CONFIGHEAD->state.y = m->vecPosition.y;
wlr_output_set_custom_mode(m->output, m->vecPixelSize.x, m->vecPixelSize.y, (int)(round(m->refreshRate * 1000)));
CONFIGHEAD->state.mode = m->output->current_mode;
CONFIGHEAD->state.x = m->vecPosition.x;
CONFIGHEAD->state.y = m->vecPosition.y;
}
wlr_output_manager_v1_set_configuration(g_pCompositor->m_sWLROutputMgr, CONFIG);
}
void Events::listener_newOutput(wl_listener* listener, void* data) {
// new monitor added, let's accomodate for that.
// new monitor added, let's accommodate for that.
const auto OUTPUT = (wlr_output*)data;
// for warping the cursor on launch
static bool firstLaunch = true;
if (!OUTPUT->name) {
Debug::log(ERR, "New monitor has no name?? Ignoring");
return;
}
if (g_pCompositor->getMonitorFromName(std::string(OUTPUT->name))) {
Debug::log(WARN, "Monitor with name %s already exists, not adding as new!", OUTPUT->name);
return;
if (g_pCompositor->m_bUnsafeState) {
Debug::log(WARN, "Recovering from an unsafe state. May you be lucky.");
}
// get monitor rule that matches
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(OUTPUT->name);
// add it to real
std::shared_ptr<CMonitor>* PNEWMONITORWRAP = nullptr;
// if it's disabled, disable and ignore
if (monitorRule.disabled) {
wlr_output_enable(OUTPUT, 0);
wlr_output_commit(OUTPUT);
if (const auto PMONITOR = g_pCompositor->getMonitorFromName(std::string(OUTPUT->name)); PMONITOR) {
listener_monitorDestroy(nullptr, PMONITOR->output);
for (auto& rm : g_pCompositor->m_vRealMonitors) {
if (rm->szName == OUTPUT->name) {
PNEWMONITORWRAP = &rm;
Debug::log(LOG, "Recovering a removed monitor.");
break;
}
return;
}
SMonitor newMonitor;
newMonitor.output = OUTPUT;
newMonitor.ID = g_pCompositor->getNextAvailableMonitorID();
newMonitor.szName = OUTPUT->name;
if (!PNEWMONITORWRAP) {
Debug::log(LOG, "Adding completely new monitor.");
PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared<CMonitor>());
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
wlr_output_set_scale(OUTPUT, monitorRule.scale);
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale);
wlr_output_set_transform(OUTPUT, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms
wlr_output_enable_adaptive_sync(OUTPUT, 1);
// create it in the arr
newMonitor.vecPosition = monitorRule.offset;
newMonitor.vecSize = monitorRule.resolution;
newMonitor.refreshRate = monitorRule.refreshRate;
const auto PNEWMONITOR = g_pCompositor->m_vMonitors.emplace_back(std::make_unique<SMonitor>(newMonitor)).get();
PNEWMONITOR->hyprListener_monitorFrame.initCallback(&OUTPUT->events.frame, &Events::listener_monitorFrame, PNEWMONITOR);
PNEWMONITOR->hyprListener_monitorDestroy.initCallback(&OUTPUT->events.destroy, &Events::listener_monitorDestroy, PNEWMONITOR);
wlr_output_enable(OUTPUT, 1);
// TODO: this doesn't seem to set the X and Y correctly,
// wlr_output_layout_output_coords returns invalid values, I think...
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, OUTPUT, monitorRule.offset.x, monitorRule.offset.y);
// set mode, also applies
g_pHyprRenderer->applyMonitorRule(PNEWMONITOR, &monitorRule, true);
Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", OUTPUT->name, (int)monitorRule.offset.x, (int)monitorRule.offset.y, (int)monitorRule.resolution.x, (int)monitorRule.resolution.y, OUTPUT);
PNEWMONITOR->damage = wlr_output_damage_create(PNEWMONITOR->output);
// add a WLR workspace group
PNEWMONITOR->pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr);
wlr_ext_workspace_group_handle_v1_output_enter(PNEWMONITOR->pWLRWorkspaceGroupHandle, PNEWMONITOR->output);
// Workspace
std::string newDefaultWorkspaceName = "";
auto WORKSPACEID = monitorRule.defaultWorkspace == "" ? g_pCompositor->m_vWorkspaces.size() + 1 : getWorkspaceIDFromString(monitorRule.defaultWorkspace, newDefaultWorkspaceName);
if (WORKSPACEID == INT_MAX || WORKSPACEID == (long unsigned int)SPECIAL_WORKSPACE_ID) {
WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1;
newDefaultWorkspaceName = std::to_string(WORKSPACEID);
Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", monitorRule.defaultWorkspace);
(*PNEWMONITORWRAP)->ID = g_pCompositor->getNextAvailableMonitorID(OUTPUT->name);
}
auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
const auto PNEWMONITOR = PNEWMONITORWRAP->get();
Debug::log(LOG, "New monitor: WORKSPACEID %d, exists: %d", WORKSPACEID, (int)(PNEWWORKSPACE != nullptr));
PNEWMONITOR->output = OUTPUT;
PNEWMONITOR->m_pThisWrap = PNEWMONITORWRAP;
if (PNEWWORKSPACE) {
// workspace exists, move it to the newly connected monitor
g_pCompositor->moveWorkspaceToMonitor(PNEWWORKSPACE, PNEWMONITOR);
PNEWMONITOR->activeWorkspace = PNEWWORKSPACE->m_iID;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PNEWMONITOR->ID);
PNEWWORKSPACE->startAnim(true,true,true);
} else {
PNEWWORKSPACE = g_pCompositor->m_vWorkspaces.emplace_back(std::make_unique<CWorkspace>(newMonitor.ID, newDefaultWorkspaceName)).get();
PNEWMONITOR->onConnect(false);
// We are required to set the name here immediately
wlr_ext_workspace_handle_v1_set_name(PNEWWORKSPACE->m_pWlrHandle, newDefaultWorkspaceName.c_str());
PNEWWORKSPACE->m_iID = WORKSPACEID;
}
PNEWMONITOR->activeWorkspace = PNEWWORKSPACE->m_iID;
PNEWMONITOR->scale = monitorRule.scale;
PNEWMONITOR->forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering.
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);
PNEWWORKSPACE->setActive(true);
//
if (!pMostHzMonitor || monitorRule.refreshRate > pMostHzMonitor->refreshRate)
pMostHzMonitor = PNEWMONITOR;
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
g_pCompositor->m_pLastMonitor = PNEWMONITOR;
g_pEventManager->postEvent(SHyprIPCEvent("monitoradded", PNEWMONITOR->szName));
if ((!g_pHyprRenderer->m_pMostHzMonitor || PNEWMONITOR->refreshRate > g_pHyprRenderer->m_pMostHzMonitor->refreshRate) && PNEWMONITOR->m_bEnabled)
g_pHyprRenderer->m_pMostHzMonitor = PNEWMONITOR;
// ready to process cuz we have a monitor
g_pCompositor->m_bReadyToProcess = true;
if (PNEWMONITOR->m_bEnabled) {
g_pCompositor->m_bReadyToProcess = true;
g_pCompositor->m_bUnsafeState = false;
}
g_pConfigManager->m_bWantsMonitorReload = true;
g_pCompositor->scheduleFrameForMonitor(PNEWMONITOR);
if (firstLaunch) {
firstLaunch = false;
const auto POS = PNEWMONITOR->vecPosition + PNEWMONITOR->vecSize / 2.f;
if (g_pCompositor->m_sSeat.mouse)
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, POS.x, POS.y);
} else {
for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_iMonitorID == PNEWMONITOR->ID) {
w->m_iLastSurfaceMonitorID = -1;
w->updateSurfaceOutputs();
}
}
}
}
void Events::listener_monitorFrame(void* owner, void* data) {
SMonitor* const PMONITOR = (SMonitor*)owner;
CMonitor* const PMONITOR = (CMonitor*)owner;
static std::chrono::high_resolution_clock::time_point startRender = std::chrono::high_resolution_clock::now();
static std::chrono::high_resolution_clock::time_point startRenderOverlay = std::chrono::high_resolution_clock::now();
static std::chrono::high_resolution_clock::time_point endRenderOverlay = std::chrono::high_resolution_clock::now();
if ((g_pCompositor->m_sWLRSession && !g_pCompositor->m_sWLRSession->active) || !g_pCompositor->m_bSessionActive || g_pCompositor->m_bUnsafeState) {
Debug::log(WARN, "Attempted to render frame on inactive session!");
static auto *const PDEBUGOVERLAY = &g_pConfigManager->getConfigValuePtr("debug:overlay")->intValue;
static auto *const PDAMAGETRACKINGMODE = &g_pConfigManager->getConfigValuePtr("general:damage_tracking_internal")->intValue;
static auto *const PDAMAGEBLINK = &g_pConfigManager->getConfigValuePtr("debug:damage_blink")->intValue;
static auto *const PNOVFR = &g_pConfigManager->getConfigValuePtr("misc:no_vfr")->intValue;
static int damageBlinkCleanup = 0; // because double-buffered
if (*PDEBUGOVERLAY == 1) {
startRender = std::chrono::high_resolution_clock::now();
g_pDebugOverlay->frameData(PMONITOR);
}
// checks //
if (PMONITOR->ID == pMostHzMonitor->ID || !*PNOVFR) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
g_pCompositor->sanityCheckWorkspaces();
g_pAnimationManager->tick();
g_pCompositor->cleanupFadingOut();
HyprCtl::tickHyprCtl(); // so that we dont get that race condition multithread bullshit
g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd
if (g_pConfigManager->m_bWantsMonitorReload)
if (g_pCompositor->m_bUnsafeState)
g_pConfigManager->performMonitorReload();
g_pHyprRenderer->ensureCursorRenderingMode(); // so that the cursor gets hidden/shown if the user requested timeouts
return; // cannot draw on session inactive (different tty)
}
// //
if (PMONITOR->framesToSkip > 0) {
PMONITOR->framesToSkip -= 1;
if (!PMONITOR->m_bEnabled)
return;
if (!PMONITOR->noFrameSchedule)
wlr_output_schedule_frame(PMONITOR->output);
else {
Debug::log(LOG, "NoFrameSchedule hit for %s.", PMONITOR->szName.c_str());
static auto* const PENABLERAT = &g_pConfigManager->getConfigValuePtr("misc:render_ahead_of_time")->intValue;
static auto* const PRATSAFE = &g_pConfigManager->getConfigValuePtr("misc:render_ahead_safezone")->intValue;
PMONITOR->lastPresentationTimer.reset();
if (*PENABLERAT) {
if (!PMONITOR->RATScheduled) {
// render
g_pHyprRenderer->renderMonitor(PMONITOR);
}
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
return;
}
timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
PMONITOR->RATScheduled = false;
// check the damage
pixman_region32_t damage;
bool hasChanged;
pixman_region32_init(&damage);
const auto& [avg, max, min] = g_pHyprRenderer->getRenderTimes(PMONITOR);
if (*PDAMAGETRACKINGMODE == -1) {
Debug::log(CRIT, "Damage tracking mode -1 ????");
return;
}
if (max + *PRATSAFE > 1000.0 / PMONITOR->refreshRate)
return;
if (!wlr_output_damage_attach_render(PMONITOR->damage, &hasChanged, &damage)){
Debug::log(ERR, "Couldn't attach render to display %s ???", PMONITOR->szName.c_str());
return;
}
const auto MSLEFT = 1000.0 / PMONITOR->refreshRate - PMONITOR->lastPresentationTimer.getMillis();
if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && PMONITOR->forceFullFrames == 0 && damageBlinkCleanup == 0) {
pixman_region32_fini(&damage);
wlr_output_rollback(PMONITOR->output);
PMONITOR->RATScheduled = true;
if (*PDAMAGEBLINK || *PNOVFR)
wlr_output_schedule_frame(PMONITOR->output);
const auto ESTRENDERTIME = std::ceil(avg + *PRATSAFE);
const auto TIMETOSLEEP = std::floor(MSLEFT - ESTRENDERTIME);
return;
}
// if we have no tracking or full tracking, invalidate the entire monitor
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || PMONITOR->forceFullFrames > 0 || damageBlinkCleanup > 0) {
pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
if (MSLEFT < 1 || MSLEFT < ESTRENDERTIME || TIMETOSLEEP < 1)
g_pHyprRenderer->renderMonitor(PMONITOR);
else
wl_event_source_timer_update(PMONITOR->renderTimer, TIMETOSLEEP);
} else {
static auto* const PBLURENABLED = &g_pConfigManager->getConfigValuePtr("decoration:blur")->intValue;
// if we use blur we need to expand the damage for proper blurring
if (*PBLURENABLED == 1) {
// TODO: can this be optimized?
static auto* const PBLURSIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_size")->intValue;
static auto* const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur_passes")->intValue;
const auto BLURRADIUS = *PBLURSIZE * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
// now, prep the damage, get the extended damage region
wlr_region_expand(&damage, &damage, BLURRADIUS); // expand for proper blurring
} else {
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
}
}
if (PMONITOR->forceFullFrames > 0)
PMONITOR->forceFullFrames -= 1;
// TODO: this is getting called with extents being 0,0,0,0 should it be?
// potentially can save on resources.
g_pHyprOpenGL->begin(PMONITOR, &damage);
g_pHyprOpenGL->clear(CColor(17, 17, 17, 255));
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now);
// if correct monitor draw hyprerror
if (PMONITOR->ID == 0)
g_pHyprError->draw();
// for drawing the debug overlay
if (PMONITOR->ID == 0 && *PDEBUGOVERLAY == 1) {
startRenderOverlay = std::chrono::high_resolution_clock::now();
g_pDebugOverlay->draw();
endRenderOverlay = std::chrono::high_resolution_clock::now();
}
if (*PDAMAGEBLINK && damageBlinkCleanup == 0) {
wlr_box monrect = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprOpenGL->renderRect(&monrect, CColor(255,0,255,100), 0);
damageBlinkCleanup = 1;
} else if (*PDAMAGEBLINK) {
damageBlinkCleanup++;
if (damageBlinkCleanup > 3)
damageBlinkCleanup = 0;
}
wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
wlr_output_render_software_cursors(PMONITOR->output, NULL);
wlr_renderer_end(g_pCompositor->m_sWLRRenderer);
g_pHyprOpenGL->end();
// calc frame damage
pixman_region32_t frameDamage;
pixman_region32_init(&frameDamage);
const auto TRANSFORM = wlr_output_transform_invert(PMONITOR->output->transform);
wlr_region_transform(&frameDamage, &PMONITOR->damage->current, TRANSFORM, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
pixman_region32_union_rect(&frameDamage, &frameDamage, 0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
if (*PDAMAGEBLINK)
pixman_region32_union(&frameDamage, &frameDamage, &damage);
wlr_output_set_damage(PMONITOR->output, &frameDamage);
pixman_region32_fini(&frameDamage);
pixman_region32_fini(&damage);
wlr_output_commit(PMONITOR->output);
if (*PDAMAGEBLINK || *PNOVFR)
wlr_output_schedule_frame(PMONITOR->output);
if (*PDEBUGOVERLAY == 1) {
const float µs = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - startRender).count() / 1000.f;
g_pDebugOverlay->renderData(PMONITOR, µs);
if (PMONITOR->ID == 0) {
const float µsNoOverlay = µs - std::chrono::duration_cast<std::chrono::nanoseconds>(endRenderOverlay - startRenderOverlay).count() / 1000.f;
g_pDebugOverlay->renderDataNoOverlay(PMONITOR, µsNoOverlay);
} else {
g_pDebugOverlay->renderDataNoOverlay(PMONITOR, µs);
}
g_pHyprRenderer->renderMonitor(PMONITOR);
}
}
void Events::listener_monitorDestroy(void* owner, void* data) {
const auto OUTPUT = (wlr_output*)data;
SMonitor* pMonitor = nullptr;
CMonitor* pMonitor = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) {
if (m->szName == OUTPUT->name) {
for (auto& m : g_pCompositor->m_vRealMonitors) {
if (m->output == OUTPUT) {
pMonitor = m.get();
break;
}
@@ -353,55 +177,53 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
if (!pMonitor)
return;
// Cleanup everything. Move windows back, snap cursor, shit.
const auto BACKUPMON = g_pCompositor->m_vMonitors.front().get();
Debug::log(LOG, "Destroy called for monitor %s", pMonitor->output->name);
if (!BACKUPMON) {
Debug::log(CRIT, "No monitors! Unplugged last! Exiting.");
g_pCompositor->cleanupExit();
exit(1);
return;
}
pMonitor->onDisconnect();
const auto BACKUPWORKSPACE = BACKUPMON->activeWorkspace > 0 ? std::to_string(BACKUPMON->activeWorkspace) : "name:" + g_pCompositor->getWorkspaceByID(BACKUPMON->activeWorkspace)->m_szName;
pMonitor->output = nullptr;
pMonitor->m_bRenderingInitPassed = false;
// snap cursor
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f);
// cleanup if not unsafe
if (!g_pCompositor->m_bUnsafeState) {
Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->szName.c_str());
// move workspaces
std::deque<CWorkspace*> wspToMove;
for (auto& w : g_pCompositor->m_vWorkspaces) {
if (w->m_iMonitorID == pMonitor->ID) {
wspToMove.push_back(w.get());
}
}
for (auto& w : wspToMove) {
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
w->startAnim(true, true, true);
}
pMonitor->activeWorkspace = -1;
g_pCompositor->m_vWorkspaces.erase(std::remove_if(g_pCompositor->m_vWorkspaces.begin(), g_pCompositor->m_vWorkspaces.end(), [&](std::unique_ptr<CWorkspace>& el) { return el->m_iMonitorID == pMonitor->ID; }));
Debug::log(LOG, "Removed monitor %s!", pMonitor->szName.c_str());
g_pEventManager->postEvent(SHyprIPCEvent("monitorremoved", pMonitor->szName));
g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::unique_ptr<SMonitor>& el) { return el.get() == pMonitor; }));
if (pMostHzMonitor == pMonitor) {
int mostHz = 0;
SMonitor* pMonitorMostHz = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) {
if (m->refreshRate > mostHz) {
pMonitorMostHz = m.get();
mostHz = m->refreshRate;
}
}
pMostHzMonitor = pMonitorMostHz;
std::erase_if(g_pCompositor->m_vRealMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; });
}
}
void Events::listener_monitorStateRequest(void* owner, void* data) {
const auto PMONITOR = (CMonitor*)owner;
const auto E = (wlr_output_event_request_state*)data;
wlr_output_commit_state(PMONITOR->output, E->state);
}
void Events::listener_monitorDamage(void* owner, void* data) {
const auto PMONITOR = (CMonitor*)owner;
const auto E = (wlr_output_event_damage*)data;
PMONITOR->addDamage(E->damage);
}
void Events::listener_monitorNeedsFrame(void* owner, void* data) {
const auto PMONITOR = (CMonitor*)owner;
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
}
void Events::listener_monitorCommit(void* owner, void* data) {
const auto PMONITOR = (CMonitor*)owner;
const auto E = (wlr_output_event_commit*)data;
if (E->committed & WLR_OUTPUT_STATE_BUFFER)
g_pProtocolManager->m_pScreencopyProtocolManager->onOutputCommit(PMONITOR, E);
if (E->committed & (WLR_OUTPUT_STATE_SCALE | WLR_OUTPUT_STATE_TRANSFORM | WLR_OUTPUT_STATE_MODE))
g_pXWaylandManager->updateXWaylandScale();
}
void Events::listener_monitorBind(void* owner, void* data) {
g_pXWaylandManager->updateXWaylandScale();
}

View File

@@ -16,20 +16,24 @@
// --------------------------------------------- //
void addPopupGlobalCoords(void* pPopup, int* x, int* y) {
SXDGPopup *const PPOPUP = (SXDGPopup*)pPopup;
SXDGPopup* const PPOPUP = (SXDGPopup*)pPopup;
int px = 0;
int py = 0;
auto curPopup = PPOPUP;
int px = 0;
int py = 0;
auto curPopup = PPOPUP;
while (true) {
px += curPopup->popup->current.geometry.x;
py += curPopup->popup->current.geometry.y;
// fix oversized fucking popups
// kill me
if (curPopup->pSurfaceTree && curPopup->pSurfaceTree->pSurface && !curPopup->parentPopup) {
const auto EXTENTSSURFACE = pixman_region32_extents(&curPopup->pSurfaceTree->pSurface->input_region);
if (curPopup == PPOPUP && PPOPUP->parentWindow) {
px -= curPopup->popup->base->current.geometry.x;
py -= curPopup->popup->base->current.geometry.y;
}
if (curPopup->popup && !curPopup->parentPopup && !curPopup->parentWindow) {
const auto EXTENTSSURFACE = pixman_region32_extents(&curPopup->popup->base->surface->input_region);
px -= EXTENTSSURFACE->x1;
py -= EXTENTSSURFACE->y1;
}
@@ -51,20 +55,22 @@ void addPopupGlobalCoords(void* pPopup, int* x, int* y) {
void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
pHyprPopup->popup = popup;
pHyprPopup->hyprListener_destroyPopupXDG.initCallback(&popup->base->surface->events.destroy, &Events::listener_destroyPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_mapPopupXDG.initCallback(&popup->base->events.map, &Events::listener_mapPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_unmapPopupXDG.initCallback(&popup->base->events.unmap, &Events::listener_unmapPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_destroyPopupXDG.initCallback(&popup->base->events.destroy, &Events::listener_destroyPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_mapPopupXDG.initCallback(&popup->base->surface->events.map, &Events::listener_mapPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_unmapPopupXDG.initCallback(&popup->base->surface->events.unmap, &Events::listener_unmapPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_newPopupFromPopupXDG.initCallback(&popup->base->events.new_popup, &Events::listener_newPopupFromPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_commitPopupXDG.initCallback(&popup->base->surface->events.commit, &Events::listener_commitPopupXDG, pHyprPopup, "HyprPopup");
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
wlr_box box = {.x = PMONITOR->vecPosition.x - pHyprPopup->lx, .y = PMONITOR->vecPosition.y - pHyprPopup->ly, .width = PMONITOR->vecSize.x, .height = PMONITOR->vecSize.y};
wlr_box box = {.x = PMONITOR->vecPosition.x - pHyprPopup->lx, .y = PMONITOR->vecPosition.y - pHyprPopup->ly, .width = PMONITOR->vecSize.x, .height = PMONITOR->vecSize.y};
wlr_xdg_popup_unconstrain_from_box(popup, &box);
pHyprPopup->monitor = PMONITOR;
Debug::log(LOG, "Popup: Unconstrained from lx ly: %f %f, pHyprPopup lx ly: %f %f", (float)PMONITOR->vecPosition.x, (float)PMONITOR->vecPosition.y, (float)pHyprPopup->lx, (float)pHyprPopup->ly);
Debug::log(LOG, "Popup: Unconstrained from lx ly: %f %f, pHyprPopup lx ly: %f %f", (float)PMONITOR->vecPosition.x, (float)PMONITOR->vecPosition.y, (float)pHyprPopup->lx,
(float)pHyprPopup->ly);
}
void Events::listener_newPopup(void* owner, void* data) {
@@ -72,7 +78,7 @@ void Events::listener_newPopup(void* owner, void* data) {
ASSERT(layersurface);
Debug::log(LOG, "New layer popup created from surface %x", layersurface);
Debug::log(LOG, "New layer popup created from surface %lx", layersurface);
const auto WLRPOPUP = (wlr_xdg_popup*)data;
@@ -80,10 +86,11 @@ void Events::listener_newPopup(void* owner, void* data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->lx = layersurface->position.x;
PNEWPOPUP->ly = layersurface->position.y;
PNEWPOPUP->monitor = PMONITOR;
PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->lx = layersurface->position.x;
PNEWPOPUP->ly = layersurface->position.y;
PNEWPOPUP->monitor = PMONITOR;
PNEWPOPUP->parentLS = layersurface;
createNewPopup(WLRPOPUP, PNEWPOPUP);
}
@@ -95,7 +102,7 @@ void Events::listener_newPopupXDG(void* owner, void* data) {
if (!PWINDOW->m_bIsMapped)
return;
Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str());
Debug::log(LOG, "New layer popup created from XDG window %lx -> %s", PWINDOW, PWINDOW->m_szTitle.c_str());
const auto WLRPOPUP = (wlr_xdg_popup*)data;
@@ -103,11 +110,11 @@ void Events::listener_newPopupXDG(void* owner, void* data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->lx = PWINDOW->m_vRealPosition.goalv().x;
PNEWPOPUP->ly = PWINDOW->m_vRealPosition.goalv().y;
PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->lx = PWINDOW->m_vRealPosition.goalv().x;
PNEWPOPUP->ly = PWINDOW->m_vRealPosition.goalv().y;
PNEWPOPUP->parentWindow = PWINDOW;
PNEWPOPUP->monitor = PMONITOR;
PNEWPOPUP->monitor = PMONITOR;
createNewPopup(WLRPOPUP, PNEWPOPUP);
}
@@ -115,22 +122,22 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner;
ASSERT(PPOPUP);
if (PPOPUP->parentWindow)
Debug::log(LOG, "New popup created from XDG Window popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str());
Debug::log(LOG, "New popup created from XDG Window popup %lx -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str());
else
Debug::log(LOG, "New popup created from Non-Window popup %x", PPOPUP);
Debug::log(LOG, "New popup created from Non-Window popup %lx", PPOPUP);
const auto WLRPOPUP = (wlr_xdg_popup*)data;
const auto PNEWPOPUP = g_pCompositor->m_vXDGPopups.emplace_back(std::make_unique<SXDGPopup>()).get();
PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->parentPopup = PPOPUP;
PNEWPOPUP->lx = PPOPUP->lx;
PNEWPOPUP->ly = PPOPUP->ly;
PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->parentPopup = PPOPUP;
PNEWPOPUP->lx = PPOPUP->lx;
PNEWPOPUP->ly = PPOPUP->ly;
PNEWPOPUP->parentWindow = PPOPUP->parentWindow;
PNEWPOPUP->monitor = PPOPUP->monitor;
PNEWPOPUP->monitor = PPOPUP->monitor;
createNewPopup(WLRPOPUP, PNEWPOPUP);
}
@@ -142,9 +149,25 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
Debug::log(LOG, "New XDG Popup mapped at %d %d", (int)PPOPUP->lx, (int)PPOPUP->ly);
if (PPOPUP->parentWindow)
PPOPUP->parentWindow->m_lPopupSurfaces.emplace_back(PPOPUP->popup->base->surface);
else if (PPOPUP->parentLS)
PPOPUP->parentLS->popupSurfaces.emplace_back(PPOPUP->popup->base->surface);
PPOPUP->pSurfaceTree = SubsurfaceTree::createTreeRoot(PPOPUP->popup->base->surface, addPopupGlobalCoords, PPOPUP, PPOPUP->parentWindow);
Debug::log(LOG, "XDG Popup got assigned a surfaceTreeNode %x", PPOPUP->pSurfaceTree);
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
wlr_box extents;
wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents);
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
if (PPOPUP->monitor)
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(PPOPUP->popup->base->surface, PPOPUP->monitor->scale);
Debug::log(LOG, "XDG Popup got assigned a surfaceTreeNode %lx", PPOPUP->pSurfaceTree);
}
void Events::listener_unmapPopupXDG(void* owner, void* data) {
@@ -153,9 +176,36 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP);
if (PPOPUP->popup->base->surface == g_pCompositor->m_pLastFocus)
g_pInputManager->releaseAllMouseButtons();
SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree);
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
wlr_box extents;
wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents);
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
if (PPOPUP->parentWindow)
std::erase(PPOPUP->parentWindow->m_lPopupSurfaces, PPOPUP->popup->base->surface);
else if (PPOPUP->parentLS)
std::erase(PPOPUP->parentLS->popupSurfaces, PPOPUP->popup->base->surface);
PPOPUP->pSurfaceTree = nullptr;
g_pInputManager->simulateMouseMovement(); // to focus and return back to an appropriate surface
}
void Events::listener_commitPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner;
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
g_pHyprRenderer->damageSurface(PPOPUP->popup->base->surface, lx, ly);
}
void Events::listener_destroyPopupXDG(void* owner, void* data) {
@@ -163,12 +213,12 @@ void Events::listener_destroyPopupXDG(void* owner, void* data) {
ASSERT(PPOPUP);
Debug::log(LOG, "Destroyed popup XDG %x", PPOPUP);
Debug::log(LOG, "Destroyed popup XDG %lx", PPOPUP);
if (PPOPUP->pSurfaceTree) {
SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree);
PPOPUP->pSurfaceTree = nullptr;
}
g_pCompositor->m_vXDGPopups.erase(std::remove_if(g_pCompositor->m_vXDGPopups.begin(), g_pCompositor->m_vXDGPopups.end(), [&](std::unique_ptr<SXDGPopup>& el) { return el.get() == PPOPUP; }));
}
std::erase_if(g_pCompositor->m_vXDGPopups, [&](std::unique_ptr<SXDGPopup>& el) { return el.get() == PPOPUP; });
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,49 +1,44 @@
#include "AnimatedVariable.hpp"
#include "../managers/AnimationManager.hpp"
#include "../config/ConfigManager.hpp"
CAnimatedVariable::CAnimatedVariable() {
; // dummy var
}
void CAnimatedVariable::create(ANIMATEDVARTYPE type, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY policy) {
m_eVarType = type;
void CAnimatedVariable::create(ANIMATEDVARTYPE type, SAnimationPropertyConfig* pAnimConfig, void* pWindow, AVARDAMAGEPOLICY policy) {
m_eVarType = type;
m_eDamagePolicy = policy;
m_pSpeed = speed;
m_pEnabled = enabled;
m_pWindow = pWindow;
m_pBezier = pBezier;
g_pAnimationManager->m_lAnimatedVariables.push_back(this);
m_pConfig = pAnimConfig;
m_pWindow = pWindow;
m_bDummy = false;
}
void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY policy) {
create(type, speed, enabled, pBezier, pWindow, policy);
void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, SAnimationPropertyConfig* pAnimConfig, void* pWindow, AVARDAMAGEPOLICY policy) {
create(type, pAnimConfig, pWindow, policy);
try {
switch (type) {
case AVARTYPE_FLOAT: {
const auto V = std::any_cast<float>(val);
m_fValue = V;
m_fGoal = V;
m_fValue = V;
m_fGoal = V;
break;
}
case AVARTYPE_VECTOR: {
const auto V = std::any_cast<Vector2D>(val);
m_vValue = V;
m_vGoal = V;
m_vValue = V;
m_vGoal = V;
break;
}
case AVARTYPE_COLOR: {
const auto V = std::any_cast<CColor>(val);
m_cValue = V;
m_cGoal = V;
m_cValue = V;
m_cGoal = V;
break;
}
default:
ASSERT(false);
break;
default: ASSERT(false); break;
}
} catch (std::exception& e) {
Debug::log(ERR, "CAnimatedVariable create error: %s", e.what());
@@ -57,4 +52,30 @@ CAnimatedVariable::~CAnimatedVariable() {
void CAnimatedVariable::unregister() {
g_pAnimationManager->m_lAnimatedVariables.remove(this);
m_bIsRegistered = false;
}
void CAnimatedVariable::registerVar() {
if (!m_bIsRegistered)
g_pAnimationManager->m_lAnimatedVariables.push_back(this);
m_bIsRegistered = true;
}
int CAnimatedVariable::getDurationLeftMs() {
return std::max(
(int)(m_pConfig->pValues->internalSpeed * 100) - (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count(), 0);
}
float CAnimatedVariable::getPercent() {
const auto DURATIONPASSED = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count();
return std::clamp((DURATIONPASSED / 100.f) / m_pConfig->pValues->internalSpeed, 0.f, 1.f);
}
float CAnimatedVariable::getCurveValue() {
const auto SPENT = getPercent();
if (SPENT >= 1.f)
return 1.f;
return g_pAnimationManager->getBezier(m_pConfig->pValues->internalBezier)->getYForPoint(SPENT);
}

View File

@@ -3,33 +3,44 @@
#include "../defines.hpp"
#include <any>
enum ANIMATEDVARTYPE {
enum ANIMATEDVARTYPE
{
AVARTYPE_INVALID = -1,
AVARTYPE_FLOAT,
AVARTYPE_VECTOR,
AVARTYPE_COLOR
};
enum AVARDAMAGEPOLICY {
AVARDAMAGE_INVALID = -1,
enum AVARDAMAGEPOLICY
{
AVARDAMAGE_NONE = -1,
AVARDAMAGE_ENTIRE = 0,
AVARDAMAGE_BORDER
AVARDAMAGE_BORDER,
AVARDAMAGE_SHADOW
};
class CAnimationManager;
class CWorkspace;
struct SLayerSurface;
struct SAnimationPropertyConfig;
class CHyprRenderer;
class CAnimatedVariable {
public:
public:
CAnimatedVariable(); // dummy var
void create(ANIMATEDVARTYPE, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY);
void create(ANIMATEDVARTYPE, std::any val, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY);
void create(ANIMATEDVARTYPE, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY);
void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY);
CAnimatedVariable(const CAnimatedVariable&) = delete;
CAnimatedVariable(CAnimatedVariable&&) = delete;
CAnimatedVariable& operator=(const CAnimatedVariable&) = delete;
CAnimatedVariable& operator=(CAnimatedVariable&&) = delete;
~CAnimatedVariable();
void unregister();
void registerVar();
// gets the current vector value (real time)
const Vector2D& vec() const {
@@ -61,43 +72,61 @@ public:
return m_cGoal;
}
void operator=(const Vector2D& v) {
m_vGoal = v;
CAnimatedVariable& operator=(const Vector2D& v) {
m_vGoal = v;
animationBegin = std::chrono::system_clock::now();
m_vBegun = m_vValue;
m_vBegun = m_vValue;
onAnimationBegin();
return *this;
}
void operator=(const float& v) {
m_fGoal = v;
CAnimatedVariable& operator=(const float& v) {
m_fGoal = v;
animationBegin = std::chrono::system_clock::now();
m_fBegun = m_fValue;
m_fBegun = m_fValue;
onAnimationBegin();
return *this;
}
void operator=(const CColor& v) {
m_cGoal = v;
CAnimatedVariable& operator=(const CColor& v) {
m_cGoal = v;
animationBegin = std::chrono::system_clock::now();
m_cBegun = m_cValue;
m_cBegun = m_cValue;
onAnimationBegin();
return *this;
}
// Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const Vector2D& v) {
m_vValue = v;
m_vValue = v;
animationBegin = std::chrono::system_clock::now();
m_vBegun = m_vValue;
m_vBegun = m_vValue;
onAnimationBegin();
}
// Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const float& v) {
m_fValue = v;
m_fValue = v;
animationBegin = std::chrono::system_clock::now();
m_vBegun = m_vValue;
m_vBegun = m_vValue;
onAnimationBegin();
}
// Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const CColor& v) {
m_cValue = v;
m_cValue = v;
animationBegin = std::chrono::system_clock::now();
m_vBegun = m_vValue;
m_vBegun = m_vValue;
onAnimationBegin();
}
// Sets the actual value and goal
@@ -121,20 +150,18 @@ public:
// checks if an animation is in progress
bool isBeingAnimated() {
switch (m_eVarType) {
case AVARTYPE_FLOAT:
return m_fValue != m_fGoal;
case AVARTYPE_VECTOR:
return m_vValue != m_vGoal;
case AVARTYPE_COLOR:
return m_cValue != m_cGoal;
default:
std::unreachable();
case AVARTYPE_FLOAT: return m_fValue != m_fGoal;
case AVARTYPE_VECTOR: return m_vValue != m_vGoal;
case AVARTYPE_COLOR: return m_cValue != m_cGoal;
default: UNREACHABLE();
}
std::unreachable();
UNREACHABLE();
return false; // just so that the warning is suppressed
}
void warp() {
void warp(bool endCallback = true) {
switch (m_eVarType) {
case AVARTYPE_FLOAT: {
m_fValue = m_fGoal;
@@ -148,43 +175,117 @@ public:
m_cValue = m_cGoal;
break;
}
default:
std::unreachable();
default: UNREACHABLE();
}
if (endCallback)
onAnimationEnd();
}
private:
void setConfig(SAnimationPropertyConfig* pConfig) {
m_pConfig = pConfig;
}
Vector2D m_vValue = Vector2D(0,0);
float m_fValue = 0;
CColor m_cValue;
SAnimationPropertyConfig* getConfig() {
return m_pConfig;
}
Vector2D m_vGoal = Vector2D(0,0);
float m_fGoal = 0;
CColor m_cGoal;
int getDurationLeftMs();
Vector2D m_vBegun = Vector2D(0,0);
float m_fBegun = 0;
CColor m_cBegun;
/* returns the spent (completion) % */
float getPercent();
float* m_pSpeed = nullptr;
int64_t* m_pEnabled = nullptr;
/* returns the current curve value */
float getCurveValue();
/* sets a function to be ran when the animation finishes.
if an animation is not running, runs instantly.
if "remove" is set to true, will remove the callback when ran. */
void setCallbackOnEnd(std::function<void(void* thisptr)> func, bool remove = true) {
m_fEndCallback = func;
m_bRemoveEndAfterRan = remove;
if (!isBeingAnimated())
onAnimationEnd();
}
/* sets a function to be ran when an animation is started.
if "remove" is set to true, will remove the callback when ran. */
void setCallbackOnBegin(std::function<void(void* thisptr)> func, bool remove = true) {
m_fBeginCallback = func;
m_bRemoveBeginAfterRan = remove;
}
/* Sets the update callback, called every time the value is animated and a step is done
Warning: calling unregisterVar/registerVar in this handler will cause UB */
void setUpdateCallback(std::function<void(void* thisptr)> func) {
m_fUpdateCallback = func;
}
/* resets all callbacks. Does not call any. */
void resetAllCallbacks() {
m_fBeginCallback = nullptr;
m_fEndCallback = nullptr;
m_fUpdateCallback = nullptr;
m_bRemoveBeginAfterRan = false;
m_bRemoveEndAfterRan = false;
}
private:
Vector2D m_vValue = Vector2D(0, 0);
float m_fValue = 0;
CColor m_cValue;
Vector2D m_vGoal = Vector2D(0, 0);
float m_fGoal = 0;
CColor m_cGoal;
Vector2D m_vBegun = Vector2D(0, 0);
float m_fBegun = 0;
CColor m_cBegun;
// owners
void* m_pWindow = nullptr;
void* m_pWorkspace = nullptr;
void* m_pLayer = nullptr;
void* m_pWindow = nullptr;
void* m_pWorkspace = nullptr;
void* m_pLayer = nullptr;
std::string* m_pBezier = nullptr;
SAnimationPropertyConfig* m_pConfig = nullptr;
bool m_bDummy = true;
bool m_bDummy = true;
bool m_bIsRegistered = false;
std::chrono::system_clock::time_point animationBegin;
ANIMATEDVARTYPE m_eVarType = AVARTYPE_INVALID;
AVARDAMAGEPOLICY m_eDamagePolicy = AVARDAMAGE_INVALID;
ANIMATEDVARTYPE m_eVarType = AVARTYPE_INVALID;
AVARDAMAGEPOLICY m_eDamagePolicy = AVARDAMAGE_NONE;
bool m_bRemoveEndAfterRan = true;
bool m_bRemoveBeginAfterRan = true;
std::function<void(void* thisptr)> m_fEndCallback;
std::function<void(void* thisptr)> m_fBeginCallback;
std::function<void(void* thisptr)> m_fUpdateCallback;
// methods
void onAnimationEnd() {
if (m_fEndCallback) {
// loading m_bRemoveEndAfterRan before calling the callback allows the callback to delete this animation safely if it is false.
auto removeEndCallback = m_bRemoveEndAfterRan;
m_fEndCallback(this);
if (removeEndCallback)
m_fEndCallback = nullptr; // reset
}
}
void onAnimationBegin() {
if (m_fBeginCallback) {
m_fBeginCallback(this);
if (m_bRemoveBeginAfterRan)
m_fBeginCallback = nullptr; // reset
}
}
friend class CAnimationManager;
friend class CWorkspace;
friend struct SLayerSurface;
};
friend class CHyprRenderer;
};

View File

@@ -1,17 +1,19 @@
#include "BezierCurve.hpp"
#include <algorithm>
void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
m_dPoints.clear();
const auto BEGIN = std::chrono::high_resolution_clock::now();
m_dPoints.emplace_back(Vector2D(0,0));
m_dPoints.emplace_back(Vector2D(0, 0));
for (auto& p : *pVec) {
m_dPoints.push_back(p);
}
m_dPoints.emplace_back(Vector2D(1,1));
m_dPoints.emplace_back(Vector2D(1, 1));
RASSERT(m_dPoints.size() == 4, "CBezierCurve only supports cubic beziers! (points num: %i)", m_dPoints.size());
@@ -21,7 +23,7 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
m_aPointsBaked[i] = Vector2D(getXForT((i + 1) / (float)BAKEDPOINTS), getYForT((i + 1) / (float)BAKEDPOINTS));
}
const auto ELAPSEDUS = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGIN).count() / 1000.f;
const auto ELAPSEDUS = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGIN).count() / 1000.f;
const auto POINTSSIZE = m_aPointsBaked.size() * sizeof(m_aPointsBaked[0]) / 1000.f;
const auto BEGINCALC = std::chrono::high_resolution_clock::now();
@@ -29,9 +31,8 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
getYForPoint(i);
const auto ELAPSEDCALCAVG = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGINCALC).count() / 1000.f / 10.f;
Debug::log(LOG, "Created a bezier curve, baked %i points, mem usage: %.2fkB, time to bake: %.2fµs. Estimated average calc time: %.2fµs.",
BAKEDPOINTS, POINTSSIZE, ELAPSEDUS, ELAPSEDCALCAVG);
Debug::log(LOG, "Created a bezier curve, baked %i points, mem usage: %.2fkB, time to bake: %.2fµs. Estimated average calc time: %.2fµs.", BAKEDPOINTS, POINTSSIZE, ELAPSEDUS,
ELAPSEDCALCAVG);
}
float CBezierCurve::getYForT(float t) {
@@ -44,29 +45,32 @@ float CBezierCurve::getXForT(float t) {
// Todo: this probably can be done better and faster
float CBezierCurve::getYForPoint(float x) {
// binary search for the range UPDOWN X
float upperT = 1;
float lowerT = 0;
float mid = 0.5;
if (x >= 1.0)
return 1.0;
while(std::abs(upperT - lowerT) > INVBAKEDPOINTS) {
if (m_aPointsBaked[((int)(mid * (float)BAKEDPOINTS))].x > x) {
// binary search for the range UPDOWN X
int upperT = BAKEDPOINTS - 1;
int lowerT = 0;
int mid = upperT / 2;
while (std::abs(upperT - lowerT) > 1) {
if (m_aPointsBaked[mid].x > x) {
upperT = mid;
} else {
lowerT = mid;
}
mid = (upperT + lowerT) / 2.f;
mid = (upperT + lowerT) / 2;
}
// in the name of performance i shall make a hack
const auto LOWERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * lowerT), 0, 199)];
const auto UPPERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * upperT), 0, 199)];
const auto LOWERPOINT = &m_aPointsBaked[std::clamp(lowerT, 0, BAKEDPOINTS - 1)];
const auto UPPERPOINT = &m_aPointsBaked[std::clamp(upperT, 0, BAKEDPOINTS - 1)];
const auto PERCINDELTA = (x - LOWERPOINT->x) / (UPPERPOINT->x - LOWERPOINT->x);
if (std::isnan(PERCINDELTA) || std::isinf(PERCINDELTA)) // can sometimes happen for VERY small x
if (std::isnan(PERCINDELTA) || std::isinf(PERCINDELTA)) // can sometimes happen for VERY small x
return 0.f;
return LOWERPOINT->y + (UPPERPOINT->y - UPPERPOINT->y) * PERCINDELTA;
return LOWERPOINT->y + (UPPERPOINT->y - LOWERPOINT->y) * PERCINDELTA;
}

View File

@@ -3,25 +3,25 @@
#include "../defines.hpp"
#include <deque>
constexpr int BAKEDPOINTS = 200;
constexpr int BAKEDPOINTS = 255;
constexpr float INVBAKEDPOINTS = 1.f / BAKEDPOINTS;
// an implementation of a cubic bezier curve
// might do better later
// TODO: n-point curves
class CBezierCurve {
public:
public:
// sets up the bezier curve.
// this EXCLUDES the 0,0 and 1,1 points,
void setup(std::vector<Vector2D>* points);
void setup(std::vector<Vector2D>* points);
float getYForT(float t);
float getXForT(float t);
float getYForPoint(float x);
float getYForT(float t);
float getXForT(float t);
float getYForPoint(float x);
private:
private:
// this INCLUDES the 0,0 and 1,1 points.
std::deque<Vector2D> m_dPoints;
std::deque<Vector2D> m_dPoints;
std::array<Vector2D, BAKEDPOINTS> m_aPointsBaked;
std::array<Vector2D, BAKEDPOINTS> m_aPointsBaked;
};

View File

@@ -1,9 +1,7 @@
#include "Color.hpp"
#include "../defines.hpp"
CColor::CColor() {
}
CColor::CColor() {}
CColor::CColor(float r, float g, float b, float a) {
this->r = r;
@@ -13,10 +11,10 @@ CColor::CColor(float r, float g, float b, float a) {
}
CColor::CColor(uint64_t hex) {
this->r = RED(hex) * 255.f;
this->g = GREEN(hex) * 255.f;
this->b = BLUE(hex) * 255.f;
this->a = ALPHA(hex) * 255.f;
this->r = RED(hex);
this->g = GREEN(hex);
this->b = BLUE(hex);
this->a = ALPHA(hex);
}
uint64_t CColor::getAsHex() {

View File

@@ -1,30 +1,30 @@
#pragma once
#include "../includes.hpp"
#include <cstdint>
class CColor {
public:
public:
CColor();
CColor(float, float, float, float);
CColor(uint64_t);
float r = 0, g = 0, b = 0, a = 255;
float r = 0, g = 0, b = 0, a = 1.f;
uint64_t getAsHex();
uint64_t getAsHex();
CColor operator- (const CColor& c2) const {
CColor operator-(const CColor& c2) const {
return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a);
}
CColor operator+ (const CColor& c2) const {
CColor operator+(const CColor& c2) const {
return CColor(r + c2.r, g + c2.g, b + c2.b, a + c2.a);
}
CColor operator* (const float& v) const {
CColor operator*(const float& v) const {
return CColor(r * v, g * v, b * v, a * v);
}
bool operator==(const CColor& c2) const {
return r == c2.r && g == c2.g && b == c2.b && a == c2.a;
}
};
};

View File

@@ -2,176 +2,255 @@
#include "../defines.hpp"
#include <algorithm>
#include "../Compositor.hpp"
#include <set>
#include <sys/utsname.h>
#include <iomanip>
#include <sstream>
static const float transforms[][9] = {{
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
0.0f, 1.0f, 0.0f,
-1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
-1.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
0.0f, -1.0f, 0.0f,
1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
-1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
0.0f, 1.0f, 0.0f,
1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
1.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
0.0f, -1.0f, 0.0f,
-1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/sysctl.h>
#if defined(__DragonFly__)
#include <sys/kinfo.h> // struct kinfo_proc
#elif defined(__FreeBSD__)
#include <sys/user.h> // struct kinfo_proc
#endif
#if defined(__NetBSD__)
#undef KERN_PROC
#define KERN_PROC KERN_PROC2
#define KINFO_PROC struct kinfo_proc2
#else
#define KINFO_PROC struct kinfo_proc
#endif
#if defined(__DragonFly__)
#define KP_PPID(kp) kp.kp_ppid
#elif defined(__FreeBSD__)
#define KP_PPID(kp) kp.ki_ppid
#else
#define KP_PPID(kp) kp.p_ppid
#endif
#endif
static const float transforms[][9] = {
{
1.0f,
0.0f,
0.0f,
0.0f,
1.0f,
0.0f,
0.0f,
0.0f,
1.0f,
},
{
0.0f,
1.0f,
0.0f,
-1.0f,
0.0f,
0.0f,
0.0f,
0.0f,
1.0f,
},
{
-1.0f,
0.0f,
0.0f,
0.0f,
-1.0f,
0.0f,
0.0f,
0.0f,
1.0f,
},
{
0.0f,
-1.0f,
0.0f,
1.0f,
0.0f,
0.0f,
0.0f,
0.0f,
1.0f,
},
{
-1.0f,
0.0f,
0.0f,
0.0f,
1.0f,
0.0f,
0.0f,
0.0f,
1.0f,
},
{
0.0f,
1.0f,
0.0f,
1.0f,
0.0f,
0.0f,
0.0f,
0.0f,
1.0f,
},
{
1.0f,
0.0f,
0.0f,
0.0f,
-1.0f,
0.0f,
0.0f,
0.0f,
1.0f,
},
{
0.0f,
-1.0f,
0.0f,
-1.0f,
0.0f,
0.0f,
0.0f,
0.0f,
1.0f,
},
};
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
ASSERT(pSignal);
ASSERT(pListener);
wl_signal_add(pSignal, pListener);
std::string absolutePath(const std::string& rawpath, const std::string& currentPath) {
auto value = rawpath;
Debug::log(LOG, "Registered signal for owner %x: %x -> %x (owner: %s)", pOwner, pSignal, pListener, ownerString.c_str());
if (value[0] == '.') {
auto currentDir = currentPath.substr(0, currentPath.find_last_of('/'));
if (value[1] == '.') {
auto parentDir = currentDir.substr(0, currentDir.find_last_of('/'));
value.replace(0, 2 + currentPath.empty(), parentDir);
} else {
value.replace(0, 1 + currentPath.empty(), currentDir);
}
}
if (value[0] == '~') {
static const char* const ENVHOME = getenv("HOME");
value.replace(0, 1, std::string(ENVHOME));
}
return value;
}
void handleNoop(struct wl_listener *listener, void *data) {
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, const std::string& ownerString) {
ASSERT(pSignal);
ASSERT(pListener);
wl_signal_add(pSignal, pListener);
Debug::log(LOG, "Registered signal for owner %lx: %lx -> %lx (owner: %s)", pOwner, pSignal, pListener, ownerString.c_str());
}
void handleNoop(struct wl_listener* listener, void* data) {
// Do nothing
}
void wlr_signal_emit_safe(struct wl_signal *signal, void *data) {
struct wl_listener cursor;
struct wl_listener end;
/* Add two special markers: one cursor and one end marker. This way, we know
* that we've already called listeners on the left of the cursor and that we
* don't want to call listeners on the right of the end marker. The 'it'
* function can remove any element it wants from the list without troubles.
* wl_list_for_each_safe tries to be safe but it fails: it works fine
* if the current item is removed, but not if the next one is. */
wl_list_insert(&signal->listener_list, &cursor.link);
cursor.notify = handleNoop;
wl_list_insert(signal->listener_list.prev, &end.link);
end.notify = handleNoop;
while (cursor.link.next != &end.link) {
struct wl_list *pos = cursor.link.next;
struct wl_listener *l = wl_container_of(pos, l, link);
wl_list_remove(&cursor.link);
wl_list_insert(pos, &cursor.link);
l->notify(l, data);
}
wl_list_remove(&cursor.link);
wl_list_remove(&end.link);
}
std::string getFormat(const char *fmt, ...) {
char buf[LOGMESSAGESIZE] = "";
char* outputStr;
int logLen;
std::string getFormat(const char* fmt, ...) {
char* outputStr = nullptr;
va_list args;
va_start(args, fmt);
logLen = vsnprintf(buf, sizeof buf, fmt, args);
vasprintf(&outputStr, fmt, args);
va_end(args);
if ((long unsigned int)logLen < sizeof buf) {
outputStr = strdup(buf);
} else {
outputStr = (char*)malloc(logLen + 1);
if (!outputStr) {
printf("CRITICAL: Cannot alloc size %d for log! (Out of memory?)", logLen + 1);
return "";
}
va_start(args, fmt);
vsnprintf(outputStr, logLen + 1U, fmt, args);
va_end(args);
}
std::string output = std::string(outputStr);
free(outputStr);
return output;
}
std::string escapeJSONStrings(const std::string& str) {
std::ostringstream oss;
for (auto& c : str) {
switch (c) {
case '"': oss << "\\\""; break;
case '\\': oss << "\\\\"; break;
case '\b': oss << "\\b"; break;
case '\f': oss << "\\f"; break;
case '\n': oss << "\\n"; break;
case '\r': oss << "\\r"; break;
case '\t': oss << "\\t"; break;
default:
if ('\x00' <= c && c <= '\x1f') {
oss << "\\u" << std::hex << std::setw(4) << std::setfill('0') << static_cast<int>(c);
} else {
oss << c;
}
}
}
return oss.str();
}
void scaleBox(wlr_box* box, float scale) {
box->width = std::round(box->width * scale);
box->width = std::round(box->width * scale);
box->height = std::round(box->height * scale);
box->x = std::round(box->x * scale);
box->y = std::round(box->y * scale);
box->x = std::round(box->x * scale);
box->y = std::round(box->y * scale);
}
std::string removeBeginEndSpacesTabs(std::string str) {
while (str[0] == ' ' || str[0] == '\t') {
str = str.substr(1);
if (str.empty())
return str;
int countBefore = 0;
while (str[countBefore] == ' ' || str[countBefore] == '\t') {
countBefore++;
}
while (str.length() != 0 && (str[str.length() - 1] == ' ' || str[str.length() - 1] == '\t')) {
str = str.substr(0, str.length() - 1);
int countAfter = 0;
while ((int)str.length() - countAfter - 1 >= 0 && (str[str.length() - countAfter - 1] == ' ' || str[str.length() - 1 - countAfter] == '\t')) {
countAfter++;
}
str = str.substr(countBefore, str.length() - countBefore - countAfter);
return str;
}
float getPlusMinusKeywordResult(std::string source, float relative) {
float result = INT_MAX;
if (source.find_first_of("+") == 0) {
try {
if (source.contains("."))
result = relative + std::stof(source.substr(1));
else
result = relative + std::stoi(source.substr(1));
} catch (...) {
Debug::log(ERR, "Invalid arg \"%s\" in getPlusMinusKeywordResult!", source.c_str());
return INT_MAX;
}
} else if (source.find_first_of("-") == 0) {
try {
if (source.contains("."))
result = relative - std::stof(source.substr(1));
else
result = relative - std::stoi(source.substr(1));
} catch (...) {
Debug::log(ERR, "Invalid arg \"%s\" in getPlusMinusKeywordResult!", source.c_str());
return INT_MAX;
}
} else {
try {
if (source.contains("."))
result = stof(source);
else
result = stoi(source);
} catch (...) {
Debug::log(ERR, "Invalid arg \"%s\" in getPlusMinusKeywordResult!", source.c_str());
return INT_MAX;
}
try {
return relative + stof(source);
} catch (...) {
Debug::log(ERR, "Invalid arg \"%s\" in getPlusMinusKeywordResult!", source.c_str());
return INT_MAX;
}
return result;
}
bool isNumber(const std::string& str, bool allowfloat) {
return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); });
std::string copy = str;
if (*copy.begin() == '-')
copy = copy.substr(1);
if (copy.empty())
return false;
bool point = !allowfloat;
for (auto& c : copy) {
if (c == '.') {
if (point)
return false;
point = true;
continue;
}
if (!std::isdigit(c))
return false;
}
return true;
}
bool isDirection(const std::string& arg) {
@@ -182,18 +261,187 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
int result = INT_MAX;
if (in.find("special") == 0) {
outName = "special";
return SPECIAL_WORKSPACE_ID;
if (in.length() > 8) {
const auto NAME = in.substr(8);
const auto WS = g_pCompositor->getWorkspaceByName("special:" + NAME);
outName = "special:" + NAME;
return WS ? WS->m_iID : g_pCompositor->getNewSpecialID();
}
return SPECIAL_WORKSPACE_START;
} else if (in.find("name:") == 0) {
const auto WORKSPACENAME = in.substr(in.find_first_of(':') + 1);
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
if (!WORKSPACE) {
result = g_pCompositor->getNextAvailableNamedWorkspace();
} else {
result = WORKSPACE->m_iID;
}
outName = WORKSPACENAME;
} else if (in.find("empty") == 0) {
int id = 0;
while (++id < INT_MAX) {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
if (!PWORKSPACE || (g_pCompositor->getWindowsOnWorkspace(id) == 0))
return id;
}
} else if (in.find("prev") == 0) {
if (!g_pCompositor->m_pLastMonitor)
return INT_MAX;
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
if (!PWORKSPACE)
return INT_MAX;
const auto PLASTWORKSPACE = g_pCompositor->getWorkspaceByID(PWORKSPACE->m_sPrevWorkspace.iID);
if (!PLASTWORKSPACE)
return INT_MAX;
outName = PLASTWORKSPACE->m_szName;
return PLASTWORKSPACE->m_iID;
} else {
if (in[0] == 'm') {
if (in[0] == 'r' && (in[1] == '-' || in[1] == '+') && isNumber(in.substr(2))) {
if (!g_pCompositor->m_pLastMonitor) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
result = INT_MAX;
return result;
}
result = (int)getPlusMinusKeywordResult(in.substr(1), 0);
int remains = (int)result;
std::set<int> invalidWSes;
// Collect all the workspaces we can't jump to.
for (auto& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)) {
// Can't jump to this workspace
invalidWSes.insert(ws->m_iID);
}
}
for (auto& rule : g_pConfigManager->getAllWorkspaceRules()) {
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
if (!PMONITOR || PMONITOR->ID == g_pCompositor->m_pLastMonitor->ID) {
// Can't be invalid
continue;
}
// WS is bound to another monitor, can't jump to this
invalidWSes.insert(rule.workspaceId);
}
// Prepare all named workspaces in case when we need them
std::vector<int> namedWSes;
for (auto& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) || ws->m_iID >= 0)
continue;
namedWSes.push_back(ws->m_iID);
}
std::sort(namedWSes.begin(), namedWSes.end());
// Just take a blind guess at where we'll probably end up
int predictedWSID = g_pCompositor->m_pLastMonitor->activeWorkspace + remains;
int remainingWSes = 0;
char walkDir = in[1];
// sanitize. 0 means invalid oob in -
predictedWSID = std::max(predictedWSID, 0);
// Count how many invalidWSes are in between (how bad the prediction was)
int beginID = in[1] == '+' ? g_pCompositor->m_pLastMonitor->activeWorkspace + 1 : predictedWSID;
int endID = in[1] == '+' ? predictedWSID : g_pCompositor->m_pLastMonitor->activeWorkspace;
auto begin = invalidWSes.upper_bound(beginID - 1); // upper_bound is >, we want >=
for (auto it = begin; *it <= endID && it != invalidWSes.end(); it++) {
remainingWSes++;
}
// Handle named workspaces. They are treated like always before other workspaces
if (g_pCompositor->m_pLastMonitor->activeWorkspace < 0) {
// Behaviour similar to 'm'
// Find current
int currentItem = -1;
for (size_t i = 0; i < namedWSes.size(); i++) {
if (namedWSes[i] == g_pCompositor->m_pLastMonitor->activeWorkspace) {
currentItem = i;
break;
}
}
currentItem += remains;
currentItem = std::max(currentItem, 0);
if (currentItem >= (int)namedWSes.size()) {
// At the seam between namedWSes and normal WSes. Behave like r+[diff] at imaginary ws 0
int diff = currentItem - (namedWSes.size() - 1);
predictedWSID = diff;
int beginID = 1;
int endID = predictedWSID;
auto begin = invalidWSes.upper_bound(beginID - 1); // upper_bound is >, we want >=
for (auto it = begin; *it <= endID && it != invalidWSes.end(); it++) {
remainingWSes++;
}
walkDir = '+';
} else {
// We found our final ws.
remainingWSes = 0;
predictedWSID = namedWSes[currentItem];
}
}
// Go in the search direction for remainingWSes
// The performance impact is directly proportional to the number of open and bound workspaces
int finalWSID = predictedWSID;
if (walkDir == '-') {
int beginID = finalWSID;
int curID = finalWSID;
while (--curID > 0 && remainingWSes > 0) {
if (invalidWSes.find(curID) == invalidWSes.end()) {
remainingWSes--;
}
finalWSID = curID;
}
if (finalWSID <= 0 || invalidWSes.find(finalWSID) != invalidWSes.end()) {
if (namedWSes.size()) {
// Go to the named workspaces
// Need remainingWSes more
int namedWSIdx = namedWSes.size() - remainingWSes;
// Sanitze
namedWSIdx = std::clamp(namedWSIdx, 0, (int)namedWSes.size() - 1);
finalWSID = namedWSes[namedWSIdx];
} else {
// Couldn't find valid workspace in negative direction, search last first one back up positive direction
walkDir = '+';
// We know, that everything less than beginID is invalid, so don't bother with that
finalWSID = beginID;
remainingWSes = 1;
}
}
}
if (walkDir == '+') {
int curID = finalWSID;
while (++curID < INT32_MAX && remainingWSes > 0) {
if (invalidWSes.find(curID) == invalidWSes.end()) {
remainingWSes--;
}
finalWSID = curID;
}
}
result = finalWSID;
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(result);
if (PWORKSPACE)
outName = g_pCompositor->getWorkspaceByID(result)->m_szName;
else
outName = std::to_string(finalWSID);
} else if ((in[0] == 'm' || in[0] == 'e') && (in[1] == '-' || in[1] == '+') && isNumber(in.substr(2))) {
bool onAllMonitors = in[0] == 'e';
if (!g_pCompositor->m_pLastMonitor) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
result = INT_MAX;
@@ -204,76 +452,76 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
result = (int)getPlusMinusKeywordResult(in.substr(1), 0);
// result now has +/- what we should move on mon
int remains = (int)result;
int currentID = g_pCompositor->m_pLastMonitor->activeWorkspace;
int searchID = currentID;
int remains = (int)result;
while (remains != 0) {
if (remains < 0)
searchID--;
else
searchID++;
if (g_pCompositor->workspaceIDOutOfBounds(searchID)){
// means we need to wrap around
int lowestID = 99999;
int highestID = -99999;
std::vector<int> validWSes;
for (auto& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID && !onAllMonitors))
continue;
for (auto& w : g_pCompositor->m_vWorkspaces) {
if (w->m_iID < lowestID)
lowestID = w->m_iID;
validWSes.push_back(ws->m_iID);
}
if (w->m_iID > highestID)
highestID = w->m_iID;
}
std::sort(validWSes.begin(), validWSes.end());
if (remains < 0)
searchID = highestID;
else
searchID = lowestID;
}
// get the offset
remains = remains < 0 ? -((-remains) % validWSes.size()) : remains % validWSes.size();
if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(searchID); PWORKSPACE && PWORKSPACE->m_iID != SPECIAL_WORKSPACE_ID) {
if (PWORKSPACE->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID) {
currentID = PWORKSPACE->m_iID;
if (remains < 0)
remains++;
else
remains--;
}
// get the current item
int currentItem = -1;
for (size_t i = 0; i < validWSes.size(); i++) {
if (validWSes[i] == g_pCompositor->m_pLastMonitor->activeWorkspace) {
currentItem = i;
break;
}
}
result = currentID;
outName = g_pCompositor->getWorkspaceByID(currentID)->m_szName;
// apply
currentItem += remains;
// sanitize
if (currentItem >= (int)validWSes.size()) {
currentItem = currentItem % validWSes.size();
} else if (currentItem < 0) {
currentItem = validWSes.size() + currentItem;
}
result = validWSes[currentItem];
outName = g_pCompositor->getWorkspaceByID(validWSes[currentItem])->m_szName;
} else {
if (g_pCompositor->m_pLastMonitor)
result = std::clamp((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1, INT_MAX);
else if (isNumber(in))
result = std::clamp(std::stoi(in), 1, INT_MAX);
if (in[0] == '+' || in[0] == '-') {
if (g_pCompositor->m_pLastMonitor)
result = std::max((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1);
else {
Debug::log(ERR, "Relative workspace on no mon!");
result = INT_MAX;
}
} else if (isNumber(in))
result = std::max(std::stoi(in), 1);
else {
Debug::log(ERR, "Relative workspace on no mon!");
result = INT_MAX;
// maybe name
const auto PWORKSPACE = g_pCompositor->getWorkspaceByName(in);
if (PWORKSPACE)
result = PWORKSPACE->m_iID;
}
outName = std::to_string(result);
}
}
}
return result;
}
float vecToRectDistanceSquared(const Vector2D& vec, const Vector2D& p1, const Vector2D& p2) {
const float DX = std::max((double)0, std::max(p1.x - vec.x, vec.x - p2.x));
const float DY = std::max((double)0, std::max(p1.y - vec.y, vec.y - p2.y));
const float DX = std::max({0.0, p1.x - vec.x, vec.x - p2.x});
const float DY = std::max({0.0, p1.y - vec.y, vec.y - p2.y});
return DX * DX + DY * DY;
}
// Execute a shell command and get the output
std::string execAndGet(const char* cmd) {
std::array<char, 128> buffer;
std::string result;
std::array<char, 128> buffer;
std::string result;
const std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose);
if (!pipe) {
Debug::log(ERR, "execAndGet: failed in pipe");
@@ -295,6 +543,19 @@ void logSystemInfo() {
Debug::log(LOG, "Release: %s", unameInfo.release);
Debug::log(LOG, "Version: %s", unameInfo.version);
Debug::log(NONE, "\n");
#if defined(__DragonFly__) || defined(__FreeBSD__)
const std::string GPUINFO = execAndGet("pciconf -lv | fgrep -A4 vga");
#else
const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA");
#endif
Debug::log(LOG, "GPU information:\n%s\n", GPUINFO.c_str());
if (GPUINFO.contains("NVIDIA")) {
Debug::log(WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
}
// log etc
Debug::log(LOG, "os-release:");
@@ -305,14 +566,14 @@ void matrixProjection(float mat[9], int w, int h, wl_output_transform tr) {
memset(mat, 0, sizeof(*mat) * 9);
const float* t = transforms[tr];
float x = 2.0f / w;
float y = 2.0f / h;
float x = 2.0f / w;
float y = 2.0f / h;
// Rotation + reflection
mat[0] = x * t[0];
mat[1] = x * t[1];
mat[3] = y * -t[3];
mat[4] = y * -t[4];
mat[3] = y * t[3];
mat[4] = y * t[4];
// Translation
mat[2] = -copysign(1.0f, mat[0] + mat[1]);
@@ -321,3 +582,117 @@ void matrixProjection(float mat[9], int w, int h, wl_output_transform tr) {
// Identity
mat[8] = 1.0f;
}
int64_t getPPIDof(int64_t pid) {
#if defined(KERN_PROC_PID)
int mib[] = {
CTL_KERN,
KERN_PROC,
KERN_PROC_PID,
(int)pid,
#if defined(__NetBSD__) || defined(__OpenBSD__)
sizeof(KINFO_PROC),
1,
#endif
};
u_int miblen = sizeof(mib) / sizeof(mib[0]);
KINFO_PROC kp;
size_t sz = sizeof(KINFO_PROC);
if (sysctl(mib, miblen, &kp, &sz, NULL, 0) != -1)
return KP_PPID(kp);
return 0;
#else
std::string dir = "/proc/" + std::to_string(pid) + "/status";
FILE* infile;
infile = fopen(dir.c_str(), "r");
if (!infile)
return 0;
char* line = nullptr;
size_t len = 0;
ssize_t len2 = 0;
std::string pidstr;
while ((len2 = getline(&line, &len, infile)) != -1) {
if (strstr(line, "PPid:")) {
pidstr = std::string(line, len2);
const auto tabpos = pidstr.find_last_of('\t');
if (tabpos != std::string::npos)
pidstr = pidstr.substr(tabpos);
break;
}
}
fclose(infile);
if (line)
free(line);
try {
return std::stoll(pidstr);
} catch (std::exception& e) { return 0; }
#endif
}
int64_t configStringToInt(const std::string& VALUE) {
if (VALUE.find("0x") == 0) {
// Values with 0x are hex
const auto VALUEWITHOUTHEX = VALUE.substr(2);
return stol(VALUEWITHOUTHEX, nullptr, 16);
} else if (VALUE.find("rgba(") == 0 && VALUE.find(')') == VALUE.length() - 1) {
const auto VALUEWITHOUTFUNC = VALUE.substr(5, VALUE.length() - 6);
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 8) {
Debug::log(WARN, "invalid length %i for rgba", VALUEWITHOUTFUNC.length());
throw std::invalid_argument("rgba() expects length of 8 characters (4 bytes)");
}
const auto RGBA = std::stol(VALUEWITHOUTFUNC, nullptr, 16);
// now we need to RGBA -> ARGB. The config holds ARGB only.
return (RGBA >> 8) + 0x1000000 * (RGBA & 0xFF);
} else if (VALUE.find("rgb(") == 0 && VALUE.find(')') == VALUE.length() - 1) {
const auto VALUEWITHOUTFUNC = VALUE.substr(4, VALUE.length() - 5);
if (removeBeginEndSpacesTabs(VALUEWITHOUTFUNC).length() != 6) {
Debug::log(WARN, "invalid length %i for rgb", VALUEWITHOUTFUNC.length());
throw std::invalid_argument("rgb() expects length of 6 characters (3 bytes)");
}
const auto RGB = std::stol(VALUEWITHOUTFUNC, nullptr, 16);
return RGB + 0xFF000000; // 0xFF for opaque
} else if (VALUE.find("true") == 0 || VALUE.find("on") == 0 || VALUE.find("yes") == 0) {
return 1;
} else if (VALUE.find("false") == 0 || VALUE.find("off") == 0 || VALUE.find("no") == 0) {
return 0;
}
return std::stoll(VALUE);
}
double normalizeAngleRad(double ang) {
if (ang > M_PI * 2) {
while (ang > M_PI * 2)
ang -= M_PI * 2;
return ang;
}
if (ang < 0.0) {
while (ang < 0.0)
ang += M_PI * 2;
return ang;
}
return ang;
}
std::string replaceInString(std::string subject, const std::string& search, const std::string& replace) {
size_t pos = 0;
while ((pos = subject.find(search, pos)) != std::string::npos) {
subject.replace(pos, search.length(), replace);
pos += replace.length();
}
return subject;
}

Some files were not shown because too many files have changed in this diff Show More