Commit Graph

4031 Commits

Author SHA1 Message Date
Tomáš Janoušek
d2b174f269 Merge pull request #688 from liskin/dynamic-workspaces-nub-refresh-loop
X.H.ManageDocks: Avoid unnecessary refresh (loop) for decorations

This started as an investigation of the root cause of
<https://github.com/xmonad/xmonad-contrib/issues/565>, which was
addressed by <https://github.com/xmonad/xmonad-contrib/pull/621> without
having a full understanding of why xmonad ends up in a busy loop.

What was going on:

* X.L.SubLayouts group update algorithm assumes no duplicities in the
  Stack, and results in multiplying those duplicities otherwise. Note
  that this is a reasonable assumption—duplicities in a Stack have no
  defined behaviour in xmonad (X11 can't place a window on a screen
  twice), so "fixing" this algorithm is a waste of time.

* X.L.Decoration creates windows which X.H.ManageDocks treats as
  possible docks, resulting in extra refresh whenever they appear.

* The extra refresh causes X.L.SubLayouts to multiply the duplicities,
  X.L.Decoration to create new decoration windows, and these invalidate
  the X.H.ManageDocks strut cache, leading to yet another refresh, and
  an endless loop of these.

Having concluded that the no-duplicities assumption is a reasonable one,
there's nothing really to fix here after
<https://github.com/xmonad/xmonad-contrib/pull/621>. Still, the extra
refresh might be causing extra flicker in decorated layouts, and we can
easily avoid it, so I do that here. Plus a bit of documentation for
X.L.SubLayouts.
2022-02-20 18:24:59 +00:00
Tomas Janousek
253b952814 X.L.SubLayouts: Document assumptions/pre-conditions of toGroupStack
This started as an investigation/fix of xmonad freezing when a bug in
X.A.DynamicWorkspaces caused duplicate Windows in a single Workspace
Stack, but I soon(-ish) realized that trying to make SubLayouts robust
enough to handle duplicities in a Stack is futile. Any code that creates
duplicities in a Stack is buggy, and must be fixed; the rest can assume
there aren't any.

Instead, let's just document that this is a pre-condition, and that (and
how) stuff will misbehave.

Related: https://github.com/xmonad/xmonad-contrib/issues/565
2022-02-20 18:22:19 +00:00
Tomas Janousek
a6c048899c X.L.SubLayouts: Use ScopedTypeVariables as intended years ago
We don't need to support GHC 6.8.2 any more. :-)
2022-02-20 18:22:19 +00:00
Tomas Janousek
6a6e4bcce8 X.H.ManageDocks: Avoid unnecessary refresh (loop) for decorations
Windows created by X.U.XUtils.createNewWindow have _NET_WM_WINDOW_TYPE =
_NET_WM_WINDOW_TYPE_DESKTOP, which caused checkDock to match them and an
UpdateDocks event to be sent, causing an additional layout refresh
whenever a decoration window appeared.

This could in theory lead to a refresh loop with a layout (modifier)
that dropped and recreated its decoration windows on every
runLayout—which isn't entirely unreasonable, X.L.MouseResizableTile does
it, just luckily happens to not mark its windows as
_NET_WM_WINDOW_TYPE_DESKTOP.

In practice, such a refresh loop could be triggered when buggy
X.A.DynamicWorkspaces (before 929a6a3f6f) duplicated a Window in a
single workspace's Stack, and buggy X.L.SubLayouts then kept duplicating
the duplication (2 → 4 → 8 → …), triggering the creation of new
decoration window in each iteration.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/565
2022-02-20 18:22:19 +00:00
slotThe
e98d666447 X.U.XUtils: Fix alignment in showSimpleWindow 2022-02-19 11:52:44 +01:00
Tony Zorman
ee3ea2402d Merge pull request #685 from slotThe/ezconfig-property-tests
X.U.EZConfig: Add property tests
2022-02-13 16:16:54 +01:00
slotThe
153d46fd90 tests: Add property tests for X.U.EZConfig
Adds property tests in both directions for the parser in X.U.EZConfig.
As with the tests for X.P.OrgMode, these (modulo `Maybe` noise) take the
shape of the operation of an inverse semigroup:

    pp ∘ p ∘ pp ≡ pp        and        p ∘ pp ∘ p = p,

