74 Commits

Author SHA1 Message Date
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
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
Tomas Janousek
ebe2a6284a X.H.EwmhDesktops: Avoid some unnecessary refreshes (border flicker)
Current version of Steam sends _NET_ACTIVE_WINDOW ClientMessage for
every mouse click which results in a lot of border blinking.

Ignore requests that would result in no change to get rid of the
annoying border flicker that is inevitable with the current
implementation of XMonad.Operations.windows.

(Note that Steam also sends ConfigureRequest events, and these cause
an additional refresh due to the call to `float` when handling the event
in xmonad core. Not sure if worth fixing.)

Related: https://github.com/xmonad/xmonad-contrib/pull/371
Related: https://github.com/xmonad/xmonad-contrib/pull/399
2021-05-21 12:19:45 +01:00
slotThe
538089db83 X.H.EwmhDesktops, X.L.Spacing: Use PatternGuards
Fixes a GHC warning about non-standard pattern guards.

Related: https://github.com/xmonad/xmonad-contrib/issues/537
2021-05-20 17:32:04 +02:00
Tomas Janousek
41ba7fd0d3 X.H.EwmhDesktops: Fix _NET_ACTIVE_WINDOW requests from pagers being ignored
This makes window switching apps like rofi and alttab able to activate
windows even if the logHook doesn't activate them (which it doesn't by
default, and that's a regression).

Fixes: 45052b984dbe ("X.H.EwmhDesktops. run 'logHook' for activated window.")
Related: https://github.com/xmonad/xmonad-contrib/issues/396
Related: https://github.com/xmonad/xmonad-contrib/pull/110
Related: https://github.com/xmonad/xmonad-contrib/pull/192
2021-05-16 15:02:37 +01:00
Tomas Janousek
82ecde86fe X.H.EwmhDesktops: Clean up "handle"
Related: https://github.com/xmonad/xmonad-contrib/issues/396
Related: https://github.com/xmonad/xmonad-contrib/pull/399
Related: https://github.com/xmonad/xmonad-contrib/pull/192
2021-05-16 15:02:37 +01:00
Tomas Janousek
6946bbc48b X.{H.EwmhDesktops,L.Fullscreen}: Kill a few warnings
Related: https://github.com/xmonad/xmonad-contrib/issues/396
Related: https://github.com/xmonad/xmonad-contrib/pull/399
2021-05-16 14:58:44 +01:00
Tomas Janousek
2c1c96c3e5 X.H.{EwmhDesktops,ManageDocks}: Improve the usage doc a bit
Don't assume ewmh/docks are the only xmonad config combinator out there.

Related: https://github.com/xmonad/xmonad-contrib/issues/396
Related: https://github.com/xmonad/xmonad-contrib/pull/399
2021-05-16 14:58:38 +01:00
slotThe
2469269119 New module: XMonad.Prelude
This is a convenience module in order to have less import noise.  It
re-exports the following:

  a) Commonly used modules in full (Data.Foldable, Data.Applicative, and
     so on); though only those that play nicely with each other, so that
     XMonad.Prelude can be imported unqualified without any problems.
     This prevents things like `Prelude.(.)` and `Control.Category.(.)`
     fighting with each other.

  b) Helper functions that don't necessarily fit in any other module;
     e.g., the often used abbreviation `fi = fromIntegral`.
2021-05-13 17:44:47 +02:00
slotThe
78d526d1dd Get rid of unused imports
Starting with 5240116f3cdf169e3aa226d9f8206a5f5b99c867 we only support
GHC versions 8.4.4 and up (more precisely, the GHC version associated
with stackage lts-12 and up).  The imports in question are now in
Prelude and need not be imported explicitly.
2020-12-14 13:41:28 +01:00
Tomas Janousek
5d2a6d75a8 X.H.EwmhDesktops: Fix _NET_* properties not being set at startup
None of these properties are currently being set when xmonad starts:

    _NET_ACTIVE_WINDOW(WINDOW): window id # 0x0
    _NET_CURRENT_DESKTOP(CARDINAL) = 0
    _NET_CLIENT_LIST_STACKING(WINDOW): window id #
    _NET_CLIENT_LIST(WINDOW): window id #

because the caching introduced in 92fe5f34ffff408fa859f initializes the
cache with the same values that they should have in an empty session, so
we don't detect a change and don't set them.

Fix it by initializing the cache with impossible (or at least extremely
improbable) values.

