Commit Graph

2525 Commits

Author SHA1 Message Date
oogeek
d521d18dde X.A.CopyWindow: Add copiesPP
This is a function that takes a pretty-printer and makes it aware of
copies of the currently focused window.  This is particularly nice when
using it with a StatusBarConfig.

Related: https://github.com/xmonad/xmonad-contrib/pull/463
2021-06-10 14:03:52 +02:00
oogeek
8899078b00 X.L.IndependentScreens: Add workspacesOn, withScreen, fix marshallPP always sorting lexically
- Added `workspacesOn` for filtering workspaces on the current screen.

- Added `withScreen` to specify names for a given single screen.

- Added new aliases `PhysicalWindowSpace` and `VirtualWindowSpace`
  for a `WindowSpace` for easier to read function signatures.

- Fixed a bug where `marshallPP` always sorted workspace names
  lexically.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/420
2021-06-10 11:07:49 +02:00
Tomas Janousek
b6cd47db29 X.H.StatusBar.PP: Clarify ppOutput doc + minor cleanups 2021-06-08 00:14:17 +01:00
Tomas Janousek
c3b67ab0df X.U.ClickableWorkspaces: Fix Haddock formatting 2021-06-08 00:14:17 +01:00
slotThe
f76318ce5f X.Prompt: Calculate prompt width once at the start
At the moment, we re-calculate the prompt width every time we want
to (re)draw the prompt window.  This is unnecessary, as the screen
dimensions or the preferred position changing _while the prompt is
active_ is extremely unlikely.

This now calculates the desired width at the start of the prompts event
loop and threads it through to the places that need it.
2021-06-07 09:33:35 +02:00
slotThe
5bc0d9d777 X.Prompt: Remove non-IORef complWin
While it is true that we need an IORef complWin in case of an exception,
so the window can be destroyed correctly, we do not need its non-IORef
counterpart at all.

When we need to access the complWin it's undoubtably when we want to do
_something_ with regards to window management; these things naturally
live in `XP ()` and so there's not loss of purity with this change.
2021-06-07 09:33:35 +02:00
slotThe
84dcc9b716 X.Prompt: Document createPromptWin 2021-06-07 09:33:35 +02:00
slotThe
a49c4066b9 X.Prompt: Simplify nextComplIndex 2021-06-07 09:33:35 +02:00
slotThe
6036151ca7 X.Prompt: Document destroyComplWin 2021-06-07 09:33:35 +02:00
slotThe
aa35d6a2f2 X.Prompt: Document getCompletions 2021-06-07 09:33:35 +02:00
slotThe
26c4fb0f2d X.Prompt: Document printComplList, rename 2021-06-07 09:33:35 +02:00
slotThe
5f58fb5cd1 X.Prompt: Document drawComplWin 2021-06-07 09:33:35 +02:00
slotThe
2f6546a8d6 X.Prompt: Document getComplWinDim 2021-06-07 09:33:34 +02:00
slotThe
96640f7aae X.Prompt: Document printPrompt 2021-06-07 09:32:56 +02:00
slotThe
548595ed34 X.Prompt: Document redrawComplWin 2021-06-07 09:32:56 +02:00
slotThe
b7dbc277a7 X.Prompt: write updateWindows in terms of redrawWindows
Also document the functions because they dearly need it.
2021-06-07 09:32:56 +02:00
slotThe
0af9435d58 X.Prompt: Make ComplWindowDim a proper type 2021-06-07 09:32:56 +02:00
slotThe
bd5b969d9b Apply hlint hints
All hints are applied in one single commit, as a commit per hint would
result in 80+ separate commits—tihs is really just too much noise.