where pp is pretty-printing and p is parsing.
2022-02-13 15:00:21 +01:00
slotThe
7d91a1bf85 X.Prelude: Improve keyToString output
The keysymToString function prints the key names in pure ASCII; e.g.,
`keysymToString 250` returns "uacute" instead of "ú".  This is
undesirable when printing these keysyms in places like visualSubmap.

Thus, move all of the key infrastructure (heh) from X.U.EZConfig to
X.Prelude and look up the name of the key if possible.  For better
composability, slightly change the signature for `regularKeys` and the
associated parser.
2022-02-13 14:49:02 +01:00
slotThe
e6b50c5dd6 X.Prelude: Concat modifier keys instead of unwording
Instead of printing "M- S- C-", print "M-S-C".
2022-02-13 14:46:23 +01:00
Tomáš Janoušek
493b6adbc4 Merge pull request #686 from liskin/keypress-fixes
X.{A.{{Grid,Tree}Select,Submap},Prompt}: KeyPress handling fixes
2022-02-13 10:22:54 +00:00
Tomas Janousek
1b728ff96a CHANGES: Document the key bindings changes 2022-02-10 15:01:10 +00:00
Nikolay Yakimov
68c967ec0c X.A.{Grid,Tree}Select, X.Prompt: Fix keybindings like Shift-Tab and similar
This changes KeyPress handling in these modules to behave much closer to
how xmonad core itself handles keypresses. The primary difference lies
in that xmonad reads raw KeyCode and then converts it to unmodified
KeySym, while these modules used `lookupString` to find the actual
keysyms. As a consequence, key definitions like `(shiftMap, xK_Tab)`
didn't work on many layouts because an actual KeySym for `Shift-Tab` is
commonly `ISO_LEFT_TAB`, and not `Tab`.

Closes: https://github.com/xmonad/xmonad-contrib/pull/590
Co-authored-by: Tomas Janousek <tomi@nomi.cz>
2022-02-10 14:42:23 +00:00
Tomas Janousek
12c5518852 X.A.Submap, X.Prompt: Use cleanKeyMask
This replaces the custom `cleanMask` extension in these modules—which
only filtered out XKB group bits and Button5Mask¹—with the new
`cleanKeyMask` which additionally filters out all mouse buttons, as
these aren't relevant for key bindings.

¹) Filtering out Button5Mask was probably an off-by-one mistake.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/290
Related: https://github.com/xmonad/xmonad-contrib/pull/590
2022-02-10 14:23:01 +00:00
Tomas Janousek
adced0a8c8 X.A.{Grid,Tree}Select: Fix keybindings in secondary kbd layouts
We didn't clean XKB group bits out of the KeyPress events' state so key
bindings only worked in the primary keyboard layout (first XKB group).
To fix this, this adds a `cleanKeyMask` function to X.Prelude which is
analogous to `cleanMask` but aimed at cleaning regular KeyPress states
(as opposed to just KeyPresses from passive key grabs), and this is then
used instead of `cleanMask`.

Related: https://github.com/xmonad/xmonad-contrib/issues/290
Related: https://github.com/xmonad/xmonad-contrib/pull/590
2022-02-09 23:53:16 +00:00
Tomas Janousek
2e3254a908 X.H.Rescreen: Catch exceptions in user-provided hooks in add*Hook
This way a single failing hook won't disturb other hooks (not just
rescreen hooks, also other event hooks).
2022-02-03 11:53:54 +00:00
Tomas Janousek
7445390432 X.H.Rescreen: Improve usage doc (recommend add*Hook)
There's no reason (other than me forgetting to update the docs when
these add-Hooks were added) to steer users towards the ugly record-based
low-level API.
2022-02-03 11:49:34 +00:00
Tony Zorman
a49b664276 Merge pull request #680 from slotThe/visual-submap
X.A.Submap: Add `visualSubmap`
2022-02-03 09:38:13 +01:00
slotThe
cf1d966ee6 X.A.Submap: Add visualSubmap
Add a `visualSubmap` function, which works much like the regular
`submap` one, except that it visualises the available choices in a
pop-up window.