Fixes: https://github.com/xmonad/xmonad-contrib/issues/363
2020-11-09 22:15:25 +00:00
sgf
45052b984d X.H.EwmhDesktops. run 'logHook' for activated window.
- By default window activation does nothing.
- `activateLogHook` may be used for running some 'ManageHook' for
activated window.
- `activated` predicate may be used for checking was window activated or
not.
2020-10-28 17:51:40 +03:00
Tomas Janousek
7bf8544f1c X.H.EwmhDesktops: optionally advertise fullscreen support in _NET_SUPPORTED
Provide a way to advertise _NET_WM_STATE_FULLSCREEN in _NET_SUPPORTED.
I had this hardcoded for a while but read the mpv manpage recently:

    Specifically, yes will force use of NetWM fullscreen support, even
    if not advertised by the WM. This can be useful for WMs that are
    broken on purpose, like XMonad. (XMonad supposedly doesn't advertise
    fullscreen support, because Flash uses it. Apparently, applications
    which want to use fullscreen anyway are supposed to either ignore
    the NetWM support hints, or provide a workaround. Shame on XMonad
    for deliberately breaking X protocols (as if X isn't bad enough
    already).

I'm not sure Flash is still a good reason these days to not advertise
fullscreen support yet still handle it and look like idiots while doing
so. (And if anyone thinks it is a good reason, their unchanged xmonad
config will continue behaving that way.)
2019-10-16 16:25:36 +02:00
Tomas Janousek
dc2b96d575 Use Graphics.X11.Xlib.Atom constants in invocations of changeProperty 2019-10-16 16:24:29 +02:00
slotThe
bcd4dde298 Remove redundant do's 2019-10-11 16:35:54 +02:00
slotThe
53b57eba14 Replace liftM and fmap with <$> 2019-10-08 10:33:56 +02:00
slotThe
f3024e6779 Remove unnecessary imports of Control.Applicative 2019-10-08 10:21:15 +02:00
Ben Gamari
92fe5f34ff EwmhDesktops: Cache properties independently 2018-06-19 12:39:24 -04:00
Ben Gamari
8c309f87b8 EwmhDesktops: Cache active window as well 2018-06-19 11:54:20 -04:00
Ben Gamari
f6f925c823 Use extensible state instead of IORef 2018-06-19 11:54:18 -04:00
Ben Gamari
203e63b055 EwmhDesktops: Only update properties when something changed 2018-06-19 10:03:20 -04:00
Ben Gamari
e814f748b5 EwmhDesktops: Cache property values to avoid needless property changes 2018-06-19 01:47:08 -04:00
Ivan Malison
a512351d3a
Remove gnome-panel hack from ewmh desktop code
Fixes #216
2018-03-28 15:06:33 -07:00
Peter J. Jones
1b738c2bed Revert "Add new module XMonad.Hooks.Focus ." 2017-04-10 16:19:06 -07:00
sgf
c07be09e17 X.H.EwmhDesktops: use manageHook for handling activated window.
Move EWMH code from `X.H.Focus` to `X.H.EwmhDesktops`. Thus:

- I'll use `manageHook` for handling activated window.
- By default window activation do nothing (assuming default `ManageHook`).
- I can use `activated` predicate for changing window activation behavior.
- I may use additional combinators from `X.H.Focus` for more complex
  focus/workspace switch strategies.
2016-12-16 23:59:04 +03:00
Tomas Janousek
e38fb3bdb8 Make usage of ManageDocks simpler and more robust
As it now consists of a startup hook, a manage hook, an event hook and
a layout modifier, and behaves erratically when any one component is not
included in a user's config (which happens to be the case for all
configs from xmonad-contrib 0.12 since the startup hook is a new
inclusion), it's probably wise to have a single function that adds
all the hooks to the config instead.

NB: This will need a release notes entry anyway!
2016-09-07 13:26:58 +03:00
allbery.b
e41d7135a9 ewmh-hook-order
Reorder the application of hooks so that users' config is honored.
Notably, this means setWMName works in startupHook instead of
needing to do it repeatedly in logHook.
2015-04-23 15:44:36 +00:00
Daniel Wagner
daa2731d3d eliminate references to defaultConfig 2013-05-28 00:58:25 +00:00
Adam Vogt
a9911d2168 Add missing type signatures.
For whatever reason, some patches applied were missing these signatures.
While haddock has been able to include inferred signatures for a while,
including type signatures makes it easier to see if and when types have
been changed.
2012-11-09 01:27:52 +00:00
Adam Vogt
1716ffd9d0 Rename variables "state" to avoid warnings about shadowing
XMonad core re-exports Control.Monad.State, which includes
a function "state" if you happen to use mtl-2. Since there's
a chance xmonad still works with mtl-1 avoid imports like:

