Commit Graph

3969 Commits

Author SHA1 Message Date
brandon s allbery kf8nh
d65cf05369 warn about using avoidStruts with gap modifiers 2021-12-22 16:41:30 -05:00
brandon s allbery kf8nh
2cf0a10f5b warn about use of avoidStruts with spacing modifiers 2021-12-22 16:38:11 -05:00
brandon s allbery kf8nh
a67be39673 document that avoidStruts must be applied before any modifier that
changes the screen rectangle
2021-12-22 16:27:21 -05:00
Tony Zorman
0010735aca Merge pull request #659 from slotThe/x.u.parser
New Module: XMonad.Util.Parser
2021-12-17 12:13:02 +01:00
slotThe
520c51817a X.U.EZConfig: Add simple unit tests
Add very basic unit tests for EZConfig to see if it can parse all of the
keys (and key combinations) that it promises to parse.

The long-term goal here should be to write a pretty-printer for EZConfig
and to check whether that's a proper inverse (either in the normal sense
or in the inverse semigroup sense), as the tests for X.P.OrgMode do.
2021-12-13 16:11:57 +01:00
slotThe
8abeb81fd0 X.U.EZConfig: Use X.U.Parser
Using X.U.Parser works almost as a drop-in replacement for ReadP here.
In some places (like `parseSpecial`) we need to be a little bit more
careful when constructing the parser, but this is offset a much simpler
`readKeySequence`.
2021-12-13 16:11:57 +01:00
slotThe
b1532e666f X.P.OrgMode: Use X.U.Parser
Since we now have an "internal" parser library in xmonad, use it.  This
allows us to get rid of some hacks in this module that were needed
because of ReadP's parsing behaviour.
2021-12-13 16:11:57 +01:00
slotThe
8b3df5b268 New module: XMonad.Util.Parser
This module provides a parser combinator library based on base's ReadP,
which aims to function more like other popular combinator libraries like
attoparsec and megaparsec.

In particular, the Alternative and Monoid instances are left-biased now,
so combinators like `many` and `optional` from Control.Applicative work
in a more intuitive manner.  Further, some functions (like `endBy1`)
only return the "most successful" parse, instead of returning all of
them.  We can now get away with providing a single parsing result
instead of ReadP's list of results (as such, parsers need to be
disambiguated earlier instead of trimming the list down after parsing).
2021-12-13 16:11:57 +01:00
Tony Zorman
061faf1748 Merge pull request #646 from iliayar/feature/fallback-fonts
Add xft-based font fallback support
2021-12-11 19:12:14 +01:00
Ilya
42b392e06a X.U.Font: Add font-fallback support
This adds basic font-fallback support for X.U.Font, as well as modules
using it, like X.Prompt and X.A.TreeSelect.

In the new system, multiple fonts may be specified with the syntax

    "xft:iosevka-11,FontAwesome-9"

Fixes: https://github.com/xmonad/xmonad-contrib/issues/208
2021-12-11 15:08:42 +01:00
Tony Zorman
905a4fec9c Merge pull request #660 from exorcist365/master
X.H.BorderPerWindow: Remove unused import
2021-12-07 09:10:20 +01:00
exorcist365
3569e7168b X.H.BorderPerWindow: Remove unused import
Dimension is already exported by XMonad.

Fixes: 95b37a9ab2
2021-12-07 09:08:22 +01:00
slotThe
853264b113 X.H.BorderPerWindow: Fix typo in documentation
Fixes: 95b37a9ab2
2021-12-06 12:38:04 +01:00
Tony Zorman
afdd466bc6 Merge pull request #640 from subbyte/master
Add X.U.ActionQueue and X.H.BorderPerWindow
2021-12-05 14:24:17 +01:00
slotThe
ba43dc6c7e X.U.ExtensibleConf: Fix typo in docs 2021-12-04 17:21:10 +01:00
Xiaokui Shu
95b37a9ab2 New module: XMonad.Hooks.BorderPerWindow 2021-12-04 17:21:10 +01:00
Xiaokui Shu
a981832aaf New module: XMonad.Util.ActionQueue 2021-12-04 17:21:10 +01:00
Tony Zorman
28aa164abd Merge pull request #647 from slotThe/safe-window-attrs
Prefer safe alternatives to getWindowAttributes
2021-11-28 20:43:02 +01:00
Tony Zorman
243deb943f Merge pull request #658 from d3adb5/master
X.L.MagicFocus: always use focused as master
2021-11-28 17:08:45 +01:00
d3adb5
97beb3efc7 X.L.MagicFocus: always use focused as master
Instead of searching for the currently focused window across workspaces,
make it so there is never any window above focus on the Stack that is
given to the modified layout.