Related: https://github.com/xmonad/xmonad-contrib/issues/537
2021-06-06 18:59:05 +02:00
Tomas Janousek
b96899afb6 X.H.StatusBar: Fix misleading doc comment about encodeString
This isn't true since 63e31ccd8d, `xmonadPropLog'` does the encoding
now and accepts a normal Haskell String now.

Fixes: 63e31ccd8d ("X.H.DynamicLog: Move UTF8 encoding from dynamicLogString to xmonadPropLog'")
2021-06-06 13:56:40 +01:00
slotThe
9af232489d Remove unnecessary imports of X.L.LayoutCombinators 2021-06-04 18:23:37 +01:00
slotThe
921ee69064 X.L.LayoutCombinators: Update for new X.L.(|||)
With xmonad/xmonad@45b2275b88 going live
the functionality of X.L.LayoutCombinators.(|||) was moved into xmonad
core, more specifically into X.L.(|||).  We just need to clean up the
contrib side of things, which involves making JumpToLayout and NewSelect
type aliases and cutting out the custom layout combinator.

Related:
  - https://github.com/xmonad/xmonad/pull/281
  - xmonad/xmonad@45b2275b88
  - https://github.com/xmonad/xmonad-contrib/issues/116
2021-06-04 18:23:37 +01:00
Tomas Janousek
bb71111b75 X.L.LayoutModifier: Drop outdated comment about haddock bug
This doesn't seem to be true any more with haddock 2.23.0.
2021-06-04 16:38:20 +01:00
Tomas Janousek
5230f038b3 Merge branch 'pr/rescreen' 2021-06-03 11:10:58 +01:00
Tomas Janousek
30995c41ff X.H.StatusBar: Use addAfterRescreenHook instead of listening for RRScreenChangeNotifyEvent
The new X.H.Rescreen provides a simpler composable API for hooking into
rescreen. Unfortunately it also breaks other code that listens for
RRScreenChangeNotifyEvent, so this conversion isn't really optional.

Not that there's any dispute this is nicer, is there? :-)
2021-06-03 11:10:33 +01:00
Tomas Janousek
eab9a3a58e X.U.ExtensibleConf: Flip arguments of once(M)
This appears to be more natural. The function will most often be fixed
by the module using `XC.once` and the configuration will often be
supplied by users of those modules, so it's better to partially apply
the function first.
2021-06-03 11:10:33 +01:00
Tomas Janousek
13b1de27a9 X.H.StatusBar: Add statusBarGeneric for taffybar/trayer/stalonetray
`statusBarGeneric`: A generic `StatusBarConfig` that launches a status
bar but takes a generic `X ()` logging function instead of a `PP`. This
has several uses:

 * With `xmonadPropLog` or `xmonadPropLog'` in the logging function, a
   custom non-`PP`-based logger can be used for logging into an `xmobar`.

 * With `mempty` as the logging function, it's possible to manage a status
   bar that reads information from EWMH properties like `taffybar`.

 * With `mempty` as the logging function, any other dock like `trayer` or
   `stalonetray` can be managed by this module.

Related: https://github.com/xmonad/xmonad-contrib/pull/463
2021-06-03 02:31:47 +01:00
Tomas Janousek
4a6f21604f X.H.Rescreen: Port to ExtensibleConf 2021-06-03 01:02:57 +01:00
Tomas Janousek
280964b9f5 Update CHANGES, X.D.Extending: add X.H.Rescreen 2021-06-03 01:02:57 +01:00
Tomas Janousek
90c7621e1f X.H.Rescreen: Merge the two hooks together and improve their behaviour
Now that randrChangeHook is only invoked for changes that don't result
in rescreen, it can actually be used for autorandr.
2021-06-03 01:02:57 +01:00
Tomas Janousek
1ff954b4b6 X.H.Rescreen: Add randrHook 2021-06-03 01:02:57 +01:00
Tomas Janousek
5b28f5ee54 Add X.H.Rescreen module (custom rescreen hooks) 2021-06-03 01:02:57 +01:00
Tomas Janousek
f71095885f Fix more GHC warnings: -Wdeprecations
With the bumped xmonad dependency, we can drop these, leaving just 4
warnings visible in ghcid. \o/