import XMonad hiding (state)
2012-11-09 01:23:16 +00:00
pastorelli.mario
fbb9eb36f9 ewmh-eventhook-custom
Add ewmhDesktopsEventHookCustom, a generalized version of ewmhDesktopsEventHook that takes a sort function as argument. This sort function should be the same used by the LogHook.
2012-08-16 15:30:32 +00:00
Adam Vogt
272c333f75 X.H.EwmhDesktops note that fullscreenEventHook is not included in ewmh
Just a documentation fix (nomeata's suggestion at issue 339).
2012-01-02 21:14:04 +00:00
Adam Vogt
aa96dd6e03 X.H.EwmhDesktops haddock formatting. 2012-01-02 21:12:03 +00:00
Adam Vogt
5ec429ee6f Style changes in EwmhDesktops 2009-12-19 00:38:24 +00:00
audunskaugen
75775178fd Add support for fullscreen through the _NET_WM_STATE protocol
This patch adds support for applications using the
gtk_window_fullscreen function, and other applications using
_NET_WM_STATE for the same purpose.
2009-12-14 13:51:19 +00:00
Adam Vogt
71abbe457a Remove defaulting when using NoMonomorphismRestriction in H.EwmhDesktops 2009-11-07 19:52:55 +00:00
Spencer Janssen
4832f0fc7d Add ewmh function to set all EWMH settings in one step 2009-10-23 03:46:30 +00:00
Justin Bogner
fc1da0d701 Move EWMH support initialization to a startupHook
Set EWMH support atoms and the window manager name in a startup hook,
rather than in the log hook: the log hook occurs far too frequently
for it to make sense to set constants with it.
2009-10-11 05:35:38 +00:00
Daniel Schoepe
15acd55553 Don't use tabs in EwmhDesktops 2009-08-13 20:01:19 +00:00
Joachim Breitner
4f375b20bf Do not warn about unknown ClientMessageEvents
Not all client messages are are meant to be handled by the wndow manager, so do
not complain when one is unknown.
2009-08-12 22:29:17 +00:00
Adam Vogt
5cd48cac7c Remove trailing whitespace from many modules 2009-07-05 20:12:05 +00:00
Adam Vogt
0cb6ac2910 Use -fwarn-tabs for test, remove tabs 2009-06-24 04:38:31 +00:00
Khudyakov Alexey
32b1e5bdfa Properly encode destop names before sending them to X server in XMonad.Hooks.EwmhDesktops 2009-02-20 18:41:37 +00:00
Daniel Schoepe
7e1db48875 Fix an undefined in EwmhDesktops 2009-02-09 15:23:08 +00:00
Daniel Schoepe
9a7dcbbabb Adjustments to use the new event hook feature instead of Hooks.EventHook 2009-02-03 16:00:46 +00:00
rupa
56850074df fix-fromJust-errors
bogner wrote all this stuff and i just tested it.

I had:

myLogHook = ewmhDesktopLogHookCustom ScratchpadFilterOutWorkspace >> updatePointer Nearest

Everytime I invoked or hid Scratchpad, it would leave a 'Maybe.fromJust: Nothing' line in .xsession-errors, and updatePointer would stop working.
2008-12-24 04:55:09 +00:00
Joachim Breitner
a4cbf496e7 Do not consider XMONAD_TIMER unknown 2008-10-08 19:56:43 +00:00
Joachim Breitner
6d17e66bb3 Kill window without focusing it first
This patch requires the patch "add killWindow function" in xmonad.
Before this patch, people would experience “workspace flicker” when closing
a window via EWMH that is not on the current workspace, for example when
quitting pidgin via the panel icon.
2008-10-05 00:25:33 +00:00
Devin Mullins
f3b6b2707a cleanup - use currentTag 2008-09-21 01:11:59 +00:00
Spencer Janssen
26e40e555e Improve documentation for XMonad.Hooks.EwmhDesktops 2008-08-13 19:18:57 +00:00