Closes #657.
2021-11-28 02:04:22 -03:00
Tony Zorman
3d71669b0a Merge pull request #653 from RubenAstudillo/feature/no-leak-history-hook
Fix memory leaks in `historyHook` and `workspaceHistoryHook`
2021-11-24 21:03:17 +01:00
Ruben Astudillo
b75d0d265e Use deepseq instead of parallel 2021-11-24 15:24:08 -03:00
Ruben Astudillo
44fb597350 Fix workspaceHistoryHook memory leak
The XS.modify was leaving thunk on the history that the demand analyser
could not prove to be neccesary as they depended on the future user
interaction. This was bad as the time advance there was less and less
neccesity to force such value, so the thunk would be increasing. Since the
datatypes that the `WorkspaceHistory` are really simple, we can just
evaluate and save a good chunk of memory.
2021-11-23 17:50:18 -03:00
Ruben Astudillo
ed5d6f0d78 Fix historyHook memory leak
updateHistory leaks unfiltered windows from previous states as it is never
forced. The consumer of such data structure is not visible to ghc, so the
demand analysis has to fallback on pure laziness.

We fix this inserting evaluation points on the `historyHook` function. We do
this for two reasons, this is the only function calling `updateHistory`.
Plus we cannot do it clearly at the `updateHistory` function as we operate
inside a continuation on withWindowSet. In respect to the `put`, everything
would be a big thunk.
2021-11-23 17:50:18 -03:00
Ruben Astudillo
282afefddf Add a modify' function on extensible state 2021-11-22 17:29:08 -03:00
Tony Zorman
2a02fb3753 Merge pull request #652 from Rogach/pr/fix-window-navigation
X.A.WindowNavigation: Fix navigation being "stuck" in certain situations
2021-11-22 21:10:39 +01:00
Platon Pronko
ca5841f7fa X.A.WindowNavigation: Fix navigation getting stuck
Update left and right navigation to behave correctly even if the
currently saved position is directly on the edge of the focused window.
This makes the L/R behavior consistent with U/D navigation.

How to reproduce the issue on a 16:9 resolution like 1920x1080:

  - configure Grid layout;
  - open 4 terminals;
  - navigate to the top-right terminal;
  - open another terminal;
  - immediately close it;
  - try navigating left from the currently focused top-right terminal;
  - observe navigation being "stuck".
2021-11-22 21:12:17 +01:00
Tomas Janousek
5f3d660fde README: Add badges for IRC and Matrix 2021-11-22 11:30:59 +00:00
Tomas Janousek
65408dc07a README: Make spaces _not_ part of hyperlinks 2021-11-22 11:30:35 +00:00
slotThe
61c3aff33c X.A.CycleWorkspaceByScreen: Document
The documentation for this module was lacking, making it significantly
harder to use than the functionality wise very similar
X.A.CycleRecentWS—change that.
2021-11-21 16:42:55 +01:00
slotThe
90a96dee49 X.H.ManageHelpers: Flip logic for (^?), (~?), and ($?)
This changes how the "is*Of" infix operators are hoisted into the
ManageHook context.  Instead of `q ~? x` being a lifted version of
`isPrefixOf q x` we instead let it be a lift of `isPrefixOf x q`.