Related: https://github.com/xmonad/xmonad-contrib/issues/472
2022-02-03 08:53:33 +01:00
slotThe
86b816ec50 X.U.XUtils: Add framework for manipulating simple windows
Adds several new functions and type for manipulating "simple windows".

There are several ways to draw windows in X.U.XUtils and other places
already, but they are all quite manual.  Most of the time one does not
want to think about dimensions much and assumes that the code is smart
enough to "figure it out"; this is an attempt to do exactly that.

There is a less-managed version `showSimpleWindow`, which just creates
and shows the windows, as well as a wrapper-like `withSimpleWindow` that
also destroys the window once some action finishes executing.

With these functions it should be possible to refactor some contrib
modules that currently draw windows manually, like X.U.EasyMotion.
2022-02-03 08:53:22 +01:00
slotThe
505577b755 X.Prelude: Add keymaskToString, keyToString
This technically introduces a regression with regards to the way that
modifier masks are printed in X.U.NamedActions and X.H.DebugEvents.
However, since this way of printing masks is move in line with
X.U.EZConfig, I personally don't think that this is noteworthy.
2022-02-03 08:53:22 +01:00
Tomas Janousek
54095f5420 X.U.Hacks: Clean up tray padding hooks a bit
Un-export trivial/useless definitions and adapt the generic versions of
trayerPaddingXmobarEventHook to be more generally useful.

Related: https://github.com/xmonad/xmonad-contrib/pull/643#issuecomment-962661655
2022-02-01 19:17:30 +00:00
Tomas Janousek
d71856431a CHANGES: Fix formatting of the VoidBorders entry 2022-02-01 19:16:13 +00:00
Tomáš Janoušek
ae9b9c43a4 Merge pull request #682 from rayes0/master
X.L.VoidBorders: Add ability to reset borders for certain layouts
2022-02-01 18:39:57 +00:00
Tomas Janousek
c4d718be9a X.L.VoidBorders: Improve doc a bit 2022-02-01 18:39:33 +00:00
rayes
a3012eaa27 X.L.VoidBorders: Add ability to reset borders for certain layouts 2022-01-30 21:07:46 -07:00
slotThe
741d90eb9b X.P.Man: Use System.FilePath
Instead of hand-written functions, just use what's already provided by
filepath.
2022-01-30 10:20:04 +01:00
slotThe
c36a888a59 X.P.FuzzyMatch: Use isSubsequenceOf
The implementation is exactly the same, just that this function is now
in base, so there should be no change in behaviour.
2022-01-30 10:20:04 +01:00
Tony Zorman
56cc296754 Merge pull request #643 from tulth/trayerResizeHook
add to hacks: rough draft trayer resize event hook
2022-01-21 09:30:46 +01:00
tulthix
4d24193baa X.U.Hacks: Add tray(er) event hooks
Adds event hooks to communicate with trayer or, more generally, with
other tray programs.  For convenience, a standard query for trayer is
also provided.
2022-01-21 09:16:28 +01:00
slotThe
de886d6182 CHANGES: Remove Bluetile from deprecated modules
Was undeprecated in 981166a2ab.
2022-01-17 18:33:22 +01:00
Tomas Janousek
201a14718e X.A.GroupNavigation, X.H.WorkspaceHistory: Leak fix cleanups
Simplify stuff a bit. Prevent memory leaks additionally in:
`workspaceHistoryTransaction` and `workspaceHistoryModify`.

Related: https://github.com/xmonad/xmonad-contrib/pull/653
2022-01-15 19:12:32 +00:00
Tomas Janousek
981166a2ab Un-deprecate X.C.Bluetile
This one isn't actually a personal configuration, it's more like
X.C.Desktop and the other desktop-specific configs. As I happen to
sometimes use it for testing whether everything still works with
decorated layouts, it shouldn't be considered abandoned.