Related: https://github.com/xmonad/xmonad/pull/258
2021-06-03 00:01:27 +01:00
Yecine Megdiche
dac3acc5dd Merge pull request #553 from TheMC47/postpone-pipe
X.H.StatusBar.statusBarPipe: spawn in the startupHook
2021-06-02 16:02:57 +02:00
Yecine Megdiche
465044d5ce X.H.StatusBar.statusBarPipe: spawn in the startupHook
statusBarPipe abuses the interface of StatusBarConfig by starting the
status bar before the startupHook. This worked correctly before, but it
does not play will with `dynamicSBs`
2021-06-02 15:52:05 +02:00
Tomáš Janoušek
e1db71c42c Merge pull request #546 from slotThe/set-class
Set `WM_CLASS` for some windows
2021-06-02 11:48:19 +01:00
Tomas Janousek
86522a27b0 X.A.CycleRecentWS: Make unView work with greedyView as well
Entirely unnecessary for the current version of `cycleWindowSets`, but
if anyone ever wants to use `greedyView`, this shows that it's not at
all complicated to adapt `unView` to that.
2021-06-02 09:18:43 +02:00
Tomas Janousek
1e2e1273b8 X.A.CycleRecentWS: Revert setOption changes
These are remnants of the first fix attempt, but are no longer
necessary. This reduces the diff to `view . unview` instead of `const`.
2021-06-02 09:18:43 +02:00
Tomas Janousek
b65b83661b X.A.CycleRecentWS: Simplify unView even more
Instead of implementing `view` in reverse, we can use it directly and
then just fix the order of visible/hidden workspaces.
2021-06-02 09:18:43 +02:00
Tomas Janousek
12b30c393c X.A.CycleRecentWS: Simplify/fix unView
To make this more "obviously correct", make it resemble the `view`
implementation, just do the exact reverse. Now the only complex bit is
the "undelete" operation.

This also fixes another issue: state was only preserved in the focused
workspace, but it may have changed in another visible workspace as well.
The property test is updated to test this.
2021-06-02 08:32:41 +02:00
Tomas Janousek
24786c6d04 X.A.CycleRecentWS: Add property test for unView
Scary looking code better be tested. :-)

(For the record, the test did find an issue that is already fixed in the
previous commit.)
2021-06-02 08:32:34 +02:00
Tomas Janousek
3db9167da4 X.A.CycleRecentWS: Rename restoreOrder to unView
Makes it more obvious what it really does.

Also, don't expose origWSet as a variable, lest someone uses it. :-)
2021-06-02 08:31:53 +02:00
slotThe
f0809e5d1d X.A.CycleRecentWS: Cycle workspaces, not windowsets
The way that workspace cycling is implemented right now—by generating
new windowsets where the things we want happen to be true and then
replacing the old windowsets—is not safe, as workspaces and layouts may
carry state with them.  That state will get lost in translation when
windowsets are simply replaced.

As an example, a conflict occurs when using `X.L.ShowWName.showWName` in
one's layoutHook.  When cycling through workspaces via, e.g.,
`cycleRecentWS` the flashed workspace tag will not disappear, as the
necessary state to control this isn't present in the new windowset.

Instead, what we want to do is to keep the "current" windowset alive and
actually switch to the requested workspaces.  This mostly works without
much trouble, the only hard part is maintaining the invariant that
previewed workspaces don't count towards the history of recently-viewed
workspaces.  This is done by remembering the tag-order of the original
windowset and then restoring that at the end.

This is a breaking change, insofar as it changes the type signatures of
the exported functions `recentWS`, `cycleWindowSets`, and
`toggleWindowSets` to return a list of `WorkspaceId`s instead of a list
of `WindowSet`s.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/504
2021-06-02 08:31:53 +02:00
slotThe
fd5d8267d2 Set WM_CLASS for created windows
Set the WM_CLASS property for long-living windows that need it.  This
helps users to properly match on these windows for certain tasks.

Fixes:
  - https://github.com/xmonad/xmonad-contrib/issues/526
  - https://github.com/xmonad/xmonad-contrib/issues/369
2021-06-02 08:18:11 +02:00
Joan Milev
f4673d611b X.L.BinarySpacePartition: Customizable ratio in messages that resize windows
Co-authored-by: Yecine Megdiche <yecine.megdiche@gmail.com>
2021-06-01 19:56:58 +01:00
Tomas Janousek
f6b1e5dd88 X.U.ExtensibleConf: New helper module for extensible config
It's often difficult to make contrib modules work together. When one
depends on a functionality of another, it is often necessary to expose
lots of low-level functions and hooks and have the user combine these
into a complex configuration that works. This is error-prone, and
arguably a bad UX in general.