While this obviously does not matter for symmetric operators like `(==)`
and `(/=)`, for `isInfixOf` it is rather essential.  The reason for that
is that the given `q` on the left side is an atom that can't (shouldn't)
be changed (by the user) and we only have control over the right hand
side.  Otherwise, things like

    title ~? "foo"

would read "only match if `title` is an infix of `foo`" instead of the
much more useful "only match if `foo` is an infix of `title`".

Fixes: 8b6f17ba66
2021-11-17 20:14:26 +01:00
Artem Smaznov
e82a8b8849 X.U.EZConfig: Add modifier keys' KeySyms 2021-11-15 14:16:01 -05:00
slotThe
b6a8069e44 Prefer safe alternatives to getWindowAttributes
Whenever possible, prefer the safe wrappers withWindowAttributes or
safeGetWindowAttributes to getWindowAttributes.

Places where these are not applicable are limited to layouts, where
there is not good "default value" to give back in case these calls fail.
In these cases, we let the exception handling of the layout mechanism
handle it and fall back to the Full layout.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/146
2021-11-13 21:26:02 +01:00
slotThe
528b9d9fde X.Prelude: Add safeGetWindowAttributes
Move the function from X.U.DebugWindow, where it was defined already.
This is a safe version of getWindowAttributes, returning a Maybe instead
of throwing an exception, in case the window attributes could not be
retrieved.
2021-11-13 20:44:15 +01:00
brandon s allbery kf8nh
6cb2796fc0 Fix thinko in documentation
This file was obviously copied from `DwmStyle`, and the author missed changing that
out to `simpleDeco` in one place. Just patching in place since it's a one-word change.
2021-11-12 13:47:21 -05:00
slotThe
67a92edd2a Merge pull request #637 from slotThe/modernise-extending
Start modernising X.D.Extending
2021-11-10 11:47:31 +01:00
slotThe
3109e3966c X.D.Extending: Explain how to write additionalKeys
Instead of telling the user how to add custom keybindings to
xmonad—something which is already done in the tutorial—instead explain
instead how one would go about writing a version of
X.U.EZConfig.additionalKeys.  This mostly involves looking at the type
signatures and sticking some standard functions together, so it's quite
a decent way to learn about some of xmonad's internals.
2021-11-09 20:33:32 +01:00
Tomas Janousek
7807eb1be0 ci: Show error body from Hackage when it fails
Prevents having to upload the candidate manually to see what's wrong.
2021-11-08 18:18:09 +00:00
Tomas Janousek
b40b672288 ci: Swap candidate/final release logic
During the release of xmonad 0.17.0, I realized that we need to be able
to upload candidates before tagging the release on GitHub, because there
might be issues with the tarball and Hackage may reject it. When that
happened, I had to remove the release, delete the tag, upload the
candidate manually to see what's wrong with it, try to fix it, upload it
manually again, and so on.

This commit swaps the logic: when the workflow is invoked manually, it
uploads the candidate. This can be done multiple times, and once
everything is fine, the release can finally be tagged and it's released
to Hackage proper. The only disadvantage is that we need to remember to
try uploading the candidate. Not sure if there's a perfect solution…
2021-11-08 18:17:36 +00:00
slotThe
99e1b30e86 X.A.Search: Remove num=100 from google search engine
It no longer does what it was intended to do, and in fact, now does the
opposite.