Related: https://github.com/xmonad/xmonad-contrib/pull/679
2022-01-15 18:23:59 +00:00
Tomas Janousek
2b5d2c5ab8 X.U.ActionQueue: Separate ExtState and ExtConf data types
Using the same type for both is confusing and requires a bogus Semigroup
instance.
2022-01-15 13:43:16 +00:00
Tomas Janousek
50527a4613 X.H.BorderPerWindow: Improve module synopsis 2022-01-15 13:43:16 +00:00
Tomas Janousek
20753c1bdb flake.nix: Use upstream gitignore.nix instead of Ivan's fork 2022-01-15 12:24:03 +00:00
Tomas Janousek
756d73c78c Merge branch 'mikenrafter/master' 2022-01-15 12:23:22 +00:00
Tony Zorman
f90e76248f Merge pull request #679 from slotThe/deprecate-modules
Deprecate user and abandoned modules
2022-01-14 07:55:52 +01:00
slotThe
478393fb7d Deprecate user and abandoned modules
Now that the user configs are on the website, it is time to deprecate
them.  At the same time deprecated X.C.Monad, which hasn't been updated
since 2008 and X.C.Prime, which has confused users quite recently,
thinking it to be a better starting place.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/677
Fixes: https://github.com/xmonad/xmonad-contrib/issues/595
Related: https://github.com/xmonad/xmonad-web/pull/49
2022-01-14 07:58:18 +01:00
Mike Nrafter
77ba202548 Fixed flake.nix's use of GitIgnore. 2022-01-12 20:02:33 -07:00
Tony Zorman
41ca79986b Merge pull request #676 from exorcist365/master
X.A.FloatKeys: Export ChangeDim
2022-01-08 09:05:51 +01:00
exorcist365
be1201cdeb X.A.FloatKeys: Export ChangeDim
Haddock displays exported types in a much nicer way.
2022-01-08 09:06:00 +01:00
brandon s allbery kf8nh
aad8a3a865 Missed a reference to the old SP workspace 2022-01-06 08:10:02 -05:00
slotThe
0a6048c66d X.U.EZConfig: Force readKeySequence to consume the whole input
When users specify non-existent keys, it seems most intuitive to just
abort the parse and not try to take the "longest" input that still
works.  For example, given the "key" `M-10` we should signal a parse
error (by returning `Nothing`) instead of parsing `M-1` and ignoring
the rest of the input.  The old EZConfig parser accounted for this but
when the module was rewritten to use X.U.Parser in [1], this was
forgotten about.

Fixes: https://github.com/xmonad/xmonad/issues/361

[1]: 8abeb81fd0
2022-01-05 15:06:17 +01:00
Yecine Megdiche
28d86f3a28 Merge pull request #675 from afreakk/patch-1
keysMoveWindow: change signature type D to ChangeDim in XMonad.Actions.FloatKeys
2022-01-03 11:08:42 +01:00
slotThe
324fdd802a tests: Fix typos in prop names 2022-01-03 08:59:41 +01:00
afreakk
7bcd81a7e9 keysMoveWindow signature D -> ChangeDim 2022-01-02 20:41:43 +01:00
Yecine Megdiche
5cc2db4a9a Merge pull request #674 from TheMC47/minimize-haddock-formatting
X.A.Minimize: fix formatting
2022-01-01 23:12:16 +01:00
Yecine Megdiche
be6530808f X.A.Minimize: fix formatting 2022-01-01 17:55:51 +01:00
Tony Zorman
a17e2904dd Merge pull request #671 from SimSaladin/simsaladin/minimize-improvements-rebased
X.L.BinarySpacePartition: Ignore minimized windows
2021-12-31 10:51:22 +01:00
Tony Zorman
3389241adb Merge pull request #673 from slotThe/org-mode-parser
X.P.OrgMode: Update parser tests
2021-12-31 10:02:29 +01:00