This commit presents a simple solution to that problem inspired by
"extensible state": extensible config. It allows contrib modules to
store custom configuration values inside XConfig. This lets them create
custom hooks, ensure they hook into xmonad core only once, and possibly
other use cases I haven't thought of yet.

This requires changes to xmonad core: https://github.com/xmonad/xmonad/pull/294

A couple examples of what this gives us:

* [X.H.RescreenHook](https://github.com/xmonad/xmonad-contrib/pull/460)
  can be made safe to apply multiple times, making it composable and
  usable in other contrib modules like X.H.StatusBar

* `withSB` from X.H.StatusBar can also be made safe to apply multiple
  times, and we can even provide an API [similar to what we had
  before](https://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Hooks-DynamicLog.html#v:statusBar)
  if we want (probably not, consistency with the new dynamic status bars
  of https://github.com/xmonad/xmonad-contrib/pull/463 is more important)

* The [X.H.EwmhDesktops refactor](https://github.com/xmonad/xmonad-contrib/pull/399)
  can possibly be made without breaking the `ewmh`/`ewmhFullscreen` API.
  And we will finally be able to have composable EWMH hooks.

Related: https://github.com/xmonad/xmonad/pull/294
2021-06-01 19:07:13 +01:00
Tomas Janousek
56cf96cfa9 X.H.ManageDocks: Fix button events on decoration windows
Decoration windows are created using XMonad.Util.XUtils.createNewWindow
which happens to set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_DESKTOP,
and ManageDocks considers such windows candidates for struts and
therefore requests property events, thus overriding the original event
mask requested by decorations.

The fix is to first obtain the current event mask, set the required bits
in it only then reset the mask.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/517
Fixes: ec14617123 ("X.H.ManageDocks: React to strut updates of override_redirect docks")
Related: https://github.com/xmonad/X11/pull/77
2021-06-01 18:56:44 +01:00
Yecine Megdiche
5c73845c68 Merge pull request #463 from TheMC47/dynamic-status-bar-configs
Dynamic Status Bars support for XMonad.Hooks.StatusBar
2021-05-28 22:50:35 +02:00
Yecine Megdiche
d2f3a8de74 Added support for dynamic status bars.
This is heavily inspired by "XMonad.Hooks.DynamicBars", but it can be
used with any status-bar.
2021-05-28 18:47:50 +02:00
Yecine Megdiche
b6e364ce42 Rename 'spawnStatusBarAndRemember' and 'cleanupStatusBars', made them
command specific

- The names were awfully long. spawnStatusBar and killStatusBar are
perfectly fine alternatives.
- It's more flexible to have killStatusBar command specific. Also added
killAllStatusBars to provide the old functionality
2021-05-28 18:47:50 +02:00
Tomas Janousek
fde7f4f8b0 X.H.EwmhDesktops: Ignore _NET_WM_STATE_FULLSCREEN from unmanaged windows
This prevents an unnecessary refresh.

That refresh would normally be harmless but it does reset the input
focus, which happens to upset some non-conforming clients such as
https://github.com/flameshot-org/flameshot. Flameshot is an interactive
screenshot tool that creates an override-redirect fullscreen window to
let the user select a rectangle to capture and then allows drawing and
adding text and so on, but it unfortunately doesn't follow ICCCM
recommendations:

> If it is necessary for a client to receive keystrokes on an
> override-redirect window, either the client must grab the keyboard, or
> the client must have another top-level window that is not
> override-redirect and that has selected the Locally Active or Globally
> Active focus model.

Instead, it just takes input focus and hopes for the best. And it also
sends an entirely useless _NET_WM_STATE_FULLSCREEN request, which would
trigger a refresh and take that focus away.

This commit works around that by not handling that useless
_NET_WM_STATE_FULLSCREEN for unmanaged windows and thus preventing that
refresh. It's just a workaround, however: if a legitimate refresh is
necessary at any point, the focus _will_ be taken away.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/550
Fixes: https://github.com/flameshot-org/flameshot/issues/773
2021-05-28 15:13:09 +01:00