When X.A.Search came to be in ~2007, Google's default of showing 10 or
so search hits was radically inadequate for poweruser needs. The 'num'
argument was used to force display of more hits (i.e., n meant 'display
at least n hits per page').

However, at some point, 'num' was inverted to mean something
catastrophically different: now it apparently means 'display no more
than n hits, total'. If you use that parameter, you will get 1 or 2
pages of hits at most reading 'About 98 results' or 'About 99
results' (no matter how many millions are available), and a blurb at the
bottom of the final page saying 'In order to show you the most relevant
results, we have omitted some entries very similar to the 99 already
displayed.' Removing the 'num' parameter then shows you all the hits
that were suppressed.

This is bad, and should be removed.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/642

Co-authored-by: Gwern Branwen <gwern@gwern.net>
2021-11-08 16:46:24 +01:00
slotThe
42dec50c17 Merge pull request #644 from slotThe/window-swallowing-noborder
X.H.WindowSwallowing: Fix single window getting lost
2021-11-08 11:46:05 +01:00
slotThe
5c50387db0 X.H.WindowSwallowing: Fix single window getting lost
ConfigureEvents may occur after a window has been deleted, an UnmapEvent
has already been sent (and thus xmonad already unmanaged the window),
but before a DestroyWindowEvent is caught by the eventHook.  For
example, this is the case when one uses smartBorders with a single
window (such that smartBorders is "active").  The ConfigureEvents
sensibly already have an empty stack (because the UnmapEvent has already
been received), which we then copy to the history.

Whenever a parent window has been found, the sensible thing to do is to
always restore it.  The fact that oldStack is Nothing simply encodes an
empty workspace and is thus something we definitely need to handle as
well.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/638
2021-11-07 16:06:30 +01:00
slotThe
feee11a0ba X.H.DynamicLog: Fix xmobarProp example
In [1] we changed the return type to not be an IO action and hence this
example can't work, even with an otherwise correct configuration.

[1]: 168cb6a6c3 (Removed unnecessary IO)
2021-11-06 11:40:13 +01:00
slotThe
3bc06447d2 X.H.TaffybarPagerHints: Rename defaultConfig to def
The former was removed in [1], so only the latter is valid code right
now.

[1]: 5140f5b5d0
     (Remove things deprecated by Data.Default)
2021-11-06 11:40:13 +01:00
Tomáš Janoušek
52998657ef Merge pull request #639 from liskin/ghc92
Test against GHC 9.2.1; fix new warnings
2021-11-05 10:30:22 +00:00
Tomas Janousek
d67df574cf ci: Run hlint with 9.0.1, not 9.2.1
cabal-3.6.2.0: Could not resolve dependencies:
    [__0] trying: hlint-3.3.4 (user goal)
    [__1] next goal: ghc-lib-parser (dependency of hlint +/-ghc-lib)
    [__1] rejecting: ghc-lib-parser-9.2.1.20211030 (conflict: hlint +/-ghc-lib =>
    ghc-lib-parser>=9.0 && <9.1)
    [__1] trying: ghc-lib-parser-9.0.1.20210324
    [__2] next goal: base (dependency of hlint)
    [__2] rejecting: base-4.16.0.0/installed-4.16.0.0 (conflict: ghc-lib-parser =>
    base>=4.13 && <4.16)
    [__2] skipping: base-4.16.0.0 (has the same characteristics that caused the
    previous version to fail: excluded by constraint '>=4.13 && <4.16' from
    'ghc-lib-parser')
    [__2] rejecting: base-4.15.0.0, base-4.14.3.0, base-4.14.2.0, base-4.14.1.0,
    base-4.14.0.0, base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0,
    base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
    base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
    base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
    base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
    base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
    (constraint from non-upgradeable package requires installed instance)
    [__2] fail (backjumping, conflict set: base, ghc-lib-parser, hlint)
    After searching the rest of the dependency tree exhaustively, these were the
    goals I've had most trouble fulfilling: hlint (536), ghc-lib-parser (335),
    base (219)
2021-11-05 10:14:20 +00:00
Tomas Janousek
4b4f7f2dd6 ci: Test against GHC 9.2 2021-11-05 10:14:20 +00:00
Tomas Janousek
8623c29dd5 ci: Update haskell-ci 2021-11-05 10:14:20 +00:00
Tomas Janousek
5aff766a4c Apply hlint 3.3 hints 2021-11-05 10:14:20 +00:00
Tomas Janousek
e7f102bc9a Revert "Fix -Wdeprecations warnings (time 1.11)"
This doesn't work with the version of time shipped with GHC 8.4 and 8.6.

This reverts commit f2db7bcaa6367bc7db6b49c30e029f10534a99a2.
2021-11-05 10:14:20 +00:00