2662 Commits
v0.3 ... v0.14

Author SHA1 Message Date
Peter Simons
16836b6f91 Merge pull request #275 from LSLeary/point14
0.14
2018-07-31 09:54:42 +02:00
L. S. Leary
065c305fed version bump to 0.14 2018-07-30 23:44:56 +12:00
L. S. Leary
9a80f2d891 Clean up CHANGES.md:
* 0.14 (Not Yet) -> 0.14
 * Removed reverted changes left over from #128 & #161
 * Fixed some typos
 * Made markup more consistent.
2018-07-30 23:44:56 +12:00
LSLeary
a1111a3418 Merge pull request #274 from LSLeary/travis 2018-07-30 23:43:49 +12:00
L. S. Leary
fdc3f78588 Drop GHC 7.6 compatibility. 2018-07-30 22:50:03 +12:00
L. S. Leary
259c170ac9 Travis-CI:
* don't constrain to precise
 * add libxrandr dependency
 * test against new GHC versions
 * install xmonad from git before cabal can install it from hackage
2018-07-30 22:50:03 +12:00
L. S. Leary
4f23016e54 GHC 7.8 compatibility:
* Explicitly import pure, (<$>), (<*>) and (<$) from Control.Applicative.
 * Use DeriveDataTypeable pragma.
 * Remove type signature from pattern synonym.
2018-07-30 22:50:03 +12:00
LSLeary
4ec78aa3f2 Merge pull request #273 from orbisvicis/reSpaced
reSpaced: Compatibility v2
2018-07-30 22:12:55 +12:00
L. S. Leary
ea39960bd4 Merge pull request #261 from orbisvicis/messaging 2018-07-30 22:05:48 +12:00
L. S. Leary
d015416573 Revert "Merge pull request #256 from LSLeary/refocuslast"
This reverts commit b0f9197e04, reversing
changes made to 6b8a8f9c8d.

Not for 0.14.
2018-07-30 16:53:44 +12:00
Brent Yorgey
c90241807a Merge pull request #269 from MichielDerhaeg/belgianKeys
add support for belgian keyboards in XMonad.Config.Azerty
2018-07-27 11:40:50 -05:00
Brent Yorgey
0731407537 Merge pull request #270 from lucianposton/doc
X.L.MultiToggle: Doc improvement
2018-07-27 11:39:01 -05:00
Brent Yorgey
a6a69394be Merge pull request #271 from lucianposton/tbf
Add the X.L.MultiToggle.TabBarDecoration module
2018-07-27 11:38:35 -05:00
Brent Yorgey
0fb36d418b Merge pull request #272 from lucianposton/darktheme
X.U.Themes: Add darkTheme
2018-07-27 11:37:19 -05:00
Yclept Nemo
3e68036360 XMonad.Layout.Spacing: extreme compatibility
* Reintroduce the original 'ModifySpacing' type and constructor as
  deprecated; the new 'ModifySpacing' type was renamed to
  'SpacingModifier'. Suggested by @LSLeary.
* Types 'SpacingWithEdge', 'SmartSpacing', and 'SmartSpacingWithEdge'
  have been reintroduced as deprecated type synonyms of 'Spacing'. Work
  by @LSLeary.

Also 'borderMap' is now exported; it might be useful.
2018-07-19 15:06:35 -04:00
Lucian Poston
8109a605fd X.U.Themes: Add darkTheme 2018-07-17 19:17:45 -07:00
Lucian Poston
048bb42e7a Add the X.L.MultiToggle.TabBarDecoration module 2018-07-16 19:51:14 -07:00
Lucian Poston
b9ef1649b0 X.L.MultiToggle: Doc improvement 2018-07-15 17:18:12 -07:00
LSLeary
a4b430bfa7 Merge pull request #266 from LSLeary/master
Fix to X.L.Grid as per issue #223
2018-07-09 05:34:45 +12:00
Michiel Derhaeg
d0e283d175 add support for belgian keyboards in XMonad.Config.Azerty 2018-07-05 22:22:28 +02:00
L.S. Leary
90e54a9abb Fix to X.L.Grid as per issue #223; it will no longer calculate more columns than there are windows. 2018-07-02 18:20:13 +12:00
Yclept Nemo
9fcea6cb55 Merge pull request #252 from orbisvicis/swapPromote
Swap Promote
2018-06-15 12:29:14 -04:00
Yclept Nemo
7e54a9d90b 'XMonad.Actions.SwapPromote': advertise changes...
... and expose the new module.
2018-06-15 12:26:28 -04:00
Yclept Nemo
66281f07f1 'XMonad.Actions.SwapPromote': 'stackMerge' fixes
Make 'stackMerge' safer by implicitly appending any leftover elements
rather than discarding them. Otherwise on refresh the missing windows
will be deleted. This is only necessary if the stack has been shortened
- i.e. not required by this module.

Minor miscellaneous documentation fixes.
2018-06-15 12:26:28 -04:00
Yclept Nemo
56a76df88f 'XMonad.Actions.SwapPromote': new module
Module for tracking master window history per workspace, and associated
functions for manipulating the stack using such history.
2018-06-15 12:26:28 -04:00
Yclept Nemo
b6a09f5d80 Merge pull request #242 from orbisvicis/borderControl
Border Control
2018-06-15 12:19:07 -04:00
Yclept Nemo
2fde742e7a 'XMonad.Layout.Spacing': compatibility tweaks
* All the backwards-compatibility functions now accept `Int` rather than
  `Integer`: `spacing`, `spacingWithEdge`, `smartSpacing`,
  `smartSpacingWithEdge`, `setSpacing`, and `incSpacing`. Work done by
  @LSLeary.
* Introduce the new functions `setScreenWindowSpacing`,
  `incScreenWindowSpacing`, `decScreenWindowSpacing`. Unlike their
  original `setSpacing`, `incSpacing` counterparts, these refresh no
  more than once. Requires `sendMessages` from my PR of
  `XMonad.Actions.MessageFeedback`. Suggestion by @LSLeary and
  implemented so any combination of messages can be sent without
  triggering unnecessary refreshes.
2018-06-14 13:10:19 -04:00
Yclept Nemo
8ee2e39fb2 'XMonad.Actions.MessageFeedback': standardize
- Follow the naming conventions of `XMonad.Operations`. Functions returning
  `X ()` are named regularly (previously these ended in underscore) while
  those returning `X Bool` are suffixed with an uppercase 'B'.

- Provide all `X Bool` and `SomeMessage` variations for `sendMessage` and
  `sendMessageWithNoRefresh`, not just `sendMessageWithNoRefreshToCurrent`
  (renamed from `send`).

- The new `tryInOrderB` and `tryMessageB` functions accept a parameter of
  type `SomeMessage -> X Bool`, which means you are no longer constrained
  to the behavior of the `sendMessageWithNoRefreshToCurrent` dispatcher.

- The `send*Messages*` family of funtions allows for sequencing arbitrary
  sets of messages with minimal refresh. It makes little sense for these
  functions to support custom message dispatchers.

- Remain backwards compatible. Maintain deprecated aliases of all renamed
  functions:
  - `send`          -> `sendMessageWithNoRefreshToCurrentB`
  - `sendSM`        -> `sendSomeMessageWithNoRefreshToCurrentB`
  - `sendSM_`       -> `sendSomeMessageWithNoRefreshToCurrent`
  - `tryInOrder`    -> `tryInOrderWithNoRefreshToCurrentB`
  - `tryInOrder_`   -> `tryInOrderWithNoRefreshToCurrent`
  - `tryMessage`    -> `tryMessageWithNoRefreshToCurrentB`
  - `tryMessage_`   -> `tryMessageWithNoRefreshToCurrent`
2018-06-13 15:26:18 -04:00
Yclept Nemo
9d342cddb7 'XMonad.Layout.NoBorders': document upgrade path
Document upgrade path for 'hiddens', which added a 'Rectangle'
parameter.
2018-06-10 19:45:17 -04:00
Yclept Nemo
0c1a6c25f6 'XMonad.Layout.NoBorders': advertise changes 2018-06-10 18:12:21 -04:00
Yclept Nemo
c6cdb77e3b 'XMonad.Layout.NoBorders': various improvements:
The layout now maintains a list of windows that never have borders, and
a list of windows that always have borders. Use 'BorderMessage' to
manage these lists and the accompanying event hook ('borderEventHook')
to remove destroyed windows from them. Also provides the 'hasBorder'
manage hook.

Two new conditions have been added to 'Ambiguity': 'OnlyLayoutFloat' and
'OnlyLayoutFloatBelow'; 'OnlyFloat' was renamed to 'OnlyScreenFloat'.
See the documentation for more information.
2018-06-10 18:06:00 -04:00
Brent Yorgey
e0b1954e62 Merge pull request #254 from mimi1vx/patch-1
Allow build with X11-1.9
2018-06-09 07:43:49 -05:00
Brent Yorgey
178ec86cc6 Merge pull request #257 from skewerr/master
Added two actions to X.A.DynamicWorkspaceOrder
2018-06-09 07:37:38 -05:00
Brent Yorgey
b0f9197e04 Merge pull request #256 from LSLeary/refocuslast
RefocusLast
2018-06-09 07:34:22 -05:00
L. S. Leary
d7461c037e Added the X.H.RefocusLast module. 2018-06-06 18:43:28 +12:00
Brent Yorgey
6b8a8f9c8d add X.U.Rectangle to exposed-modules 2018-06-04 14:28:33 -05:00
Brent Yorgey
cfe7a90d4a Merge pull request #244 from orbisvicis/rectangle
Rectangle
2018-06-04 14:27:59 -05:00
Brent Yorgey
44306eb0ab Merge branch 'master' into rectangle 2018-06-04 14:27:11 -05:00
Brent Yorgey
18eb79ce73 add X.L.BinaryColumn to exposed-modules
Also fix typo in CHANGES.md. See #233.
2018-06-04 14:24:18 -05:00
Brent Yorgey
3f54045af2 Merge pull request #253 from LSLeary/statefull
StateFull: Fixing Full (and other layouts we lie to)
2018-06-04 14:18:31 -05:00
Brent Yorgey
22345dce9f Merge pull request #248 from jktomer/master
Fullscreen.hs: don't lay out windows obscured by fullscreen
2018-06-04 14:12:28 -05:00
Brent Yorgey
bc63ff3f0d Merge pull request #243 from orbisvicis/reSpaced
reSpaced
2018-06-04 13:59:33 -05:00
Brent Yorgey
83e421c495 Merge branch 'master' into reSpaced 2018-06-04 13:59:21 -05:00
L. S. Leary
c4c007806c Added the X.L.StateFull module providing the StateFull layout and the FocusTracking layout transformer. 2018-05-29 22:58:51 +12:00
spoonm
635a9dee4c Added updateName and removeName to X.A.DynamicWorkspaceOrder
This adds the possibility to maintain the ordering of workspaces after
they are renamed and to remove them from sorting when they are deleted.
2018-05-21 16:22:52 -03:00
L. S. Leary
0cd4690f9b Added findS/Z and reverseS/Z to X.U.Stack. 2018-05-18 11:04:09 +12:00
Brent Yorgey
d3d0818e9b Merge pull request #246 from orbisvicis/xmobar
Xmobar
2018-05-17 16:47:19 -05:00
Ondřej Súkup
d3ae0eeac2 Allow build with X11-1.9 2018-05-15 13:02:38 +02:00
Brent Yorgey
295adf056e Merge pull request #250 from LSLeary/master
X.P.FuzzyMatch: Relocate imports so that haddock generation succeeds.
2018-05-08 21:33:09 -05:00
L. S. Leary
56f7b3acb3 X.P.FuzzyMatch: Relocate imports so that haddock generation succeeds. 2018-05-08 03:29:46 +12:00
Brent Yorgey
9a68684ec1 Merge pull request #233 from ideasman42/layout-binary-column
Add BinaryColumn layout
2018-05-07 06:02:28 -05:00
Brent Yorgey
54ee8933ee Merge pull request #241 from miguelclean/master
Added pretty printer for empty visible workspaces (wrapped in Maybe)
2018-04-24 15:58:13 -05:00
jktomer
d338e11110 Fullscreen.hs: don't lay out windows obscured by fullscreen
There's no reason to return a rectangle for any window that is totally
obscured by a full-screen window, and not doing so has the nice property that
when hidden windows' borders overlap with a full-screen window's, the user
will not be confused by overlapping partially-drawn borders. It also makes the
Fullscreen modifiers combine much better with smartBorders.
2018-04-24 07:06:23 -07:00
Brent Yorgey
09426e9d71 Merge pull request #239 from marcsaegesser/SpawnOnceEnhancements
Add spawnOnOnce and related functions.
2018-04-21 11:47:21 -05:00
Yclept Nemo
2c53d507ee 'XMonad.Layout.Spacing': backwards compatibility 2018-04-21 11:43:53 -04:00
Yclept Nemo
19a020837d 'XMonad.Layout.Spacing': advertise changes 2018-04-20 12:55:08 -04:00
Yclept Nemo
fdccc873de 'XMonad.Layout.Spacing': the finished product.
Both screen and window borders can now be disabled. Implement missing
messages. The layout now handles windows that are displayed but not part
of the stack, such as those created by 'XMonad.Layout.Decoration'.
Several additional fixes.
2018-04-20 12:55:08 -04:00
Yclept Nemo
f1ed0a5edb 'Layout.Spacing': Improve the smart screen border:
The 'smartBorder' now depends on the window/rectangle list resulting
from 'runLayout' rather than the stack, which means that the child
layout will always be called with the screen border. If only a single
window is displayed, it will be expanded into the original layout
rectangle.
2018-04-20 12:55:08 -04:00
Yclept Nemo
6ae7c2c8b4 Rewrite of 'XMonad.Layout.Spacing':
* Independent screen/window borders
* Configurable top/bottom/right/left borders
2018-04-20 12:55:08 -04:00
Yclept Nemo
108431d03d 'XMonad.Util.Rectangle': advertise changes 2018-04-20 12:54:09 -04:00
Yclept Nemo
31bfcc217f 'XMonad.Util.Rectangle': 'withBorder' fixes
Fix handling of negative borders in 'withBorder'.
2018-04-20 12:54:09 -04:00
Yclept Nemo
cc00a93f1a 'XMonad.Util.Rectangle': new module
A new module for handling pixel rectangles.
2018-04-20 12:54:09 -04:00
Yclept Nemo
26d6bde9c3 'XMonad.Hooks.DynamicLog': advertise changes 2018-04-20 12:52:22 -04:00
Yclept Nemo
348861da00 'XMonad.Hooks.DynamicLog': xmobar tags
Support xmobar's <action> and <raw> tags.
2018-04-20 12:52:22 -04:00
Miguel
670eb3bc60 Added pretty printer for empty visible workspaces
Simple extensions of the pretty printer to differentiate between empty
and non-empty visible workspaces. Analogical to the existing
functionality for hidden workspaces. Particularly useful if some
displays managed by xmonad are turned off temporarily.

The new 'ppVisibleNoWindows' function was wrapped in a Maybe data type.
Its value dafaults to 'Nothing' and 'ppVisible' is used as fallback.
2018-04-18 11:36:46 +02:00
Campbell Barton
869311090c Correct docs 2018-04-11 07:58:11 +02:00
Brent Yorgey
5f2afb08e9 Merge pull request #240 from ae-g-i-s/more-dzen-options
Implement additional options for Dzen
2018-04-10 23:08:34 -05:00
Brent Yorgey
1ce035ee7d Merge pull request #232 from l29ah/fuzzymatch
+ FuzzyMatch by @nzeh
2018-04-10 20:56:08 -05:00
Brent Yorgey
41e6343a7e Merge pull request #237 from ccrusius/master
Add a `ModifyX` message to `Groups`
2018-04-10 20:43:28 -05:00
ae-g-i-s
b20cf7c1e6 Implement additional options for Dzen 2018-04-04 14:25:42 +02:00
Brent Yorgey
5cdf4e408c Merge pull request #234 from vmandela/dzen
DynamicLog: add dzenWithFlags function
2018-04-02 10:14:50 -05:00
Marc A. Saegesser
9c4dad9946 Add spawnOnOnce and related functions. 2018-03-30 13:43:05 -05:00
geekosaur
13e37b964e Merge pull request #238 from IvanMalison/remove_gnome_panel_ewmh_code
Remove gnome-panel hack from ewmh desktop code
2018-03-28 22:01:02 -04:00
Ivan Malison
a512351d3a Remove gnome-panel hack from ewmh desktop code
Fixes #216
2018-03-28 15:06:33 -07:00
Venkateswara Rao Mandela
82aba52541 DynamicLog: add dzenWithFlags function
This commit adds `dzenWithFlags` function for users who wish to change the
command line arguments passed to `dzen`. The behaviour of `dzen` function is
kept the same.
2018-03-27 20:09:34 +05:30
Cesar Crusius
62e04de68e Add a ModifyX message to Groups
The `group3` addition I made in a previous commit enabled one to go so
far, but then quickly hit some walls due to non-exported symbols from
`XMonad.Layout.Groups`.

This commit removes `group3`, as it would hardly be useful to anybody,
and introduces a new `ModifyX` message that allows the modifying
function to return a `Groups` layout inside the `X` monad. Here's an
example on why this is useful:

Say you have a master layout with tabbed sub-layouts, and you have
terminal windows sprinkled around these sub-layouts. You now want to
gather all of them into a single tabbed sub-layout, effectively
implementing a "tabbed terminal" (or browser, or editor, etc). With
functionality like this, `XMonad` can become a unified multi-window
application manager: one does not need tabbed browsers, terminals,
etc.

In order for this to be possible, however, the modifier function needs
to be able to query for things like the window class name with
`runQuery`, and that in turn means it has to operate inside the `X`
monad. This is only possible if `Groups` accepts the modifier
introduced in this commit.

I bet many other uses for a `ModifierX` message can be found. I have
the functionality of the example I gave implemented and working with
this change, since it was my motivation to get it done (and I must say
it is quite sweet to have tabbed window unification).
2018-03-21 21:16:06 -07:00
Brent Yorgey
2448a2a6a6 Merge pull request #236 from MichielDerhaeg/ghc84-compat
update to work with GHC 8.4.1
2018-03-21 15:26:15 -05:00
Michiel Derhaeg
86595e193e update to work with GHC 8.4.1 2018-03-20 22:06:18 +01:00
Campbell Barton
236ca9959d Add BinaryColumn layout
This is similar to 'Column' layout with some differences.

- Add/remove windows keeps window bounds.
- Enforce minimum window size.
- Negative scale can be used to increase the size of the last window
  instead of the master window.
2018-03-11 20:45:20 +11:00
Sergey Alirzaev
d5d82267c5 + FuzzyMatch by @nzeh
Provides a predicate 'fuzzyMatch' that is much more lenient in matching
completions in XMonad.Prompt than the default prefix match.  Also provides
a function 'fuzzySort' that allows sorting the fuzzy matches by "how well"
they match.

Not sure why wasn't it accepted.
Discussion: https://markmail.org/thread/kgrybzqarqzqiige
2018-03-10 09:07:00 +03:00
Brent Yorgey
3d3e898166 Merge pull request #229 from ccrusius/master
Add three-dimensional group layout
2018-03-06 20:52:56 -06:00
Brent Yorgey
e03844dd20 Merge pull request #230 from IamfromSpace/add-layout-multi-dishes-squashed
Add a new layout MultiDishes
2018-03-06 20:50:15 -06:00
Nathan Fairhurst
b42a1392da Add a new layout MultiDishes, which behaves like Dishes, but allows a configurable number windows within each stack. 2018-03-04 21:03:45 -08:00
Brent Yorgey
0bde284129 Merge pull request #219 from LSLeary/master
New sideNavigation strategy for X.A.Navigation2D
2018-03-02 05:55:33 -06:00
ccrusius
1c52484753 Add three-dimensional group layout
This is as per the work done in
http://lynnard.me/blog/2013/12/30/more-xmonad-goodies/, where the
functionality is explained in detail.

This also fixes #214. The original suggestion in that bug report is
not enough. Even if we export `gen` and `Uniq`, we would still have to
export the `Groups` type constructor. I thought it better to simply
allow the user to create a three-dimensional group instead.
2018-02-28 18:37:24 -08:00
Brent Yorgey
d7c6ee940b Merge pull request #228 from codetriage-readme-bot/codetriage-badge
Add CodeTriage badge to xmonad/xmonad-contrib
2018-02-14 22:13:46 -06:00
Brent Yorgey
a96d1d0bb7 Merge pull request #225 from maciasello/master
Add appendFilePrompt' to allow transforming text before appending
2018-02-12 09:59:40 -06:00
codetriage-readme-bot
a590034a23 Add CodeTriage badge to xmonad/xmonad-contrib
Adds a badge showing the number of people helping this repo on CodeTriage.

[![Open Source Helpers](https://www.codetriage.com/xmonad/xmonad-contrib/badges/users.svg)](https://www.codetriage.com/xmonad/xmonad-contrib)

## What is CodeTriage?

CodeTriage is an Open Source app that is designed to make contributing to Open Source projects easier. It works by sending subscribers a few open issues in their inbox. If subscribers get busy, there is an algorithm that backs off issue load so they do not get overwhelmed

[Read more about the CodeTriage project](https://www.codetriage.com/what).

## Why am I getting this PR?

Your project was picked by the human, @schneems. They selected it from the projects submitted to https://www.codetriage.com and hand edited the PR. How did your project get added to [CodeTriage](https://www.codetriage.com/what)? Roughly 7 months ago, [wisn](https://github.com/wisn) added this project to CodeTriage in order to start contributing. Since then, 2 people have subscribed to help this repo.

## What does adding a badge accomplish?

Adding a badge invites people to help contribute to your project. It also lets developers know that others are invested in the longterm success and maintainability of the project.

You can see an example of a CodeTriage badge on these popular OSS READMEs:

- [![](https://www.codetriage.com/rails/rails/badges/users.svg)](https://www.codetriage.com/rails/rails) https://github.com/rails/rails
- [![](https://www.codetriage.com/crystal-lang/crystal/badges/users.svg)](https://www.codetriage.com/crystal-lang/crystal) https://github.com/crystal-lang/crystal

## Have a question or comment?

While I am a bot, this PR was manually reviewed and monitored by a human - @schneems. My job is writing commit messages and handling PR logistics.

If you have any questions, you can reply back to this PR and they will be answered by @schneems. If you do not want a badge right now, no worries, close the PR, you will not hear from me again.

Thanks for making your project Open Source! Any feedback is greatly appreciated.
2018-02-11 13:51:19 -06:00
Maciej Ligenza
ff3e415b9d Add appendFilePrompt' to allow transforming text before appending to file 2018-01-21 02:12:24 +01:00
Brent Yorgey
3044577a4c Merge pull request #182 from strokyl/157_allow_custom_physical_screen_order
157 allow user to customize screen ordering
2018-01-18 23:43:25 -06:00
Luc DUZAN
756507e2b6 157 allow user to customize screen ordering
Now when using getSortByXineramaPhysicalRule and all helper given by
Actions.PhysicalScreens the user have to provide a screen comparator that can
compare screen using their id or/and their coordinate.
2018-01-14 22:13:31 +01:00
L.S. Leary
4a98a27950 Added navigation strategy sideNavigation and parameterised variant sideNavigationWithBias to X.A.Navigation2D. 2017-12-16 17:37:52 +13:00
Brent Yorgey
51857a1a20 Merge pull request #218 from LSLeary/master
Extended the sendMessage interface of X.L.Gaps to allow arbitrary modifications
2017-11-28 23:58:33 -05:00
L.S. Leary
cc9622ab28 Extended the sendMessage interface of X.L.Gaps to allow arbitrary modifications to the GapSpec. 2017-11-22 07:58:41 +13:00
Brent Yorgey
89a0fdf7fe Merge pull request #181 from NickHu/master
Make UnicodeData.txt path configurable, remove unsafePerformIO
2017-10-16 00:18:43 -04:00
Nick Hu
50b2abce5b Merge branch 'master' into master 2017-10-09 12:52:41 +01:00
Brent Yorgey
dc30cbd2f9 Merge pull request #197 from NickHu/pass
Add facility for automatically typing passwords via XMonad.Prompt.Pass, and handle special characters in pass labels
2017-10-07 16:43:21 -04:00
Peter J. Jones
6b5d08c46b Merge pull request #212 from LSLeary/master
Generalised hybridNavigation to hybridOf
2017-09-26 11:49:26 -07:00
L.S. Leary
c778b9c2af Generalised (and hence deprecated) hybridNavigation to hybridOf so that users can choose order of preference of navigation strategies. 2017-09-27 07:25:35 +13:00
Peter J. Jones
823362ce79 Update .travis.yml 2017-09-26 10:53:02 -07:00
Nick Hu
ecd0048d83 Make UnicodeData.txt path configurable, remove unsafePerformIO in favour
of ExtensibleState

Add facility to type Unicode character via xdotool
2017-08-19 00:27:52 +01:00
Nick Hu
8daa84375b Pipe password to xdotool via undocumented --file to prevent snatch
from `ps`, and also some backwards compatibility.
2017-08-17 21:46:41 +01:00
Nick Hu
cee5aa2a58 Adds a new function to spawn a pass prompt which will use xdotool to
type in a password, bypassing the clipboard. Also incorporate some shell
escapes to properly handle pass labels with spaces and special
characters in them.
2017-08-17 21:46:41 +01:00
Brent Yorgey
676d83ce83 Merge pull request #196 from Ongy/sessionstartup
Add XMonad.Util.SessionStart
2017-07-25 11:44:33 -04:00
Brent Yorgey
6b1f755e20 Merge pull request #206 from foreverbell/master
Export XMonad.Prompt.insertString.
2017-07-24 17:41:51 -04:00
Brent Yorgey
df88bc62d7 Merge pull request #189 from skewerr/master
Added functions to perform actions with the first minimized window.
2017-07-24 11:37:42 -04:00
Brent Yorgey
dcc2a69fbc Merge branch 'master' into master 2017-07-24 11:37:32 -04:00
foreverbell
ff3ecd2032 Update CHANGES.md 2017-07-23 00:59:02 +08:00
foreverbell
96e9cab753 Export XMonad.Prompt.insertString. 2017-07-23 00:52:43 +08:00
Brent Yorgey
97daafa723 Merge pull request #205 from Gekkio/fix-gnome-config-mod-shift-q
Fix Gnome config modm+shift+Q logout command
2017-07-17 17:40:29 -04:00
Joonas Javanainen
26690e2d0b Fix Gnome config modm+shift+Q logout command
The --kill option was deprecated in 2.23.x (year 2008):
c91d138b33/NEWS (L1843)

gnome-session-save was renamed to gnome-session-quit in 2.91.x (year 2011):
c91d138b33/NEWS (L988)
2017-07-16 15:04:00 +03:00
Brent Yorgey
dc04c3821c Merge pull request #200 from xrvdg/readme
README.md: Update links and add contributing info.
2017-07-10 11:44:34 -04:00
Brent Yorgey
430942e981 Merge pull request #201 from xrvdg/commands-dmenulike
X.A.Commands: Parameterize runCommand to accept dmenu-like launchers.
2017-07-10 11:41:17 -04:00
Brent Yorgey
62028bbff7 Merge pull request #202 from xrvdg/spacing-gaps-documentation
X.L.Spacing + X.L.Gaps: add mutual hyperlink
2017-07-10 11:37:17 -04:00
Brent Yorgey
4719dfe260 Merge pull request #190 from crocket/master
Replace X with MonadIO in XMonad.Util.Dmenu
2017-07-10 11:35:49 -04:00
crocket
7930151604 Make XMonad.Util.Dmenu.menuArgs compatible with GHC < 7.10
menuArgs breaks compilation on GHC < 7.10 because it uses fmap but
only has a MonadIO constraint.
Functor was not a superclass of Monad until GHC 7.10.
2017-07-08 08:16:14 +09:00
Xander Rémon van der Goot
cad6bb7769 X.L.Spacing + X.L.Gaps: add mutual hyperlink
These layout have different applications but their names could cause some
confusion since the module names could just as well be swapped. To support this claim,
what we call "spacing" is named "gaps" in i3wm (i3-gaps). Therefore hyperlinks have
been added to inform the reader of the existence of the other module.
2017-07-03 21:27:58 +02:00
Xander Rémon van der Goot
d5dd9329b5 X.A.Commands: Parameterize runCommand to accept dmenu-like launchers.
The X.U.Dmenu library has support to run dmenu-like launchers, but X.A.Commands
has the use of dmenu hardcoded. This commit makes it possible to use other
launchers without duplicating existing code.
2017-07-03 19:41:11 +02:00
xrvdg
1b1a0eeada README.md: Update links and add contributing info.
Firstly, the links are updated to point to Hackage rather than xmonad.org since not all redirect work correctly. For example the link to developing documentation went to the main XMonad's Hackage page rather then XMonad.Docs.Extending on Hackage.

Secondly, the links are changed such that their [id]-tag isn't showing.

Lastly, a link to XMonad's contributing.md has been added.
2017-07-03 17:53:50 +02:00
Markus Ongyerth
c8ce8dcd41 Add XMonad.Util.SessionStart
This module provides a way to query the session startup.
Currently the flag has to be set by calling setSessionStarted in
the startupHook. The goal would be to merge this into xmonad at some
point and set the flag when the state file is read in, and remove the
need to manually set it.
2017-06-25 12:15:17 +02:00
spoonm
8266feba95 Added withFirstMinimized and withFirstMinimized'.
Also changed the order of the `L.intersect` line to prevent the map key ordering from changing the minimizedStack.
2017-06-17 10:20:49 -03:00
crocket
3282fb420d Replace X with MonadIO in XMonad.Util.Dmenu
MonadIO is compatible with xfork which prevents dmenu prompts from
freezing XMonad.
Without xfork, if I try to give focus to another window while dmenu is
waiting, XMonad freezes until I kill dmenu in virtual terminal or ssh
session.
2017-06-06 10:17:00 +09:00
Peter J. Jones
12227d37ca Merge pull request #186 from ankaan/multicolumns-layouthints-windoworderfix
Fix render order of LayoutHints and MultiColumns
2017-05-24 16:52:41 -07:00
Anders Engström
cff3343a8c Fix render order of LayoutHints and MultiColumns
Before this fix, when using layoutHintsToCenter together with
MultiColumns, in certain situations XMonad would render the border of
the focused window below a border of unfocused windows. This looks odd
and is here fixed by changing MultiColumns to always place the focused
window in front (even though they should not really overlap) and making
LayoutHints preserve the order returned from the underlying layout,
except for the focused window that is placed on top.

This is a good idea since layoutHintsToCenter requires the focused
window to be on top for good rendering, even if that is not really
required when the underlying layout is used on its own. This way
layoutHintsToCenter requires less of the layout that is modified and
MultiColumns is more compatible with future layout modifiers that are
not so considerate.
2017-05-24 22:18:34 +02:00
Daniel Wagner
ade890ac63 Merge pull request #172 from bforte/fixed-haddock-comments
trivial changes to fix haddock documentation
2017-04-29 15:23:01 -07:00
Bruce Forte
295d416e9d Update CycleWorkspaceByScreen.hs 2017-04-29 22:53:42 +02:00
bforte
38b7a2e7f4 trivial changes to fix haddock documentation 2017-04-29 21:08:12 +02:00
Peter J. Jones
abb5f3d45c Merge pull request #171 from pjones/pjones/combop-parition
Add message to "re-partition" a ComboP layout
2017-04-28 21:14:33 -07:00
Peter Jones
e3c46b36db Add message to "re-partition" a ComboP layout
This is especially useful with the `Tagged' window property.
2017-04-27 21:28:00 -07:00
Peter J. Jones
e5534d16cd Merge pull request #167 from IvanMalison/CycleWorkspaceByScreen
Cycle workspace by screen
2017-04-21 14:37:10 -07:00
Ivan Malison
0e35b6e504 Add X.A.CycleWorkspaceByScreen, Per screen WorkspaceHistory 2017-04-20 15:46:23 -07:00
Peter J. Jones
7e47ecc124 Merge pull request #102 from f1u77y/rewrite-minimize
Rewrite minimization-related modules
2017-04-20 10:46:26 -07:00
Bogdan Sinitsyn
c99606bbdd Rewrite minimization-related modules
* Use global state instead of per-layout - so now window is minimized on
  all workspaces (EWMH requires that windows with _NET_WM_STATE_HIDDEN
  set should be minimized on any workspace but previously they were not)
* Use `windows` instead of `modify`. That should fix bugs related to
  actions that should be done by `windows` and not done by
  `modify` (fixes #46)
* Mark module X.H.RestoreMinimized as deprecated
2017-04-20 20:09:16 +03:00
Brent Yorgey
a226ca62c7 Merge pull request #156 from strokyl/add_modifySpacing_message_handling_to_smartpacing
Add ModifySpacing message handling to SmartPacing and SmartSpacingWit…
2017-04-19 12:25:38 -04:00
Peter J. Jones
87683afd72 Merge pull request #165 from davama/master
X.P.Pass doc typo
2017-04-13 11:30:59 -07:00
Dave
20e8a33e0c Typo fix 2017-04-13 13:37:30 -04:00
Peter J. Jones
21062dd392 Merge pull request #44 from deepfire/spawnon-child-pid-tracking
Spawnon child pid tracking
2017-04-12 08:26:18 -07:00
Peter J. Jones
cfc99693fe Merge pull request #161 from xmonad/revert-128-master
Requesting focus causes layout order to change

Reverts xmonad/xmonad-contrib#128
2017-04-10 16:52:12 -07:00
Peter J. Jones
1b738c2bed Revert "Add new module XMonad.Hooks.Focus ." 2017-04-10 16:19:06 -07:00
Kosyrev Serge
33237f47f7 Actions.SpawnOn: make spawnOn more reliable on Linux, by tracking children across fork 2017-04-11 01:00:47 +03:00
Peter Jones
65ac029636 Move example configuration file into xmonad-contrib for better visibility 2017-04-10 10:38:23 -07:00
Brent Yorgey
7136394282 Merge pull request #147 from pjones/pjones/windowMultiPrompt
New function: `X.P.Window.windowMultiPrompt'
2017-03-30 16:15:50 -05:00
Brent Yorgey
0ecbc68b98 Merge branch 'master' into pjones/windowMultiPrompt 2017-03-30 16:15:06 -05:00
Brent Yorgey
3ab4a94d6f clean up Hooks.Focus-related CHANGES and move to 0.14 2017-03-30 16:10:21 -05:00
Brent Yorgey
3b9924b181 Merge pull request #128 from sgf-dma/master
Add new module XMonad.Hooks.Focus .
2017-03-30 16:03:18 -05:00
Brent Yorgey
08abaccdce Merge branch 'master' into master 2017-03-30 16:02:47 -05:00
geekosaur
acdea28dfd Merge pull request #158 from xmonad/ezconfig-latin1
X.U.EZConfig: include Latin1 keys
2017-03-28 20:20:04 -04:00
Brent Yorgey
4ba56ee388 update CHANGES for EZConfig Latin1 changes 2017-03-26 22:06:05 -05:00
Brent Yorgey
057af44998 X.U.EZConfig: include Latin1 keys 2017-03-26 22:02:48 -05:00
Luc DUZAN
b4e7ab3d37 Add ModifySpacing message handling to SmartPacing and SmartSpacingWithEdge 2017-03-15 17:53:02 +01:00
Daniel Wagner
8984ce64bb Merge pull request #153 from mitchellwrosen/master
Respect number of master windows in Magnify layout
2017-02-25 10:07:01 -08:00
Mitchell Rosen
1b96c646c1 Respect number of master windows in Magnify layout 2017-02-25 10:02:29 -05:00
Brent Yorgey
78a15b9d49 Merge pull request #151 from samdoshi/gridselect
GridSelect: border colour and vertically centring text
2017-02-21 20:20:20 -06:00
Brent Yorgey
4c00eb5848 fix ThreeColMid window shuffling
Fixes #137.
2017-02-19 20:45:43 -06:00
geekosaur
a372b455dc typo in navigation2DP example
The example code in the documentation uses `navigation2D` instead of `navigation2DP`, evidently a simple copy/paste error. No actual code change.
2017-02-18 17:19:59 -05:00
Sam Doshi
a79a116934 improve the vertical centring in X.A.GridSelect 2017-02-18 13:46:30 +00:00
Sam Doshi
b1dee9b0b4 allow border colour to be specified in GSConfig 2017-02-17 08:29:12 +00:00
Brent Yorgey
54ef9f6f8d Merge pull request #149 from pjones/pjones/tagged
X.U.WindowProperties: Added the ability to test if a window has a tag…
2017-02-16 21:59:09 -06:00
Brent Yorgey
cffc36e21a Merge pull request #148 from samdoshi/bsp
export BinarySpacePartition type
2017-02-16 21:52:46 -06:00
Peter Jones
025433c658 X.U.WindowProperties: Added the ability to test if a window has a tag from X.A.TagWindows
New data constructor `Tagged` that uses `hasTag` from
`X.A.TagWindows`.  This is great for building layouts based off of
window tags.
2017-02-15 09:36:35 -07:00
Sam Doshi
0f9a6015e4 export BinarySpacePartition type 2017-02-15 14:45:11 +00:00
Peter Jones
00eb2abd87 New function: `X.P.Window.windowMultiPrompt'
Like 'windowPrompt', but uses the multiple modes feature of
@Prompt@ (via 'mkXPromptWithModes').

Given a list of actions along with the windows they should work
with, display the appropriate prompt with the ability to switch
between them using the @changeModeKey@.

For example, to have a prompt that first shows you all windows, but
allows you to narrow the list down to just the windows on the
current workspace:

> windowMultiPrompt config [(Goto, allWindows), (Goto, wsWindows)]
2017-02-14 10:32:50 -07:00
sgf
6f8145a2dc X.H.Focus: Add predefined configurations and more examples. 2017-02-14 20:13:49 +03:00
Peter Jones
298e51f939 Correctly mark functions in X.P.Window as deprecated 2017-02-13 16:16:04 -07:00
Peter J. Jones
9d2ffeb8e1 Merge pull request #139 from mekeor/better-xpc-font-description
Better description of 'font' field of 'XPC' record
2017-02-13 12:15:59 -07:00
Mekeor Melire
878987071b Better description of 'font' field of 'XPC' record
Describe how to use the 'font' field of 'XPC' record by adding two different examples.
2017-02-13 13:25:25 +01:00
Peter Jones
ca9b7d9dfc Add a stack.yaml file for testing and easy Hackage upload 2017-02-10 16:20:42 -07:00
Peter Jones
615f007fe4 Add a cabal.project file 2017-02-10 16:04:33 -07:00
Peter Jones
e4e20da8f0 Clean up the change log just a bit 2017-02-10 16:02:41 -07:00
Peter Jones
b064d22c2d Add a release date 2017-02-09 16:25:24 -07:00
Peter Jones
d2ffb75031 Merge remote-tracking branch 'origin/pjones/rmworkarea' into release-0.13 2017-02-09 16:13:36 -07:00
Peter Jones
cb344d14b9 Bump version to 0.13 2017-02-09 16:12:55 -07:00
Peter J. Jones
d1a5f9cf91 Merge pull request #141 from pjones/pjones/prompt-complete
Better completion when using `alwaysHighlight'
2017-02-09 15:10:27 -07:00
Peter J. Jones
3b1c43cced Merge pull request #142 from pjones/pjones/border
Use `setWindowBorderWithFallback' to support windows with RGBA color maps
2017-02-09 15:10:13 -07:00
Peter J. Jones
76b1771a31 Merge pull request #144 from pjones/pjones/dzen
Manage struts even when _NET_WM_WINDOW_TYPE isn't a dock
2017-02-09 15:07:40 -07:00
Peter Jones
cd96de5378 Manage struts even when _NET_WM_WINDOW_TYPE isn't a dock
Relates to #21
2017-02-07 15:58:55 -07:00
Peter Jones
0a8e68b458 Delete _NET_WORKAREA instead of setting it
References:

  * 9c020877dd

  * https://github.com/qtile/qtile/issues/847

  * eec80838ab

  * https://github.com/xmonad/xmonad-contrib/pull/79
2017-02-07 15:42:35 -07:00
Peter Jones
de4a3bd0ed Use `setWindowBorderWithFallback' to support windows with RGBA color maps
This brings xmonad-contrib inline with xmonad in this regard.  Should
also be fix for #138
2017-02-07 14:49:01 -07:00
Peter Jones
4f3020313d Don't use `windows' in X.L.Hidden, it might cause an infinite loop
Fixes #132
2017-02-07 13:39:01 -07:00
Peter Jones
57c00b1086 Better completion when using `alwaysHighlight'
This change improves the UX of X.Prompt when `alwaysHighlight` is
enabled.  This is especially useful for use with `mkXPromptWithModes`
which forces `alwaysHighlight` to be `True`.

When the user presses the `complKey` and `alwaysHighlight` is `True`,
one of two things will happen:

  1. If this is the first time `complKey` is pressed in this round of
     completion then the prompt buffer will be updated so it contains
     the currently highlighted item.

  2. Every other time that the `complKey` is pressed the next
     completion item will be selected and the prompt buffer updated.

This gives immediate feedback to the user and allows using some
prompts with `alwaysHighlight` that weren't possible before (e.g.,
shellPrompt, directoryPrompt, etc.)
2017-02-05 19:38:00 -07:00
Peter Jones
bdec8df4c6 Improve prompts for X.A.DynamicProjects 2017-02-05 19:36:30 -07:00
Peter Jones
52087953fd Add `directoryMultipleModes'
Allow X.P.Directory to be used with `mkXPromptWithModes`
2017-02-05 19:31:41 -07:00
Peter Jones
33c805fadc Add GitHub templates 2017-01-12 12:27:11 -07:00
Peter J. Jones
32b9f00ce7 Merge pull request #134 from pjones/bugfix/prompt-history
Use the new getXMonadCacheDir function from #62
2017-01-08 21:26:13 -07:00
sgf
a3593e5607 Remove no longer relevant changes from CHANGES.md. Fix merge conflicts. 2017-01-06 18:01:41 +03:00
Peter Jones
4dd60756ea Update the change log 2017-01-04 14:47:20 -07:00
Peter Jones
74b281b5d3 Use the new getXMonadCacheDir function from #62
Prompt should have been using getXMonadDir this entire time but since
we now have getXMonadCacheDir use that instead.  This brings
xmonad-contrib inline with the changes in #62.

This also fixes xmonad/xmonad-contrib#68
2017-01-04 14:39:00 -07:00
Peter J. Jones
77e5e5190d Merge pull request #131 from sgf-dma/fix-changes.md
Fix CHANGES.md after b9d8f6c .
2017-01-03 15:49:09 -07:00
sgf
5bf4b27054 Fix CHANGES.md after b9d8f6c . 2016-12-25 14:59:30 +03:00
Brent Yorgey
8956684ff5 Merge pull request #130 from strokyl/add_HiddenEmptyWS_to_CycleWS
Add HiddenEmptyWS to CycleWS
2016-12-23 23:50:52 -05:00
Luc DUZAN
9da78669e7 Add HiddenEmptyWS to CycleWS
When I have multiscreen I think it's usefull to get the next empty workspace
that is not already displayed.
2016-12-22 22:48:23 +01: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
sgf
8e5931272c X.H.ManageHelpers: Make type of ManageHook combinators more general. 2016-12-16 14:22:39 +03:00
sgf
2807935900 X.H.SetWMName: Add getWMName function.
And do not overwrite wm name in `handleFocusQuery`, if user has already set
it.
2016-12-15 22:13:48 +03:00
sgf
195cfbe77e Add new module XMonad.Hooks.Focus .
Extend ManageHook EDSL to work on focused windows and current workspace.
2016-12-15 22:13:42 +03:00
Peter J. Jones
c0cf18def2 Merge pull request #17 from kurnevsky/update_pointer_bugfix
UpdatePointer bugfix.
2016-12-14 14:48:52 -07:00
Peter Jones
d5aa562282 Add build status badge from Travis 2016-12-14 14:44:15 -07:00
Peter Jones
f1de0413da Update GHC versions to a more reasonable list 2016-12-14 14:29:52 -07:00
Peter Jones
6eac81cf51 Bump X11 version upper-bounds to 1.8 2016-12-14 14:11:30 -07:00
Kurnevsky Evgeny
a8d290b830 Update CHANGES.md 2016-12-14 11:49:28 +03:00
Kurnevsky Evgeny
86280c5063 Rewrite XMonad.Actions.UpdatePointer bugfix with Control.Exception.try. 2016-12-14 09:03:26 +03:00
Kurnevsky Evgeny
11e0d683af UpdatePointer bugfix. 2016-12-14 09:03:26 +03:00
geekosaur
061edbd954 Merge pull request #127 from bennofs/patch-1
DynamicProperty: execute other hooks
2016-12-09 23:10:06 -05:00
Benno Fünfstück
0949b9ec91 DynamicProperty: execute other hooks
All False short-cuts the default behavior for the event, which leads to a non-functioning window manager. Returning mempty ensures that the default action is still executed,
2016-12-09 22:35:11 +01:00
Peter J. Jones
f837a4fb36 Merge pull request #6 from sgf-dma/master
X.A.Submap: establish pointer grab to avoid freezing X.
2016-12-09 08:34:47 -07:00
sgf
b9d8f6ce34 X.A.Submap: establish pointer grab to avoid freezing X.
Establish active asynchronous pointer grab before entering infinity cycle.
Because xmonad already has passive synchronous pointer grab, this overwrites
it temporary and avoids freezing X, when button press occurs after submap key
press.

Also, terminate submap at button press in the same way, as we do for wrong key
press.
2016-12-09 12:38:33 +03:00
Peter J. Jones
c69b2933a3 Merge pull request #126 from pauleve/master
Fix #120 - Make Actions.WindowGo.raiseNextMaybe span over all workspaces
2016-12-08 14:39:30 -07:00
Loïc Paulevé
0573451789 Update CHANGES.md for #126 2016-12-08 22:24:24 +01:00
Loïc Paulevé
43673b3907 workspacesSorted: fix indentation + add comment 2016-12-05 13:37:26 +01:00
Loïc Paulevé
9f9b5d3748 Make Actions.WindowGo.raiseNextMaybe span over all workspaces. Fixes #120 2016-12-02 08:54:01 +01:00
Daniel Wagner
0a1d8505a0 Merge pull request #125 from vvv/fix-custom-keys-doc
CustomKeys.hs: Fix documentation
2016-11-30 18:41:54 +01:00
Valery V. Vorotyntsev
c392a407bb CustomKeys.hs: Fix documentation
Fix code example in documentation. (Wrong implementation of `delkeys`.)
Thanks to Lasse R.H. Nielsen for reporting the problem!
2016-11-30 17:55:20 +02:00
Brent Yorgey
16b80a4331 Merge pull request #124 from trofi/master
XMonad/Layout/Groups/Helpers.hs: drop broken ImpredicativeTypes extension (fixes #123)
2016-11-28 17:54:29 -05:00
Sergei Trofimovich
a681e68602 XMonad/Layout/Groups/Helpers.hs: drop broken ImpredicativeTypes extension (fixes #123)
ImpredicativeTypes is practically unsupported extension
on it's way to be removed from GHC:
    https://mail.haskell.org/pipermail/ghc-devs/2016-September/012826.html

GHC-8.0.2-rc1 already fails to build xmonad-contrib as:

  XMonad/Layout/Groups/Helpers.hs:181:22: error:
    • Couldn't match type ‘G.WithID l0 Window
                           -> XMonad.Util.Stack.Zipper (G.Group l0 Window)
                           -> XMonad.Util.Stack.Zipper (G.Group l0 Window)’
                     with ‘G.ModifySpec’
      Expected type: (G.WithID l0 Window
                      -> XMonad.Util.Stack.Zipper (G.Group l0 Window)
                      -> XMonad.Util.Stack.Zipper (G.Group l0 Window))
                     -> G.GroupsMessage
        Actual type: G.ModifySpec -> G.GroupsMessage
    • In the second argument of ‘(.)’, namely ‘G.Modify’
      In the expression: sendMessage . G.Modify
      In an equation for ‘wrap’: wrap = sendMessage . G.Modify

The workaround is simple: add explicit types to applications
or open-code direct application (this change).

Bug: https://github.com/xmonad/xmonad-contrib/issues/123
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2016-11-27 10:03:17 +00:00
Peter Jones
be036f9bb9 Export `removeEmptyWorkspaceByTag'
It looks like this function should have been exported all along but
was overlooked.
2016-11-21 17:15:53 -07:00
Peter Jones
217abc39a2 Compose startupHook/logHook in the same order as other modules
I believe this was causing issues where a dynamically created
workspace would not properly trigger manageDocks logic.
2016-11-16 15:13:58 -07:00
Peter Jones
5790913eae Teach X.A.DynamicProjects to use removeWorkspaceByTag when deleting a project
When deleting a dynamic project, also delete its workspace.
2016-11-15 17:00:50 -07:00
Brent Yorgey
d21ed81801 Merge pull request #106 from IvanMalison/custom_focus_raise_next_maybe
X.A.WindowGo: Add arg for custom focus fn to raiseNextMaybe
2016-11-08 22:59:21 -05:00
Brent Yorgey
cc44be649d Merge pull request #113 from pjones/xmonad/features/layoutb
Refactor all X.L.LayoutBuilderP functionality into X.L.LayoutBuilder
2016-11-08 22:57:08 -05:00
Brent Yorgey
a7059e1a32 Merge pull request #114 from liskin/workspacenames2
X.A.WorkspaceNames: add getWorkspaceNames'
2016-11-08 22:53:31 -05:00
Tomas Janousek
7ada94df42 X.A.WorkspaceNames: add getWorkspaceNames' 2016-11-07 20:59:20 +01:00
Peter Jones
c0a0a44fbc Update CHANGES.md for PR #113 2016-11-05 10:00:17 -07:00
Peter Jones
ca5fbc155b Refactor all X.L.LayoutBuilderP functionality into X.L.LayoutBuilder
X.L.LayoutBuilderP is nearly identical to X.L.LayoutBuilder.  Originally
I wanted to add the ability to dynamically resize the layout boxes so it
make a lot of sense to join these two modules together so I wouldn't
have to do it in both.  Even though I never got around to that I still
think it's a good idea to merge these two modules into one.

I believe I was able to merge these without creating any
backward-compatibility issues.  I've been sitting on these changes since
2015 and they work for me without having to change older parts of my
config (relating to X.L.LayoutBuilder).

If anyone wants to work on dynamically resizing layout boxes the issue I
created for it is #36.
2016-11-05 09:51:28 -07:00
Ivan Malison
856b125186 X.A.WindowGo: Make comment style more consistent 2016-11-03 19:22:49 -07:00
Ivan Malison
c51bd739d7 X.A.WindowGo: Add a haddock comment to raiseNextMaybeCustomFocus 2016-11-03 19:21:52 -07:00
Ivan Malison
0e1cecd135 Merge remote-tracking branch 'origin/master' into custom_focus_raise_next_maybe 2016-11-03 19:15:28 -07:00
Brent Yorgey
ec5f9a9e59 Merge pull request #80 from f1u77y/managedocks-global-cache
Make strut cache global
2016-11-03 17:40:04 -04:00
Brent Yorgey
65bbe1a995 Merge pull request #108 from liskin/workspacenames
X.A.WorkspaceNames: add get(Current)WorkspaceName
2016-11-02 21:25:06 -04:00
Brent Yorgey
7b8798cb30 Merge pull request #104 from IvanMalison/windowBringerDefaults
X.A.WindowBringer: Add a config object with a X.C.Default implementation
2016-11-02 21:23:20 -04:00
Tomas Janousek
0a74e3479e X.A.WorkspaceNames: add get(Current)WorkspaceName 2016-10-29 23:36:19 +02:00
Ivan Malison
8e061c0c6d X.A.WindowGo: Remove uncurry from raiseNextMaybeCustomFocus 2016-10-26 17:24:45 -07:00
Ivan Malison
49fecdf4eb X.A.WindowGo: Add arg for custom focus fn to raiseNextMaybe 2016-10-26 17:09:42 -07:00
Ivan Malison
993dedf6d3 X.A.WindowBringer: Use <$> instead of fmap 2016-10-24 22:38:45 -07:00
Bogdan Sinitsyn
fcb57bd657 Move modifyXS to X.U.ExtensibleState 2016-10-25 08:22:02 +03:00
Ivan Malison
05d7493888 X.A.WindowBringer: Misc. cleanup and whitespace fixes 2016-10-24 22:10:56 -07:00
Ivan Malison
4983ecfd23 X.A.WindowBringer: Add haddocks for WindowBringerConfig 2016-10-24 22:10:09 -07:00
Brent Yorgey
ae7fd21e29 Merge pull request #97 from samdoshi/prompt-haddock
fix broken XPConfig docs
2016-10-24 17:57:53 -04:00
Ivan Malison
6cb10c9300 X.A.WindowBringer: Add a X.C.Default impl
This provides a less complicated interface to the specification of
custom behavior. In particular it allows the specification of a custom
window titling function.
2016-10-21 20:14:52 -07:00
Brent Yorgey
e98fedfaa5 Merge pull request #92 from jschwab/use-searchPredicate-in-prompt-pass
XMonad.Prompt.Pass: Use searchPredicate from XPConfig
2016-10-21 22:35:09 -04:00
Sam Doshi
dcc2759c4d fix broken XPConfig docs 2016-10-19 11:41:06 +01:00
Brent Yorgey
b871a0c7ee Merge pull request #91 from nomeata/prompt-unicode
Add XMonad.Prompt.Unicode
2016-10-19 19:13:47 +09:00
Brent Yorgey
c71f72ff66 Merge pull request #95 from Fuco1/feature/add-submapdefaultwithkey
Feature/add submapdefaultwithkey
2016-10-18 10:58:27 +09:00
Matus Goljer
e5ca066057 Add submapDefaultWithKey.
This is useful for when we want to decide what to do in the default
action based on the key that failed to match in the submap.
2016-10-16 16:40:13 +02:00
Matus Goljer
444986d993 Remove unneeded argument 2016-10-16 16:36:18 +02:00
Matus Goljer
1553d81ce7 Use fromMaybe over "maybe .. id" 2016-10-16 16:33:49 +02:00
Josiah Schwab
082c64ec37 XMonad.Prompt.Pass: Use searchPredicate from XPConfig
XMonad.Prompt allows the user to specify a search predicate in XPConfig.
However, previously XMonad.Prompt.Pass did not apply this predicate.
This now applies the predicate in similar manner as XMonad.Prompt.Shell.
2016-10-12 10:28:01 -07:00
Joachim Breitner
01ddbb7b82 Do not use sortOn
as it is not available in old versions of base.
2016-10-07 15:40:04 -04:00
Joachim Breitner
feec53c78c Avoid attoparsec dependency for this simple parsing task 2016-10-07 15:29:03 -04:00
Joachim Breitner
e4e120bb8e Add XMonad.Prompt.Unicode
I have been using this code locally for years now, and it turned out to
be quite useful in many cases, so I thought it is about time to submit
it to the repository.
2016-10-07 11:50:21 -04:00
Brent Yorgey
858a906240 Merge pull request #87 from nlewo/master
X.A.DynamicWorkspaces: associate indexes to workspaces
2016-10-05 20:32:34 +09:00
Brent Yorgey
1b81ac7314 Merge pull request #86 from aiya000/master
Export XMonad.Actions.Workscreen (WorkscreenId)
2016-10-05 20:29:18 +09:00
Brent Yorgey
262e78770f Merge pull request #82 from 41px/dev-41px
Switch/Move to physical/Xinerama screens 1, 2 or 3
2016-09-23 07:14:17 +09:00
Brent Yorgey
1c8e17e127 Merge pull request #84 from TomSmeets/treeselect
Fix incorrect documentation in TreeSelect
2016-09-23 07:11:56 +09:00
Antoine Eiche
f3de3e2719 X.A.DynamicWorkspace: update index map on workspace renaming 2016-09-20 20:42:03 +02:00
Antoine Eiche
464a99b842 X.A.DynamicWorkspaces: associate indexes to workspaces
You can add indexes to workspaces and use them to do actions on
workspaces. This allows you to dynamicaly associate a workspace to a
keybinding without depending of the workspace name or the workspace
position.
2016-09-19 14:33:18 +02:00
aiya000
f6ded1a4d7 Export XMonad.Actions.Workscreen (WorkscreenId)
This is fixing for problem that
WorkscreenId was shown in XMonad.Actions.Workscreen document
(ex: viewWorkscreen),
but never shown WorkscreenId definition.
2016-09-19 16:31:43 +09:00
Tom Smeets
3b4a3d2bd2 Fix incorrect documentation for WorkspaceHistory 2016-09-14 20:02:07 +02:00
Brent Yorgey
753e9ce4b0 Merge pull request #72 from TomSmeets/treeselect
Add TreeSelect action for selecting from many workspaces and X actions
2016-09-14 07:22:05 -04:00
Daniel Wagner
bf1f4fcc76 Merge pull request #81 from asjo/add_note_to_stoppable
Add note about when Stoppable does not work.
2016-09-11 16:04:39 -07:00
Tom Smeets
305c8eff0d Add optional workspace-history navigation
To enable this feature add `workspaceHisotryHook` from
`XMonad.Hooks.WorkspaceHistory` to your logHook.

Your previously-visited workspaces can be navigated with
the 'moveHistBack' and 'moveHistForward' actions (which are bound to the 'o' and 'i' keys)
2016-09-08 17:00:21 +02:00
Tom Smeets
52b180e6b2 Fixed getSubForest and rootNode 2016-09-08 17:00:21 +02:00
Tom Smeets
c2331f9657 Fixed a small error in the documentation 2016-09-08 17:00:21 +02:00
Tom Hinton
953f1576f4 Determine which groups to Hide correctly
This is a fix I have applied locally to make sure that when I use decorated layouts like tabbed in groups, XMonad does not leave bogus decoration windows lying around.

I think that the issue fixed is that the set of groups to send `Hide` to is determined by subtracting the extant groups from `l`, but `l` has already been put through `readapt` and so some groups may have been removed (if they are empty), so they don't get the Hide message.

The comparison should therefore be between `_l` and the new groups.
2016-09-08 17:00:21 +02:00
Alexandre Px
7629f774c6 fix Couldn't match expected type `KeyMask' 2016-09-07 21:54:09 +02:00
Alexandre Px
a1adb0b801 Replace M.union to <+> in documentation 2016-09-07 21:48:49 +02:00
Alexandre Px
c3081bd783 Switch/Move to physical/Xinerama screens 1, 2 or 3 2016-09-07 21:44:15 +02: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
Bogdan Sinitsyn
c48d81e378 Fix caching issues in ManageDocks
Commits d638dc8b and a5e87e38 introduced a per-AvoidStruts-instance
strut cache that

a) didn't get initialized at startup,
b) didn't get reinitialized after layout reset and
c) didn't get updates if it wasn't the active layout, for example when
   layoutHook = avoidStruts tall ||| avoidStruts (mirror tall)

a) + b) could be fixed by using the docksStartupHook introduced in
28e9f8bc, although this wasn't documented and having to call
docksStartupHook after setLayout is far from obvious.

By moving the strut cache from AvoidStruts instances to a global state,
b) and c) are fixed. One still has to invoke the docksStartupHook for
a), and this will be addressed in the next commit.
2016-09-07 13:26:50 +03:00
Brent Yorgey
94c7cb513c Merge pull request #77 from LSLeary/master
A very simple extension to Navigation2D so it plays better with gaps
2016-09-06 13:19:17 -04:00
Adam Sjøgren
61038f95fb Add note about when Stoppable does not work. 2016-09-03 23:41:10 +02:00
L.S. Leary
4358f58de8 Swapped pickSomething for <|> in doHybridNavigation. 2016-08-30 13:11:54 +12:00
Brent Yorgey
899ff52316 Merge pull request #78 from larkery/patch-1
Determine which groups to Hide correctly
2016-08-29 19:04:13 -04:00
L.S. Leary
ea6e1a5d6d Removed extraneous blank line from Nav2D. 2016-08-29 16:53:46 +12:00
LSLeary
4aaf053273 Rewrote doHybridNavigation. 2016-08-29 14:30:03 +12:00
Tom Hinton
2e53a6cdd6 Determine which groups to Hide correctly
This is a fix I have applied locally to make sure that when I use decorated layouts like tabbed in groups, XMonad does not leave bogus decoration windows lying around.

I think that the issue fixed is that the set of groups to send `Hide` to is determined by subtracting the extant groups from `l`, but `l` has already been put through `readapt` and so some groups may have been removed (if they are empty), so they don't get the Hide message.

The comparison should therefore be between `_l` and the new groups.
2016-08-27 17:12:34 +01:00
L.S. Leary
76565e42c4 Removed an extraneous comment that had been accidentally left in place. 2016-08-27 03:49:52 +12:00
L.S. Leary
a7d5696e5a Punctuation tweak in docs. 2016-08-27 03:27:08 +12:00
L.S. Leary
b9215181bb Rather than writing over the vanilla Line navigation function, Hybrid navigation has been implemented separately. 2016-08-27 03:17:05 +12:00
L.S. Leary
806a501d51 Modified Line to default to Center if it can't move. This provides the best way to get around if you use gaps and float no windows. 2016-08-27 02:37:35 +12:00
Tom Smeets
529683660c Show error when using incorrect XConfig.workspaces 2016-08-22 21:18:04 +02:00
Tom Smeets
15a2a86d46 Removed a useless comment 2016-08-22 20:15:25 +02:00
Tom Smeets
25df357a4a Fixed a small bug 2016-08-10 10:30:39 +02:00
Tom Smeets
c2e0fc517c Fixed incompatibility with older GHC versions 2016-08-08 18:53:27 +02:00
Tom Smeets
1087844a7f Add screenshots and a little more info 2016-08-08 17:26:26 +02:00
Tom Smeets
8bfbafeae9 Add entry to XMonad.Doc.Extending 2016-08-08 11:47:08 +02:00
Tom Smeets
7e777bebfd Select your workspaces and actions in a Tree format.
TreeSelect displays your workspaces or actions in a Tree-like format.
You can select the desired workspace/action with the cursor or hjkl keys.

This module is fully configurable and very useful if you like to have a
lot of workspaces.

Please see the Documentation provided by 'XMonad.Actions.TreeSelect'.
2016-08-07 20:40:40 +02:00
Brent Yorgey
8d2582f032 Merge pull request #66 from mathstuf/fix-warnings
Fix warnings
2016-08-01 14:12:35 -04:00
Brent Yorgey
81f1eab1ee X.A.Search: fix amazon search URL
Closes #71.
2016-08-01 13:01:30 -05:00
Ben Boeckel
4e880b37a2 IfMax: add the PatternGuards extension 2016-07-16 13:23:11 -04:00
Ben Boeckel
637c5c67b1 BinarySpacePartition: add type signature for noRef 2016-07-16 13:22:45 -04:00
Ben Boeckel
8fd8c5d02d warnings: remove unused variables 2016-07-16 13:22:34 -04:00
Ben Boeckel
d414c76da8 warnings: rename shadowing variables 2016-07-16 13:22:12 -04:00
geekosaur
ddcc9e0209 Merge pull request #63 from oldmanmike/XMonad-Config-Desktop-update
Update XMonad.Config.Desktop for 0.12 ManageDocks
2016-07-13 15:46:08 -04:00
Brent Yorgey
e280f62a57 Merge pull request #61 from oldmanmike/update-extending-docs
Add missing Extending documentation for new modules
2016-07-05 15:19:56 -04:00
oldmanmike
a8ca8bcd6f Update XMonad.Config.Desktop for 0.12 ManageDocks 2016-07-02 02:14:36 -04:00
oldmanmike
f3dc89f821 Add missing Extending documentation for new modules 2016-07-01 12:36:15 -04:00
Adam Vogt
6a9e9e5a78 Merge pull request #59 from chongli/master
New SortedLayout module.
2016-07-01 11:52:22 -04:00
Kurt Dietrich
1d5cdc108a New SortedLayout module. 2016-06-30 15:33:15 -04:00
Daniel Wagner
d6243c9564 improve documentation on fonts in Prompt 2016-06-22 13:17:28 -07:00
Daniel Wagner
c2c6a94834 Merge branch 'master' of github:xmonad/xmonad-contrib 2016-06-22 12:57:14 -07:00
Brent Yorgey
6aa289c713 Merge pull request #4 from mathstuf/dynamic-bars-partial-cleanup
X.H.DynamicBars: support per-monitor cleanup
2016-06-16 17:31:05 -04:00
Ben Boeckel
cc77b5019d DynamicBars: improve documentation 2016-06-12 20:03:22 -04:00
geekosaur
a421da29e6 Merge pull request #57 from CaptainPatate/master
Fix minor things
2016-06-12 19:00:45 -04:00
Amaury Gauthier
2831378f8f Fix type of additionalKeys and removeKeys functions 2016-06-08 00:35:25 +02:00
Amaury Gauthier
34f9dda006 Fix documentation 2016-06-08 00:35:25 +02:00
Ben Boeckel
e698e5fe53 X.H.DynamicBars: support per-monitor cleanup
Add functions to allow cleaning up only screens which disappear. This
works better where killing the statusbar for a specific screen is
possible. The old way is still relevant for setups which do not have
such a method (e.g., safeSpawn xmobar/spawnPipe xmonadpropwrite).
2016-05-22 17:28:46 -04:00
Brent Yorgey
fce36bda16 Merge pull request #24 from nlewo/master
X.P.Window: add window selector for the prompt and BringToMaster action
2016-05-12 12:11:25 -04:00
Antoine Eiche
73134369ea X.P.Window: add window selector for the prompt and BringToMaster action
- The set of windows proposed by the prompt can be parametrized. Two
  helper functions are currently defined. One for selecting all
  available windows and another one for selecting all windows of the
  current workspace.

- Add BringToMaster action which brings the selected window to the
  current workspace and set it as master.

- windowPromptGoto, windowPromptBring, windowPromptBringCopy are
  marked as deprecated since they can be realized by the more generic
  windowPrompt function.  For instance, "windowPromptGoto prompt" can
  be easily replaced by "windowPrompt prompt Goto allWindows".
2016-05-10 09:54:41 +02:00
Brent Yorgey
26b50c043c Merge pull request #52 from geekosaur/nsp-loggers
XMonad.Util.Loggers for NamedScratchPad-s
2016-05-09 20:55:25 -04:00
brandon s allbery kf8nh
ed4909aa65 pre-Typeable-unsafeCoerce-fix ghc needs a deriving pragma 2016-05-02 23:06:08 -04:00
Brent Yorgey
f12167b298 Merge pull request #53 from jablko/master
Make WindowBringer case insensitive
2016-05-02 23:00:55 -04:00
Brent Yorgey
00c6a44bdc Merge pull request #51 from seanstrom/feature/dynamicbars-multiPPFormat
DynamicBars: Add new multiPPFormat function
2016-05-02 22:47:27 -04:00
geekosaur
b41544b6cc Merge pull request #55 from Delapouite/docs
docs: fix typo Repace → Replace in XMonad.Layout.Renamed
2016-04-29 10:02:47 -04:00
Delapouite
da44e76f75 docs: fix typo Repace → Replace in XMonad.Layout.Renamed 2016-04-29 13:31:59 +02:00
Jack Bates
75b3cae49f Make WindowBringer case insensitive 2016-04-27 09:48:36 -07:00
brandon s allbery kf8nh
72956159b6 Add XMonad.Util.NoTaskbar, XMonad.Util.Loggers.NamedScratchpad 2016-04-21 14:49:13 -04:00
geekosaur
9a187f243c Merge pull request #50 from damianfral/patch-1
Fix updatePointer equivalence table.
2016-04-12 11:15:56 -04:00
Damián Franco Álvarez
e0211ad7d6 Fix updatePointer equivalence table.
In order to get the behavior I had with `updatePointer (Relative 0.5 0.5)`, I have to use `updatePointer (0.5,0.5) (0,0)`.
2016-04-12 16:36:56 +02:00
geekosaur
c08d48f6aa Merge pull request #31 from geekosaur/master
add X.U.Ungrab
2016-04-07 14:22:47 -04:00
geekosaur
81dd1cba1d Merge pull request #48 from f1u77y/fix-ifmax-3
Final(I hope) attempt to fix X.L.IfMax
2016-04-06 23:04:25 -04:00
brandon s allbery kf8nh
abe911a8d6 Merge remote-tracking branch 'upstream/master' 2016-04-06 21:24:21 -04:00
seanstrom
1452c9e273 add new multiPPFormat function 2016-04-03 16:04:49 -07:00
Bogdan Sinitsyn
44abb6c8d4 handle ReleaseResources correctly 2016-03-26 16:28:23 +03:00
Bogdan Sinitsyn
43fccf1a6c use workspace name for running layouts 2016-03-26 16:28:23 +03:00
Bogdan Sinitsyn
f429843b66 remove reundant ReleaseResources handling 2016-03-26 16:28:23 +03:00
Bogdan Sinitsyn
dd5a36cc08 hide layout when changing to another 2016-03-26 16:28:23 +03:00
Brent Yorgey
01ea659a06 Merge pull request #21 from f1u77y/#16
fix #16
2016-03-15 22:02:39 -05:00
geekosaur
f1d3118417 Merge pull request #45 from f1u77y/fix-ifmax-2
watch only for tiled windows in X.L.IfMax
2016-03-10 19:53:25 -05:00
Bogdan Sinitsyn
ceb2df8931 watch only for tiled windows in X.L.IfMax 2016-02-29 14:12:36 +03:00
Adam Vogt
99cc0b6c85 Merge pull request #42 from f1u77y/fix-ifmax
handle messages in X.L.IfMax
2016-02-28 19:23:16 -05:00
Adam Vogt
9c95c81a90 Merge pull request #22 from f1u77y/#14
close #14
2016-02-28 19:20:20 -05:00
Adam Vogt
15c645d9f2 use traverse_ instead of traverse in DynamicBars 2016-02-26 19:08:57 -05:00
Bogdan Sinitsyn
94a7e97ac8 handle messages in X.L.IfMax 2016-02-23 16:06:21 +03:00
Brent Yorgey
c736d52268 Merge pull request #41 from jmickelin/wmii-togglegroupfull-fix
Fixed bottom-yielding definition of toggleGroupFull
2016-02-23 06:30:09 -06:00
Jonne Mickelin Sätherblom
c27ef4d418 Fixed bottom-yielding definition of toggleGroupFull 2016-02-19 19:51:31 +01:00
Brent Yorgey
571193a219 Merge pull request #34 from bb-h8/master
Added missing boundary check in Layout.Spacing.shrinkRect
2016-02-14 16:42:03 -06:00
f1u77y
bbbdad8faa prevent losing focus in gridSelect(fix #16) 2016-02-14 20:15:26 +03:00
geekosaur
311d3a0582 Merge pull request #38 from kurnevsky/docmentation_fix
Documentation fix.
2016-02-14 11:10:53 -05:00
geekosaur
b14db06f65 Merge pull request #39 from f1u77y/fix-prompt-numlock
strip numlock from mask in X.Prompt(fixes #37)
2016-02-14 11:10:04 -05:00
Bogdan Sinitsyn
30f657a437 strip numlock from mask in X.Prompt(fixes #37) 2016-02-14 14:54:26 +03:00
Kurnevsky Evgeny
a6f286dbdc Documentation fix. 2016-02-14 12:59:29 +03:00
brandon s allbery kf8nh
3796569268 whoops, CHANGES.md 2016-02-13 21:29:06 -05:00
geekosaur
d5eb7316d1 Merge pull request #30 from f1u77y/fix-docks
fix xmonad/xmonad#21
2016-02-13 21:23:50 -05:00
bb-h8
baf1dd9251 Added missing boundary check in Layout.Spacing.shrinkRect 2016-01-26 21:27:49 +01:00
Bogdan Sinitsyn
5e96324d80 send all docks messages only from event hook 2016-01-18 12:02:40 +03:00
Bogdan Sinitsyn
5df7ba160e some minor fixes in X.H.ManageDocks 2016-01-18 10:37:04 +03:00
Bogdan Sinitsyn
431fd66527 fix slowdown when removing docks 2016-01-17 18:15:41 +03:00
Bogdan Sinitsyn
f79e3fadea handle docks remove correctly 2016-01-17 16:32:56 +03:00
Bogdan Sinitsyn
28e9f8bce7 add docksStartupHook for handling docks when restarted 2016-01-17 11:55:59 +03:00
Bogdan Sinitsyn
f73eb1c938 handle PropertyNotify events on docks 2016-01-17 11:46:53 +03:00
Bogdan Sinitsyn
83ee18ad94 add new dock if it hasn't strut properties 2016-01-17 10:53:55 +03:00
Bogdan Sinitsyn
f4d4bde026 typo 2016-01-17 10:38:51 +03:00
Bogdan Sinitsyn
f1b9a0c193 add calcGapForAll for other modules 2016-01-17 10:35:26 +03:00
Bogdan Sinitsyn
34beb76562 fix X.H.PositionStoreHooks for new signature of calcGaps 2016-01-17 10:14:51 +03:00
Bogdan Sinitsyn
028ad6d6ec minor fixes in X.H.ManageDocks 2016-01-17 10:08:20 +03:00
Bogdan Sinitsyn
a5e87e3894 never query all the tree in X.H.ManageHook 2016-01-17 10:03:07 +03:00
brandon s allbery kf8nh
2855ed3d70 add X.U.Ungrab 2016-01-16 00:37:19 -05:00
Bogdan Sinitsyn
68cfa84b91 fix build with older ghc 2016-01-15 21:21:47 +03:00
Peter J. Jones
b20e7fa1e4 Merge pull request #29 from f1u77y/prompt-position
Prompt position
2016-01-10 16:06:29 -07:00
Bogdan Sinitsyn
58c3062910 typo 2016-01-10 23:52:13 +03:00
Bogdan Sinitsyn
889cd97d08 add myself to .mailmap and edit changelog 2016-01-10 23:51:00 +03:00
Bogdan Sinitsyn
4a9e28ca8b Merge branch 'master' of https://github.com/xmonad/xmonad-contrib into prompt-position 2016-01-10 23:43:11 +03:00
Peter J. Jones
604a262f38 Merge pull request #23 from psibi/prompt-multiple-key
Add multiple key support for completion key
2016-01-10 12:01:06 -07:00
Sibi Prabakaran
0510da7659 Add changelog for the patch. 2016-01-10 23:17:00 +05:30
Sibi Prabakaran
93b2620ad3 Add myself in mailmap 2016-01-10 23:17:00 +05:30
Sibi Prabakaran
727e214195 Add multiple key support for completion key
This patch enables support for key binding like Ctrl + i which was not
previously possible. Technically, this changes the type of completionKey
from KeySym to (KeyMask, KeySym).
2016-01-10 23:17:00 +05:30
Bogdan Sinitsyn
9a7a63bfb4 improve documentation for X.Prompt 2016-01-08 20:58:56 +03:00
Bogdan Sinitsyn
a61ce8dd74 improve documentation for X.Prompt 2016-01-08 20:29:45 +03:00
Bogdan Sinitsyn
d638dc8b0a fix xmonad/xmonad#21 2016-01-03 12:41:15 +03:00
Bogdan Sinitsyn
bce9c551ef fix CenteredAt in X.Prompt 2016-01-01 00:22:45 +03:00
Bogdan Sinitsyn
26309d1622 improve CenteredAt in X.Prompt 2015-12-31 23:51:03 +03:00
Bogdan Sinitsyn
d81b4e5bcb add documentation for XPPosition in X.Prompt 2015-12-31 23:36:07 +03:00
Bogdan Sinitsyn
6043914841 fix border between prompt and completions in X.Prompt 2015-12-31 16:03:00 +03:00
Bogdan Sinitsyn
ed7be9a791 fix border between prompt and completion window in X.Prompt 2015-12-31 15:57:36 +03:00
Bogdan Sinitsyn
becb724f95 fix prompt width 2015-12-28 19:37:52 +03:00
Bogdan Sinitsyn
0447c76d48 change documentation 2015-12-28 15:19:02 +03:00
Bogdan Sinitsyn
e47794148c fix border drawing 2015-12-28 15:14:35 +03:00
Bogdan Sinitsyn
edd6b8be55 add customization for prompt position 2015-12-28 14:49:36 +03:00
Bogdan Sinitsyn
ddcf5abcbf fix swapNth' 2015-12-23 09:28:18 +03:00
Bogdan Sinitsyn
e19460677a fix swapNth' 2015-12-23 09:16:01 +03:00
Adam Vogt
b23f56d65d clean up `git shortlog' output 2015-12-22 16:42:06 -05:00
Brent Yorgey
c3b05ceb7f travis: comment out cabal check for now
It complains about the -Werror enabled by the 'testing' flag,
even though the testing flag is set to manual: True, default: False
2015-12-22 07:51:37 -06:00
Brent Yorgey
9f68077c6c .cabal: remove outdated flag
xmonad no longer supports GHC 6.10, and the -O0 was causing
cabal to generate a warning.
2015-12-22 07:39:06 -06:00
Brent Yorgey
723494f01e travis: build xmonad from HEAD 2015-12-22 07:35:05 -06:00
Brent Yorgey
ae6b8db29b Update lower bounds for containers and base
Closes #28.
2015-12-22 07:31:36 -06:00
Brent Yorgey
1ce26e8cd2 .cabal: make testing flag manual 2015-12-21 13:15:00 -06:00
Brent Yorgey
cc7ddcfa60 Merge pull request #25 from iblech/patch-1
Fix tiny markup typo
2015-12-18 14:11:11 -06:00
Brent Yorgey
02ddfebf05 Merge pull request #26 from pjones/release-0.12
Release 0.12
2015-12-18 11:22:32 -06:00
Daniel Wagner
800ae670e2 use a record pattern to be robust against additions to the X11 library 2015-12-15 07:44:36 -08:00
Peter Jones
093352f6c5 Finial tweaks before release 2015-12-14 13:30:55 -07:00
Ingo Blechschmidt
fa3e774a65 Fix tiny markup typo 2015-12-14 16:24:16 +01:00
Peter Jones
126ce6f3c9 Update development references (darcs, code.google.com, etc.)
* All references to darcs have been updated to git

  * Most Google Code references have been changed to GitHub

  * References to specific issues at code.google.com have been left
    alone

  * Updated the GenerateManpage.hs to work with the latest version of
    pandoc
2015-12-11 11:17:26 -07:00
Peter Jones
c98f2b16db Add change log entries for recent merges 2015-12-11 10:31:58 -07:00
Peter Jones
0d6c2b1668 Use a table format that works with Pandoc and GitHub 2015-12-11 09:49:52 -07:00
Peter Jones
5739da65b3 Added more detail to the change log
* Brought in changes from https://wiki.haskell.org/Xmonad/Notable_changes_since_0.11

  * List all new modules along with their description
2015-12-11 09:49:52 -07:00
Peter Jones
4d3f633c73 Reformat README.md, add CHANGES.md, update xmonad-contrib.cabal 2015-12-11 09:49:52 -07:00
Peter Jones
6177841488 Rename the REAME file for GitHub/Hackage 2015-12-11 09:49:52 -07:00
f1u77y
d81c48d022 fix #14 2015-12-11 16:42:14 +03:00
Brent Yorgey
b9b4f4af07 Merge pull request #19 from kurnevsky/move_history_bugfix
Bugfix for moveHistory when alwaysHighlight is enabled.
2015-12-10 21:35:15 -06:00
Brent Yorgey
8e532562e7 X.P.Shell: fix shadowing warning 2015-12-10 21:08:38 -06:00
Brent Yorgey
e521d6546f X.A.Search: fix missing type sig warning 2015-12-10 21:07:24 -06:00
Brent Yorgey
dfeed762d4 Merge pull request #11 from pjones/projects
New module: XMonad.Actions.DynamicProjects
2015-12-10 20:55:42 -06:00
David Unric
0d4439b7a7 stop ignoring Prompt.Shell searchPredicate
Closes #9.

See also https://code.google.com/p/xmonad/issues/detail?id=393 .
2015-12-10 20:50:38 -06:00
Kurnevsky Evgeny
09f3c3fbea Bugfix for moveHistory when alwaysHighlight is enabled. 2015-12-09 17:50:15 +03:00
Brent Yorgey
6ae90737de Merge pull request #10 from pjones/dirfix
NixOS does not have /bin/bash
2015-12-08 21:25:41 -06:00
Brent Yorgey
1c61f3cf05 Merge pull request #5 from kurnevsky/master
Add layout hook for ScreenCorners.
2015-12-08 21:24:02 -06:00
Kurnevsky Evgeny
dfb1c52c66 Add layout hook for ScreenCorners. 2015-12-08 08:39:55 +03:00
Peter Jones
f35083da9f Don't auto-delete workspaces
* Previously I was removing empty workspaces after switching away from
    them, but this seemed to cause a bug when workspaces were defined
    statically in your XMonad configuration.

  * Next up: a function to delete an existing project.
2015-12-02 20:07:57 -07:00
Brent Yorgey
dc5fbfecc4 Merge pull request #12 from psibi/add-search-engine
Add Stackage and Vocabulary as new search engines.
2015-12-02 16:56:24 -06:00
Brent Yorgey
8cc31b5c76 Merge pull request #15 from nikolas/patch-1
Fix typo in Monitor layout description
2015-12-02 15:49:18 -06:00
Peter Jones
ea8e0ea7b6 Add renameProjectPrompt, fix directory prompting completion 2015-12-01 12:08:52 -07:00
Nik Nyby
62dac9ccd2 Fix typo in Monitor layout description 2015-11-30 20:10:17 -05:00
Peter Jones
60922e0cae Remove unnecessary call to XS.modify 2015-11-30 12:54:06 -07:00
Sibi Prabakaran
9eb55c76ea Add Stackage and Vocabulary as new search engines. 2015-11-22 15:10:14 +05:30
Peter Jones
08c88abfb2 Fix a small space leak in DynamicProjects
Add a couple of strictness annotations to keep ExtensibleState from
building up thunks.
2015-11-18 13:53:31 -07:00
Peter Jones
b1360f08d0 Fix warnings from hlint 2015-11-16 13:12:49 -07:00
Peter Jones
3b9c6d6ff2 New module: XMonad.Actions.DynamicProjects 2015-11-16 11:51:31 -07:00
Peter Jones
6f0a9785d6 NixOS does not have /bin/bash 2015-11-16 10:10:34 -07:00
Brent Yorgey
dbfd81b3f9 add generated .travis.yml 2015-11-06 14:51:52 -06:00
Brent Yorgey
e6350c91b8 .cabal: update tested-with field 2015-11-06 14:51:15 -06:00
geekosaur
32f3fbdb2f Merge pull request #2 from vrs/master
X.H.DynamicLog: make xmobarStrip actually strip xmobar tags
2015-09-11 17:03:05 -04:00
geekosaur
62e40287a6 Merge pull request #1 from 0/dynamic-bars
Use existing connection in X.H.DynamicBars
2015-09-11 17:01:22 -04:00
vrs
0a7ae19f90 X.H.DynamicLog: make xmobarStrip actually strip xmobar tags
consider the old implementation:
> xmobarStrip "<<fc=#f00>fc=#f00>foo</</fc>fc>"
"<fc=#f00>foo</fc>"
2015-09-07 22:59:38 +02:00
Dmitri Iouchtchenko
42a69bfa98 Use existing connection in X.H.DynamicBars
Adapted from patch attributed to geekosaur
(https://code.google.com/p/xmonad/issues/detail?id=538).
2015-08-24 01:56:46 -04:00
brandon s allbery kf8nh
05f3eb17f5 Add .gitignore
Shamelessly ganked from cabal.
2015-08-22 14:01:56 -04:00
Tuncer Ayaz
d26da8e63a Fix 7.10.2 compile 2015-06-17 19:09:33 +00:00
Brent Yorgey
c1db249147 X.A.WorkspaceNames: convert tabs to spaces, cleanup 2015-06-03 14:20:27 +00:00
Antoine Eiche
bbf36809e9 XMonad.Actions.WorkspaceName.workspaceNamePrompt is XMonad.Prompt.Workspace.workspacePrompt acting on the workspace name. 2015-06-01 09:32:53 +00:00
anton.pirogov at gmail . com
c4b3895af6 BinarySpacePartition: make all actions work on nodes, add MoveNode feature 2015-05-07 09:08:42 +00: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
ezyang
f7f87c03cb Add XMonad.Layout.PerScreen 2015-05-02 04:53:53 +00:00
Adam Vogt
0d061462c7 make X.A.Plane example config actually compile 2015-04-24 01:22:09 +00:00
Adam Vogt
08beff45b9 address warnings 2015-04-14 19:48:38 +00:00
allbery.b
d3ffb1661a dynamicproperty
Run a ManageHook from handleEventHook when a window property changes.
You would use this to match e.g. browser windows whose title is not
"final" until after the on-load hooks of the loaded document complete.
2015-04-14 15:36:57 +00:00
Daniel Wagner
33c0e81a4a minor doc fixes to X.C.Mate 2015-03-30 18:07:52 +00:00
allbery.b
b5b8558acc mate-comment-fixup
Correct the docstrings / comments in X.C.Mate, which still referenced
gnomeConfig. Also update the session manager configuration to use
dconf and a current (on Mint at least) path for the session config.
2015-03-30 16:05:23 +00:00
Peter Jones
c2f00b8e61 Add the ability to specify padding used with Maximize 2015-03-09 23:29:39 +00:00
Peter Jones
a0cd3f92e5 Don't restore windows when changing workspaces 2015-03-10 20:17:09 +00:00
Peter Jones
e2e63440ee New layout modifier: Hidden
A layout modifer that is meant to work with the BinarySpacePartition
layout.  By removing windows from the window set and adding them back
at a later time, you can move windows to a different branch of the BSP
tree.
2015-03-09 22:30:36 +00:00
anton.pirogov
cf5739a484 Fixes to warnings with BSP layout 2015-03-15 10:00:41 +00:00
anton.pirogov
37f47d0bcb Improved BinarySpacePartition, added Equalize,Balance and FocusParent and mouse resize support 2015-03-12 14:52:20 +00:00
nzeh
00187576db New layout module X.L.Dwindle
This adds three layouts:  Spiral is a reimplementation of X.L.Spiral.spiral
with a (to me) more intuitive splitting policy.  Dwindle is similar but pushes
the smaller windows into a corner rather than into the center.  Squeeze just
stacks windows vertically or horizontally using geometrically decreasing sizes.
2015-03-15 13:09:13 +00:00
Adam Vogt
466f184c65 address warnings in P.Pass 2015-03-13 01:56:36 +00:00
ankaan
c8c5d28a9c X.L.AvoidFloats more useful default settings
Changed default settings with the simple layout modifier. Instead of asking for a bool indicating if all windows should be avoided, no such bool is asked for. No windows are avoided by default. I think this will be a more useful default setting since it would be annoying if dialogue windows are avoided. The same functionality is possible with the advanced constructor. This will be easier for new users.

This will break configurations using the old module, but this will not be much of an issue since the module has not been added to the repo as of this writing.
2015-03-10 21:20:22 +00:00
ankaan
3405d561b8 Resolve minor conflict in xmonad-contrib.cabal 2015-03-06 17:54:36 +00:00
ankaan
b2531a6f48 X.L.AvoidFloats, like avoidStruts but for floats
Checks for floating windows within the layout area and finds a maximum area
rectangle within that does not overlap with any of the floating windows.
This rectangle is used for all non-floating windows.

This new functionality introduced problems with the recommended configuration
of one of my other modules (X.A.FloatSnap.) A new and more reliable method of
distinguishing between clicks and drags where therefore introduced in the new
module X.A.AfterDrag.

This does not break any prior use of FloatSnap, but will require changes in
configuration if used together with AvoidFloats. (This is mentioned in the
docs for AvoidFloats and I recommend using the new configuration method even if
AvoidFloats is not in use.)
2015-03-06 17:17:02 +00:00
ankaan
16db912751 X.L.LayoutBuilder place active on top
Make sure that the active layout area is placed on top of all other areas when placing windows. This makes overlapping areas usable.
2015-03-06 16:42:00 +00:00
Dmitri Iouchtchenko
2f5e49919d Add rearrangers to X.A.GridSelect 2013-01-23 04:40:38 +00:00
Dmitri Iouchtchenko
2e1474f230 Avoid repainting elements in X.A.GridSelect 2013-01-23 04:38:50 +00:00
Dmitri Iouchtchenko
e98f0657bb Give a name to the initial state in X.A.GridSelect 2013-01-21 06:13:24 +00:00
Adam Vogt
45e4bd4ff6 Add XMonad.Config.Bepo (Yorick Laupa) 2015-03-10 21:43:14 +00:00
Adam Vogt
8ba4e0bed2 add instance Default WallpaperConf 2015-03-10 21:42:46 +00:00
Joachim Breitner
88fd1dd4fb XMonad.Prompt.Pass: Handle hierachical password stores
pass stores its passwords in directories, so the contents of the directory
store needs to be enumerated recursively. Alexander Sulfrian provided this
patch on the mailinglist, which I tested (it works) and cleaned up slightly.
2015-02-18 09:18:16 +00:00
Adam Vogt
9bb1f3b91e remove warnings and text dependency from H.WallpaperSetter 2015-03-10 19:29:33 +00:00
anton.pirogov
dcbff492fe Added the new hook WallpaperSetter 2015-02-28 16:23:35 +00:00
Adam Vogt
d82bfc6baf adjust an import to fix the build 2015-03-10 18:24:03 +00:00
Adam Vogt
e4fde08a0a merge conflicts in X.L.Spacing
I should have just applied Anton Pirogov March 4 patch.
2015-03-10 18:20:46 +00:00
anton.pirogov
0857f71938 Added messages to adjust the gap dynamically 2015-03-04 08:25:20 +00:00
Adam Vogt
80348bb4b7 X.L.Spacing needs -XPatternGuards now 2015-03-10 18:12:48 +00:00
Adam Vogt
c1abaa0183 add ConfirmPrompt (Antoine Beaupré) 2015-03-10 18:10:36 +00:00
anton.pirogov
20e69af48b Added messages to adjust the gap dynamically 2015-03-03 21:01:43 +00:00
Adam Vogt
6cbddae8c2 add another extension to actually fix the build with ghc-7.10-RC1 2015-01-24 11:19:39 +00:00
benweitzman
19860e2fa0 BinarySpacePartition downstream changes
Pulled in changes from my repo for this layout on github (https://github.com/benweitzman/BinarySpacePartition)
Includes a new mode for resizing windows in a more intuitive way, also contains a bug fix that was preventing users from
resiving a window up.

Includes changes from github users egasimus (Adam Avramov) and SolitaryCipher (Nick)
2014-11-10 20:22:59 +00:00
Adam Vogt
c115650d0d add XF86AudioMicMute to EZConfig (#582) 2014-12-22 04:53:06 +00:00
nrujac
5816a473dd Generalize new workspace addition functions to support arbitrary insertion.
The current DynamicWorkspaces module only supports adding new workspaces
at the start of the list of workspaces. This means when binding workspaces
to keys based on the position in the list, key bindings can change 
as workspaces are added in removed in a far more destructive way than
necessary. Instead, supporting appending and arbitrary insertion allows
the user to determine where the new workspace should be added.

This patch is a straight generalization of the addHiddenWorkspace' function.
Rather than always using `(:)` to insert the new workspace into the list
of workspaces, this patches causes it to use an arbitrary list insertion
function instead. A few new functions are added to prevent breakage of
external code while exported functions are left unchanged.

List of new functions:
  appendWorkspace
  appendWorkspacePrompt
  addWorkspaceAt
  addHiddenWorkspaceAt

Existing functions were modified to call their generalized brethren where possible
without changing functionality. This patch should not change behavior for any
existing users of this module.
2014-12-19 00:23:09 +00:00
Adam Vogt
0903f339b6 address another bitSize/finiteBitSize warning 2014-12-22 03:33:00 +00:00
Anton Vorontsov
201c25e7a4 X.L.Master: Add FixMaster layout modifier
This layout modifier is useful for the case if you desire to add a master
pane that has fixed width (it's fixed even if there is just one window
opened). Especially nice feature if you don't want to have too wide
terminal in a master pane.

The layout is implemented as an addition to Master layout, so it reuses
most of the code.
2014-12-20 01:13:39 +00:00
Adam Vogt
3b6d0c2458 filepath dependency for P.Pass was left out 2014-12-21 21:41:29 +00:00
Adam Vogt
7dac12829d remove unused imports 2014-08-15 05:12:34 +00:00
Adam Vogt
6d33617e1c fix build with ghc-6.12 2014-08-15 05:12:14 +00:00
Adam Vogt
8a195a2a48 use FiniteBitSize with ghc >= 7.8 2014-08-15 05:11:36 +00:00
Felix Crux
6c410a8a00 Layout.Spacing: Outer window edges now get as much spacing as inner ones
Layout.Spacing applies a customizable amount of space around the outside of each
window. At window edges where two windows meet, the total distance between them
is therefore twice the customized value (one space value from each window). At
the edge of the screen, however, the spacing is only applied once. This results
in uneven amounts of spacing and differently-sized gaps on the screen.

This patch extends the Spacing layout to include a further gap all around the
edge of the screen, thus making all spaces around windows equal in size.
2014-12-19 22:36:46 +00:00
Adam Vogt
95365822da add filepath package dependency needed by Prompt.Pass
filepath comes with ghc, and it's used by xmonad-core anyways
2014-09-09 14:52:16 +00:00
Devin Mullins
d0039a2f8b X.C.Prime: doc tweaks 2014-10-02 07:59:39 +00:00
Devin Mullins
c648a3959b X.A.Navigation2D: add convenience functions for setting config & keybindings
1. Added 'additionalNav2DKeys' which adds keybindings for the cartesian product
   of direction keys and (modifier, action) pairs given.
2. Added 'navigation2D' which combines that with 'withNavigation2DConfig'.
3. Added 'additionalNav2DKeysP' and 'navigation2DP' which do the same, but use
   the 'additionalKeysP' syntax.
2014-10-02 07:57:57 +00:00
Devin Mullins
0f21017370 X.C.Prime: doc fixes 2014-10-01 07:58:55 +00:00
Devin Mullins
6c96f4d5c6 X.C.Prime: add 'withScreens' and friends
The screen equivalent of 'withWorkspaces' lets you more easily define keys that
move/swap between screens.

Also, rename wsKeyspecs to wsKeys, and make a couple of doc tweaks.
2014-10-01 07:52:50 +00:00
Anton Vorontsov
27f4d5dafe Implement proper handling of dynamically changing hostname
The module implements a proper way of finding out whether the window is
remote or local.

Just checking for a hostname and WM_CLIENT_MACHINE being equal is often
not enough because the hostname is a changing subject (without any
established notification mechanisms), and thus WM_CLIENT_MACHINE and the
hostname can diverge even for a local window.

This module solves the problem. As soon as there is a new window created,
we check the hostname and WM_CLIENT_MACHINE, and then we cache the result
into the XMONAD_REMOTE property.

Notice that XMonad itself does not know anything about hostnames, nor does
it have any dependency on Network.* modules. For this module it is not a
problem: you can provide a mean to get the hostname through your config
file (see usage). Or, if you don't like the hassle of handling dynamic
hostnames (suppose your hostname never changes), it is also fine: this
module will fallback to using environment variables.
2014-09-01 07:21:58 +00:00
Anton Vorontsov
b2a885fe5a Add Stoppable layout for power saving
This module implements a special kind of layout modifier, which when
applied to a layout, causes xmonad to stop all non-visible processes. In a
way, this is a sledge-hammer for applications that drain power. For
example, given a web browser on a stoppable workspace, once the workspace
is hidden the web browser will be stopped.

Note that the stopped application won't be able to communicate with X11
clipboard. For this, the module actually stops applications after a
certain delay, giving a chance for a user to complete copy-paste sequence.
By default, the delay equals to 15 seconds, it is configurable via
'Stoppable' constructor.

The stoppable modifier prepends a mark (by default equals to "Stoppable")
to the layout description (alternatively, you can choose your own mark and
use it with 'Stoppable' constructor). The stoppable layout (identified by
a mark) spans to multiple workspaces, letting you to create groups of
stoppable workspaces that only stop processes when none of the workspaces
are visible, and conversely, unfreezing all processes even if one of the
stoppable workspaces are visible.

To stop the process we use signals, which works for most cases. For
processes that tinker with signal handling (debuggers), another
(Linux-centric) approach may be used. See
https://www.kernel.org/doc/Documentation/cgroups/freezer-subsystem.txt
2014-09-01 07:21:41 +00:00
Devin Mullins
12ec2d0be4 X.C.Prime: doc changes 2014-09-25 20:30:37 +00:00
Devin Mullins
74c3f059b0 X.C.Prime: add withWorkspaces et al.
This allows easier configuration of workspaces and their keybindings. Required
generalizing the 'Prime' type, so lots of other lines changed in rather trivial
ways.
2014-09-25 20:30:34 +00:00
Devin Mullins
cbcd42dc83 X.C.Prime: add ifThenElse binding
This is necessary for if-then-else support in the user's config.
2014-09-24 19:15:09 +00:00
Devin Mullins
c5290be3c8 X.C.Prime: doc fixes 2014-09-15 08:06:01 +00:00
Devin Mullins
972ee2c19f X.C.Prime: fix 'def' hyperlink in doc 2014-09-14 07:53:52 +00:00
Devin Mullins
babbd208a6 XMonad.Config.Prime, a do-notation for config
Note that the use of RebindableSyntax is because of the need to vary the
layoutHook type throughout the config. The alternative, using the existential
Layout type, was rejected because it required TemplateHaskell in order to look
nice, and TemplateHaskell is not portable.

I've tried to make a version of (>>) that also worked on normal monads, but
have had no luck as of yet. Maybe some intrepid soul can add it later.
2014-09-14 06:48:28 +00:00
me
4ef0beab55 X.P.Shell: fix doc typo 2013-03-17 11:55:16 +00:00
nwfilardo
c073651cc2 reverse workspaces, so that switching to a dynamic workspace group restores the focus to the screen that was focused at group creation time 2014-09-13 17:41:18 +00:00
me
4efaa673fe add filepath dependency, needed by new X.P.Pass module 2014-09-13 07:09:26 +00:00
eniotna.t
9f453fdb58 add-new-xmonad-prompt-pass
This module provides 3 <XMonad.Prompt> to ease passwords manipulation (generate, read, remove):

- one to lookup passwords in the password-storage.

- one to generate a password for a given password label that the user inputs.

- one to delete a stored password for a given password label that the user inputs.

All those prompts benefit from the completion system provided by the module <XMonad.Prompt>.

The password store is setuped through an environment variable PASSWORD_STORE_DIR.
If this is set, use the content of the variable.
Otherwise, the password store is located on user's home @$HOME\/.password-store@.


Source:

- The password storage implementation is <http://git.zx2c4.com/password-store the password-store cli>.

- Inspired from <http://babushk.in/posts/combining-xmonad-and-pass.html>
2014-08-29 13:19:28 +00:00
Adam Vogt
6137b1e2ff use Data.Map instead of Data.Map.Strict to support containers < 0.5 2014-08-15 04:31:41 +00:00
allbery.b
7d4a083906 config-mate
Initial support for the Mate desktop environment (http://mate-desktop.org).
Based on existing Gnome 2 support, since Mate is a maintained fork of
Gnome 2.
2014-08-03 02:06:59 +00:00
allbery.b
56c6b9fef5 debug-managehook
A set of hooks, and convenience combinators, to help with ManageHook debugging.
Ordinary users may well want to use debugManageHookOn in normal configs,
specifying a key sequence which can be pressed before running a command in
order to capture debug information just for that command's main window.

This is especially useful when trying to diagnose issues such as programs
that do not play well with SpawnOn, or ManageHook matching on 'title' when
the program does not set the window title until after it is mapped.
2014-08-03 02:06:01 +00:00
allbery.b
ec0fb3ba8a debug-debug
Various fixes and enhancements to DebugWindow and DebugStack. ManageDebug
requires these fixes, but some of them are significant even if not using
ManageDebug.
2014-08-03 02:05:30 +00:00
Adam Vogt
11265ad69b derive Applicative instances to suppress AMP warning 2014-07-10 16:39:50 +00:00
Adam Vogt
8ff856a761 clean up cabal file and drop support for base < 3 2014-07-10 01:32:55 +00:00
eniotna.t
1173c6c54f add-duck-duck-go-search-engine 2014-06-17 17:42:46 +00:00
gwern
eca9d7318e XSelection: getSelection: fix connection exhaustion bug (issue #573); include warning 2014-06-01 02:50:19 +00:00
md143rbh7f
72a537cf46 Fix dbus-send call in XMonad.Config.Gnome
dbus-send --print-reply=string is invalid, but it was silently ignored until recently:
http://cgit.freedesktop.org/dbus/dbus/commit/tools/dbus-send.c?id=c690ee4351f99ed5e629ffcf5f4a2edcd418d103
I've changed XMonad.Config.Gnome to run --print-reply=literal, since that's what the old behavior was.
2014-01-29 03:21:14 +00:00
Adam Vogt
2f44f16fac warning police (unused variables) 2014-05-05 00:12:42 +00:00
linxray
2b7add99aa This patch makes the Ssh extension works with **user** arguments in ssh, .e.g ssh admin@localhost. 2014-05-04 09:11:20 +00:00
Adam Vogt
c9b63a8f40 remove trailing whitespace in L.BinarySpacePartition 2014-05-01 01:19:43 +00:00
Adam Vogt
fb7ca05a63 replace Bound with the equivalent Direction2D 2014-05-01 01:15:40 +00:00
Adam Vogt
fcf0545475 remove unused extension in BSP 2014-05-01 01:14:55 +00:00
benweitzman
ec56f2c47c Add BinarySpacePartition layout 2014-04-30 20:58:48 +00:00
Brent Yorgey
25b9a25925 X.Actions.DynamicWorkspaceGroups: export new function addRawWSGroup 2014-04-28 14:29:01 +00:00
Adam Vogt
6a2ad3f1ee Remove unneeded context with the IfMax layout instance
Extra constraints on instances are about as useful as -XDataTypeContexts
2014-04-22 22:11:05 +00:00
nrujac
e2ff50687e Adding side tabs and replacing TabbarLocation with Direction2D. 2014-02-19 20:08:11 +00:00
Daniel Wagner
fb3b9f59e4 warning police 2014-03-16 18:37:47 +00:00
Dmitry Bogatov
ca9961c1ca New module: XMonad.Util.WindowState
Save almost arbitary data per window
2014-02-18 10:02:29 +00:00
nrujac
0f6bed2ff7 Add side tabs to the tabbed layout. 2014-02-13 21:52:47 +00:00
cwills.dev
c1b8674aa0 SpawnNamedPipe hlint cleanup 2014-02-02 21:36:13 +00:00
cwills.dev
d88153d3be document and cleanup SpawnNamedPipe 2014-02-02 21:10:00 +00:00
cwills.dev
6b46603147 Added SpawnNamedPipe 2014-02-02 14:34:15 +00:00
md143rbh7f
9403542db0 Make commandToComplete in XMonad.Prompt.Shell complete last word
The following change from 2013-02-09 breaks shell completion for me:
    hunk ./XMonad/Prompt/Shell.hs 65
    +    commandToComplete _ c = c

It seems to be passing the entire string into compgen in order to get the file completions, but it should only pass the last word. I propose reverting this change. Comments are appreciated.
2014-01-30 20:00:50 +00:00
Daniel Wagner
35ed0601f4 expose and document X.L.IndependentScreens.marshallSort 2014-01-28 21:28:44 +00:00
Adam Vogt
df824edf5f ServerMode properly indent 2013-12-19 20:14:40 +00:00
Adam Vogt
78ed2e1a9e remove ServerMode tabs 2013-12-19 20:10:00 +00:00
Adam Vogt
f453a9a375 fix -Wall ServerMode 2013-12-19 18:10:30 +00:00
Adam Vogt
c6b91b546e documentation note that ServerMode is similar to wmctrl 2013-12-19 18:07:48 +00:00
polson2
7ccac6a9a0 Generalized XMonad.Hooks.ServerMode 2013-12-16 02:51:00 +00:00
Ilya Portnov
f10a18670a IfMax-Layout
This adds a new ("conditional") layout, IfMax, which simply runs one layout, if there are <= N windows, and else runs another layout.
2013-12-01 07:26:34 +00:00
Adam Vogt
ab3f5b3d5d fix UrgencyHook and add filterUrgencyHook 2013-09-24 22:47:38 +00:00
Adam Vogt
075b7d69ed export XMonad.Hooks.UrgencyHook.clearUrgency (issue 533) 2013-09-23 03:13:49 +00:00
Daniel Wagner
95372520bb minor documentation fix: manageDocks doesn't do anything with struts, so don't claim it does 2013-08-14 12:51:06 +00:00
Daniel Wagner
0906634f3a don't pretend to be LG3D in X.C.Dmwit because this confuses modern GTK 2013-08-13 21:16:36 +00:00
Liyang HU
fd23bd692b XMonad.Actions.UpdatePointer: generalise updatePointer 2013-07-30 07:10:07 +00:00
Liyang HU
2fe30c6730 XMonad.Actions.UpdatePointer: document TowardsCentre 2013-07-30 05:37:46 +00:00
Adam Vogt
8f712f0a04 Haddock formatting in H.Minimize 2013-07-23 15:56:58 +00:00
Adam Vogt
1a916d1c57 Bump version (and xmonad dependency) to 0.12
This makes a breakage due to missing patches in core a bit more obvious.
Previously you would have a build failure regarding some missing identifiers
(def re-exported by XMonad from Data.Default), while after applying this patch
it will be clear that xmonad-core needs to be updated.
2013-07-20 20:58:57 +00:00
Adam Vogt
7246defb90 Fix issue 551 by also getting manpath without -g flag.
Instead of taking Ondrej's approach of figuring out which man (man-db or
http://primates.ximian.com/~flucifredi/man/) is used by the system, just try
both sets of flags.
2013-07-16 03:05:36 +00:00
Adam Vogt
d3b2a01e3d Escape dzen markup and remove xmobar tags from window titles by default.
The issue was that window titles, such as those set by, for example a browser,
could set the window title to display something like

   <action=malicious shell command>normal title</action>

Which could be executed by xmobar (or dzen).

This adds a ppTitleSanitize which does the above functions. This way when users
override ppTitle, the benefits are not lost.

Thanks to Raúl Benencia and Joachim Breitner for bringing this to my attention.
2013-07-08 14:48:13 +00:00
gopsychonauts
129e98773e DynamicBars-use-ExtensibleState
Hooks.DynamicBars was previously using an MVar and the unsafePerformIO hack (
http://www.haskell.org/haskellwiki/Top_level_mutable_state ) to store bar
state. Since ExtensibleState exists to solve these sorts of problems, I've
switched the file over to use unsafePerformIO instead.

Some functions' types had to be changed to allow access to XState, but the
public API is unchanged.
2013-06-18 07:47:55 +00:00
Thomas Tuegel
7958f8905e Catch exceptions when finding commands on PATH in Prompt.Shell 2013-06-16 23:02:19 +00:00
Adam Vogt
646090a3d9 Fix haddock parse error in X.A.LinkWorkspaces 2013-05-28 13:34:48 +00:00
Daniel Wagner
0f1b6fb772 use Data.Default wherever possible, and deprecate the things it replaces 2013-05-28 01:39:09 +00:00
Daniel Wagner
daa2731d3d eliminate references to defaultConfig 2013-05-28 00:58:25 +00:00
Daniel Wagner
0287b2861c minimal change needed to get xmonad-contrib to build with xmonad's data-default patch 2013-05-28 00:10:40 +00:00
Francesco Ariis
e8259ebd43 Remove unneeded XSync call in Layout.ShowWName 2013-05-17 15:33:41 +00:00
Adam Vogt
12b91b9630 Remove misleading comment: we definitely don't support ghc-6.6 anymore 2013-05-14 21:58:51 +00:00
Adam Vogt
546b582a3d Fix module name in comment of X.L.Fullscreen 2013-05-14 21:57:27 +00:00
Adam Vogt
91a5d13005 Minor update to cabal file (adding modules & maintainership) 2013-05-14 21:56:32 +00:00
Adam Vogt
31ec8cc26a Remove trailing whitespace in X.A.LinkWorkspaces 2013-05-14 21:54:21 +00:00
quesel
0fcb4ae238 Update documentation of LinkWorkspaces Module 2011-03-28 07:28:13 +00:00
quesel
3722f48da9 Added a module for linking workspaces
This module provides a way to link certain workspaces in a multihead setup.
That way, when switching to the first one the other heads display the linked
workspaces.
2011-02-10 16:50:18 +00:00
Adam Vogt
00be056a1b Cache results from calcGap in ManageDocks
http://www.haskell.org/pipermail/xmonad/2013-April/013670.html
2013-04-25 15:58:11 +00:00
Adam Vogt
eae925fc29 Remove unnecessary contexts from L.MultiToggle 2013-02-17 16:33:56 +00:00
gopsychonauts
faa61bbbab Generalises modWorkspace to take any layout-transforming function
modWorkspace already was capable of modifying the layout with an arbitrary
layout -> layout function, but its original type restricted it such that it
could only apply a single LayoutModifier; this was often inconvenient, as for
example it was not possible simply to compose LayoutModifiers for use with
modWorkspace.

This patch also reimplements onWorkspaces in terms of modWorkspaces, since with
the latter's less restrictive type this is now possible.
2013-05-01 15:14:25 +00:00
Daniel Wagner
ac8aefbc92 since XMonad.Config.Dmwit mentions xmobar, we should include the associated .xmobarrc file 2013-05-03 19:40:55 +00:00
Daniel Wagner
469ff726a4 warning police 2013-05-02 01:27:00 +00:00
Daniel Wagner
e11d97137e XMonad.Config.Dmwit 2013-05-02 01:21:32 +00:00
Daniel Wagner
a56a135313 minor fixes to the haddock markup in X.L.IndependentScreens 2013-04-11 19:38:49 +00:00
Daniel Wagner
faf0997881 add whenCurrentOn to X.L.IndependentScreens 2013-04-08 22:52:51 +00:00
Paul Fertser
7dda5f976f Allow to specify the initial gaps' states in X.L.Gaps 2013-02-22 07:22:32 +00:00
Daniel Wagner
493db20cf0 should bump X11 dependency, too, to make sure we have getAtomName 2013-02-25 18:05:27 +00:00
Daniel Wagner
5c04a573db getAtomName is now defined in the X11 library 2013-02-25 18:03:23 +00:00
Paul Fertser
8bfe148416 Allow to limit maximum row count in X.Prompt completion window
On a keyboard-less device (such as a smartphone), where one has to use
an on-screen keyboard, the maximum completion window height must be
limited to avoid overlapping the keyboard.
2013-02-21 12:20:50 +00:00
Adam Vogt
945714f250 Note in U.NameActions that xmonad core can list default keys now 2013-02-17 23:30:26 +00:00
Adam Vogt
10ee484a59 Export U.NamedActions.addDescrKeys per evaryont's request. 2013-02-17 23:26:19 +00:00
Maarten de Vries
7e9c986217 Add EWMH DEMANDS_ATTENTION support to UrgencyHook.
Add support for the _NET_WM_STATE_DEMANDS_ATTENTION atom
by treating it the same way as the WM_HINTS urgency flag.
2013-02-12 18:12:29 +00:00
Adam Vogt
0aeef31c5d Unconditionally set _NET_WORKAREA in ManageDocks 2013-01-17 18:08:51 +00:00
c.lopez
34800741e5 spawn command when no completion is available (if alwaysHighlight is True); changes commandToComplete in Prompt/Shell to complete the whole word instead of using getLastWord 2013-02-09 19:04:56 +00:00
matthewhague
a45d8d38a6 order-unindexed-ws-last
Changes the WorkspaceCompare module's comparison by index to put workspaces without an index last (rather than first).
2012-07-03 22:27:26 +00:00
Adam Vogt
c0b0d52678 SpawnOn modification for issue 523
This moves the function to help clean up the `Spawner' to the ManageHook
rather than in functions like spawnOn. Probably it makes no difference, the
reason is because there's one manageSpawn function but many different so this
way there are less functions to write.
2013-01-14 01:46:42 +00:00
Adam Vogt
a33f355232 Update L.TrackFloating.useTransient example code
Suggest useTransient goes to the right of trackFloating which is the
configuration actually tested.
2013-01-12 04:12:39 +00:00
Adam Vogt
ced8f5e0f0 Adapt ideas of issue 306 patch to a new modifier in L.TrackFloating 2013-01-12 03:57:01 +00:00
Dmitri Iouchtchenko
498a50d109 Make X.A.CycleWS not rely on hidden WS order 2013-01-09 02:33:28 +00:00
Dmitri Iouchtchenko
5d93450b5e Add X.H.WorkspaceHistory 2013-01-09 02:33:07 +00:00
Dmitri Iouchtchenko
9b6ed4c505 Allow removing arbitrary workspaces 2012-12-31 21:43:43 +00:00
Dmitri Iouchtchenko
d83442b8eb Remove first-hidden restriction from X.A.DynamicWorkspaces.removeWorkspace' 2012-12-31 21:41:48 +00:00
Adam Vogt
78d44079c2 Add authorspellings file for `darcs show authors'.
This authorspellings file includes a couple people who've contributed to xmonad
(not XMonadContrib). When people have multiple addresses, the most recent one
has been picked.
2013-01-01 04:00:31 +00:00
Adam Vogt
6072d9c599 bump cabal-version to satsify hackage 2013-01-01 01:41:59 +00:00
Adam Vogt
277412af44 bump version to 0.11 2012-12-31 10:42:52 +00:00
Adam Vogt
0030802e46 Add more metadata to cabal file 2012-12-31 18:45:13 +00:00
Adam Vogt
f211874340 X.A.Workscreen make the whole module description show up for haddock 2012-12-31 02:46:00 +00:00
Adam Vogt
32548e056f Note that an alternative to XMonad.Actions.ShowText is X.U.Dzen 2012-12-31 02:30:42 +00:00
Dmitri Iouchtchenko
2c6f1c22b2 Add X.A.DynamicWorkspaces.renameWorkspaceByName. 2012-12-27 06:35:31 +00:00
Adam Vogt
b8a22c4dee Change type of X.A.ShowText.handleTimerEvent so example code typechecks. 2012-12-26 01:38:41 +00:00
Adam Vogt
42443e3df2 Describe arguments for X.A.ShowText.flashText 2012-12-26 01:37:25 +00:00
pastorelli.mario
9e0eb7f770 Add XMonad.Actions.ShowText 2012-12-25 20:26:35 +00:00
Adam Vogt
895c47fb4e Record polachok's fix for issue 507 2012-12-16 18:27:24 +00:00
c.lopez
cc98355700 Removes unused function spawnWithActions and redundant imports in XMonad.Actions.Launcher 2012-12-15 22:37:14 +00:00
Adam Vogt
205e7133ac A.Launcher markup identifiers for haddock links 2012-12-15 16:59:14 +00:00
Adam Vogt
9caedf2fff Address warnings from Debug modules
The warnings were related to ghc-7.6 removing Prelude.catch
(triggering warnings regarding the import hiding it), as well
as defaulting of some numeric types.
2012-12-15 16:55:25 +00:00
c.lopez
265df96ab8 Removes LocateMode and LocateRegexMode from XMonad.Actions.Launcher 2012-12-14 21:12:30 +00:00
allbery.b
8d1ad8b280 debug-hooks
Hooks to print diagnostic information to stderr (usually .xsession-errors)
to help debug complex issues involving the StackSet and received events.
2012-08-13 22:38:21 +00:00
Adam Vogt
de84dfef0d Remove trailing whitespace. 2012-11-09 01:41:56 +00:00
Adam Vogt
3fa51ed656 Use Control.Exception.catch explitly to avoid warnings
The base that comes with ghc-7.6.1 no longer includes Prelude.catch;
so these modules were changed so that there is no warning for

import Prelude hiding (catch)

At the same time these changes should be compatible with older GHCs,
since the catch being has never been the one in the Prelude.
2012-11-09 01:35:06 +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
Adam Vogt
e776260133 Rename variable in L.Minimize to avoid shadowing.
This "state" is new with a newer mtl.
2012-11-09 00:34:10 +00:00
Adam Vogt
53c2e7833c Gut H.ICCCMFocus: issue 177 has been merged in core.
Keep the module for now: the LG3D bit might still be useful
and there's no need to break configs unnecessarily.
2012-11-08 22:57: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
daedalusinfinity
4da5da430e Added smart spacing to the spacing module
Added smart spacing to the spacing module, which adds spacing to all windows,
except to windows on singleton workspaces.
2012-09-23 03:45:27 +00:00
c.lopez
0af63a4767 Improves haddock documentation 2012-08-26 09:17:16 +00:00
c.lopez
7245766c6d Improve comments, add an error throw that shouldn't happen 2012-08-26 08:54:26 +00:00
c.lopez
cd6feb81e2 fix a bug when ncompletions = nrows 2012-08-26 08:31:37 +00:00
c.lopez
8f9fa05c0f Fixes typos in Actions.Launcher haddock documentation 2012-08-11 11:25:02 +00:00
c.lopez
b5f9a61dbe Correctly get the autocompletion item when alwaysHighlight in XMonad.Prompt is True 2012-08-11 10:48:05 +00:00
c.lopez
96ab91fcfa Removes warnings, adds a browser value for LauncherConfig in haddock comments 2012-06-28 11:45:33 +00:00
c.lopez
3c74148a2f Changes on XPrompt:
* Adds mkPromptWithModes, creates a prompt given a list of modes (list of XPType).

    * Adds Setting `alwaysHighlight` to defaultXPConfig. When set to true, autocompletion always highlight the first result if it is not highlighted.
    
Adds module XMonad.Actions.Launcher. This module allows to combine and switch between instances of XPrompt. It includes a default set of modes which require the programs `hoogle`, `locate` and `calc` to be installed to work properly.
2012-06-28 10:17:49 +00:00
Daniel Wagner
9d34e848d9 accept more windows as docks 2012-08-23 12:41:53 +00:00
longpoke
a7c2c023fb strip newlines from dmenu's returns to be compatible with the newest version of dmenu 2012-07-23 21:28:07 +00:00
kedals0
814fda056b A workscreen permits to display a set of workspaces on several
screens. In xinerama mode, when a workscreen is viewed, workspaces
associated to all screens are visible.

The first workspace of a workscreen is displayed on first screen,
second on second screen, etc. Workspace position can be easily
changed. If the current workscreen is called again, workspaces are
shifted.

This also permits to see all workspaces of a workscreen even if just
one screen is present, and to move windows from workspace to workscreen.
2012-07-06 09:33:08 +00:00
Daniel Wagner
2a6709ff5c refer to the new name 'handleEventHook' instead of the old name 'eventHook' in X.L.Fullscreen documentation 2012-06-18 18:10:03 +00:00
gopsychonauts
3ffc956b93 UrgencyHooks made available as Window -> X () functions
Adds an UrgencyHook instance for the type Window -> X (), allowing any such
functions to be used directly as UrgencyHooks. The Show and Read constraints
were removed from the UrgencyHook class in order to permit this; these
constraints were required only in a historical implementation of the module,
which used a layout modifier.

All existing configurations using UrgencyHooks should remain fully functional.
New configs may make use of this modification by declaring their UrgencyHook as
a simple Window -> X () function.
2012-05-04 06:23:39 +00:00
Brent Yorgey
e705eba1e0 updates to XMonad.Prompt re: word-oriented commands
+ change killWord and moveWord to have emacs-like behavior: first move
    past/kill consecutive whitespace, then move past/kill consecutive
    non-whitespace.

  + create variants killWord' and moveWord' which take a predicate
    specifying non-word characters.

  + create variants defaultXPKeymap' and emacsLikeXPKeymap' which take
    the same sort of predicate, which is applied to all keybindings with
    word-oriented commands.
2012-05-10 17:43:17 +00:00
Jesper Reenberg
2f2a217b85 Added isUnfocusedOnCurrentWS and fadeInactiveCurrentWSLogHook for better support of fading/opacity on multi monitor setups 2012-03-29 14:18:18 +00:00
Jesper Reenberg
6f996bb21f Fixed X.A.GridSelect to be consistent in the way it (now) sorts the shown
elements when modifying the searchString.

The implemented ordering sorts based on how "deep the needle is in the
haystack", meaning that searching for "st" in the elements "Install" and "Study"
will order them as "Study" and "Install". Previously there was no ordering and
when using GridSelect to select workspaces, the ordering was not consistent, as
the list of workspaces (if not modified manually) is ordered by last used. In
this case either "Study" or "Install" would come first depending on which
workspace was last visited.
2012-05-01 18:04:15 +00:00
Julia Jomantaite
3a740c4d5a Use getXMonadDir to get the default xmonad directory. 2012-05-01 12:14:27 +00:00
Adam Vogt
f09a61f5f5 Minor haddock formatting for X.L.OnHost and X.A.DynamicWorkspaceOrder 2012-04-28 19:45:52 +00:00
Adam Vogt
1a735f04e3 Remove trailing whitespace. 2012-04-28 19:40:48 +00:00
Carlos Lopez-Camey
d2739b1683 Add emacs-like keys to browse history in XMonad.Prompt 2012-04-21 11:07:37 +00:00
Carlos Lopez-Camey
9ecc76e087 Adds an emacs-like Keymap in XMonad.Prompt 2012-04-21 01:23:35 +00:00
jakob
7b21732ead add 'withNthWorkspace' to DynamicWorkspaceOrder.
Note this is very similar to the function of the same name exported by
DynamicWorkspaces.  Ultimately it would probably be cleaner to
generalize the one in DynamicWorkspaces to accept an arbitrary
workspace sort as a parameter; this is left as an exercise for future
hackers.
2012-04-07 18:46:40 +00:00
allbery.b
c691988bbf XMonad.Layout.OnHost allows host-specific modifications to a layout, which
is otherwise very difficult to do.  Similarly to X.L.PerWorkspace, it provides
onHost, onHosts, modHost, and modHosts layout modifiers.  It attempts to do
smart hostname comparison, such that short names will be matched with short
names and FQDNs with FQDNs.

This module currently requires that $HOST be set in the environment.
You can use System.Posix.Env.setEnv to do so in xmonad.hs if need be.
(Properly, this should be done via the network library, but I'm trying to
avoid adding that dependency.)  An alternative would be to shell out to
get the name, but that has considerable portability hurdles.
2012-03-20 03:09:12 +00:00
Adam Vogt
40d8c01894 Bump version to 0.10.1
Raising the X11 dependency while keeping the xmonad version the same leads to
problems where cabal install uses the dependency versions following hackage,
not what is installed.
2012-03-20 00:53:11 +00:00
Jens Petersen
328293a0a8 narrower BorderResize rectangles placed within border edges
Change the border resize rectangles to be narrower and only extend
  inside the window not outside.  Most window managers just seem to use
  the border decoration area for starting resizes which is often just 1 pixel
  wide but as a compromise the width is now 2 pixels (before it was 10!).
  The rectangles are now placed symmetrically within the border and window.
  This seems to work ok with PositionStoreFloat for the Bluetile config.
2012-03-14 06:47:03 +00:00
Ben Boeckel
434aec1038 add-dynamic-bars-module
This adds the X.H.DynamicBars module. It allows per-screen status bars to be
easily managed and dynamically handles the number of screens changing.
2012-03-16 00:22:04 +00:00
Daniel Wagner
69d2e0a873 bump X11 dependency so that noModMask is available 2012-03-16 00:03:02 +00:00
gwern0
9454dd5d7f Paste.hs: rm noModMask, shifted definition to X11 binding (see previous email) 2011-12-03 20:30:38 +00:00
Jens Petersen
60713064e7 GroupNavigation: fix import typo in usage 2012-03-12 10:33:49 +00:00
Jens Petersen
98b0e8e4c1 add sendToEmptyWorkspace to FindEmptyWorkspace
sendToEmptyWorkspace is like tagToEmptyWorkspace except
it does not change workspace after moving the window.
2012-03-12 10:23:31 +00:00
Jens Petersen
d2a076b1e7 xmonad-contrib.cabal: simplify xmonad dependency to >=0.10 && < 0.11
Unless there is a particular reason for listing the lower and upper bounds
separately then this seems simpler and cleaner.
2012-03-12 10:18:00 +00:00
crodjer
e2bb57bd63 ShowWName: Increase horizontal padding for flash
Currently the flash window width leaves a very small amount of padding. This
patch adds some extra horizontal width, governed by text width and length.
2012-03-05 16:45:17 +00:00
Ben Boeckel
d5e7d6217f persist-togglehook-options
Save the state of ToggleHook options over a restart.
2012-03-11 05:01:43 +00:00
Rohan Jain
4feb4fb058 ShowWName flash window background color
While calling paintAndWrite for flash window, the background color from config
should also be passed on as window background in addition to as text background
color. Otherwise the window color gets set to the default black which shows up
when text cannot span whole of the window.

This issue becomes visible when the font size is considerably large or even in
small size with truetype fonts.
2012-03-06 06:52:24 +00:00
crodjer
3f39d34994 ShowWName: Fix flash location by screen rectangle
In case of using this hook with multiple monitors, the Tag flash was not
following the screen's coordinates. This patch shifts the new window created for
flash according to the Rectangle defined by the screen.
2012-03-05 16:12:40 +00:00
crodjer
7789f18ce9 Fix typo in tabbed layout link for font utils docs 2012-02-29 07:00:22 +00:00
Steffen Schuldenzucker
807d356743 L.WorkspaceDir: cleanup redundant {definitions,imports} 2012-02-29 11:21:24 +00:00
Steffen Schuldenzucker
c012b3408d fix L.WorkspaceDir special char handling: remove "echo -n" processing 2012-02-27 12:20:04 +00:00
allbery.b
f6a050e5a3 Add BorderUrgencyHook to XMonad.Hooks.UrgencyHook
BorderUrgencyHook is a new UrgencyHook usable with withUrgencyHook or
withUrgencyHookC; it allows an urgent window to be given a different
border color.  This may not always work as intended, since UrgencyHook
likes to assume that a window being visible is sufficient to disable
urgency notification; but with suppressWhen = Never it may work well
enough.

There is a report that if a new window is created at the wrong time,
the wrong window may be marked urgent somehow.  I seem to once again
be revealing bugs in underlying packages, although a quick examination
of X.H.UrgencyHook doesn't seem to show any way for the wrong window
to be selected.
2012-02-25 08:26:16 +00:00
nicolas.dudebout
92e8f5ebef Adding use case for namedScratchpad. 2012-01-22 23:58:43 +00:00
gwern0
dd591587f6 Actions.WindowGo: typo fix - trim 's' per cub.uanic https://code.google.com/p/xmonad/issues/detail?id=491 2012-01-16 22:42:44 +00:00
gwern0
219b4dd8fb XMonad.Actions.PhysicalScreens: fix typo spotted by Chris Pick <haskell@chrispick.com> 2012-01-15 22:30:13 +00:00
Daniel Wagner
b944b1129c roll back previous incorrect fix 2012-01-11 21:41:33 +00:00
gwern0
08d432bde6 Extending: fix http://code.google.com/p/xmonad/issues/detail?id=490 2012-01-11 21:19:07 +00:00
Daniel Wagner
04d6cbc5f0 another documentation patch: XMonadContrib.UpdatePointer -> XMonad.Actions.UpdatePointer 2012-01-11 21:12:26 +00:00
Daniel Wagner
9cafb7c2af documentation patch, fixes issue 490 2012-01-11 21:08: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
Norbert Zeh
59bfe97f63 X.A.Navigation2D
This is a new module to support directional navigation across multiple screens.
As such it is related to X.A.WindowNavigation and X.L.WindowNavigation, but it
is more general.  For a detailed discussion of the differences, see
http://www.cs.dal.ca/~nzeh/xmonad/Navigation2D.pdf.
2011-12-08 20:58:42 +00:00
Daniel Wagner
64efea4d0a documentation patch: mention PostfixOperators 2011-12-10 23:48:20 +00:00
Adam Vogt
a1a578010c P.Shell documentation and add missing unsafePrompt export
Haddock (version 2.9.2 at least) does not attach documentation to any of a b or
c when given:

    -- | documentation
    a,b,c :: X
2011-12-07 16:39:51 +00:00
gwern0
9209e96234 Paste: 3 more escaped characters from alistra 2011-11-29 16:03:35 +00:00
Daniel Wagner
c809ae6f5f unfuck X.U.Paste 2011-11-29 03:23:31 +00:00
gwern0
9b369949ff XMonad.Util.Paste: +alistra's patch for fixing his pasting of things like email address (@) 2011-11-28 21:56:48 +00:00
gwern0
9e69773d98 XMonad.Util.Paste: rm myself from maintainer field; I don't know how to fix any of it even if I wanted 2011-11-28 21:30:01 +00:00
gwern0
2f0ac73313 XMonad.Prompt.Shell: improve 'env' documentation to cover goodgrue's problem 2011-11-27 23:15:07 +00:00
Erik de Castro Lopo
95290ed278 Fix spelling 'prefered' -> 'preferred'. 2011-11-25 01:02:29 +00:00
Adam Vogt
a551d1367c Restore TrackFloating behavior to an earlier version.
Thanks for liskni_si for pressing the matter: without this change it is very
broken, with the patch it is still not perfect but still useful.
2011-11-20 04:55:38 +00:00
Adam Vogt
cb795c8c75 Explicitly list test files in .cabal
In the future, require Cabal >= 1.6 to be able to just write tests/*.hs
2011-11-18 23:25:11 +00:00
Adam Vogt
d4c7c51616 Export types to improve haddock links. 2011-11-18 19:06:42 +00:00
nzeh
c4f3e94377 Better control over GridVariants geometry
Added new messages the layout understands to allow changing the grid aspect
ratio and setting the fraction of the master to a given value rather than
changing it relative to the current value.
2011-09-07 13:33:04 +00:00
Norbert Zeh
2e91cde115 Support for scratchpad applications with multiple windows
I recently found that I use xpad to add sticky notes to my desktop.  I wanted
to be able to show/hide these in the same fashion as regular scratchpads.  This
patch adds a function that allows to do this while reusing most of the existing
NamedScratchpad code.
2011-04-06 14:02:13 +00:00
Norbert Zeh
e09cfba7dd Additional messages for SplitGrid layout
This patch introduces two new message SetMasterRows and SetMasterCols for the
X.GridVariants.SplitGrid layout, which set the number of rows/columns in the
master grid to the given value.  This is useful when setting the number of rows
and/or columns non-incrementally using an interface such as GridSelect.
2009-12-15 19:21:42 +00:00
Adam Vogt
001b38c7ab Be consistent with core utf8-string usage.
Now that spawn assumes executeFile takes a String containing utf8 codepoints
(and takes an actual String as input) adjust Prompt.Shell to avoid double
encoding. U.Run functions are updated to be consistent with spawn.
2011-11-18 18:47:45 +00:00
Adam Vogt
067ccb950e Export types to reduce haddock warnings. 2010-10-23 19:57:55 +00:00
Daniel Wagner
0226b8cb4f documentation patch: note the drawbacks of X.U.Dmenu 2011-11-15 02:27:26 +00:00
Daniel Wagner
68d49ad3aa get ready for GHC 7.4: Num a no longer implies (Eq a, Show a) 2011-11-15 02:26:50 +00:00
Adam Vogt
d3ef59256b Correct completions of utf8-named file in X.P.Shell 2011-11-11 21:56:55 +00:00
Wirt Wolff
1fb2696710 Expose X.L.Groups.Helpers and Groups.Wmii in xmonad-contrib.cabal
They provide many useful exports and are linked from X.L.Groups so promote
them from other-modules or missing status.
2011-11-04 05:37:03 +00:00
Audun Skaugen
71bb40156a Small bugfix to XMonad.Layout.Fullscreen
Fixed a small bug in the layout modifers where 
windows entering fullscreen were not refreshed.

Also fixed some funny whitespace characters.
2011-10-23 10:29:40 +00:00
Daniel Wagner
189f489e03 documentation patch: add a bit more context to the code snippets in X.L.IndependentScreens 2011-10-11 20:46:19 +00:00
Adam Vogt
c00dd7b51b U.EZConfig allow removing more than one mouse binding. 2011-09-23 12:39:07 +00:00
Norbert Zeh
41d23c1749 Remove X.A.GroupNavigation.currentWindow
This function does the same as X.StackSet.peek and all its uses have been
replaced with X.StackSet.peek.
2011-09-20 08:39:22 +00:00
Adam Vogt
7f70beaf4f Fix typo in NoBorders example code. 2011-08-14 19:53:14 +00:00
Daniel Schoepe
f27e89a2ff Add XF86TouchpadToggle to the list of multimedia keys in X.U.EZConfig 2011-09-17 15:14:19 +00:00
Daniel Wagner
61e991afaa documentation patch to XMonad.Doc.Extending 2011-09-16 20:28:45 +00:00
Brent Yorgey
9e5a712929 fix warnings in X.U.EZConfig 2011-09-08 13:32:46 +00:00
Wirt Wolff
f4fc9fe503 X.A.CycleWS Refactor and add toggleWS' that excludes listed tags 2011-09-07 23:27:30 +00:00
Wirt Wolff
23c2896c6f X.A.FlexibleManipulate: Set expected fixities for Pnt math operators
Restores broken mouseWindow discrete linear and resize to 0.9.1 behavior
2011-09-04 22:12:47 +00:00
Daniel Wagner
2443a962a0 GHC 7 compat
* true error: more modules export foldl/foldl'/foldr, so explicitly use the Data.Foldable one
* -Werror error: transition from Control.OldException to Control.Exception, assuming everything was IOException
2011-07-31 17:08:50 +00:00
Adam Vogt
1364a00c84 Correct H.DynamicLog.dynamicLogXinerama comment. Wuzzeb's patch at issue 466.
Slight changes to the patch to 1. work with haddock, and 2. remove ppOutput
which distracts from the formatting and is covered elsewhere.
2011-07-14 23:17:41 +00:00
Ben Boeckel
a9d1ce1efc ungrab-keyboard-before-action
If an action that requires the keyboard to be grabbed (e.g., launching dmenu),
it is a race when submapping the action as to whether the action will have
access to the keyboard or not. To fix this, the keyboard should be ungrabbed
before executing the action.
2011-05-15 21:03:12 +00:00
Ben Boeckel
9f65044be5 add-movenext-moveprev-bindings
Adds default bindings to GridSelect for the moveNext and movePrev motions.
2011-05-15 19:33:26 +00:00
Tomas Janousek
82dff7f91d X.L.LayoutHints: refresh only if hints are not satisfied 2011-06-15 15:03:33 +00:00
Adam Vogt
758094e4c7 L.Spacing use imported fi 2011-06-12 19:23:39 +00:00
Adam Vogt
4ea488d906 Use a phantom type instead of undefined in L.LayoutBuilderP
This better expresses the idea that the argument to alwaysTrue is just there to
select an instance. Another option could be to do use a fundep, which seems to
be compatible with the two instances so far.

class Predicate p w | p -> w
2011-06-09 05:18:58 +00:00
Adam Vogt
6ec8898a54 Add more L.LayoutBuilderP documentation 2011-06-09 05:09:22 +00:00
Adam Vogt
2ba8788b8e Correct L.LayoutBuilderP module name in haddock. 2011-06-09 04:39:40 +00:00
Ilya Portnov
b2f260e9ea Cleanup in X.L.LayoutBuilderP.
Remove unused datatype declaration and export usefull typeclass.
2011-05-14 13:22:32 +00:00
Adam Vogt
334344b804 Extend script for generating the code which runs tests
Now the number of runs each can be set, and the failures and successes are
summarized in the same way as the core Properties.hs. There is some duplicated
code which could be avoided by modifying Properties.hs.
2011-06-09 04:07:22 +00:00
Adam Vogt
dea9cdea5e Move tests from ManageDocks to tests/
The change to use a newtype for RectC is kind of ugly, but this way instances
are less likely to conflict in the tests.
2011-06-09 04:02:20 +00:00
Adam Vogt
ff41d7dc68 Export X.A.CycleWS.screenBy (issue 439) 2011-06-07 00:20:53 +00:00
Tomas Janousek
d752141be1 X.H.FloatNext: export X.H.ToggleHook.runLogHook
Otherwise the user has to import XMonad.Hooks.ToggleHook as well, which he
didn't have to in earlier versions.
2011-05-28 19:17:00 +00:00
Adam Vogt
cc162bba44 Documentation fix (issue 445)
Daniel's change which broke -Wall (adding an import for haddock only) was
somehow removed. Instead we can just modify the sample code to add the import.
2011-05-27 03:35:21 +00:00
Adam Vogt
c438c17e4d X.A.AppendFile documentation fix.
Forgotten > means haddock complained (and generated incorrect output).
More controversially I reworded a sentence and use do notation.
2011-05-27 03:28:54 +00:00
Ben Boeckel
4377e75bcc add-willhook-function
Adds a function that hooks into whether the hook will be triggered on the next
request.
2011-05-15 19:17:18 +00:00
Ben Boeckel
f4dd8973b1 use-map-in-toggle-hook
Use "Data.Map String (Bool, Bool)" instead of "[(String, (Bool, Bool))]" in
X.H.ToggleHook.
2011-05-15 19:14:18 +00:00
Ilya Portnov
af9e1863eb Extend GridSelect navigation
Add moveNext and movePrev, which move selection to next/previous item.
2011-05-15 15:42:46 +00:00
Ilya Portnov
fa6ce67fba Generalize X.L.AutoMaster modifier
Enable it to work not only with Windows, but with any (Eq) type.
2011-05-14 13:25:49 +00:00
Mats Rauhala
a4da8cd41b Aesthetics on Flexiblemanipulate
Based on Adam Vogts recommendation on the mailing list. I had to give explicit
type signatures to get rid of warnings, but nearly verbatim to his version.
2011-05-06 09:44:31 +00:00
Ilya Portnov
d9c9e0c10e Add new layout combinator: LayoutBuilderP.
LayoutBuilderP is similar to LayoutBuilder (and is based on it), but LayoutBuilderP places windows matching given X.U.WindowProperties.Property (or any other predicate) into one rectangle, instead of fixed number of windows.
2011-05-11 15:40:10 +00:00
Mats Rauhala
2ab79a7c35 Compile with ghc7 2011-05-04 19:24:55 +00:00
Mats Rauhala
8056bb5c2c Action search autocomplete based on whole line
The previous version autocompleted based on words, but when searching from web
sites, it makes more sense to autocomplete based on the entire search.
2011-05-04 21:52:01 +00:00
Daniel Wagner
29cad0672e documentation: tell where to find a few auxiliary functions that might be useful in conjunction with X.A.DynamicWorkspaces 2011-04-15 22:48:46 +00:00
Brandon S Allbery KF8NH
08c4c09fc5 Typo in window-properties.sh
Somewhere between my creating the original version of this script and
adding it to the tree, a backslash got lost.  It appears to have been
lost in the version I put on the wiki, so I suspect a copy-paste
problem at that point.
2011-04-13 05:30:02 +00:00
Brandon S Allbery KF8NH
85d6b79ab9 XMonad.Hooks.FadeWindows: A generalized window fading hook 2011-02-26 00:24:36 +00:00
Brandon S Allbery KF8NH
4bcf636259 Script to simplify getting ManageHook information from a window 2011-02-24 02:49:37 +00:00
Brandon S Allbery KF8NH
864732dbdc XMonad/Hooks/DebugKeyEvents - debug helper to see what keys xmonad sees 2011-02-24 02:36:13 +00:00
Brandon S Allbery KF8NH
521ef9e01d Prevent non-default XUtils windows from being composited 2011-02-24 00:32:24 +00:00
gwern0
8fb4c1e734 XMonad.Hooks.FloatNext: issue #406, make FloatNext use ToggleHook 2011-04-12 01:52:17 +00:00
gwern0
9b4e43e20f issue #406: ben boeckel <mathstuf@gmail.com> +XMonad.Hooks.ToggleHook 2011-04-12 01:51:27 +00:00
Adam Vogt
786613198b Fix xinerama workspace swapping with A.CopyWindow.killAllOtherCopies
Spotted by arlinius in #xmonad, and this only shows up for xinerama setups.
Using an algorithm that scales better with number of workspaces would probably
be shorter too (visiting them in turn, rather than doing random access), but
probably not worth the effort.
2011-03-01 03:37:36 +00:00
gwern0
1844c80978 XMonad.Util.Run: resolve issue #441
See <http://code.google.com/p/xmonad/issues/detail?id=441>

> I have run into programs that fail when run by safeSpawn but succeed with spawn.
> I tracked it down in one (python) and it seems to be due to uninstallSignalHandlers.
> When run by safeSpawn, the program reports errors from wait.

dylan did not supply a patch and his version doesn't match the declared type signature;
since I don't want to break every `safeSpawn` user, I tossed a `>> return ()` in to make
the type right, although I'm troubled at removing the exception functions.
2011-04-11 16:37:40 +00:00
gwern0
7c4358d2d6 AppendFile: additional example of usage 2011-01-26 20:10:18 +00:00
Adam Vogt
ed12889c2c Fix A.Gridselect image links (thanks dobblego) 2011-01-19 23:01:13 +00:00
Adam Vogt
9d3e169fb0 Bump version to 0.10 to help keep the correct contrib/core versions together. 2011-01-15 18:05:53 +00:00
Adam Vogt
0377a9e335 H.ICCCMFocus had atom_WM_TAKE_FOCUS incorrectly removed
It is possible that this atom should be defined in the X11 library, but fix the
build of contrib for now. In any case, this would have to wait for a change and
release of the X11 binding.

rolling back:

Wed Jan  5 22:38:39 EST 2011  Adam Vogt <vogt.adam@gmail.com>
  * Remove accidental atom_WM_TAKE_FOCUS from H.ICCCMFocus
  
  The XMonad module exports this already

    M ./XMonad/Hooks/ICCCMFocus.hs -7 +1
2011-01-06 19:20:52 +00:00
Adam Vogt
fe9fb9c62d Remove accidental atom_WM_TAKE_FOCUS from H.ICCCMFocus
The XMonad module exports this already
2011-01-06 03:38:39 +00:00
haskell
37fc674790 Java swing application focus patch 2011-01-05 03:25:35 +00:00
Brent Yorgey
bbd9761130 fix X.L.Gaps documentation, thanks to Carl Mueller for the report 2010-12-23 01:07:44 +00:00
Adam Vogt
a976d33038 Fix A.OnScreen example code typo 2010-12-12 16:18:50 +00:00
Brent Yorgey
1c50b1aa9a fix up funny unicode whitespace in Fullscreen 2010-12-12 14:22:41 +00:00
Audun Skaugen
02a3b820c9 Add X.L.Fullscreen 2010-11-16 22:16:11 +00:00
quesel
3813d625b6 Close the display correctly after counting the number of screens
This patch adds support for calling countScreens in arbitrary places. Prior to
this patch one would end up with an open display for each call of the
countScreens function with would eventually mess up X. This patch ensures that
the display that is no longer needed is closed after the operation and thus
using the function without side effects.
2010-11-16 08:14:49 +00:00
Adam Vogt
67db59bf73 Compatibility with mtl-1 and mtl-2 2010-11-15 23:26:54 +00:00
Adam Vogt
52d3aa1500 Rename state in A.Gridselect to avoid name shadowing (mtl-2) 2010-11-15 23:22:22 +00:00
Clemens Fruhwirth
cbb20fb3a8 Substring search support for X.A.GridSelect. As keymaps get more complicated to support different styles, the gs_navigate element is fundamentially changed. 2010-11-02 21:12:13 +00:00
Clemens Fruhwirth
e544e09cbb Make substring search case insensitive 2010-10-16 21:29:04 +00:00
Clemens Fruhwirth
3a886e0844 Introduce grayoutAllElements in X.A.GridSelect 2010-10-16 21:25:59 +00:00
Clemens Fruhwirth
27fc66bb2c Add substring filter to td_elementmap 2010-10-16 18:36:44 +00:00
Clemens Fruhwirth
3a35fe3f3d Refactor for ad-hoc element and position matching turning td_elementmap into a function using the new td_availSlot and td_elements fields 2010-10-16 18:35:54 +00:00
Clemens Fruhwirth
06bb702240 Remove nub from diamondLayer in X.A.GridSelect 2010-10-16 18:31:32 +00:00
Clemens Fruhwirth
3cee73fe02 Convert access of td_elementmap from field styled to function call styled in X.A.GridSelect 2010-10-16 16:47:57 +00:00
Clemens Fruhwirth
ffe08858ab Make use of field names when constructing TwoDState in X.A.GridSelect 2010-10-16 16:41:51 +00:00
Adam Vogt
96d2982c60 Pointfree and -XRank2Types don't mix in X.L.Groups.Helpers
It used to work with ghc-6.12 (and earlier?), but ghc-7RC2 type inference
doesn't work with . instead of it's definition.
2010-11-13 02:28:39 +00:00
Adam Vogt
f9d2a6bd7f Restrict dependencies, since mtl-2 is incompatible
A couple removed constructors need to be replaced by the lowercase versions
(ex. State = StateT Identity now). But it isn't clear that mtl-1 should be
dropped.
2010-11-13 02:22:04 +00:00
Adam Vogt
b1ff22411d X.L.TrackFloating docs and help nested layouts
Now TrackFloating remembers focus for the given layout when the other window is
also tiled, but not fed to the given layout: this helps with X.L.IM, among
others.
2010-10-30 17:56:15 +00:00
Norbert Zeh
a73a61302c X.L.Maximize: Make layout forget maximized window when it is closed
The X.L.Maximize layout modifier does not track whether the window it stores as
maximized does still exist.  The X server reuses window IDs.  As a result, I
was able to reproduce the following behaviour (e.g., by opening and closing
xpdf windows): Create a window, maximize it, close it without restoring it to
its normal state.  Open a new window with the same window ID (e.g., an xpdf
window after just closing an xpdf window).  The new window will open maximized,
which is not what one would expect.  This patch addresses this problem,
removing the ID of the maximized window from the layout when the maximized
window is closed.
2010-10-29 22:15:51 +00:00
Adam Vogt
81d338952d Fix bug in L.TrackFloating
Addresses the comment that:

If the focus goes from the floating layer to tiling by deleting a floating
window, it's again the master window that gets focus, not the remembered
window.
2010-10-30 00:06:20 +00:00
Daniel Schoepe
d7005d529a Add X.L.Groups.Helpers to other-modules
Not listing aforementioned module can cause build failures in libaries
that depend on xmonad-contrib.
2010-10-24 19:18:50 +00:00
mathstuf
88380dc1da windowbringer-menu-choice
Add functions to allow users to use a menu other than dmenu and pass arguments
to the menu.
2010-09-05 01:35:22 +00:00
Adam Vogt
25889f2d0c Add X.L.TrackFloating for tiled-floating focus issues (#4) 2010-10-16 16:55:36 +00:00
Daniel Wagner
eec8dc9dcb minor documentation fixes 2010-10-07 01:19:57 +00:00
Daniel Schoepe
3a405285b0 Minor documentation fixes in X.U.ExtensibleState 2010-10-04 12:05:09 +00:00
Adam Vogt
8fa66c829d Clarify the note on -XRank2Types in L.Groups 2010-10-02 02:08:41 +00:00
quentin.moser
44a1889345 Mention X.L.Groups.ModifySpec's rank-2 type in the doc 2010-01-17 11:56:01 +00:00
moserq
4339b7ac00 Orphan my modules 2010-10-01 10:43:00 +00:00
moserq
021245b5fa Split X.L.Groups.Examples
X.L.G.Examples : rowOfColumns and tiled tabs layouts
X.L.G.Helpers : helper actions
X.L.G.Wmii : wmii layout
2010-10-01 10:41:42 +00:00
moserq
ea10cbbbd8 X.L.G.Examples: improve the tabs of tiledTabs 2010-01-20 10:32:40 +00:00
moserq
0b4c57d769 X.L.G.Examples: improve the tabs of wmiiLike 2010-01-20 10:17:46 +00:00
quentin.moser
e3af1c3dfc X.L.Groups: Always keep one group, even if empty. 2010-01-18 02:15:26 +00:00
quentin.moser
8e298ca8b8 Do not duplicate layouts in X.L.Groups
I liked the idea, but it completey messes up Decoration layouts.
2010-01-17 11:47:08 +00:00
Adam Vogt
85973b0550 Add missing module re-export (issue 366) 2010-09-30 00:20:46 +00:00
Tomas Janousek
f8be680472 X.H.ManageDocks: event hook to refresh on new docks 2010-07-06 18:58:34 +00:00
quesel
5fb228cfac This patch adds support for multiple master windows to X.L.Master 2010-05-18 06:05:57 +00:00
Tomas Janousek
adbb52d4f2 X.L.LayoutHints: event hook to refresh on hints change 2010-07-06 18:59:25 +00:00
Adam Vogt
2e30d259b8 Remove last excess definition of `fi' (fromIntegral) 2010-09-13 23:38:50 +00:00
Adam Vogt
d5a5522187 Explain fields added for "XMonad.Layout.ImageButtonDecoration" 2010-09-13 23:27:20 +00:00
Adam Vogt
6458e60812 Adjust X.C.Desktop documentation content.
Correct errors regarding a description of `mappend' for X

Use <+> more often since that's `consistent', and there is no difference since
it's the same as >> when all arguments have the same type (which they do...
otherwise people aren't just combining valid values for that field of the
config).
2010-08-03 14:11:17 +00:00
Jan Vornberger
82147d137c Minimize: Replaced calls to 'sendMessage' (BW.focusDown) and 'windows' with alternative methods
Calling these functions during message handling results in the loss of layout state.
This fixes a number of bugs related to the combination of X.L.Minimize with a decoration.
2010-07-27 22:48:41 +00:00
Jan Vornberger
980a22434b CurrentWorkspaceOnTop: proper reimplementation of XMonad.Operation
Fixes bugs in combination with stateful layouts and floating windows
2010-07-27 19:41:54 +00:00
Justin Bogner
fd99373c39 A hook to handle minimize/restore window manager hints.
XMonad.Hooks.Minimize handles both minimize and restore
messages. Handling restore messages was already done in
RestoreMinimized, which this module intends to replace.
2010-06-16 05:11:24 +00:00
gwern0
bac3e0d658 WindowGo: bulk up 'runOrRaise' doc to point to 'raiseMaybe' for shell scripting 2010-07-12 04:56:32 +00:00
gwern0
9f6bb1a26e WindowGo: fmt & sp 2010-07-12 04:29:15 +00:00
Adam Vogt
129af43738 Note that Simplest works well with BoringWindows 2010-06-22 03:08:50 +00:00
gwern0
3f8e0109cc XMonad.Util.Run: improve linking and rearrange docs 2010-06-20 17:52:15 +00:00
gwern0
eed47b3f81 XMonad.Util.Run: correct broken example 2010-06-20 17:51:58 +00:00
gwern0
7dd1384884 XMonad.Util.Run: fix unicode char 2010-06-20 17:51:40 +00:00
gwern0
f23f8e0bf7 XSelection.hs: update docs w/r/t unicode
see http://code.google.com/p/xmonad/issues/detail?id=348
2010-06-15 00:09:02 +00:00
Khudyakov Alexey
e708caf2ac encode string of bytes not list of chars 2010-06-13 11:33:41 +00:00
gwern0
c6178cacd2 GroupNavigation.hs: clean up imports 2010-06-08 20:38:32 +00:00
gwern0
6472683476 remove decodeInput/encodeOutput
see http://code.google.com/p/xmonad/issues/detail?id=348
they are just synonyms for 2 utf8-string functions, and don't really help
2010-06-14 23:23:00 +00:00
gwern0
955dd48153 Developing: be good to mention hlint in a hacking guide 2010-05-06 16:05:35 +00:00
Norbert Zeh
9300140701 Fix bug in history maintenance of X.A.GroupNavigation
When the focused window was closed without a new window receiving focus, the
closed window was not removed from the history database, making for example
"nextMatch History (return True)" misbehave.  This patch fixes this.
2010-06-04 08:14:31 +00:00
Jan Vornberger
af24766a83 PositionStoreHook: take decoration into account 2010-06-02 22:30:15 +00:00
Jan Vornberger
12cc1dc53e PositionStoreHook: take docks into account 2010-06-02 21:50:48 +00:00
Nicolas Pouillard
316e26fd0c TopicSpace: +reverseLastFocusedTopics 2010-05-20 07:28:44 +00:00
Nicolas Pouillard
c1a3a1c19d TopicSpace: improve the lastFocusedTopic handling
Now the list of last topics is internally kept but
only visually truncated.
2009-12-20 21:28:13 +00:00
Norbert Zeh
142eac2eb3 X.A.GroupNavigation with containers < 0.3.0.0 compatibility
This patch replaces the use of Seq.filter and Seq.breakl with two
functions flt and brkl that do the same.  This is necessary to
keep compatibility with containers < 0.3.0.0 because Seq.filter and
Seq.breakl were introduced only in containers 0.3.0.0.
2010-05-14 22:21:53 +00:00
Norbert Zeh
d01bb24022 New module XMonad.Actions.GroupNavigation
This module adds two related facilities.  The first one allows cycling through
the windows in a window group.  A group is defined as the set of windows for
which a given Boolean Query returns True.  The second one keeps track of the
history of focused windows and allows returning to the most recently focused
window in a given window group before the currently focused window.
2010-05-10 08:14:12 +00:00
Daniel Schoepe
2ee34742ca Add a way to update the modifier in X.L.LayoutModifier
This patch adds the possibility to update the state of a layout modifier when
modifying the underlying layout before it is run(i.e. using modifyLayout). 
The modified state is also passed to the subsequent call of redoLayout, whose 
return takes precedence if both functions return modified states of the layout 
modifier.
2009-08-22 21:39:58 +00:00
Adam Vogt
b21208dad7 Remove trailing whitespace in A.KeyRemap 2010-05-03 15:32:58 +00:00
stettberger
99e5a4393f Adding XMonad.Actions.KeyRemap for mapping single keys
With KeyRemap it is possible to emit different keys to client windows, when 
pressing some key. For example having dvorak layout for typing, but us for 
keybindings.
2010-05-02 15:23:22 +00:00
Adam Vogt
ad5277a189 Move Util.Font to .hs, and enable -XCPP
As the CPP pass was the only feature being used in Font.hsc (no other FFI)
it's better to avoid hsc2hs, if only to make the purpose of the module
clearer from the filename.
2010-04-29 14:07:44 +00:00
Adam Vogt
d310cf5f69 A.Search: Remove unnecessary `do' 2010-04-29 13:47:49 +00:00
Khudyakov Alexey
f7d8eb3fdd Fix escaping of URI 2010-04-23 20:47:07 +00:00
Adam Vogt
ceb24fb8b4 Prompt: handle case of historySize=0 better. 2010-04-21 18:30:06 +00:00
Adam Vogt
36bcb743d6 Rearrange tests. See test/genMain.hs for instructions. 2010-04-19 01:49:46 +00:00
Adam Vogt
c3c06a4567 Use CPP to add to exports for Selective tests (L.LimitWindows) 2010-04-19 01:43:44 +00:00
Adam Vogt
78f13d2acd Use imported `fi' alias for fromIntegral more often.
Also moves `fi' into U.Image to avoid cyclic imports,
though XUtils sill exports that definition.
2010-04-16 21:29:39 +00:00
Adam Vogt
d511ffd01a Note that mouseResizableTileMirrored may be removed. 2010-04-16 16:11:18 +00:00
Adam Vogt
4950c69dbd Structure L.MouseResizableTile documentation. 2010-04-16 16:06:41 +00:00
Tomas Janousek
7129622eb9 X.L.MouseResizableTile: make everything configurable 2010-04-15 21:46:09 +00:00
Tomas Janousek
1e847cb65a X.L.MouseResizableTile: configurable gaps (dragger size and position)
(with the option of putting the draggers over window borders with no gaps at
all)
2010-04-15 21:38:13 +00:00
Adam Vogt
2853dc65c8 Remove unnecessary imports. 2010-04-16 16:02:39 +00:00
gwern0
ddd9674b14 update module imports 2010-04-14 21:19:47 +00:00
Adam Vogt
9372aac28e tests/test_XPrompt can build now. 2010-04-14 20:46:12 +00:00
Adam Vogt
2477f81f73 prettier haddock markup for L.NoBorders 2010-04-05 18:40:20 +00:00
Jan Vornberger
c37cbbadf5 ImageButtonDecoration: new image for menu button 2010-04-02 17:49:10 +00:00
trupill
e125c84616 image_buttons
* Added a XMonad.Util.Image module to manipulate simple images
  and show them into an X drawable
* Added the possibility of using image buttons instead of plain
  text buttons into the title bar
* Added a XMonad.Layout.ImageButtonDecoration as an example of
  how to use the image buttons
2010-03-31 09:38:08 +00:00
Jan Vornberger
4e8285dcbe WindowMenu: own colorizer that works better with Bluetile's new theme 2010-04-02 18:41:19 +00:00
Anders Engstrom
96f3456b96 X.L.Named deprecate and implement using X.L.Renamed
nameTail behaves slightly different if there are whitespace before the first word or the name contains tabs or other such whitespace. But I expect few users are affected since the only usecase where nameTail is actually needed is to remove automatically added prefixes. These prefixes will be removed as they should by the new implementation.
2010-04-01 21:24:03 +00:00
Anders Engstrom
5b045e458d X.L.Minimize remove redundant imports 2010-04-01 20:44:00 +00:00
Adam Vogt
5e274b254e Correct module header. 2010-03-30 18:10:29 +00:00
trupill
b6c5550334 minimize_ewmh 2010-03-30 18:36:16 +00:00
Adam Vogt
086c8c209c Use more monoid instances to clean up U.WorkspaceCompare 2010-02-22 15:17:10 +00:00
Adam Vogt
6215d71600 Note that Groups has redundancies and the interface may change.
Refer to:
http://www.haskell.org/pipermail/xmonad/2010-January/009585.html
2010-03-30 17:59:45 +00:00
Tomas Janousek
f093c11a27 X.H.UrgencyHook: performance fix
cleanupUrgents would update the Map in extensible state 2-times the number of
visible windows, resulting in excessive memory usage and garbage collection.
This seems to make it behave correctly.
2010-03-30 14:13:41 +00:00
quentin.moser
97e68c1bc8 Update my e-mail address 2010-01-17 01:11:09 +00:00
quentin.moser
dd1a8ff05d New module: X.L.Groups.Examples
Utility functions and examples using X.L.Groups.
2010-01-17 01:02:36 +00:00
quentin.moser
10e1e1d4c1 New module: X.L.Groups
The mother of all layout combinators.
2010-01-17 00:53:01 +00:00
quentin.moser
38f1a07042 New module: X.L.ZoomRow
Row layout with individually resizable elements.
2010-01-17 00:39:39 +00:00
quentin.moser
317afc33af New module: X.L.Renamed 2010-01-17 00:26:12 +00:00
quentin.moser
6aeca44187 New module: X.U.Stack
Utility functions for working with Maybe Stacks, including:
  - useful conversions to and from lists
  - insertUp/Down, swapUp/Down, focusUp/Down, etc
  - maps, filters and folds
2010-01-17 00:21:04 +00:00
Daniel Wagner
8705542d1d bugfix: removeKeys should remove all keys in the provided list 2010-03-27 19:25:41 +00:00
Jurgen Doser
208d920b6b fixed argument order to isPrefixOf in a couple of places in X.A.Search
In some places, ((!>), prefixAware, and one place in the documentation),
isPrefixOf was used with wrong argument order.  In particular, this made
combining search engines not work as advertised, for example, the predefined
search engine "multi".
2010-03-16 12:20:10 +00:00
Brent Yorgey
5485ba57ac X.P.Ssh: add entries from .ssh/config to ssh prompt completion 2009-12-29 17:13:46 +00:00
Tomas Janousek
21526d1532 X.H.DynamicLog: let the user of xmonadPropLog choose property name 2010-03-19 21:46:31 +00:00
gwern0
520b9ccf6e Replace.hs: rm trailing whitespace 2010-03-14 21:01:09 +00:00
gwern0
e28cd8cd6e Workspace.hs: rm trailing whitespace 2010-03-14 21:01:01 +00:00
gwern0
98a320cbb5 Layout.hs: rm trailing whitespace 2010-03-14 21:00:54 +00:00
gwern0
3b258409db Directory.hs: rm trailing whitespace 2010-03-14 21:00:47 +00:00
gwern0
cf0c3194de MessageControl: rm trailing whitespace 2010-03-14 21:00:38 +00:00
gwern0
796b775d5c LimitWindows.hs: rm trailing whitespace 2010-03-14 21:00:30 +00:00
gwern0
0d3293ce52 LayoutCombinators.hs: rm trailing whitespace 2010-03-14 21:00:21 +00:00
gwern0
ce5f81fe16 DecorationAddons.hs: rm trailing whitespace 2010-03-14 21:00:12 +00:00
gwern0
b267617eee Column.hs: rm whitespace 2010-03-14 21:00:01 +00:00
gwern0
c3796a9cb1 DynamicWorkspaces.hs: rm whitespace 2010-03-14 20:59:51 +00:00
Max Rabkin
ee38a0328b Fix bugs with nested drawers in X.L.Drawer
There were two bugs:
1. The layout modifier assumed the rect's x was zero.
2. The layout modifier assumed that the stackset's focus actually had focus.
2010-03-10 17:01:59 +00:00
Adam Vogt
8cc604c4ad Correct L.Drawer haddock markup and re-export required module. 2010-03-08 22:52:58 +00:00
Max Rabkin
8f58fb4c2f Added X.L.Drawer
X.L.Drawer provides a layout modifier for retracting windows which roll down
(like the Quake console) when they gain focus.
2010-03-08 21:27:52 +00:00
Anders Engstrom
0c9619e5cd X.U.WorkspaceCompare xinerama compare with physical order
Like the old xinerama workspace comparison, but order by physical location just like X.A.PhysicalScreens. Useful if using xinerama sort for statusbar together with physicalscreens.
2010-03-08 11:54:02 +00:00
Anders Engstrom
5e6c03c2ca X.U.Dmenu helpers to run dmenu with arguments 2010-03-08 11:50:22 +00:00
Anders Engstrom
abebe3085c X.L.LayoutScreens split current screen
This patch will allow the user to split the currently focused screen instead of all screens together. This is usefull for multiscreen users who have functioning xinerama, but wish to split one of the screens.
2010-03-08 11:43:18 +00:00
Anders Engstrom
649bb08374 X.A.PhysicalScreens cleaning and allow cycling
Remove redundant import to supress warning, did some refactoring to use xmonad internal things to find screens instead of using X11-stuff. Also added ability to cycle between screens in physical order.
2010-03-08 11:37:04 +00:00
Adam Vogt
16fce733c0 Use imported 'fi' in H.ScreenCorners 2010-02-22 15:06:33 +00:00
Nils Schweinsberg
c8cd7df334 X.H.ScreenCorners typos 2010-02-22 11:51:42 +00:00
Nils Schweinsberg
c057c24f70 X.H.ScreenCorners rewritten to use InputOnly windows instead of waiting for MotionEvents on the root window 2010-02-22 11:24:59 +00:00
Nils Schweinsberg
4a138012ba [patch] X.H.ScreenCorners: move the mouse cursor to avoid loops 2010-02-21 23:15:50 +00:00
Daniel Schoepe
aa34798b99 Prevent possible pattern match failure in X.A.UpdateFocus 2010-02-21 23:47:35 +00:00
Nils Schweinsberg
9fdd63bd8b New extension: XMonad.Hooks.ScreenCorners 2010-02-21 23:02:59 +00:00
daniel
bd47cc5d3e documentation for marshallPP 2010-02-15 00:07:31 +00:00
Daniel Wagner
e44bab10e7 DynamicLog support for IndependentScreens 2010-01-04 05:42:51 +00:00
Daniel Wagner
0909472d54 minor style changes 2009-12-28 17:30:16 +00:00
gwern0
38228517eb XMonad.Prompt: remove white border from greenXPConfig 2010-02-11 16:36:41 +00:00
Daniel Schoepe
de9a2e8adb Fixed reversed history searching direction in X.P.history(Up|Down)Matching 2010-02-08 16:29:01 +00:00
Adam Vogt
52a2eba7e6 Compatibility for rename of XMonad.numlockMask 2010-01-24 20:19:55 +00:00
Adam Vogt
aa8290b60d Use extensible-exceptions to allow base-3 or base-4 2010-01-24 20:33:24 +00:00
Brent Yorgey
b435a6a519 suppress some warnings under ghc 6.12.1 and clean up redundant imports to get rid of some others. 2010-01-12 17:25:07 +00:00
Daniel Schoepe
96792aa4ab Corrected documentation in X.Prompt 2010-02-01 20:45:22 +00:00
Daniel Schoepe
59667f39ab Use Stack instead of list in X.Prompt.history*Matching 2010-02-01 20:28:39 +00:00
Jan Vornberger
9b76a85c74 BluetileConfig: Fullscreen tweaks and border color change 2010-01-31 23:33:47 +00:00
Wirt Wolff
57c00ea498 A.CycleWindows replace partial rotUp and rotDown with safer versions
Rather than throw exceptions, handle null and singleton lists, i.e.
f [] gives [] and f [x] gives [x].
2010-01-23 23:19:12 +00:00
Adam Vogt
a9f2b82337 Use <+> instead of explicit M.union to merge keybindings in X.C.* 2010-01-24 20:21:36 +00:00
Adam Vogt
0b4d34fa7e Fix incorrect import suggestion in L.Tabbed (issue 362) 2010-01-21 18:25:01 +00:00
Adam Vogt
685cc6931f Swap window ordering in L.Accordion (closes Issue 358). Thanks rsaarelm.
This change keeps windows in the same ordering when focus is changed.
2010-01-21 15:43:44 +00:00
Jens Petersen
7b0fd3ba3a use restart to restart xmonad (no longer bluetile) 2010-01-16 10:59:35 +00:00
Tomas Janousek
0ce76fd152 X.L.Decoration: avoid flicker by not showing decowins without rectangles
These would be hidden by updateDecos immediately after being shown. This
caused flicker with simpleTabbed and only one window on a workspace.
2010-01-16 11:20:54 +00:00
Daniel Schoepe
c0d5c4a278 Add a way to cycle only through matching history entries in X.Prompt
This patch adds a way go up through X.Prompt's history using
only those entries that start with the current input, similar
to zsh's `history-search-backward'.
2010-01-13 23:30:36 +00:00
Adam Vogt
882ddc25f4 Style changes in L.Minimize 2010-01-04 14:44:48 +00:00
konstantin.sobolev
6c452e066e minimize_floating
Adds floating windows support to X.L.Minimize
2009-12-30 07:01:05 +00:00
Adam Vogt
6fc1530fe9 Use more imported cursor constants. 2009-12-30 22:09:27 +00:00
Brent Yorgey
1eb50b2028 import new contrib module, X.A.DynamicWorkspaceOrder 2009-12-30 19:23:50 +00:00
Brent Yorgey
f25c348669 X.A.CycleWS: export generalized 'doTo' function for performing an action on a workspace relative to the current one 2009-12-30 19:19:53 +00:00
Brent Yorgey
2c4e5f5d53 new contrib module, X.A.DynamicWorkspaceGroups, for managing groups of workspaces on multi-head setups 2009-12-29 16:57:02 +00:00
Brent Yorgey
d384a98ccb new contrib module from Tomas Janousek, X.A.WorkspaceNames 2009-12-29 16:39:15 +00:00
Tim Horton
4e2e0ef0ba X.P.Shell, filter empty string from PATH
doesDirectoryExist returns True if given an empty string using ghc <= 6.10.4.
This causes getDirectoryContents to raise an exception and X.P.Shell does not
render. This is only an issue if you have an empty string in your PATH.

Using ghc == 6.12.1, doesDirectoryExist returns False given an empty string, so
this should not be an issue in the future.
2009-12-24 03:32:17 +00:00
Brent Yorgey
997fdef24b small tweak to battery logger 2009-12-27 08:56:41 +00:00
Adam Vogt
2f0e880ccd Use imported xC_bottom_right_corner in A.MouseResize 2009-12-27 23:37:05 +00:00
Tomas Janousek
311994f9ef X.A.MouseResize: assign an appropriate cursor for the resizing inpuwin 2009-12-27 21:21:40 +00:00
Spencer Janssen
12c791d02f Fix the createSession bug in spawnPipe
Both the new XMonad.Core.xfork function and spawnPipe call createSession, calling
this function twice results in an error.
2009-12-27 00:35:01 +00:00
Jan Vornberger
adb7144a98 Let the core know about MouseResizableTile's draggers, so they are stacked correctly 2009-12-23 14:54:28 +00:00
Spencer Janssen
e8c0f39fd5 Update all uses of forkProcess to xfork 2009-12-23 06:45:58 +00:00
Jan Vornberger
98fe292e9f Make X.L.Minimize explicitly mark minimized windows as boring 2009-12-22 21:45:29 +00:00
intrigeri
d32efe75e4 Actions/Search: added openstreetmap 2009-12-22 11:45:45 +00:00
Mike Lundy
efbcf16cee Add a search predicate option to XMonad.Prompt 2009-12-21 02:54:08 +00:00
Adam Vogt
05ed62a455 In D.Extending note how <+> can be used with keybindings. 2009-12-20 19:07:39 +00:00
Tomas Janousek
16181ce6e7 Fix MultiToggle crashes with decorated layouts
The problem was that certain layouts keep their "world" state in their value,
which was thrown away and forgotten after ReleaseResources during toggle.

In particular, decorated layouts store some X11 handles in them and
allocate/deallocate it as appropriate. If any modification to their state is
ignored, they may try to deallocate already deallocated memory, which results
in a crash somewhere inside Xlib.

This patch makes Transformers reversible so that nothing is ever ignored. As a
side effect, layout transformers now do receive messages and messages for the
base layout do not need the undo/reapply cycle -- we just pass messages to the
current transformed layout and unapply the transformer when needed.
(This, however, doesn't mean that the base layout is not asked to release
resources on a transformer change -- we still need the transformer to release
its resources and there's no way to do this without asking the base layout as
well.)
2009-12-20 00:47:33 +00:00
Adam Vogt
d616e92dba Golf / style change in U.ExtensibleState 2009-12-08 01:05:06 +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
Spencer Janssen
103d633e41 TAG 0.9.1 2009-12-16 23:36:51 +00:00
Spencer Janssen
d7cac6d70c Bump version to 0.9.1 2009-12-16 23:26:34 +00:00
Spencer Janssen
e806fe9bc8 Match X11 dependencies with xmonad's 2009-12-16 01:26:30 +00:00
Spencer Janssen
d451c277f6 Safer X11 version dependency 2009-12-16 00:59:16 +00:00
Spencer Janssen
cdae01dfdb Update Prompt for numlockMask changes 2009-11-03 22:26:21 +00:00
Tomas Janousek
5c2aa04175 X.L.MouseResizableTile: change description for mirrored variant
The description for mirrored MouseResizableTile is now "Mirror
MouseResizableTile", to follow the standard of other layouts that can be
mirrored using the Mirror modifier.
2009-12-11 12:42:18 +00:00
Tomas Janousek
1d6a171dd2 X.A.GridSelect: documentation typo fix
spotted by Justin on IRC
2009-12-11 18:25:15 +00:00
Adam Vogt
e8cfb696ad A.GridSelect shouldn't grab keys if there are no choices.
Thanks thermal2008 in #xmonad for bringing up the corner case when gridselect
is run with an empty list of choices.
2009-12-10 18:30:38 +00:00
Nils Schweinsberg
9464b32395 onScreen' variation for X () functions 2009-12-09 00:37:17 +00:00
Jan Vornberger
f46873fdab Added Bluetile's config 2009-12-09 15:03:09 +00:00
Jan Vornberger
c729dac32e BluetileCommands - a list of commands that Bluetile uses to communicate with its dock 2009-12-08 23:44:31 +00:00
Adam Vogt
84a8e42ac0 Use lookup instead of find in A.PerWorkspaceKeys 2009-11-29 03:26:50 +00:00
Nils Schweinsberg
de3cafec0d Change of X.A.OnScreen, more simple and predictable behaviour of onScreen, new functions: toggle(Greedy)OnScreen 2009-12-07 15:50:50 +00:00
Jan Vornberger
bfb5fc7384 Module to ensure that a dragged window always stays in front of all other windows 2009-11-29 00:45:06 +00:00
Jan Vornberger
b2fa3f3e80 Decoration that allows to switch the position of windows by dragging them onto each other. 2009-11-29 00:34:31 +00:00
Jan Vornberger
2ca7de8b08 A decoration with small buttons and a supporting module 2009-11-29 00:24:16 +00:00
gwern0
8fa0319e89 XMonad.Actions.Search: finally fixed the internet archive search plugin 2009-12-05 03:34:35 +00:00
gwern0
8e8962909b XMonad.Actions.Search: in retrospect, a bit silly to make everyone go through SSL 2009-12-05 03:33:18 +00:00
Tim Horton
1dc74c3879 Prompt.hs: Corrected quit keybindings 2009-12-03 05:00:41 +00:00
Jan Vornberger
bcb204731f Extended decoration module with more hooks and consolidated some existing ones 2009-11-28 23:43:10 +00:00
Jan Vornberger
c92b8b3e9e Extended decoration theme to contain extra static text that always appears in the title bar 2009-10-24 21:39:28 +00:00
Jan Vornberger
be4feb98d6 Extended paintAndWrite to allow for multiple strings to be written into the rectangle 2009-10-24 20:51:11 +00:00
Jan Vornberger
c38912b991 Added the alignment option 'AlignRightOffset' 2009-10-24 20:45:13 +00:00
Jan Vornberger
79e7a8210a Prevent windows from being decorated that are too small to contain decoration. 2009-06-27 09:43:16 +00:00
Tomas Janousek
02063ff97e X.L.MouseResizableTile: keep draggers on the bottom of the window stack. 2009-11-26 17:34:13 +00:00
Jan Vornberger
c198812fb6 Implemented smarter system of managing borders for BorderResize 2009-11-22 23:36:51 +00:00
Tomas Janousek
e2c5fa876a X.H.DynamicLog: fix xmonadPropLog double-encoding of UTF-8
dynamicLogString utf-8 encodes its output, xmonadPropLog shouldn't do that
again.
2009-11-21 00:48:29 +00:00
Brent Yorgey
70d5cedcc5 X.H.DynamicLog: make documentation for 'dzen' and 'xmobar' slightly more clear 2009-11-21 17:07:39 +00:00
Tomas Janousek
82a0d30f31 X.H.ManageDocks: ignore struts that cover an entire screen on that screen
Imagine a screen layout like this:

  11111111
  11111111
  11111111
   222222    <--- xmobar here
   222222
   222222

When placing xmobar as indicated, the partial strut property indicates that an
entire height of screen 1 is covered by the strut, as well as a few lines at
the top of screen 2. The original code would create a screen rectangle of
negative height and wreak havoc. This patch causes such strut to be ignored on
the screen it covers entirely, resulting in the desired behaviour of a small
strut at the top of screen 2.

Please note that this semantics of _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL is
different to what is in wm-spec. The "correct" thing to do would be to discard
the covered portion of screen 1 leaving two narrow areas at the sides, but
this new behaviour is probably more desirable in many cases, at least for
xmonad/xmobar users.

The correct solution of having separate _NET_WM_STRUT_PARTIAL for each
Xinerama screen was mentioned in wm-spec maillist in 2007, but has never
really been proposed, discussed and included in wm-spec. Hence this "hack".
2009-11-19 14:50:43 +00:00
Adam Vogt
46fca2c6c9 Use imported 'fi' in PositionStoreHooks 2009-11-19 10:31:12 +00:00
Daniel Schoepe
30a78d51e3 Changed interface of X.U.ExtensibleState
Changed the interface of X.U.ExtensibleState to resemble that of
Control.Monad.State and modified the modules that use it accordingly.
2009-11-16 17:10:13 +00:00
Jan Vornberger
b881934a02 PositionStoreFloat - a floating layout with support hooks 2009-11-15 18:48:33 +00:00
Jan Vornberger
6a8e6af48f PositionStore utility to store information about position and size of a window 2009-11-08 19:57:35 +00:00
Anders Engstrom
addb6a99e1 X.H.Urgencyhook fix minor doc bug 2009-11-15 13:11:21 +00:00
Anders Engstrom
5d341e8e99 X.H.DynamicLog fix minor indentation oddness 2009-11-15 13:07:07 +00:00
Anders Engstrom
5463e04b94 X.A.CycleWS cycle by tag group
Allow grouping of workspaces, so that a user can cycle through those in the same group. Grouping is done by using a special character in the tag.
2009-11-15 13:02:17 +00:00
Adam Vogt
b4acd87c7a Use less short names in X.Prompt 2009-11-15 02:56:47 +00:00
Adam Vogt
aa6f4882a4 Use io instead of liftIO in Prompt 2009-11-15 02:53:01 +00:00
Adam Vogt
ff11ae70a0 'io' and 'fi' are defined outside of Prompt 2009-11-15 02:40:01 +00:00
Adam Vogt
9cdcb7185f Use zipWithM_ instead of recursion in Prompt.printComplList 2009-11-15 02:34:51 +00:00
Adam Vogt
4f97bc02ce Minor style changes in DynamicWorkspaces 2009-11-15 02:27:51 +00:00
Anders Engstrom
b3329397c0 X.A.DynamicWorkspaces fix doc and add behaviour
Before this patch the documentation claims that it won't do anything on non-empty workspaces when it actually does. This patch fixes the documentation to reflect the actual behaviour, but also adds the behaviour promised by the documentation in other functions. It does not break configs. In addition it also provides functions to help removing empty workspaces when leaving them.
2009-11-13 23:39:03 +00:00
daniel
cb684763ce rework XMonad.Util.Dzen 2009-11-14 05:15:09 +00:00
daniel
db37e18098 generalize IO actions to MonadIO m => m actions
This should not cause any working configs to stop working, because IO is an instance of MonadIO, and because complete configs will pin down the type of the call to IO.  Note that XMonad.Config.Arossato is not a complete config, and so it needed some tweaks; with a main function, this should not be a problem.
2009-11-14 02:36:16 +00:00
daniel
7c363c82d3 fix documentation to match implementation 2009-11-14 02:13:28 +00:00
Adam Vogt
65d1309cf1 Bypass more of stringToKeysym in U.Paste 2009-11-14 22:37:26 +00:00
Adam Vogt
14f0f6129d Don't erase floating information with H.InsertPosition (Issue 334) 2009-11-13 16:14:02 +00:00
Adam Vogt
8cda47f19f Rename gridselectViewWorkspace to gridselectWorkspace, add another example.
The name should be more general to suggest uses other than just viewing other
workspaces.
2009-11-12 21:14:35 +00:00
Brent Yorgey
fdec915dda X.A.DynamicWorkspaces: fix addWorkspace and friends so they never add another copy of an existing workspace 2009-11-12 20:13:51 +00:00
Adam Vogt
eba5720d30 Trim whitespace in H.FloatNext 2009-11-11 02:27:02 +00:00
Adam Vogt
d606f998bd Use ExtensibleState in H.FloatNext 2009-11-11 02:25:13 +00:00
Adam Vogt
3102a69287 Make a haddock link direct in C.Desktop. 2009-11-11 01:38:10 +00:00
Adam Vogt
8dcd818586 Change A.TopicSpace haddocks to use block quotes. 2009-11-11 01:32:41 +00:00
Adam Vogt
60ae62e4e3 Add defaultTopicConfig, to allow adding more fields to TopicSpace later. 2009-11-11 01:29:15 +00:00
Spencer Janssen
3b82b8755e X.A.WindowGo: fix haddock markup 2009-11-11 00:32:56 +00:00
Daniel Schoepe
e14dcd9aa6 Minor style corrections in X.U.SpawnOnce 2009-11-09 20:15:43 +00:00
Daniel Schoepe
da094a635d Add gridselectViewWorkspace in X.A.GridSelect 2009-11-09 15:58:15 +00:00
`Henrique Abreu
77f916fa26 minor-doc-fix-in-ManageHelpers 2009-11-04 17:27:27 +00:00
Daniel Schoepe
5f4b9e8a19 Set buffering to LineBuffering in scripts/xmonadpropread.hs
(Required for the script to work properly with tools like dzen)
2009-11-08 20:41:06 +00:00
Spencer Janssen
a3fb5f5df1 X.U.ExtensibleState: style 2009-11-08 18:28:58 +00:00
Brent Yorgey
0efee8b0cb X.A.DynamicWorkspaces: new 'addWorkspacePrompt' method 2009-11-08 17:05:03 +00:00
Adam Vogt
71abbe457a Remove defaulting when using NoMonomorphismRestriction in H.EwmhDesktops 2009-11-07 19:52:55 +00:00
Adam Vogt
9cd4fccdc2 Update A.TopicSpace to use extensible state. No config changes required. 2009-11-07 19:45:02 +00:00
Adam Vogt
920bf15e04 Inline tupadd function in A.GridSelect 2009-11-01 19:03:12 +00:00
Spencer Janssen
54acce050f Alphabetize exposed-modules 2009-11-07 17:49:46 +00:00
Spencer Janssen
328fae1468 Use X.U.SpawnOnce in my config 2009-11-07 17:46:15 +00:00
Spencer Janssen
df7ac47317 Add XMonad.Util.SpawnOnce 2009-11-07 17:38:20 +00:00
Daniel Schoepe
86f6b327ae Store deserialized data after reading in X.U.ExtensibleState 2009-11-07 10:38:32 +00:00
Daniel Schoepe
8ec090cfbf Fixed conflict between X.U.ExtensibleState and X.C.Sjanssen 2009-11-07 10:36:19 +00:00
Daniel Schoepe
fa476549c2 Use X.U.ExtensibleState instead of IORefs
This patch changes SpawnOn, DynamicHooks and UrgencyHooks to
use X.U.ExtensibleState instead of IORefs. This simplifies the
usage of those modules thus also breaking current configs.
2009-11-06 11:56:01 +00:00
Daniel Schoepe
f71fdefdc7 Add X.U.ExtensibleState 2009-11-06 11:53:36 +00:00
Spencer Janssen
97a36b49a5 My config uses xmonadPropLog now 2009-11-07 00:52:30 +00:00
Spencer Janssen
1a8bdd4320 Add xmonadpropread script 2009-11-07 00:48:58 +00:00
Spencer Janssen
3f6787be4f Add experimental xmonadPropLog function 2009-11-07 00:46:24 +00:00
gwern0
2edac2fc13 XMonad.Actions.Search: imdb search URL tweak for bug #33 2009-11-03 22:23:30 +00:00
Adam Vogt
9f66ef9975 Clean imports for L.BoringWindows 2009-11-03 14:06:49 +00:00
Adam Vogt
4769530d9f I maintain L.BoringWindows 2009-11-03 14:05:09 +00:00
Tomas Janousek
bfdfb2297e fix window rectangle calculation in X.A.UpdatePointer 2009-10-26 15:49:18 +00:00
Adam Vogt
9180666302 Implement hasProperty in terms of runQuery in U.WindowProperties
This addresses issue 302 for unicode titles by actually using the complicated
XMonad.ManageHook.title code, instead of reimplementing it with stringProperty
(which doesn't appear to handle unicode).
2009-10-31 15:49:45 +00:00
Daniel Schoepe
9159b17cc8 Add functions to access the current input in X.Prompt 2009-10-30 23:50:33 +00:00
Spencer Janssen
41deac6194 Remove putSelection, fixes #317 2009-10-30 22:43:54 +00:00
Adam Vogt
a64d55f618 Fix typo in H.FadeInactive documentation 2009-10-29 16:57:36 +00:00
Anders Engstrom
b1ac0b5030 X.L.MultiCol constructor 0 NWin bugfig
Fix bug where the constructor did not accept catch-all columns. Also some minor cleaning.
2009-10-29 10:56:33 +00:00
Ismael Carnales
ccd71d4a15 X.H.ManageHelpers: added currentWs that returns the current workspace 2009-10-28 19:35:19 +00:00
Anders Engstrom
6e84273e03 X.L.MultiColumns bugfix and formating
Fix bug where a column list of insufficient length could be used to find the column of the window. Also fix formating to conform better with standards.
2009-10-27 13:17:41 +00:00
Anders Engstrom
3fd77f5386 X.L.MultiColumns NWin shrinkning fix
Fixed a bug where the list containing the number of windows in each column was allowed the shrink if a column was unused.
2009-10-27 00:59:32 +00:00
Anders Engstrom
95bada8d02 New Layout X.L.MultiColumns
New layout inspired the realization that I was switching between Mirror Tall and Mirror ThreeCol depending on how many windows there were on the workspace. This layout will make those changes automatically.
2009-10-24 17:51:55 +00:00
mail
0b9b98c06b Changing behaviour of ppUrgent with X.H.DynamicLog
Currently, the ppUrgent method is an addition to the ppHidden method.
This doesn't make any sense since it is in fact possible to get urgent
windows on the current and visible screens. So I've raised the ppUrgent
printer to be above ppCurrent/ppVisible and dropped its dependency on
ppHidden.

In addition to that this makes it a lot more easier to define a more
custom ppUrgent printer, since you don't have to "undo" the ppHidden
printer anymore. This also basicly removes the need for dzenStrip,
although I just changed the description.

-- McManiaC / Nils
2009-09-10 01:04:11 +00:00
Tomas Janousek
cdb1e6ef71 fix X.U.Run.spawnPipe fd leak 2009-10-25 21:02:46 +00:00
Spencer Janssen
6f6e9692c2 Bump version to 0.9 2009-10-26 00:48:50 +00:00
Wirt Wolff
beda65a760 README Update to point to wiki changelog, prettify 2009-10-24 20:35:50 +00:00
Wirt Wolff
79ab1d5de1 Doc namespace minor updates
Most signifigant changes are use unversioned links to external html,
fix a couple of key binding examples, and double quotes that should
have been single.
2009-10-23 18:49:05 +00:00
Wirt Wolff
06a1322366 Docs: use myLayout like template rather than plural
Despite myLayouts currently being more popular in examples, make
them all myLayout as in man/xmonad.hs to avoid mixing them in the
same module as was done a few places, leading to confusion for some users.
2009-10-23 04:26:51 +00:00
Spencer Janssen
5417286d6a Use 'ewmh' in relevant configs 2009-10-23 03:50:43 +00:00
Spencer Janssen
4832f0fc7d Add ewmh function to set all EWMH settings in one step 2009-10-23 03:46:30 +00:00
Adam Vogt
74a03cd8fb Refer to modm as the current modMask
This makes the config suggestions consistent with the current template.
2009-10-22 04:11:26 +00:00
Daniel Schoepe
9f16a427e6 Resolve conflicts between Justin Bogner's C.Desktop patch and latest head. 2009-10-22 11:58:49 +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
Wirt Wolff
6e91396fa5 C.Desktop fix bad escaping and typo 2009-10-22 10:01:56 +00:00
Wirt Wolff
0e713d57c1 C.Desktop doc explaining common desktop config customizations
To close http://code.google.com/p/xmonad/issues/detail?id=174
2009-10-22 04:27:48 +00:00
Daniel Schoepe
8f8e650537 Clean keymask in GridSelect(solves issue 318) 2009-10-21 22:34:04 +00:00
Adam Vogt
00bae8bafa Share one StdGen between RGB channels in A.RandomBackground 2009-10-20 16:59:24 +00:00
Adam Vogt
be635001de Document A.RandomBackground 2009-10-20 16:52:05 +00:00
Adam Vogt
3513c8386b Bump X11 dependency to 1.4.6.1, to access cursor definitions. 2009-10-20 16:19:14 +00:00
Wirt Wolff
6d4ad7f431 C.Gnome combine with instead of replace Desktop startupHook
Now that C.Desktop sets startupHook do both rather than only
gnomeRegister.
2009-10-20 09:20:10 +00:00
Adam Vogt
4abbb620a4 Remove H.SetCursor: U.Cursor is preferred 2009-10-19 23:57:22 +00:00
Adam Vogt
37a0dba16e Add some haddock formatting in U.Cursor 2009-10-19 23:30:36 +00:00
Andres Salomon
bcab2509d3 XMonadContrib: set the default cursor to left_ptr for the Desktop config 2009-09-15 16:57:53 +00:00
Andres Salomon
9ac6c9a24d XMonadContrib: add a utility module to set the default cursor
This adds XMonad.Util.Cursor, which defines a function that allows setting
the default mouse cursor.  This can be useful for (for example) gnomeConfig,
to ensure that the root cursor is changed from X_cursor to left_ptr.
2009-09-15 16:56:04 +00:00
Adam Vogt
45db2ebfbe More docs formatting in A.GridSelect 2009-10-16 20:31:32 +00:00
Adam Vogt
721cda38cc In A.GridSelect correct haddocks 2009-10-16 17:11:59 +00:00
Adam Vogt
f655307a1c Describe parameters to subLayouts more 2009-10-16 16:49:37 +00:00
Adam Vogt
8d4c0a5e13 Refer to modMask as modm in L.SubLayouts sample keybinds 2009-10-16 16:47:37 +00:00
Adam Vogt
f61ac3a174 Format L.SubLayout TODO 2009-10-16 15:58:37 +00:00
Adam Vogt
f28f32f7ed Add more links in L.SubLayout documentation 2009-10-16 15:55:18 +00:00
Adam Vogt
0e2aef4deb Link a screenshot in L.SubLayouts from the haskellwiki 2009-10-16 15:05:39 +00:00
Jan Vornberger
41a53e7d15 Added focusMaster to BoringWindows 2009-10-15 23:35:18 +00:00
Adam Vogt
ca29a33f56 Remove NamedFieldPuns from L.LimitWindows
This is more ugly, but otherwise we have lots of trouble for ghc-6.8
compatibility (due to the recomended flag having changed)
2009-10-15 01:01:23 +00:00
Max Rabkin
d330dcae24 added prop_select_two_consec to test_Selective.hs 2009-10-01 15:58:53 +00:00
Adam Vogt
6ef8fd353d Note L.Minimize in L.LimitWindows haddocks. 2009-10-14 20:53:26 +00:00
Max Rabkin
2b31698e15 Move limitSelect into L.LimitWindows 2009-10-14 20:22:13 +00:00
Max Rabkin
79eb2582c4 added haddocks for L.Selective 2009-10-02 11:27:20 +00:00
Max Rabkin
70e968c354 Support IncMasterN in Selective 2009-09-29 17:33:46 +00:00
Max Rabkin
adc029566e removed commented-out code 2009-09-29 16:35:09 +00:00
Max Rabkin
cd43a200bf Test that update preserves invariants of Selection 2009-09-29 16:31:39 +00:00
Max Rabkin
f0e835ebe2 move updateSel from test_Selective into Selective 2009-09-29 16:04:20 +00:00
Max Rabkin
831168d701 Add "Selective" layout modifier 2009-09-29 16:02:07 +00:00
Daniel Schoepe
064f117018 Filter extra modifier bits some layouts set in XMonad.Prompt 2009-10-12 13:28:14 +00:00
Adam Vogt
1edc2752c7 Cleanup L.BorderResize 2009-10-12 05:55:32 +00:00
Jan Vornberger
06998efa45 Layout modifier to resize windows by dragging their borders with the mouse 2009-10-11 22:22:14 +00:00
Adam Vogt
ec87f7d62d Add U.Replace which implements a --replace behavior. 2009-10-12 05:23:06 +00:00
Adam Vogt
5e0a65ea63 Update D.Extending module lists with help of a script (also added) 2009-10-12 04:49:18 +00:00
Adam Vogt
bf36bb785a Correct erroneous haddock link in U.XSelection 2009-10-12 04:31:33 +00:00
Adam Vogt
4b67243cac Make L.Mosaic explicit imports compatible with haskell-src-exts 2009-10-12 04:28:59 +00:00
Adam Vogt
a08fd578ee Put screenshots inline for L.ThreeColumns and L.Roledex 2009-10-12 04:26:51 +00:00
Adam Vogt
3e0be7dd1b Use LANGUAGE pragma instead of -fglasgow-exts in L.Minimize 2009-10-12 04:24:57 +00:00
Adam Vogt
f983084b63 Add a description to L.LayoutScreens 2009-10-12 04:22:31 +00:00
Adam Vogt
dc07d902d9 Add Portability and Stability boilerplate for a couple modules.
Needed for automating the generation of the Doc.Extending module summaries.
2009-10-12 04:10:55 +00:00
Adam Vogt
e0a5d16e40 Correct hyperlink in A.DeManage 2009-10-12 04:03:40 +00:00
Jan Vornberger
97537c8ad3 NoFrillsDecoration - most basic version of decoration for windows 2009-10-11 22:05:12 +00:00
Adam Vogt
a8677c001a Split A.TopicSpace documentation into sections 2009-10-12 00:47:30 +00:00
Adam Vogt
19b55d74a7 Use hyperlinks in WorkspaceCursors documentation. 2009-10-08 03:20:47 +00:00
Adam Vogt
9ba60f1952 Minor haddock formatting correction in L.Tabbed 2009-10-08 02:48:39 +00:00
Adam Vogt
eb10d679e6 Hyperlink the reference to ResizableTile in MouseResizableTile 2009-10-05 17:53:03 +00:00
Adam Vogt
f0925b5a28 Finish a sentence in H.ManageDocks haddocks. 2009-10-05 16:53:12 +00:00
Adam Vogt
63b6d7c225 Add a SetStruts message to H.ManageDocks.
This patch also uses Data.Set instead of [] for the AvoidStruts
constructor to simplify the SetStruts implementation.
2009-10-05 16:42:21 +00:00
Adam Vogt
1ef2eb63b9 Derive Enum for U.Types.Direction2D 2009-10-05 16:31:32 +00:00
Adam Vogt
e9a432298c Rearrange the GSCONFIG class in A.Gridselect 2009-10-05 02:32:27 +00:00
Adam Vogt
4509a8b696 Add a GSCONFIG class to overload defaultGSConfig.
This uses -XOverlappingInstances to provide a fallback instance which uses the
focusedBorderColor and normalBorderColor, but that part is optional.

User's configs should use -XNoMonomorphismRestriction if they want to avoid
writing a type signature for myGSConfig.

Also, type variables become ambiguous in expressions like:

> myGSConfig = defaultGSConfig { gs_navigate = neiu `M.union` gs_navigate defaultGSConfig }
>     where neiu = M.map (\(x,y) (a,b) -> (x+a,y+b)) $ M.fromList
>             [((0,xK_n),(-1,0)) ,((0,xK_e),(0,1)) ,((0,xK_i),(1,0)) ,((0,xK_u),(0,-1))]

But that can be resolved with the appropriate (`asTypeOf`myGSConfig) applied to
the second defaultGSConfig, or the use of some other method for modifying
existing fields.
2009-10-03 19:38:04 +00:00
Adam Vogt
fb7539d74b Add a screenshots section in the A.GridSelect haddocks 2009-10-04 16:08:16 +00:00
Jan Vornberger
ed43c38519 Fixed guard in WorkspaceByPos - condition got switched during transformation 2009-10-04 08:52:32 +00:00
Wirt Wolff
697f387a39 A.CycleWindows update docs, use lib fn second instead of custom lambda 2009-09-26 15:47:00 +00:00
Adam Vogt
0bb00440dc Group functions in GridSelect haddock, add an inline screenshot. 2009-10-03 18:19:27 +00:00
sean.escriva
097d7367bb minor hlint cleanup of Prompt and XMonad.Prompt.* sub-modules 2009-09-28 20:44:43 +00:00
mail
104cc6ba25 New module : X.H.SetCursor
Idea from Andres Salomon
(http://www.haskell.org/pipermail/xmonad/2009-September/008553.html).
2009-09-15 10:13:27 +00:00
Adam Vogt
f6fa7e509f Hyperlink modules named in WindowMenu, RestoreMinimized, and Minimize 2009-10-03 15:13:25 +00:00
Jan Vornberger
563266f3a5 Mention X.L.Maximize and X.L.Minimize in WindowMenu documentation 2009-10-03 11:13:30 +00:00
Adam Vogt
df9655c662 Small style change in L.SimplestFloat 2009-10-02 00:15:52 +00:00
Adam Vogt
27a7bcbd6e Use U.XUtils.fi to make WindowMenu clearer 2009-10-01 22:57:36 +00:00
Jan Vornberger
77f52bc84d Extended GridSelect
1) Added another convenience wrapper that allows to select an X() action
   from a given list.
2) Implemented the option to change the position of the selection diamond.
(Re-recorded from Bluetile repo, rebased to current darcs)
2009-09-30 15:27:41 +00:00
Jan Vornberger
832d435dee WindowMenu based on GridSelect that displays actions for the focused window (re-recorded from Bluetile repo). 2009-09-30 15:53:43 +00:00
Daniel Schoepe
066db410b0 Use default handler in XMonad.Prompt.eventLoop 2009-10-01 18:04:02 +00:00
Adam Vogt
66b8ad46d0 Remove redundant parentheses from L.MouseResizableTile 2009-09-30 21:21:10 +00:00
Adam Vogt
bf2fc75035 Use ErrorT instead of nested case for H.WorkspaceByPos 2009-09-30 20:49:14 +00:00
Adam Vogt
e6158615cb Note that ManageDocks is preferred to A.DeManage 2009-09-30 20:44:43 +00:00
Adam Vogt
cce2c7c839 Factor out redundancy in L.MouseResizableTile.handleResize 2009-09-30 20:41:51 +00:00
Jan Vornberger
41b58ed499 In a multi-head setup, move windows with a non-zero position upon creation to the right workspace.
Useful in a dual-head setup: Looks at the requested geometry of
new windows and moves them to the workspace of the non-focused
screen if necessary.
2009-09-30 12:33:41 +00:00
Adam Vogt
3bc9c11d97 Use LANGUAGE instead of -fglasgow-exts in L.MouseResizableTile 2009-09-30 20:04:43 +00:00
Adam Vogt
8aa3450f83 Remove redundant ($) in A.Commands 2009-09-30 20:03:11 +00:00
Adam Vogt
2d193a4304 Fix haddock parse error in MouseResizableTile 2009-09-30 20:01:43 +00:00
Jan Vornberger
5d949197b2 A ResizableTile-like layout that can be resized using the mouse.
All separations between windows can be dragged to modify the layout.
Keyboard commands can also be used to achieve the same effect.
2009-09-30 12:11:05 +00:00
Jan Vornberger
2b9b770e12 Replaced more stuff in X.L.Maximize with pure versions 2009-05-16 23:35:57 +00:00
Jan Vornberger
b5b9a3dc67 Expanded on X.L.Maximize functionality
1. Move maximized window into the background when it's not focused.
2. Changed semantics so that maximizing a different window will
   automatically restore the currently maximized window and maximize the
   new one (previously this had to be done in two seperate steps).
2009-05-03 00:10:52 +00:00
Jan Vornberger
5aa7d3635e EventHook to restore minimized windows from taskbar (re-recorded from Bluetile repo) 2009-09-28 23:15:49 +00:00
Jan Vornberger
218b041fa9 LayoutModifier to minimize windows (re-recorded from Bluetile repo) 2009-09-28 23:13:20 +00:00
Daniel Schoepe
2bebf54795 Correctly check completionKey field in XMonad.Prompt 2009-09-28 09:32:15 +00:00
Daniel Schoepe
bc00f63b79 Fix for issue 315 2009-09-28 09:19:46 +00:00
Daniel Schoepe
02eed22659 Only use search history for completion in X.A.Search 2009-09-20 22:14:55 +00:00
Daniel Schoepe
2733268980 Fix regression in XMonad.Prompt's completion 2009-09-20 20:57:11 +00:00
Daniel Schoepe
eac4b6a8d2 Clean keymask before use in XMonad.Prompt 2009-09-20 20:12:29 +00:00
Daniel Schoepe
d783e96352 Export moveCursor in XMonad.Prompt 2009-09-20 19:25:13 +00:00
Wirt Wolff
f98c0c83a1 U.EZConfig: Correct additionalKeysP M2-M5 values
Was 8,9,10,11,12 rather than needed 8,16,32,64,128
2009-09-06 07:05:03 +00:00
Daniel Schoepe
e2113acd35 Factor out direction types and put them in X.U.Types
This patch factors out commonly used direction types like
data Direction = Prev | Next
and moves them to X.U.Types.
2009-09-19 19:17:17 +00:00
Daniel Schoepe
33046439d6 Add function to disable focusFollowsMouse conditionally
This patch adds an event hook to have the focus follow the mouse only
if a given condition is true.
2009-08-29 21:29:16 +00:00
Daniel Schoepe
e8e6cfcc3a Make the keymap of XMonad.Prompt customizable
This patch allows the user to change the keymap XMonad.Prompt and
related modules use to be customized using the XPConfig structure.
2009-09-10 16:08:28 +00:00
Spencer Janssen
857bf537b5 Run gnomeRegister from startupHook 2009-09-18 02:34:10 +00:00
Adam Vogt
832ea65e75 Use U.Run.safeSpawn in C.Gnome 2009-09-17 23:39:53 +00:00
Adam Vogt
c4cae4839d Add gnomeRegister to C.Gnome.
Credit to Joachim Breitner here:
http://www.haskell.org/pipermail/xmonad/2009-May/007984.html
2009-09-17 23:21:50 +00:00
Adam Vogt
cbd978c3b5 Remove excess broadcastMessage ReleaseResources from A.Commands
XMonad.Operations.restart tells the layouts to release resources.  There's no
sense in duplicating it in contrib code anymore.
2009-09-04 01:02:59 +00:00
Adam Vogt
a9cb7bf67a Mark modules last-modified in 2007 as stable
http://www.haskell.org/pipermail/xmonad/2009-July/008328.html
2009-09-04 00:51:47 +00:00
Spencer Janssen
63e5b222b8 Minor changes to my config 2009-09-01 02:48:02 +00:00
Adam Vogt
c91f54b2fb Return True in X.H.FadeInactive.isUnfocused if current workspace is empty. (dschoepe) 2009-08-28 21:45:37 +00:00
Jan Vornberger
e80f1df518 Actually execute the correct command when giving user-defined commands to ServerMode 2009-08-25 23:38:28 +00:00
Adam Vogt
afecca6561 Preserve backwards compatibility with H.ServerMode 2009-08-25 22:03:48 +00:00
Daniel Schoepe
28e0adcde7 Let the user decide which commands to use in X.H.ServerMode 2009-08-25 10:16:30 +00:00
Daniel Schoepe
9a207f0512 Improve/correct documentation in X.A.TagWindows 2009-08-23 13:12:29 +00:00
Clemens Fruhwirth
491e21b3b9 Replace nextEvent with maskEvent to prevent GridSelect from swallowing unrelated events (such as map/unmap) 2009-08-09 13:10:55 +00:00
Daniel Schoepe
0ec25c9fee Better default for ppUrgent in xmobarPP
Most users would expect workspaces with urgent windows to be highlighted in
xmobar when they set up an UrgencyHook. Hence, doing this by default in xmobarPP
makes sense. (dzenPP does the same)
2009-08-22 18:34:16 +00:00
Daniel Schoepe
8b6135f868 Add backwards compatability in X.H.FadeInactive 2009-08-21 22:56:46 +00:00
Daniel Schoepe
8fe80758a8 More flexible interface for X.H.FadeInactive
This patch allows setting the opacity on a per-window basis and lets the
user specify it as a percentage instead of an Integer between 0 and 2^32-1.
2009-08-21 20:39:36 +00:00
Wirt Wolff
cc2fb2c10d U.Scratchpad: doc add disable-factory flag to gnome-terminal example
Few systems have --disable-factory on by default, but it's needed to
set custom resource string.
http://code.google.com/p/xmonad/issues/detail?id=308
2009-08-18 19:25:03 +00:00
Wirt Wolff
5daaf583b7 A.CycleWS: add toggleOrView fns, fix doc, prevent head exception 2009-08-17 21:55:49 +00:00
Adam Vogt
8be4946bcd Add -fwarn-tabs to ghc-options for the regular build 2009-08-14 02:21:08 +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
konstantin.sobolev
cb9ab874ce ScratchpadRewrite
Scratchpad reimplementation in terms of NamedScratchpad. No interface changes.
2009-04-28 20:01:36 +00:00
konstantin.sobolev
be2bbc9202 NS_Placement
Added ability to specify scratchpad manage hooks, mostly for defining window placement in a more flexible manner
2009-04-28 19:27:31 +00:00
Anders Engstrom
3bce490813 ThreeColMid - Swap slave window positions
This patch will swap the positions of the two slave windows and this will result in a more intuitive window order. When using focusDown beginning in the master pane we will move in the following graphical order 2->3->1->2->3 instead of 2->1->3->2->1. This is backwards from what is expected.

The small drawback is that increasing from 2 to 3 windows (and therefore also columns) will behave in a less intuitive way. The window in the right column will jump to the left of the screen.

I think that it is a good idea to make this change since I rely a lot on the window order but people using WindowNavigation may be of a different opinion.

An alternative is to add an option to select in what way to behave, but that could be overkill... I leave it up to discussion and devs to decide.
2009-05-03 19:50:26 +00:00
Brent Yorgey
d13551a49c fix UrgencyHook docs (\a -> \\a in Haddock) 2009-08-09 18:40:16 +00:00
gwern0
d38696bcd5 XMonad.Actions.Search: removeColonPrefix shouldn't throw an exception if no :! 2009-08-08 00:22:24 +00:00
gwern0
bf398ff356 XMonad.Actions.Search: clean up hasPrefix - dupe of Data.List.isPrefixOf 2009-08-08 00:21:20 +00:00
gwern0
41a63a5743 XMonad.Actions.Search: +wikt 2009-08-08 00:06:22 +00:00
quentin.moser
a4d5d7ff9b NoWrap export patch for use with X.L.MessageControl 2009-01-28 00:47:26 +00:00
quentin.moser
aca86af08a new XMonad.Layout.MessageControl module 2009-01-28 01:39:17 +00:00
Adam Vogt
d13dc2ff48 U.NamedActions: align the descriptions for each section, refactor its integration with EZConfig 2009-07-26 03:20:03 +00:00
Adam Vogt
b89dc9da44 U.NamedActions support subtitles bound to (0,0) unreachable normally 2009-05-25 00:29:15 +00:00
Adam Vogt
a3ba5f1503 Add U.NamedActions: present a list of keybindings including submaps 2009-05-04 02:40:17 +00:00
Adam Vogt
f22c4624a3 Revert to old behavior where unmatched keys do not exit the eventloop for A.GridSelect 2009-07-27 01:23:02 +00:00
Adam Vogt
b09827c2bc Share more mkAdjust calls L.LayoutHints in the LayoutHintsToCenter modifier 2009-07-26 06:18:02 +00:00
Adam Vogt
218595881f Make direction keybindings configurable in A.GridSelect 2009-07-26 02:04:38 +00:00
Anders Engstrom
f1ce4e5876 LayoutBuilder - make an example more sane 2009-05-13 15:57:32 +00:00
Khudyakov Alexey
c884dbb74b Clean Xkb masks in X.A.Submap
Xkb adds its own mask and prevent Submap keybindings from normal
functioning when alternate layout is used. This patch cleans
these masks.
2009-06-23 16:46:53 +00:00
Adam Vogt
fdaeaa18de Fix defaulting warning with A.RandomBackground 2009-07-16 23:49:55 +00:00
Juraj Hercek
4e3a4a2c8b Addition of Machine window property.
This patch adds WM_CLIENT_MACHINE property to window properties.
I can be used to distinguish windows run from different machines.
2009-07-15 10:50:53 +00:00
David Roundy
dd1dc7f2bc remove myself as maintainer from code I don't maintain. 2009-07-16 15:34:09 +00:00
wirtwolff
8addbabe49 X.A.CopyWindow: add wsContainingCopies, doc cleanup
Use wsContainingCopies in a logHook to highlight hidden workspaces
with copies of the focused window. (refactored from original by aavogt)
2009-07-03 01:15:24 +00:00
Daniel Schoepe
b805a6fa42 Add ability to copy the entered string in X.Prompt 2009-07-09 10:07:03 +00:00
Adam Vogt
2a73df7a45 Correct license for L.CenteredMaster
Context for why I've recorded the patch:
	aavogt | portnov: did you get the message about your XMonad.Layout.CenteredMaster licence being not compatible with the licence of contrib?
	portnov | aavogt: yep.  Could you change that yourself? I allow this to be distributed as bsd3. Making so small patch and sending it will get to much time :)
	portnov | *so
	aavogt | I can change it, its more about whether you would allow the change to be made                                                                       
	aavogt | but I guess this clears it up                                                                                                                       
	portnov | i allow.
2009-07-08 05:16:16 +00:00
Adam Vogt
5cd48cac7c Remove trailing whitespace from many modules 2009-07-05 20:12:05 +00:00
Adam Vogt
d65e40f09d Clarify documentation the Migrate message added to L.SubLayouts 2009-07-05 18:00:14 +00:00
Adam Vogt
f0c0f4d5c3 Reduce a bit of recently introduced duplication in L.SubLayouts 2009-07-05 17:51:45 +00:00
Adam Vogt
f8a4dd9503 Add Migrate message to L.SubLayouts, for better support of moving windows between groups 2009-07-05 17:49:34 +00:00
Adam Vogt
1f13242164 L.SubLayouts: also run the layout being modified in a restricted environment
This way, correct behavior can be expected if the layout runs ex. 'withWindowset
W.peek', instead of looking at its arguments.
2009-07-05 17:41:56 +00:00
Adam Vogt
48e74031f9 L.SubLayouts fix bug where previously run layouts would not get messages 2009-07-05 17:35:04 +00:00
Adam Vogt
99788c8780 Simplify A.WorkspaceCursors use of layout for state, add documentation 2009-07-05 05:06:29 +00:00
Adam Vogt
96a63b1dfa Add A.WorkspaceCursors, a generalization of Plane to arbitrary dimensions
This is implemented as a layoutModifier, since that way the workspace
arrangment is preserved between restarts.
2009-07-02 04:26:09 +00:00
Adam Vogt
9c3b472470 Refactor A.OnScreen to use Maybe Monad 2009-07-03 02:15:07 +00:00
mail
7e6fed9bf0 Added XMonad.Actions.OnScreen 2009-07-02 10:16:21 +00:00
Daniel Schoepe
02671904e1 Remove code duplication in X.A.CopyWindow 2009-07-02 10:49:33 +00:00
sean.escriva
7aafd381d3 Cleanup code duplication in X.P.Layout and X.P.Workspace 2009-07-01 21:56:40 +00:00
Brent Yorgey
a6c4f7659a X.A.Search: use the new canonical package URL for hackage search 2009-06-29 19:24:55 +00:00
Brent Yorgey
141c3cba96 X.H.ManageHelpers: add two new helper functions, doFloatDep and doFloatAt 2009-06-05 03:01:13 +00:00
Adam Vogt
1e1f2c6770 Keep track of whether messages should be given to new sublayouts in L.SubLayouts 2009-06-28 06:06:08 +00:00
Adam Vogt
1893d67d09 Run sublayouts in L.Sublayouts in a restricted state 2009-06-28 06:03:33 +00:00
Adam Vogt
a0ae1e8bba A.RandomBackground: Parameterize randomBg by a RandomColor data 2009-06-29 00:41:47 +00:00
Adam Vogt
32debd47e8 Add A.RandomBackground, actions to start terminals with a random -bg option 2009-06-27 20:27:55 +00:00
Adam Vogt
54f030faf8 Replace most -fglasgow-exts with specific LANGUAGE pragmas 2009-06-26 02:54:57 +00:00
portnov84
8362a5b81b Column_layout.dpatch
This module defines layot named Column. It places all windows in one
column. Windows heights are calculated from equation: H1/H2 = H2/H3 = ... = q,
where `q' is given (thus, windows heights forms a geometric progression). With
Shrink/Expand messages one can change the `q' value.
2009-06-05 18:45:15 +00:00
Brent Yorgey
6bd66b885a X.A.Search: add Google "I'm feeling lucky" search 2009-06-25 17:37:51 +00:00
Daniel Schoepe
dce0b17420 Add ifWindow and ifWindows and simplify WindowGo
This patch adds ifWindow and ifWindows as helper functions to
X.A.WindowGo and removes some boilerplate by rewriting other functions
in terms of those. Also some minor simplifications.
2009-06-24 23:17:11 +00:00
Adam Vogt
0cb6ac2910 Use -fwarn-tabs for test, remove tabs 2009-06-24 04:38:31 +00:00
Adam Vogt
2d84da7fdd From A.Topicspace split functions for storing strings with root to U.StringProp
These functions will be used to send strings for execution by command line, in
xmonad-eval
2009-06-23 05:25:37 +00:00
Adam Vogt
9847e0da5e Correct A.TopicSpace sample config 2009-06-23 00:39:37 +00:00
Adam Vogt
0f15f2fa7e Add shiftNthLastFocused to A.TopicSpace 2009-06-23 00:26:45 +00:00
Daniel Schoepe
5733601ad3 Generalize Actions.SpawnOn
Actions.SpawnOn can now be used to execute arbitrary manage hooks on
the windows spawned by a command(e.g. start a terminal of specific size
or floated).
2009-06-22 18:38:25 +00:00
gwern0
10c984ce44 update callers of safeSpawn 2009-06-22 20:14:23 +00:00
gwern0
65b8c39fe7 XMonad.Util.Run: improve definition so this can be used with emacs 2009-06-22 20:14:01 +00:00
gwern0
04f440d804 XMonad.Actions.WindowGo: switch to safeSpawn, since everyone just passes a prog name (no shell scripting) 2009-06-22 19:32:55 +00:00
gwern0
d4d17e6576 XMonad.Util.Run: +convenience function for safeSpawn which drops args to the prog 2009-06-22 19:30:18 +00:00
gwern0
e582ae5a4e XMonad.Actions.WindowGo: improve haddocks 2009-06-22 19:28:31 +00:00
Adam Vogt
41d8b2b22a Fix window ordering bug in L.LimitWindows 2009-06-22 00:43:09 +00:00
Adam Vogt
708b8a7d96 L.LimitWindows add usage information, functions to modify the limit 2009-06-22 00:01:15 +00:00
Dmitry Astapov
f541602f0b Expand Tabbed documentation to describe mouse clicks processing 2009-06-21 21:19:47 +00:00
Dmitry Astapov
be2be3f2f6 Close tabs by middle click on tab decoration
I'd better do it in xmonad.hs, but I can't decide what to expose from
Tabbed.hs to make it happed. Suggestions on how to make mouse click
handling hook a part of the Tabbed creation interface are very welcome
- my attempts turned out to be ugly in extreme.
2009-06-21 19:52:25 +00:00
Dmitry Astapov
54dc0ac732 Provide means to find original window by its decoration.
In order to enable user to write custom `decorationMouseFocusHook' and
`decorationMouseDragHook' hooks we need to provide him with means to
lookup original window by its decoration.

Module Decoration has internal function `lookFor' for exactly the same
purpose. I exported it under a slightly different name and without
exposing internals of DecorationState.
2009-06-21 19:46:52 +00:00
Adam Vogt
d823d9e68c Add L.LimitWindows layout modifier 2009-06-19 05:27:31 +00:00
Daniel Schoepe
1b521f0064 Remove Hooks.EventHook
The Hooks.EventHook module is superseded by handleEventHook from core and should no longer be needed.
2009-06-18 10:43:18 +00:00
Adam Vogt
00c3775a06 use 'take 1' instead of custom truncHead function in L.WindowNavigation 2009-06-18 01:01:18 +00:00
Adam Vogt
cc84480c99 Correct many typos in the documentation, consistent US spellingg 2009-06-18 00:37:29 +00:00
Joachim Breitner
6d0b082eb7 minor typo in ./XMonad/Layout/StackTile.hs 2009-06-17 21:03:45 +00:00
Brent Yorgey
67cdbb0ba8 X.L.ResizableTile: make sure windows aren't resized to a height larger than the screen (fixes #298) 2009-06-04 12:35:09 +00:00
Roman Cheplyaka
fc984af98d X.A.PhysicalScreens: fix typo 2009-06-02 17:21:48 +00:00
Roman Cheplyaka
9b7125f965 X.L.AutoMaster: fix warning 2009-06-02 17:17:54 +00:00
Ilya Portnov
85913caf2e AutoMaster.dpatch
Provides layout modifier AutoMaster. It separates screen in two parts -
master and slave. Size of slave area automatically changes depending on
number of slave windows.
2009-04-26 15:54:01 +00:00
Anders Engstrom
aa435aa5c8 UpdatePointer - Don't warp while dragging with mouse 2009-05-30 18:57:52 +00:00
Anders Engstrom
72e2c5d0b4 FlexibleResize - Resize from edge, don't move adjust at opposite edge
When resizing other corners than bottom-right, instead of adjusting to even columns/rows on the opposite side to it the same way as if resizing was made from the bottom right.

Also add the possibility to add an area in the middle of an edge where only that edge is resized, not the closest corner.
2009-05-30 18:54:37 +00:00
Khudyakov Alexey
eddd655b49 Remove USE_UTF8 defines.
They are not needed any more since utf8-string is mandatory dependence.
2009-04-19 13:09:09 +00:00
Anders Engstrom
c5b5db500b FloatSnap - calculate gaps instead of snapping against unmanaged windows
This patch will remove snapping against unmanaged windows, but instead calculate a new rectangle with all gaps (computed by ManageDocks) removed. This new rectangle is used to snap against. (Both the inside and outside of the rectangle.)

This will remedy the issue of snapping against multiple layers of the same window, additionally there will be no snap-points between windows on the same side. So if you are running two dzen side by side with half the screen each. You will not automatically have a snap-point in the middle.

Naturally, this patch will change which function is exported from ManageDocks.
2009-05-26 22:29:42 +00:00
Adam Vogt
f6479ee0a8 Fix L.Mosaic bug where stored [Rational] was not extended 2009-05-25 03:07:34 +00:00
Brent Yorgey
451ced82d9 X.A.Search: add Wolfram|Alpha search 2009-05-25 01:04:19 +00:00
Adam Vogt
3f3aff573a Remove L.ThreeColumnsMiddle compatiblity module
Signed off here too:
http://www.haskell.org/pipermail/xmonad/2009-May/007883.html
2009-05-25 00:32:45 +00:00
Adam Vogt
49bb2655ff A.FloatSnap snap to unmanaged docks too 2009-05-25 00:18:34 +00:00
Anders Engstrom
6703453f26 LayoutBuilder fix maintainer 2009-05-24 20:59:57 +00:00
Anders Engstrom
1fd4489ae6 FloatSnap fix maintainer 2009-05-24 20:58:54 +00:00
Anders Engstrom
bc425079f2 X.A.FloatSnap - More configuration for magic resize, adaption for mouse bindings and some minor fixes 2009-05-24 20:11:43 +00:00
Anders Engstrom
bd7e2004a0 X.A.FloatSnap - Assisted move/resize of windows
TODO: Try to snap against unmanaged windows such as dzen/xmobar.
2009-05-23 23:52:30 +00:00
Adam Vogt
160d961951 Simplyify L.Mosaic interface, and support resizing specific windows
The order previously was not as documented, which prevented resizing specific
windows.

The Mosaic constructor is hidden in favour of mosaic :: Rational -> [Rational] -> Mosaic a

Expand and Shrink messages are added, requiring another argument.

Remove useless demonstration of SlopeMod message since resizing the focused
window is better.
2009-05-24 19:38:10 +00:00
Adam Vogt
75cf2c1e30 L.ResizableTile document ResizableTall parameters with records 2009-05-19 02:42:58 +00:00
Adam Vogt
50c22cc05b L.LayoutHints, add layoutHintsToCentre
layoutHintsToCentre attempts to apply hints in a way that eliminates gaps
between windows. The excess space ends up on all edges.
2009-05-19 01:38:06 +00:00
Adam Vogt
9d27bdb17d Remove excess whitespace from L.LayoutHints 2009-05-19 01:33:50 +00:00
Brent Yorgey
2eb98c1437 new layout module X.L.Spacing, put blank space around each window 2009-05-14 21:55:52 +00:00
Anders Engstrom
a3f931262b X.L.LayoutBuilder doc fix and cleaning 2009-05-09 19:52:54 +00:00
Anders Engstrom
af22761a10 X.L.LayoutBuilder custom layouts
A layout combinator that sends a specified number of windows to one rectangle and the rest to another.
2009-05-09 17:46:27 +00:00
Anders Engstrom
823ea115ae submapDefault fix key leakage 2009-04-26 17:10:02 +00:00
Adam Vogt
ea61ad0f47 Fix typo in L.Mosaic hints 2009-05-08 20:29:37 +00:00
wirtwolff
071257d475 U.Loggers: add maildirNew, other loggers, and logger formatting utilities
Rework of the Logger portions of patches originally from seanmce33@gmail.com
to apply without conflicts, plus several formatting utilities for use with
X (Maybe String) aka Loggers.
2009-04-12 04:13:56 +00:00
Anders Engstrom
a5e11a14b6 ThreeCol - Update docs to match reality 2009-05-03 19:07:55 +00:00
Adam Vogt
99e839228e Remove some excess whitespace in XMonad.AppLauncher 2009-05-03 18:34:16 +00:00
Adam Vogt
cc0e18af8a Export ThreeColMid from L.ThreeColumnsMiddle
The configs that import it should continue to work with this module, though the
type of the ThreeColMid constructor is now ThreeCol (previously ThreeColMid).
2009-04-25 16:17:10 +00:00
Adam Vogt
7410b9826c ThreeColumns support middle column, with more backwards compatiblity 2009-04-14 06:18:19 +00:00
Anders Engstrom
71139c1fb3 X.L.ThreeColumnsMiddle merged into X.L.ThreeColumns with some new features 2009-04-11 11:36:36 +00:00
Anders Engstrom
561855133c nameTail - Remove the first word of a layout description 2009-05-03 10:59:50 +00:00
Adam Vogt
4a8c4b74ac Add H.InsertPosition: add new windows to different positions in a workspace 2009-05-03 02:03:03 +00:00
Adam Vogt
552b4f91ab Add changeMaster function to L.Mosaic 2009-05-01 23:31:36 +00:00
Adam Vogt
89c2ecb448 Optimizer bug does not affect 6.10.2 (issue 226) 2009-04-30 03:48:23 +00:00
Adam Vogt
06a997aaf9 Remove -XScopedTypeVariables requirement with L.SubLayouts
This should keep the code -Wall clean on ghc-6.8 in addition to ghc-6.10
2009-04-28 22:27:49 +00:00
Adam Vogt
115cd5af95 Add SubLayouts: a layout combinator for nesting layouts. 2009-04-23 01:31:35 +00:00
Adam Vogt
0dd1cf1ea8 Document and extend BoringWindows to support multiple sources of boring.
The Replace and Merge messages are added to support layouts sending a list of
windows that should be skipped over. The sources are tagged by a string key, so
it is possible though unlikely for different sources of boring windows to
interfere with eachother.
2009-04-06 04:13:01 +00:00
Adam Vogt
24b39a40cb Add Apply message to L.WindowNavigation 2009-03-03 06:57:01 +00:00
Nicolas Pouillard
b60cdb60f0 X.A.TopicSpace: remove the allTopics lists from the configuration. 2009-04-23 17:29:39 +00:00
perlkat
cc7d2140b7 added colour themes
These themes are colour themes only; they use the default font settings.
I thought the existing themes were rather dull, so these give more bright
(but tasteful) colours; shades of peacock feathers, shades of autumn.
2009-02-27 06:53:15 +00:00
sean.escriva
e780b6f81e Prompt.hs: setSuccess True also on Keypad Enter 2009-04-09 16:26:09 +00:00
Daniel Schoepe
5ce50a3cc0 Update focus on mouse moves within inactive windows
This patch adds functionality to update the focus on moves in unfocused windows, which would make sense if one wanted the focus to follow the mouse.
Currently this only happens when the mouse enters/leaves a window. 
This patch should fix issue #205.
2009-04-07 19:18:19 +00:00
Adam Vogt
6bcbd5b871 Add promoteWarp event to L.MagicFocus
This event enables A.UpdatePointer behavior without causing infinite loops in
combination with magicFocus
2009-03-22 22:14:56 +00:00
Adam Vogt
761b884555 Add TowardsCentre option to UpdatePointer
This option is like Nearest, but it places the pointer a configurable
percentage towards the centre of the window, instead of right at the edge.
2009-03-22 21:58:11 +00:00
Adam Vogt
3ad7661897 Remove excess whitespace in A.UpdatePointer 2009-03-22 21:55:53 +00:00
Anders Engstrom
6d205dda20 Combo fix ReleaseResources when no windows are available, new fix 2009-02-24 17:20:18 +00:00
portnov84
e0ca57557b OneBig_resize.dpatch
Add Shrink/Expand messages handling for OneBig layout.
2009-02-21 14:23:00 +00:00
portnov84
1c0d227c44 OneBig_layout.dpatch
Add the OneBig layout, which places one (master) window at top left corner of
screen (width and height of master window are parameters of layout), and other
(slave) windows at bottom and at right of master, trying to give equal space
for each slave window.
2009-02-20 17:26:34 +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
Khudyakov Alexey
13d8b17f97 Make utf8-string regular dependency
The reason for this is that EWMH specification require 
utf8 encoded strings.
2009-02-20 18:33:18 +00:00
Daniel Schoepe
6686d32f56 Update haddock description for Actions.GridSelect 2009-04-22 17:25:10 +00:00
sean.escriva
3184fd00c7 X.H.DynamicLog: provides trim, inverse of pad 2009-04-09 16:35:13 +00:00
Daniel Schoepe
e431c38c5e Mouse support for GridSelect
GridSelect now allows selecting an element by a click with the left mouse button.
2009-04-09 22:33:02 +00:00
Daniel Schoepe
156917209e Generalize GridSelect to arbitrary elements
This patch generalizes Actions.GridSelect to work for arbitrary (String,a)-lists. The changes break configurations that used `gridSelect' directly, which is now named gridSelectWindow. As an example for uses of the GridSelect-UI, I included a function to spawn an application from a list of commands(`spawnSelected').
2009-04-09 15:57:04 +00:00
quentin.moser
34147551ce Improve composability of X.H.Place, drop simple(st)Float support 2009-04-15 18:45:50 +00:00
quentin.moser
e772528912 Fixed X.H.Place.position 2009-04-09 08:49:46 +00:00
quentin.moser
43edb3a151 Module for automatic placement of floating windows 2009-04-08 08:09:53 +00:00
quentin.moser
1b82ccd21f X.H.FloatNext: new module, float the next spawned window(s) 2009-04-15 18:19:07 +00:00
konstantin.sobolev
af526ae23e ComboP 2009-04-15 01:43:27 +00:00
Nicolas Pouillard
0234f94be3 New module: XMonad.Actions.TopicSpace 2009-04-19 08:52:39 +00:00
konstantin.sobolev
5ad49783f2 NamedScratchpad 2009-04-19 04:55:42 +00:00
Adam Vogt
4cac1c6ebd More configurability for Layout.NoBorders (typeclass method)
This method uses a typeclass to pass a function to the layoutmodifier. It is
flexible, but a bit indirect and perhaps the flexibility is not required.
2009-03-25 05:02:06 +00:00
nelhage
93ed1c6019 Add XMonad.Actions.PhysicalScreens
Add an XMonad.Actions.PhysicalScreens contrib module that allows
addressing of screens by physical ordering, rather than the arbitrary
ScreenID.
2009-03-21 00:13:20 +00:00
Joachim Breitner
521bb48ad9 pointWithin has moved to the core 2008-10-08 15:42:45 +00:00
Joachim Breitner
15df01705f UpdatePointer even to empty workspaces
This makes UpdatePointer more Xinerama-compatible: If the user switches to a
screen with an empty workspace, the pointer is moved to that workspace, which I
think is expected behavoiur.
2008-10-07 08:00:41 +00:00
Norbert Zeh
ac8c6ab633 More predictable aspect ratio in GridVariants.Grid
The old version fairly arbitrarily decided to prefer windows that are too
high over those that are too wide.  The new version chooses the number of
columns so that all windows on the screen are as close as possible to the
desired aspect ratio.  As a side effect, the layout changes much more
predictably under addition and removal of clients.
2009-03-11 01:36:17 +00:00
Ismael Carnales
e8d80d552c X.L.Master: fix number of windows 2009-03-01 05:15:09 +00:00
wirtwolff
15217548ab U.EZConfig: add xK_Print <Print> to special keys
Many setups are expecting xK_Print rather than
xK_Sys_Req, so make it available in additionalKeysP.
2009-03-02 23:07:41 +00:00
Daniel Schoepe
fb7a2d4ae3 More flexibility for H.FadeInactive 2009-03-09 16:00:20 +00:00
Valery V. Vorotyntsev
75a3e2e290 Prompt.Shell: escape ampersand
Ampersand (&) is a special character and should be escaped.
2009-03-12 09:13:14 +00:00
Adam Vogt
a2846292bf Cleanup X.L.Mosaic, without breaking it 2009-02-19 02:24:17 +00:00
Adam Vogt
92aa7079ea X.L.Mosaic: prevent users from causing non-termination with negative elements 2009-02-10 02:27:27 +00:00
Adam Vogt
aa7dce7085 better Layout.NoBorders.smartBorders behavior on xinerama
Now smartBorders shows borders when you have multiple screens with one window
each. In the case where only one window is visible, no borders are drawn.
2009-03-14 17:00:58 +00:00
wirtwolff
ac60c04cb4 H.DynamicLog: revised dzenStrip and xmobarStrip functions
Reconcile darcswatch patch with pushed version of dzenStrip.
2009-03-14 04:15:17 +00:00
Braden Shepherdson
2a9c77aa71 X.H.DynamicLog: Add dzenStrip to remove formatting, for use in dzenPP's ppUrgent.
This function was written by Wirt Wolff. This change should allow UrgencyHook
to work out of the box with dzen and dzenPP, rather than the colours being
overridden so even though UrgencyHook is working, it doesn't change colours.
2009-03-14 03:28:18 +00:00
Roman Cheplyaka
98030cb415 X.H.ManageHelpers: export isInProperty 2009-03-08 20:11:12 +00:00
wirtwolff
1b682cbceb L.Cross: clarify documentation
Amend-record earlier patch to work with byorgey's fix,
this one is just the documentation typo fixes and 
clarifications.
2009-02-22 04:22:20 +00:00
daniel
edcba03217 documentation for IndependentScreens 2009-02-21 23:59:59 +00:00
daniel
04a5f4392e eliminate a haddock warning in BoringWindows 2009-02-21 23:58:36 +00:00
daniel
db4f731f4e merge IndependentScreens 2009-02-21 23:21:42 +00:00
daniel
57a62ce871 add IndependentScreens to xmonad-contrib.cabal 2009-02-21 23:16:32 +00:00
daniel
cf07f9caca add type information for IndependentScreens 2009-02-21 23:15:25 +00:00
Brent Yorgey
efc2f1160f add some boilerplate comments at the top of IndependentScreens 2009-02-21 23:08:50 +00:00
daniel
ffe5f0cf6f IndependentScreens, v0.0 2009-02-21 22:52:29 +00:00
wirtwolff
d6d03e84af U.Run: remove waitForProcess to close Issue 268
http://code.google.com/p/xmonad/issues/detail?id=268
Submitting with some trepidation, since I've nearly no
understanding of process handling. Should be ok, no 
warnings by sjanssen when asking about it in hpaste or
earlier email, and tested locally by spawning excessive
numbers of dzens: did not leave zombies or raise exceptions.
2009-02-20 21:41:53 +00:00
Brent Yorgey
ed1d90d322 change Cross data declaration into a record so that Haddock will parse the per-argument comments 2009-02-21 22:47:42 +00:00
Ismael Carnales
3285ac8bb4 X.L.Master: turn it to a Layout modifier and update the code 2009-02-13 02:04:53 +00:00
Spencer Janssen
27bbeff92c Use doShift in my config 2009-02-19 04:20:40 +00:00
Spencer Janssen
35c5e80c32 SpawnOn: use doShift. This resolves problems where SpawnOn would shift the wrong window 2009-02-19 04:18:56 +00:00
Spencer Janssen
a4f4c5bd39 SpawnOn: delete seen pids 2009-02-13 01:30:11 +00:00
Roman Cheplyaka
bbb0e97e61 X.U.Loggers: handle possible EOF (reported by dyfrgi) 2009-02-16 21:38:42 +00:00
wirtwolff
c1c5b8d08e U.Scratchpad: add general spawn action to close issue 249
Adds scratchpadSpawnActionCustom where user specifies how to set
resource to "scratchpad". This allows use of gnome-terminal, etc.
Add detail to RationalRectangle documentation; strip trailing spaces.
2009-02-14 00:36:42 +00:00
Spencer Janssen
cd86241cc9 SpawnOn: add 'exec' to shell strings where possible 2009-02-12 23:46:08 +00:00
'Luis Cabellos
6037b0db21 Add Cross Layout 2009-02-09 17:48:02 +00:00
Daniel Schoepe
7e1db48875 Fix an undefined in EwmhDesktops 2009-02-09 15:23:08 +00:00
Roman Cheplyaka
509e345947 X.U.WindowProperties: docs (description and sections) 2009-02-08 23:14:22 +00:00
Ismael Carnales
12939b6c1d X.U.WindowProperties: Add getProp32 and getProp32s, helpers to get properties from windows 2009-02-05 01:30:31 +00:00
Adam Vogt
aa1581b3d0 cleanup and make X.L.Mosaic behavior more intuitive wrt. areas 2009-02-08 22:16:29 +00:00
Joachim Breitner
b66d1aae33 minor typo in XMonad/Util/EZConfig.hs 2009-02-08 19:22:24 +00:00
Khudyakov Alexey
07793c1bc3 Multimedia keys support for EZConfig 2009-02-07 17:33:30 +00:00
wirtwolff
bd3c36d62e +A.CycleWindows: bindings to cycle windows in new ways
Provides binding actions and customizable pure stack operations
to cycle through a list of permutations of the stack (recent),
cycle nth into focus, cycle through focus excluding a neighbor,
cycle unfocused, shift a window halfway around the stack.
Esp. for Full, two or three pane layouts, but useful for any
layout with many windows.
2009-02-07 17:06:22 +00:00
gwern0
f80d3eb250 XMonad.Actions.CopyWindow: fmt & qualify stackset import 2009-02-06 17:18:33 +00:00
lan3ny
af08bec754 XMonad.Actions.CopyWindow runOrCopy 2008-06-02 20:57:42 +00:00
Ismael Carnales
9fc46d0dfd ManageHelpers: reduce duplicated code in predicates 2009-02-04 02:18:47 +00:00
Roman Cheplyaka
c1b9f308d9 Remove X.U.SpawnOnWorkspace (superseded by X.A.SpawnOn) 2009-02-04 10:36:35 +00:00
Roman Cheplyaka
fbb9605d76 X.A.SpawnOn: add docs
Add more documentation, including documentation from
X.U.SpawnOnWorkspace by Daniel Schoepe.
2009-02-04 10:24:24 +00:00
Spencer Janssen
54122382ed Remove silliness from XMonad.Doc.Configuring 2009-02-04 05:56:26 +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
quentin.moser
4700b44c2c Easier Colorizers for X.A.GridSelect 2009-01-28 00:17:02 +00:00
Roman Cheplyaka
b88f22fc36 X.A.SpawOn: fix usage doc 2009-02-02 10:20:42 +00:00
Norbert Zeh
d4a0bbbe2c Added GridVariants.SplitGrid
GridVariants.TallGrid behaved weird when transformed using Mirror
or Reflect.  The new layout SplitGrid does away with the need for
such transformations by taking a parameter to specify horizontal
or vertical splits.
2009-01-29 15:21:46 +00:00
Ismael Carnales
31110d1b45 FixedColumn: added missing nmaster to the usage doc 2009-01-30 19:52:39 +00:00
gwern0
3c0f793e4a XMonad.Actions.Search: fix whitespace & tabs 2009-01-29 02:52:46 +00:00
Michal Trybus
794f70fb04 xmonad-action-search-intelligent-searchengines
Changed the XMonad.Action.Search to use a function instead of String to prepare the search URL.Added a few useful functions used to connect many search engines together and do intelligent prefixed searches (more doc in haddock)The API has not changed with the only exception of search function, which now accepts a function instead of String.
2009-01-28 10:19:38 +00:00
quentin.moser
cfbee439a1 XMonad.Prompt autocompletion fix 2009-01-27 18:41:45 +00:00
Brent Yorgey
869a3d4a1e X.A.SinkAll: re-add accidentally deleted usage documentation 2009-01-27 22:25:33 +00:00
Brent Yorgey
d1e2991ccf move XMonad.Actions.SinkAll functionality to more general XMonad.Actions.WithAll, and re-export sinkAll from X.A.SinkAll for backwards compatibility 2009-01-27 22:23:55 +00:00
loupgaroublond
3022e3c937 adds generic 'all windows on current workspace' functionality 2008-12-21 22:48:50 +00:00
quentin.moser
01e0a42c17 placement patch to XMonad.Layout.LayoutHints 2009-01-26 19:59:50 +00:00
quentin.moser
eed05efeab XMonad.Actions.MessageFeedback module 2009-01-26 18:10:59 +00:00
Anders Engstrom
b39dfa1917 submapDefault
Add support for a default action to take when the entered key does not match any entry.
2009-01-18 15:29:33 +00:00
Roman Cheplyaka
b3822c6faa X.A.CycleWS: convert tabs to spaces (closes #266) 2009-01-27 18:56:04 +00:00
Adam Vogt
9826ade99e Mosaic picks the middle aspect layout, unless overriden 2009-01-26 03:24:21 +00:00
Adam Vogt
f22c6aa144 Mosaic: stop preventing access to the widest layouts 2009-01-25 04:52:56 +00:00
Adam Vogt
b7872f77f7 X.L.Mosaic add documentation, update interface and aspect ratio behavior 2009-01-25 04:12:29 +00:00
Spencer Janssen
c1f1f27da0 Use currentTag, thanks asgaroth 2009-01-25 21:33:31 +00:00
Daniel Schoepe
70e9b9b2d6 Support for spawning most applications on a specific workspace 2009-01-25 19:10:45 +00:00
Roman Cheplyaka
22a7c39107 X.L.Mosaic: haddock fix 2009-01-24 23:59:08 +00:00
Adam Vogt
5c849c1fc6 A mosaic layout based on MosaicAlt
The position of a window in the stack determines its position and layout. And
the overall tendency to make wide or tall windows can be changed, though not
all of the options presented by MosaicAlt can be reached, the layout changes
with each aspect ratio message.
2009-01-24 02:20:58 +00:00
Spencer Janssen
e78cad6f90 uninstallSignalHandlers in spawnPipe 2009-01-22 00:27:45 +00:00
Spencer Janssen
69a75d863e Create a new session for spawnPiped processes 2009-01-22 00:04:41 +00:00
Spencer Janssen
b456b87e0e TAG 0.8.1 2009-01-18 22:06:47 +00:00
Spencer Janssen
da2a08ec7e Use spawnOn in my config 2009-01-17 04:10:26 +00:00
Spencer Janssen
c51f64476a Add XMonad.Actions.SpawnOn 2009-01-17 04:04:32 +00:00
Spencer Janssen
d1b2eb4bbb Bump version to 0.8.1 2009-01-16 22:36:07 +00:00
Spencer Janssen
03513bb9b4 Compile without optimizations on x86_64 and GHC 6.10
This is a workaround for http://xmonad.org/bugs/226
2009-01-08 23:16:50 +00:00
Spencer Janssen
0272b8e468 Update all uses of doubleFork/waitForProcess 2009-01-16 21:03:15 +00:00
Spencer Janssen
b1984eef30 Update to my config 2009-01-16 20:45:53 +00:00
Daniel Schoepe
deacde29a0 Adjustments to new userCode function 2009-01-10 22:13:10 +00:00
Brent Yorgey
22ea09d747 X.U.EZConfig: expand documentation 2009-01-16 15:31:43 +00:00
Brent Yorgey
2786791ff5 add a bit of documentation to HintedTile 2009-01-14 06:51:26 +00:00
johanngiwer
021298cb34 ManageHelpers: add isDialog 2009-01-08 23:25:05 +00:00
portnov84
f885e942e9 CenteredMaster
centerMaster layout modifier places master window at top of other, at center of screen. Other windows are managed by base layout.
topRightMaster is similar, but places master window at top right corner.
2009-01-11 13:45:13 +00:00
gwern0
b5d77062b9 XMonad.Util.XSelection: update maintainer information 2009-01-10 21:30:00 +00:00
Brent Yorgey
bcec549103 X.U.XSelection: get rid of warning about missing newline, add Haddock link 2009-01-02 19:43:57 +00:00
loupgaroublond
d889c531d0 adds haddock documentation for transformPromptSelection
also renames the function per mailing list recommendation
2009-01-02 19:09:54 +00:00
loupgaroublond
44b9610906 adds a weird function to XSelection
This enables you to pass a function of (String -> String) to a selection function to modify the string before executing it.  This way, you can input your own escape routines to make it shell command line safe, and/or do other fancier things.
2008-12-22 02:07:30 +00:00
xmonad
f3617e75c5 ThreeColumnsMiddle 2009-01-02 09:10:19 +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
Dominik Bruhn
3ac1205411 Prompt: Change Filemode to 600 for history-file (fixes bug 244) 2008-12-18 00:16:01 +00:00
Roman Cheplyaka
ed240c6972 X.L.Monitor: changes in message passing
- transform mbName (Maybe String) to name (String)
- slghtly change semantics of messages, document it
2008-12-26 22:08:51 +00:00
Roman Cheplyaka
d44ca42551 X.L.Monitor: change interface
- remove add*Monitor
- add manageMonitor, monitor template
2008-12-26 21:31:18 +00:00
Roman Cheplyaka
fc581c9e4a X.U.WindowProperties: propertyToQuery+docs 2008-12-25 08:07:02 +00:00
Roman Cheplyaka
c5af703cb8 X.L.Monitor: docs 2008-12-25 07:39:04 +00:00
gwern0
42692986e6 hlintify XUtils, XSelection, Search, WindowGo 2008-12-20 15:33:02 +00:00
Norbert Zeh
88e524f480 fix focus issue for XMonad.Actions.Warp.banishScreen
This patch ensures that the focus (or in fact the whose windowset)
does not change as a result of a banishScreen.  The way this is implemented
will become problematic if xmonad ever goes multithreaded.
2008-12-12 20:35:32 +00:00
Norbert Zeh
4c7ebafcfe addition of XMonad.Actions.Warp.banishScreen
This works on top of warpToScreen and, thus, suffers from the same issue:
focus change.
2008-12-12 19:26:21 +00:00
Norbert Zeh
fe253a602c fixed documentation for banish
banish actually warps to the specified corner of the current window, not
the screen.
2008-12-12 19:18:19 +00:00
Norbert Zeh
52379a3736 addition of combined TallGrid layout
Added a module XMonad.Layouts.GridVariants, which defines layouts
Grid and TallGrid.  The former is a customizable version of Grid.  The latter
is a combination of Grid and Tall (see doc of the module).
2008-12-12 18:48:36 +00:00
Justin Bogner
a11a42b2a5 Add FixedColumn, a layout like Tall but based on the resize hints of windows 2008-12-13 07:30:54 +00:00
gwern0
afa80ad2a2 XMonad.Actions.WindowGo: fix a floating-related focus bug
If a floating window was focused, a cross-workspace 'raise' would cause a loop of
shifting windows. Apparently the problem was 'focus' and its mouse-handling. Spencer
suggested that the calls to focus be replaced with 'focusWindow', which resolved it.
2008-12-05 15:07:55 +00:00
gwern0
ef310e1792 Prompt.hs: +greenXPConfig and amberXPConfig 2008-11-19 21:31:22 +00:00
gwern0
8afb72a48e Prompt.hs: increase font size to 12 from niggardly 10 2008-11-19 21:25:23 +00:00
gwern0
a521838fac Prompt.hs: replace magic numbers with understandable names 2008-11-19 21:25:02 +00:00
Roman Cheplyaka
8698e58f12 X.L.Monitor: recommend doHideIgnore (docs) 2008-12-15 19:07:10 +00:00
Roman Cheplyaka
99f04b7504 X.L.Monitor: docs 2008-12-15 18:44:23 +00:00
Roman Cheplyaka
f365c082ba X.L.Monitor: export Monitor datatype 2008-12-15 18:43:18 +00:00
Roman Cheplyaka
601c3c06db X.H.ManageHelpers: add doHideIgnore 2008-12-15 18:27:58 +00:00
Spencer Janssen
9d0f34852c Add KDE 4 config, thanks to Shirakawasuna on IRC 2008-12-11 07:11:41 +00:00
Spencer Janssen
293b8152aa I use the deleteConsecutive history filter 2008-10-25 07:04:38 +00:00
Braden Shepherdson
1d78c1fd60 Remove XMonad.Config.PlainConfig, it has been turned into the separate xmonad-light project. 2008-12-03 16:15:34 +00:00
gwern0
96786e0abd XMonad.Prompt: swap up and down per bug #243 2008-12-03 01:33:23 +00:00
Aleksandar Dimitrov
78a9495c03 Fix boolean operator precedence in GridSelect keybindings
The vim-like hjkl keys were ORed to the key event AND arrow keys.
2008-12-01 12:09:28 +00:00
sean.escriva
0462f00f42 GridSelect.hs: navigate grid with h,j,k,l as well as arrow keys 2008-11-22 08:47:25 +00:00
Roman Cheplyaka
3b4473f121 Export setOpacity from FadeInactive. Document how to make monitor transparent (X.L.Monitor) 2008-11-17 15:30:27 +00:00
Roman Cheplyaka
6962d8f216 Monitor: use broadcastMessage instead of sendMessage; this solves several issues 2008-11-17 13:39:57 +00:00
Roman Cheplyaka
0a935aff63 FadeInactive: fade all inactive windows (including focused windows on visible screens) 2008-11-17 13:01:15 +00:00
Roman Cheplyaka
642cbdcad6 Monitor: documented one more issue 2008-11-17 11:38:07 +00:00
Roman Cheplyaka
1a6c11e8e6 Monitor: improved the docs 2008-11-17 07:37:09 +00:00
Roman Cheplyaka
8cc3556448 added XMonad.Layout.Monitor 2008-11-15 10:47:35 +00:00
Roman Cheplyaka
d043dfbaf9 WindowProperties: added allWithProperty 2008-11-15 10:45:25 +00:00
Roman Cheplyaka
565dd89ebe ManageHelpers: added doSideFloat (generalization of doCenterFloat) 2008-11-14 11:30:15 +00:00
Dominik Bruhn
20119ffa7a GridSelect: Export default_colorizer 2008-11-12 14:00:05 +00:00
Dominik Bruhn
7337ce50c2 Simplify code for restriction-calculation and remove compiletime warnings 2008-11-12 13:46:30 +00:00
Clemens Fruhwirth
cbc978936e Simplify handle/eventLoop, introduce findInWindowMap, partial updates for key movements (less flickering)
* handle/eventLoop carried the display and the drawing window as
  parameters. The display is available from the embedded X monad, the
  drawing windows was added.

* updateWindows now takes a list of windows to
  update. updateAllWindows updates all windows.

* only the windows that are modified by key movements are redrawn
  now. This means less flickering.
2008-11-11 10:04:05 +00:00
Roman Cheplyaka
80618c53c1 GridSelect: force cursor stay in visible area 2008-11-11 06:33:48 +00:00
Roman Cheplyaka
4908cc5efb GridSelect: fix infiniteness problem with diamondRestrict 2008-11-11 05:53:50 +00:00
Roman Cheplyaka
a5ffb70fc6 GridSelect: remove tabs 2008-11-11 05:36:47 +00:00
Roman Cheplyaka
dcde384f1a Exported shrinkWhile from Decoration to use in GridSelect 2008-11-10 19:15:34 +00:00
Roman Cheplyaka
e3503bc3f2 GridSelect: added link to a screenshot 2008-11-10 19:06:17 +00:00
Roman Cheplyaka
1415787fa3 GridSelect: various improvements
Added documentation
Restricted export list for the sake of haddock
Added functions:
  withSelectedWindow
  bringSelected (by Clemens Fruhwirth)
  goToSelected (by Dominik Bruhn)
2008-11-10 18:46:44 +00:00
Clemens Fruhwirth
de64bf60b4 Initial version of GridSelect.hs with a lot room for improvement/cleanups 2008-11-07 11:51:14 +00:00
sean.escriva
7749dc92d5 documentation: XMonad.Util.Search.hs, add EZConfig keybindings example 2008-11-06 17:17:07 +00:00
Don Stewart
9d2a5d4acc typo 2008-11-04 04:30:44 +00:00
Don Stewart
b6164c6ddc place an upper bound on the version of base we support 2008-11-04 03:58:57 +00:00
Don Stewart
c40d8c2f3d explicit import list for things in the process library 2008-11-04 03:53:19 +00:00
Don Stewart
b6c951a30c Work around ghc 6.10 bug #2738 2008-11-04 03:48:19 +00:00
deadguysfrom
2520104b1e windowPromptBringCopy 2008-10-23 17:30:19 +00:00
Travis B. Hartwell
b849ccb29e generic menu and window bringer 2008-10-27 00:55:23 +00:00
gwern0
1e30ffe2c6 Search.hs: +hackage search, courtesy of byorgey 2008-10-31 21:49:37 +00:00
gwern0
f0259987b1 Prompt.hs rename deleteConsecutiveDuplicates
That name is really unwieldy and long.
2008-10-08 20:51:31 +00:00
gwern0
c27eb22b39 Prompt.hs: have historyCompletion filter dupes
Specifically, it calls deleteConsecutiveDuplicates on the end product. uniqSort reverses order in an unfortunate way, so we don't use that.
The use-case is when a user has added the same input many times - as it stands, if the history records 30 'top's or whatever, the completion will show 30 'top' entries! This fixes that.
2008-10-08 20:47:10 +00:00
gwern0
a0ac6331df Prompt.hs: tweak haddocks 2008-10-08 20:46:49 +00:00
gwern0
806c1f4b5f Prompt.hs: mv uniqSort to next to its confreres, and mention the trade-off 2008-10-08 19:26:45 +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
daniel
a2cf9d4d97 let MagnifyLess actually magnify less 2008-10-15 15:39:11 +00:00
intrigeri
9d409b6b3d Actions.Search: add a few search engines
Add Debian {package, bug, tracking system} search engines, as well as Google
Images and isohunt.
2008-10-08 10:40:33 +00:00
Joachim Breitner
5f361b02af Implement HiddenNonEmptyWS with HiddenWS and NonEmptyWS
(Just to reduce code duplication)
2008-10-06 21:10:27 +00:00
Joachim Breitner
5514c2ddca Add straightforward HiddenWS to WSType
With NonEmptyWS and HiddenNonEmptyWS present, HiddenWS is obviously missing.
2008-10-06 21:05:48 +00:00
Joachim Breitner
2480ba1f02 Merge emptyLayoutMod into redoLayout
This removes the emptyLayoutMod method from the LayoutModifier class, and
change the Stack parameter to redoLayout to a Maybe Stack one. It also changes
all affected code. This should should be a refactoring without any change in
program behaviour.
2008-10-05 19:02:20 +00:00
Joachim Breitner
2102a565fd SmartBorders even for empty layouts
Fixes: http://code.google.com/p/xmonad/issues/detail?id=223
2008-10-05 18:44:26 +00:00
gwern0
2051b80b25 Paste.hs: improve haddocks 2008-09-27 15:01:58 +00:00
gwern0
e8edf860f7 Paste.hs: fix haddock 2008-09-27 14:52:38 +00:00
daniel
95c8fa2d1d minor explanatory comment 2008-10-03 01:59:19 +00:00
Lukas Mai
a667fa5720 XMonad.Layout.HintedGrid: add GridRatio (--no-test because of haddock breakage) 2008-09-30 14:17:15 +00:00
Lukas Mai
31fd3135cf XMonad.Util.Font: UTF8 -> USE_UTF8 2008-09-30 14:00:56 +00:00
gwern0
300d9cf2b7 Paste.hs: implement noModMask suggestion 2008-09-26 23:20:56 +00:00
daniel
b663075990 fix a divide by zero error in Grid 2008-09-26 20:41:48 +00:00
gwern0
b0c3dcc192 -DUTF8 flag with -DUSE_UTF8 2008-09-21 15:40:14 +00:00
gwern0
07e9192f6f XSelection.hs: use CPP to compile against utf8-string 2008-09-20 15:16:15 +00:00
Devin Mullins
205032840b add XMonad.Config.Azerty 2008-09-24 04:49:46 +00:00
Devin Mullins
ae57d452be flip GridRatio to match convention (x/y) 2008-09-22 03:33:54 +00:00
daniel
bf51c0f64c let Grid have a configurable aspect ratio goal 2008-09-22 01:09:50 +00:00
gwern0
8971328f06 Paste.hs: +warning about ASCII limitations 2008-09-21 15:50:38 +00:00
gwern0
38a21daefe Paste.hs: shorten comment lines to under 80 columns per sjanssen 2008-09-21 15:49:50 +00:00
Spencer Janssen
9476610ee0 Forgot to enable historyFilter :( 2008-09-21 09:42:54 +00:00
Spencer Janssen
2d5b9475b9 Prompt: add configurable history filters 2008-09-21 09:34:53 +00:00
Spencer Janssen
005f4ef7fb Update my config to use 'statusBar' 2008-09-21 06:35:13 +00:00
Spencer Janssen
1c1205daed Rename pasteKey functions to sendKey 2008-09-21 06:20:16 +00:00
Spencer Janssen
505cbb2430 DynamicLog: doc fixes 2008-09-21 06:13:14 +00:00
Spencer Janssen
2477985387 Move XMonad.Util.XPaste to XMonad.Util.Paste 2008-09-21 06:09:47 +00:00
Spencer Janssen
8d670902e5 Depend on X11 >= 1.4.3 2008-09-21 05:54:56 +00:00
Spencer Janssen
c75b058c5b statusBar now supplies the action to toggle struts 2008-09-18 01:38:58 +00:00
Devin Mullins
f3b6b2707a cleanup - use currentTag 2008-09-21 01:11:59 +00:00
gwern0
bd2b5379ab XPaste.hs: improve author info 2008-09-20 15:23:42 +00:00
gwern0
4ae4a7ec07 +XMonad.Util.XPaste: a module for pasting strings to windows 2008-09-20 15:21:06 +00:00
Devin Mullins
9dd5fff540 UrgencyHook bug fix: cleanupUrgents should clean up reminders, too 2008-09-20 06:21:17 +00:00
Spencer Janssen
026fdf71be Sketch of XMonad.Config.Monad 2008-09-17 08:18:38 +00:00
seanmce33
10be813bd7 raiseMaster 2008-09-12 18:48:30 +00:00
Daniel Neri
63a0177187 Add missing space between dzen command and flags 2008-09-15 13:10:09 +00:00
Spencer Janssen
2d1ccbe643 Big DynamicLog refactor. Added statusBar, improved compositionality for dzen and xmobar
Compatibility notes:
    - dzen type change
    - xmobar type change
    - dynamicLogDzen removed
    - dynamicLogXmobar removed
2008-09-13 20:59:31 +00:00
Spencer Janssen
03caedc589 Take maintainership of XMonad.Prompt 2008-09-11 23:04:42 +00:00
Spencer Janssen
e677bb3cc1 Overhaul Prompt to use a zipper for history navigation. Fixes issue #216 2008-09-11 22:59:40 +00:00
Spencer Janssen
644b85ab36 Use the new completion on tab setting 2008-09-11 08:59:40 +00:00
Joachim Breitner
587078d456 Only start to show the completion window with more than one match 2008-09-08 11:01:29 +00:00
Joachim Breitner
25033caf6e XPrompt: Add showCompletionOnTab option
This patch partially implements
http://code.google.com/p/xmonad/issues/detail?id=215
It adds a XPConfig option that, if enabled, hides the completion window
until the user presses Tab once. Default behaviour is preserved.
TODO: If Tab causes a unique completion, continue to hide the completion
window.
2008-09-08 10:57:58 +00:00
Marco Túlio Gontijo e Silva
a908ff760b XMonad.Actions.Plane.planeKeys: function to make easier to configure 2008-07-14 15:36:01 +00:00
Marco Túlio Gontijo e Silva
07a5355edc XMonad.Actions.Plane: removed unneeded hiding 2008-07-14 15:26:31 +00:00
Marco Túlio Gontijo e Silva
289b994646 Improvements in documentation 2008-07-09 00:24:25 +00:00
Spencer Janssen
297e626fc7 Fix haddock typos in XMonad.Config.{Desktop,Gnome,Kde} 2008-09-11 04:08:08 +00:00
Devin Mullins
c3d5c09e84 add clearUrgents for your keys 2008-09-09 05:54:25 +00:00
Devin Mullins
27efc7a626 add reminder functionality to UrgencyHook
I'm considering rewriting remindWhen and suppressWhen as UrgencyHookModifiers, so to speak. Bleh.
2008-08-24 20:05:48 +00:00
Spencer Janssen
25896cd43d Bump version to 0.8 2008-09-05 19:44:15 +00:00
Devin Mullins
7325062ccf Take maintainership of X.L.WindowNavigation
Since I've been working on a rewrite, it seems only fair that I be forced to
better understand the existing code / issues.
2008-09-02 07:02:47 +00:00
Spencer Janssen
df58a90077 Take maintainership of NoBorders 2008-08-29 20:13:25 +00:00
Joachim Breitner
9dae24bfd8 Only move pointers over managed windows 2008-06-10 19:59:16 +00:00
robreim
9515818409 Fix window region checking in UpdatePointer 2008-05-11 09:40:56 +00:00
David Roundy
1f2162781f remove myself as maintainer from modules I don't maintain or use. 2008-08-28 15:18:30 +00:00
Devin Mullins
4d2365734d change withUrgencyHookC api
Now it takes an UrgencyConfig record type.
2008-08-21 05:20:46 +00:00
Spencer Janssen
1df08883b8 Accept a range of xmonad versions 2008-08-20 21:40:56 +00:00
acura
79b0c3401a StackTile_fix 2008-08-20 06:19:18 +00:00
Devin Mullins
bfc265d663 X.H.UrgencyHook: haddock fixes 2008-08-16 19:52:20 +00:00
Spencer Janssen
26e40e555e Improve documentation for XMonad.Hooks.EwmhDesktops 2008-08-13 19:18:57 +00:00
Devin Mullins
e58933b9c1 simplify WindowBringer code, and change greedyView to focusWindow 2008-08-11 03:31:37 +00:00
Spencer Janssen
1c03ecc596 Updates to my config 2008-08-12 05:01:24 +00:00
Braden Shepherdson
1a9af96070 Added XMonad.Hooks.DynamicHooks
Allows runtime creation and modification of ManageHooks. Also allows one-shot
ManageHooks that are removed after the fire. Note that if several transient
hooks fire at once, only the most recently defined is executed, and all
are removed.
2008-07-24 22:20:54 +00:00
gwern0
8aa2076a45 XMonad.Hooks.UrgencyHook: +FocusHook
This is a hook for simply traveling to whatever window has just set an urgent flag, instead of doing something more involved like printing to a status bar and letting the user do something manually.
2008-07-16 22:47:45 +00:00
Lukas Mai
e9980e2052 Grid/HintedGrid: prefer wider windows 2008-07-17 20:51:38 +00:00
Spencer Janssen
94101637c9 I prefer the spencerjanssen@gmail.com address 2008-07-14 20:40:05 +00:00
Devin Mullins
cfaadb644e callUrgencyHook after adjustUrgents
So folks can readUrgents inside their urgencyHook, should they so desire.
2008-07-14 04:30:20 +00:00
gwern0
ed49f823d0 XMonad/Doc/Developing.hs: update haddock ln, cpedit 2008-07-08 20:50:58 +00:00
gwern0
f29f38fbeb XMonad/Doc.hs: why link to a specific version instead of the latest? 2008-07-08 20:22:36 +00:00
leoserra
f06a147057 XMonad.Actions.Plane.Linear 2008-07-06 17:53:03 +00:00
Marco Túlio Gontijo e Silva
e0ebbc1ea8 XMonad.Actions.Plane: Improvements in code quality 2008-07-06 17:28:29 +00:00
Marco Túlio Gontijo e Silva
52192efe56 XMonad.Actions.Plane: Treat error in read 2008-07-10 13:53:42 +00:00
Marco Túlio Gontijo e Silva
18ae6a3e2c XMonad.Actions.Plane: GConf support
Thanks to Johan Dahlin.
2008-07-09 00:19:00 +00:00
Devin Mullins
b775d682ca X.A.WindowNavigation: comments 2008-07-10 04:10:28 +00:00
Devin Mullins
99f9c8acc3 add autoComplete option to XMonad.Prompt
Maybe this will get Gwern one step closer to a complete Ratpoison binding.
2008-07-04 07:34:15 +00:00
Marco Túlio Gontijo e Silva
95b26ac219 XMonad.Actions.Plane: Copyright update 2008-07-09 00:15:48 +00:00
Marco Túlio Gontijo e Silva
374c034628 XMonad.Actions.Plane: removed missing haddock chunck 2008-07-09 01:05:30 +00:00
Braden Shepherdson
ae1010882a Added function to filter out scratchpad workspace for use with ewmhLogHookCustom. 2008-07-06 16:10:27 +00:00
Braden Shepherdson
afb54c64b0 Added ewmhLogHookCustom, which allows arbitrary transformation of the workspace list. 2008-07-06 16:08:47 +00:00
brian
23588c09ae adding thesaurus.reference.com and Google Labs Code Search searches 2008-07-01 09:01:42 +00:00
gwern0
60e02bb08a fillout banish example in Warp.hs
We also include a nice little type to avoid specifying 0 0 stuff.
2008-06-29 20:20:47 +00:00
gwern0
ddb522d0cb fix Actions.Wap doc
warp 1 1 has a comment claiming that this moves the cursor to the lower *left*, but if you look at the warpToWindow haddock, it says that 1 1 is actually lower *right* - as indeed it proved to do. This was annoying as it led me astray for a minute or so.
2008-06-29 11:55:04 +00:00
brian
2dc1b0c5f7 allow function keys up to F24 2008-06-26 04:05:16 +00:00
Braden Shepherdson
7cc6859496 Now using -name instead of -title as the term app argument, and correspondingly resource for the ManageHook. 2008-06-08 18:07:48 +00:00
Brent Yorgey
6530f28720 Actions/Search.hs: export SearchEngine constructor 2008-06-20 21:20:16 +00:00
Malebria
ddc49ade7b Export PerWorkspace to allow type signatures 2008-06-20 01:50:46 +00:00
Lukas Mai
1c18687ec4 XMonad.Util.EZConfig: add keypad bindings 2008-06-15 14:37:02 +00:00
Lukas Mai
4dc9baca48 XMonad.Util.EZConfig: minor cleanups 2008-05-28 16:54:50 +00:00
David Roundy
389e23b979 make default highlighting a bit dimmer for neighbors in WindowNavigation. 2008-06-10 17:42:00 +00:00
David Roundy
d988bda23f keep drag panes on the bottom of the window stack. 2008-06-10 17:40:44 +00:00
David Roundy
78f934255b add support to Magnifier for vertical zooming. 2008-06-10 17:37:47 +00:00
Malebria
f6e166c5ea XMonad.Hooks.EwmhDesktops export EwmHDesktopsHook
Any function that a user may write in his configuration file that is related to ewmhDesktopsLayout cannot have it's type signature if this type is not exported.
2008-06-10 13:06:14 +00:00
Malebria
a8c84232f3 XMonad.Config.Desktop type problem (monomorphism?)
With main = xmonad defaultConfig {layoutHook = desktopLayoutModifiers Full} I got a type error, that's not present with the patch.
2008-06-10 18:28:56 +00:00
Justin Bogner
f736a57bf0 Make prompt keybindings work when numLock or capsLock are active 2008-06-08 17:20:57 +00:00
Braden Shepherdson
244c75bee7 Replaced old "spawn on mod+s" semantics with "spawn/summon or banish on mod+s".
Originally the key binding just spawned a new floating terminal on every keypress.
Now it spawns if it doesn't exist, summons from another workspace if it does but
isn't visible, or banishes it to a dynamically created workspace if it is on the
current workspace.
2008-06-08 04:54:57 +00:00
Braden Shepherdson
303107fbae Exporting addHiddenWorkspace, it's needed by the new Scratchpad 2008-06-08 04:53:18 +00:00
Braden Shepherdson
aa9e7ca663 Added scratchpadSpawnActionTerminal to specify the terminal program directly as a String. 2008-06-08 03:26:19 +00:00
Braden Shepherdson
744b8197ee Removed odd scratchpadSpawnDefault, improved documentation. 2008-06-08 03:24:39 +00:00
gwern0
7b81a45619 Actions.Search.hs: switch inappropriate use of getShellCompl for a historyCompletion
It's inappropriate because if I am searching Wikipedia, say, why on earth do I want completion of files and executables on my PC? A previous search query is much more likely to be what I want.
2008-06-07 07:13:31 +00:00
gwern0
da64090416 Prompt.hs: +a historyCompletion function for use in XPrompts 2008-06-07 07:12:25 +00:00
Trevor Elliott
aa8275e491 Add C-w to XMonad.Prompt
* Bind C-w to kill the previous word
2008-06-05 22:06:56 +00:00
Don Stewart
955a4bd24f Add missing xfce module to .cabal 2008-06-02 17:42:19 +00:00
Malebria
5c908f986a Use lines instead of columns in configuration (similar to GNOME and KDE) 2008-05-26 22:53:37 +00:00
Malebria
f95fa1f551 Bug correction when areasColumn > 1 2008-05-26 22:32:20 +00:00
Devin Mullins
3436683f88 more documentation for WindowNavigation and UrgencyHook 2008-05-25 05:02:31 +00:00
Devin Mullins
8bec9a32e1 X.A.WindowNavigation: add logHook for better state tracking 2008-05-25 03:23:25 +00:00
Devin Mullins
f13c352bff doco tweaks 2008-05-24 21:18:49 +00:00
Justin Bogner
5895a401be made fadeInactiveLogHook take an argument amount to fade 2008-05-23 21:39:37 +00:00
Justin Bogner
5fc69c1ae7 add FadeInactive to fade out inactive windows using xcompmgr 2008-05-23 20:58:38 +00:00
Justin Bogner
0cbb8b83af add close window functionality to EwmhDesktops 2008-05-23 18:59:08 +00:00
Malebria
65109b90c6 Add XMonad.Actions.Plane 2008-05-23 00:43:57 +00:00
Ivan.Miljenovic
25de482d5f Default Xfce config, this time with me holding the copyright, maintainership, etc. 2008-05-22 10:53:16 +00:00
Joachim Fasting
7ef87af128 StackTile: minor documentation fix
That '[]' in the example seems incorrect
2008-05-21 18:26:37 +00:00
acura
8a4ffb3e57 StackTile
A simple patch to get a dishes like stacking, but with the ability to resize master pane.
2008-05-20 19:55:59 +00:00
gwern0
12e54671a5 revamp Search.hs to export a replacement for simpleEngine
It's called searchEngine now, and is a wrapper around the SearchEngine type. Different type as well
2008-05-19 19:09:12 +00:00
gwern0
e3974a91b3 sp ShowWName.hs 2008-05-19 19:05:20 +00:00
David Roundy
8c65d469db remove ScratchWorkspace.
It's ugly code, and I'd be surprised if anyone actually uses it.  I see no
reason to continue to maintain it.
2008-05-16 18:57:29 +00:00
Roman Cheplyaka
3cbccce5e8 Fixed location of xmonad.conf 2008-05-18 20:46:02 +00:00
zhen.sydow
7a3ff21b89 add site name in search prompt dialog 2008-05-18 10:13:57 +00:00
zhen.sydow
0140d63947 add youtube to search engines 2008-05-13 21:25:08 +00:00
Devin Mullins
8a646c9983 SwapWorkspaces: swapTo Next|Prev 2008-05-18 02:41:21 +00:00
Devin Mullins
e355598321 UrgencyHook: removeVisiblesFromUrgents -> cleanupUrgents
Now only removes windows based on SuppressWhen setting.
2008-05-15 16:44:36 +00:00
Braden Shepherdson
dd0ad36b22 Added XMonad.Config.PlainConfig: proof-of-concept GHC-less plain text configuration file parser
An example of the config file format can be found in the Haddock.
Notably missing features are docks and more layouts than just the standard three.
2008-05-17 22:29:16 +00:00
lithis
826512a460 XMonad.Hooks.SetWMName: Update documentation to reflect the addition of startupHook. 2008-05-16 22:10:11 +00:00
David Roundy
f4b537a06e I no longer use ScratchWorkspace. 2008-05-16 18:57:15 +00:00
David Roundy
6c2489e4a5 fix bug in smartBorders when combined with decorated windows. 2008-05-16 18:48:55 +00:00
Devin Mullins
52d2a731c9 decent documentation for UrgencyHook
Blame it on lack of sleep. Or perhaps the causation is the reverse.
2008-05-15 08:22:22 +00:00
Devin Mullins
21dd3fed8f X.A.WindowNavigation: currentPosition and setPosition share the same inside logic, now
Aside from documentation, this is pretty much usable, now.
2008-05-15 06:22:11 +00:00
Devin Mullins
7852e704fa X.A.WindowNavigation: have currentPosition handle axes independently
This improves some subtle interactions between mod-j/k and mod-w/a/s/d, though
that might not become very apparent until I fix setPosition.
2008-05-15 05:33:30 +00:00
Devin Mullins
1d93dfba51 fix compile warnings in BoringWindows 2008-05-15 05:17:28 +00:00
David Roundy
60f269f0b3 add BoringWindows module to make certain windows skipped when rotating focus. 2008-05-14 16:28:46 +00:00
Devin Mullins
4d520a4f20 UrgencyHook: some documentation (more is needed) 2008-05-14 08:01:04 +00:00
Devin Mullins
7d34680a9c UrgencyHook: got rid of the need for instances to know about suppressWhen
This changes the API a little bit, but that's what you get for using a day-old feature from darcs.
2008-05-14 07:22:17 +00:00
zhen.sydow
ac6f1a66fe move AppLauncher from Actions module to Prompt module 2008-05-13 20:12:52 +00:00
Devin Mullins
921097c9b5 X.A.WindowNavigation: comment cleanup 2008-05-13 09:13:13 +00:00
Devin Mullins
2d60591715 windowRect now compensates for border width
Odd that I have to do (Rectangle x y (w + 2 * bw) (h + 2 * bw)) -- you'd think
the window would be centered within the bordered area.
2008-05-13 09:01:51 +00:00
Devin Mullins
4d1bc6eecb X.A.WindowNavigation: update TODO 2008-05-13 04:42:29 +00:00
Devin Mullins
bb5fd00967 X.A.WindowNavigation: minor cleanup 2008-05-12 17:04:10 +00:00
Devin Mullins
864f3382ce X.A.WindowNavigation: simplify inr somewhat 2008-05-12 09:06:47 +00:00
Devin Mullins
95e5210d95 X.A.WindowNavigation: clarity 2008-05-12 08:53:38 +00:00
Devin Mullins
6eb5074bd1 X.A.WindowNavigation: ugh, typo 2008-05-12 08:22:28 +00:00
Devin Mullins
70caa5a67b X.A.WindowNavigation: implement swap, extract withTargetWindow commonality
Why doesn't mapWindows exist already?
2008-05-12 06:47:15 +00:00
Devin Mullins
cdeb842834 add more flexible withWindowNavigationKeys
Names aren't permanent yet, so don't cry if they change.
2008-05-12 05:06:37 +00:00
Devin Mullins
255a04753e X.A.WindowNavigation: TODO 2008-05-11 22:21:16 +00:00
Devin Mullins
8f0b9fa066 X.A.WindowNavigation: add withWindowNavigation, for easy setup
This should be more flexible than it is -- I've got an idea, but am interested to hear others.
2008-05-11 22:04:58 +00:00
Devin Mullins
98c70dd264 X.A.WindowNavigation: fix currentPosition
Now properly deals with an unitialized state (e.g. from a restart) or an
inconsistent state (e.g. from using mod-j/k). Deserves cleanup.
2008-05-11 21:21:28 +00:00
Devin Mullins
5338391ae9 X.A.WindowNavigation: add TODOs 2008-05-11 21:13:26 +00:00
Devin Mullins
ad787b2d5f X.A.WindowNavigation state is now workspace-specific
racking up some code debt, here...
2008-05-11 07:16:56 +00:00
Devin Mullins
50420922eb X.A.WindowNavigation: minor doco changes 2008-05-06 07:42:35 +00:00
Devin Mullins
b45722cf82 add draft XMonad.Actions.WindowNavigation
This is an experiment with replacing the WindowNavigation LayoutModifier with
one that simply adds keybindings and stores state in an IORef. Credit to
droundy for the original code -- hopefully I'm not butchering it. The end
intent is to add Xinerama support, but it'll be a little while before I get
there.
2008-05-04 05:00:22 +00:00
zhen.sydow
07b2f424b1 new contrib module to launch apps with command line parameters 2008-05-13 13:47:54 +00:00
Devin Mullins
090d77236d pull suppressWhen logic into main WithUrgencyHook handler
In order for this to work, I added a new UrgencyHook method to communicate the
SuppressWhen value. I'm not sure if this is actually better than just providing
a convenience function, but it's an easy switch.
2008-05-13 07:52:47 +00:00
Devin Mullins
4b8575f3ae add suppressWhen option to dzenUrgencyHook 2008-05-13 05:46:15 +00:00
Devin Mullins
5e045d018b WindowNavigation: extract navigable function 2008-04-22 04:52:48 +00:00
Devin Mullins
e8b19b8b33 UrgencyHook: doc typo 2008-05-12 05:21:37 +00:00
Devin Mullins
0350117f47 UrgencyHook: extract whenNotVisible 2008-05-12 04:18:52 +00:00
Devin Mullins
26b1a747c6 SpawnUrgencyHook, FWIW 2008-05-12 04:04:49 +00:00
Devin Mullins
33b0a1b760 make UrgencyHook an EventHook
This gets rid of the stupid bug that led to a need for the clearBit hack, and
allowed me to simplify the types (since EventHooks aren't required to
parameterize on the window type). Config files need not change, unless they
declare instances of UrgencyHook, in which case, they should remove "Window" as
is seen in this patch.
2008-05-12 02:48:22 +00:00
Ivan N. Veselov
82a6bea527 'xmobar' function added to DynamicLog for running xmobar with some defaults 2008-05-08 19:49:18 +00:00
lithis
7c9948f9ee HintedTile: Fix mistake in documentation. 2008-05-08 00:35:52 +00:00
Spencer Janssen
58610f1c15 Use gnome-session-save for the mod-shift-q binding 2008-05-07 08:22:05 +00:00
Spencer Janssen
e3eb2151da Use the named constant 'none' rather than 0 2008-05-07 08:18:54 +00:00
lithis
52932bcd03 HintedTile: Improve documentation. 2008-05-08 00:02:45 +00:00
Spencer Janssen
d38b2b4f72 Whitespace only 2008-05-07 03:13:06 +00:00
Spencer Janssen
72c42e6b0a Add a binding for Gnome's "Run Application" dialog 2008-05-07 03:11:27 +00:00
Spencer Janssen
2a2c33b37f Add some keybindings to the Kde config 2008-05-07 02:26:58 +00:00
Spencer Janssen
c66c634cf0 Indentation 2008-05-07 02:25:53 +00:00
Spencer Janssen
90d5b56d45 Add ToggleStruts to the desktop config 2008-05-07 02:25:16 +00:00
Spencer Janssen
8677090476 Refactor my config 2008-05-07 02:15:04 +00:00
Spencer Janssen
1e6c4e485a Add XMonad.Config.Kde 2008-05-07 02:08:33 +00:00
Klaus Weidner
476fb301d4 Don't move the pointer if the user is moving the mouse
This patch depends on the following xmonad core patch:

  Remember if focus changes were caused by mouse actions or by key commands

If the user was moving the mouse, it's not appropriate to move the pointer
around in resonse to focus changes. Do that only in response to keyboard
commands.
2008-04-17 02:22:34 +00:00
Don Stewart
570f6c9cf1 Missing pragmas 2008-05-06 05:34:02 +00:00
Don Stewart
0a118f1179 Add full documentation 2008-05-05 21:05:46 +00:00
Devin Mullins
99d0c45074 minor cleanup on getName 2008-05-04 05:49:23 +00:00
Devin Mullins
5e7462d9b2 bug doco for UrgencyHook 2008-04-26 20:36:38 +00:00
Spencer Janssen
b15fd831fe NamedWindows: when converting the text property, handle the empty list.
This fixes a "Prelude.head" exception observed with windows that have no title.
Reproduce by placing several windows in the tabbed layout, then starting
'xterm -name ""'.  Thanks to Andrea for pointing out the issue.
2008-05-02 10:42:49 +00:00
Andrea Rossato
82975240b7 Fix issue #179 by handling events correctly 2008-05-01 06:23:57 +00:00
Spencer Janssen
e35e0a001c My monitor is larger now :) 2008-04-30 08:30:26 +00:00
Spencer Janssen
4fff234f3b manageHooks for my config 2008-04-30 08:25:36 +00:00
Spencer Janssen
a46e04fef7 Remove redundant type signature 2008-04-30 08:24:47 +00:00
Spencer Janssen
034eee34e3 Add XMonad.Config.Desktop and XMonad.Config.Gnome 2008-04-30 08:22:53 +00:00
Spencer Janssen
49b705906b Alphabetize exposed-modules 2008-04-30 03:54:53 +00:00
joamaki
0df598fa5d new contrib layout: XMonad.Layout.SimplestFloat - A floating layout like SimpleFloat, but without decoration 2008-04-24 22:09:57 +00:00
Don Stewart
b2c1e077b2 stricitfy some gap fields 2008-04-27 19:12:47 +00:00
Lukas Mai
2418d4b374 XMonad.Hooks.ManageHelpers: quick&dirty support for _NET_WM_STATE_FULLSCREEN 2008-04-26 13:27:45 +00:00
Lukas Mai
aca6fd8058 XMonad.Hooks.Script: haddock fixes 2008-04-26 13:26:29 +00:00
Ivan.Miljenovic
8e5df4b950 Error fix for Tabbed when tabbar always shown 2008-04-24 06:31:35 +00:00
Don Stewart
336c617cbe remove my config file -- the wiki is where its at. 2008-04-19 19:56:50 +00:00
Don Stewart
bcc4295d3d tweaks to docs for SimpleDecoration 2008-04-18 21:51:55 +00:00
Ivan.Miljenovic
2e050d29d9 Allow tabbar to always be shown.
Patch take 4, hopefully the final version.  Includes droundy's suggestions.
2008-04-15 04:37:28 +00:00
Don Stewart
19156cb3ff polish 2008-04-18 03:31:33 +00:00
Trevor Elliott
5344db6c90 Script-based hooks 2008-04-16 21:30:24 +00:00
Spencer Janssen
b1d4d97c1a Don't strictify the Display component, this triggers a bug in GHC 6.6 2008-04-16 18:57:33 +00:00
Roman Cheplyaka
adbee1ce2c Fix to IM modifier.
Avoid differentiating integrated stack by using StackSet.filter.
2008-04-14 23:24:37 +00:00
Ivan N. Veselov
adde0fc668 IM layout converted to LayoutModifier, which can be applied to any layout 2008-04-13 20:58:24 +00:00
Don Stewart
c98059db64 stictify some fields 2008-04-13 07:01:17 +00:00
Don Stewart
58f10da612 strictify some fields 2008-04-13 06:59:58 +00:00
Joachim Breitner
ab782c936a Fix window order in EWMH
For pagers to draw the stacking order correctly, the focused window has to
be the last in the list. Thus put an appropriate implementation of allWindows
into the Module.
This does not work perfectly with floating windows.
2008-04-11 13:44:11 +00:00
David Roundy
117c3bd6b1 remove myself as maintainer of CopyWindow.
I'm not sure who's maintaining this, but it's not me.
2008-04-09 14:43:33 +00:00
Roman Cheplyaka
9e6dca0fa1 XMonad.Util.WindowProperties: add WM_WINDOW_ROLE as Role 2008-04-09 17:49:35 +00:00
Spencer Janssen
1071d0a4e1 Generalize copyWindow, minor style change 2008-04-08 21:00:50 +00:00
Ivan N. Veselov
56031b1f63 XMonad.Actions.CopyWindow: added copyToAll and killAllOtherCopies functions 2008-04-08 19:51:11 +00:00
Lukas Mai
59fc99504f XMonad.Actions.UpdatePointer: doc fix 2008-04-07 15:27:41 +00:00
Lukas Mai
413023b5d0 XMonad.Util.Font: minor reformatting 2008-04-06 02:09:35 +00:00
Lukas Mai
b2b1671630 DynamicLog: resolve merge conflict 2008-04-06 02:05:27 +00:00
lithis
999029d95f Encode the entire DynamicLog output, instead of just window title. 2008-03-29 03:15:37 +00:00
Andrea Rossato
4277d11def DynamicLog: add support for UTF-8 locales when compiled with XFT or UFT-8 support 2008-03-13 10:26:43 +00:00
Lukas Mai
cdfbf3ebce XMonad.Util.Font: don't call setlocale; core does it for us 2008-04-06 01:31:23 +00:00
Lukas Mai
c86409624f XMonad.Util.NamedWindows: fix imports 2008-03-26 17:27:45 +00:00
Mats Jansborg
e28702c57b Changed getName to use locale-aware functions
Rewrote getName using getTextProperty and wcTextPropertyToTextList.
2007-08-19 13:21:04 +00:00
Ian Zerny
ef25a538bf Added next-window versions of the raise* functions. 2008-04-05 18:29:00 +00:00
Lukas Mai
b495c7f725 XMonad.Layout.Master: initial import 2008-04-04 22:07:34 +00:00
Lukas Mai
1950a4e2cc update contrib for applySizeHints changes 2008-04-04 22:05:58 +00:00
Lukas Mai
c15eea99c9 XMonad.Hooks.ManageDocks: haddock fix 2008-04-04 22:05:32 +00:00
Brent Yorgey
8783bc727c MultiToggle/Instances: ghc 6.6 can't parse LANGUAGE pragma 2008-04-04 20:01:57 +00:00
Joachim Breitner
8d2f363729 Document _NET_ACTIVE_WINDOW behaviour more exactly 2008-04-04 07:29:44 +00:00
Joachim Breitner
2747f802df _NET_ACTIVE_WINDOW moves windows if necessary
This makes EWMH behave a bit more like metacity: If _NET_ACTIVE_WINDOW is
received and the window is not on the current worspace, it is brought here 
(instead of the workspace switched to the other one). So for example, if you
click on the pidgin icon in the panel and the buddy list is already open some
where it is moved here.
2008-04-02 14:38:11 +00:00
Don Stewart
0971238cf6 onstart=lower, solves floating dzen issue 2008-04-03 20:34:25 +00:00
Don Stewart
6c324cbfed some bang patterns 2008-04-03 17:22:46 +00:00
Don Stewart
f1d91209a4 have 'dzen' use autoStruts to detect the gaps 2008-04-03 00:31:30 +00:00
Brent Yorgey
5d352c8bf4 Actions/Search.hs: add dictionary.com search 2008-04-02 15:05:21 +00:00
Joachim Breitner
63bac5b539 _NET_ACTIVE_WINDOW moves windows if necessary
This makes EWMH behave a bit more like metacity: If _NET_ACTIVE_WINDOW is
received and the window is not on the current worspace, it is brought here 
(instead of the workspace switched to the other one). So for example, if you
click on the pidgin icon in the panel and the buddy list is already open some
where it is moved here.
2008-04-02 14:38:11 +00:00
Lukas Mai
7e3cb59c23 HintedGrid: guesstimate window flexibility and layout rigid windows first 2008-04-02 04:28:46 +00:00
Lukas Mai
adbf9032ca HintedGrid: try both bottom-up/top-down window placement to minimize unused space 2008-04-02 01:25:38 +00:00
Lukas Mai
d2df9b329e Grid/HintedGrid: use an ncolumns formula inspired by dwm's "optimal" mode 2008-04-02 01:21:26 +00:00
Brent Yorgey
25c23eb79d XMonad.Layout.Gaps: new contrib module for manual gap support, in the few cases where ManageDocks is not appropriate (dock apps that don't set STRUTS properly, adjusting for a display that is cut off on one edge, etc.) 2008-04-02 00:37:42 +00:00
gwern0
e170cfc611 improve WindowGo.hs Haddock formatting 2008-04-01 02:31:30 +00:00
gwern0
7382e616a9 forgot a haddock for getEditor in Shell.hs 2008-04-01 02:20:12 +00:00
gwern0
64396d85ab WindowGo.hs: +raiseBrowser, raiseEditor
Specialize runOrRaise in the same way as with Actions.Search, for one's browser and one's editors.
2008-04-01 02:17:40 +00:00
gwern0
acd13fd324 RunOrRaise.hs: FF 3 doesn't use the "Firefox-bin" classname 2008-04-01 01:50:49 +00:00
gwern0
a4fb5d127f Search.hs: remove an argument from selectSearch and promptSearch
The new getBrowser function allows us to mv the old selectSearch and promptSearch aside as too-general functions, and replace them with new versions, which employ getBrowser to supply one more argument. This allows us to replace the tedious 'selectSearch google "firefox"; selectSearch yahoo "firefox"...' with shorter 'selectSearch google' and so on. One less argument.

Also, update the docs.
2008-04-01 01:39:47 +00:00
gwern0
494823eb82 Shell.hs: +getBrowser, getEditor, helper function
The helper function asks the shell for the value of a variable, else returns the second argument.
getBrowser and getEditor obviously specialize it for two particular possibly queries
2008-04-01 01:34:47 +00:00
Lukas Mai
dcd1aea5d6 XMonad.Layout.HintedGrid: initial import 2008-04-01 23:17:22 +00:00
Roman Cheplyaka
6c19138d55 Documentation improvement. 2008-04-01 13:43:05 +00:00
Roman Cheplyaka
8816dc5c3f Remove broken link to screenshot. 2008-03-31 21:08:54 +00:00
Brent Yorgey
110c3863e8 MultiToggle: add new XMonad.Layout.MultiToggle.Instances module for common instances of Transformer, update MultiToggle docs accordingly 2008-03-31 20:17:39 +00:00
Michal Janeczek
f77f71512b XMonad.Actions.CycleRecentWS: initial import 2008-03-31 11:19:06 +00:00
Lukas Mai
7abbbd4568 XMonad.Hooks.ManageDocks: export checkDoc 2008-03-31 01:29:11 +00:00
Lukas Mai
5bbf9700f3 XMonad.Layout.Grid: fix indentation 2008-03-30 00:48:59 +00:00
Brent Yorgey
c857ebe29c move Direction type from WindowNavigation to ManageDocks (ManageDocks will move into the core, taking Direction with it) 2008-03-31 01:01:27 +00:00
Brent Yorgey
da5452b009 ManageDocks: clean up + add more documentation 2008-03-31 00:29:29 +00:00
Brent Yorgey
a09ed70091 Util.Run, Hooks.DynamicLog: re-export hPutStrLn and hPutStr from Util.Run for convenience, and update DynamicLog documentation to show proper imports 2008-03-28 20:54:46 +00:00
Brent Yorgey
bc0851f52a ManageDocks: add avoidStrutsOn, for covering some docks and not others by default. 2008-03-27 20:39:40 +00:00
Brent Yorgey
4e66e0ad1b ManageDocks: add ability to toggle individual gaps independently 2008-03-27 11:17:22 +00:00
Brent Yorgey
8efc32759a PerWorkspace: add modWorkspace(s) combinators, for selectively applying layout modifiers to certain workspaces but not others 2008-03-26 21:43:51 +00:00
Roman Cheplyaka
c86dd6f097 Haddock fix 2008-03-30 13:44:35 +00:00
Spencer Janssen
0d310df103 Remove stale status gaps code 2008-03-29 23:07:37 +00:00
Spencer Janssen
071081f38e Bump version to 0.7 2008-03-29 19:24:00 +00:00
Spencer Janssen
64f04628b9 Fix haddock error 2008-03-29 19:17:52 +00:00
Lukas Mai
f15334d02d XMonad.Layout.MultiToggle: let runLayout modify the base layout if no transformer is active 2008-03-28 19:09:03 +00:00
Brent Yorgey
920336e1ac Spiral: add documentation 2008-03-28 19:22:31 +00:00
David Roundy
c2d0a209eb corrected version of make workspaceDir work even in workspaces with no windows. 2008-03-27 14:22:57 +00:00
David Roundy
143e68f664 cleanup in Tabbed (make 'loc' be actual location). 2008-03-26 15:10:04 +00:00
David Roundy
296b0b2513 make workspaceDir work even in workspaces with no windows.
This also fixes a (minor) bug when the focussed window is present on
multiple visible workspaces.
2008-03-26 15:27:08 +00:00
David Roundy
e17d039c3a clean up Config.Droundy. 2008-03-27 00:21:59 +00:00
David Roundy
e3d455ded4 make workspaceDir work even in workspaces with no windows.
This also fixes a (minor) bug when the focussed window is present on
multiple visible workspaces.
2008-03-26 15:27:08 +00:00
Brent Yorgey
a787d4badf ManageDocks: add warning about making sure gaps are set to zero before switching to avoidStruts, since ToggleStruts won't work otherwise 2008-03-26 23:19:28 +00:00
Brent Yorgey
f0e7b48bda update documentation in XMonad/Doc in preparation for 0.7 release 2008-03-26 19:57:41 +00:00
Lukas Mai
6ada04c415 XMonad.Hooks.ManageHelpers: reformatting 2008-03-26 18:27:07 +00:00
Lukas Mai
6761a61cad XMonad.Layout.NoBorders: fix floating fullscreen logic 2008-03-26 17:28:44 +00:00
xmonad
1c6798a639 UpdatePointer: Make pointer position configurable. 2008-03-26 07:57:59 +00:00
Spencer Janssen
b85ce7522f Fix bugs in Tabbed and TabBarDecoration -- please remember multi-head! 2008-03-26 03:45:41 +00:00
Don Stewart
7de2ed2152 my current config 2008-03-26 02:33:03 +00:00
Spencer Janssen
31d303508e I don't use DwmStyle 2008-03-25 21:38:18 +00:00
David Roundy
ca2d0ca406 fix bug in TabBarDecoration leading to gaps in corner. 2008-03-25 21:03:27 +00:00
David Roundy
6850c0fed7 fix bug leading to gaps in tabs at the corner of the screen.
Besides being ugly, this had the effect of making me fail to click on the
tab I aimed for, if it was in the corner.
2008-03-25 21:02:11 +00:00
Brent Yorgey
1f53383e2e XMonad.Layout.LayoutModifier: add a metric crapload of documentation 2008-03-25 20:50:06 +00:00
Brent Yorgey
ec2cd8d8b1 XMonad.Layout.Reflect: update documentation to reflect (haha) recent updates to MultiToggle 2008-03-25 18:56:30 +00:00
Lukas Mai
529797ae8e XMonad.Layout.HintedTile: make alignment of shrunk windows configurable 2008-03-25 20:29:58 +00:00
Brent Yorgey
687c898c55 XMonad.Actions.Commands: documentation fix 2008-03-25 16:57:07 +00:00
redbeard0531
492b1e27c2 focusedHasProperty 2008-03-25 04:04:12 +00:00
Brent Yorgey
0900dbf0be XMonad.Util.Themes: improve documentation to make it clear that themes only apply to decorated layouts 2008-03-24 18:59:46 +00:00
Brent Yorgey
883b803794 Doc/Extending: remove references to "XMonad.Layouts" -- it's now called "XMonad.Layout", and in any case, importing it explicitly is not needed anyway. 2008-03-24 14:35:03 +00:00
Brent Yorgey
6fd03c107c XMonad.Actions.Search: add Google Maps search 2008-03-24 14:33:48 +00:00
Brent Yorgey
16fc0f231d XMonad.Layout.Magnifier: add documentation 2008-03-24 14:32:14 +00:00
wcfarrington
cfb3f6575e wfarrTheme
Add a new color theme using blue and black.
2008-03-24 01:16:25 +00:00
Justin Bogner
f0cb1b3bf2 added RunOrRaisePrompt, exported getCommands from Shell 2008-03-23 22:26:32 +00:00
Lukas Mai
180298def6 XMonad.Actions.MouseGestures: reexport Direction from WindowNavigation, avoid type duplication 2008-03-22 19:34:57 +00:00
David Roundy
b378857a8e use ewmhDesktopsLayout in Droundy. 2008-03-22 15:36:10 +00:00
David Roundy
c0519e4375 cut Anneal and Mosaic. 2008-03-22 15:35:46 +00:00
David Roundy
f86648cf7c fix WorkspaceDir to work when there are multiple screens.
In particlar, ScratchWorkspace broke this.
2008-03-11 22:12:01 +00:00
Lukas Mai
4b7167c6e5 fix various compilation errors 2008-03-22 07:41:13 +00:00
Lukas Mai
a9a8e488ef XMonad.Layout.NoBorders: first attempt at documenting smartBorders 2008-03-21 22:13:15 +00:00
daniel
7d0b8fd72f allow magnifier to toggle whether it's active 2008-03-21 10:46:05 +00:00
daniel
d0260ddbff a magnifier that defaults to not magnifying any windows 2008-03-21 10:44:41 +00:00
Lukas Mai
f34258af22 XMonad.Layout.Magnifier: remove references to Data.Ratio.% from documentation 2008-03-20 22:38:16 +00:00
Don Stewart
426a9e4795 mark Mosaic as broken. use MosaicAlt 2008-03-20 22:37:17 +00:00
Joachim Breitner
ce2b39be1a add ewmhDesktopsLayout for EWMH interaction
This is based on Andrea’s EventHook thingy. Note that I could not merge
this with some of my earlier EWHM interaction patches (darcs was failing on me),
so I copied some code. Do not try to merge it with those patches either.

Note that the docs are saying what should work. There are still some bugs
to be resolved, but it works sometimes and should work similar to what we have.
2008-03-19 19:57:36 +00:00
Joachim Breitner
098f11e1c0 Export HandleEvent type to be able to use it in type annotations 2008-03-19 19:56:03 +00:00
Andrea Rossato
f1c5f11c2e I now use ServerMode 2008-02-26 11:53:47 +00:00
Andrea Rossato
12ca9dbfa6 EventHook: handle events after the underlying layout and more
- check the first time the Bool is True
- coding and naming style
2008-02-24 23:08:54 +00:00
Andrea Rossato
6cac436d47 Add Hooks.ServerMode: an event hook to execute commands sent by an external client 2008-02-24 13:37:06 +00:00
Andrea Rossato
ce6241b6b3 Add EventHook: a layout modifier to handle X events 2008-02-24 11:24:32 +00:00
Don Stewart
c60522bfef tabs 2008-03-17 22:47:58 +00:00
Brent Yorgey
1c7e519126 WindowProperties: fix documentation 2008-03-18 20:45:40 +00:00
Roman Cheplyaka
4015eb2c6f Move window properties to a separate Util module
Add XMonad.Util.WindowProperties
Modify XMonad.Layout.IM.hs to use WindowProperties.
2008-03-18 16:56:58 +00:00
Lukas Mai
7a341fa790 XMonad.Layout.NoBorders: always unborder fullscreen floating windows, even when there are multiple screens 2008-03-17 18:30:43 +00:00
Brent Yorgey
a1fce4af5a MagicFocus: reimplement as a LayoutModifier, fix bug (MagicFocus didn't pass on messages to underlying layouts) 2008-03-17 19:30:08 +00:00
gwern0
929c9a1b56 WindowGo.hs: improve description
I'm still not sure whether the description makes sense if you don't already understand the idea.
2008-03-16 22:39:46 +00:00
gwern0
7d5235e942 Run.hs: improve haddock
This module too was causing horizontal scrolling because of the shell command. I managed to discover that you only need to specify 'png:' *or* "foo.png", not both, which trimmed off enough characters.
Also, I improved the docs for my functions.
2008-03-16 22:32:19 +00:00
gwern0
3b09878000 XSelection.hs: improved haddockf formatting, more links, & cpedit 2008-03-16 22:20:50 +00:00
gwern0
a97c325b8b Search.hs: try to add a more descriptive type 2008-03-16 21:57:28 +00:00
gwern0
aca42e5ddb improve the formatting for WindowGo.hs 2008-03-16 21:56:42 +00:00
gwern0
87bb590217 Search.hs: haddock fmt
This removes whitespace in source code snippets. Because Haddock renders quoted source code as monospaced unwrappable text, the excess whitespace meant you would have to scroll horizontally, unpleasantly.
2008-03-16 21:39:14 +00:00
xmonad
e216c95beb Add XMonad.Actions.Promote 2008-03-16 20:57:22 +00:00
Brent Yorgey
2526a5ddaa LayoutCombinators: improve documentation (closes ticket #136) 2008-03-16 19:58:26 +00:00
Lukas Mai
2000ddb82e Xmonad.Layout.NoBorders: make smartBorders unborder fullscreen floating windows (bug 157) 2008-03-16 04:29:41 +00:00
Lukas Mai
9ccc684f3d Xmonad.Prompt.DirExec: fix haddock error 2008-03-16 04:28:40 +00:00
Alec Berryman
f38f27420b EwmhDesktops: advertise support for _NET_CLIENT_LIST_STACKING 2008-03-15 21:26:31 +00:00
Brent Yorgey
245fd850e3 ScratchWorkspace: update to work with runLayout changes 2008-03-11 21:29:08 +00:00
Brent Yorgey
bf8268c003 Scratchpad: update to work with runLayout changes 2008-03-11 18:17:15 +00:00
Brent Yorgey
eb18de22c8 MagicFocus: update to work with runLayout changes 2008-03-11 18:16:25 +00:00
Brent Yorgey
8b27f8e0aa LayoutScreens: update to work with runLayout changes 2008-03-11 18:15:37 +00:00
Brent Yorgey
a0daaf1e47 Combo: update to work with runLayout changes 2008-03-11 18:14:00 +00:00
Brent Yorgey
5769b3343b MultiToggle: fix to work with runLayout changes to core 2008-03-11 17:20:46 +00:00
Andrea Rossato
32941d49b4 PerWorksapce: use a safer False as default 2008-02-23 07:55:31 +00:00
Andrea Rossato
c9e4f2dc10 PerWorkspace: reimplemented using runLayout
This way we have a Xinerama safe PerWorkspace and the emptyLayout
method for free.
2008-02-22 17:59:54 +00:00
Andrea Rossato
c2dcd6ede8 ToggleLayouts: reimplemented with runLayout 2008-02-23 08:15:53 +00:00
Andrea Rossato
e0987d1330 LayoutCombinators: NewSelect reimplemented with runLayout 2008-02-23 08:09:58 +00:00
Andrea Rossato
3ca4966b06 LayoutModifier: reimplement ModifiedLayout using runLayout and more
- change modifyLayout type to get the Workspace
- updated ResizeScreen and ManageDocks accordingly.
2008-02-23 07:56:10 +00:00
Andrea Rossato
9ac91e3a15 Combo: updated to latest runLayout changes 2008-02-22 17:59:24 +00:00
Brent Yorgey
5acc881930 EZConfig: add documentation and a warning, so no one repeats my silly hard-to-track-down mistake. 2008-03-11 17:26:10 +00:00
robreim
c4b0af9adf Fix to work with "floats always use current screen" patch 2008-03-08 02:49:28 +00:00
David Roundy
8950dced20 make smartBorders ignore screens with no dimensions. 2008-03-08 22:42:44 +00:00
David Roundy
c754adc48b rewrite ScratchWorkspace to make scratch always visible, but not always on screen. 2008-03-08 22:38:30 +00:00
David Roundy
6da9d73f0d add HiddenNonEmptyWS to CycleWS to avoid workspaces already visible. 2008-03-08 22:37:17 +00:00
Roman Cheplyaka
0db06db23e Fix ThreeColumns doc. 2008-03-07 20:30:22 +00:00
Andrea Rossato
83f5512909 Shell: add support for UTF-8 locales 2008-03-02 09:59:24 +00:00
Andrea Rossato
5a9781ee48 Font and XUtils: add UTF-8 support and various fixes related to XFT
- printStringXMF: use the background color for XFT fonts too
- textWidthXMF now returns the text width even with xft fonts
- textExtentsXMF will now return only the ascend and the descent of a
  string.
- stringPosition now takes the display too
- add support for UTF-8 locales: if the contrib library is compiled
  with the 'with_xft' or the 'with_utf8' option the prompt and the
  decoration system will support UTF-8 locales - this requires
  utf8-strings.
2008-03-02 09:57:12 +00:00
Andrea Rossato
7f14dbb5dd Ssh: coding style 2008-02-29 10:03:46 +00:00
Andrea Rossato
639558798f Ssh: complete known hosts with non standard ports too 2008-02-29 09:50:14 +00:00
nicolas.pouillard
579a3feb1c Fix xmonadPromptC and use it. 2008-03-06 16:39:28 +00:00
nicolas.pouillard
7f8882faf2 Documentation typo about UpdatePointer. 2008-03-06 16:35:16 +00:00
Braden Shepherdson
3a6e2d8b8e Fix ToggleOff: It was adding 0.1 to the magnification. 2008-03-05 22:23:02 +00:00
Juraj Hercek
4f2e1927b0 Removed WmiiActions module. 2008-03-05 08:23:36 +00:00
Juraj Hercek
91da412bf1 Adjusted signature of DirExec module functions.
- added parameter for function which executes the selected program
  - renamed dirExecPromptWithName to dirExecPromptNamed
2008-03-01 17:19:05 +00:00
Juraj Hercek
34f9ad7d1f Import of new DirExec module.
- allows execution of executable files from specific directory
2008-02-29 21:22:57 +00:00
Dmitry Kurochkin
9b6b495e06 Hooks.DynamicLog: export xmobarPP 2008-03-03 21:56:37 +00:00
Brent Yorgey
413296ca8a Magnifier: fix behavior for windows on the bottom + right of the screen. Now all magnified windows will be the same size, possibly shifted in order to fit completely on the screen. 2008-03-03 20:46:19 +00:00
robreim
d44253f17f Changed semantics of UpdatePointer to move to nearest point 2008-03-01 14:31:26 +00:00
robreim
26de20d294 UpdatePointer XMonadContrib module 2008-03-01 13:44:01 +00:00
gwern0
ef50ecda71 Util.Run: minor clarification in comment 2008-03-03 05:15:13 +00:00
Roman Cheplyaka
11e57ce367 Add XMonad.Actions.PerWorkspaceKeys 2008-03-02 20:23:46 +00:00
Dominik Bruhn
2d7ceeb75e Haddock fix: Changed URL-Markup 2008-03-02 18:54:35 +00:00
David Roundy
372f1e14fe switch Droundy to smartBorders (which works better with ScratchWorkspace). 2008-03-01 19:11:03 +00:00
Lukas Mai
68a05495e5 XMonad.Layout.Simplest: add FlexibleInstances pragma 2008-03-01 06:17:14 +00:00
Lukas Mai
6b72b94994 XMonad.Layout.ScratchWorkspace: avoid warnings, make tests compile again 2008-03-01 06:16:25 +00:00
David Roundy
4e6f032d64 implement ScratchWorkspace. 2008-02-29 22:43:16 +00:00
David Roundy
93cf069aab in Prompt.Workspace sort by official workspace order. 2008-02-29 22:30:47 +00:00
David Roundy
dca8b60cd5 simplify Simplest--allow it to apply to non-Windows. 2008-02-29 22:13:26 +00:00
Lukas Mai
77476932c4 XMonad.Actions.MouseGestures.mkCollect: generalize type 2008-02-29 21:17:32 +00:00
Roman Cheplyaka
b3a9ed8dcd Add bottom-tabbed layout. 2008-02-29 15:51:20 +00:00
Lukas Mai
2fb79e1d70 XMonad.Actions.MouseGestures: refactoring, code simplification
It is now possible to get "live" status updates while the gesture handler
is running. I use this in my xmonad.hs to print the current gesture to my
status bar. Because collecting movements is now the callback's job, the
implementation of mouseGestureH got quite a bit simpler. The interface is
incompatible with the previous mouseGestureH but the old mouseGesture
function works as before.
2008-02-29 00:21:36 +00:00
Brent Yorgey
40b636aea5 EZConfig: additional documentation 2008-02-27 16:46:02 +00:00
Brent Yorgey
9eeca8057b XMonad.Util.Scratchpad: change 'XConfig Layout' to 'XConfig l', to avoid type mismatches; the exact layout type doesn't actually matter 2008-02-27 01:42:01 +00:00
Brent Yorgey
3cbddabe3d EZConfig: add an emacs-style keybinding parser!
Now, instead of writing out incredibly dull things like

  ((modMask conf .|. controlMask .|. shiftMask, xK_F2), ...)

you can just write

  ("M-C-S-<F2>", ...)

Hooray!
2008-02-26 22:27:23 +00:00
Lukas Mai
cdab5ae1c3 Xmonad.Actions.MouseGestures: generalize interface, allow hooks 2008-02-26 20:26:39 +00:00
Lukas Mai
09a12b46f6 update inactive debugging code in MouseGestures; no visible changes 2007-11-09 02:07:55 +00:00
Braden Shepherdson
04a8c51f95 Scratchpad terminal
Key binding and ManageHook to pop up a small, floating terminal window for a few quick commands.

Combined with a utility like detach[1], makes a great X application launcher.

Requires my two new ManageHooks (doRectFloat, specifically).

[1] http://detach.sourceforge.net
2008-02-25 18:36:33 +00:00
Braden Shepherdson
da14e60ded Two new floating window ManageHooks.
Adds doRectFloat, which floats the new window in the given rectangle; and doCenterFloat, which floats the 
new window with its original size, but centered.
2008-02-25 18:33:37 +00:00
Roman Cheplyaka
e185d12b78 Fix usage doc. 2008-02-25 06:23:30 +00:00
Roman Cheplyaka
aa4a928d36 Fix haddock hyperlink. 2008-02-24 20:54:16 +00:00
Roman Cheplyaka
37b2051c04 Add XMonad.Layout.IM 2008-02-21 08:57:52 +00:00
Roman Cheplyaka
4e828e85e3 Export XMonad.Layout.Grid.arrange (for use in XMonad.Layout.IM) 2008-02-21 06:22:04 +00:00
Andrea Rossato
d9e8311d52 Decoration: some haddock updates 2008-02-20 21:49:34 +00:00
Nils Anders Danielsson
10862fe143 Small refactoring. 2008-02-10 22:47:56 +00:00
Nils Anders Danielsson
83df2b4415 Fixed off-by-one error which broke strut handling for some panels. 2008-02-10 22:26:00 +00:00
Andrea Rossato
e093874211 Decoration: fix an issue with decoration window creation and more
- fix a bug reported by Roman Cheplyaka: when decorate returned
  Nothing the window was never going to be created, even if decorate
  was reporting a Just Rectangle in the next run. Quite a deep issue,
  still visible only with TabbedDecoration at the present time.
- remove decorateFirst (decorate has enough information to decide
  whether a window is the first one or not, am I right, David?)
- some point free.
2008-02-20 20:43:55 +00:00
Andrea Rossato
cbeae0b86c DynamicLog.hs: haddock fix
Someone forgot to check if her patch was going to break haddock docs
generation or not. So, while I was recording a patch with quite a long
description I had to manually write - sound strange? -, I found out
that my patch did not pass the tests, because of this haddock problem
left behind.

And so I fixed it, recorded this patch, with the hope the my next
description of the next patch I'm going to record will survive the
test suite we created to avoid this kind of problems for.
2008-02-20 20:40:33 +00:00
Brent Yorgey
2a8cb7d84c improvements to XMonad.Hooks.DynamicLog, and new contrib module XMonad.Util.Loggers
Improvements to DynamicLog include:
  * Greatly expanded and improved documentation and examples
  * remove seemingly useless makeSimpleDzenConfig function
  * factor out xmobarPP
  * add new ppExtras field to PP record, for specifying 'extra'
    loggers which can supply information other than window title,
    layout, and workspace status to a status bar (for example, time and date,
    battery status, mail status, etc.)

The new XMonad.Util.Loggers module provides some example loggers that 
can be used in the new ppExtras field of the PP record.  Create your own,
add them to this module, go crazy! =)
2008-02-19 21:01:28 +00:00
Andrea Rossato
172d422efb LayoutHints: fix a wrong fix
The case analisys of my fix should be the other way around... this is
the real fix.
2008-02-19 16:51:27 +00:00
Andrea Rossato
9cd93a043a Arossato: updated to latest changes 2008-02-19 16:30:58 +00:00
Andrea Rossato
ce95a5c93a Decoration: comment only
This is a detailed commentary of all the code.
2008-02-19 16:13:39 +00:00
Andrea Rossato
3f40309087 Decoratione: generate rectangles first, and create windows accordingly
With this patch Decoration will first generate a rectangle and only if
there is a rectangle available a window will be created.

This makes the Decoration state a bit more difficult to process, but
should reduce resource consumption.
2008-02-19 12:21:15 +00:00
Roman Cheplyaka
ad5b862c5a Fix doc for Tabbed 2008-02-19 05:56:50 +00:00
Andrea Rossato
a6ce16d2e7 Tabbed and TabBarDecoration: no need to implement decorateFirst (the default is used) 2008-02-18 18:49:50 +00:00
Andrea Rossato
fd250226bc TabBarDecoration: simpleTabBar automatically applies resizeVertical
Added some comments too.
2008-02-18 18:09:22 +00:00
Andrea Rossato
a0067681f3 DwmStyle: comment fix only 2008-02-18 18:07:27 +00:00
Andrea Rossato
4136c4eb22 ResizeScreen: add resizeHorizontalRight and resizeVerticalBottom 2008-02-18 18:05:04 +00:00
Andrea Rossato
1e85802e2f Add TabBarDecoration, a layout modifier to add a bar of tabs to any layout
... and port DecorationMadness to the new system.
2008-02-18 16:11:21 +00:00
Andrea Rossato
cf4bd0a225 add Eq superclass to DecorationStyle and change styles in order not to decorate non managed windows 2008-02-18 13:13:20 +00:00
Andrea Rossato
651acdbc3e Refactor MouseResize, remove isDecoration and introduce isInStack, isVisible, isInvisible
This patch includes several changes, which are strictly related and
cannot be recorded separately:
- remove Decoraion.isDecoartion and introduce Decoration.isInStack
  (with the related change to LayoutHints)
- in Decoration introduce useful utilities: isVisible, isInvisible,
  isWithin and lookFor'
- MouseResize: - invisible inputOnly windows will not be created;
	       - fix a bug in the read instance which caused a failure
                 in the state deserialization.
2008-02-18 10:57:26 +00:00
Andrea Rossato
cb3f424823 Prompt: regenerate completion list if there's just one completion 2008-02-17 13:27:34 +00:00
Andrea Rossato
977349d911 Prompt.Theme: use mkComplFunFromList' to generate completions 2008-02-17 12:44:53 +00:00
Andrea Rossato
72806ee75c some code formatting 2008-02-17 12:44:34 +00:00
Andrea Rossato
6a026cf692 Prompt: comment only (clafiry completionToCommand uses) 2008-02-16 18:16:20 +00:00
Andrea Rossato
11d3eff158 Prompt: comment only (remove confusing remarks about commandToComplete) 2008-02-16 18:04:12 +00:00
Andrea Rossato
2871ea6662 Prompt: haddock fixes only 2008-02-16 17:23:31 +00:00
Andrea Rossato
62637b0325 Prompt.XMonad: use mkComplFunFromList' to get all the completions with an empty command line 2008-02-16 13:39:49 +00:00
Andrea Rossato
4def39f610 Prompt.Window: remove unneeded and ugly escaping/unescaping 2008-02-16 13:38:42 +00:00
Andrea Rossato
f611982205 Theme: move theme's nextCompletion implementation to Prompt.getNextCompletion 2008-02-16 13:37:38 +00:00
Andrea Rossato
b06e4a50fb Shell: escape the string in the command line only 2008-02-16 13:36:51 +00:00
Andrea Rossato
a7da5dd460 Prompt: add some methods to make completions more flexible
- now it is possible to decide if the prompt will complete the last
  word of the command line or the whole line (default is the last
  word);
- completing the last word can be fine tuned by implementing
  'commandToComplete' and 'completionToCommand': see comments for
  details;
- move mkComplFunFromList' from TagWindows to Prompt.
2008-02-16 13:34:54 +00:00
Andrea Rossato
1dd33dc560 Prompt.Theme: display all theme information and handle completion accordingly 2008-02-16 11:41:59 +00:00
Andrea Rossato
e753278080 Prompt.Shell: if there's just one completion and it is a directory add a trailing slash 2008-02-16 11:40:05 +00:00
Andrea Rossato
99f6944c3d Prompt: added nextCompletion and commandToComplete methods to fine tune prompts' completion functions 2008-02-16 11:37:23 +00:00
Andrea Rossato
8a793ce064 Util.Themes: add ppThemeInfor to render the theme info 2008-02-16 11:36:35 +00:00
Andrea Rossato
f4fc09b00d DecorationMadness: resizable layouts now use MouseResize too 2008-02-12 17:36:45 +00:00
Andrea Rossato
94b2529999 SimpleFloat now uses MouseResize 2008-02-12 17:36:15 +00:00
Andrea Rossato
c948559c53 Add Actions.MouseResize: a layout modifier to resize windows with the mouse 2008-02-12 17:34:55 +00:00
Andrea Rossato
c5a57f337e Decoration: remove mouse resize and more
- since mouse resize is not related to decoration, I removed the code
  from here. Mouse resize will be handled by a separated layout
  modifier (in a separated module)
- now also stacked decoration will be removed (I separated insert_dwr
  from remove_stacked)
2008-02-12 16:53:06 +00:00
Andrea Rossato
0d69127db5 Decoration.hs: variable names consistency only 2008-02-11 12:30:56 +00:00
Andrea Rossato
7e8276d0b7 Tabbed and SimpleTabbed (in DecorationMadness) define their own decorationMouseDragHook method
... to disable mouse drag in tabbed layouts
2008-02-11 11:40:43 +00:00
Andrea Rossato
7ffe391d6c Decoration: DecorationStyle class cleanup and focus/drag unification
- moved decoEventHook to decorationEventHook
- added decorationMouseFocusHook, decorationMouseDragHook,
  decorationMouseResizeHook methods
- added a handleMouseFocusDrag to focus and drag a window (which makes
  it possible to focus *and* drag unfocused windows too
2008-02-11 11:36:50 +00:00
Roman Cheplyaka
364ba77cdc Refactor XMonad.Hooks.DynamicLog
This allows using DynamicLog not only for statusbar.
2008-02-10 22:24:06 +00:00
Andrea Rossato
f764fea592 DecorationMadness: comment only 2008-02-10 13:14:27 +00:00
Andrea Rossato
e57a9f011d DecorationMadness: added a few floating layouts 2008-02-10 12:25:23 +00:00
Andrea Rossato
ab38525b72 SimpleFloat: export SimpleFloat and add documentation 2008-02-10 11:31:59 +00:00
Andrea Rossato
041f12f21d Move DefaultDecoration from DecorationMadness to Decoration 2008-02-10 10:43:04 +00:00
Andrea Rossato
c1090dfcaf Themes: added robertTheme and donaldTheme 2008-02-10 08:30:16 +00:00
Andrea Rossato
97371565fa DecorationMadness: make tunable tabbed layouts respect the Theme decoHeight field 2008-02-10 07:53:22 +00:00
Andrea Rossato
f2a268c14e ScreenResize: vertical and horizontal now respond to SetTheme
And so they will change the screen dimension accordingly.
2008-02-10 07:45:44 +00:00
Brent Yorgey
8f71c70d37 WindowGo.hs: fix syntax in example 2008-02-09 22:51:35 +00:00
gwern0
37748e0b26 +doc for WindowGo.hs: I've discovered a common usecase for me for raiseMaybe 2008-02-05 03:21:55 +00:00
gwern0
14792eb6cc Run.hs: add an option to runinterms
It turns out that for urxvt, and most terminal, apparently, once you give a '-e' option, that's it.
They will not interpret anything after that as anything but input for /bin/sh, so if you wanted to go 'runInTerm "'screen -r session' -title IRC"',
you were SOL - the -title would not be seen by urxvt. This, needless to say, is bad, since then you can't do stuff like set the title which means
various hooks and extensions are helpless. This patch adds an extra options argument which is inserted *before* the -e. If you want the old behaivour,
you can just go 'runInTerm "" "executable"', but now if you need to do something extra, 'runInTerm "-title mutt" "mutt"' works fine.

This patch also updates callers.
2008-02-05 03:18:24 +00:00
Andrea Rossato
84d5962dbe Add DecorationMadness: a repository of weirdnesses 2008-02-09 18:25:15 +00:00
Andrea Rossato
29093c6493 Decoration: change mouseEventHook to decoEventHook and more
Fix also the problem with window's movement when the grabbing starts
2008-02-09 16:51:01 +00:00
Andrea Rossato
4ee7aafd1c Tabbed: add simpleTabbed and fx documentation
simpleTabbed is just a version of tabbed with default theme and
default srhinker.
2008-02-09 16:39:17 +00:00
Andrea Rossato
42f78498f1 Arossato: update to latest changes 2008-02-08 14:06:04 +00:00
Andrea Rossato
b8cf0d0694 Decoration: enable mouse dragging of windows 2008-02-08 08:36:02 +00:00
Andrea Rossato
954981e2e3 WindowArranger: add a SetGeometry message - needed to enable mouseDrag 2008-02-08 08:34:13 +00:00
Andrea Rossato
7f5d86009d Decoration: add a mouseEventHook methohd and move mouse button event there 2008-02-08 07:35:14 +00:00
Andrea Rossato
1a99a75bf3 Util.Thems: some more typos in comments 2008-02-07 23:33:41 +00:00
Andrea Rossato
3df63c7376 Util.Themes: documentation and export list (added themes that have been left out) 2008-02-07 23:22:51 +00:00
Andrea Rossato
0e9b9d7263 Prompt.Theme: comments and some point-free 2008-02-07 23:21:55 +00:00
its.sec
44730f59b3 oxymor00nTheme 2008-02-07 21:31:00 +00:00
its.sec
3e5b16da3d add swapScreen to CycleWS
* add support for swapping the workspaces on screens to CycleWS
2008-02-06 19:10:32 +00:00
Andrea Rossato
8578cf419a Decoration: consistency of variable names
Since the configuration is now called Theme, the variable 'c' is now a
't'
2008-02-07 19:14:42 +00:00
Andrea Rossato
7493f8fb04 Add Prompt.Theme: a prompt for dynamically applying a theme to the current workspace 2008-02-07 18:43:21 +00:00
Andrea Rossato
2170415689 Decoration: add a SetTheme message and releaseResources
...which should make it harder to forget to release the font structure.
2008-02-07 18:40:48 +00:00
Andrea Rossato
b690154b97 cabal file: respect alphabetic order for modules 2008-02-07 18:31:53 +00:00
Andrea Rossato
89fa996786 Add Util.Themes to collect user contributed themes 2008-02-07 18:28:43 +00:00
Andrea Rossato
4621e66837 SimpleFloat: comment only 2008-02-07 18:24:38 +00:00
Don Stewart
0675af2b53 Update to safer initColor api 2008-02-06 19:22:32 +00:00
David Roundy
7b022b9981 use Util.WorkspaceCompare in Prompt.Workspace. 2008-02-06 00:40:57 +00:00
David Roundy
ed6b36b289 roll back to previous version of Droundy.hs.
A cleaner WindowNavigation fix made the separation of tabbed and addTabs
not strictly necessary (but still a desireable possibility in my opinion,
as it allows pretty decoration of non-composite layouts that might want to
have some of their windows tabbed.
2008-02-05 20:40:43 +00:00
David Roundy
026400e7ef make WindowNavigation ignore decorations. 2008-02-05 20:35:56 +00:00
David Roundy
5df47fcfc5 make tabbed work nicely with LayoutCombinators and WindowNavigation.
The problem is that WindowNavigation assumes all windows are navigable, and
it was getting confused by decorations.  With a bit of work, we can
decorate windows *after* combining layouts just fine.
2008-02-05 20:23:43 +00:00
David Roundy
f804991d22 make WindowNavigation work when windows are stacked. 2008-02-05 20:20:27 +00:00
gwern0
4c7a536465 XMonad.Actions.WindowGo: add a runOrRaise module for Joseph Garvin with the help of Spencer Janssen 2008-02-04 17:34:02 +00:00
David Roundy
10f24bccaf enable proper handling of panels in droundy config. 2008-02-04 03:08:43 +00:00
David Roundy
a19af8a4f0 enable button click for focus in tabbed.
Note that this patch doesn't work with

Thu Dec 27 03:03:56 EST 2007  Spencer Janssen <sjanssen@cse.unl.edu>
  * Broadcast button events to all layouts, fix for issue #111

but this isn't a regression, since button events have never worked with
tabbed and this change.
2008-02-04 01:05:36 +00:00
David Roundy
dc81032fa8 in Decoration, remove windows that are precisely hidden underneath other windows.
This is needed for WindowNavigation to work properly with the new
Decorations framework.
2008-02-04 00:54:13 +00:00
David Roundy
8034498f91 switch tabbed back to using Simplest (so tabs will be shown). 2008-02-04 00:53:50 +00:00
Brent Yorgey
e6d229e8e1 CycleWS: change example binding for toggleWS from mod-t to mod-z. example bindings shouldn't conflict with default key bindings. 2008-02-01 20:21:26 +00:00
Brent Yorgey
5492a1265e REMOVE RotView: use CycleWS instead.
See CycleWS docs for info on switching, or just look at the changes to
XMonad.Config.Droundy.
2008-02-01 18:06:18 +00:00
Brent Yorgey
1cfbd20de1 CycleWS: add more general functionality that now subsumes the functionality of RotView. Now with parameterized workspace sorting and predicates! 2008-02-01 12:15:24 +00:00
Brent Yorgey
902240b5e0 WorkspaceCompare: some refactoring.
* Export WorkspaceCompare and WorkspaceSort types.
  * Extract commonality in sort methods into mkWsSort, which creates
    a workspace sort from a workspace comparison function.
  * Rename getSortByTag to getSortByIndex, since it did not actually sort
    by tag at all; it sorts by index of workspace tags in the user's config.
  * Create a new getSortByTag function which actually does sort
    lexicographically by tag.
  * Enhance documentation.
2008-02-01 12:04:30 +00:00
Brent Yorgey
e685c5d0ff Search.hs: haddock cleanup 2008-01-31 16:19:48 +00:00
v.dijk.bas
f2877c4f20 Added a handy tip to the documentation of XMonad.Actions.Search
The tip explains how to use the submap action to create a handy submap of keybindings for searching.
2008-01-31 12:26:20 +00:00
Andrea Rossato
3b04fd4235 Make LayoutHints a decoration aware layout modifier 2008-01-31 08:23:14 +00:00
Andrea Rossato
de1d0432b2 Remove LayoutCombinator class and revert PerWorkspace to its Maybe Bool state
As I said in order to have a CombinedLayout type instace of
LayoutClass and a class for easily writing pure and impure combinators
to be feeded to the CombinedLayout together with the layouts to be
conbined, there's seems to be the need to change the type of the
LayoutClass.description method from l a -> String to l a -> X String.

Without that "ugly" change - loosing the purity of the description
(please note the *every* methods of that class unless description
operates in the X monad) - I'm plainly unable to write something
really useful and maintainable. If someone can point me in the right
direction I would really really appreciate.

Since, in the meantime, PerWorkspace, which has its users, is broken
and I broke it, I'm reverting it to it supposedly more beautiful
PerWorkspac [WorkspaceId] (Maybe Bool) (l1 a) (l2 a) type.
2008-01-31 06:39:29 +00:00
Brent Yorgey
adf747b666 Extending.hs: documentation update 2008-01-31 01:27:28 +00:00
Brent Yorgey
1826f43e85 DynamicLog: lots of additional documentation; add byorgeyPP as an example dzen config 2008-01-30 20:52:19 +00:00
Juraj Hercek
f5a867c3a9 Extended PP with sorting algorithm specification and added xinerama sorting
algorithm
  - idea is to specify sorting algorithm from user's xmonad.hs
  - xinerama sorting algorithm produces same ordering as
    pprWindowSetXinerama
  - default ppSort is set to getSortByTag, so the default functionality
    is the same as it was before
2008-01-09 15:49:23 +00:00
Andrea Rossato
9222210f22 SimpleDecoration: export defaultTheme 2008-01-30 12:46:09 +00:00
Spencer Janssen
dfa3a4ee01 Various decorations related updates
* remove deprecated TConf stuff
 * Remove 'style' from DeConf
 * Change DeConf to Theme
 * share defaultTheme across all decorations
2008-01-30 06:46:24 +00:00
Joachim Fasting
c050c3efa9 TwoPane: add description string 2008-01-26 14:13:32 +00:00
Roman Cheplyaka
bb1fce547f add XMonad.Actions.CycleSelectedLayouts 2008-01-16 20:50:20 +00:00
Brent Yorgey
63a63b3bd0 Search.hs: add documentation and two more search engines (MathWorld and Google Scholar) 2008-01-28 19:04:43 +00:00
Brent Yorgey
fd3751ea61 xmonad-contrib.cabal: add build-type field to get rid of Cabal warning 2008-01-28 19:01:37 +00:00
Andrea Rossato
2797c0d71b LayoutCombinator class: code clean up
- ComboType becomes CombboChooser
- removed the stupid doFirst
- better comboDescription default implemenation
2008-01-29 22:49:52 +00:00
Andrea Rossato
055a6b1232 Add a LayoutCombinator class and a CombinedLayout and port PerWorkspace to the new system 2008-01-29 19:29:03 +00:00
Andrea Rossato
f23a87f4e6 Named: reimplemented as a LayoutModifier and updated Config.Droundy accordingly 2008-01-28 16:13:43 +00:00
Andrea Rossato
6912227914 LayoutModifier: add modifyDescription for completely override the modified layout description 2008-01-28 16:06:14 +00:00
Andrea Rossato
5dab294a2d Make ToggleLayouts and Named implement emptyLayout 2008-01-28 15:15:35 +00:00
Andrea Rossato
97acd14ed5 Decoration: the fontset must be released even when we don't decorate the first window
This is quite an old bug! It affected Tabbed since the very beginning..;)
2008-01-28 00:44:11 +00:00
Andrea Rossato
beea8ab5d8 Decoration: I forgot we need to release the fontset too! 2008-01-27 23:35:21 +00:00
Andrea Rossato
700944720b Decoration: after deleting the windows we must update the layout modifier
Thanks to Feuerbach for reporting this.
2008-01-27 23:18:15 +00:00
Andrea Rossato
c281e20e0a Reflect: reimplemented as a layout modifier (which makes it compatible with windowArranger and decoration) 2008-01-27 16:58:54 +00:00
Andrea Rossato
ddbbc56285 SimpleFLoat: change the description to Float (Simple is the decoration description) 2008-01-27 14:45:56 +00:00
Andrea Rossato
14d7231dd0 ManageDocks: implement AvoidStruts as a layout modifier 2008-01-27 14:43:01 +00:00
Andrea Rossato
18921e16c9 ResizeScreen has been rewritten as a layout modifier 2008-01-27 14:08:37 +00:00
Andrea Rossato
0f0a99e355 LayoutModifier add a modifyLayout
Many layouts are written as layout modifiers because they need to
change the stack of the rectangle before executing doLayout.

This is a major source of bugs. all layout modifiers should be using the
LayoutModifier class. This method (modifyLayout) can be used to
manipulate the rectangle and the stack before running doLayout by the
layout modifier.
2008-01-27 14:02:19 +00:00
Andrea Rossato
099d1c689f Make LayoutCombinators deal with emptyLayout 2008-01-27 09:24:15 +00:00
Andrea Rossato
ee0b0d59cb Add ResizeScreen, a layout modifier for modifing the screen geometry 2008-01-27 01:07:55 +00:00
Andrea Rossato
8f65eecf92 WindowArranger can now arrange all windows
This is useful for SimpleFloat, whose state can now persists across
layout switches.
2008-01-26 23:30:53 +00:00
Andrea Rossato
bb4c97ede0 Arossato: updated my config to recent changes 2008-01-26 20:56:38 +00:00
Andrea Rossato
de40bee12f Add SimpleFloat a very basic floating layout that will place windows according to their size hints 2008-01-26 20:54:10 +00:00
Andrea Rossato
c84a26022d WindoWrranger: export the WindowArranger type (see the upcoming SimpleFloat) 2008-01-26 20:46:05 +00:00
Andrea Rossato
d32fa5ae21 ShowWName: show the name of empty layouts too 2008-01-26 19:02:14 +00:00
Andrea Rossato
07c2c3e7f9 ManageDocks: add emptyLayout definition for supporting the new decoration framework 2008-01-26 18:59:36 +00:00
Andrea Rossato
a7bc2bf88e Decoration: code formatting only 2008-01-26 10:13:54 +00:00
Andrea Rossato
6d21eb841e export DeConfig to avoid importing Decoration 2008-01-26 10:10:49 +00:00
Andrea Rossato
ababfeca6f Prompt: code formatting only 2008-01-26 09:32:34 +00:00
Andrea Rossato
041eb5dc18 Don't export TConf anymore and export DeConfig instead
WARNING: this patch may be breaking your configuration. While it is
still possible to use:

tabbed shrinkText defaultTConf

updating the fields of the defaultTConf record is not possible
anymore, since the type TConf is now hidden.

WARNING: "tabSize" has been substituted by "decoHeight"

You can change your configuration this way:
myTConf :: TConf
myTConf = defaultTConf
       { tabSize = 15
       , etc....

becomes:
myTConf :: DeConfig TabbedDecoration Window
myTConf = defaultTabbedConfig
       { decoHeight = 15
       , etc....

and
tabbed shrinkText myTConf

becomes:
tabDeco shrinkText myTConf
2008-01-26 09:21:41 +00:00
Andrea Rossato
baca0e98d1 Tabbed now uses Decoration 2008-01-25 15:23:11 +00:00
Andrea Rossato
18e5a2658f Add DwmStyle, a layout modifier to add dwm-style decorations to windows in any layout 2008-01-25 15:21:52 +00:00
Andrea Rossato
8c3d08544a Adde SimpleDecoration, a layout modifier to add simple decorations to windows in any layout 2008-01-25 15:21:06 +00:00
Andrea Rossato
82a62c856f Add Layout.Simplest, the simplest layout 2008-01-25 15:20:15 +00:00
Andrea Rossato
6a6a09a991 Add Decoration, a layout modifier and a class for easily writing decorated layouts 2008-01-25 15:17:26 +00:00
Andrea Rossato
c749fbc399 Add WindowArranger, a layout modifier to move and resize windows with the keyboard 2008-01-25 15:16:33 +00:00
Andrea Rossato
968868a359 ShowWName: moved fi to XUtils 2008-01-24 13:47:25 +00:00
Andrea Rossato
8120af677b XUtils: add functions for operating on lists of windows and export fi 2008-01-24 13:46:38 +00:00
Andrea Rossato
e9f0f05217 LayoutModifier: add emptyLayoutMod for dealing with empty workspaces 2008-01-24 01:56:05 +00:00
Andrea Rossato
efc4ad95b8 LayoutModifier: add pureMess and pureModifier to the LayoutModifier class 2008-01-22 11:13:19 +00:00
Andrea Rossato
a07b207023 Layout.ShowWName: generalize the instance 2008-01-15 04:51:39 +00:00
Lukas Mai
d1dc49575b add emptyLayout to MultiToggle 2008-01-28 17:53:13 +00:00
Lukas Mai
ced1792bfa grammar fix 2008-01-28 17:50:59 +00:00
Spencer Janssen
2659a12049 depend on xmonad-0.6 2008-01-27 22:11:01 +00:00
Spencer Janssen
3533a5d3f3 Bump version to 0.6 2008-01-27 21:15:04 +00:00
Spencer Janssen
d8baf188db I use urxvtc now 2008-01-27 21:14:52 +00:00
Spencer Janssen
8dcb699db3 Update the test hook 2008-01-27 20:51:48 +00:00
Lukas Mai
4440974718 add 'single' helper function 2008-01-17 23:45:50 +00:00
Lukas Mai
7629022c72 documentation fix 2008-01-17 23:44:01 +00:00
Lukas Mai
9a209f6d55 style assimilation 2008-01-17 23:40:59 +00:00
xmonad-contrib
9a6494fae2 cleared up transience to better highlight how to use ManageHooks properly
The initial patch that extended the EDSL for writing ManageHook rules did not come with a good example on how to use it.  This patch ammends that. 'move' is an example of how to write a rule to resolve a Query (Maybe a) into something tangible.  'move'' is an example of how to write a rule isolating window managing code from the rest ofthe mess the EDSL creates.
2008-01-02 07:48:10 +00:00
xmonad-contrib
f7c34eef31 expands the EDSL for performing actions on windows
This patch adds a few types of relationships and operators for managing windows with rules.  It provides grouping operators so the X action can access the quantifier that was matched or not matched.  It provides a formalism for predicates that work in both grouping and non grouping rules.  It could do with some classes, so that there are fewer operators that always do the Right Thing (TM), but the Haskell Type system currently has some problems resolving types.  Since I don't know enough about these high level things, it would be hard to create a GHC patch just to make it all work.
2008-01-01 17:44:46 +00:00
Spencer Janssen
dec7167bc8 -Werror when flag(testing) only 2008-01-18 01:52:07 +00:00
Andrea Rossato
80f70d284d Timer: some code cleanup 2008-01-14 21:11:14 +00:00
nicolas.pouillard
c7a64a99ce Use doubleFork instead of manual double fork, or buggy single fork.
This fixes showWName because Timer was leaking zombie processes.
You should update xmonad, since doubleFork was not exported.
2008-01-14 20:28:33 +00:00
Brent Yorgey
73502fbbdf Reflect.hs: minor haddock fix 2008-01-16 20:35:46 +00:00
Brent Yorgey
10fbf85a2a Reflect.hs: use -fglasgow-exts for now instead of LANGUAGE pragmas, for compatibility with ghc 6.6 2008-01-15 19:48:11 +00:00
Brent Yorgey
e0024ec9c8 Reflect.hs: add MultiToggle support 2008-01-15 19:35:19 +00:00
Brent Yorgey
670d3160c4 MultiToggle.hs: improve 'description' implementation in LayoutClass instance to display the current transformed layout rather than just 'MultiToggle' 2008-01-15 19:33:11 +00:00
Brent Yorgey
4026d40730 Layout.Reflect: new contrib module for reflecting layouts horizontally/vertically 2008-01-15 03:09:47 +00:00
Brent Yorgey
e76c654211 ShowWName.hs: switch color/bgcolor in call to paintAndWrite 2008-01-14 15:38:21 +00:00
Andrea Rossato
1e7cd73544 Prompt: clean up and optimize moveWord a bit 2008-01-13 16:47:45 +00:00
Andrea Rossato
06b3767cae Prompt: added moveWord to move the cursor to the word boundaries
The actions have been bound to ctrl+Left and Right
2008-01-13 12:35:29 +00:00
Andrea Rossato
1125e9102e Doc.Extending: added links and description of recent module addition 2008-01-13 09:32:11 +00:00
Andrea Rossato
396ae4e77c Action.Search: small haddock fixes 2008-01-13 09:26:46 +00:00
Andrea Rossato
7124346ebe ShowWName now uses Timer and XUtils to display the workspace name 2008-01-13 09:11:07 +00:00
Andrea Rossato
6283298a85 Add XMonad.Util.Timer, a module to set up timers and to handle them 2008-01-13 09:01:40 +00:00
Andrea Rossato
c1a711dba0 de-obfuscate the initState and set the init offset to the length of the default text 2008-01-10 14:09:51 +00:00
nicolas.pouillard
9a4559d2fa prompt: Allow to provide a default text in the prompt config. 2008-01-09 21:39:16 +00:00
Joachim Fasting
9b0a2649b6 Correct caps in module header. 2007-12-30 06:19:20 +00:00
Joachim Fasting
8454e5d6b3 Use LANGUAGE pragma. 2007-12-30 06:18:17 +00:00
mail
35c5c1eaf0 shiftPrevScreen and shiftNextScreen, to make CycleWS consistent 2007-12-31 17:16:09 +00:00
Don Stewart
a0dde418ad formatting 2007-12-04 17:49:20 +00:00
Brent Yorgey
4fbd0c5b3f PerWorkspace.hs: add an explanatory note 2007-12-31 13:58:06 +00:00
Andrea Rossato
926c5ec9d2 Add ShowWName a layout modifier to show the workspace name
This module requires dzen
2007-12-31 13:04:41 +00:00
Andrea Rossato
69453d212a ManageDocks: some documentation fixes 2007-12-31 10:18:20 +00:00
Spencer Janssen
0917d4f5d4 -Wall police (again) 2007-12-28 06:18:41 +00:00
Spencer Janssen
0bf616d2fb -Wall police 2007-12-28 06:18:22 +00:00
mail
4f2feafd04 Fulfill the EWMH specification by listing the supported ATOMs, doesnt really make a differene AFAIK 2007-12-27 21:56:07 +00:00
mail
e153c6d406 display all visible windows on the current desktop in the pager
This is my best shot at modeling xmonad’s WM behaviour in a way that
the Extended Window Manager Hints specification allows.

Unfortunately, we can not tell the panel what size and position it should
think the apps are.
2007-12-27 20:43:49 +00:00
mail
0b1beb1d2b Although I do not need the curr variable after all, this is nicer 2007-12-27 19:01:13 +00:00
mail
54c138c4f0 Add support for cycling through screens to CycleWS 2007-12-27 18:26:35 +00:00
mail
35ea95dc88 Clear _NET_ACTIVE_WINDOW when nothing is focused 2007-12-28 15:42:22 +00:00
Andrea Rossato
6bcefb308b textExtentsXMF doesn't require the display 2007-12-28 12:59:13 +00:00
Spencer Janssen
c6e80350e2 Don't bother checking executable bits of items in $PATH, yields a significant speed-up 2007-12-26 03:24:12 +00:00
Brent Yorgey
24b112c452 ResizableTile.hs: fix resizing to work in the presence of floating windows (resolves issue #100) 2007-12-25 13:58:39 +00:00
Andrea Rossato
c698a58fe6 LayoutScreens: haddock fixes 2007-12-25 10:53:16 +00:00
Andrea Rossato
f6723df7d8 XMonad.Actions.Search: haddock fix 2007-12-24 17:11:15 +00:00
Andrea Rossato
0c835744c2 Fix isssue 105
issue 105 was due to the fact that tab windows created when
bootstrapping the windowset after a restart where managed. Setting the
override_redirect attributes to True fixes the issue.

Added the possibility to set the override_redirect attribute with
XMonad.Util.XUtils.creationNewWindow
2007-12-24 17:10:20 +00:00
gwern0
7e0186ef4e Prompt.hs: mv .xmonad_history into .xmonad/
See my email to mailing list. This will slightly break anyone who upgrades while running and expects to see their prompt history, and leave a stray file, I think, but nothing else, and it'll permanently improve tab-completion, and is tidier.
2007-12-24 05:46:10 +00:00
gwern0
9e28c1ce37 Search.hs: +docs, and export simpleEngine so users can define their own 2007-12-24 04:38:28 +00:00
gwern0
7b3466d9a9 Search.hs: mv into Actions/ per IRC suggestion 2007-12-24 04:37:35 +00:00
Lukas Mai
bf55da2bad add XMonad.Actions.NoBorders 2007-12-20 20:39:53 +00:00
Spencer Janssen
53571aad1e AvoidStruts: add support for partial struts 2007-12-22 13:34:25 +00:00
Brent Yorgey
838c878fa2 Search.hs: add hoogle 2007-12-22 18:49:12 +00:00
Spencer Janssen
feae6b11e5 ManageDocks: ignore desktop windows also 2007-12-22 11:38:08 +00:00
Spencer Janssen
0cca07363d Wibble 2007-12-22 11:06:41 +00:00
Spencer Janssen
4c6f940a1d EwmhDesktops: add _NET_ACTIVE_WINDOW support 2007-12-22 11:05:52 +00:00
Spencer Janssen
44cf0f02c3 A few short comments for WorkspaceCompare 2007-12-22 10:50:45 +00:00
Spencer Janssen
64c9db6bab EwmhDesktops: drop 'Workspace' from displayed workspace names 2007-12-22 10:45:59 +00:00
Spencer Janssen
e11534fa56 Factor workspace sorting into a separate module 2007-12-22 10:41:14 +00:00
Spencer Janssen
662eeb7e5f No more tabs 2007-12-22 05:04:39 +00:00
Spencer Janssen
da6155ebac Refactor Search.hs 2007-12-22 04:47:14 +00:00
Spencer Janssen
edb48ee66c Generalize XSelection functions to MonadIO 2007-12-22 04:45:14 +00:00
gwern0
a5431b3f85 Search.hs: +imdb & amazon engines for unk_red 2007-12-22 03:58:37 +00:00
gwern0
cdf37639e4 Search.hs: cleanup and refactor 2007-12-20 17:40:01 +00:00
Spencer Janssen
9997b18970 Update various restart bindings 2007-12-19 22:06:34 +00:00
Roman Cheplyaka
ef14aa07ba Fix typo. 2007-12-19 07:38:57 +00:00
Brent Yorgey
f20b54067c Doc/Developing.hs: add some information about Haddock documentation. 2007-12-19 21:53:00 +00:00
Brent Yorgey
1a4c17e35e require haddock documentation to build successfully in order to record a patch. 2007-12-19 21:52:17 +00:00
Spencer Janssen
71f87d5804 Remove inaccurate comment about 'banish' 2007-12-17 23:15:40 +00:00
Brent Yorgey
0d5de727c3 Warp.hs: haddock fixes 2007-12-17 22:47:12 +00:00
gwern0
697d9e21b7 Warp.hs: +doc
Describe how to emulate Ratpoison's 'banish' functionality on one's config
2007-12-16 03:00:15 +00:00
Brent Yorgey
2949cbeef4 Util/Search.hs: a few updates/fixes
* fix shadowing warning (ghc 6.8.2 complains)
  * export a few more of the functions
  * re-de-obfuscate generated URLs by not escaping alphanumerics or punct.
2007-12-17 22:29:30 +00:00
gwern0
8925732d5f Util.Search: import escapeURIString, and fall back on the ugly const false hack to avoid copy-pasting even more 2007-12-15 21:16:38 +00:00
David Roundy
ecc2f0d5ec update Config.Droundy to use a few nice hooks. 2007-12-16 18:56:53 +00:00
Shachaf Ben-Kiki
0853c1ce21 Add UrgencyHook support to Tabbed 2007-12-15 17:16:17 +00:00
Brent Yorgey
b95f4daab7 DynamicLog.hs: some documentation updates. 2007-12-15 14:37:27 +00:00
Brent Yorgey
e75a72d63f DynamicLog.hs: fix shadowing warning 2007-12-15 14:32:27 +00:00
Shachaf Ben-Kiki
7064ac5ec9 Add UrgencyHook support to DynamicLog
Someone with Xinerama should look at this -- I don't know exactly how that
should behave.
2007-12-14 04:35:28 +00:00
Spencer Janssen
d4798cf7ae Depend on X11-1.4.1, it has crucial bugfixes 2007-12-15 02:21:51 +00:00
Spencer Janssen
5954f61988 Remove network dependency, potentially breaking XMonad.Util.Search 2007-12-14 23:18:59 +00:00
Brent Yorgey
67ab9fb6ad Search.hs: fix shadowing warning and haddock errors 2007-12-14 16:31:19 +00:00
gwern0
38306b1deb +cabal support for XMonad.Util.Search 2007-12-13 20:56:54 +00:00
gwern0
aba20ccf60 +XMonad.Util.Search: new module
This module is intended to provide helpful functions for easily running web searchs; just hit a bound key, enter your query, and up opens a new tab/browser/window with the search results. In theory anyway; the Wikipedia and Google ones work fine for me, but the Internet Archive's docs on how to do don't necessarily seem to be correct. If you were, like me, previously running shell commands to call Surfraw or similar shell scripts to do the same thing, you can now scrap them and replace them.

There aren't too many search engines defined here; new ones would be good, and they're easy to add!
2007-12-13 20:51:59 +00:00
Spencer Janssen
647c7e9b61 Add support for _NET_WM_STRUT_PARTIAL 2007-12-13 02:17:04 +00:00
Spencer Janssen
2033064db1 ManageDocks: when there are struts on opposing edges, the right/bottom strut
was ignored.  TODO: quickchecks
2007-12-10 02:10:30 +00:00
"Valery V. Vorotyntsev"
dd80c23f56 Run.hs: fix documentation, cleanup whitespace 2007-12-12 09:15:16 +00:00
"Valery V. Vorotyntsev"
fb9a8cfef8 Man.hs: input speedup
Descend manpage directories once -- when `manPrompt' is called.
(Previous version used to search directories upon each character
arrival.)
2007-12-12 09:02:56 +00:00
Lukas Mai
02012aeedd new XMonad.Hooks.ManageHelpers module 2007-12-11 18:30:40 +00:00
intrigeri
ef79fa7c10 Magnifier: custom zoom ratio for magnifier' too 2007-12-11 01:55:54 +00:00
Brent Yorgey
2a73b577c2 Magnifier.hs: minor haddock fixes 2007-12-11 01:11:54 +00:00
tim.thelion
0155164015 fix haddock on Magnifier 2007-12-10 23:19:42 +00:00
tim.thelion
5375240f08 Custom zoom levels for magnifier 2007-12-08 23:08:44 +00:00
Spencer Janssen
3cdd04141f Remove references to xmonad 0.4 2007-12-09 23:23:24 +00:00
Spencer Janssen
aca2d6f365 Bump version to 0.5! 2007-12-09 23:16:22 +00:00
Andrea Rossato
88424dc1a8 Extending: updated to the lates config changes - manageHook simplification 2007-12-09 16:47:31 +00:00
Spencer Janssen
71d1c8c23b I use ManageDocks now 2007-12-09 13:44:45 +00:00
Spencer Janssen
bd3e3ed64c Update ManageDocks to the new ManageHook system, remove the gap setting code in favor of AvoidStruts 2007-12-09 13:42:25 +00:00
Andrea Rossato
2d4032665d Extending: some fixes 2007-12-09 12:36:23 +00:00
Andrea Rossato
b2d8bd71c3 Arossato: my teaTime application. 2007-12-09 12:33:27 +00:00
Andrea Rossato
e630b47bc2 XPropManage: haddock fixes 2007-12-09 12:32:46 +00:00
Andrea Rossato
a488b7a54f SetWMName: haddock fixes 2007-12-09 12:32:27 +00:00
Andrea Rossato
7330ee34af EwmhDesktops: haddock fixes 2007-12-09 12:32:04 +00:00
Andrea Rossato
8dc2651a9c DynamicLog: haddock fixes 2007-12-09 12:31:48 +00:00
dominik
0e3d6afc96 Sshprompt: Add explanation for the completion in sshprompt 2007-12-07 00:09:04 +00:00
Spencer Janssen
503cb539af More import pruning 2007-12-08 01:48:46 +00:00
Spencer Janssen
3a522e7e3c Remove XMonad.Operations imports 2007-12-08 00:05:47 +00:00
Spencer Janssen
4f7764ca8b Prune more imports 2007-12-07 23:51:16 +00:00
Spencer Janssen
e85228229b I use CopyWindow now 2007-12-07 23:40:18 +00:00
Spencer Janssen
dc11825588 Remove redundant imports 2007-12-07 23:38:27 +00:00
Spencer Janssen
5f190a315e Typo in extra-source-files 2007-12-05 05:03:11 +00:00
Spencer Janssen
05bca1c2aa Depend on X11>=1.4.0 2007-12-05 05:00:12 +00:00
Spencer Janssen
7a054e9d3e Remove TilePrime, it is subsumed by HintedTile 2007-12-05 04:57:46 +00:00
Spencer Janssen
58d540789b Update Sjanssen.hs 2007-12-05 04:56:48 +00:00
Brent Yorgey
7296b99306 LayoutScreens and Square: haddock updates 2007-12-04 20:40:39 +00:00
Brent Yorgey
258ccb3468 Droundy.hs: add spaces so haddock isn't confused by commented-out ||| combinator 2007-12-04 20:36:22 +00:00
David Roundy
2c856dceec my urgency-hook code also seems to crach... change in Droundy. 2007-12-01 16:23:10 +00:00
David Roundy
03d4f8ea9c disable avoidStruts in Droundy again.
Apparently, ManageDocks still crashes on X86-64...
2007-12-01 16:02:26 +00:00
David Roundy
c4117a1de0 fix bug where we failed to hide combo decorations. 2007-12-01 15:58:59 +00:00
David Roundy
e849a055e3 add to Droundy a non-working urgency hook and enable avoidStruts. 2007-12-01 13:29:10 +00:00
gwern0
e5c50cd0c8 update XSelection.hs; apparently the utf8-string library has updated
Note that this does not fix the apparent problems with actually using getSelection, even though it works fine from a GHCi prompt...
2007-11-30 16:14:29 +00:00
Brent Yorgey
dcd3bc5324 LayoutScreens: documentation fix 2007-11-30 16:54:23 +00:00
David Roundy
7794428303 tune Droundy config. 2007-11-30 14:51:38 +00:00
David Roundy
fc5277fe1c more coding on Mosaic. 2007-11-23 19:24:55 +00:00
David Roundy
14c60215a1 make Mosaic read (and partially try to obey) WM hints. 2007-11-23 16:25:38 +00:00
Brent Yorgey
7acf6462cb refactor XMonad.Prompt, add new modules XMonad.Prompt.{Input,Email}
XMonad.Prompt.Input is a new module which provides a framework for
prompting the user for input and passing it along to some other action,
useful for building actions which require user input.
XMonad.Prompt.Email is a simple example of the use of XMonad.Prompt.Input,
which prompts the user for a recipient, subject, and body, and sends
a one-line email.
I also made a small refactoring to XMonad.Prompt in order to support
XMonad.Prompt.Input.
2007-11-28 14:24:17 +00:00
Brent Yorgey
baa85def23 AppendFile: initial import
XMonad.Prompt.AppendFile is a new module which provides a prompt for
appending a single line of text to a file.  I use it for quickly
writing down ideas/todos/etc. to a special file when I can't be 
bothered to stop what I'm doing to write things down properly.
2007-11-27 22:42:58 +00:00
Brent Yorgey
98840048e5 DynamicWorkspaces: haddock updates 2007-11-27 22:00:33 +00:00
Brent Yorgey
760a240af1 WorkspaceDir: minor haddock update 2007-11-27 21:56:52 +00:00
Brent Yorgey
26e5824938 WmiiActions: haddock updates 2007-11-27 19:44:27 +00:00
Brent Yorgey
d6af9405ba WindowBringer: haddock updates 2007-11-27 19:39:48 +00:00
Brent Yorgey
3a6e31a64f Warp: haddock updates 2007-11-27 19:37:17 +00:00
Brent Yorgey
a24f632959 TagWindows: haddock updates 2007-11-27 19:32:13 +00:00
Brent Yorgey
99e858140c SwapWorkspaces: haddock updates 2007-11-27 19:26:34 +00:00
Brent Yorgey
eb6c642fd9 SimpleDate, Submap: modMask --> modMask x 2007-11-27 19:20:39 +00:00
Brent Yorgey
0cce3cff7e Submap: haddock updates 2007-11-27 19:18:41 +00:00
Brent Yorgey
913bd274b3 SinkAll: haddock updates 2007-11-27 19:13:18 +00:00
Brent Yorgey
dbff738cda SimpleDate: haddock updates; more specific imports 2007-11-27 19:08:32 +00:00
Brent Yorgey
8099d676de Doc/Developing: various edits 2007-11-27 19:03:45 +00:00
Brent Yorgey
971c34ba4a RotView: haddock updates 2007-11-27 18:57:41 +00:00
Brent Yorgey
b4937810cc LayoutCombinators: a few minor haddock fixes 2007-11-27 16:31:06 +00:00
Andrea Rossato
cc1a24c1c8 LayoutCombinators: changes infixes and added many other combinators. 2007-11-27 16:18:07 +00:00
Andrea Rossato
d5533e4dec CopyWindow: fixed docs 2007-11-25 12:14:18 +00:00
Spencer Janssen
f18819f306 Alleviate clashing symbols with XMonad.ManageHook.<||> 2007-11-27 00:42:58 +00:00
Brent Yorgey
2bcef79a1f xmonad-contrib.cabal: better order for the documentation links 2007-11-25 17:17:45 +00:00
Don Stewart
0c16884d6c links to documentatoin subsections in generated docs 2007-11-25 05:22:06 +00:00
Don Stewart
3ee8f201ce depend on X11 1.4.0 2007-11-25 03:46:56 +00:00
Brent Yorgey
93fd3f0f7d RotSlaves: haddock updates 2007-11-24 17:45:18 +00:00
Brent Yorgey
0564291490 MouseGestures: haddock updates 2007-11-24 17:33:51 +00:00
Brent Yorgey
a94c862a53 Extending.hs: a few edits 2007-11-24 17:14:52 +00:00
Andrea Rossato
503400b6f8 Developing: a start 2007-11-24 14:11:33 +00:00
Andrea Rossato
e07df4eb6b Extending: some more stuff 2007-11-24 14:11:06 +00:00
Andrea Rossato
e3b779303f Arossato: some changes. I now use Magnifier among my layouts 2007-11-24 14:09:18 +00:00
Andrea Rossato
97b8a0aefc DynamicLog: added a dynamicLogXmobar 2007-11-24 12:52:02 +00:00
Brent Yorgey
09faa86c16 Haddock docs: modMask --> modMask x 2007-11-24 02:26:35 +00:00
Brent Yorgey
f8a054f592 FocusNth: haddock updates 2007-11-24 02:22:49 +00:00
Brent Yorgey
82d9e02b96 FloatKeys: haddock updates 2007-11-24 00:37:02 +00:00
Brent Yorgey
3a8cf88fb5 FlexibleResize: haddock updates 2007-11-24 00:20:13 +00:00
Brent Yorgey
bc45ff76d1 FlexibleManipulate: add link to mouse binding documentation 2007-11-24 00:19:27 +00:00
Brent Yorgey
c24838627b FlexibleManipulate: haddock updates 2007-11-24 00:07:54 +00:00
Brent Yorgey
5648308b8e FindEmptyWorkspace: haddock updates 2007-11-23 23:54:27 +00:00
Brent Yorgey
4761b83657 Doc/Extending.hs: edits 2007-11-23 23:27:43 +00:00
Andrea Rossato
6339686032 Extending: added manageHook and logHook sections 2007-11-23 21:29:43 +00:00
Andrea Rossato
495b25c884 Magnifier: typo 2007-11-23 21:29:00 +00:00
Andrea Rossato
9cd120f599 LayoutCombinators: fix doc 2007-11-23 17:57:23 +00:00
Brent Yorgey
b13fd2d464 DwmPromote: haddock updates 2007-11-23 20:22:04 +00:00
Brent Yorgey
518cb7432f DeManage: haddock updates 2007-11-23 20:17:02 +00:00
Brent Yorgey
52df6deb52 CycleWS: haddock updates 2007-11-23 20:11:22 +00:00
Brent Yorgey
efb59f06f8 CopyWindow: haddock updates 2007-11-23 20:06:43 +00:00
Brent Yorgey
11a24393fe ConstrainedResize: haddock updates 2007-11-23 19:56:43 +00:00
Brent Yorgey
57d5cb0962 Doc/Extending.hs: add a section about configuring mouse bindings. 2007-11-23 18:45:01 +00:00
Brent Yorgey
eef80d1841 Commands.hs: haddock updates 2007-11-23 17:16:19 +00:00
Brent Yorgey
e6dcaa15c7 dafaultConfig --> defaultConfig 2007-11-23 16:47:22 +00:00
Andrea Rossato
6d7507d4a8 LayoutCombinators: haddock documentation 2007-11-23 15:43:11 +00:00
Andrea Rossato
63c531bb5e ToggleLayout: haddock fixes 2007-11-23 14:29:34 +00:00
Andrea Rossato
1e35714e1e LayoutHints: haddock fixes 2007-11-23 14:28:59 +00:00
Andrea Rossato
ec0d5129a3 LayouModifier: haddock docs 2007-11-23 14:25:19 +00:00
Andrea Rossato
8f641ff025 MagicFocus: haddock docs 2007-11-23 14:16:57 +00:00
Andrea Rossato
4e047d2666 Maximize: haddock fixes 2007-11-23 14:13:04 +00:00
Andrea Rossato
6cfb38608c MosaicAlt: haddock fixes 2007-11-23 14:10:21 +00:00
Andrea Rossato
79f22e7615 Named: haddock fixes 2007-11-23 14:05:57 +00:00
Andrea Rossato
6d35c4c723 NoBorders: haddock fixes 2007-11-23 14:05:35 +00:00
Andrea Rossato
b1af78da95 ResizableTile: haddock fixes 2007-11-23 14:05:11 +00:00
Andrea Rossato
ee4e14c9bd Roledex: haddock fixes 2007-11-23 14:04:51 +00:00
Andrea Rossato
de23c9ab0d Spiral: haddock docs 2007-11-23 13:50:23 +00:00
David Roundy
3885445b26 clean up mosaic a bit more. 2007-11-23 15:36:17 +00:00
Andrea Rossato
81fa770e4c Mosaic: fix docs 2007-11-23 12:53:39 +00:00
Andrea Rossato
7ce5f6e0da ThreeColumns: haddock docs 2007-11-23 12:46:59 +00:00
Andrea Rossato
f9e497687c TilePrime: haddock docs 2007-11-23 12:44:56 +00:00
Andrea Rossato
8682f617d0 TwoPane: haddock docs 2007-11-23 12:31:55 +00:00
Andrea Rossato
33bca8260f WindowNavigation: haddock documentation 2007-11-23 12:11:29 +00:00
Andrea Rossato
ea2102f93c WorkspaceDir: docs 2007-11-23 11:56:35 +00:00
Andrea Rossato
978d2fe54d HntedTile: alignement 2007-11-23 11:50:31 +00:00
Andrea Rossato
e472709986 Combo: some haddock formatting 2007-11-23 11:49:04 +00:00
David Roundy
51d6066d15 make CopyWindow export a fancy copy-window-anywhere function. 2007-11-23 12:10:20 +00:00
David Roundy
8b3ad50c57 remove need for faulty Read instance of NamedWindow. 2007-11-22 17:04:48 +00:00
Andrea Rossato
0004559b97 Magnifier: more refactoring and a few message handlers 2007-11-23 11:33:53 +00:00
Andrea Rossato
70175d85bf cabal: build Magnifier again. 2007-11-22 19:04:27 +00:00
Andrea Rossato
1645745f29 Magnifier: some fixes and refactoring. It now works properly. 2007-11-22 19:01:24 +00:00
Alec Berryman
e65e2e3dba Mosaic: unbreak build, remove unused import that ghc complains about 2007-11-22 17:59:25 +00:00
Andrea Rossato
402054c581 Extending: editing the key bindings require importing Data.Map 2007-11-22 13:39:01 +00:00
Andrea Rossato
378a9ea8b3 cabal: added mosaic and anneal 2007-11-22 13:38:37 +00:00
Andrea Rossato
5ea409d27d NamedWindow: Mosaic requires NamedWindow to have a Read instance 2007-11-22 13:38:02 +00:00
Andrea Rossato
90abd48f28 Added Anneal used by the original mosaic 2007-11-22 13:37:32 +00:00
Andrea Rossato
fb8b39b822 Make the original Mosaic work with LayoutClass 2007-11-22 13:36:58 +00:00
"Valery V. Vorotyntsev"
ecfa40bec9 Prompt/Man.hs: fixing haddock 2007-11-22 09:18:28 +00:00
Spencer Janssen
0ef0c613d7 Don't show HintedTile in the description 2007-11-22 07:26:15 +00:00
Devin Mullins
afce47a330 UrgencyHook: haddock fixes 2007-11-22 06:56:16 +00:00
joel.suovaniemi
c298c87da1 updated XPropManage to ManageHook type 2007-11-22 05:32:03 +00:00
Spencer Janssen
baf2ae570d More HintedTile refactoring 2007-11-22 05:31:54 +00:00
Spencer Janssen
bb74a0bc0d HintedTile:
- code formatting
 - refactoring, based on TilePrime work by Eric Mertens
 - use the current border width of the window, this improves interaction with
   the No/SmartBorders extensions
2007-11-22 05:11:57 +00:00
Spencer Janssen
1519612c23 HintedTile: orientation bug fix, remove wide and tall in favor of the Tall and Wide constructors. 2007-11-22 04:27:20 +00:00
Joachim Fasting
8a614b8328 Hooks/DynamicLog.hs: minor typo. 2007-11-19 13:12:18 +00:00
Brent Yorgey
27506065b2 Extending.hs: more edits and additions. 2007-11-22 03:44:32 +00:00
Brent Yorgey
0dd121e4f7 Doc.hs: edits and additions 2007-11-21 20:43:29 +00:00
Brent Yorgey
450262dca0 Extending.hs: edits and additions 2007-11-21 20:36:31 +00:00
Brent Yorgey
f8a5f32bb3 Configuring.hs: edits and additions 2007-11-21 20:33:12 +00:00
Brent Yorgey
c02e84f98b README: update reference to documentation 2007-11-21 20:26:43 +00:00
Andrea Rossato
1902145b6e Tabbed: haddock fixes 2007-11-21 18:17:10 +00:00
Andrea Rossato
1713fa33c7 HintedTile: haddock fixes 2007-11-21 18:16:35 +00:00
Andrea Rossato
e522c5e9db Grid: haddock fixes 2007-11-21 18:16:16 +00:00
Andrea Rossato
fd4e59e71c DragPane: haddock fixes 2007-11-21 18:15:55 +00:00
Andrea Rossato
e991fd9430 Dishes: haddock fixes 2007-11-21 18:15:29 +00:00
Andrea Rossato
aa42d25ad6 Combo: haddock fixes 2007-11-21 18:15:07 +00:00
Andrea Rossato
aad6a7d747 Circle: haddock fixes 2007-11-21 18:14:41 +00:00
Andrea Rossato
8cef719a61 Accordion: haddock fixes 2007-11-21 18:14:09 +00:00
Andrea Rossato
2a443363b8 Updated documentation of all prompts in XMonad.Prompt 2007-11-21 14:27:15 +00:00
Andrea Rossato
0388e0ae47 Font: haddock fix 2007-11-21 14:16:18 +00:00
Andrea Rossato
b5524bc6fd NamedWindows: haddock fix 2007-11-21 14:14:24 +00:00
Andrea Rossato
d5948af040 XUtils: haddock fix 2007-11-21 14:13:19 +00:00
Andrea Rossato
816b866c32 Shell: small doc fix 2007-11-21 14:10:13 +00:00
Andrea Rossato
c43dabf621 Tabbed: haddock documentation and code formatting 2007-11-21 14:09:08 +00:00
Andrea Rossato
e9621deeed HintedTile: typo 2007-11-21 14:08:28 +00:00
Andrea Rossato
51c1e2f67b HintedTile: ported to the LayoutClass 2007-11-21 11:23:31 +00:00
Brent Yorgey
e25d514503 PerWorkspace.hs: various fixes and updates 2007-11-20 17:33:07 +00:00
Brent Yorgey
9d6ec7f99f Doc.hs: remove modules from export list.
Apparently GHC 6.8.1 issues a warning when a re-exported module does not
itself export anything.
2007-11-20 17:29:47 +00:00
Andrea Rossato
85d3577080 A new documentation system
What to see a real Haddock abuse? Here you go. Removed
Documentation.hs and added a new name space: XMonad.Doc. By importing
other documentation modules we may also use the synopsis in XMonad.Doc.

If you believe that we should not have modules without code, well this
code is not for you: just that strange -- stuff ...;)
2007-11-20 15:15:52 +00:00
Andrea Rossato
6b17a40677 PerWorkspace.hs: minor haddock fixes
Also, we don't need to add those docstring annotation (%...), since
that system is not used anymore.
2007-11-20 10:32:50 +00:00
Brent Yorgey
31cebf1b0a new contrib module: Layout.PerWorkspace
This module allows you to configure layouts on a per-workspace basis,
rather than specifying the same layout for all workspaces.  (Of course,
you still really *are* specifying the same layout for all workspaces,
it just acts differently depending on the workspace. =)
2007-11-20 02:46:12 +00:00
Brent Yorgey
635a4f1fc5 NoBorders.hs: Haddock markup fix 2007-11-20 02:44:15 +00:00
Brent Yorgey
1733963b6c xmc/README: fix xmonad capitalisation, spelling fix 2007-11-20 02:41:18 +00:00
Don Stewart
34ff4ff6f2 Port overview from contrib.html to Documentation.hs 2007-11-19 18:31:27 +00:00
David Roundy
2d55592f21 remove Mosaic and Anneal. 2007-11-19 15:30:05 +00:00
Devin Mullins
334ab53672 remove MessageHooks
Duplicating xmonad-core and working around static-linking issues was getting
old quick. MessageHooks is now a branch of core, located at:
  http://code.haskell.org/~twifkak/xmonad-MessageHooks
2007-11-19 07:04:17 +00:00
Devin Mullins
494fb4c419 make handle Just Another Message Hook 2007-11-19 04:17:31 +00:00
Spencer Janssen
ce47c37dcd Anneal is only used by Mosaic which is disabled 2007-11-19 06:14:40 +00:00
Andrea Rossato
ee90d99853 Prompt: comment only 2007-11-19 00:03:57 +00:00
Spencer Janssen
0bef4068f0 Port XPrompt to XMonad.Util.Font, various other refactorings 2007-11-16 23:27:43 +00:00
Shachaf Ben-Kiki
6302d0b0b9 Miscellaneous spell-checking 2007-11-18 23:03:19 +00:00
Brent Yorgey
9498388041 RotSlaves.hs: documentation fix. 2007-11-18 21:58:58 +00:00
Brent Yorgey
cf3221f569 Documentation.hs: a lot more edits and additions. 2007-11-18 21:55:41 +00:00
Joachim Fasting
9ff17a46aa Prompt/*: add XConfig variable to keybindings in doc. 2007-11-18 14:48:49 +00:00
Joachim Fasting
0d383fa26f Prompt/XMonad.hs: minor typo in doc. 2007-11-18 14:47:22 +00:00
Joachim Fasting
e13d6fe0ff Actions/SinkAll.hs: update usage doc. 2007-11-18 14:41:53 +00:00
Joachim Fasting
c29c440a39 Prompt/Man.hs: remove docstring. 2007-11-18 14:32:40 +00:00
Andrea Rossato
e095e14be1 Documentation: added the section on editing layoutHook 2007-11-18 12:12:40 +00:00
Don Stewart
e640def6d7 needs pattern guards 2007-11-18 05:32:04 +00:00
Joachim Fasting
3d692c0d23 Prompt/Workspace.hs: suggest using defaultXPConfig in usage doc. 2007-11-17 23:09:40 +00:00
Joachim Fasting
8bef395ab9 Prompt/Workspace.hs: update module description. 2007-11-17 23:09:31 +00:00
Joachim Fasting
353687db43 Prompt/Window.hs: fix import statements in usage doc. 2007-11-17 23:08:54 +00:00
Joachim Fasting
7b5ee95ef6 Prompt/Ssh.hs: fix import statements in usage doc. 2007-11-17 23:08:14 +00:00
Joachim Fasting
3c03484bf3 Prompt/Man.hs: tweak import stuff in usage doc. 2007-11-17 23:07:34 +00:00
Joachim Fasting
342380e330 Prompt/Layout.hs: add missing import to usage doc. 2007-11-17 23:06:27 +00:00
Joachim Fasting
42da6bf450 Prompt/Shell.hs: fix invalid module import in usage doc. 2007-11-17 22:46:14 +00:00
Devin Mullins
0cb0d3eef4 experimental MessageHooks "branch" of main
Doesn't do much now, but is enough to allow me to define noFollow again. :)
I believe the need to change XConfig may force this to be an *actual* branch of
xmonad core, but I'm not sure yet.
2007-11-18 01:08:36 +00:00
Devin Mullins
ef6ef321cb Grid: tabs -> spaces 2007-11-17 20:11:40 +00:00
Brent Yorgey
d2f7e735f6 Documentation.hs: various stylistic edits, add a few more details 2007-11-17 17:39:24 +00:00
Andrea Rossato
8fcee53fa3 Documentation: added library description coding style and licensing policy - xmonad in small caps 2007-11-17 13:46:31 +00:00
Andrea Rossato
d3dfbb9bc9 Documentation: added more stuff 2007-11-17 11:42:17 +00:00
Devin Mullins
0ed0324496 cpp-options requires Cabal 1.2.1 2007-11-17 01:26:59 +00:00
Spencer Janssen
20da7a48d3 Use cpp-options 2007-11-16 23:23:01 +00:00
Brent Yorgey
bf84ca529f Config/Droundy.hs: -Wall police, add -fno-warn-orphans 2007-11-16 15:52:02 +00:00
Spencer Janssen
96a534cb68 Move XMonad.Util.Font to fix haddock generation 2007-11-16 21:57:20 +00:00
Andrea Rossato
06783babd9 cabal: I don't know how Hackage handles that so adopt a more general approach 2007-11-16 20:16:44 +00:00
Andrea Rossato
47702ebe31 Documentation.hs: minor fixes 2007-11-16 20:16:00 +00:00
Andrea Rossato
42297605be Arossato: my terminal is urxvt 2007-11-16 20:15:33 +00:00
Andrea Rossato
c4c25f499c Documentation: added the section for adding and removing key bindings 2007-11-16 15:51:10 +00:00
Andrea Rossato
8ba071ef60 Documentation: more stuff added 2007-11-16 15:40:59 +00:00
Spencer Janssen
1c665bc2ac utf8-string isn't needed 2007-11-16 13:37:38 +00:00
Spencer Janssen
0d73e44ea8 Depend on X11-xft >= 0.2 2007-11-16 13:09:26 +00:00
Spencer Janssen
10b5169387 XUtils: remove stringToPixel 2007-11-16 12:52:47 +00:00
Spencer Janssen
e6b8e1eb51 Export XMonadFont's constructors, use those constructors in XMonad.Prompt 2007-11-16 12:51:57 +00:00
Spencer Janssen
0494d0d5e5 Use Xft automatically if available 2007-11-16 12:42:11 +00:00
Spencer Janssen
65299e7d0c Font.hs: CPP around Xft calls, use a data type rather than Either 2007-11-16 12:35:52 +00:00
Spencer Janssen
32109d6f83 Font.hs: tabs 2007-11-16 12:25:51 +00:00
Clemens Fruhwirth
ce5928edd3 Add Font layer supporting an Xft backend. Make Tabbed.hs a user of this layer. 2007-11-16 12:06:53 +00:00
Andrea Rossato
711381e29a Documentation: typos and formatting 2007-11-16 12:29:29 +00:00
Andrea Rossato
2ebbf2dbd9 XUtils: a small haddock fix 2007-11-16 12:23:59 +00:00
Andrea Rossato
46c93c4ec2 XMonad.Util.Run: meny haddock fixes
I've also trasnformed gwern's comments to use '--' instead of {- -},
for uniformity.
2007-11-16 12:09:38 +00:00
"Valery V. Vorotyntsev"
6d4a670df3 CustomKeys.hs: typo 2007-11-16 11:25:31 +00:00
Andrea Rossato
663a032512 README: wrap long lines 2007-11-16 10:50:37 +00:00
Andrea Rossato
8a827d3471 Add Documentation.hs for documentation purposes
An empty module for documentation purpose with configuration
instructions.
2007-11-16 10:48:27 +00:00
Andrea Rossato
c30f6076ac Arossato: removed unneeded bits 2007-11-16 10:47:53 +00:00
Andrea Rossato
2249d3b3a7 RotSlaves: small haddock fix 2007-11-16 10:47:30 +00:00
Don Stewart
13860e0ed9 update run xmonad script 2007-11-15 22:57:04 +00:00
Andrea Rossato
2a3ac53d30 Prompt: haddock fixes 2007-11-15 20:48:28 +00:00
Andrea Rossato
3d39b52959 Arossato: documentation 2007-11-15 19:10:39 +00:00
Andrea Rossato
8cc3101ff1 Prompt: just code formatting 2007-11-15 19:10:12 +00:00
Andrea Rossato
c03da570a0 Prompt: add killWord edit action
With this bindings:
^ - Delete kill forward
^ - BackSpace kill backward
2007-11-15 19:07:34 +00:00
David Roundy
ffed7c0e02 remove unneeded Data.Bits imports. 2007-11-15 16:13:46 +00:00
"Valery V. Vorotyntsev"
533ef65e9d CustomKeys.hs: "complete rebinding" mechanism explained
Thanks to Don Stewart for his suggestion:
  http://article.gmane.org/gmane.comp.lang.haskell.xmonad/3339
2007-11-15 15:14:10 +00:00
"Valery V. Vorotyntsev"
d4f8502807 Tabbed.hs, SetWMName.hs: the modules need bitwise "or"
Tabbed.hs cleaned of trailing whitespace.
2007-11-15 14:37:58 +00:00
David Roundy
33fa0047c9 fix bug in WindowNavigation.
We weren't properly cleaning up in some cases, because we called focus,
which calls windows, while handling a message, which had the result that
changes to the layout were overwritten.  This had the result that
windowNavigation combined with DragPane left stray drag bars hanging
around.
2007-11-14 23:19:14 +00:00
Andrea Rossato
40ad31449f Tabbed: removed -fno-warn-orphans
I added it by mistake, but it is not needed. Sorry.
2007-11-14 23:05:44 +00:00
David Roundy
f978d76172 simplify NewSelect code. 2007-11-14 22:35:38 +00:00
David Roundy
0292c8e4f5 fix bug in LayoutCombinators. 2007-11-14 21:01:39 +00:00
Don Stewart
964a511cd9 no need to import Data.Bits 2007-11-14 18:39:55 +00:00
Andrea Rossato
61b795d2e2 ManageDocks.hs: haddock fixes 2007-11-14 19:13:27 +00:00
Andrea Rossato
622ddfc38b EZConfig.hs: haddock fixes 2007-11-14 19:11:09 +00:00
"Valery V. Vorotyntsev"
20e92a5d40 CustomKeys.hs: moved into `Util' directory
I still wonder why do we need all those configuration examples. :)
2007-11-14 15:34:18 +00:00
Andrea Rossato
011780d68c Arossato: removed unneeded bits 2007-11-14 17:25:00 +00:00
David Roundy
f7dd5d3fcc improve shrinking in Droundy.hs 2007-11-14 14:21:27 +00:00
Andrea Rossato
58e2029669 Arossato: just code formatting 2007-11-14 14:22:13 +00:00
Andrea Rossato
90aae189f0 Arossato: typo 2007-11-14 14:20:46 +00:00
Andrea Rossato
064e9257b7 Arossato: some keybindings tuning 2007-11-14 14:17:19 +00:00
Andrea Rossato
5ee39ecc53 Tabbed: added -fno-warn-orphans 2007-11-14 13:55:25 +00:00
Andrea Rossato
85952e9e53 Arossato: just code formattings 2007-11-14 13:53:52 +00:00
Andrea Rossato
4323d659d3 Config.Arossato: my hand has been forced to pick up a true combinator set... 2007-11-14 13:38:48 +00:00
Andrea Rossato
1eb69c2fdc UrgencyHook.hs: small haddock fix 2007-11-14 10:48:44 +00:00
Devin Mullins
5f6a80ca7a fix EZConfig documentation 2007-11-14 12:04:42 +00:00
Devin Mullins
7712f02ef8 remove dead code 2007-11-12 18:48:57 +00:00
"Valery V. Vorotyntsev"
68e5d0de9f CustomKeys.hs (customKeysFrom): new function
Update third-party configuration to fit your key preferences.
Extended documentation.
2007-11-13 20:18:52 +00:00
Don Stewart
8d03f9d5d7 pattern guards and newtype deriving required for ManageDocks.hs to build! 2007-11-14 03:26:25 +00:00
David Roundy
de6b1feabf add ToggleStruts capability to avoidStruts. 2007-11-13 20:34:34 +00:00
Andrea Rossato
46528b4f48 Arossato: cleanup and fine-tuning 2007-11-13 16:39:06 +00:00
David Roundy
6e24689652 make shrinker preserved over restart in tabbed. 2007-11-13 16:31:16 +00:00
gwern0
ea542ce5af REAME: one more try 2007-11-12 22:05:23 +00:00
gwern0
993ffa049e scripts/generate-configs: update docs 2007-11-12 14:46:43 +00:00
Don Stewart
ff56ab01cf HEADS UP: Rename XMonadContrib library as xmonad-contrib.
After building and install as normal, be sure to unregister your
old XMonadContrib library:

    $ ghc-pkg unregister --user XMonadContrib-0.4
    $ ghc-pkg unregister XMonadContrib-0.4

And then your ~/.xmonad/* stuff should link as normal.
2007-11-12 18:09:19 +00:00
"Valery V. Vorotyntsev"
9140b58b91 XMonad.Config.CustomKeys - new module
This module is another key bindings customization helper.

Differences from XMonad.Util.EZConfig by Devin Mullins:
  EZConfig   -- M.union/M.difference
  CustomKeys -- Monad.Reader + foldr'ed M.insert/M.delete

IMHO, both modules could evolve into something nice. :)
Please discuss at the mailing list.
2007-11-12 17:55:30 +00:00
David Roundy
c468f6e608 prune Droundy.hs. 2007-11-12 17:20:32 +00:00
Brent Yorgey
e0dfb3428d NoBorders.hs: remove modifierDescription definitions, so NoBorders and SmartBorder don't change the layout description. 2007-11-12 15:45:25 +00:00
Brent Yorgey
6cd8425c76 NoBorder.hs: documentation updates 2007-11-12 15:44:11 +00:00
Devin Mullins
fe5b0a0af1 fix intro doco for UrgencyHook
Ooh, this new XConfig l -> XConfig l' function makes the docs disappear!
2007-11-12 04:41:02 +00:00
Devin Mullins
5552c8c86d revert UrgencyHook behavior back to ICCCM non-compliance
Note: If you're using UrgencyHook, this will break your config.
@withUrgencyHook SomeUrgencyHook@ is XConfig -> XConfig, now. The layout hook
has been renamed to urgencyLayoutHook.

It may also be worth noting that, in order to recreate the old behavior without
using redoLayout (so that this may be ported to an eventHook), I had to hijack
logHook. Shouldn't harm anything, though.

TODO: update main docs
2007-11-12 04:33:25 +00:00
Devin Mullins
a35b7ab6f3 add StdoutUrgencyHook, to help debug weird client behavior 2007-11-12 01:58:55 +00:00
Spencer Janssen
25849e68e0 EZConfig: update for kind change in XConfig 2007-11-11 21:53:14 +00:00
David Roundy
e423e3eb34 changes to work with XConfig of kind * -> *. 2007-11-11 00:56:29 +00:00
Don Stewart
044bd10ee5 depend on X11==1.3.0.20071111 for new type defns and 64 bit clean 2007-11-11 20:10:55 +00:00
Don Stewart
929e0b8638 font size 15 pixels is the dzen default 2007-11-09 19:03:28 +00:00
David Roundy
a3d739db17 add two new modules, one to name layouts, another to select a layout.
The latter is pretty useless, as there's no way to find out what
layouts are available, but it can at least allow you to select between
any layouts that you happen to be using already (in one workspace or
another).  The former is handy any time you'd rather have a short name
for a layout (either for selecting, or for viewing in a status bar).
2007-11-11 19:50:36 +00:00
Devin Mullins
a96b55ecfe add helper module for writing configs
Looking for suggestions on this module. Does it belong here? Is there a better
name? Should the additional* functions pass the modMask to their second
argument? etc.
2007-11-11 07:52:22 +00:00
Devin Mullins
4835a3be3f let clients track their urgency, per ICCCM
This removes the dependency on redoLayout -- now WithUrgencyHook defines handleMess only.
2007-11-11 02:12:41 +00:00
Devin Mullins
92490057b4 wrap user code in userCode, go figure
(thanks à shachaf for that suggestion)
2007-11-11 00:26:17 +00:00
Devin Mullins
e31599860e add LANGUAGE PatternGuards to UrgencyHook 2007-11-11 00:22:38 +00:00
Devin Mullins
f4a5a3dc0c remove dead doco 2007-11-11 00:14:43 +00:00
Devin Mullins
c5410f7ee6 clarify config code... a bit 2007-11-11 00:09:33 +00:00
Devin Mullins
9d99b06220 fix doco for UrgencyHook 2007-11-11 00:00:46 +00:00
Devin Mullins
899bb99fad add NoUrgencyHook, for shachaf's sake 2007-11-10 23:58:57 +00:00
Devin Mullins
6a3e6d787f oops, export the configuration options 2007-11-10 23:33:13 +00:00
Devin Mullins
e4fe6c8994 add dzenUrgencyHook back
TODO: fix all the doco
2007-11-10 23:27:06 +00:00
Devin Mullins
11f65f5ccf remove dzenUrgencyHook* from Dzen module
To be replaced by UrgencyHook instances defined in the UrgencyHook module.
2007-11-10 23:11:15 +00:00
Devin Mullins
4ec92c5054 get UrgencyHook to compile
(The boilerplate, it burns!) Still isn't useful (to me) yet, as I haven't
ported dzenUrgencyHook to the new UrgencyHook class.
2007-11-10 22:43:03 +00:00
David Roundy
48f23960be fix bug in avoidStruts. 2007-11-10 21:42:05 +00:00
Devin Mullins
0c83b03914 typo fix in Util.Run 2007-11-10 21:13:28 +00:00
David Roundy
9c915ef65d add a few docs (very sparse) to DynamicWorkspaces. 2007-11-09 15:26:49 +00:00
David Roundy
77be696976 add withWorkspace prompt, which automatically creates workspace if nonexistent. 2007-11-09 15:21:24 +00:00
Spencer Janssen
283001699d Generalize safe/unsafeSpawn to MonadIO 2007-11-09 07:38:10 +00:00
gwern0
0e016a6fa5 Magnifier.hs: update so it at least compiles
Code modified on advice of Wachter; note I make absolutely no claims that the code runs correctly or doesn't eat your pets or does anything besides compile without any warnings.
2007-11-08 01:25:22 +00:00
gwern0
a5799ec85f Dzen.hs: resend doc update 2007-11-06 21:15:37 +00:00
gwern0
64d215327e Update docs in Util 2007-11-06 19:02:58 +00:00
David Roundy
39445183bc fix types to work with Mats fix to X11. 2007-11-08 19:23:18 +00:00
Mats Jansborg
107a957ff6 Change the type of properties from Word32 to CLong 2007-11-01 19:27:30 +00:00
David Roundy
7540b14963 fix bug in avoidStruts.
I've now tested this module, and it works on x86--but doesn't work on
x86-64, because ManageDocks doesn't work on 64-bit.  But in any case, it
works almost perfectly, with no user intervention needed (and no special
hooks).  The only catch is that it doesn't notice when a panel disappears,
so the layout won't adjust until the next refresh (e.g. if you change
focus, layout or workspace).
2007-11-08 17:52:50 +00:00
David Roundy
85766bb72a clean up Droundy.hs. 2007-11-07 14:41:06 +00:00
Andrea Rossato
c6c377a325 DynamicLog: typo in docs 2007-11-08 01:01:04 +00:00
Don Stewart
2b7a8d06da over pararenthesised arty fibonacci 2007-11-07 23:06:01 +00:00
Chris Mears
ab1f382566 Remove spurious import in Arossato's config. 2007-11-07 21:56:30 +00:00
Andrea Rossato
d1eb962214 Add my configuration file
Spencer and David: you really did a great job. Thank you guys!
2007-11-07 19:13:05 +00:00
Don Stewart
901522fc10 add higher order 'dzen' function
The intent is that:

    main = dzen xmonad

should just work, and indeed it does now, for launching a cool status
bar with minimal effort.
2007-11-07 18:31:07 +00:00
Spencer Janssen
e34a880460 Set defaultGaps for makeSimpleDzenConfig 2007-11-07 09:20:37 +00:00
Eric Mertens
4bfbc43023 DynamicLog: Add makeSimpleDzenConfig function
This function serves as an example for spawning a dzen2 instance and printing
the defaultPP to it.
2007-11-07 08:55:14 +00:00
Spencer Janssen
4fcd67ef05 Use spawnPipe in sjanssenConfig 2007-11-07 08:26:37 +00:00
Spencer Janssen
f98023d3c2 Add spawnPipe 2007-11-07 07:50:09 +00:00
Eric Mertens
68b04cba15 DynamicLog: add ppOutput field to PP
This allows the user to specify an alternate destination for logging output
instead of outputing to stdout (which is still the default).
2007-11-07 05:58:05 +00:00
Spencer Janssen
486806c051 Add EwmhDesktops to exposed-modules 2007-11-07 03:11:35 +00:00
gwern0
d76ebde249 Actions: update SinkAll doc 2007-11-06 19:21:58 +00:00
gwern0
c64b43be9f Prompt.hs: update names 2007-11-06 19:20:54 +00:00
gwern0
e13f9849ae EwmhDesktops: move to correct name, update so it compiles 2007-11-06 19:17:51 +00:00
gwern0
4109a68fdf Man.hs: -Wall option not necessary as that's turned on in the Cabal files 2007-11-06 19:06:59 +00:00
Lukas Mai
58072a2edc make Setup haddock work again 2007-11-06 14:18:29 +00:00
Lukas Mai
7b7b1ce800 change MultiToggle interface; add docs 2007-11-06 14:17:29 +00:00
Spencer Janssen
e780bb042a Remove SwitchTrans 2007-11-06 06:59:33 +00:00
Spencer Janssen
9f9997ca55 Remove MetaModule 2007-11-06 02:37:13 +00:00
Lukas Mai
edb3d350be add serializable SwitchTrans (a.k.a. MultiToggle) 2007-11-06 00:58:19 +00:00
l.mai
8d5afd87d7 make TilePrime compile again 2007-11-05 23:32:18 +00:00
l.mai
bd42371d9e add LayoutHints to MetaModule 2007-11-05 23:31:43 +00:00
l.mai
62a46c6df3 make LayoutHints compile again 2007-11-05 23:30:20 +00:00
Spencer Janssen
2d51577c4e Expose LayoutCombinators 2007-11-06 02:16:11 +00:00
Spencer Janssen
c1572fe940 Add LANGUAGE pragmas for ManageDocks 2007-11-06 02:15:07 +00:00
Spencer Janssen
9520922357 Combo builds now 2007-11-06 02:13:41 +00:00
Spencer Janssen
e1675284e2 Make Combo build on GHC 6.8 2007-11-06 02:11:26 +00:00
Spencer Janssen
7d1506fded Stupid mistake 2007-11-05 10:10:52 +00:00
Spencer Janssen
81a148a8d5 -Werror 2007-11-05 06:02:23 +00:00
David Roundy
0e4226bb4d fix Config.Droundy to compile again. 2007-11-05 20:53:39 +00:00
Spencer Janssen
2bb992c128 -Wall police 2007-11-05 06:00:36 +00:00
Spencer Janssen
9cd33f809e Minor updates to Sjanssen.hs 2007-11-05 05:50:22 +00:00
Spencer Janssen
387a4827cb Use configurations 2007-11-05 03:41:09 +00:00
Don Stewart
1ae326cfa7 -Wall is on 2007-11-05 03:18:15 +00:00
Spencer Janssen
50a61a49a2 Revert ghc-options changes 2007-11-05 03:03:27 +00:00
Don Stewart
2ef6f91fb1 forgot to add my config file 2007-11-05 02:58:56 +00:00
Don Stewart
080e11b376 build with optimisations on as usual, fix a few compile errors 2007-11-05 02:48:58 +00:00
Spencer Janssen
ee5ae195e0 Add XMonad.Config.Sjanssen 2007-11-05 00:58:32 +00:00
Spencer Janssen
d3a389e6b5 Move configs/droundy.hs to an actual library module 2007-11-04 20:29:57 +00:00
Spencer Janssen
9a42cf8721 Improve test hook.
--disable-optimizations makes testing much faster.
--user allows Cabal to satisfy dependencies from the user package database.
2007-11-04 20:29:19 +00:00
David Roundy
ecd07bf450 fix warnings in Combo. 2007-11-01 21:45:04 +00:00
David Roundy
3b6c939af0 make WorkspaceDir always store absolute pathnames. 2007-11-01 21:44:01 +00:00
David Roundy
3e9e9c8b03 add new off-center layout combinators. 2007-11-01 21:42:16 +00:00
David Roundy
69999d8018 add configs demo directory 2007-11-01 20:37:20 +00:00
Spencer Janssen
33740d99d6 Add Cabal stuff 2007-11-01 20:20:41 +00:00
David Roundy
722b99dd83 make Hierarchical LayoutCombinators. 2007-11-01 18:54:18 +00:00
David Roundy
c2a4c05faf fix selectWorkspace to work with new config. 2007-11-01 18:35:46 +00:00
Spencer Janssen
cd1884466a Hierarchify 2007-11-01 20:10:59 +00:00
Spencer Janssen
4a76d9e675 Use hierarchical module names from the core 2007-11-01 18:28:24 +00:00
David Roundy
418cc6511e code to define a strut-avoiding layout. 2007-10-23 22:00:25 +00:00
David Roundy
0a242c6a6e reenable JumpToLayout in NewSelect. 2007-11-01 18:11:28 +00:00
David Roundy
e397233808 -Wall police in Run. 2007-11-01 15:20:28 +00:00
David Roundy
35d1367d4d port Combo (dropping combo). 2007-11-01 15:29:15 +00:00
Spencer Janssen
fbfcff6cbf Port ToggleLayouts 2007-11-01 09:18:53 +00:00
Spencer Janssen
014f49aefd Port WorkspacePrompt 2007-11-01 09:04:25 +00:00
Spencer Janssen
ee98008f45 Port Accordion 2007-11-01 09:03:41 +00:00
Spencer Janssen
fb0f288dca Port Dishes 2007-11-01 09:03:12 +00:00
Spencer Janssen
1f698321d7 Dishes: tabs 2007-11-01 09:02:37 +00:00
Spencer Janssen
ea8cd6d2c7 Port DragPane 2007-11-01 08:57:33 +00:00
Spencer Janssen
5eab2d705d Port MosaicAlt 2007-11-01 08:55:24 +00:00
Spencer Janssen
a44890582b Port ResizableTile 2007-11-01 08:55:00 +00:00
Spencer Janssen
52989e5845 Port Roledex 2007-11-01 08:54:30 +00:00
Spencer Janssen
93ffacad82 Port Spiral 2007-11-01 08:54:02 +00:00
Spencer Janssen
69c623f834 Port TagWindows 2007-11-01 08:53:35 +00:00
Spencer Janssen
d53b331dc7 Port ThreeColumns 2007-11-01 08:52:29 +00:00
Spencer Janssen
ee9c7d35be Port TwoPane 2007-11-01 08:51:51 +00:00
Spencer Janssen
8eea95bc44 Port XMonadPrompt 2007-11-01 08:50:37 +00:00
Spencer Janssen
42854f5243 XMonadPrompt: tabs 2007-11-01 08:49:39 +00:00
Spencer Janssen
a9e93c7e3e Port WindowNavigation 2007-11-01 08:48:52 +00:00
Spencer Janssen
fe30292005 Port Submap 2007-11-01 08:47:44 +00:00
Spencer Janssen
4b134366b3 Port CycleWS 2007-11-01 08:44:31 +00:00
Spencer Janssen
2d81245280 NO TABS 2007-11-01 08:39:54 +00:00
Spencer Janssen
c4c7cc7924 Port Commands 2007-11-01 08:32:36 +00:00
Spencer Janssen
a1066224f7 XPrompt: don't import XMonad.config 2007-11-01 07:41:49 +00:00
Spencer Janssen
332ecc3e11 More porting 2007-11-01 07:35:06 +00:00
Spencer Janssen
e16479570a Port DynamicLog 2007-11-01 07:26:06 +00:00
Spencer Janssen
0b681cadc2 Port NoBorders 2007-11-01 07:08:59 +00:00
Spencer Janssen
bd97249b22 LayoutModifier: LayoutMessages have moved 2007-11-01 07:07:24 +00:00
Spencer Janssen
a4ea5e80ef Remove Config import from Run 2007-11-01 07:04:08 +00:00
Spencer Janssen
d64e43e858 Remove 'descriptions' stuff from NewSelect. I think we can do this without make LayoutClass larger 2007-11-01 03:38:44 +00:00
David Roundy
1a67657db8 add NewSelect layout combinator.
This patch adds a selection layout combinator ||| which
replaces Select, and makes the Layout data type unnecessary.
This combinator isn't yet feature-complete, as I didn't implement
backwards rotation (PrevLayout), but that's obviously doable.  This
patch requires the descriptions function be added to LayoutClass in
core.
2007-10-24 15:26:48 +00:00
"Valery V. Vorotyntsev"
92ef6cd811 ManPrompt.hs: auto-complete explicit paths (those with `/')
Bash's compgen is used for this (like in ShellPrompt.hs).

Enable all GHC warnings.

Improve documentation (slightly).
2007-11-04 20:20:56 +00:00
Devin Mullins
3fb0cf1391 clean up destroyed windows from urgents list 2007-11-03 15:03:58 +00:00
Devin Mullins
f2eec4b48b add focusUrgent action, for those too lazy to read 2007-11-03 05:54:58 +00:00
Devin Mullins
273f64955e changed urgent state from Set to list 2007-11-03 05:51:43 +00:00
Devin Mullins
6984a9f0cb fix examples 2007-11-03 02:20:11 +00:00
Devin Mullins
83cc45d972 add haddock for top-level Dzen bindings 2007-11-03 02:17:05 +00:00
Devin Mullins
fd268ab7b9 expose dzenWithArgs, dzenUrgencyHookWithArgs (for colors!) 2007-10-30 07:24:55 +00:00
Devin Mullins
5c9a9e68c4 use a global IORef to keep list of urgent windows 2007-10-27 06:48:10 +00:00
Brent Yorgey
b091f3e28f fix parse error in pattern match 2007-10-29 17:41:50 +00:00
David Roundy
8ab680ede3 allow use of multiple toggles in ToggleLayouts. 2007-10-26 21:06:43 +00:00
Brent Yorgey
fade0c609d WindowNavigation.hs: documentation fix (navigateBorder -> navigateColor) 2007-10-29 15:57:31 +00:00
"Valery V. Vorotyntsev"
9bc7e1ff0c MetaModule.hs: add ManPrompt, remove ViewPrev 2007-10-29 07:56:21 +00:00
Andrea Rossato
0b444e5264 XMonadPrompt: use a single blank 2007-10-29 09:16:18 +00:00
cardboard42
323040000f Added xmonadPromptC
I added xmonadPromptC which takes a user defined list of commands as in Command.runCommand
2007-10-27 01:48:11 +00:00
Spencer Janssen
6d147212f7 Factor out some of dzenPP's goodies 2007-10-29 01:55:56 +00:00
Spencer Janssen
69b05866b5 Don't reverse sjanssenPP 2007-10-28 22:48:43 +00:00
gwern0
5e214e9210 MetaModule.hs: someone forgot the (), so GHC was giving a warning. Small fix to quiet the warning. 2007-10-27 15:08:47 +00:00
"Valery V. Vorotyntsev"
27421129f6 ViewPrev.hs: deleted
Its functionality is now part of CycleWS module.
CycleWS.hs: Nelson Elhage added to authors.
2007-10-27 09:09:37 +00:00
Don Stewart
1ec36de78f add more details on using smartBorders 2007-10-26 22:45:10 +00:00
Don Stewart
9ef767dc77 add dynamicLogDzen, a dwm status bar, using dzen colour codes 2007-10-26 22:19:44 +00:00
Andrea Rossato
e7ec30009e XPrompt: removed unneeded parenteses 2007-10-26 22:15:05 +00:00
"Valery V. Vorotyntsev"
9f0a2a66f9 XPrompt.hs: use a single blank
Excessive blanks in prompts originate from here. Eliminate. :)
Rewrite `getLastWord' and `skipLastWord' in pointfree style.
2007-10-22 19:23:10 +00:00
"Valery V. Vorotyntsev"
df33392d08 ShellPrompt.hs (showXPrompt): use a single blank 2007-10-22 19:17:41 +00:00
Andrea Rossato
051eb3b814 ShellPrompt: remove harcoded path when calling bash 2007-10-26 21:23:34 +00:00
Andrea Rossato
d875c05252 ShellPrompt: reformat the comments to complay with the module style 2007-10-26 21:19:56 +00:00
Andrea Rossato
2b4179169b XPrompt: catch exceptions when running the completion function 2007-10-26 21:18:59 +00:00
Andrea Rossato
eda311fa78 CycleWS: StackSet.findIndex is now findTag 2007-10-26 21:18:02 +00:00
Brent Yorgey
31f5d1a912 Dzen.hs: replace 'findIndex' by 'findTag' to match renaming in core. 2007-10-22 20:43:35 +00:00
gwern0
e3a96e2b5a XPrompt.hs: add sensible bindings for Home and End 2007-10-26 03:50:26 +00:00
gwern0
89ffbc20a1 XPrompt.hs: add a pasteString function and keybinding 2007-10-26 03:49:20 +00:00
"Valery V. Vorotyntsev"
630166f9fa Run.hs: documentation fix 2007-10-24 14:42:44 +00:00
"Valery V. Vorotyntsev"
906c3ccc32 XPrompt.hs (uniqSort): new function
Moved from ShellPrompt. There are at least three happy users
of this function -- ShellPrompt, SshPrompt, and ManPrompt.
2007-10-24 14:22:41 +00:00
"Valery V. Vorotyntsev"
bd13af8f25 SshPrompt.hs: use `uniqSort' from XPrompt.hs
Remove excessive import lists.
2007-10-24 14:41:28 +00:00
"Valery V. Vorotyntsev"
414a3dab6a SshPrompt.hs (showXPrompt): use a single blank
Delete trailing whitespace. Fix documentation typo.
2007-10-22 19:20:37 +00:00
"Valery V. Vorotyntsev"
c7e078b73b ShellPrompt.hs: move `uniqSort' to XPrompt.hs 2007-10-24 14:38:20 +00:00
"Valery V. Vorotyntsev"
11a7df81d6 ManPrompt.hs: use `uniqSort' from XPrompt.hs
TODO list extended.
2007-10-24 14:39:05 +00:00
Eric Mertens
dee7d9ef95 TilePrime.hs: Handle nmaster = 0 reasonably 2007-10-25 00:17:50 +00:00
Devin Mullins
b1da605575 oops, add period 2007-10-24 12:54:48 +00:00
Devin Mullins
3044a447e6 expand Invisible comments 2007-10-24 12:52:13 +00:00
Spencer Janssen
f213257f65 Remove excessive import lists from ShellPrompt 2007-10-24 11:31:06 +00:00
Spencer Janssen
c65b9c06b9 Use new terminal config option 2007-10-24 11:02:19 +00:00
gwern0
32a01355bf Run.hs: do my usual segregation into safe and unsafe runInTerms 2007-10-24 00:39:11 +00:00
gwern0
ab941a450c Run.hs: specialize runInXTerm to use runInTerm per my mailing list suggestion 2007-10-24 00:18:56 +00:00
gwern0
98f6709902 Run.hs: +my suggested runInTerm general function 2007-10-24 00:16:28 +00:00
gwern0
877999d890 Run.hs, SshPrompt.hs, ShellPrompt.hs: mv runInXTerm back into Run.hs per suggestions 2007-10-24 00:13:41 +00:00
Dougal Stanton
725b3a82ca Comments for ConstrainedResize 2007-10-20 09:25:09 +00:00
Dougal Stanton
1ac15e3f83 Add ConstrainedResize module
Constrain the aspect ratio of floated windows by holding down shift
2007-10-19 17:35:08 +00:00
Devin Mullins
41a094601c fix stupid dzenUrgencyHook bug 2007-10-21 06:13:08 +00:00
"Valery V. Vorotyntsev"
37a58b9df2 CycleWS.hs (toggleWS): new function
This is a pointfree adaptation of ViewPrev.viewPrev;
after this patch is applied, it may be a good idea to merge
ViewPrev.hs into CycleWS.hs.
2007-10-19 20:53:23 +00:00
Dmitry Kurochkin
139ce1b8c4 XPrompt.hs: fix vertical alignment of completions. 2007-10-23 18:31:29 +00:00
David Roundy
8649c90c55 fix bug in DragPane (where we forgot that r was mirrored). 2007-10-23 15:24:48 +00:00
"Valery V. Vorotyntsev"
49f2ae8b98 ManPrompt.hs: a manual page prompt (new module) 2007-10-22 19:14:43 +00:00
mail
8eca4751e0 STRUT aware gap toggling (clean patch)
Without this patch, ManageDocks would only set the gap according to a window’s
STRUT when the window is first mapped. This information would then get lost when
the user toggle the gap.
   
Now, when the user toggles the Gap, all present windows are scanned for STRUT
settings, and the gap is set accordingly. No need to manually configure the gap
anymore.

This is the same patch as before, but independant of the Hooks patches, and with
more documentation.
2007-10-22 22:01:32 +00:00
David Roundy
86839154d1 add new LayoutCombinators module. 2007-10-23 13:56:38 +00:00
David Roundy
640896d6f4 export DragPane type. 2007-10-23 13:49:33 +00:00
David Roundy
515d514491 make DragPane work with any type (not just Windows). 2007-10-23 13:49:11 +00:00
gwern0
0fe340d50c SshPrompt.hs: while I'm here, replace nub with the faster Set trick 2007-10-19 18:15:14 +00:00
gwern0
b70448353f ShellPrompt.hs: fmt imports and update 2007-10-19 18:13:17 +00:00
gwern0
1bded83669 SshPrompt.hs: fmt imports and update 2007-10-19 18:12:55 +00:00
gwern0
6f04a51959 XSelection.hs: fmt imports and sigs 2007-10-19 18:12:32 +00:00
gwern0
75589eaf16 XSelection.hs: +2 functions, safePromptSelection and unsafePromptSelection
Analogous to Run.hs patch; these use safeSpawn and unsafeSpawn respectively.
2007-10-19 18:11:37 +00:00
gwern0
c7e40aa771 Run.hs: +2 functions, safeSpawn & unsafeSpawn
See their documentation. This is part of a re-organization of various 'run' commands; this two
make it easier to go through the shell or not, and will be re-used elsewhere.
2007-10-19 18:10:09 +00:00
gwern0
0917e5f56f Run.hs: fmt 2007-10-19 18:09:53 +00:00
gwern0
3483054089 Run.hs, ShellPrompt.sh: mv runInXTerm to ShellPrompt.hs 2007-10-19 18:09:00 +00:00
gwern0
890f586bb7 XSelection.hs: documentation format changes. 2007-10-19 01:00:57 +00:00
gwern0
984f9092c1 XSelection.hs: +type signature for auxiliary function 2007-10-19 01:00:34 +00:00
gwern0
f0eb0f0311 XSelection.hs: simplify creation of window
While spelunking in the xclip source code, I noticed it had much the same call to createSimpleWindow but with a simpler geometry - just 1x1 pixels, not the odd 200x100 of the original code. It seems to work the same and looks better and less mysterious, so unless arossato had a specific reason for those particular two numbers...
2007-10-19 01:00:13 +00:00
"Valery V. Vorotyntsev"
710aa7efb9 XPrompt.hs (keyPressHandle): Ctrl-g and Ctrl-c added to quit keystrokes
Obvious comments removed.
2007-10-20 17:09:36 +00:00
"Valery V. Vorotyntsev"
0febec2c69 XPrompt.hs: trailing whitespace cleaned 2007-10-20 17:07:19 +00:00
Shachaf Ben-Kiki
55b537f2a2 Fix pragmas in XMonadContrib 2007-10-22 01:17:38 +00:00
"Valery V. Vorotyntsev"
ab94a40160 test_XPrompt.hs: there is no ShellPrompt.rmPath 2007-10-19 20:58:30 +00:00
David Roundy
723e757910 introduce new combineTwo layout combinator.
This layout combinator is similar in spirit (and in code) to
the old combo combinator, but only allows two sublayouts.  As
a result, we don't need to wrap these in existentials, and reading
works seamlessly.  Also, we add the feature (which could also be
added to combo) of being able to change which sublayout a given
window is in through integration with WindowNavigation.

I envision combo being deprecated soon.  combineTwo isn't quite
so flexible, but it's much easier and is better-coded also.
2007-10-20 19:17:48 +00:00
David Roundy
73a5299fbe allow layout modifiers to modify a Message in transit.
This is a helpful feature (for, e.g. WindowNavigation) that
allows modifiers (if they so choose... the old API remains
supported) to easily send a single Message to the modified
layout in response to a Message.
2007-10-20 19:15:42 +00:00
Brent Yorgey
ba006db696 update UrgencyHook example config to reflect changes to WindowNavigation and core Config.hs 2007-10-19 14:55:26 +00:00
David Roundy
f2b5dfebed add ToggleLayouts module. 2007-10-18 21:45:25 +00:00
David Roundy
fbe5c23729 default to empty description for layout modifiers.
This is because modifierDescription is designed to be human-readable,
and show rarely creates a human-readable description.  And in many (if
not most) cases, an empty description is precisely what we want.
2007-10-18 20:26:04 +00:00
David Roundy
3c372e5f9a beautify description code for empty modifier-description. 2007-10-18 20:24:38 +00:00
Brent Yorgey
7910250fe4 change definition of 'description' function for LayoutModifier so an extra space is not added if the modifier description is empty. 2007-10-18 18:30:54 +00:00
l.mai
da02543042 -Wall police 2007-10-18 03:30:00 +00:00
Eric Mertens
61ed28a72b DynamicLog.hs: Add dzenColor 2007-10-18 17:45:23 +00:00
David Roundy
c80bf1e5eb add function to rename workspaces. 2007-10-18 14:56:04 +00:00
l.mai
27b9582201 fix WindowNavigation comment 2007-10-18 05:43:15 +00:00
Devin Mullins
883af044fb change example to dzenUrgencyHook 2007-10-18 02:20:26 +00:00
Devin Mullins
06aa06ecdb add dzenUrgencyHook as example (and the one I use) 2007-10-18 02:17:42 +00:00
Devin Mullins
567e10619b fixed Dzen and gave it a configurable timeout 2007-10-18 01:29:10 +00:00
Devin Mullins
02c2e69643 rename LayoutSelect & defaultLayout in comments 2007-10-16 05:18:19 +00:00
Devin Mullins
244edc1d3a add import to comments, for clarity 2007-10-12 04:45:55 +00:00
Devin Mullins
46b9061f4b documentation for UrgencyHook 2007-10-12 03:45:06 +00:00
Devin Mullins
ff65fdb6c6 d'oh, minor UrgencyHook cleanup 2007-10-12 03:25:58 +00:00
Devin Mullins
83756daeeb brand new UrgencyHook contrib, depends on X11-extras WMHints binding
It's a LayoutModifier which lets you define an urgencyHook function -- the
action gets performed wheneveran X client sends an XUrgencyHint message (i.e.
tries to "flash" the "taskbar").

This statically points to Config.urgencyHook, which requires that the user add
a line to Config.hs-boot, in addition to defining the urgencyHook.

Documentation forthcoming.
2007-10-11 05:16:41 +00:00
Eric Mertens
58d131746a TilePrime.hs: Give a description that distinguishs between horizontal/vertical 2007-10-18 06:37:49 +00:00
Spencer Janssen
107121680f Truncate title at 80 characters 2007-10-18 00:30:13 +00:00
Spencer Janssen
7b82a81080 shorten in sjanssenPP too 2007-10-18 00:28:21 +00:00
Spencer Janssen
f706345292 Truncate long window titles 2007-10-18 00:25:11 +00:00
Eric Mertens
fc393b5f2c DynamicLog.hs: Add ppWsSep field to PP to specify workspace separator.
This can be useful when you are using colors to distinguish between
workspaces and simply provides more functionality. The default behavior
remains the same.
2007-10-18 00:16:52 +00:00
Spencer Janssen
30e99281b2 Wrapping the empty string yields the empty string 2007-10-18 00:15:42 +00:00
Spencer Janssen
e4416696c1 DynamicLog: documentation only 2007-10-17 21:14:27 +00:00
Spencer Janssen
8340a26946 Allow the user to change the order of workspaces, layout, title 2007-10-17 21:13:03 +00:00
Spencer Janssen
840835f00a Don't wrap the layout description by default 2007-10-17 21:10:11 +00:00
Spencer Janssen
d5a014725d DynamicLog: not . null. Duh. 2007-10-17 21:09:12 +00:00
Spencer Janssen
005d65b57e A big dynamicLog refactor
We introduce the PP type to allow user customization of dynamicLog.
dynamicLogWithTitle has been eliminated because this is the default behavior
for dynamicLog now.
2007-10-17 21:04:31 +00:00
Spencer Janssen
9ef8512291 Don't toLower the layout description.
If we'd really like lower case layout descriptions, the 'description' method
in the LayoutClass instances should be changed instead.
2007-10-17 20:29:53 +00:00
Eric Mertens
fa81ef9e07 TilePrime.hs: Correct behavior when number of windows <= nmaster
Additionally this patch does various clean-ups that should not
affect functionality.
2007-10-17 20:51:53 +00:00
Spencer Janssen
3b71671751 Remove RunInXTerm in favor of Run 2007-10-17 20:22:01 +00:00
Christian Thiemann
830945336f Move runXXX functions to one module
This patch takes runProcessWithInput out of Dmenu, runProcessWithInputAndWait
out of Dzen, and runInXTerm out of RunInXTerm and collects them in one central
module called Run.  This way, other modules may include Run instead of Dmenu
to get what they want without giving the impression of making use of dmenu.
2007-10-12 14:52:33 +00:00
Shachaf Ben-Kiki
c437e3e384 Fix LANGUAGE pragmas 2007-10-17 19:46:22 +00:00
l.mai
aba2e77b68 use full screen for single window in TilePrime 2007-10-17 19:14:21 +00:00
Eric Mertens
3e5c834c75 RotSlaves.hs: Add rotAll functions 2007-10-17 17:32:56 +00:00
Joachim Fasting
5abd5e39a6 TilePrime.hs: add usage info. 2007-10-17 19:26:12 +00:00
Joachim Fasting
1d006c67f3 TilePrime.hs: add LANGAUGE pragma. 2007-10-17 18:20:42 +00:00
Joachim Fasting
ac633a1486 MetaModule.hs: add WorkspacePrompt. 2007-10-17 18:20:27 +00:00
David Roundy
1d20921fb2 add TilePrime to MetaModule. 2007-10-17 13:32:02 +00:00
Eric Mertens
cbd3af0b0e Initial import of TilePrime
This layout provides a standard tiling layout with support for resize hints
and filling the gaps created by them.
2007-10-17 05:20:17 +00:00
David Roundy
551e44ce55 code cleanup in selectWorkspace. 2007-10-16 23:12:18 +00:00
David Roundy
763a952c80 allow users to go to dynamically-added workspaces with mod-n. 2007-10-16 23:03:01 +00:00
David Roundy
e43eabfd93 add modules to deal with Workspaces (select, etc) by name using XPrompt. 2007-10-16 22:33:47 +00:00
David Roundy
1ec41467de make windowNavigation simpler to use in simplest case. 2007-10-16 21:43:37 +00:00
David Roundy
7efca8901c compute nice window border for WindowNavigation properly. 2007-10-16 21:33:16 +00:00
David Roundy
4c236753ec fix docs on WindowNavigation. 2007-10-16 21:03:49 +00:00
David Roundy
2f3a40d535 compute a reasonable navigation color based on focussed color. 2007-10-15 16:55:04 +00:00
Andrea Rossato
d7704a3c0d WindowNavigation: don't export the config constructor and some haddock fixes
I told to David I would have taken care of that: instead of exporting
the config constructor we export 2 functions: navigateColor and
noNavigateBorders. Updated documentation accordingly.
2007-10-13 09:05:24 +00:00
David Roundy
f785bad680 improvements in Combo. 2007-10-15 13:28:39 +00:00
Brent Yorgey
07184fed9f Spiral.hs: add 'description' function to LayoutClass instance for SpiralWithDir. 2007-10-16 14:09:59 +00:00
Spencer Janssen
452ba366ad ShellPrompt: traverse $PATH once per invocation. Major speed improvement 2007-10-16 09:05:52 +00:00
gwern0
53c9038b53 ShellPrompt.hs: a quick optimization of nub
I saw some complaints about ShellPrompt being slow - and noticed it myself - and it seems ShellPrompt uses 'nub' in an awkward place to uniquefy input. Nub doesn't perform well on long lists, but I once ran into a similar problem and the suggested solution was something clever: convert to a Set and then back to a List. Sets can't have duplicate entries, and they uniquefy faster than nub. The price is that the output is not sorted the same as nub's output would be, but this is OK because the output of (toList . fromList) is immediately passed to 'sort' - which should then produce the same output for both versions. I haven't really tested this but on long directories this should help.
2007-10-15 23:48:50 +00:00
Spencer Janssen
550cea2da4 defaultLayout -> layoutHook 2007-10-15 20:59:01 +00:00
Spencer Janssen
a96e944477 LayoutSelection -> Select 2007-10-15 20:58:04 +00:00
Spencer Janssen
067bda6f29 defaultLayouts -> layouts 2007-10-15 20:55:42 +00:00
David Roundy
a1a2f6b6c3 fix float bug in CopyWindow. 2007-10-15 16:15:29 +00:00
Spencer Janssen
b27fcdf08b Various docstring fixes 2007-10-13 23:05:29 +00:00
Alex Tarkovsky
5a0c98e1dd TwoPane: Fix syntax error in example 2007-10-13 01:41:51 +00:00
Don Stewart
6f166ab4cb note combo broken under head 2007-10-13 23:25:24 +00:00
Alex Tarkovsky
d5c174ab1d New features for generate-configs.sh; renamed to generate-configs 2007-10-13 09:02:51 +00:00
Don Stewart
864dd9cea8 WorkspaceDir introduces dependency on directory package 2007-10-13 23:01:02 +00:00
Don Stewart
37bc27b7f8 Dmenu.hs introduces process dependency 2007-10-13 23:00:51 +00:00
Don Stewart
1d74c72415 serialisedLayouts 2007-10-13 23:00:40 +00:00
Don Stewart
6bfeae8592 Combo requires FlexibleContexts (but still doesn't compile under ghc head) 2007-10-13 23:00:20 +00:00
Don Stewart
abc5af1c8b 'Anneal' requires 'random' package in ghc 6.8 2007-10-13 23:00:07 +00:00
Don Stewart
75fbca3ecd use leading % for magic comments in ./scripts/generate-configs.sh 2007-10-13 21:24:29 +00:00
Andrea Rossato
76964246ea WindowPrompt: haddock fixes 2007-10-13 16:07:35 +00:00
Alex Tarkovsky
b914b584ca Fix more config docstrings 2007-10-13 08:51:33 +00:00
Andrea Rossato
d861a52ff5 DragPane: haddock fixes 2007-10-13 09:04:37 +00:00
Andrea Rossato
b2ddabb016 TagWindows.hs: haddock fixes 2007-10-13 09:04:13 +00:00
Andrea Rossato
6ab50d3f84 Tabbed: haddock fixes 2007-10-13 09:03:42 +00:00
Andrea Rossato
4077ad6406 Roledex.hs: haddock fixes 2007-10-13 09:03:23 +00:00
Andrea Rossato
da576a4140 ResizableTile.hs: haddock fixes 2007-10-13 09:02:33 +00:00
Andrea Rossato
99ddf09560 CycleWS: typo 2007-10-13 09:01:45 +00:00
Andrea Rossato
af99f4b319 CopyWindow.hs: type signature for copy 2007-10-13 09:01:22 +00:00
Andrea Rossato
c3c2499052 Circle.hs: haddock fixes 2007-10-13 09:01:00 +00:00
Andrea Rossato
a056f10710 Accordion.hs: haddock fixes 2007-10-13 09:00:38 +00:00
Don Stewart
d699957320 clean up DynamicLog.hs 2007-10-13 19:51:29 +00:00
Devin Mullins
51d60c7a33 remove old TODOs (fix darcs conflict) 2007-10-12 15:48:59 +00:00
Devin Mullins
96bc2749ae haddock improvement 2007-10-12 14:54:47 +00:00
Joachim Fasting
4b5a4b7a23 MetaModule.hs: add RunInXTerm and XUtils. 2007-10-12 11:42:52 +00:00
nornagon
979968bb49 Add documentation to Dishes.hs 2007-10-12 07:29:53 +00:00
Devin Mullins
0927815c14 doco fix: s/SomeLayout/Layout/g 2007-10-12 02:59:53 +00:00
Andrea Rossato
a85718506b Haddock fixes 2007-10-12 10:04:16 +00:00
Alex Tarkovsky
85794b9558 Fix EwmhDesktops, ManageDocks, and SetWMName compilation for amd64 2007-10-10 21:38:53 +00:00
Karsten Schoelzel
26dc3c05f2 Export hasTag 2007-10-11 09:55:04 +00:00
Eric Mertens
f883fe0e9a Improve readability of RotView 2007-10-11 17:52:00 +00:00
Juraj Hercek
0ea83bd92f Added wmii like actions extension. 2007-10-10 20:14:52 +00:00
Spencer Janssen
df3d489284 Remove spurious output from ShellPrompt 2007-10-11 18:28:16 +00:00
l.mai
39b30296c5 add/reformat (commented out) tracing code to SwitchTrans 2007-10-11 02:21:39 +00:00
l.mai
183b6fb563 NoBorders bugfix (I hope)
David Roundy should probably have a look at this, but this change makes sense
to me. Plus it makes NoBorders work in combination with SwitchTrans. :-)
2007-10-11 02:17:56 +00:00
gwern0
762681f9bd XSelection.hs: Implement Andrea's idea for handling non-UTF-8 string cases 2007-10-10 02:06:16 +00:00
Spencer Janssen
144e8baf53 Add XSelection to MetaModule 2007-10-10 16:03:40 +00:00
gwern0
749f309474 XSelection.hs: a new module for XMonadContrib dealing with copy-and-paste
This is based on Andrea Rossato's standalone tools and is meant for integration straight into a Config.hs. It offers two main functions, 'getSelection' and 'putSelection', whose names should be self-explanatory.
2007-10-08 22:27:06 +00:00
Andrea Rossato
0dfef633ab Add WindowPrompt: the XPrompt equivalent of WindowBringer 2007-10-09 16:40:47 +00:00
Andrea Rossato
de16d4587c WindowBringer: export windowMapWith used by WindowPrompt 2007-10-09 16:35:05 +00:00
Andrea Rossato
e30a4dc136 MetaModule: added WindowPrompt 2007-10-09 16:34:45 +00:00
Spencer Janssen
5519714921 LayoutScreens: update docs 2007-10-08 16:14:41 +00:00
Spencer Janssen
bc768af023 TwoPane: update docs 2007-10-08 16:13:45 +00:00
Andrea Rossato
87966eb05e DragPane: no need to deal with expose events in this simplified version 2007-10-08 14:38:01 +00:00
David Roundy
dcd7388f1b make createNewWindow set background and foreground to a given color.
This means we don't need to draw colors that are this color.  Also
speeds up redrawing, since the X server can do all the drawing on its
own, without talking with xmonad.
2007-10-08 12:52:06 +00:00
Shachaf Ben-Kiki
9c4d32fe12 Fix more LANGUAGE pragmas
This patch should go after my other one -- I'd missed some files that used
-fglasgow-exts.
2007-10-08 11:52:29 +00:00
Shachaf Ben-Kiki
73c055bd46 Add LANGUAGE pragams
It seems that GHC 6.6 just enables -fglasgow-exts when it sees any LANGUAGE
pragma, so not all of them were added; this patch adds the rest of them, which
is necessary for xmonad to compile in GHC >=6.7.
2007-10-08 02:21:41 +00:00
l.mai
6120380809 fix SwitchTrans some more 2007-10-07 22:41:16 +00:00
Devin Mullins
11687d63fb update doco 2007-10-07 21:59:06 +00:00
Devin Mullins
ad9e827492 add bringMenu, and extract duplication 2007-10-07 21:55:32 +00:00
Andrea Rossato
c415ab00b7 DragPane must handle ExposeEvent too 2007-10-08 07:47:02 +00:00
gwern0
a82a44282f ShellPrompt.hs: add getShellCompl to export list
getShellCompl is useful for writing prompts in Config.hs or even full standalone prompts; and personally, if a  small utility function like 'split' can be exported, how much more so something useful like getShellCompl?
2007-10-07 22:02:36 +00:00
Andrea Rossato
574cb0baa0 Tabbed and XPrompt updated to lates Extras changes 2007-10-07 16:38:25 +00:00
Devin Mullins
e421157aa4 doc fixes for ManageDocks 2007-10-07 20:40:16 +00:00
l.mai
d4c9f0ead8 fix(?) SwitchTrans (makes noBorders work again) 2007-10-07 19:30:55 +00:00
l.mai
e02ad926e0 avoid compiler warning in FlexibleManipulate 2007-10-07 16:35:09 +00:00
gwern0
51084b8e64 update NoBorders.hs configuration documentation
It seems 'noBorder full' no longer hacks it.
2007-10-07 19:06:21 +00:00
Devin Mullins
5ea3b29dd5 d'oh, add WindowBringer to MetaModule 2007-10-07 18:51:38 +00:00
Devin Mullins
51d770e1e6 Maybe? What Maybe? (rollback earlier dmenu change) 2007-10-07 18:59:15 +00:00
Devin Mullins
367210bae1 Enter WindowBringer, Bringer of Windows. 2007-10-07 17:36:33 +00:00
Devin Mullins
87a35e799a add dmenuMap function 2007-10-07 17:25:43 +00:00
Andrea Rossato
be8baa8324 ShellPrompt: check for executables and better error handling
Code contributed by Spencer (basically I just removed FilePath
depenency).
2007-10-07 11:01:33 +00:00
mail
af3efea238 Move my NextWorkspace functionality into CycleWS
Hi,

This patch merges the additional functionality of my NextWorkspace into CycleWS,
using a compatible interface for what was there before.

Greetings,
Joachim
2007-10-07 10:39:33 +00:00
mail
a40f8c9c5f ManageDocks now handles STRUT windows as well
It now also detects window with STRUT set and modifies the gap accordingly.
Cheveats:
 * Only acts on STRUT apps on creation, not if you move or close them
 * To reset the gap, press Mod-b twice and restart xmonad (Mod-q)
2007-10-07 10:31:16 +00:00
mail
7486c29254 NextWorkspace haddock improvement
I just added to the docs how to move a window to the next workspace 
_and_ switch to that (by >>’ing the two actions). Some users (like me, it
seems) probably prefer that behaviour.

Greetings,
Joachim
2007-10-07 08:32:16 +00:00
mail
51033a3315 NextWorkspace: Go forward or backward
Hi,

inspired by RotView, I implemented an Extension that allows the user to go
forward or backward in the list of workspaces, or to move the current
window to the next or previous workspace. Haddock included. Works here, but
hardly tested (and while tired).

Cu torrow @ HacII, if you are there.

Greetings,
Joachim
2007-10-06 23:30:10 +00:00
mail
0d7daf4e27 Better EWMH support
Yay, SetWMName contains just what I need! Thanks Ivan, that saved me quite
some work. Now the panel switch should work even when you start with xmonad
right away, and don’t run it after metacity has run before :-]

Greetings,
Joachim
2007-10-07 09:16:48 +00:00
Andrea Rossato
39c0f0355b Add ShellPrompt to MetaModule 2007-10-07 07:59:37 +00:00
Andrea Rossato
bac3846853 Tabbed: updated to the last (unannounced) API changes 2007-10-07 07:20:18 +00:00
Andrea Rossato
0b3397aad3 ShellPrompt: fromMaybe requires importing Data.Maybe 2007-10-07 07:01:48 +00:00
l.mai
560801a88a add MouseGestures to MetaModule 2007-10-06 23:07:35 +00:00
l.mai
c1ab053662 re-add SwitchTrans to MetaModule 2007-10-06 23:07:11 +00:00
l.mai
da594e9907 add MouseGestures.hs to darcs 2007-10-06 23:04:25 +00:00
l.mai
bf103490d5 document noBorders breakage 2007-10-06 23:03:16 +00:00
nornagon
e1a10b926e Replace -fglasgow-exts with LANGUAGE pragma in WindowNavigation.hs 2007-10-06 22:41:56 +00:00
nornagon
48c89e0e3f Replace -fglasgow-exts with LANGUAGE pragma in ResizableTile.hs 2007-10-06 22:31:56 +00:00
nornagon
54e133cf0c Replace -fglasgow-exts with LANGUAGE pragma in MosaicAlt.hs 2007-10-06 22:30:25 +00:00
nornagon
54e9573b12 Replace -fglasgow-exts with LANGUAGE pragma in Grid.hs 2007-10-06 22:23:20 +00:00
nornagon
f06195dd47 Replace -fglasgow-exts with LANGUAGE pragma in Dishes.hs 2007-10-06 22:21:55 +00:00
l.mai
fbaa785424 update SwitchTrans for the new layout system 2007-10-06 21:20:08 +00:00
Christian Thiemann
2c600dbc7c Two new dynamic log functions that display the title of the currently focused window
I liked the window-title-in-statusbar feature of dwm very much and wanted to
have that in XMonad as well.  Somewhere on the net I found some code to put
into Config.hs (and sorry, that was last week and I already forgot where I got
it from) which I modified and put into the DynamicLog extension.  One can now
set the logHook in Config.hs either to dynamicLogWithTitle to get the usual
layout description and workspace list plus window title enclosed in angle
brackets, or dynamicLogWithTitleColored "white" (or "red" etc.) to have xmonad
print out some ^fg() markers for dzen to display the window title in the given
color.

Some windows (like terminals or browsers) change their window title from time
to time but xmonad does not recognize this.  So I started learning Haskell to
provide patches for X11-extras and xmonad so that PropertyNotify events are
captured and, if the event notifies about a WM_NAME property change, call the
logHook to update the status bar.

Hope you find this useful,
  Christian
2007-10-06 17:31:13 +00:00
Devin Mullins
beaead5256 change Dmenu functions to return IO/X (Maybe String)
dmenu exits with code 1 when you hit Escape, and I wanna create a contrib that
takes advantage of that.

This required changes in four contribs (Commands, DirectoryPrompt, ShellPrompt,
and WorkspaceDir), and might require changes in users' Configs. Also, I'm not
sure some of the changes I made to the client code are very Haskelly. Would
appreciate input there.
2007-10-06 07:09:59 +00:00
David Roundy
dcbfe603b5 fix problem found by Heffalump in CopyWindow. 2007-10-05 14:37:46 +00:00
mail
6c2b35046d (un)Manage Docks based on WINDOW_TYPE
Hi,

this is a replacement for the example code in Config.hs that should detect
and unamange, for example, the gnome-panel.

The problem with that code is that it also unamangs dialog boxes from gnome-panel
which then are not usable (no keyboard intput, at least here).

Greetings,
Joachim
2007-10-06 13:28:02 +00:00
Joachim Fasting
81c44fa3f6 MetaModule.hs: add Dishes. 2007-10-06 12:39:00 +00:00
Joachim Fasting
da60a371b1 Dishes.hs: needs -fglasgow-exts. 2007-10-06 12:38:51 +00:00
Joachim Fasting
d9fbcc7557 ResizableTile.hs: needs -fglasgow-exts. 2007-10-06 12:35:50 +00:00
Joachim Fasting
34b2ebb0a4 MetaModule.hs: whitespace. 2007-10-06 12:35:40 +00:00
Joachim Fasting
8f1a18d853 MetaModule.hs: add some missing imports. 2007-10-06 12:35:25 +00:00
Joachim Fasting
91501f7a1c MetaModule.hs: typo. 2007-10-06 12:32:14 +00:00
Joachim Fasting
fff1778e75 NoBorders.hs: unused bindings. 2007-10-06 10:23:16 +00:00
Joachim Fasting
9c8877dad6 NoBorders.smartBorders: add type signature. 2007-10-06 10:22:10 +00:00
Joachim Fasting
25bc72459d Grid.hs: needs -fglasgow-exts. 2007-10-06 10:22:04 +00:00
mail
32cffdbca1 EwmhWindows wrap up for inclusion
Now with haddock documentation, a proper header and nicer, warningfree code, ready
for a first release and inclusion in XMonadConrib. It works for me, but needs more
testing. If you run xmonad with gnome-panel or something similar, please try it.

Thanks,
Joachim
2007-10-06 11:05:29 +00:00
mail
d72ff99200 EwmhDesktops initial patch
What works so far, quit hackerish:
 * Number of Workspaces
 * Active current workspace
 * Names of workspaces
More to come..
2007-10-05 22:25:40 +00:00
Devin Mullins
c51fcfef2d get rid of obviated comment 2007-10-06 05:56:52 +00:00
Devin Mullins
53ae2de5ac get rid of duplicate mapWorkspaces function 2007-10-06 05:54:04 +00:00
l.mai
972e262e3a add Grid to MetaModule 2007-10-05 23:00:32 +00:00
l.mai
2299cc3030 basic docs for Grid 2007-10-05 22:59:34 +00:00
l.mai
8ed858d3c8 import Grid.hs into repository 2007-10-05 01:34:12 +00:00
nornagon
332a91325c Dishes layout. Stacks windows underneath masters. 2007-10-05 23:00:38 +00:00
Andrea Rossato
509416d0d4 ShellPrompt: removed readline dependency and added escape character support 2007-10-05 11:22:50 +00:00
Andrea Rossato
cfa8429450 XPrompt: added ^A and ^E and more
- added ^A (start of line) and ^E (end of line)
- added support for escaping spaces (see an example of it's use in the
  new ShellPrompt)
- some code cleanup: I'm now tracking changes to XPrompt also in
  modified version that supports i18n. This is the reason of some name
  changes.
2007-10-05 11:21:22 +00:00
Andrea Rossato
7e00195c4b Tabbed: check if we really have a window to focus 2007-10-05 11:17:33 +00:00
Devin Mullins
b9abecd4f2 add QC tests for SwapWorkspaces
run with -i..:../tests
2007-10-04 08:15:34 +00:00
Devin Mullins
1b4c763ef9 add man page doco 2007-10-04 08:15:04 +00:00
Jamie Webb
2f7fb1480d Maximize layout modifier 2007-10-04 06:12:02 +00:00
Eric Mertens
70ef0f2d88 Add ^K and ^U support to XPrompt 2007-10-02 21:08:14 +00:00
Jamie Webb
222c67ab88 Rename ResizableTile.Tall to ResizableTall
Having two layouts named Tall was upsetting the deserialization code.
2007-10-03 02:30:00 +00:00
Jamie Webb
667918e6a9 MosaicAlt take 2 2007-10-03 16:25:33 +00:00
Spencer Janssen
093dd7a400 Mark modules that haven't been ported to the new API yet.
These need to be ported or removed before the 0.4 release.
2007-10-03 16:45:16 +00:00
Spencer Janssen
b9dc9be07e More LANGUAGE pragmas 2007-10-03 16:42:57 +00:00
Spencer Janssen
2bf55b0138 Add XPropManage to MetaModule 2007-10-03 16:42:36 +00:00
David Roundy
5669c3903a add swapping capability in WindowNavigation.
This allows you to reorder your windows geometrically, by
swapping the currently focussed window with ones that are
up/down/right/left of it.  The idea is that we should be
able to manipulate windows based on the visual layout of
the screen rather than some (possibly obscure) logical ordering.
2007-10-03 15:17:55 +00:00
Daniel Neri
7b4f4e5817 export constructor to make ThreeColumns layout usable again 2007-10-03 09:31:03 +00:00
Andrea Rossato
e8bd7919fa WindowNavigation: add configurable colors and the possibility to turn them off 2007-10-03 09:00:17 +00:00
Spencer Janssen
d60c48238e Add SwapWorkspaces to MetaModule 2007-10-03 16:34:05 +00:00
Devin Mullins
71d822250f add SwapWorkspaces (to reorder them on your number keys) 2007-10-02 21:24:07 +00:00
Jamie Webb
fe8941da13 Layout -> LayoutClass for ResizableTile and MosaicAlt 2007-10-03 01:08:49 +00:00
Spencer Janssen
92efa63299 NoBorders: reduce flicker 2007-10-02 21:30:53 +00:00
Karsten Schoelzel
21ba61d1b9 TagWindows
Functions to work with window tags, including a XPrompt interface.
These are stored in the window property "_XMONAD_TAGS"

Adding also functions shiftHere and shiftToScreen (move to another module?).
2007-10-02 19:05:26 +00:00
Karsten Schoelzel
2323614b0f Add XPropManage, a manageHook using XProperties 2007-10-02 19:02:31 +00:00
David Roundy
4e3fab6779 make Spiral work with new layout class. 2007-10-02 16:47:35 +00:00
David Roundy
db1026f6e9 some renaming of classes and data types. 2007-09-29 19:12:38 +00:00
Spencer Janssen
12c4318b03 SimpleStacking is deprecated 2007-10-02 18:56:04 +00:00
Andrea Rossato
e9365723a8 Make Tabbed use XUtils.releaseFont 2007-10-02 06:27:09 +00:00
Andrea Rossato
cbd6b83b4f XUtils: added releaseFont 2007-10-02 06:26:40 +00:00
Jamie Webb
e7780183fe An alternative mosaic layout implementation 2007-10-02 01:17:16 +00:00
Jamie Webb
51d0fddb66 Fix infinite loop in ResizableTile serialization 2007-10-02 00:12:54 +00:00
Spencer Janssen
59e4cc28f7 Use newtype deriving for Invisible 2007-10-01 15:15:55 +00:00
Andrea Rossato
39c272d85f Tabbed: updated usage information 2007-10-01 08:22:19 +00:00
matsuyama3
828eb2c4dc XMonadContrib.ResizableTile in darcs patch.
I have fixed error "" to return Nothing. Thanks Andrea.
2007-10-01 09:14:11 +00:00
Andrea Rossato
7eea993964 Commands: added recent layout commands 2007-09-30 21:32:25 +00:00
Andrea Rossato
3ed5f5cde0 Removed fromIMaybe from Tabbed ad added it to Invisible 2007-09-30 18:19:12 +00:00
Andrea Rossato
d758a8b412 Tabbed: reintroduced shrinker configuration option and removed the unneeded Read instance 2007-09-30 13:19:36 +00:00
Andrea Rossato
33f5c17bab Tabbed: moved string positioning to XUtils 2007-09-30 09:54:41 +00:00
Andrea Rossato
44caa486a1 refactor paintAndWrite to take the alignment and hide string positioning 2007-09-30 09:52:15 +00:00
Andrea Rossato
6b3d57c896 make DraPane use XUtils 2007-09-29 17:28:49 +00:00
Andrea Rossato
24f28e2ba6 make Tabbed use XUtils 2007-09-29 17:28:23 +00:00
Andrea Rossato
48afa3bbe4 Added XUtils: a library for drawing 2007-09-29 17:27:54 +00:00
David Roundy
107c9912bf enable color setting in WindowNavigation.
This is still somewhat experimental, comments welcome.
2007-09-29 11:45:31 +00:00
Spencer Janssen
ad87351147 Add smartBorders 2007-09-29 01:09:46 +00:00
Spencer Janssen
9c0e28c490 Give Invisible a definition for fail.
The default definition of fail calls error.  This is very bad, as we rely on a
non-bottom result.  We should consider moving to MonadZero, to be on the safe
side.
2007-09-29 05:15:27 +00:00
Andrea Rossato
46452ba025 Tabbed: fixed a bug: when only one window is in the stack doLayout must still return a Tabbed (I Nothing) TConf 2007-09-28 22:31:36 +00:00
Andrea Rossato
0f525c0761 Added Invisible to store layout state
Invisible is a data type to store information that will be lost when
restarting XMonad (the idea came from David Roundy)
2007-09-28 19:01:07 +00:00
Andrea Rossato
77d047200d WindowNavigation now uses Invisible (plus some vertical alignement) 2007-09-28 18:59:07 +00:00
Andrea Rossato
338d0c3130 DragPane now uses Invisible 2007-09-28 18:58:32 +00:00
Andrea Rossato
b5cabd671e Tabbed now uses Invisible 2007-09-28 18:58:08 +00:00
David Roundy
81371c20fa add new WindowNavigation module. 2007-09-28 13:19:06 +00:00
Andrea Rossato
285ade1cbe Tabbed: removed two little bugs due to the mess during the transition (my fault, sorry ;) 2007-09-28 08:55:13 +00:00
Joachim Fasting
2fc9428df1 DeManage.hs: doesn't need -fglasgow-exts. 2007-09-28 08:36:39 +00:00
Spencer Janssen
de6968d1b4 Use LANGUAGE pragmas over -fglasgow-exts 2007-09-28 18:16:14 +00:00
David Roundy
fcd4ef11de remove SetLayout. 2007-09-28 01:58:55 +00:00
Spencer Janssen
1bd0fee18d Various fixes to NoBorders. Hopefully fixes bug #42 2007-09-28 17:46:15 +00:00
Spencer Janssen
91df16823f Use LANGUAGE pragmas 2007-09-28 17:46:02 +00:00
Spencer Janssen
c1cc5b23e8 LayoutModifier: call unhook after releaseResources 2007-09-28 17:45:10 +00:00
Spencer Janssen
1e0a92acd6 DynamicLog: sort first by index in the workspaces list, then by tag name 2007-09-28 14:49:00 +00:00
Spencer Janssen
acc70375a7 Make modifier descriptions prettier 2007-09-28 05:32:57 +00:00
Spencer Janssen
9e5501ce1f Give Hinted a nice description 2007-09-28 05:31:21 +00:00
Spencer Janssen
1ef72a1bfa LayoutModifier should have descriptions too 2007-09-28 05:31:06 +00:00
Spencer Janssen
1593bb54cd Tabbed: give a nice description 2007-09-28 05:26:08 +00:00
Spencer Janssen
2323b1408c DynamicLog: print a description of the current layout 2007-09-28 05:16:06 +00:00
Spencer Janssen
423db457fc Update docs 2007-09-28 03:43:50 +00:00
Spencer Janssen
e9fbb298ec Add simpler layoutHints 2007-09-28 03:40:08 +00:00
Andrea Rossato
91f98540be NewTabbed: after a ReleaseResources we should return Tabbed Nothing... 2007-09-28 01:16:45 +00:00
Spencer Janssen
9609ec3cc3 Move NewTabbed to Tabbed 2007-09-27 23:18:40 +00:00
Spencer Janssen
d562b3c572 Remove Tabbed.hs 2007-09-27 23:10:02 +00:00
Spencer Janssen
35b3920524 Remove Decoration.hs 2007-09-27 23:09:47 +00:00
Andrea Rossato
92ccfee617 DragPane:just code formatting 2007-09-27 08:38:14 +00:00
Andrea Rossato
77404ef53b NewTabbed: fixes a (reintroduced) bug and some code formatting
- The InvisibleMaybe patch reintroduced the rectangle bug.
- Some code formatting
- Corrected usage information
2007-09-27 08:35:51 +00:00
David Roundy
20edf8dce6 make NewTabbed use InvisibleMaybe to hide its cache. 2007-09-26 20:23:30 +00:00
David Roundy
9880d6faab make DragPane code a bit more compact. 2007-09-26 19:16:56 +00:00
David Roundy
f703dea0ae hide implementation of DragPane from users. 2007-09-26 19:16:30 +00:00
David Roundy
9d2f57f6a6 make DragPane a bit more succinct. 2007-09-26 19:09:00 +00:00
Andrea Rossato
2d3cf0b4fd make DragPane work with the new Layout class 2007-09-26 19:04:39 +00:00
Andrea Rossato
430a0dd8a9 make MagicFocus work with the new Layout class 2007-09-26 11:43:07 +00:00
Andrea Rossato
e8b225fee1 NewTabbed: we must check if the sceen rectangle changed
- Check if rectangle changed
- removed orphan instances warnings
- some code formatting
2007-09-26 11:40:56 +00:00
David Roundy
5ff5f0ca01 fix DynamicWorkspaces. 2007-09-25 22:06:59 +00:00
Spencer Janssen
14c44216dc Remove LayoutChoice, this functionality is in the core 2007-09-25 21:49:12 +00:00
David Roundy
537e0b8681 new SetLayout module. 2007-09-25 20:53:33 +00:00
David Roundy
c2ca3c6593 make Accordian use pureLayout. 2007-09-25 19:21:17 +00:00
David Roundy
23af4f228b modifyLayout -> handleMessage. 2007-09-25 18:29:30 +00:00
David Roundy
8c6ebf9d6e Make Square work with class. 2007-09-25 17:44:46 +00:00
David Roundy
40e1d3e618 make Combo work with class 2007-09-25 17:44:17 +00:00
Andrea Rossato
648132f636 NewTabbed: fixed a bug and some code formatting
- Since now Operations.windows doesn't call sendMessage UnDoLayout
anymore, doLayout must take care of destroying all tabs when only one
window ( or none) is left on the workspace.
- Some code formatting.
2007-09-25 13:37:49 +00:00
Andrea Rossato
2c29ae74df make Roledex work with Layout class 2007-09-25 15:32:37 +00:00
Andrea Rossato
1f986de3f6 make Accordion work with Layout class 2007-09-25 15:23:07 +00:00
David Roundy
3183254033 fix embarrassing bugs in LayoutModifier. 2007-09-24 19:57:26 +00:00
Andrea Rossato
5116847159 Added a NewTabbed module with a new tabbed layout to test 2007-09-24 19:34:19 +00:00
Andrea Rossato
ac82b7ec35 LayoutModifier updated to use LayoutMessages 2007-09-24 19:33:45 +00:00
David Roundy
4bd8319e02 move ThreeCol over to new class. 2007-09-24 19:16:32 +00:00
Spencer Janssen
b34251c722 Use the new modifiers in LayoutHints 2007-09-24 06:20:00 +00:00
Spencer Janssen
318c5e83eb Use the new layout switcher in Commands 2007-09-24 06:05:41 +00:00
Spencer Janssen
59be9148e4 Follow kind changes in FindEmptyWorkspace 2007-09-24 05:59:28 +00:00
David Roundy
38657d40c6 update WorkspaceDir. 2007-09-23 22:14:56 +00:00
David Roundy
220cea642d rename LayoutHelpers to LayoutModifier. 2007-09-23 21:59:56 +00:00
David Roundy
6a4ed37fb0 convert LayoutScreens to class. 2007-09-23 21:59:42 +00:00
David Roundy
f82d3dadb2 Update NoBorders and LayoutHelpers. 2007-09-23 19:26:40 +00:00
David Roundy
89f89021ab add a hook to LayoutHelpers. 2007-09-23 12:17:23 +00:00
David Roundy
92834a2493 use default modifyLayout in Circle. 2007-09-23 11:52:57 +00:00
David Roundy
dcaae4f01b update LayoutHelpers to work with new Layout class. 2007-09-23 11:49:29 +00:00
Andrea Rossato
4c841078b3 make TwoPane work with Layout class 2007-09-22 12:42:10 +00:00
Andrea Rossato
62f6884423 Circle: must export type constructor 2007-09-22 12:41:26 +00:00
David Roundy
8d1d4b466e make Circle work with Layout class. 2007-09-21 21:55:25 +00:00
Spencer Janssen
59789e11f4 Cope with StackSet export changes 2007-09-24 09:10:31 +00:00
Joachim Fasting
fa98fc3b7d Rolodex.hs: add missing type signature.
div' is only used with Dimension, used Integral to keep it general.
2007-09-19 21:54:36 +00:00
Joachim Fasting
35f29b75d3 Warp.hs: remove seemingly unused code. 2007-09-19 21:46:34 +00:00
Joachim Fasting
4bde5e30b6 CopyWindow.hs: -Wall police. 2007-09-19 21:45:56 +00:00
Joachim Fasting
d557e5f382 CopyWindow.copy: remove seemingly unnecessary parameter from helper func. 2007-09-19 21:45:26 +00:00
Joachim Fasting
119412d095 DirectoryPrompt.hs: add missing type signature. 2007-09-19 21:37:36 +00:00
Joachim Fasting
2fa916ad29 LayoutChoice.hs: update module header. 2007-09-19 21:31:01 +00:00
Joachim Fasting
3ce4b71b13 LayoutChoice.hs: add LANGUAGE pragma. 2007-09-19 21:28:15 +00:00
Joachim Fasting
1f3bdd659a SinkAll.hs: -Wall police. 2007-09-19 21:23:59 +00:00
gwern0
8d29875f8b XPrompt.hs: replace 'borderWidth' with 'borderPixel'
borderWidth is already defined in Config.hs. Thus, if one attempted to use a prompt configuration different than defaultXPConfig, and one defined it in one's Config.hs where it should be, then the borderWidth field would cause a warning by -Wall, since borderWidth is already a name being used by XMonad at large.
2007-09-18 16:29:50 +00:00
Spencer Janssen
4d2170bbb4 Operations.sink is gone 2007-09-17 21:41:13 +00:00
Spencer Janssen
6c7fde2991 Match 'Remove Operations functions which have StackSet equivalents' from the core 2007-09-17 21:33:29 +00:00
Brandon S Allbery KF8NH
67779476ed SshPrompt.hs: fix some copy/paste errors, rebind sshPrompt to not conflict with xmonadPrompt
Just a minor patch to the comments/documentation, which was clearly copied
unchanged from ShellPrompt.hs.
2007-09-16 18:25:20 +00:00
David Roundy
2aaadede35 make fixedLayout accept a list of Rectangles.
This works nicely for describing a fixed xinerama-like layout.
(e.g. when using two distinct VNC clients to log into a single
VNC server and attain multiheadedness).
2007-09-11 13:48:45 +00:00
Michael Fellinger
44a2e41a15 Fixing some typos and grammar in documentation. 2007-09-11 02:31:58 +00:00
Michael Fellinger
0994d187f2 Typo in Tabbed.hs documentation 2007-09-11 02:18:15 +00:00
Brandon S Allbery KF8NH
f5f674280d ssh-global-known-hosts
Add support for global ssh known hosts file, which is checked for via
$SSH_KNOWN_HOSTS or a standard list of locations.  This is stripped of
comments and hashed hosts, combined with the local hosts file (which is
trated the same way), and duplicates eliminated.
2007-09-09 22:24:32 +00:00
David Roundy
451b5e869d add LayoutChoice module. 2007-09-06 15:49:55 +00:00
Joachim Fasting
220d6b1888 FloatKeys.hs: needs -fglasgow-exts to compile. 2007-09-09 14:42:15 +00:00
Joachim Fasting
0bf45b94cf DragPane.hs: needs -fglasgow-exts to compile. 2007-09-09 14:42:05 +00:00
Karsten Schoelzel
9ab2d77798 Unify Drag(UpDown)Pane 2007-09-04 21:03:12 +00:00
David Roundy
3c72df8713 add function and comment assisting use in resizing the screen. 2007-09-06 12:55:43 +00:00
Karsten Schoelzel
883854c1e8 Add FloatKeys for moving and resizing of floating windows with the keyboard 2007-09-05 21:25:31 +00:00
Karsten Schoelzel
e345ad893d Fix FlexibleResize for change in applySizeHints 2007-09-05 19:39:26 +00:00
David Roundy
c0ed2a6bbc make dragPane handle thinner. 2007-09-05 12:41:39 +00:00
David Roundy
c7728a6b6a cleanup in WorkspaceDir. 2007-08-27 18:58:33 +00:00
Ivan Tarasov
29a9eb9f5a new SetWMName module, useful for working around problems running Java GUI applications. 2007-08-26 00:44:11 +00:00
David Roundy
4efa95ece0 remove LayoutHooks module (which is unused). 2007-08-23 15:45:20 +00:00
David Roundy
5943b98bf2 cleanup in DwmPromote. 2007-08-23 15:54:37 +00:00
David Roundy
266f5cfc0a cleanup in ViewPrev. 2007-08-23 15:54:05 +00:00
David Roundy
4b9bfe0a8a clean up CopyWindow. 2007-08-23 15:59:12 +00:00
Spencer Janssen
0f1618bac9 Add CycleWS to MetaModule 2007-09-05 20:31:37 +00:00
Andrea Rossato
12503e090a CycleWS: a couple of simple functions to cycle between workspaces 2007-08-21 06:11:32 +00:00
David Roundy
e0a509171e make Contrib use WorkspaceId = type String. 2007-08-20 11:38:13 +00:00
Spencer Janssen
4c2017bf36 Add HintedTile docstring 2007-09-05 20:03:10 +00:00
Alex Tarkovsky
d0adeca94a Docstring parser for generating xmonad build configs with default settings for extensions 2007-09-05 20:01:28 +00:00
Spencer Janssen
39180985fb TAG 0.3 2007-09-05 02:29:47 +00:00
Don Stewart
dd3bd26cec docs not generated in DragPane.hs 2007-09-04 23:24:47 +00:00
338 changed files with 48895 additions and 4037 deletions

24
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,24 @@
### Problem Description
Describe the problem you are having, what you expect to happen
instead, and how to reproduce the problem.
### Configuration File
Please include the smallest configuration file that reproduces the
problem you are experiencing:
```haskell
module Main (main) where
import XMonad
main :: IO ()
main = xmonad def
```
### Checklist
- [ ] I've read [CONTRIBUTING.md](https://github.com/xmonad/xmonad/blob/master/CONTRIBUTING.md)
- [ ] I tested my configuration with [xmonad-testing](https://github.com/xmonad/xmonad-testing)

12
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,12 @@
### Description
Include a description for your changes, including the motivation
behind them.
### Checklist
- [ ] I've read [CONTRIBUTING.md](https://github.com/xmonad/xmonad/blob/master/CONTRIBUTING.md)
- [ ] I tested my changes with [xmonad-testing](https://github.com/xmonad/xmonad-testing)
- [ ] I updated the `CHANGES.md` file

26
.gitignore vendored Normal file
View File

@@ -0,0 +1,26 @@
.cabal-sandbox/
cabal.sandbox.config
.hpc/
*.hi
*.o
*.p_hi
*.prof
*.tix
cabal.config
dist
dist-*
# editor temp files
*#
.#*
*~
.*.swp
# TAGS files
TAGS
tags
# stack artifacts
/.stack-work/
/cabal.project.local

102
.mailmap Normal file
View File

@@ -0,0 +1,102 @@
Alejandro Serrano Mena <trupill@gmail.com>
Alexandre Buisse <buisse@cs.chalmers.se>
Anders Engstrom <ankaan@gmail.com>
Antoine R. Dumont <eniotna.t@gmail.com>
Anton Pirogov <anton.pirogov@gmail.com>
Anton Pirogov <anton.pirogov@gmail.com> anton.pirogov at gmail . com <unknown>
Arjun Comar <nrujac@gmail.com>
Audun Skaugen <audun@skaugen.name> <audunskaugen@gmail.com>
Bas van Dijk <v.dijk.bas@gmail.com>
Ben Boeckel <mathstuf@gmail.com>
Ben Weitzman <benweitzman@gmail.com>
Bogdan Sinitsyn <bogdan.sinitsyn@gmail.com>
Brandon S Allbery KF8NH <allbery.b@gmail.com>
Brandon S Allbery KF8NH <allbery.b@gmail.com> <allbery@ece.cmu.edu>
Brent Yorgey <byorgey@gmail.com> <byorgey@cis.upenn.edu>
Carlos Lopez-Camey <c.lopez@kmels.net>
Carsten Otto <xmonad@c-otto.de>
Christian Dietrich <stettberger@dokucode.de>
Christian Wills <cwills.dev@gmail.com>
Daniel Neri <daniel.neri@sigicom.com> <daniel.neri@sigicom.se>
Daniel Schoepe <daniel.schoepe@googlemail.com> <asgaroth_@gmx.de>
Daniel Schoepe <daniel.schoepe@googlemail.com> <daniel.schoepe@gmail.com>
Daniel Wagner <me@dmwit.com> <daniel@wagner-home.com>
Dave Harrison <dave@nullcube.com>
David Glasser <glasser@mit.edu>
David McLean <gopsychonauts@gmail.com>
Devin Mullins <devin.mullins@gmail.com> <me@twifkak.com>
Dominik Bruhn <dominik@dbruhn.de>
Don Stewart <dons00@gmail.com> <dons@cse.unsw.edu.au>
Don Stewart <dons00@gmail.com> <dons@galois.com>
Edward Z. Yang <ezyang@cs.stanford.edu>
Gwern Branwen <gwern@gwern.net>
Gwern Branwen <gwern@gwern.net> <gwern0@gmail.com>
Henrique Abreu <hgabreu@gmail.com>
Ilya Portnov <portnov84@rambler.ru>
intrigeri <intrigeri@boum.org>
Ivan Miljenovic <Ivan.Miljenovic@gmail.com>
Jan-David Quesel <quesel@informatik.uni-oldenburg.de>
Jens Petersen <juhp@community.haskell.org> <petersen@haskell.org>
Jeremy Apthorp <nornagon@gmail.com>
Joachim Breitner <mail@joachim-breitner.de>
Joachim Fasting <joachim.fasting@gmail.com>
Joel Suovaniemi <joel.suovaniemi@iki.fi>
Joe Thornber <joe.thornber@gmail.com>
Johann Giwer <johanngiwer@web.de>
Jussi Maki <joamaki@gmail.com>
Konstantin Sobolev <konstantin.sobolev@gmail.com>
Lanny Ripple <lan3ny@gmail.com>
Lei Chen <linxray@gmail.com>
Leonardo Serra <leoserra@minaslivre.org>
Luis Cabellos <zhen.sydow@gmail.com>
Lukas Mai <l.mai@web.de>
Mario Pastorelli <pastorelli.mario@gmail.com>
Mathias Stearn <redbeard0531@gmail.com>
Matt Brown <deadguysfrom@gmail.com>
Matthew Hague <matthewhague@zoho.com>
Nathaniel Filardo <nwfilardo@gmail.com>
Nelson Elhage <nelhage@mit.edu>
Nicolas Dudebout <nicolas.dudebout@gatech.edu>
Nicolas Pouillard <nicolas.pouillard@gmail.com>
Nils Schweinsberg <mail@n-sch.de>
Norbert Zeh <nzeh@cs.dal.ca>
Peter Olson <polson2@hawk.iit.edu>
Quentin Moser <moserq@gmail.com>
Quentin Moser <quentin.moser@unifr.ch>
Rickard Gustafsson <acura@allyourbase.se>
Robert Marlow <bobstopper@bobturf.org>
Robert Marlow <bobstopper@bobturf.org> <robreim@bobturf.org>
Rohan Jain <crodjer@gmail.com>
Sibi Prabakaran <sibi@psibi.in> <psibi2000@gmail.com>
Sean Escriva <sean.escriva@gmail.com>
Sean McEligot <seanmce33@gmail.com>
Spencer Janssen <spencerjanssen@gmail.com> <sjanssen@cse.unl.edu>
Tomohiro Matsuyama <matsuyama3@ariel-networks.com>
Tom Rauchenwald <its.sec@gmx.net>
Tony Morris <haskell@tmorris.net>
Valery V. Vorotyntsev <valery.vv@gmail.com>
Will Farrington <wcfarrington@gmail.com>
Wirt Wolff <wirtwolff@gmail.com>
Yaakov Nemoy <loupgaroublond@gmail.com>
brian <brian@lorf.org>
cardboard42 <cardboard42@gmail.com>
daedalusinfinity <daedalusinfinity@gmail.com>
hexago.nl <xmonad-contrib@hexago.nl>
intrigeri <intrigeri@boum.org>
jakob <jakob@pipefour.org>
kedals0 <kedals0@gmail.com>
lithis <xmonad@selg.hethrael.org>
lithis <xmonad@selg.hethrael.org> <xmonad@s001.hethrael.com>
longpoke <longpoke@gmail.com>
md143rbh7f <md143rbh7f@gmail.com>
perlkat <perlkat@katspace.org>
rupa <rupa@lrrr.us> <rupa@lrrr.us>
timthelion <tim.thelion@gmail.com>
# for core only
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>, Neil Mitchell
Nick Burlett <nickburlett@mac.com>
Sam Hughes <hughes@rpi.edu>
Shae Erisson <shae@ScannedInAvian.com>
Conrad Irwin <conrad.irwin@gmail.com>

104
.travis.yml Normal file
View File

@@ -0,0 +1,104 @@
# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
language: c
sudo: false
cache:
directories:
- $HOME/.cabsnap
- $HOME/.cabal/packages
before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
matrix:
include:
- env: GHCVER=8.4.3 CABALVER=2.2
compiler: ": #GHC 8.4.3"
addons: { apt: { packages: [cabal-install-2.2, ghc-8.4.3, libxrandr-dev]
, sources: [hvr-ghc]
} }
- env: GHCVER=8.2.2 CABALVER=2.0
compiler: ": #GHC 8.2.2"
addons: { apt: { packages: [cabal-install-2.0, ghc-8.2.2, libxrandr-dev]
, sources: [hvr-ghc]
} }
- env: GHCVER=8.0.1 CABALVER=1.24
compiler: ": #GHC 8.0.1"
addons: { apt: { packages: [cabal-install-1.24, ghc-8.0.1, libxrandr-dev]
, sources: [hvr-ghc]
} }
- env: GHCVER=7.10.3 CABALVER=1.22
compiler: ": #GHC 7.10.3"
addons: { apt: { packages: [cabal-install-1.22, ghc-7.10.3, libxrandr-dev]
, sources: [hvr-ghc]
} }
- env: GHCVER=7.8.4 CABALVER=1.18
compiler: ": #GHC 7.8.4"
addons: { apt: { packages: [cabal-install-1.18, ghc-7.8.4, libxrandr-dev]
, sources: [hvr-ghc]
} }
before_install:
- unset CC
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
install:
- cabal --version
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
then
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
fi
- travis_retry cabal update -v
# build xmonad from HEAD
- git clone https://github.com/xmonad/xmonad.git
- cabal install xmonad/
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
- cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
- sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
# check whether current requested install-plan matches cached package-db snapshot
- if diff -u $HOME/.cabsnap/installplan.txt installplan.txt;
then
echo "cabal build-cache HIT";
rm -rfv .ghc;
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
else
echo "cabal build-cache MISS";
rm -rf $HOME/.cabsnap;
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
fi
- cabal install --only-dependencies --enable-tests --enable-benchmarks;
# snapshot package-db on cache miss
- if [ ! -d $HOME/.cabsnap ];
then
echo "snapshotting package-db to build-cache";
mkdir $HOME/.cabsnap;
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
fi
# Here starts the actual work to be performed for the package under test;
# any command which exits with a non-zero exit code causes the build to fail.
script:
- if [ -f configure.ac ]; then autoreconf -i; fi
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
- cabal build # this builds all libraries and executables (including tests/benchmarks)
- cabal test
# - cabal check # complains about -Werror even though it is
# hidden behind a manual flag with default false
- cabal sdist # tests that a source-distribution can be generated
# Check that the resulting source distribution can be built & installed.
# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
# `cabal install --force-reinstalls dist/*-*.tar.gz`
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
# EOF

View File

@@ -1,49 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Accordion
-- Copyright : (c) glasser@mit.edu
-- License : BSD
--
-- Maintainer : glasser@mit.edu
-- Stability : unstable
-- Portability : unportable
--
-- Layout that puts non-focused windows in ribbons at the top and bottom
-- of the screen.
-----------------------------------------------------------------------------
module XMonadContrib.Accordion (
-- * Usage
-- $usage
accordion) where
import XMonad
import Operations
import qualified StackSet as W
import Graphics.X11.Xlib
import Data.Ratio
import XMonadContrib.LayoutHelpers ( idModify )
-- $usage
-- > import XMonadContrib.Accordion
-- > defaultLayouts = [ accordion ]
accordion :: Eq a => Layout a
accordion = Layout { doLayout = accordionLayout, modifyLayout = idModify }
accordionLayout :: Eq a => Rectangle -> W.Stack a -> X ([(a, Rectangle)], Maybe (Layout a))
accordionLayout sc ws = return ((zip ups tops) ++
[(W.focus ws, mainPane)] ++
(zip dns bottoms)
,Nothing)
where ups = W.up ws
dns = W.down ws
(top, allButTop) = splitVerticallyBy (1%8) sc
(center, bottom) = splitVerticallyBy (6%7) allButTop
(allButBottom, _) = splitVerticallyBy (7%8) sc
mainPane | ups /= [] && dns /= [] = center
| ups /= [] = allButTop
| dns /= [] = allButBottom
| otherwise = sc
tops = if ups /= [] then splitVertically (length ups) top else []
bottoms= if dns /= [] then splitVertically (length dns) bottom else []

View File

@@ -1,87 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Anneal
-- Copyright : (c) David Roundy
-- License : BSD-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.org>
-- Stability : unstable
-- Portability : unportable
--
--
-----------------------------------------------------------------------------
module XMonadContrib.Anneal ( Rated(Rated), the_value, the_rating
, anneal, annealMax ) where
import System.Random ( StdGen, Random, mkStdGen, randomR )
import Control.Monad.State ( State, runState, put, get, gets, modify )
data Rated a b = Rated !a !b
deriving ( Show )
instance Functor (Rated a) where
f `fmap` (Rated v a) = Rated v (f a)
the_value :: Rated a b -> b
the_value (Rated _ b) = b
the_rating :: Rated a b -> a
the_rating (Rated a _) = a
instance Eq a => Eq (Rated a b) where
(Rated a _) == (Rated a' _) = a == a'
instance Ord a => Ord (Rated a b) where
compare (Rated a _) (Rated a' _) = compare a a'
anneal :: a -> (a -> Double) -> (a -> [a]) -> Rated Double a
anneal st r sel = runAnneal st r (do_anneal sel)
annealMax :: a -> (a -> Double) -> (a -> [a]) -> Rated Double a
annealMax st r sel = runAnneal st (negate . r) (do_anneal sel)
do_anneal :: (a -> [a]) -> State (Anneal a) (Rated Double a)
do_anneal sel = do sequence_ $ replicate 100 da
gets best
where da = do select_metropolis sel
modify $ \s -> s { temperature = temperature s *0.99 }
data Anneal a = A { g :: StdGen
, best :: Rated Double a
, current :: Rated Double a
, rate :: a -> Rated Double a
, temperature :: Double }
runAnneal :: a -> (a -> Double) -> State (Anneal a) b -> b
runAnneal start r x = fst $ runState x (A { g = mkStdGen 137
, best = Rated (r start) start
, current = Rated (r start) start
, rate = \xx -> Rated (r xx) xx
, temperature = 1.0 })
select_metropolis :: (a -> [a]) -> State (Anneal a) ()
select_metropolis x = do c <- gets current
a <- select $ x $ the_value c
metropolis a
metropolis :: a -> State (Anneal a) ()
metropolis x = do r <- gets rate
c <- gets current
t <- gets temperature
let rx = r x
boltz = exp $ (the_rating c - the_rating rx) / t
if rx < c then do modify $ \s -> s { current = rx, best = rx }
else do p <- getOne (0,1)
if p < boltz
then modify $ \s -> s { current = rx }
else return ()
select :: [a] -> State (Anneal a) a
select [] = the_value `fmap` gets best
select [x] = return x
select xs = do n <- getOne (0,length xs - 1)
return (xs !! n)
getOne :: (Random a) => (a,a) -> State (Anneal x) a
getOne bounds = do s <- get
(x,g') <- return $ randomR bounds (g s)
put $ s { g = g' }
return x

651
CHANGES.md Normal file
View File

@@ -0,0 +1,651 @@
# Change Log / Release Notes
## 0.14
### Breaking Changes
* `XMonad.Layout.Spacing`
Rewrite `XMonad.Layout.Spacing`. Borders are no longer uniform but composed
of four sides each with its own border width. The screen and window borders
are now separate and can be independently toggled on/off. The screen border
examines the window/rectangle list resulting from 'runLayout' rather than
the stack, which makes it compatible with layouts such as the builtin
`Full`. The child layout will always be called with the screen border. If
only a single window is displayed (and `smartBorder` enabled), it will be
expanded into the original layout rectangle. Windows that are displayed but
not part of the stack, such as those created by 'XMonad.Layout.Decoration',
will be shifted out of the way, but not scaled (not possible for windows
created by XMonad). This isn't perfect, so you might want to disable
`Spacing` on such layouts.
* `XMonad.Util.SpawnOnce`
- Added `spawnOnOnce`, `spawnNOnOnce` and `spawnAndDoOnce`. These are useful in startup hooks
to shift spawned windows to a specific workspace.
* Adding handling of modifySpacing message in smartSpacing and smartSpacingWithEdge layout modifier
* `XMonad.Actions.GridSelect`
- Added field `gs_bordercolor` to `GSConfig` to specify border color.
* `XMonad.Layout.Minimize`
Though the interface it offers is quite similar, this module has been
almost completely rewritten. The new `XMonad.Actions.Minimize` contains
several functions that allow interaction with minimization window state.
If you are using this module, you must upgrade your configuration to import
`X.A.Minimize` and use `maximizeWindow` and `withLastMinimized` instead of
sending messages to `Minimized` layout. `XMonad.Hooks.RestoreMinimized` has
been completely deprecated, and its functions have no effect.
* `XMonad.Prompt.Unicode`
- `unicodePrompt :: String -> XPConfig -> X ()` now additionally takes a
filepath to the `UnicodeData.txt` file containing unicode data.
* `XMonad.Actions.PhysicalScreens`
`getScreen`, `viewScreen`, `sendToScreen`, `onNextNeighbour`, `onPrevNeighbour` now need a extra parameter
of type `ScreenComparator`. This allow the user to specify how he want his screen to be ordered default
value are:
- `def`(same as verticalScreenOrderer) will keep previous behavior
- `verticalScreenOrderer`
- `horizontalScreenOrderer`
One can build his custom ScreenOrderer using:
- `screenComparatorById` (allow to order by Xinerama id)
- `screenComparatorByRectangle` (allow to order by screen coordonate)
- `ScreenComparator` (allow to mix ordering by screen coordonate and xinerama id)
* `XMonad.Util.WorkspaceCompare`
`getXineramaPhysicalWsCompare` now need a extra argument of type `ScreenComparator` defined in
`XMonad.Actions.PhysicalScreens` (see changelog of this module for more information)
* `XMonad.Hooks.EwmhDesktops`
- Simplify ewmhDesktopsLogHookCustom, and remove the gnome-panel specific
remapping of all visible windows to the active workspace (#216).
- Handle workspace renames that might be occuring in the custom function
that is provided to ewmhDesktopsLogHookCustom.
* `XMonad.Hooks.DynamicLog`
- Support xmobar's \<action> and \<raw> tags; see `xmobarAction` and
`xmobarRaw`.
* `XMonad.Layout.NoBorders`
The layout now maintains a list of windows that never have borders, and a
list of windows that always have borders. Use `BorderMessage` to manage
these lists and the accompanying event hook (`borderEventHook`) to remove
destroyed windows from them. Also provides the `hasBorder` manage hook.
Two new conditions have been added to `Ambiguity`: `OnlyLayoutFloat` and
`OnlyLayoutFloatBelow`; `OnlyFloat` was renamed to `OnlyScreenFloat`. See
the documentation for more information.
The type signature of `hiddens` was changed to accept a new `Rectangle`
parameter representing the bounds of the parent layout, placed after the
`WindowSet` parameter. Anyone defining a new instance of `SetsAmbiguous`
will need to update their configuration. For example, replace "`hiddens amb
wset mst wrs =`" either with "`hiddens amb wset _ mst wrs =`" or to make
use of the new parameter with "`hiddens amb wset lr mst wrs =`".
* `XMonad.Actions.MessageFeedback`
- Follow the naming conventions of `XMonad.Operations`. Functions returning
`X ()` are named regularly (previously these ended in underscore) while
those returning `X Bool` are suffixed with an uppercase 'B'.
- Provide all `X Bool` and `SomeMessage` variations for `sendMessage` and
`sendMessageWithNoRefresh`, not just `sendMessageWithNoRefreshToCurrent`
(renamed from `send`).
- The new `tryInOrderB` and `tryMessageB` functions accept a parameter of
type `SomeMessage -> X Bool`, which means you are no longer constrained
to the behavior of the `sendMessageWithNoRefreshToCurrent` dispatcher.
- The `send*Messages*` family of funtions allows for sequencing arbitrary
sets of messages with minimal refresh. It makes little sense for these
functions to support custom message dispatchers.
- Remain backwards compatible. Maintain deprecated aliases of all renamed
functions:
- `send` -> `sendMessageWithNoRefreshToCurrentB`
- `sendSM` -> `sendSomeMessageWithNoRefreshToCurrentB`
- `sendSM_` -> `sendSomeMessageWithNoRefreshToCurrent`
- `tryInOrder` -> `tryInOrderWithNoRefreshToCurrentB`
- `tryInOrder_` -> `tryInOrderWithNoRefreshToCurrent`
- `tryMessage` -> `tryMessageWithNoRefreshToCurrentB`
- `tryMessage_` -> `tryMessageWithNoRefreshToCurrent`
### New Modules
* `XMonad.Layout.MultiToggle.TabBarDecoration`
Provides a simple transformer for use with `XMonad.Layout.MultiToggle` to
dynamically toggle `XMonad.Layout.TabBarDecoration`.
* `XMonad.Layout.StateFull`
Provides `StateFull`: a stateful form of `Full` that does not misbehave when
floats are focused, and the `FocusTracking` layout transformer by means of
which `StateFull` is implemented. `FocusTracking` simply holds onto the last
true focus it was given and continues to use it as the focus for the
transformed layout until it sees another. It can be used to improve the
behaviour of a child layout that has not been given the focused window.
* `XMonad.Actions.SwapPromote`
Module for tracking master window history per workspace, and associated
functions for manipulating the stack using such history.
* `XMonad.Actions.CycleWorkspaceByScreen`
A new module that allows cycling through previously viewed workspaces in the
order they were viewed most recently on the screen where cycling is taking
place.
Also provides the `repeatableAction` helper function which can be used to
build actions that can be repeated while a modifier key is held down.
* `XMonad.Prompt.FuzzyMatch`
Provides a predicate `fuzzyMatch` that is much more lenient in matching
completions in `XMonad.Prompt` than the default prefix match. Also provides
a function `fuzzySort` that allows sorting the fuzzy matches by "how well"
they match.
* `XMonad.Utils.SessionStart`
A new module that allows to query if this is the first time xmonad is
started of the session, or a xmonad restart.
Currently needs manual setting of the session start flag. This could be
automated when this moves to the core repository.
* `XMonad.Layout.MultiDishes`
A new layout based on Dishes, however it accepts additional configuration
to allow multiple windows within a single stack.
* `XMonad.Util.Rectangle`
A new module for handling pixel rectangles.
* `XMonad.Layout.BinaryColumn`
A new module which provides a simple grid layout, halving the window
sizes of each window after master.
This is similar to Column, but splits the window in a way
that maintains window sizes upon adding & removing windows as well as the
option to specify a minimum window size.
### Bug Fixes and Minor Changes
* `XMonad.Layout.Grid`
Fix as per issue #223; Grid will no longer calculate more columns than there
are windows.
* `XMonad.Hooks.FadeWindows`
Added support for GHC version 8.4.x by adding a Semigroup instance for
Monoids
* `XMonad.Hooks.WallpaperSetter`
Added support for GHC version 8.4.x by adding a Semigroup instance for
Monoids
* `XMonad.Hooks.Mosaic`
Added support for GHC version 8.4.x by adding a Semigroup instance for
Monoids
* `XMonad.Actions.Navigation2D`
Added `sideNavigation` and a parameterised variant, providing a navigation
strategy with fewer quirks for tiled layouts using X.L.Spacing.
* `XMonad.Layout.Fullscreen`
The fullscreen layouts will now not render any window that is totally
obscured by fullscreen windows.
* `XMonad.Layout.Gaps`
Extended the sendMessage interface with `ModifyGaps` to allow arbitrary
modifications to the `GapSpec`.
* `XMonad.Layout.Groups`
Added a new `ModifyX` message type that allows the modifying
function to return values in the `X` monad.
* `XMonad.Actions.Navigation2D`
Generalised (and hence deprecated) hybridNavigation to hybridOf.
* `XMonad.Layout.LayoutHints`
Preserve the window order of the modified layout, except for the focused
window that is placed on top. This fixes an issue where the border of the
focused window in certain situations could be rendered below borders of
unfocused windows. It also has a lower risk of interfering with the
modified layout.
* `XMonad.Layout.MultiColumns`
The focused window is placed above the other windows if they would be made to
overlap due to a layout modifier. (As long as it preserves the window order.)
* `XMonad.Actions.GridSelect`
- The vertical centring of text in each cell has been improved.
* `XMonad.Actions.SpawnOn`
- Bind windows spawns by child processes of the original window to the same
workspace as the original window.
* `XMonad.Util.WindowProperties`
- Added the ability to test if a window has a tag from
`XMonad.Actions.TagWindows`
* `XMonad.Layout.Magnifier`
- Handle `IncMasterN` messages.
* `XMonad.Util.EZConfig`
- Can now parse Latin1 keys, to better accommodate users with
non-US keyboards.
* `XMonad.Actions.Submap`
Establish pointer grab to avoid freezing X, when button press occurs after
submap key press. And terminate submap at button press in the same way,
as we do for wrong key press.
* `XMonad.Hooks.SetWMName`
Add function `getWMName`.
* `XMonad.Hooks.ManageHelpers`
Make type of ManageHook combinators more general.
* `XMonad.Prompt`
Export `insertString`.
* `XMonad.Prompt.Window`
- New function: `windowMultiPrompt` for using `mkXPromptWithModes`
with window prompts.
* `XMonad.Hooks.WorkspaceHistory`
- Now supports per screen history.
* `XMonad.Layout.ComboP`
- New `PartitionWins` message to re-partition all windows into the
configured sub-layouts. Useful when window properties have
changed and you want to re-sort windows into the appropriate
sub-layout.
* `XMonad.Actions.Minimize`
- Now has `withFirstMinimized` and `withFirstMinimized'` so you can perform
actions with both the last and first minimized windows easily.
* `XMonad.Config.Gnome`
- Update logout key combination (modm+shift+Q) to work with modern
* `XMonad.Prompt.Pass`
- New function `passTypePrompt` which uses `xdotool` to type in a password
from the store, bypassing the clipboard.
- Now handles password labels with spaces and special characters inside
them.
* `XMonad.Prompt.Unicode`
- Persist unicode data cache across XMonad instances due to
`ExtensibleState` now used instead of `unsafePerformIO`.
- `typeUnicodePrompt :: String -> XPConfig -> X ()` provided to insert the
Unicode character via `xdotool` instead of copying it to the paste buffer.
- `mkUnicodePrompt :: String -> [String] -> String -> XPConfig -> X ()`
acts as a generic function to pass the selected Unicode character to any
program.
* `XMonad.Prompt.AppendFile`
- New function `appendFilePrompt'` which allows for transformation of the
string passed by a user before writing to a file.
* `XMonad.Hooks.DynamicLog`
- Added a new function `dzenWithFlags` which allows specifying the arguments
passed to `dzen2` invocation. The behaviour of current `dzen` function is
unchanged.
* `XMonad.Util.Dzen`
- Now provides functions `fgColor` and `bgColor` to specify foreground and
background color, `align` and `slaveAlign` to set text alignment, and
`lineCount` to enable a second (slave) window that displays lines beyond
the initial (title) one.
* `XMonad.Hooks.DynamicLog`
- Added optional `ppVisibleNoWindows` to differentiate between empty
and non-empty visible workspaces in pretty printing.
* `XMonad.Actions.DynamicWorkspaceOrder`
- Added `updateName` and `removeName` to better control ordering when
workspace names are changed or workspaces are removed.
* `XMonad.Config.Azerty`
* Added `belgianConfig` and `belgianKeys` to support Belgian AZERTY
keyboards, which are slightly different from the French ones in the top
row.
## 0.13 (February 10, 2017)
### Breaking Changes
* The type of `completionKey` (of `XPConfig` record) has been
changed from `KeySym` to `(KeyMask, KeySym)`. The default value
for this is still bound to the `Tab` key.
* New constructor `CenteredAt Rational Rational` added for
`XMonad.Prompt.XPPosition`.
* `XMonad.Prompt` now stores its history file in the XMonad cache
directory in a file named `prompt-history`.
### New Modules
* `XMonad.Layout.SortedLayout`
A new LayoutModifier that sorts a given layout by a list of
properties. The order of properties in the list determines
the order of windows in the final layout. Any unmatched windows
go to the end of the order.
* `XMonad.Prompt.Unicode`
A prompt to search a unicode character by its name, and put it into the
clipboard.
* `XMonad.Util.Ungrab`
Release xmonad's keyboard and pointer grabs immediately, so
screen grabbers and lock utilities, etc. will work. Replaces
the short sleep hackaround.
* `XMonad.Util.Loggers.NamedScratchpad`
A collection of Loggers (see `XMonad.Util.Loggers`) for NamedScratchpads
(see `XMonad.Util.NamedScratchpad`).
* `XMonad.Util.NoTaskbar`
Utility function and `ManageHook` to mark a window to be ignored by
EWMH taskbars and pagers. Useful for `NamedScratchpad` windows, since
you will usually be taken to the `NSP` workspace by them.
### Bug Fixes and Minor Changes
* `XMonad.Hooks.ManageDocks`,
- Fix a very annoying bug where taskbars/docs would be
covered by windows.
- Also fix a bug that caused certain Gtk and Qt application to
have issues displaying menus and popups.
* `XMonad.Layout.LayoutBuilder`
Merge all functionality from `XMonad.Layout.LayoutBuilderP` into
`XMonad.Layout.LayoutBuilder`.
* `XMonad.Actions.WindowGo`
- Fix `raiseNextMaybe` cycling between 2 workspaces only.
* `XMonad.Actions.UpdatePointer`
- Fix bug when cursor gets stuck in one of the corners.
* `XMonad.Actions.DynamicProjects`
- Switching away from a dynamic project that contains no windows
automatically deletes that project's workspace.
The project itself was already being deleted, this just deletes
the workspace created for it as well.
- Added function to change the working directory (`changeProjectDirPrompt`)
- All of the prompts are now multiple mode prompts. Try using the
`changeModeKey` in a prompt and see what happens!
## 0.12 (December 14, 2015)
### Breaking Changes
* `XMonad.Actions.UpdatePointer.updatePointer` arguments were
changed. This allows including aspects of both of the
`TowardsCentre` and `Relative` methods. To keep the same behavior,
replace the entry in the left column with the entry on the right:
| < 0.12 | >= 0.12 |
|-------------------------------------|----------------------------------|
| `updatePointer Nearest` | `updatePointer (0.5, 0.5) (1,1)` |
| `updatePointer (Relative x y)` | `updatePointer (x,y) (0,0)` |
| `updatePointer (TowardsCentre x y)` | `updatePointer (0.5,0.5) (x,y)` |
### New Modules
* `XMonad.Actions.AfterDrag`
Perform an action after the current mouse drag is completed.
* `XMonad.Actions.DynamicProjects`
Imbues workspaces with additional features so they can be treated
as individual project areas.
* `XMonad.Actions.LinkWorkspaces`
Provides bindings to add and delete links between workspaces. It
is aimed at providing useful links between workspaces in a
multihead setup. Linked workspaces are viewed at the same time.
* `XMonad.Config.Bepo`
This module fixes some of the keybindings for the francophone
among you who use a BEPO keyboard layout. Based on
`XMonad.Config.Azerty`
* `XMonad.Config.Dmwit`
Daniel Wagner's configuration.
* `XMonad.Config.Mate`
This module provides a config suitable for use with the MATE
desktop environment.
* `XMonad.Config.Prime`
A draft of a brand new config syntax for xmonad.
* `XMonad.Hooks.DynamicProperty`
Module to apply a `ManageHook` to an already-mapped window when a
property changes. This would commonly be used to match browser
windows by title, since the final title will only be set after (a)
the window is mapped, (b) its document has been loaded, (c) all
load-time scripts have run.
* `XMonad.Hooks.ManageDebug`
A `manageHook` and associated `logHook` for debugging `ManageHook`s.
Simplest usage: wrap your xmonad config in the `debugManageHook`
combinator. Or use `debugManageHookOn` for a triggerable version,
specifying the triggering key sequence in `XMonad.Util.EZConfig`
syntax. Or use the individual hooks in whatever way you see fit.
* `XMonad.Hooks.WallpaperSetter`
Log hook which changes the wallpapers depending on visible
workspaces.
* `XMonad.Hooks.WorkspaceHistory`
Keeps track of workspace viewing order.
* `XMonad.Layout.AvoidFloats`
Find a maximum empty rectangle around floating windows and use
that area to display non-floating windows.
* `XMonad.Layout.BinarySpacePartition`
Layout where new windows will split the focused window in half,
based off of BSPWM.
* `XMonad.Layout.Dwindle`
Three layouts: The first, `Spiral`, is a reimplementation of
`XMonad.Layout.Spiral.spiral` with, at least to me, more intuitive
semantics. The second, `Dwindle`, is inspired by a similar layout
in awesome and produces the same sequence of decreasing window
sizes as Spiral but pushes the smallest windows into a screen
corner rather than the centre. The third, `Squeeze` arranges all
windows in one row or in one column, with geometrically decreasing
sizes.
* `XMonad.Layout.Hidden`
Similar to `XMonad.Layout.Minimize` but completely removes windows
from the window set so `XMonad.Layout.BoringWindows` isn't
necessary. Perfect companion to `XMonad.Layout.BinarySpacePartition`
since it can be used to move windows to another part of the BSP tree.
* `XMonad.Layout.IfMax`
Provides `IfMax` layout, which will run one layout if there are
maximum `N` windows on workspace, and another layout, when number
of windows is greater than `N`.
* `XMonad.Layout.PerScreen`
Configure layouts based on the width of your screen; use your
favorite multi-column layout for wide screens and a full-screen
layout for small ones.
* `XMonad.Layout.Stoppable`
This module implements a special kind of layout modifier, which when
applied to a layout, causes xmonad to stop all non-visible processes.
In a way, this is a sledge-hammer for applications that drain power.
For example, given a web browser on a stoppable workspace, once the
workspace is hidden the web browser will be stopped.
* `XMonad.Prompt.ConfirmPrompt`
A module for setting up simple confirmation prompts for
keybindings.
* `XMonad.Prompt.Pass`
This module provides 3 `XMonad.Prompt`s to ease passwords
manipulation (generate, read, remove) via [pass][].
* `XMonad.Util.RemoteWindows`
This module implements a proper way of finding out whether the
window is remote or local.
* `XMonad.Util.SpawnNamedPipe`
A module for spawning a pipe whose `Handle` lives in the xmonad state.
* `XMonad.Util.WindowState`
Functions for saving per-window data.
### Miscellaneous Changes
* Fix issue #9: `XMonad.Prompt.Shell` `searchPredicate` is ignored,
defaults to `isPrefixOf`
* Fix moveHistory when alwaysHighlight is enabled
* `XMonad.Actions.DynamicWorkspaceGroups` now exports `addRawWSGroup`
* Side tabs were added to the tabbed layout
* `XMonad/Layout/IndependentScreens` now exports `marshallSort`
* `XMonad/Hooks/UrgencyHook` now exports `clearUrgency`
* Exceptions are now caught when finding commands on `PATH` in `Prompt.Shell`
* Switched to `Data.Default` wherever possible
* `XMonad.Layout.IndependentScreens` now exports `whenCurrentOn`
* `XMonad.Util.NamedActions` now exports `addDescrKeys'`
* EWMH `DEMANDS_ATTENTION` support added to `UrgencyHook`
* New `useTransientFor` modifier in `XMonad.Layout.TrackFloating`
* Added the ability to remove arbitrary workspaces
## 0.9 (October 26, 2009)
### Updates that Require Changes in `xmonad.hs`
* `XMonad.Hooks.EwmhDesktops` no longer uses `layoutHook`, the
`ewmhDesktopsLayout` modifier has been removed from
xmonad-contrib. It uses `logHook`, `handleEventHook`, and
`startupHook` instead and provides a convenient function `ewmh` to
add EWMH support to a `defaultConfig`.
* Most `DynamicLog` users can continue with configs unchanged, but
users of the quickbar functions `xmobar` or `dzen` will need to
change `xmonad.hs`: their types have changed to allow easier
composition with other `XConfig` modifiers. The `dynamicLogDzen`
and `dynamicLogXmobar` functions have been removed.
* `WindowGo` or `safeSpawn` users may need to change command lines
due to `safeSpawn` changes.
* People explicitly referencing the "SP" scratchpad workspace should
change it to "NSP" which is also used by the new
`Util.NamedScratchpad` module.
* (Optional) People who explicitly use `swapMaster` in key or mouse
bindings should change it to `shiftMaster`. It's the current
default used where `swapMaster` had been used previously. It works
better than `swapMaster` when using floating and tiled windows
together on the same workspace.
## See Also
<https://wiki.haskell.org/Xmonad/Notable_changes_since_0.8>
[pass]: http://www.passwordstore.org/

View File

@@ -1,74 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Combo
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- A layout that combines multiple layouts.
--
-----------------------------------------------------------------------------
module XMonadContrib.Combo (
-- * Usage
-- $usage
combo
) where
import Control.Arrow ( first )
import Data.Maybe ( isJust )
import XMonad
import StackSet ( integrate, differentiate )
-- $usage
--
-- To use this layout write, in your Config.hs:
--
-- > import XMonadContrib.Combo
-- > import XMonadContrib.SimpleStacking
--
-- and add something like
--
-- > simpleStacking $ combo (twoPane 0.03 0.5) [(full,1),(tabbed shrinkText,1)]
--
-- to your defaultLayouts.
--
-- The first argument to combo is a Layout that will divide the screen into
-- one or more subscreens. The second argument is a list of layouts which
-- will be used to lay out the contents of each of those subscreents.
-- Paired with each of these layouts is an integer giving the number of
-- windows this section should hold. This number is ignored for the last
-- layout, which will hold any excess windows.
combo :: Layout (Layout a, Int) -> [(Layout a, Int)] -> Layout a
combo super origls = Layout { doLayout = \r s -> arrange r (integrate s), modifyLayout = message }
where arrange _ [] = return ([], Nothing)
arrange r [w] = return ([(w,r)], Nothing)
arrange rinput origws =
do (lrs, msuper') <- runLayout super rinput (differentiate $ take (length origws) origls)
let super' = maybe super id msuper'
lwrs [] _ = []
lwrs [((l,_),r)] ws = [((l,r),differentiate ws)]
lwrs (((l,n),r):xs) ws = ((l,r),differentiate $ take len1 ws) : lwrs xs (drop len1 ws)
where len1 = min n (length ws - length xs)
out <- mapM (uncurry $ uncurry runLayout) $ lwrs lrs origws
let origls' = zipWith foo (out++repeat ([],Nothing)) origls
foo (_, Nothing) x = x
foo (_, Just l') (_, n) = (l', n)
return (concat $ map fst out, Just $ combo super' origls')
message m = do mls <- broadcastPrivate m (map fst origls)
let mls' = (\x->zipWith first (map const x) origls) `fmap` mls
msuper <- broadcastPrivate m [super]
case msuper of
Just [super'] -> return $ Just $ combo super' $ maybe origls id mls'
_ -> return $ combo super `fmap` mls'
broadcastPrivate :: SomeMessage -> [Layout b] -> X (Maybe [Layout b])
broadcastPrivate a ol = do nml <- mapM f ol
if any isJust nml
then return $ Just $ zipWith ((flip maybe) id) ol nml
else return Nothing
where f l = modifyLayout l a `catchX` return Nothing

View File

@@ -1,101 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Commands
-- Copyright : (c) David Glasser 2007
-- License : BSD3
--
-- Maintainer : glasser@mit.edu
-- Stability : stable
-- Portability : portable
--
-- Allows you to run internal xmonad commands (X () actions) using
-- a dmenu menu in addition to key bindings. Requires dmenu and
-- the Dmenu XMonadContrib module.
--
-----------------------------------------------------------------------------
module XMonadContrib.Commands (
-- * Usage
-- $usage
commandMap,
runCommand,
runCommand',
workspaceCommands,
screenCommands,
defaultCommands
) where
import XMonad
import Operations
import XMonadContrib.Dmenu (dmenu)
import {-# SOURCE #-} Config (workspaces)
import qualified Data.Map as M
import System.Exit
import Data.Maybe
-- $usage
--
-- To use, modify your Config.hs to:
--
-- > import XMonadContrib.Commands
--
-- and add a keybinding to the runCommand action:
--
-- > , ((modMask .|. controlMask, xK_y), runCommand)
--
-- and define the list commands:
--
-- > commands :: [(String, X ())]
-- > commands = defaultCommands
--
-- A popup menu of internal xmonad commands will appear. You can
-- change the commands by changing the contents of the list
-- 'commands'. (If you like it enough, you may even want to get rid
-- of many of your other key bindings!)
commandMap :: [(String, X ())] -> M.Map String (X ())
commandMap c = M.fromList c
workspaceCommands :: [(String, X ())]
workspaceCommands = [((m ++ show i), f i)
| i <- workspaces
, (f, m) <- [(view, "view"), (shift, "shift")]
]
screenCommands :: [(String, X ())]
screenCommands = [((m ++ show sc), screenWorkspace (fromIntegral sc) >>= flip whenJust f)
| sc <- [0, 1]::[Int] -- TODO: adapt to screen changes
, (f, m) <- [(view, "screen"), (shift, "screen-to-")]
]
defaultCommands :: [(String, X ())]
defaultCommands = workspaceCommands ++ screenCommands
++ [ ("shrink", sendMessage Shrink)
, ("expand", sendMessage Expand)
, ("restart-wm", restart Nothing True)
, ("restart-wm-no-resume", restart Nothing False)
, ("layout", switchLayout)
, ("xterm", spawn "xterm")
, ("run", spawn "exe=`dmenu_path | dmenu -b` && exec $exe")
, ("kill", kill)
, ("refresh", refresh)
, ("focus-up", focusUp)
, ("focus-down", focusDown)
, ("swap-up", swapUp)
, ("swap-down", swapDown)
, ("swap-master", swapMaster)
, ("sink", withFocused sink)
, ("quit-wm", io $ exitWith ExitSuccess)
]
runCommand :: [(String, X ())] -> X ()
runCommand cl = do
let m = commandMap cl
choice <- dmenu (M.keys m)
fromMaybe (return ()) (M.lookup choice m)
runCommand' :: String -> X ()
runCommand' c = do
let m = commandMap defaultCommands
fromMaybe (return ()) (M.lookup c m)

View File

@@ -1,89 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.CopyWindow
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- Provides a binding to duplicate a window on multiple workspaces,
-- providing dwm-like tagging functionality.
--
-----------------------------------------------------------------------------
module XMonadContrib.CopyWindow (
-- * Usage
-- $usage
copy, kill1
) where
import Prelude hiding ( filter )
import Control.Monad.State ( gets )
import qualified Data.List as L
import XMonad
import Operations ( windows, kill )
import StackSet
-- $usage
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.CopyWindow
--
-- > -- mod-[1..9] @@ Switch to workspace N
-- > -- mod-shift-[1..9] @@ Move client to workspace N
-- > -- mod-control-shift-[1..9] @@ Copy client to workspace N
-- > [((m .|. modMask, k), f i)
-- > | (i, k) <- zip workspaces [xK_1 ..]
-- > , (f, m) <- [(view, 0), (shift, shiftMask), (copy, shiftMask .|. controlMask)]]
--
-- you may also wish to redefine the binding to kill a window so it only
-- removes it from the current workspace, if it's present elsewhere:
--
-- > , ((modMask .|. shiftMask, xK_c ), kill1) -- @@ Close the focused window
-- | copy. Copy a window to a new workspace.
copy :: WorkspaceId -> X ()
copy n = windows (copy' n)
copy' :: (Ord a, Eq s, Eq i) => i -> StackSet i a s sd -> StackSet i a s sd
copy' n s = if n `tagMember` s && n /= tag (workspace (current s))
then maybe s go (peek s)
else s
where go w = view (tag (workspace (current s))) $ insertUp' w $ view n s
-- |
-- /O(n)/. (Complexity due to check if element is in current stack.) Insert
-- a new element into the stack, above the currently focused element.
--
-- The new element is given focus, and is set as the master window.
-- The previously focused element is moved down. The previously
-- 'master' element is forgotten. (Thus, 'insert' will cause a retiling).
--
-- If the element is already in the current stack, it is shifted to the
-- focus position, as if it had been removed and then added.
--
-- Semantics in Huet's paper is that insert doesn't move the cursor.
-- However, we choose to insert above, and move the focus.
insertUp' :: Eq a => a -> StackSet i a s sd -> StackSet i a s sd
insertUp' a s = modify (Just $ Stack a [] [])
(\(Stack t l r) -> Just $ Stack a (L.delete a l) (L.delete a (t:r))) s
delete' :: Ord a => a -> StackSet i a s sd -> StackSet i a s sd
delete' w = sink w . modify Nothing (filter (/= w))
-- | Remove the focussed window from this workspace. If it's present in no
-- other workspace, then kill it instead. If we do kill it, we'll get a
-- delete notify back from X.
--
-- There are two ways to delete a window. Either just kill it, or if it
-- supports the delete protocol, send a delete event (e.g. firefox)
--
kill1 :: X ()
kill1 = do ss <- gets windowset
whenJust (peek ss) $ \w -> if member w $ delete' w ss
then windows $ delete' w
else kill

View File

@@ -1,56 +0,0 @@
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.DeManage
-- Copyright : (c) Spencer Janssen <sjanssen@cse.unl.edu>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Spencer Janssen <sjanssen@cse.unl.edu>
-- Stability : unstable
-- Portability : unportable
--
-- This module provides a method to cease management of a window, without
-- unmapping it. This is especially useful for applications like kicker and
-- gnome-panel.
--
-- To make a panel display correctly with xmonad:
--
-- * Determine the pixel size of the panel, add that value to defaultGaps
--
-- * Launch the panel
--
-- * Give the panel window focus, then press mod-d
--
-- * Convince the panel to move\/resize to the correct location. Changing the
-- panel's position setting several times seems to work.
--
-----------------------------------------------------------------------------
module XMonadContrib.DeManage (
-- * Usage
-- $usage
demanage
) where
import qualified StackSet as W
import XMonad
import Operations
import Control.Monad.State
import Graphics.X11 (Window)
-- $usage
-- To use demanage, add this import:
--
-- > import XMonadContrib.DeManage
--
-- And add a keybinding to it:
--
-- > , ((modMask, xK_d ), withFocused demanage)
--
-- | Stop managing the current focused window.
demanage :: Window -> X ()
demanage w = do
-- use modify to defeat automatic 'unmanage' calls.
modify (\s -> s { windowset = W.delete w (windowset s) })
refresh

View File

@@ -1,74 +0,0 @@
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Decoration
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- A module to be used to easily define decorations.
--
-----------------------------------------------------------------------------
module XMonadContrib.Decoration (
-- * Usage
-- $usage
newDecoration
) where
import Data.Bits ( (.|.) )
import Control.Monad.Reader ( asks )
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras ( Event(AnyEvent,ButtonEvent), ev_subwindow, ev_event_type, ev_window )
import XMonadContrib.LayoutHelpers ( ModLay, layoutModify, idModDo )
import XMonad
import Operations ( UnDoLayout(UnDoLayout) )
-- $usage
-- You can use this module for writing other extensions.
-- See, for instance, "XMonadContrib.Tabbed"
newDecoration :: Window -> Rectangle -> Int -> Pixel -> Pixel -> String
-> (Display -> Window -> GC -> FontStruct -> X ())
-> X () -> Layout a -> X (Layout a)
newDecoration decfor (Rectangle x y w h) th fg bg fn draw click l = do
d <- asks display
rt <- asks theRoot
win <- io $ createSimpleWindow d rt x y w h (fromIntegral th) fg bg
io $ selectInput d win $ exposureMask .|. buttonPressMask
io $ mapWindow d win
io $ restackWindows d $ decfor : [win]
let hook :: SomeMessage -> X (Maybe (ModLay a))
hook sm | Just e <- fromMessage sm = handle_event e >> return Nothing
| Just UnDoLayout == fromMessage sm = io (destroyWindow d win) >> return (Just id)
| otherwise = return Nothing
handle_event (ButtonEvent {ev_subwindow = thisw,ev_event_type = t})
| t == buttonPress && thisw == win = click
handle_event (ButtonEvent {ev_window = thisw,ev_event_type = t})
| t == buttonPress && thisw == win = click
handle_event (AnyEvent {ev_window = thisw, ev_event_type = t})
| thisw == win && t == expose = withGC win fn draw
| thisw == decfor && t == propertyNotify = withGC win fn draw
handle_event _ = return ()
return $ layoutModify idModDo hook l
-- FIXME: withGC should use bracket (but can't, unless draw is an IO thing)
withGC :: Drawable -> String -> (Display -> Drawable -> GC -> FontStruct -> X ()) -> X ()
withGC w fn f = withDisplay $ \d -> do gc <- io $ createGC d w
let fontname = if fn == ""
then "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
else fn
font <- io $ catch (loadQueryFont d fontname)
(const $ loadQueryFont d "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*")
io $ setFont d gc (fontFromFontStruct font)
f d w gc font
io $ freeGC d gc
io $ freeFont d font

View File

@@ -1,42 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.DirectoryPrompt
-- Copyright : (C) 2007 Andrea Rossato, David Roundy
-- License : BSD3
--
-- Maintainer : droundy@darcs.net
-- Stability : unstable
-- Portability : unportable
--
-- A directory prompt for XMonad
--
-----------------------------------------------------------------------------
module XMonadContrib.DirectoryPrompt (
-- * Usage
-- $usage
directoryPrompt
) where
import XMonad
import XMonadContrib.XPrompt
import XMonadContrib.Dmenu ( runProcessWithInput )
-- $usage
-- For an example usage see "XMonadContrib.WorkspaceDir"
data Dir = Dir String
instance XPrompt Dir where
showXPrompt (Dir x) = x
directoryPrompt :: XPConfig -> String -> (String -> X ()) -> X ()
directoryPrompt c prom job = mkXPrompt (Dir prom) c getDirCompl job
getDirCompl :: String -> IO [String]
getDirCompl s = (filter notboring . lines) `fmap`
runProcessWithInput "/bin/bash" [] ("compgen -A directory " ++ s ++ "\n")
notboring ('.':'.':_) = True
notboring ('.':_) = False
notboring _ = True

View File

@@ -1,54 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Dmenu
-- Copyright : (c) Spencer Janssen <sjanssen@cse.unl.edu>
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Spencer Janssen <sjanssen@cse.unl.edu>
-- Stability : unstable
-- Portability : unportable
--
-- A convenient binding to dmenu.
--
-----------------------------------------------------------------------------
module XMonadContrib.Dmenu (
-- * Usage
-- $usage
dmenu, dmenuXinerama,
runProcessWithInput
) where
import XMonad
import qualified StackSet as W
import System.Process
import System.IO
import Control.Monad.State
-- $usage
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.Dmenu
runProcessWithInput :: FilePath -> [String] -> String -> IO String
runProcessWithInput cmd args input = do
(pin, pout, perr, ph) <- runInteractiveProcess cmd args Nothing Nothing
hPutStr pin input
hClose pin
output <- hGetContents pout
when (output==output) $ return ()
hClose pout
hClose perr
waitForProcess ph
return output
-- | Starts dmenu on the current screen. Requires this patch to dmenu:
-- <http://www.jcreigh.com/dmenu/dmenu-3.2-xinerama.patch>
dmenuXinerama :: [String] -> X String
dmenuXinerama opts = do
curscreen <- (fromIntegral . W.screen . W.current) `liftM` gets windowset :: X Int
io $ runProcessWithInput "dmenu" ["-xs", show (curscreen+1)] (unlines opts)
dmenu :: [String] -> X String
dmenu opts = io $ runProcessWithInput "dmenu" [] (unlines opts)

View File

@@ -1,119 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.DragPane
-- Copyright : (c) Spencer Janssen <sjanssen@cse.unl.edu>
-- David Roundy <droundy@darcs.net>,
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
-- Layouts that splits the screen either horizontally or vertically and
-- shows two windows. The first window is always the master window, and
-- the other is either the currently focused window or the second window in
-- layout order.
-----------------------------------------------------------------------------
module XMonadContrib.DragPane (
-- * Usage
-- $usage
dragPane, dragUpDownPane
) where
import Control.Monad.Reader ( asks )
import Graphics.X11.Xlib ( Rectangle( Rectangle ) )
import XMonad
import XMonadContrib.Decoration ( newDecoration )
import Operations ( Resize(..), splitHorizontallyBy, splitVerticallyBy, initColor, mouseDrag, sendMessage )
import StackSet ( focus, up, down)
-- $usage
--
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.DragPane
--
-- and add, to the list of layouts:
--
-- > dragPane "" (fromRational delta) (fromRational delta)
halfHandleWidth :: Integral a => a
halfHandleWidth = 2
handleColor :: String
handleColor = "#000000"
dragPane :: String -> Double -> Double -> Layout a
dragPane ident delta split = Layout { doLayout = dolay, modifyLayout = return . message }
where
dolay r s = do handlec <- withDisplay $ \dpy -> io $ initColor dpy handleColor
root <- asks theRoot
let (left', right') = splitHorizontallyBy split r
leftmost = fromIntegral $ case r of Rectangle x _ _ _ -> x
widt = fromIntegral $ case r of Rectangle _ _ w _ -> w
left = case left' of Rectangle x y w h -> Rectangle x y (w-halfHandleWidth) h
right = case right' of
Rectangle x y w h -> Rectangle (x+halfHandleWidth) y (w-halfHandleWidth) h
handr = case left' of
Rectangle x y w h ->
Rectangle (x + fromIntegral w - halfHandleWidth) y (2*halfHandleWidth) h
wrs = case reverse (up s) of
(master:_) -> [(master,left),(focus s,right)]
[] -> case down s of
(next:_) -> [(focus s,left),(next,right)]
[] -> [(focus s, r)]
handle = newDecoration root handr 0 handlec handlec
"-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
(const $ const $ const $ const $ return ()) (doclick)
doclick = mouseDrag (\ex _ ->
sendMessage (SetFrac ident ((fromIntegral ex - leftmost)/widt)))
(return ())
ml' <- if length wrs > 1 then Just `fmap` handle (dragPane ident delta split)
else return Nothing
return (wrs, ml')
message x | Just Shrink <- fromMessage x = Just (dragPane ident delta (split - delta))
| Just Expand <- fromMessage x = Just (dragPane ident delta (split + delta))
| Just (SetFrac ident' frac) <- fromMessage x, ident' == ident =
Just (dragPane ident delta frac)
message _ = Nothing
dragUpDownPane :: String -> Double -> Double -> Layout a
dragUpDownPane ident delta split = Layout { doLayout = dolay, modifyLayout = return . message }
where
dolay r s = do handlec <- withDisplay $ \dpy -> io $ initColor dpy handleColor
root <- asks theRoot
let (left', right') = splitVerticallyBy split r
leftmost = fromIntegral $ case r of Rectangle _ x _ _ -> x
widt = fromIntegral $ case r of Rectangle _ _ _ w -> w
left = case left' of Rectangle x y w h -> Rectangle x y w (h-halfHandleWidth)
right = case right' of
Rectangle x y w h -> Rectangle x (y+halfHandleWidth) w (h-halfHandleWidth)
handr = case left' of
Rectangle x y w h ->
Rectangle x (y + fromIntegral h - halfHandleWidth) w (2*halfHandleWidth)
wrs = case reverse (up s) of
(master:_) -> [(master,left),(focus s,right)]
[] -> case down s of
(next:_) -> [(focus s,left),(next,right)]
[] -> [(focus s, r)]
handle = newDecoration root handr 0 handlec handlec
"-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
(const $ const $ const $ const $ return ()) (doclick)
doclick = mouseDrag (\_ ey ->
sendMessage (SetFrac ident ((fromIntegral ey - leftmost)/widt)))
(return ())
ml' <- if length wrs > 1 then Just `fmap` handle (dragUpDownPane ident delta split)
else return Nothing
return (wrs, ml')
message x | Just Shrink <- fromMessage x = Just (dragUpDownPane ident delta (split - delta))
| Just Expand <- fromMessage x = Just (dragUpDownPane ident delta (split + delta))
| Just (SetFrac ident' frac) <- fromMessage x, ident' == ident =
Just (dragUpDownPane ident delta frac)
message _ = Nothing
data SetFrac = SetFrac String Double deriving ( Show, Read, Eq, Typeable )
instance Message SetFrac

View File

@@ -1,46 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.DwmPromote
-- Copyright : (c) Miikka Koskinen 2007
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : arcatan@kapsi.fi
-- Stability : unstable
-- Portability : unportable
--
-- Dwm-like swap function for xmonad.
--
-- Swaps focused window with the master window. If focus is in the
-- master, swap it with the next window in the stack. Focus stays in the
-- master.
--
-----------------------------------------------------------------------------
module XMonadContrib.DwmPromote (
-- * Usage
-- $usage
dwmpromote
) where
import XMonad
import Operations (windows)
import StackSet
-- $usage
--
-- To use, modify your Config.hs to:
--
-- > import XMonadContrib.DwmPromote
--
-- and add a keybinding or substitute promote with dwmpromote:
--
-- > , ((modMask, xK_Return), dwmpromote)
dwmpromote :: X ()
dwmpromote = windows swap
swap :: StackSet i a s sd -> StackSet i a s sd
swap = modify' $ \c -> case c of
Stack _ [] [] -> c
Stack t [] (x:rs) -> Stack x [] (t:rs)
Stack t ls rs -> Stack t [] (ys ++ x : rs) where (x:ys) = reverse ls

View File

@@ -1,89 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.DynamicLog
-- Copyright : (c) Don Stewart <dons@cse.unsw.edu.au>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Don Stewart <dons@cse.unsw.edu.au>
-- Stability : unstable
-- Portability : unportable
--
-- DynamicLog
--
-- Log events in:
--
-- > 1 2 [3] 4 8
--
-- format. suitable to pipe into dzen.
--
-----------------------------------------------------------------------------
module XMonadContrib.DynamicLog (
-- * Usage
-- $usage
dynamicLog, dynamicLogXinerama, pprWindowSet, pprWindowSetXinerama
) where
--
-- Useful imports
--
import XMonad
import Data.Maybe ( isJust )
import Data.List
import Data.Ord ( comparing )
import qualified StackSet as S
-- $usage
--
-- To use, set:
--
-- > import XMonadContrib.DynamicLog
-- > logHook = dynamicLog
-- |
-- Perform an arbitrary action on each state change.
-- Examples include:
-- * do nothing
-- * log the state to stdout
--
-- An example logger, print a status bar output to dzen, in the form:
--
-- > 1 2 [3] 4 7
--
dynamicLog :: X ()
dynamicLog = withWindowSet $ io . putStrLn . pprWindowSet
pprWindowSet :: WindowSet -> String
pprWindowSet s = concatMap fmt $ sortBy (comparing S.tag)
(map S.workspace (S.current s : S.visible s) ++ S.hidden s)
where this = S.tag (S.workspace (S.current s))
visibles = map (S.tag . S.workspace) (S.visible s)
fmt w | S.tag w == this = "[" ++ pprTag w ++ "]"
| S.tag w `elem` visibles = "<" ++ pprTag w ++ ">"
| isJust (S.stack w) = " " ++ pprTag w ++ " "
| otherwise = ""
-- |
-- Workspace logger with a format designed for Xinerama:
--
-- > [1 9 3] 2 7
--
-- where 1, 9, and 3 are the workspaces on screens 1, 2 and 3, respectively,
-- and 2 and 7 are non-visible, non-empty workspaces
--
dynamicLogXinerama :: X ()
dynamicLogXinerama = withWindowSet $ io . putStrLn . pprWindowSetXinerama
pprWindowSetXinerama :: WindowSet -> String
pprWindowSetXinerama ws = "[" ++ unwords onscreen ++ "] " ++ unwords offscreen
where onscreen = map (pprTag . S.workspace)
. sortBy (comparing S.screen) $ S.current ws : S.visible ws
offscreen = map pprTag . filter (isJust . S.stack)
. sortBy (comparing S.tag) $ S.hidden ws
-- util functions
pprTag :: Integral i => S.Workspace i a -> String
pprTag = show . (+(1::Int)) . fromIntegral . S.tag

View File

@@ -1,71 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.DynamicWorkspaces
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- Provides bindings to add and delete workspaces. Note that you may only
-- delete a workspace that is already empty.
--
-----------------------------------------------------------------------------
module XMonadContrib.DynamicWorkspaces (
-- * Usage
-- $usage
addWorkspace, removeWorkspace
) where
import Control.Monad.State ( gets, modify )
import XMonad ( X, XState(..), Layout, trace )
import Operations ( windows, view )
import StackSet ( tagMember, StackSet(..), Screen(..), Workspace(..),
integrate, differentiate )
import Data.Map ( delete, insert )
import Graphics.X11.Xlib ( Window )
-- $usage
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.DynamicWorkspaces
--
-- > , ((modMask .|. shiftMask, xK_Up), addWorkspace defaultLayouts)
-- > , ((modMask .|. shiftMask, xK_Down), removeWorkspace)
addWorkspace :: [Layout Window] -> X ()
addWorkspace (l:ls) = do s <- gets windowset
let newtag:_ = filter (not . (`tagMember` s)) [0..]
modify $ \st -> st { layouts = insert newtag (l,ls) $ layouts st }
windows (addWorkspace' newtag)
addWorkspace [] = trace "bad layouts in XMonadContrib.DynamicWorkspaces.addWorkspace\n"
removeWorkspace :: X ()
removeWorkspace = do s <- gets windowset
case s of
StackSet { current = Screen { workspace = torem }
, hidden = (w:_) }
-> do view $ tag w
modify $ \st -> st { layouts = delete (tag torem) $ layouts st }
windows (removeWorkspace' (tag torem))
_ -> return ()
addWorkspace' :: i -> StackSet i a sid sd -> StackSet i a sid sd
addWorkspace' newtag s@(StackSet { current = scr@(Screen { workspace = w })
, hidden = ws })
= s { current = scr { workspace = Workspace newtag Nothing }
, hidden = w:ws }
removeWorkspace' :: (Eq i) => i -> StackSet i a sid sd -> StackSet i a sid sd
removeWorkspace' torem s@(StackSet { current = scr@(Screen { workspace = wc })
, hidden = (w:ws) })
| tag w == torem = s { current = scr { workspace = wc { stack = meld (stack w) (stack wc) } }
, hidden = ws }
where meld Nothing Nothing = Nothing
meld x Nothing = x
meld Nothing x = x
meld (Just x) (Just y) = differentiate (integrate x ++ integrate y)
removeWorkspace' _ s = s

63
Dzen.hs
View File

@@ -1,63 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Dzen
-- Copyright : (c) glasser@mit.edu
-- License : BSD
--
-- Maintainer : glasser@mit.edu
-- Stability : unstable
-- Portability : unportable
--
-- Handy wrapper for dzen.
--
-----------------------------------------------------------------------------
module XMonadContrib.Dzen (dzen, dzenScreen) where
import System.Posix.Process (forkProcess, getProcessStatus, createSession)
import System.IO
import System.Process
import System.Exit
import Control.Concurrent (threadDelay)
import Control.Monad.State
import qualified StackSet as W
import XMonad
-- wait is in us
runProcessWithInputAndWait :: FilePath -> [String] -> String -> Int -> IO ()
runProcessWithInputAndWait cmd args input timeout = do
pid <- forkProcess $ do
forkProcess $ do -- double fork it over to init
createSession
(pin, pout, perr, ph) <- runInteractiveProcess cmd args Nothing Nothing
hPutStr pin input
hFlush pin
threadDelay timeout
hClose pin
-- output <- hGetContents pout
-- when (output==output) $ return ()
hClose pout
hClose perr
waitForProcess ph
return ()
exitWith ExitSuccess
return ()
getProcessStatus True False pid
return ()
curScreen :: X ScreenId
curScreen = (W.screen . W.current) `liftM` gets windowset
toXineramaArg :: ScreenId -> String
toXineramaArg n = show ( ((fromIntegral n)+1)::Int )
-- Requires dzen >= 0.2.4.
dzen :: String -> X ()
dzen str = curScreen >>= \sc -> dzenScreen sc str
dzenScreen :: ScreenId -> String -> X()
dzenScreen sc str = io $ (runProcessWithInputAndWait "dzen2" ["-xs", screen] str 5000000)
where screen = toXineramaArg sc

View File

@@ -1,118 +0,0 @@
{-# OPTIONS_GHC -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.FlexibleManipulate
-- Copyright : (c) Michael Sloan
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : <mgsloan@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- Lets you move and resize floating windows without warping the mouse.
--
-----------------------------------------------------------------------------
-- Based on the FlexibleResize code by Lukas Mai (Mauke)
module XMonadContrib.FlexibleManipulate (
-- * Usage
-- $usage
mouseWindow, discrete, linear, resize, position
) where
import XMonad
import Operations
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras
-- $usage
-- Add this import to your Config.hs file:
--
-- > import qualified XMonadContrib.FlexibleManipulate as Flex
--
-- Set one of the mouse button bindings up like this:
--
-- > mouseBindings = M.fromList
-- > [ ((modMask, button1), (\w -> focus w >> Flex.mouseWindow Flex.linear w)) ], ...
--
-- Flex.linear indicates that positions between the edges and the middle
-- indicate a combination scale\/position.
-- Flex.discrete indicates that there are discrete pick regions. (window
-- is divided by thirds for each axis)
-- Flex.resize performs only resize of the window, based on which quadrant
-- the mouse is in
-- Flex.position is similar to the builtin mouseMoveWindow
--
-- You can also write your own function for this parameter. It should take
-- a value between 0 and 1 indicating position, and return a value indicating
-- the corresponding position if plain Flex.linear was used.
discrete, linear, resize, position :: Double -> Double
discrete x | x < 0.33 = 0
| x > 0.66 = 1
| otherwise = 0.5
linear = id
resize x = if x < 0.5 then 0 else 1
position = const 0.5
mouseWindow :: (Double -> Double) -> Window -> X ()
mouseWindow f w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
[wpos, wsize] <- io $ getWindowAttributes d w >>= return . winAttrs
sh <- io $ getWMNormalHints d w
pointer <- io $ queryPointer d w >>= return . pointerPos
let uv = (pointer - wpos) / wsize
fc = mapP f uv
mul = mapP (\x -> 2 - 2 * abs(x - 0.5)) fc --Fudge factors: interpolation between 1 when on edge, 2 in middle
atl = ((1, 1) - fc) * mul
abr = fc * mul
mouseDrag (\ex ey -> io $ do
let offset = (fromIntegral ex, fromIntegral ey) - pointer
npos = wpos + offset * atl
nbr = (wpos + wsize) + offset * abr
ntl = minP (nbr - (32, 32)) npos --minimum size
nwidth = applySizeHints sh $ mapP round (nbr - ntl)
moveResizeWindow d w (round $ fst ntl) (round $ snd ntl) `uncurry` nwidth
return ())
(float w)
float w
where
pointerPos (_,_,_,px,py,_,_,_) = (fromIntegral px,fromIntegral py) :: Pnt
winAttrs :: WindowAttributes -> [Pnt]
winAttrs x = pairUp $ map (fromIntegral . ($ x)) [wa_x, wa_y, wa_width, wa_height]
-- I'd rather I didn't have to do this, but I hate writing component 2d math
type Pnt = (Double, Double)
pairUp :: [a] -> [(a,a)]
pairUp [] = []
pairUp [_] = []
pairUp (x:y:xs) = (x, y) : (pairUp xs)
mapP :: (a -> b) -> (a, a) -> (b, b)
mapP f (x, y) = (f x, f y)
zipP :: (a -> b -> c) -> (a,a) -> (b,b) -> (c,c)
zipP f (ax,ay) (bx,by) = (f ax bx, f ay by)
minP :: Ord a => (a,a) -> (a,a) -> (a,a)
minP = zipP min
instance Num Pnt where
(+) = zipP (+)
(-) = zipP (-)
(*) = zipP (*)
abs = mapP abs
signum = mapP signum
fromInteger = const undefined
instance Fractional Pnt where
fromRational = const undefined
recip = mapP recip

View File

@@ -1,64 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.FlexibleResize
-- Copyright : (c) Lukas Mai
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : <l.mai@web.de>
-- Stability : unstable
-- Portability : unportable
--
-- Lets you resize floating windows from any corner.
--
-----------------------------------------------------------------------------
module XMonadContrib.FlexibleResize (
-- * Usage
-- $usage
XMonadContrib.FlexibleResize.mouseResizeWindow
) where
import XMonad
import Operations
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras
import Foreign.C.Types
-- $usage
-- Put something like this in your Config.hs file:
--
-- > import qualified XMonadContrib.FlexibleResize as Flex
-- > mouseBindings = M.fromList
-- > [ ...
-- > , ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w)) ]
mouseResizeWindow :: Window -> X ()
mouseResizeWindow w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
sh <- io $ getWMNormalHints d w
(_, _, _, _, _, ix, iy, _) <- io $ queryPointer d w
let
[pos_x, pos_y, width, height] = map (fromIntegral . ($ wa)) [wa_x, wa_y, wa_width, wa_height]
west = firstHalf ix width
north = firstHalf iy height
(cx, fx, gx) = mkSel west width pos_x
(cy, fy, gy) = mkSel north height pos_y
io $ warpPointer d none w 0 0 0 0 cx cy
mouseDrag (\ex ey -> do
wa' <- io $ getWindowAttributes d w
let [px, py] = map (fromIntegral . ($ wa')) [wa_x, wa_y]
io $ moveResizeWindow d w (fx px (fromIntegral ex))
(fy py (fromIntegral ey))
`uncurry` applySizeHints sh (gx $ fromIntegral ex, gy $ fromIntegral ey))
(float w)
where
firstHalf :: CInt -> Position -> Bool
firstHalf a b = fromIntegral a * 2 <= b
cfst = curry fst
csnd = curry snd
mkSel :: Bool -> Position -> Position -> (Position, a -> a -> a, CInt -> Dimension)
mkSel b k p =
if b
then (0, csnd, fromIntegral . max 1 . ((k + p) -) . fromIntegral)
else (k, cfst, fromIntegral . max 1 . subtract p . fromIntegral)

View File

@@ -1,42 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.FocusNth
-- Copyright : (c) Karsten Schoelzel <kuser@gmx.de>
-- License : BSD
--
-- Maintainer : Karsten Schoelzel <kuser@gmx.de>
-- Stability : unstable
-- Portability : unportable
--
-- Focus the n'th window on the screen.
-----------------------------------------------------------------------------
module XMonadContrib.FocusNth (
-- * Usage
-- $usage
focusNth) where
import StackSet
import Operations
import XMonad
-- $usage
-- > import XMonadContrib.FocusNth
-- > -- mod4-[1..9] @@ Switch to window N
-- > ++ [((mod4Mask, k), focusNth i)
-- > | (i, k) <- zip [0 .. 8] [xK_1 ..]]
focusNth :: Int -> X ()
focusNth = windows . modify' . focusNth'
focusNth' :: Int -> Stack a -> Stack a
focusNth' n s@(Stack _ ls rs) | (n < 0) || (n > length(ls) + length(rs)) = s
| otherwise = listToStack n (integrate s)
listToStack :: Int -> [a] -> Stack a
listToStack n l = Stack t ls rs
where (t:rs) = drop n l
ls = reverse (take n l)

View File

@@ -1,94 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.HintedTile
-- Copyright : (c) Peter De Wachter <pdewacht@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Peter De Wachter <pdewacht@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- A gapless tiled layout that attempts to obey window size hints,
-- rather than simply ignoring them.
--
-----------------------------------------------------------------------------
module XMonadContrib.HintedTile (
-- * Usage
-- $usage
tall, wide) where
import XMonad
import Operations (Resize(..), IncMasterN(..), applySizeHints)
import qualified StackSet as W
import {-# SOURCE #-} Config (borderWidth)
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras
import Control.Monad
-- $usage
-- You can use this module with the following in your Config.hs file:
--
-- > import qualified XMonadContrib.HintedTile
--
-- > defaultLayouts = [ XMonadContrib.HintedTile.tall nmaster delta ratio, ... ]
-- this sucks
addBorder, substractBorder :: (Dimension, Dimension) -> (Dimension, Dimension)
addBorder (w, h) = (w + 2 * borderWidth, h + 2 * borderWidth)
substractBorder (w, h) = (w - 2 * borderWidth, h - 2 * borderWidth)
tall, wide :: Int -> Rational -> Rational -> Layout Window
wide = tile splitVertically divideHorizontally
tall = tile splitHorizontally divideVertically
tile split divide nmaster delta frac =
Layout { doLayout = \r w' -> let w = W.integrate w'
in do { hints <- sequence (map getHints w)
; return (zip w (tiler frac r `uncurry` splitAt nmaster hints)
, Nothing) }
, modifyLayout = \m -> return $ fmap resize (fromMessage m) `mplus`
fmap incmastern (fromMessage m) }
where resize Shrink = tile split divide nmaster delta (frac-delta)
resize Expand = tile split divide nmaster delta (frac+delta)
incmastern (IncMasterN d) = tile split divide (max 0 (nmaster+d)) delta frac
tiler f r masters slaves = if null masters || null slaves
then divide (masters ++ slaves) r
else split f r (divide masters) (divide slaves)
getHints :: Window -> X SizeHints
getHints w = withDisplay $ \d -> io $ getWMNormalHints d w
--
-- Divide the screen vertically (horizontally) into n subrectangles
--
divideVertically, divideHorizontally :: [SizeHints] -> Rectangle -> [Rectangle]
divideVertically [] _ = [] -- there's a fold here, struggling to get out
divideVertically (hints:rest) (Rectangle sx sy sw sh) = (Rectangle sx sy w h) :
(divideVertically rest (Rectangle sx (sy + fromIntegral h) sw (sh - h)))
where (w, h) = addBorder $ applySizeHints hints $ substractBorder
(sw, sh `div` fromIntegral (1 + (length rest)))
divideHorizontally [] _ = []
divideHorizontally (hints:rest) (Rectangle sx sy sw sh) = (Rectangle sx sy w h) :
(divideHorizontally rest (Rectangle (sx + fromIntegral w) sy (sw - w) sh))
where (w, h) = addBorder $ applySizeHints hints $ substractBorder
(sw `div` fromIntegral (1 + (length rest)), sh)
-- Split the screen into two rectangles, using a rational to specify the ratio
splitHorizontally, splitVertically :: Rational -> Rectangle -> (Rectangle -> [Rectangle]) -> (Rectangle -> [Rectangle]) -> [Rectangle]
splitHorizontally f (Rectangle sx sy sw sh) left right = leftRects ++ rightRects
where leftw = floor $ fromIntegral sw * f
leftRects = left $ Rectangle sx sy leftw sh
rightx = (maximum . map rect_width) leftRects
rightRects = right $ Rectangle (sx + fromIntegral rightx) sy (sw - rightx) sh
splitVertically f (Rectangle sx sy sw sh) top bottom = topRects ++ bottomRects
where toph = floor $ fromIntegral sh * f
topRects = top $ Rectangle sx sy sw toph
bottomy = (maximum . map rect_height) topRects
bottomRects = bottom $ Rectangle sx (sy + fromIntegral bottomy) sw (sh - bottomy)

View File

@@ -1,62 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.LayoutHelpers
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : portable
--
-- A module for writing easy Layouts
-----------------------------------------------------------------------------
module XMonadContrib.LayoutHelpers (
-- * Usage
-- $usage
DoLayout, ModDo, ModMod, ModLay,
layoutModify,
l2lModDo, idModify,
idModDo, idModMod,
) where
import Graphics.X11.Xlib ( Rectangle )
import XMonad
import StackSet ( Stack, integrate )
-- $usage
-- Use LayoutHelpers to help write easy Layouts.
type DoLayout a = Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (Layout a))
type ModifyLayout a = SomeMessage -> X (Maybe (Layout a))
type ModDo a = Rectangle -> Stack a -> [(a, Rectangle)] -> X ([(a, Rectangle)], Maybe (ModLay a))
type ModMod a = SomeMessage -> X (Maybe (ModLay a))
type ModLay a = Layout a -> Layout a
layoutModify :: ModDo a -> ModMod a -> ModLay a
layoutModify fdo fmod l = Layout { doLayout = dl, modifyLayout = modl }
where dl r s = do (ws, ml') <- doLayout l r s
(ws', mmod') <- fdo r s ws
let ml'' = case mmod' of
Just mod' -> Just $ mod' $ maybe l id ml'
Nothing -> layoutModify fdo fmod `fmap` ml'
return (ws', ml'')
modl m = do ml' <- modifyLayout l m
mmod' <- fmod m
return $ case mmod' of
Just mod' -> Just $ mod' $ maybe l id ml'
Nothing -> layoutModify fdo fmod `fmap` ml'
l2lModDo :: (Rectangle -> [a] -> [(a,Rectangle)]) -> DoLayout a
l2lModDo dl r s = return (dl r $ integrate s, Nothing)
idModDo :: ModDo a
idModDo _ _ wrs = return (wrs, Nothing)
idModify :: ModifyLayout a
idModify _ = return Nothing
idModMod :: ModMod a
idModMod _ = return Nothing

View File

@@ -1,43 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.LayoutHints
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : portable
--
-- Make layouts respect size hints.
-----------------------------------------------------------------------------
module XMonadContrib.LayoutHints (
-- * usage
-- $usage
layoutHints) where
import Operations ( applySizeHints, D )
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras ( getWMNormalHints )
import {-#SOURCE#-} Config (borderWidth)
import XMonad hiding ( trace )
import XMonadContrib.LayoutHelpers ( layoutModify, idModMod )
-- $usage
-- > import XMonadContrib.LayoutHints
-- > defaultLayouts = [ layoutHints tiled , layoutHints $ mirror tiled ]
-- | Expand a size by the given multiple of the border width. The
-- multiple is most commonly 1 or -1.
adjBorders :: Dimension -> D -> D
adjBorders mult (w,h) = (w+2*mult*borderWidth, h+2*mult*borderWidth)
layoutHints :: Layout Window -> Layout Window
layoutHints = layoutModify applyHints idModMod
where applyHints _ _ xs = do xs' <- mapM applyHint xs
return (xs', Nothing)
applyHint (w,Rectangle a b c d) =
withDisplay $ \disp ->
do sh <- io $ getWMNormalHints disp w
let (c',d') = adjBorders 1 . applySizeHints sh . adjBorders (-1) $ (c,d)
return (w, Rectangle a b c' d')

View File

@@ -1,44 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.LayoutHooks
-- Copyright : (c) Stefan O'Rear <stefanor@cox.net>
-- License : BSD
--
-- Maintainer : Stefan O'Rear <stefanor@cox.net>
-- Stability : unstable
-- Portability : portable
--
-- General layout-level hooks.
-----------------------------------------------------------------------------
module XMonadContrib.LayoutHooks ( addLayoutMessageHook ) where
import qualified Data.Map as M ( adjust )
import Control.Arrow ( first )
import Control.Monad.State ( modify )
import XMonad
import qualified StackSet as W
install :: (SomeMessage -> X Bool) -> Layout a -> Layout a
install hk lay = lay{ modifyLayout = mod' }
where
mod' msg = do reinst <- hk msg
nlay <- modifyLayout lay msg
return $ cond_reinst reinst nlay
-- no need to make anything change
cond_reinst True Nothing = Nothing
-- reinstall
cond_reinst True (Just nlay) = Just (install hk nlay)
-- restore inner layout
cond_reinst False Nothing = Just lay
-- let it rot
cond_reinst False (Just nlay) = Just nlay
-- Return True each time you want the hook reinstalled
addLayoutMessageHook :: (SomeMessage -> X Bool) -> X ()
addLayoutMessageHook hk = modify $ \ s ->
let nr = W.tag . W.workspace . W.current . windowset $ s
in s { layouts = M.adjust (first $ install hk) nr (layouts s) }

View File

@@ -1,60 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.LayoutScreens
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-----------------------------------------------------------------------------
module XMonadContrib.LayoutScreens (
-- * Usage
-- $usage
layoutScreens
) where
import Control.Monad.Reader ( asks )
import XMonad
import qualified StackSet as W
import qualified Operations as O
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras
-- $usage
-- This module allows you to pretend that you have more than one screen by
-- dividing a single screen into multiple screens that xmonad will treat as
-- separate screens. This should definitely be useful for testing the
-- behavior of xmonad under Xinerama, and it's possible that it'd also be
-- handy for use as an actual user interface, if you've got a very large
-- sceen and long for greater flexibility (e.g. being able to see your
-- email window at all times, a crude mimic of sticky windows).
--
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.LayoutScreens
--
-- > , ((modMask .|. shiftMask, xK_space), layoutScreens 2 (twoPane 0.5 0.5))
-- > , ((controlMask .|. modMask .|. shiftMask, xK_space), rescreen)
layoutScreens :: Int -> Layout Int -> X ()
layoutScreens nscr _ | nscr < 1 = trace $ "Can't layoutScreens with only " ++ show nscr ++ " screens."
layoutScreens nscr l =
do rtrect <- asks theRoot >>= getWindowRectangle
(wss, _) <- doLayout l rtrect W.Stack { W.focus=1, W.up=[],W.down=[1..nscr-1] }
O.windows $ \ws@(W.StackSet { W.current = v, W.visible = vs, W.hidden = hs }) ->
let (x:xs, ys) = splitAt nscr $ map W.workspace (v:vs) ++ hs
gaps = map (statusGap . W.screenDetail) $ v:vs
(s:ss, g:gg) = (map snd wss, take nscr $ gaps ++ repeat (head gaps))
in ws { W.current = W.Screen x 0 (SD s g)
, W.visible = zipWith3 W.Screen xs [1 ..] $ zipWith SD ss gg
, W.hidden = ys }
getWindowRectangle :: Window -> X Rectangle
getWindowRectangle w = withDisplay $ \d ->
do a <- io $ getWindowAttributes d w
return $ Rectangle (fromIntegral $ wa_x a) (fromIntegral $ wa_y a)
(fromIntegral $ wa_width a) (fromIntegral $ wa_height a)

View File

@@ -1,33 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.MagicFocus
-- Copyright : (c) Peter De Wachter <pdewacht@gmail.com>
-- License : BSD
--
-- Maintainer : Peter De Wachter <pdewacht@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- Automagically put the focused window in the master area.
-----------------------------------------------------------------------------
module XMonadContrib.MagicFocus (
-- * Usage
-- $usage
magicFocus) where
import Graphics.X11.Xlib (Window)
import XMonad
import StackSet
-- $usage
-- > import XMonadContrib.MagicFocus
-- > defaultLayouts = [ magicFocus tiled , magicFocus $ mirror tiled ]
magicFocus :: Layout Window -> Layout Window
magicFocus l = l { doLayout = \r s -> withWindowSet (return . peek) >>= (doLayout l) r . swap s
, modifyLayout = \x -> fmap magicFocus `fmap` modifyLayout l x }
swap :: (Eq a) => Stack a -> Maybe a -> Stack a
swap (Stack f u d) focused | Just f == focused = Stack f [] (reverse u ++ d)
| otherwise = Stack f u d

View File

@@ -1,64 +0,0 @@
{-# OPTIONS_GHC -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Magnifier
-- Copyright : (c) Peter De Wachter 2007
-- License : BSD-style (see xmonad/LICENSE)
--
-- Maintainer : Peter De Wachter <pdewacht@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- Screenshot : <http://caladan.rave.org/magnifier.png>
--
-- This layout hack increases the size of the window that has focus.
--
-----------------------------------------------------------------------------
module XMonadContrib.Magnifier (
-- * Usage
-- $usage
magnifier, magnifier') where
import Graphics.X11.Xlib (Window, Rectangle(..))
import XMonad
import StackSet
import XMonadContrib.LayoutHelpers
-- $usage
-- > import XMonadContrib.Magnifier
-- > defaultLayouts = [ magnifier tiled , magnifier $ mirror tiled ]
-- | Increase the size of the window that has focus, unless it is the master window.
magnifier :: Layout Window -> Layout Window
magnifier = layoutModify (unlessMaster applyMagnifier) idModMod
-- | Increase the size of the window that has focus, even if it is the master window.
magnifier' :: Layout Window -> Layout Window
magnifier' = layoutModify applyMagnifier idModMod
unlessMaster :: ModDo Window -> ModDo Window
unlessMaster mainmod r s wrs = if null (up s) then return (wrs, Nothing)
else mainmod r s wrs
applyMagnifier :: ModDo Window
applyMagnifier r _ wrs = do focused <- withWindowSet (return . peek)
let mag (w,wr) ws | focused == Just w = ws ++ [(w, shrink r $ magnify wr)]
| otherwise = (w,wr) : ws
return (reverse $ foldr mag [] wrs, Nothing)
magnify :: Rectangle -> Rectangle
magnify (Rectangle x y w h) = Rectangle x' y' w' h'
where x' = x - fromIntegral (w' - w) `div` 2
y' = y - fromIntegral (h' - h) `div` 2
w' = round $ fromIntegral w * zoom
h' = round $ fromIntegral h * zoom
zoom = 1.5 :: Double
shrink :: Rectangle -> Rectangle -> Rectangle
shrink (Rectangle sx sy sw sh) (Rectangle x y w h) = Rectangle x' y' w' h'
where x' = max sx x
y' = max sy y
w' = min w (fromIntegral sx + sw - fromIntegral x')
h' = min h (fromIntegral sy + sh - fromIntegral y')

View File

@@ -1,71 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.MetaModule
-- Copyright : (c) 2007 Spencer Janssen <sjanssen@cse.unl.edu>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Spencer Janssen <sjanssen@cse.unl.edu>
-- Stability : unstable
-- Portability : unportable
--
-- This is an artificial dependency on all the XMonadContrib.* modules. It is
-- intended to help xmonad hackers ensure that contrib modules build after API
-- changes.
--
-- Please add new modules to this list (in alphabetical order).
--
-----------------------------------------------------------------------------
module XMonadContrib.MetaModule () where
import XMonadContrib.Accordion ()
import XMonadContrib.Anneal ()
import XMonadContrib.Circle ()
import XMonadContrib.Commands ()
import XMonadContrib.Combo ()
import XMonadContrib.CopyWindow ()
import XMonadContrib.Decoration ()
import XMonadContrib.DeManage ()
import XMonadContrib.DirectoryPrompt ()
import XMonadContrib.Dmenu ()
import XMonadContrib.DragPane ()
import XMonadContrib.DwmPromote ()
import XMonadContrib.DynamicLog ()
import XMonadContrib.DynamicWorkspaces ()
import XMonadContrib.Dzen ()
import XMonadContrib.FindEmptyWorkspace ()
import XMonadContrib.FlexibleResize ()
import XMonadContrib.FlexibleManipulate ()
import XMonadContrib.FocusNth ()
import XMonadContrib.HintedTile ()
import XMonadContrib.LayoutHelpers ()
import XMonadContrib.LayoutHints ()
import XMonadContrib.LayoutHooks ()
import XMonadContrib.LayoutScreens ()
import XMonadContrib.MagicFocus ()
import XMonadContrib.Magnifier ()
import XMonadContrib.Mosaic ()
import XMonadContrib.NamedWindows ()
import XMonadContrib.NoBorders ()
import XMonadContrib.Roledex ()
import XMonadContrib.RotSlaves ()
import XMonadContrib.RotView ()
-- XMonadContrib.ShellPrompt depends on readline
--import XMonadContrib.ShellPrompt ()
import XMonadContrib.SimpleDate ()
import XMonadContrib.SimpleStacking ()
import XMonadContrib.SinkAll ()
import XMonadContrib.Spiral ()
import XMonadContrib.Square ()
import XMonadContrib.SshPrompt ()
import XMonadContrib.Submap ()
import XMonadContrib.SwitchTrans ()
import XMonadContrib.Tabbed ()
import XMonadContrib.ThreeColumns ()
import XMonadContrib.TwoPane ()
import XMonadContrib.ViewPrev ()
import XMonadContrib.XMonadPrompt ()
import XMonadContrib.XPrompt ()
import XMonadContrib.Warp ()
import XMonadContrib.WorkspaceDir ()

396
Mosaic.hs
View File

@@ -1,396 +0,0 @@
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Mosaic
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- This module defines a \"mosaic\" layout, which tries to give each window a
-- user-configurable relative area, while also trying to give them aspect
-- ratios configurable at run-time by the user.
--
-----------------------------------------------------------------------------
module XMonadContrib.Mosaic (
-- * Usage
-- $usage
mosaic, expandWindow, shrinkWindow, squareWindow, myclearWindow,
tallWindow, wideWindow, flexibleWindow,
getName, withNamedWindow ) where
import Control.Monad.State ( State, put, get, runState )
import System.Random ( StdGen, mkStdGen )
import Data.Ratio
import Graphics.X11.Xlib
import XMonad hiding ( trace )
import Operations ( full, Resize(Shrink, Expand) )
import qualified StackSet as W
import qualified Data.Map as M
import Data.List ( sort )
import Data.Typeable ( Typeable )
import Control.Monad ( mplus )
import XMonadContrib.NamedWindows
import XMonadContrib.Anneal
-- $usage
--
-- Key bindings:
--
-- You can use this module with the following in your config file:
--
-- > import XMonadContrib.Mosaic
--
-- > defaultLayouts :: [Layout Window]
-- > defaultLayouts = [ mosaic 0.25 0.5 M.empty, full ]
--
-- In the key-bindings, do something like:
--
-- > , ((controlMask .|. modMask .|. shiftMask, xK_h), withNamedWindow (sendMessage . tallWindow))
-- > , ((controlMask .|. modMask .|. shiftMask, xK_l), withNamedWindow (sendMessage . wideWindow))
-- > , ((modMask .|. shiftMask, xK_h ), withNamedWindow (sendMessage . shrinkWindow))
-- > , ((modMask .|. shiftMask, xK_l ), withNamedWindow (sendMessage . expandWindow))
-- > , ((modMask .|. shiftMask, xK_s ), withNamedWindow (sendMessage . squareWindow))
-- > , ((modMask .|. shiftMask, xK_o ), withNamedWindow (sendMessage . myclearWindow))
-- > , ((controlMask .|. modMask .|. shiftMask, xK_o ), withNamedWindow (sendMessage . flexibleWindow))
--
data HandleWindow = ExpandWindow NamedWindow | ShrinkWindow NamedWindow
| SquareWindow NamedWindow | ClearWindow NamedWindow
| TallWindow NamedWindow | WideWindow NamedWindow
| FlexibleWindow NamedWindow
deriving ( Typeable, Eq )
instance Message HandleWindow
expandWindow, shrinkWindow, squareWindow, flexibleWindow, myclearWindow,tallWindow, wideWindow :: NamedWindow -> HandleWindow
expandWindow = ExpandWindow
shrinkWindow = ShrinkWindow
squareWindow = SquareWindow
flexibleWindow = FlexibleWindow
myclearWindow = ClearWindow
tallWindow = TallWindow
wideWindow = WideWindow
largeNumber :: Int
largeNumber = 50
defaultArea :: Double
defaultArea = 1
flexibility :: Double
flexibility = 0.1
mosaic :: Double -> Double -> M.Map NamedWindow [WindowHint] -> Layout Window
mosaic delta tileFrac hints = full { doLayout = \r -> mosaicL tileFrac hints r . W.integrate
, modifyLayout = return . mlayout }
where mlayout x = (m1 `fmap` fromMessage x) `mplus` (m2 `fmap` fromMessage x)
m1 Shrink = mosaic delta (tileFrac/(1+delta)) hints
m1 Expand = mosaic delta (tileFrac*(1+delta)) hints
m2 (ExpandWindow w) = mosaic delta tileFrac (multiply_area (1+delta) w hints)
m2 (ShrinkWindow w) = mosaic delta tileFrac (multiply_area (1/(1+ delta)) w hints)
m2 (SquareWindow w) = mosaic delta tileFrac (set_aspect_ratio 1 w hints)
m2 (FlexibleWindow w) = mosaic delta tileFrac (make_flexible w hints)
m2 (TallWindow w) = mosaic delta tileFrac (multiply_aspect (1/(1+delta)) w hints)
m2 (WideWindow w) = mosaic delta tileFrac (multiply_aspect (1+delta) w hints)
m2 (ClearWindow w) = mosaic delta tileFrac (M.delete w hints)
multiply_area :: Double -> NamedWindow
-> M.Map NamedWindow [WindowHint] -> M.Map NamedWindow [WindowHint]
multiply_area a = alterlist f where f [] = [RelArea (defaultArea*a)]
f (RelArea a':xs) = RelArea (a'*a) : xs
f (x:xs) = x : f xs
set_aspect_ratio :: Double -> NamedWindow
-> M.Map NamedWindow [WindowHint] -> M.Map NamedWindow [WindowHint]
set_aspect_ratio r = alterlist f where f [] = [AspectRatio r]
f (FlexibleAspectRatio _:x) = AspectRatio r:x
f (AspectRatio _:x) = AspectRatio r:x
f (x:xs) = x:f xs
make_flexible :: NamedWindow
-> M.Map NamedWindow [WindowHint] -> M.Map NamedWindow [WindowHint]
make_flexible = alterlist (map f) where f (AspectRatio r) = FlexibleAspectRatio r
f (FlexibleAspectRatio r) = AspectRatio r
f x = x
multiply_aspect :: Double -> NamedWindow
-> M.Map NamedWindow [WindowHint] -> M.Map NamedWindow [WindowHint]
multiply_aspect r = alterlist f where f [] = [FlexibleAspectRatio r]
f (AspectRatio r':x) = AspectRatio (r*r'):x
f (FlexibleAspectRatio r':x) = FlexibleAspectRatio (r*r'):x
f (x:xs) = x:f xs
findlist :: Ord k => k -> M.Map k [a] -> [a]
findlist = M.findWithDefault []
alterlist :: (Ord k, Ord a) => ([a] -> [a]) -> k -> M.Map k [a] -> M.Map k [a]
alterlist f k = M.alter f' k
where f' Nothing = f' (Just [])
f' (Just xs) = case f xs of
[] -> Nothing
xs' -> Just xs'
mosaicL :: Double -> M.Map NamedWindow [WindowHint]
-> Rectangle -> [Window] -> X ([(Window, Rectangle)],Maybe (Layout Window))
mosaicL _ _ _ [] = return ([], Nothing)
mosaicL f hints origRect origws
= do namedws <- mapM getName origws
let sortedws = reverse $ map the_value $ sort $ map (\w -> Rated (sumareas [w]) w) namedws
-- TODO: remove all this dead code
myv = runCountDown largeNumber $ mosaic_splits even_split origRect Vertical sortedws
myv2 = mc_mosaic sortedws Vertical
myh2 = mc_mosaic sortedws Horizontal
-- myv2 = maxL $ runCountDown largeNumber $
-- sequence $ replicate mediumNumber $
-- mosaic_splits one_split origRect Vertical sortedws
myh = runCountDown largeNumber $ mosaic_splits even_split origRect Horizontal sortedws
-- myh2 = maxL $ runCountDown largeNumber $
-- sequence $ replicate mediumNumber $
-- mosaic_splits one_split origRect Horizontal sortedws
return (map (\(nw,r)->(--trace ("rate1:"++ unlines [show nw,
-- show $ rate f meanarea (findlist nw hints) r,
-- show r,
-- show $ area r/meanarea,
-- show $ findlist nw hints]) $
unName nw,crop' (findlist nw hints) r)) $
flattenMosaic $ the_value $ maxL [myh,myv,myh2,myv2], Nothing)
where mosaic_splits _ _ _ [] = return $ Rated 0 $ M []
mosaic_splits _ r _ [w] = return $ Rated (rate f meanarea (findlist w hints) r) $ OM (w,r)
mosaic_splits spl r d ws = maxL `fmap` mapCD (spl r d) (init $ allsplits ws)
even_split :: Rectangle -> CutDirection -> [[NamedWindow]]
-> State CountDown (Rated Double (Mosaic (NamedWindow, Rectangle)))
even_split r d [ws] = even_split r d $ map (:[]) ws
even_split r d wss =
do let areas = map sumareas wss
let wsr_s :: [([NamedWindow], Rectangle)]
wsr_s = zip wss (partitionR d r areas)
submosaics <- mapM (\(ws',r') ->
mosaic_splits even_split r' (otherDirection d) ws') wsr_s
return $ fmap M $ catRated submosaics
{-
another_mosaic :: [NamedWindow] -> CutDirection
-> Rated Double (Mosaic (NamedWindow,Rectangle))
another_mosaic ws d = rate_mosaic ratew $
rect_mosaic origRect d $
zipML (example_mosaic ws) (map findarea ws)
-}
mc_mosaic :: [NamedWindow] -> CutDirection
-> Rated Double (Mosaic (NamedWindow,Rectangle))
mc_mosaic ws d = fmap (rect_mosaic origRect d) $
annealMax (zipML (example_mosaic ws) (map findarea ws))
(the_rating . rate_mosaic ratew . rect_mosaic origRect d )
changeMosaic
ratew :: (NamedWindow,Rectangle) -> Double
ratew (w,r) = rate f meanarea (findlist w hints) r
example_mosaic :: [NamedWindow] -> Mosaic NamedWindow
example_mosaic ws = M (map OM ws)
rect_mosaic :: Rectangle -> CutDirection -> Mosaic (a,Double) -> Mosaic (a,Rectangle)
rect_mosaic r _ (OM (w,_)) = OM (w,r)
rect_mosaic r d (M ws) = M $ zipWith (\w' r' -> rect_mosaic r' d' w') ws rs
where areas = map (sum . map snd . flattenMosaic) ws
rs = partitionR d r areas
d' = otherDirection d
rate_mosaic :: ((NamedWindow,Rectangle) -> Double)
-> Mosaic (NamedWindow,Rectangle) -> Rated Double (Mosaic (NamedWindow,Rectangle))
rate_mosaic r m = catRatedM $ fmap (\x -> Rated (r x) x) m
{-
one_split :: Rectangle -> CutDirection -> [[NamedWindow]]
-> State CountDown (Rated Double (Mosaic (NamedWindow, Rectangle)))
one_split r d [ws] = one_split r d $ map (:[]) ws
one_split r d wss =
do rnd <- mapM (const (fractional resolutionNumber)) [1..length wss]
let wsr_s :: [([NamedWindow], Rectangle)]
wsr_s = zip wss (partitionR d r rnd)
submosaics <- mapM (\(ws',r') ->
mosaic_splits even_split r' (otherDirection d) ws') wsr_s
return $ fmap M $ catRated submosaics
-}
partitionR :: CutDirection -> Rectangle -> [Double] -> [Rectangle]
partitionR _ _ [] = []
partitionR _ r [_] = [r]
partitionR d r (a:ars) = r1 : partitionR d r2 ars
where totarea = sum (a:ars)
(r1,r2) = split d (a/totarea) r
theareas = hints2area `fmap` hints
sumareas ws = sum $ map findarea ws
findarea :: NamedWindow -> Double
findarea w = M.findWithDefault 1 w theareas
meanarea = area origRect / fromIntegral (length origws)
maxL :: Ord a => [a] -> a
maxL [] = error "maxL on empty list"
maxL [a] = a
maxL (a:b:c) = maxL (max a b:c)
catRated :: Floating v => [Rated v a] -> Rated v [a]
catRated xs = Rated (product $ map the_rating xs) (map the_value xs)
catRatedM :: Floating v => Mosaic (Rated v a) -> Rated v (Mosaic a)
catRatedM (OM (Rated v x)) = Rated v (OM x)
catRatedM (M xs) = case catRated $ map catRatedM xs of Rated v xs' -> Rated v (M xs')
data CountDown = CD !StdGen !Int
tries_left :: State CountDown Int
tries_left = do CD _ n <- get
return (max 0 n)
mapCD :: (a -> State CountDown b) -> [a] -> State CountDown [b]
mapCD f xs = do n <- tries_left
let len = length xs
mapM (run_with_only ((n `div` len)+1) . f) $ take (n+1) xs
run_with_only :: Int -> State CountDown a -> State CountDown a
run_with_only limit j =
do CD g n <- get
let leftover = n - limit
if leftover < 0 then j
else do put $ CD g limit
x <- j
CD g' n' <- get
put $ CD g' (leftover + n')
return x
data WindowHint = RelArea Double
| AspectRatio Double
| FlexibleAspectRatio Double
deriving ( Show, Read, Eq, Ord )
fixedAspect :: [WindowHint] -> Bool
fixedAspect [] = False
fixedAspect (AspectRatio _:_) = True
fixedAspect (_:x) = fixedAspect x
rate :: Double -> Double -> [WindowHint] -> Rectangle -> Double
rate defaulta meanarea xs rr
| fixedAspect xs = (area (crop xs rr) / meanarea) ** weight
| otherwise = (area rr / meanarea)**(weight-flexibility)
* (area (crop (xs++[FlexibleAspectRatio defaulta]) rr) / meanarea)**flexibility
where weight = hints2area xs
crop :: [WindowHint] -> Rectangle -> Rectangle
crop (AspectRatio f:_) = cropit f
crop (FlexibleAspectRatio f:_) = cropit f
crop (_:hs) = crop hs
crop [] = id
crop' :: [WindowHint] -> Rectangle -> Rectangle
crop' (AspectRatio f:_) = cropit f
crop' (_:hs) = crop' hs
crop' [] = id
cropit :: Double -> Rectangle -> Rectangle
cropit f (Rectangle a b w h) | w -/- h > f = Rectangle a b (ceiling $ h -* f) h
| otherwise = Rectangle a b w (ceiling $ w -/ f)
hints2area :: [WindowHint] -> Double
hints2area [] = defaultArea
hints2area (RelArea r:_) = r
hints2area (_:x) = hints2area x
area :: Rectangle -> Double
area (Rectangle _ _ w h) = fromIntegral w * fromIntegral h
(-/-) :: (Integral a, Integral b) => a -> b -> Double
a -/- b = fromIntegral a / fromIntegral b
(-/) :: (Integral a) => a -> Double -> Double
a -/ b = fromIntegral a / b
(-*) :: (Integral a) => a -> Double -> Double
a -* b = fromIntegral a * b
split :: CutDirection -> Double -> Rectangle -> (Rectangle, Rectangle)
split Vertical frac (Rectangle sx sy sw sh) = (Rectangle sx sy sw h,
Rectangle sx (sy+fromIntegral h) sw (sh-h))
where h = floor $ fromIntegral sh * frac
split Horizontal frac (Rectangle sx sy sw sh) = (Rectangle sx sy w sh,
Rectangle (sx+fromIntegral w) sy (sw-w) sh)
where w = floor $ fromIntegral sw * frac
data CutDirection = Vertical | Horizontal
otherDirection :: CutDirection -> CutDirection
otherDirection Vertical = Horizontal
otherDirection Horizontal = Vertical
data Mosaic a = M [Mosaic a] | OM a
deriving ( Show )
instance Functor Mosaic where
fmap f (OM x) = OM (f x)
fmap f (M xs) = M (map (fmap f) xs)
zipMLwith :: (a -> b -> c) -> Mosaic a -> [b] -> Mosaic c
zipMLwith f (OM x) (y:_) = OM (f x y)
zipMLwith _ (OM _) [] = error "bad zipMLwith"
zipMLwith f (M xxs) yys = makeM $ foo xxs yys
where foo (x:xs) ys = zipMLwith f x (take (lengthM x) ys) :
foo xs (drop (lengthM x) ys)
foo [] _ = []
zipML :: Mosaic a -> [b] -> Mosaic (a,b)
zipML = zipMLwith (\a b -> (a,b))
lengthM :: Mosaic a -> Int
lengthM (OM _) = 1
lengthM (M x) = sum $ map lengthM x
changeMosaic :: Mosaic a -> [Mosaic a]
changeMosaic (OM _) = []
changeMosaic (M xs) = map makeM (concatenations xs) ++
map makeM (splits xs) ++
map M (tryAll changeMosaic xs)
tryAll :: (a -> [a]) -> [a] -> [[a]]
tryAll _ [] = []
tryAll f (x:xs) = map (:xs) (f x) ++ map (x:) (tryAll f xs)
splits :: [Mosaic a] -> [[Mosaic a]]
splits [] = []
splits (OM x:y) = map (OM x:) $ splits y
splits (M (x:y):z) = (x:makeM y:z) : map (makeM (x:y) :) (splits z)
splits (M []:x) = splits x
concatenations :: [Mosaic a] -> [[Mosaic a]]
concatenations (x:y:z) = (concatenateMosaic x y:z):(map (x:) $ concatenations (y:z))
concatenations _ = []
concatenateMosaic :: Mosaic a -> Mosaic a -> Mosaic a
concatenateMosaic (OM a) (OM b) = M [OM a, OM b]
concatenateMosaic (OM a) (M b) = M (OM a:b)
concatenateMosaic (M a) (OM b) = M (a++[OM b])
concatenateMosaic (M a) (M b) = M (a++b)
makeM :: [Mosaic a] -> Mosaic a
makeM [m] = m
makeM [] = error "makeM []"
makeM ms = M ms
flattenMosaic :: Mosaic a -> [a]
flattenMosaic (OM a) = [a]
flattenMosaic (M xs) = concatMap flattenMosaic xs
allsplits :: [a] -> [[[a]]]
allsplits [] = [[[]]]
allsplits [a] = [[[a]]]
allsplits (x:xs) = (map ([x]:) splitsrest) ++ (map (maphead (x:)) splitsrest)
where splitsrest = allsplits' xs
allsplits' :: [a] -> [[[a]]]
allsplits' [] = [[[]]]
allsplits' [a] = [[[a]]]
allsplits' (x:xs) = (map (maphead (x:)) splitsrest) ++ (map ([x]:) splitsrest)
where splitsrest = allsplits xs
maphead :: (a->a) -> [a] -> [a]
maphead f (x:xs) = f x : xs
maphead _ [] = []
runCountDown :: Int -> State CountDown a -> a
runCountDown n x = fst $ runState x (CD (mkStdGen n) n)

View File

@@ -1,57 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.NoBorders
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- Make a given layout display without borders. This is useful for
-- full-screen or tabbed layouts, where you don't really want to waste a
-- couple of pixels of real estate just to inform yourself that the visible
-- window has focus.
--
-----------------------------------------------------------------------------
module XMonadContrib.NoBorders (
-- * Usage
-- $usage
noBorders,
withBorder
) where
import Control.Monad.State ( gets )
import Graphics.X11.Xlib
import XMonad
import Operations ( UnDoLayout(UnDoLayout) )
import qualified StackSet as W
import {-# SOURCE #-} Config (borderWidth)
-- $usage
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.NoBorders
--
-- and modify the defaultLayouts to call noBorders on the layouts you want to lack
-- borders
--
-- > defaultLayouts = [ noBorders full, ... ]
noBorders :: Layout a -> Layout a
noBorders = withBorder 0
withBorder :: Dimension -> Layout a -> Layout a
withBorder bd l = l { doLayout = \r x -> setborders bd >> doLayout l r x
, modifyLayout = ml }
where ml m | Just UnDoLayout == fromMessage m
= do setborders borderWidth
fmap (withBorder bd) `fmap` (modifyLayout l) m
| otherwise = fmap (withBorder bd) `fmap` (modifyLayout l) m
setborders :: Dimension -> X ()
setborders bw = withDisplay $ \d ->
do ws <- gets (W.integrate' . W.stack . W.workspace . W.current . windowset)
mapM_ (\w -> io $ setWindowBorderWidth d w bw) ws

20
README
View File

@@ -1,20 +0,0 @@
3rd party xmonad extensions and contributions.
This repository can be overlayed on an xmonad repository.
Users may then import Haskell src from here, to extend their config
files.
scripts/ contains further external programs useful with xmonad.
Haskell code contributed to this repo should live under the
XMonadContrib.
name space. For example:
XMonadContrib.Mosaic
------------------------------------------------------------------------
Code submitted to the contrib repo is licensed under the same license as
xmonad itself, with copyright held by the authors.

43
README.md Normal file
View File

@@ -0,0 +1,43 @@
# xmonad-contrib: Third Party Extensions to the xmonad Window Manager
[![Build Status](https://travis-ci.org/xmonad/xmonad-contrib.svg?branch=master)](https://travis-ci.org/xmonad/xmonad-contrib)
[![Open Source Helpers](https://www.codetriage.com/xmonad/xmonad-contrib/badges/users.svg)](https://www.codetriage.com/xmonad/xmonad-contrib)
You need the ghc compiler and xmonad window manager installed in
order to use these extensions.
For installation and configuration instructions, please see the
[xmonad website][xmonad], the documents included with the
[xmonad source distribution][xmonad-git], and the
[online haddock documentation][xmonad-docs].
## Getting or Updating XMonadContrib
* Latest release: <https://hackage.haskell.org/package/xmonad-contrib>
* Git version: <https://github.com/xmonad/xmonad-contrib>
(To use git xmonad-contrib you must also use the
[git version of xmonad][xmonad-git].)
## Contributing
Haskell code contributed to this repo should live under the
appropriate subdivision of the `XMonad` namespace (currently includes
`Actions`, `Config`, `Hooks`, `Layout`, `Prompt`, and `Util`). For
example, to use the Grid layout, one would import:
XMonad.Layout.Grid
For further details, see the [documentation][developing] for the
`XMonad.Doc.Developing` module, XMonad's [CONTRIBUTING.md](https://github.com/xmonad/xmonad/blob/master/CONTRIBUTING.md) and the [xmonad website][xmonad].
## License
Code submitted to the contrib repo is licensed under the same license as
xmonad itself, with copyright held by the authors.
[xmonad]: http://xmonad.org
[xmonad-git]: https://github.com/xmonad/xmonad
[xmonad-docs]: http://hackage.haskell.org/package/xmonad
[developing]: http://hackage.haskell.org/package/xmonad-contrib/docs/XMonad-Doc-Developing.html

View File

@@ -1,46 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.RotSlaves
-- Copyright : (c) Hans Philipp Annen <haphi@gmx.net>, Mischa Dieterle <der_m@freenet.de>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Hans Philipp Annen <haphi@gmx.net>
-- Stability : unstable
-- Portability : unportable
--
-- Rotate all windows except the master window
-- and keep the focus in place.
-----------------------------------------------------------------------------
module XMonadContrib.RotSlaves (
-- $usage
rotSlaves', rotSlavesUp, rotSlavesDown
) where
import StackSet
import Operations
import XMonad
-- $usage
--
-- To use this module, import it with:
--
-- > import XMonadContrib.RotSlaves
--
-- and add a keybinding:
--
-- > , ((modMask .|. shiftMask, xK_Tab ), rotSlavesUp)
--
--
-- This operation will rotate all windows except the master window, while the focus
-- stays where it is. It is usefull together with the TwoPane-Layout (see XMonadContrib.TwoPane).
rotSlavesUp,rotSlavesDown :: X ()
rotSlavesUp = windows $ modify' (rotSlaves' (\l -> (tail l)++[head l]))
rotSlavesDown = windows $ modify' (rotSlaves' (\l -> [last l]++(init l)))
rotSlaves' :: ([a] -> [a]) -> Stack a -> Stack a
rotSlaves' _ s@(Stack _ [] []) = s
rotSlaves' f (Stack t [] rs) = Stack t [] (f rs) -- Master has focus
rotSlaves' f s@(Stack _ ls _ ) = Stack t' (reverse revls') rs' -- otherwise
where (master:ws) = integrate s
(revls',t':rs') = splitAt (length ls) (master:(f ws))

View File

@@ -1,45 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.RotView
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- Provides bindings to cycle through non-empty workspaces.
--
-----------------------------------------------------------------------------
module XMonadContrib.RotView (
-- * Usage
-- $usage
rotView
) where
import Control.Monad.State ( gets )
import Data.List ( sortBy )
import Data.Maybe ( listToMaybe, isJust )
import Data.Ord ( comparing )
import XMonad
import StackSet hiding (filter)
import qualified Operations as O
-- $usage
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.RotView
--
-- > , ((modMask .|. shiftMask, xK_Right), rotView True)
-- > , ((modMask .|. shiftMask, xK_Left), rotView False)
rotView :: Bool -> X ()
rotView b = do
ws <- gets windowset
let m = tag . workspace . current $ ws
sortWs = sortBy (comparing tag)
pivoted = uncurry (flip (++)) . span ((< m) . tag) . sortWs . hidden $ ws
nextws = listToMaybe . filter (isJust . stack) . (if b then id else reverse) $ pivoted
whenJust nextws (O.view . tag)

View File

@@ -1,31 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.RunInXTerm
-- Copyright : (C) 2007 Andrea Rossato
-- License : BSD3
--
-- Maintainer : andrea.rossato@unibz.it
-- Stability : unstable
-- Portability : unportable
--
-- A simple module to launch commands in an X terminal
-- from XMonad
--
-----------------------------------------------------------------------------
module XMonadContrib.RunInXTerm (
-- * Usage
-- $usage
runInXTerm
) where
import XMonad
import System.Environment
-- $usage
-- For an example usage see "XMonadContrib.SshPrompt"
runInXTerm :: String -> X ()
runInXTerm com = do
c <- io $ catch (getEnv "XTERMCMD") (const $ return "xterm")
spawn ("exec " ++ c ++ " -e " ++ com)

3
Setup.lhs Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env runhaskell
> import Distribution.Simple
> main = defaultMain

View File

@@ -1,91 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.ShellPrompt
-- Copyright : (C) 2007 Andrea Rossato
-- License : BSD3
--
-- Maintainer : andrea.rossato@unibz.it
-- Stability : unstable
-- Portability : unportable
--
-- A shell prompt for XMonad
--
-----------------------------------------------------------------------------
module XMonadContrib.ShellPrompt (
-- * Usage
-- $usage
shellPrompt
, rmPath
, split
) where
import XMonad
import XMonadContrib.XPrompt
import Control.Monad
import Data.List
import System.Console.Readline
import System.Environment
-- $usage
--
-- 1. In xmonad.cabal change:
--
-- > build-depends: base>=2.0, X11>=1.2.1, X11-extras>=0.2, mtl>=1.0, unix>=1.0
--
-- to
--
-- > build-depends: base>=2.0, X11>=1.2.1, X11-extras>=0.2, mtl>=1.0, unix>=1.0, readline >= 1.0
--
-- 2. In Config.hs add:
--
-- > import XMonadContrib.XPrompt
-- > import XMonadContrib.ShellPrompt
--
-- 3. In your keybindings add something like:
--
-- > , ((modMask .|. controlMask, xK_x), shellPrompt defaultXPConfig)
--
data Shell = Shell
instance XPrompt Shell where
showXPrompt Shell = "Run: "
shellPrompt :: XPConfig -> X ()
shellPrompt c = mkXPrompt Shell c getShellCompl spawn
getShellCompl :: String -> IO [String]
getShellCompl s
| s /= "" && last s /= ' ' = do
fl <- filenameCompletionFunction s
c <- commandCompletionFunction s
return $ sort . nub $ fl ++ c
| otherwise = return []
commandCompletionFunction :: String -> IO [String]
commandCompletionFunction str
| '/' `elem` str = return []
| otherwise = do
p <- getEnv "PATH"
cl p
where
cl = liftM (nub . rmPath . concat) . mapM fCF . map addToPath . split ':'
addToPath = flip (++) ("/" ++ str)
fCF = filenameCompletionFunction
rmPath :: [String] -> [String]
rmPath s =
map (reverse . fst . break (=='/') . reverse) s
split :: Eq a => a -> [a] -> [[a]]
split _ [] = []
split e l =
f : split e (rest ls)
where
(f,ls) = span (/=e) l
rest s | s == [] = []
| otherwise = tail s

View File

@@ -1,44 +0,0 @@
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.SimpleStacking
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- A module to be used to obtain a simple "memory" of stacking order.
--
-----------------------------------------------------------------------------
module XMonadContrib.SimpleStacking (
-- * Usage
-- $usage
simpleStacking
) where
import Data.Maybe ( catMaybes )
import Data.List ( nub, lookup )
import StackSet ( focus, up, down )
import Graphics.X11.Xlib ( Window )
import XMonad
import XMonadContrib.LayoutHelpers
-- $usage
-- You can use this module for
-- See, for instance, "XMonadContrib.Tabbed"
simpleStacking :: Layout Window -> Layout Window
simpleStacking = simpleStacking' []
simpleStacking' :: [Window] -> Layout Window -> Layout Window
simpleStacking' st = layoutModify dl idModMod
where dl _ s wrs = let m = map (\ (w,rr) -> (w,(w,rr))) wrs
wrs' = catMaybes $ map ((flip lookup) m) $
nub (focus s : st ++ map fst wrs)
st' = focus s:filter (`elem` (up s++down s)) st
in return (wrs', Just (simpleStacking' st'))

View File

@@ -1,34 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XmonadContrib.SinkAll
-- License : BSD3-style (see LICENSE)
-- Stability : unstable
-- Portability : unportable
--
-- Provides a simple binding that pushes all floating windows on the current
-- workspace back into tiling.
-----------------------------------------------------------------------------
module XMonadContrib.SinkAll (
-- * Usage
-- $usage
sinkAll) where
import Operations
import XMonad
import StackSet hiding (sink)
import Control.Monad.State
import Graphics.X11.Xlib
-- $usage
-- > import XMonadContrib.SinkAll
-- > keys = [ ((modMask .|. shiftMask, xK_t), sinkAll) ]
sinkAll :: X ()
sinkAll = withAll sink
-- Apply a function to all windows on current workspace.
withAll :: (Window -> X a) -> X ()
withAll f = gets (integrate' . stack . workspace . current . windowset) >>=
mapM_ f

View File

@@ -1,60 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.SshPrompt
-- Copyright : (C) 2007 Andrea Rossato
-- License : BSD3
--
-- Maintainer : andrea.rossato@unibz.it
-- Stability : unstable
-- Portability : unportable
--
-- A ssh prompt for XMonad
--
-----------------------------------------------------------------------------
module XMonadContrib.SshPrompt (
-- * Usage
-- $usage
sshPrompt
) where
import XMonad
import XMonadContrib.XPrompt
import XMonadContrib.RunInXTerm
import Control.Monad
import System.Directory
import System.Environment
-- $usage
-- 1. In Config.hs add:
--
-- > import XMonadContrib.XPrompt
-- > import XMonadContrib.SshPrompt
--
-- 3. In your keybindings add something like:
--
-- > , ((modMask .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
--
data Ssh = Ssh
instance XPrompt Ssh where
showXPrompt Ssh = "SSH to: "
sshPrompt :: XPConfig -> X ()
sshPrompt c = do
sc <- io $ sshComplList
mkXPrompt Ssh c (mkComplFunFromList sc) ssh
ssh :: String -> X ()
ssh s = runInXTerm ("ssh " ++ s)
sshComplList :: IO [String]
sshComplList = do
h <- getEnv "HOME"
let kh = h ++ "/.ssh/known_hosts"
f <- doesFileExist kh
if f then do l <- readFile kh
return $ map (takeWhile (/= ',') . concat . take 1 . words) (lines l)
else return []

View File

@@ -1,62 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Submap
-- Copyright : (c) Jason Creighton <jcreigh@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Jason Creighton <jcreigh@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- A module that allows the user to create a sub-mapping of keys bindings.
--
-----------------------------------------------------------------------------
module XMonadContrib.Submap (
-- * Usage
-- $usage
submap
) where
import Control.Monad.Reader
import XMonad
import Operations (cleanMask)
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras
import qualified Data.Map as M
{- $usage
Allows you to create a sub-mapping of keys. Example:
> , ((modMask, xK_a), submap . M.fromList $
> [ ((0, xK_n), spawn "mpc next")
> , ((0, xK_p), spawn "mpc prev")
> , ((0, xK_z), spawn "mpc random")
> , ((0, xK_space), spawn "mpc toggle")
> ])
So, for example, to run 'spawn \"mpc next\"', you would hit mod-a (to trigger the
submapping) and then 'n' to run that action. (0 means \"no modifier\"). You are,
of course, free to use any combination of modifiers in the submapping. However,
anyModifier will not work, because that is a special value passed to XGrabKey()
and not an actual modifier.
-}
submap :: M.Map (KeyMask, KeySym) (X ()) -> X ()
submap keys = do
XConf { theRoot = root, display = d } <- ask
io $ grabKeyboard d root False grabModeAsync grabModeAsync currentTime
keyspec <- io $ allocaXEvent $ \p -> fix $ \nextkey -> do
maskEvent d keyPressMask p
KeyEvent { ev_keycode = code, ev_state = m } <- getEvent p
keysym <- keycodeToKeysym d code 0
if isModifierKey keysym
then nextkey
else return (cleanMask m, keysym)
io $ ungrabKeyboard d currentTime
whenJust (M.lookup keyspec keys) id

View File

@@ -1,161 +0,0 @@
{-# OPTIONS_GHC -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.SwitchTrans
-- Copyright : (c) Lukas Mai
-- License : BSD-style (see LICENSE)
--
-- Maintainer : <l.mai@web.de>
-- Stability : unstable
-- Portability : unportable
--
--
-- Ordinary layout transformers are simple and easy to use but inflexible.
-- This module provides a more structured interface to them.
--
-- The basic idea is to have a base layout and a set of layout transformers,
-- of which at most one is active at any time. Enabling another transformer
-- first disables any currently active transformer; i.e. it works like
-- a group of radio buttons.
--
-- A side effect of this meta-layout is that layout transformers no longer
-- receive any messages; any message not handled by @SwitchTrans@ itself
-- will undo the current layout transformer, pass the message on to the base
-- layout, then reapply the transformer.
--
-- Here's how you might use this in Config.hs:
--
-- > defaultLayouts =
-- > map (
-- > mkSwitch (M.singleton "full" (const $ noBorders full)) .
-- > mkSwitch (M.singleton "mirror" mirror)
-- > ) [ tiled ]
--
-- (The noBorders transformer is from "XMonadContrib.NoBorders".)
--
-- This example is probably overkill but it's very close to what I actually use.
-- Anyway, this layout behaves like the default @tiled@ layout, until you send it
-- @Enable@\/@Disable@\/@Toggle@ messages. From the definition of @keys@:
--
-- > ...
-- > , ((modMask, xK_f ), sendMessage $ Toggle "full")
-- > , ((modMask, xK_r ), sendMessage $ Toggle "mirror")
--
-- (You may want to use other keys. I don't use Xinerama so the default mod-r
-- binding is useless to me.)
--
-- After this, pressing @mod-f@ switches the current window to fullscreen mode.
-- Pressing @mod-f@ again switches it back. Similarly, @mod-r@ rotates the layout
-- by 90 degrees (and back). The nice thing is that your changes are kept:
-- Rotating first then changing the size of the master area then rotating back
-- does not undo the master area changes.
--
-- The reason I use two stacked @SwitchTrans@ transformers instead of
-- @mkSwitch (M.fromList [("full", const $ noBorders full), ("mirror", mirror)])@
-- is that I use @mod-f@ to \"zoom in\" on interesting windows, no matter what other
-- layout transformers may be active. Having an extra fullscreen mode on top of
-- everything else means I can zoom in and out without implicitly undoing \"normal\"
-- layout transformers, like @mirror@. Remember, inside a @SwitchTrans@ there can
-- be at most one active layout transformer.
-----------------------------------------------------------------------------
module XMonadContrib.SwitchTrans (
Toggle(..),
Enable(..),
Disable(..),
mkSwitch
) where
import XMonad
import Operations
import qualified Data.Map as M
import Data.Map (Map)
-- | Toggle the specified layout transformer.
data Toggle = Toggle String deriving (Eq, Typeable)
instance Message Toggle
-- | Enable the specified transformer.
data Enable = Enable String deriving (Eq, Typeable)
instance Message Enable
-- | Disable the specified transformer.
data Disable = Disable String deriving (Eq, Typeable)
instance Message Disable
data State a = State {
base :: Layout a,
currTag :: Maybe String,
currLayout :: Layout a,
currFilt :: Layout a -> Layout a,
filters :: Map String (Layout a -> Layout a)
}
-- | Take a transformer table and a base layout, and return a
-- SwitchTrans layout.
mkSwitch :: Map String (Layout a -> Layout a) -> Layout a -> Layout a
mkSwitch fs b = switched st
where
st = State{
base = b,
currTag = Nothing,
currLayout = b,
currFilt = id,
filters = fs }
provided :: Bool -> X (Maybe a) -> X (Maybe a)
provided c x
| c = x
| otherwise = return Nothing
switched :: State a -> Layout a
switched
state@State{
base = b,
currTag = ct,
currLayout = cl,
currFilt = cf,
filters = fs
} = Layout {doLayout = dl, modifyLayout = ml}
where
enable tag alt = do
modifyLayout cl (SomeMessage UnDoLayout)
return . Just . switched $ state{
currTag = Just tag,
currFilt = alt,
currLayout = alt b }
disable = do
modifyLayout cl (SomeMessage UnDoLayout)
return . Just . switched $ state{
currTag = Nothing,
currFilt = id,
currLayout = b }
dl r s = do
(x, _) <- doLayout cl r s
return (x, Nothing) -- sorry Dave, I can't let you do that
ml m
| Just (Disable tag) <- fromMessage m
, M.member tag fs
= provided (ct == Just tag) $ disable
| Just (Enable tag) <- fromMessage m
, Just alt <- M.lookup tag fs
= provided (ct /= Just tag) $ enable tag alt
| Just (Toggle tag) <- fromMessage m
, Just alt <- M.lookup tag fs
=
if (ct == Just tag) then
disable
else
enable tag alt
| Just UnDoLayout <- fromMessage m
= do
modifyLayout cl m
return Nothing
| otherwise = do
x <- modifyLayout b m
case x of
Nothing -> return Nothing
Just b' -> do
modifyLayout cl (SomeMessage UnDoLayout)
return . Just $ switched state{
base = b',
currLayout = cf b' }

143
Tabbed.hs
View File

@@ -1,143 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Tabbed
-- Copyright : (c) David Roundy
-- License : BSD-style (see xmonad/LICENSE)
--
-- Maintainer : email@address.com
-- Stability : unstable
-- Portability : unportable
--
-- A tabbed layout for the Xmonad Window Manager
--
-----------------------------------------------------------------------------
module XMonadContrib.Tabbed (
-- * Usage:
-- $usage
tabbed
, Shrinker, shrinkText
, TConf (..), defaultTConf
) where
import Control.Monad.State ( gets )
import Graphics.X11.Xlib
import XMonad
import XMonadContrib.Decoration
import Operations ( focus, initColor )
import qualified StackSet as W
import XMonadContrib.NamedWindows
import XMonadContrib.SimpleStacking ( simpleStacking )
import XMonadContrib.LayoutHelpers ( idModify )
-- $usage
-- You can use this module with the following in your configuration file:
--
-- > import XMonadContrib.Tabbed
--
-- > defaultLayouts :: [Layout Window]
-- > defaultLayouts = [ tabbed shrinkText defaultTConf
-- > , ... ]
--
-- You can also edit the default configuration options.
--
-- > myconfig = defaultTConf { inactiveBolderColor = "#FF0000"
-- > , activeTextColor = "#00FF00"}
--
-- and
--
-- > defaultLayouts = [ tabbed shrinkText myconfig
-- > , ... ]
data TConf =
TConf { activeColor :: String
, inactiveColor :: String
, activeBorderColor :: String
, inactiveTextColor :: String
, inactiveBorderColor :: String
, activeTextColor :: String
, fontName :: String
, tabSize :: Int
} deriving (Show, Read)
defaultTConf :: TConf
defaultTConf =
TConf { activeColor ="#999999"
, inactiveColor = "#666666"
, activeBorderColor = "#FFFFFF"
, inactiveBorderColor = "#BBBBBB"
, activeTextColor = "#FFFFFF"
, inactiveTextColor = "#BFBFBF"
, fontName = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
, tabSize = 20
}
tabbed :: Shrinker -> TConf -> Layout Window
tabbed s t = simpleStacking $ tabbed' s t
tabbed' :: Shrinker -> TConf -> Layout Window
tabbed' shrinkT config = Layout { doLayout = dolay shrinkT config, modifyLayout = idModify }
dolay :: Shrinker -> TConf
-> Rectangle -> W.Stack Window -> X ([(Window, Rectangle)], Maybe (Layout Window))
dolay _ _ sc (W.Stack w [] []) = return ([(w,sc)], Nothing)
dolay shr conf sc@(Rectangle x y wid _) s = withDisplay $ \dpy ->
do ac <- io $ initColor dpy $ activeColor conf
ic <- io $ initColor dpy $ inactiveColor conf
abc <- io $ initColor dpy $ activeBorderColor conf
ibc <- io $ initColor dpy $ inactiveBorderColor conf
atc <- io $ initColor dpy $ activeTextColor conf
itc <- io $ initColor dpy $ inactiveTextColor conf
let ws = W.integrate s
ts = gentabs conf x y wid (length ws)
tws = zip ts ws
focusColor w incol actcol = (maybe incol (\focusw -> if focusw == w
then actcol else incol) . W.peek)
`fmap` gets windowset
make_tabs [] l = return l
make_tabs (tw':tws') l = do bc <- focusColor (snd tw') ibc abc
l' <- maketab tw' bc l
make_tabs tws' l'
maketab (t,ow) bg = newDecoration ow t 1 bg ac
(fontName conf) (drawtab t ow) (focus ow)
drawtab r@(Rectangle _ _ wt ht) ow d w' gc fn =
do nw <- getName ow
(fc,tc) <- focusColor ow (ic,itc) (ac,atc)
io $ setForeground d gc fc
io $ fillRectangles d w' gc [Rectangle 0 0 wt ht]
io $ setForeground d gc tc
centerText d w' gc fn r (show nw)
centerText d w' gc fontst (Rectangle _ _ wt ht) name =
do let (_,asc,_,_) = textExtents fontst name
name' = shrinkWhile shr (\n -> textWidth fontst n >
fromIntegral wt - fromIntegral (ht `div` 2)) name
width = textWidth fontst name'
io $ drawString d w' gc
(fromIntegral (wt `div` 2) - fromIntegral (width `div` 2))
((fromIntegral ht + fromIntegral asc) `div` 2) name'
l' <- make_tabs tws $ tabbed shr conf
return (map (\w -> (w,shrink conf sc)) ws, Just l')
type Shrinker = String -> [String]
shrinkWhile :: Shrinker -> (String -> Bool) -> String -> String
shrinkWhile sh p x = sw $ sh x
where sw [n] = n
sw [] = ""
sw (n:ns) | p n = sw ns
| otherwise = n
shrinkText :: Shrinker
shrinkText "" = [""]
shrinkText cs = cs : shrinkText (init cs)
shrink :: TConf -> Rectangle -> Rectangle
shrink c (Rectangle x y w h) = Rectangle x (y + fromIntegral (tabSize c)) w (h - fromIntegral (tabSize c))
gentabs :: TConf -> Position -> Position -> Dimension -> Int -> [Rectangle]
gentabs _ _ _ _ 0 = []
gentabs c x y w num = Rectangle x y (wid - 2) (fromIntegral (tabSize c) - 2)
: gentabs c (x + fromIntegral wid) y (w - wid) (num - 1)
where wid = w `div` (fromIntegral num)

View File

@@ -1,72 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.ThreeColumns
-- Copyright : (c) Kai Grossjohann <kai@emptydomain.de>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : ?
-- Stability : unstable
-- Portability : unportable
--
-- A layout similar to tall but with three columns.
--
-----------------------------------------------------------------------------
module XMonadContrib.ThreeColumns (
-- * Usage
-- $usage
threeCol
) where
import XMonad
import qualified StackSet as W
import Operations ( Resize(..), IncMasterN(..), splitVertically, splitHorizontallyBy )
import Data.Ratio
--import Control.Monad.State
import Control.Monad.Reader
import Graphics.X11.Xlib
-- $usage
--
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.ThreeColumns
--
-- and add, to the list of layouts:
--
-- > threeCol
threeCol :: Int -> Rational -> Rational -> Layout a
threeCol nmaster delta frac =
Layout { doLayout = \r -> return . (\x->(x,Nothing)) .
ap zip (tile3 frac r nmaster . length) . W.integrate
, modifyLayout = \m -> return $ msum [fmap resize (fromMessage m)
,fmap incmastern (fromMessage m)] }
where resize Shrink = threeCol nmaster delta (max 0 $ frac-delta)
resize Expand = threeCol nmaster delta (min 1 $ frac+delta)
incmastern (IncMasterN d) = threeCol (max 0 (nmaster+d)) delta frac
-- | tile3. Compute window positions using 3 panes
tile3 :: Rational -> Rectangle -> Int -> Int -> [Rectangle]
tile3 f r nmaster n
| n <= nmaster || nmaster == 0 = splitVertically n r
| n <= nmaster+1 = splitVertically nmaster s1 ++ splitVertically (n-nmaster) s2
| otherwise = splitVertically nmaster r1 ++ splitVertically nmid r2 ++ splitVertically nright r3
where (r1, r2, r3) = split3HorizontallyBy f r
(s1, s2) = splitHorizontallyBy f r
nslave = (n - nmaster)
nmid = ceiling (nslave % 2)
nright = (n - nmaster - nmid)
split3HorizontallyBy :: Rational -> Rectangle -> (Rectangle, Rectangle, Rectangle)
split3HorizontallyBy f (Rectangle sx sy sw sh) =
( Rectangle sx sy leftw sh
, Rectangle (sx + fromIntegral leftw) sy midw sh
, Rectangle (sx + fromIntegral leftw + fromIntegral midw) sy rightw sh )
where leftw = ceiling $ fromIntegral sw * (2/3) * f
midw = ceiling ( (sw - leftw) % 2 )
rightw = sw - leftw - midw

View File

@@ -1,50 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.TwoPane
-- Copyright : (c) Spencer Janssen <sjanssen@cse.unl.edu>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Spencer Janssen <sjanssen@cse.unl.edu>
-- Stability : unstable
-- Portability : unportable
--
-- A layout that splits the screen horizontally and shows two windows. The
-- left window is always the master window, and the right is either the
-- currently focused window or the second window in layout order.
--
-----------------------------------------------------------------------------
module XMonadContrib.TwoPane (
-- * Usage
-- $usage
twoPane
) where
import XMonad
import Operations ( Resize(..), splitHorizontallyBy )
import StackSet ( focus, up, down)
-- $usage
--
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.TwoPane
--
-- and add, to the list of layouts:
--
-- > twoPane defaultDelta (1%2)
twoPane :: Rational -> Rational -> Layout a
twoPane delta split = Layout { doLayout = \r s -> return (arrange r s,Nothing), modifyLayout = message }
where
arrange rect st = case reverse (up st) of
(master:_) -> [(master,left),(focus st,right)]
[] -> case down st of
(next:_) -> [(focus st,left),(next,right)]
[] -> [(focus st, rect)]
where (left, right) = splitHorizontallyBy split rect
message x = return $ case fromMessage x of
Just Shrink -> Just (twoPane delta (split - delta))
Just Expand -> Just (twoPane delta (split + delta))
_ -> Nothing

View File

@@ -1,28 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.ViewPrev
-- Copyright : (c) Nelson Elhage <nelhage@mit.edu>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Nelson Elhage <nelhage@mit.edu>
-- Stability : unstable
-- Portability : unportable
--
-- A module that implements a command to switch to the previously
-- viewed workspace
--
-----------------------------------------------------------------------------
module XMonadContrib.ViewPrev (
viewPrev
) where
import XMonad
import Operations
import qualified StackSet as W
viewPrev' :: (Eq a, Eq s, Eq i) => W.StackSet i a s sd -> W.StackSet i a s sd
viewPrev' x = W.view (W.tag . head . W.hidden $ x) x
viewPrev :: X ()
viewPrev = windows viewPrev'

71
Warp.hs
View File

@@ -1,71 +0,0 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.Warp
-- Copyright : (c) daniel@wagner-home.com
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : daniel@wagner-home.com
-- Stability : unstable
-- Portability : unportable
--
-- This can be used to make a keybinding that warps the pointer to a given
-- window or screen.
--
-----------------------------------------------------------------------------
module XMonadContrib.Warp (
-- * Usage
-- $usage
warpToScreen,
warpToWindow
) where
import Data.Ratio
import Data.Maybe
import Data.List
import Control.Monad.RWS
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras
import Operations
import XMonad
import StackSet as W
{- $usage
This can be used to make a keybinding that warps the pointer to a given
window or screen. For example, I've added the following keybindings to
my Config.hs:
> , ((modMask, xK_z ), warpToWindow (1%2) (1%2)) -- @@ Move pointer to currently focused window
>
>-- mod-ctrl-{w,e,r} @@ Move mouse pointer to screen 1, 2, or 3
>
> [((modMask .|. controlMask, key), warpToScreen sc (1%2) (1%2))
> | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]]
Note that warping to a particular screen may change the focus.
-}
fraction :: (Integral a, Integral b) => Rational -> a -> b
fraction f x = floor (f * fromIntegral x)
ix :: Int -> [a] -> Maybe a
ix n = listToMaybe . take 1 . drop n
warp :: Window -> Position -> Position -> X ()
warp w x y = withDisplay $ \d -> io $ warpPointer d none w 0 0 0 0 x y
warpToWindow :: Rational -> Rational -> X ()
warpToWindow h v =
withDisplay $ \d ->
withFocused $ \w -> do
wa <- io $ getWindowAttributes d w
warp w (fraction h (wa_width wa)) (fraction v (wa_height wa))
warpToScreen :: ScreenId -> Rational -> Rational -> X ()
warpToScreen n h v = do
root <- asks theRoot
(StackSet {current = x, visible = xs}) <- gets windowset
whenJust (fmap (screenRect . W.screenDetail) . find ((n==) . W.screen) $ x : xs)
$ \r ->
warp root (rect_x r + fraction h (rect_width r))
(rect_y r + fraction v (rect_height r))

View File

@@ -1,64 +0,0 @@
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.WorkspaceDir
-- Copyright : (c) 2007 David Roundy <droundy@darcs.net>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : David Roundy <droundy@darcs.net>
-- Stability : unstable
-- Portability : unportable
--
-- WorkspaceDir is an exstension to set the current directory in a workspace.
--
-- Actually, it sets the current directory in a layout, since there's no way I
-- know of to attach a behavior to a workspace. This means that any terminals
-- (or other programs) pulled up in that workspace (with that layout) will
-- execute in that working directory. Sort of handy, I think.
--
-----------------------------------------------------------------------------
module XMonadContrib.WorkspaceDir (
-- * Usage
-- $usage
workspaceDir,
changeDir
) where
import System.Directory ( setCurrentDirectory )
import XMonad
import Operations ( sendMessage )
import XMonadContrib.Dmenu ( runProcessWithInput )
import XMonadContrib.XPrompt ( XPConfig )
import XMonadContrib.DirectoryPrompt ( directoryPrompt )
import XMonadContrib.LayoutHelpers ( layoutModify )
import XMonadContrib.XPrompt ( defaultXPConfig )
-- $usage
-- You can use this module with the following in your Config.hs file:
--
-- > import XMonadContrib.WorkspaceDir
-- >
-- > defaultLayouts = map (workspaceDir "~") [ tiled, ... ]
--
-- In keybindings:
--
-- > , ((modMask .|. shiftMask, xK_x ), changeDir defaultXPConfig)
data Chdir = Chdir String deriving ( Typeable )
instance Message Chdir
workspaceDir :: String -> Layout a -> Layout a
workspaceDir wd = layoutModify dowd modwd
where dowd _ _ rws = scd wd >> return (rws, Nothing)
modwd m = return $ do Chdir wd' <- fromMessage m
Just $ workspaceDir wd'
scd :: String -> X ()
scd x = do x' <- io (runProcessWithInput "bash" [] ("echo -n " ++ x) `catch` \_ -> return x)
catchIO $ setCurrentDirectory x'
changeDir :: XPConfig -> X ()
changeDir c = directoryPrompt c "Set working directory: " (sendMessage . Chdir)

View File

@@ -0,0 +1,71 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.AfterDrag
-- Copyright : (c) 2014 Anders Engstrom <ankaan@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Anders Engstrom <ankaan@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- Perform an action after the current mouse drag is completed.
-----------------------------------------------------------------------------
module XMonad.Actions.AfterDrag (
-- * Usage
-- $usage
afterDrag,
ifClick,
ifClick') where
import XMonad
import System.Time
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.AfterDrag
--
-- Then add appropriate mouse bindings, for example:
--
-- > , ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> ifClick (windows $ W.float w $ W.RationalRect 0 0 1 1)))
--
-- This will allow you to resize windows as usual, but if you instead of
-- draging click the mouse button the window will be automatically resized to
-- fill the whole screen.
--
-- For detailed instructions on editing your mouse bindings, see
-- "XMonad.Doc.Extending#Editing_mouse_bindings".
--
-- More practical examples are available in "XMonad.Actions.FloatSnap".
-- | Schedule a task to take place after the current dragging is completed.
afterDrag
:: X () -- ^ The task to schedule.
-> X ()
afterDrag task = do drag <- gets dragging
case drag of
Nothing -> return () -- Not dragging
Just (motion, cleanup) -> modify $ \s -> s { dragging = Just(motion, cleanup >> task) }
-- | Take an action if the current dragging can be considered a click,
-- supposing the drag just started before this function is called.
-- A drag is considered a click if it is completed within 300 ms.
ifClick
:: X () -- ^ The action to take if the dragging turned out to be a click.
-> X ()
ifClick action = ifClick' 300 action (return ())
-- | Take an action if the current dragging is completed within a certain time (in milliseconds.)
ifClick'
:: Int -- ^ Maximum time of dragging for it to be considered a click (in milliseconds.)
-> X () -- ^ The action to take if the dragging turned out to be a click.
-> X () -- ^ The action to take if the dragging turned out to not be a click.
-> X ()
ifClick' ms click drag = do
start <- io $ getClockTime
afterDrag $ do
stop <- io $ getClockTime
if diffClockTimes stop start <= noTimeDiff { tdPicosec = fromIntegral ms * 10^(9 :: Integer) }
then click
else drag

View File

@@ -0,0 +1,83 @@
----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.BluetileCommands
-- Copyright : (c) Jan Vornberger 2009
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : jan.vornberger@informatik.uni-oldenburg.de
-- Stability : unstable
-- Portability : not portable
--
-- This is a list of selected commands that can be made available using
-- "XMonad.Hooks.ServerMode" to allow external programs to control
-- the window manager. Bluetile (<http://projects.haskell.org/bluetile/>)
-- uses this to enable its dock application to do things like changing
-- workspaces and layouts.
--
-----------------------------------------------------------------------------
module XMonad.Actions.BluetileCommands (
-- * Usage
-- $usage
bluetileCommands
) where
import XMonad
import qualified XMonad.StackSet as W
import XMonad.Layout.LayoutCombinators
import System.Exit
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Hooks.ServerMode
-- > import XMonad.Actions.BluetileCommands
--
-- Then edit your @handleEventHook@:
--
-- > main = xmonad def { handleEventHook = serverModeEventHook' bluetileCommands }
--
-- See the documentation of "XMonad.Hooks.ServerMode" for details on
-- how to actually invoke the commands from external programs.
workspaceCommands :: Int -> X [(String, X ())]
workspaceCommands sid = asks (workspaces . config) >>= \spaces -> return
[(("greedyView" ++ show i),
activateScreen sid >> windows (W.greedyView i))
| i <- spaces ]
layoutCommands :: Int -> [(String, X ())]
layoutCommands sid = [ ("layout floating" , activateScreen sid >>
sendMessage (JumpToLayout "Floating"))
, ("layout tiled1" , activateScreen sid >>
sendMessage (JumpToLayout "Tiled1"))
, ("layout tiled2" , activateScreen sid >>
sendMessage (JumpToLayout "Tiled2"))
, ("layout fullscreen" , activateScreen sid >>
sendMessage (JumpToLayout "Fullscreen"))
]
masterAreaCommands :: Int -> [(String, X ())]
masterAreaCommands sid = [ ("increase master n", activateScreen sid >>
sendMessage (IncMasterN 1))
, ("decrease master n", activateScreen sid >>
sendMessage (IncMasterN (-1)))
]
quitCommands :: [(String, X ())]
quitCommands = [ ("quit bluetile", io (exitWith ExitSuccess))
, ("quit bluetile and start metacity", restart "metacity" False)
]
bluetileCommands :: X [(String, X ())]
bluetileCommands = do
let restartCommand = [ ("restart bluetile", restart "bluetile" True) ]
wscmds0 <- workspaceCommands 0
wscmds1 <- workspaceCommands 1
return $ restartCommand
++ wscmds0 ++ layoutCommands 0 ++ masterAreaCommands 0 ++ quitCommands
++ wscmds1 ++ layoutCommands 1 ++ masterAreaCommands 1 ++ quitCommands
activateScreen :: Int -> X ()
activateScreen sid = screenWorkspace (S sid) >>= flip whenJust (windows . W.view)

127
XMonad/Actions/Commands.hs Normal file
View File

@@ -0,0 +1,127 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.Commands
-- Copyright : (c) David Glasser 2007
-- License : BSD3
--
-- Maintainer : glasser@mit.edu
-- Stability : stable
-- Portability : portable
--
-- Allows you to run internal xmonad commands (X () actions) using
-- a dmenu menu in addition to key bindings. Requires dmenu and
-- the Dmenu XMonad.Actions module.
--
-----------------------------------------------------------------------------
module XMonad.Actions.Commands (
-- * Usage
-- $usage
commandMap,
runCommand,
runCommandConfig,
runCommand',
workspaceCommands,
screenCommands,
defaultCommands
) where
import XMonad
import XMonad.StackSet hiding (workspaces)
import XMonad.Util.Dmenu (dmenu)
import qualified Data.Map as M
import System.Exit
import Data.Maybe
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.Commands
--
-- Then add a keybinding to the runCommand action:
--
-- > , ((modm .|. controlMask, xK_y), commands >>= runCommand)
--
-- and define the list of commands you want to use:
--
-- > commands :: X [(String, X ())]
-- > commands = defaultCommands
--
-- Whatever key you bound to will now cause a popup menu of internal
-- xmonad commands to appear. You can change the commands by changing
-- the contents of the list returned by 'commands'. (If you like it
-- enough, you may even want to get rid of many of your other key
-- bindings!)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Create a 'Data.Map.Map' from @String@s to xmonad actions from a
-- list of pairs.
commandMap :: [(String, X ())] -> M.Map String (X ())
commandMap c = M.fromList c
-- | Generate a list of commands to switch to\/send windows to workspaces.
workspaceCommands :: X [(String, X ())]
workspaceCommands = asks (workspaces . config) >>= \spaces -> return
[((m ++ show i), windows $ f i)
| i <- spaces
, (f, m) <- [(view, "view"), (shift, "shift")] ]
-- | Generate a list of commands dealing with multiple screens.
screenCommands :: [(String, X ())]
screenCommands = [((m ++ show sc), screenWorkspace (fromIntegral sc) >>= flip whenJust (windows . f))
| sc <- [0, 1]::[Int] -- TODO: adapt to screen changes
, (f, m) <- [(view, "screen"), (shift, "screen-to-")]
]
-- | A nice pre-defined list of commands.
defaultCommands :: X [(String, X ())]
defaultCommands = do
wscmds <- workspaceCommands
return $ wscmds ++ screenCommands ++ otherCommands
where
otherCommands =
[ ("shrink" , sendMessage Shrink )
, ("expand" , sendMessage Expand )
, ("next-layout" , sendMessage NextLayout )
, ("default-layout" , asks (layoutHook . config) >>= setLayout )
, ("restart-wm" , restart "xmonad" True )
, ("restart-wm-no-resume", restart "xmonad" False )
, ("xterm" , spawn =<< asks (terminal . config) )
, ("run" , spawn "exe=`dmenu_path | dmenu -b` && exec $exe" )
, ("kill" , kill )
, ("refresh" , refresh )
, ("focus-up" , windows focusUp )
, ("focus-down" , windows focusDown )
, ("swap-up" , windows swapUp )
, ("swap-down" , windows swapDown )
, ("swap-master" , windows swapMaster )
, ("sink" , withFocused $ windows . sink )
, ("quit-wm" , io $ exitWith ExitSuccess )
]
-- | Given a list of command\/action pairs, prompt the user to choose a
-- command using dmenu and return the corresponding action.
runCommand :: [(String, X ())] -> X ()
runCommand = runCommandConfig dmenu
-- | Given a list of command\/action pairs, prompt the user to choose a
-- command using dmenu-compatible launcher and return the corresponding action.
-- See X.U.Dmenu for compatible launchers.
runCommandConfig :: ([String] -> X String) -> [(String, X ())] -> X()
runCommandConfig f cl = do
let m = commandMap cl
choice <- f (M.keys m)
fromMaybe (return ()) (M.lookup choice m)
-- | Given the name of a command from 'defaultCommands', return the
-- corresponding action (or the null action if the command is not
-- found).
runCommand' :: String -> X ()
runCommand' c = do
m <- fmap commandMap defaultCommands
fromMaybe (return ()) (M.lookup c m)

View File

@@ -0,0 +1,57 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.ConstrainedResize
-- Copyright : (c) Dougal Stanton
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : <dougal@dougalstanton.net>
-- Stability : stable
-- Portability : unportable
--
-- Lets you constrain the aspect ratio of a floating
-- window (by, say, holding shift while you resize).
--
-- Useful for making a nice circular XClock window.
--
-----------------------------------------------------------------------------
module XMonad.Actions.ConstrainedResize (
-- * Usage
-- $usage
XMonad.Actions.ConstrainedResize.mouseResizeWindow
) where
import XMonad
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import qualified XMonad.Actions.ConstrainedResize as Sqr
--
-- Then add something like the following to your mouse bindings:
--
-- > , ((modm, button3), (\w -> focus w >> Sqr.mouseResizeWindow w False))
-- > , ((modm .|. shiftMask, button3), (\w -> focus w >> Sqr.mouseResizeWindow w True ))
--
-- The line without the shiftMask replaces the standard mouse resize
-- function call, so it's not completely necessary but seems neater
-- this way.
--
-- For detailed instructions on editing your mouse bindings, see
-- "XMonad.Doc.Extending#Editing_mouse_bindings".
-- | Resize (floating) window with optional aspect ratio constraints.
mouseResizeWindow :: Window -> Bool -> X ()
mouseResizeWindow w c = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
sh <- io $ getWMNormalHints d w
io $ warpPointer d none w 0 0 0 0 (fromIntegral (wa_width wa)) (fromIntegral (wa_height wa))
mouseDrag (\ex ey -> do
let x = ex - fromIntegral (wa_x wa)
y = ey - fromIntegral (wa_y wa)
sz = if c then (max x y, max x y) else (x,y)
io $ resizeWindow d w `uncurry`
applySizeHintsContents sh sz)
(float w)

View File

@@ -0,0 +1,165 @@
{-# LANGUAGE PatternGuards #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.CopyWindow
-- Copyright : (c) David Roundy <droundy@darcs.net>, Ivan Veselov <veselov@gmail.com>, Lanny Ripple <lan3ny@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : ???
-- Stability : unstable
-- Portability : unportable
--
-- Provides bindings to duplicate a window on multiple workspaces,
-- providing dwm-like tagging functionality.
--
-----------------------------------------------------------------------------
module XMonad.Actions.CopyWindow (
-- * Usage
-- $usage
copy, copyToAll, copyWindow, runOrCopy
, killAllOtherCopies, kill1
-- * Highlight workspaces containing copies in logHook
-- $logHook
, wsContainingCopies
) where
import XMonad
import Control.Arrow ((&&&))
import qualified Data.List as L
import XMonad.Actions.WindowGo
import qualified XMonad.StackSet as W
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file:
--
-- > import XMonad.Actions.CopyWindow
--
-- Then add something like this to your keybindings:
--
-- > -- mod-[1..9] @@ Switch to workspace N
-- > -- mod-shift-[1..9] @@ Move client to workspace N
-- > -- mod-control-shift-[1..9] @@ Copy client to workspace N
-- > [((m .|. modm, k), windows $ f i)
-- > | (i, k) <- zip (workspaces x) [xK_1 ..]
-- > , (f, m) <- [(W.view, 0), (W.shift, shiftMask), (copy, shiftMask .|. controlMask)]]
--
-- To use the above key bindings you need also to import
-- "XMonad.StackSet":
--
-- > import qualified XMonad.StackSet as W
--
-- You may also wish to redefine the binding to kill a window so it only
-- removes it from the current workspace, if it's present elsewhere:
--
-- > , ((modm .|. shiftMask, xK_c ), kill1) -- @@ Close the focused window
--
-- Instead of copying a window from one workspace to another maybe you don't
-- want to have to remember where you placed it. For that consider:
--
-- > , ((modm, xK_b ), runOrCopy "firefox" (className =? "Firefox")) -- @@ run or copy firefox
--
-- Another possibility which this extension provides is 'making window
-- always visible' (i.e. always on current workspace), similar to corresponding
-- metacity functionality. This behaviour is emulated through copying given
-- window to all the workspaces and then removing it when it's unneeded on
-- all workspaces any more.
--
-- Here is the example of keybindings which provide these actions:
--
-- > , ((modm, xK_v ), windows copyToAll) -- @@ Make focused window always visible
-- > , ((modm .|. shiftMask, xK_v ), killAllOtherCopies) -- @@ Toggle window state back
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- $logHook
-- To distinguish workspaces containing copies of the focused window use
-- something like:
--
-- > sampleLogHook h = do
-- > copies <- wsContainingCopies
-- > let check ws | ws `elem` copies = pad . xmobarColor "red" "black" $ ws
-- > | otherwise = pad ws
-- > dynamicLogWithPP myPP {ppHidden = check, ppOutput = hPutStrLn h}
-- >
-- > main = do
-- > h <- spawnPipe "xmobar"
-- > xmonad def { logHook = sampleLogHook h }
-- | Copy the focused window to a workspace.
copy :: (Eq s, Eq i, Eq a) => i -> W.StackSet i l a s sd -> W.StackSet i l a s sd
copy n s | Just w <- W.peek s = copyWindow w n s
| otherwise = s
-- | Copy the focused window to all workspaces.
copyToAll :: (Eq s, Eq i, Eq a) => W.StackSet i l a s sd -> W.StackSet i l a s sd
copyToAll s = foldr copy s $ map W.tag (W.workspaces s)
-- | Copy an arbitrary window to a workspace.
copyWindow :: (Eq a, Eq i, Eq s) => a -> i -> W.StackSet i l a s sd -> W.StackSet i l a s sd
copyWindow w n = copy'
where copy' s = if n `W.tagMember` s
then W.view (W.currentTag s) $ insertUp' w $ W.view n s
else s
insertUp' a s = W.modify (Just $ W.Stack a [] [])
(\(W.Stack t l r) -> if a `elem` t:l++r
then Just $ W.Stack t l r
else Just $ W.Stack a (L.delete a l) (L.delete a (t:r))) s
-- | runOrCopy will run the provided shell command unless it can
-- find a specified window in which case it will copy the window to
-- the current workspace. Similar to (i.e., stolen from) "XMonad.Actions.WindowGo".
runOrCopy :: String -> Query Bool -> X ()
runOrCopy = copyMaybe . spawn
-- | Copy a window if it exists, run the first argument otherwise.
copyMaybe :: X () -> Query Bool -> X ()
copyMaybe f qry = ifWindow qry copyWin f
where copyWin = ask >>= \w -> doF (\ws -> copyWindow w (W.currentTag ws) ws)
-- | Remove the focused window from this workspace. If it's present in no
-- other workspace, then kill it instead. If we do kill it, we'll get a
-- delete notify back from X.
--
-- There are two ways to delete a window. Either just kill it, or if it
-- supports the delete protocol, send a delete event (e.g. firefox).
kill1 :: X ()
kill1 = do ss <- gets windowset
whenJust (W.peek ss) $ \w -> if W.member w $ delete'' w ss
then windows $ delete'' w
else kill
where delete'' w = W.modify Nothing (W.filter (/= w))
-- | Kill all other copies of focused window (if they're present).
-- 'All other' means here 'copies which are not on the current workspace'.
killAllOtherCopies :: X ()
killAllOtherCopies = do ss <- gets windowset
whenJust (W.peek ss) $ \w -> windows $
W.view (W.currentTag ss) .
delFromAllButCurrent w
where
delFromAllButCurrent w ss = foldr ($) ss $
map (delWinFromWorkspace w . W.tag) $
W.hidden ss ++ map W.workspace (W.visible ss)
delWinFromWorkspace w wid = viewing wid $ W.modify Nothing (W.filter (/= w))
viewing wis f ss = W.view (W.currentTag ss) $ f $ W.view wis ss
-- | A list of hidden workspaces containing a copy of the focused window.
wsContainingCopies :: X [WorkspaceId]
wsContainingCopies = do
ws <- gets windowset
return $ copiesOfOn (W.peek ws) (taggedWindows $ W.hidden ws)
-- | Get a list of tuples (tag, [Window]) for each workspace.
taggedWindows :: [W.Workspace i l a] -> [(i, [a])]
taggedWindows = map $ W.tag &&& W.integrate' . W.stack
-- | Get tags with copies of the focused window (if present.)
copiesOfOn :: (Eq a) => Maybe a -> [(i, [a])] -> [i]
copiesOfOn foc tw = maybe [] hasCopyOf foc
where hasCopyOf f = map fst $ filter ((f `elem` ) . snd) tw

View File

@@ -0,0 +1,85 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.CycleRecentWS
-- Copyright : (c) Michal Janeczek <janeczek@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Michal Janeczek <janeczek@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- Provides bindings to cycle through most recently used workspaces
-- with repeated presses of a single key (as long as modifier key is
-- held down). This is similar to how many window managers handle
-- window switching.
--
-----------------------------------------------------------------------------
module XMonad.Actions.CycleRecentWS (
-- * Usage
-- $usage
cycleRecentWS,
cycleWindowSets
) where
import XMonad hiding (workspaces)
import XMonad.StackSet
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file:
--
-- > import XMonad.Actions.CycleRecentWS
-- >
-- > , ((modm, xK_Tab), cycleRecentWS [xK_Alt_L] xK_Tab xK_grave)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Cycle through most recent workspaces with repeated presses of a key, while
-- a modifier key is held down. The recency of workspaces previewed while browsing
-- to the target workspace is not affected. That way a stack of most recently used
-- workspaces is maintained, similarly to how many window managers handle window
-- switching. For best effects use the same modkey+key combination as the one used
-- to invoke this action.
cycleRecentWS :: [KeySym] -- ^ A list of modifier keys used when invoking this action.
-- As soon as one of them is released, the final switch is made.
-> KeySym -- ^ Key used to switch to next (less recent) workspace.
-> KeySym -- ^ Key used to switch to previous (more recent) workspace.
-- If it's the same as the nextWorkspace key, it is effectively ignored.
-> X ()
cycleRecentWS = cycleWindowSets options
where options w = map (view `flip` w) (recentTags w)
recentTags w = map tag $ tail (workspaces w) ++ [head (workspaces w)]
cycref :: [a] -> Int -> a
cycref l i = l !! (i `mod` length l)
-- | Cycle through a finite list of WindowSets with repeated presses of a key, while
-- a modifier key is held down. For best effects use the same modkey+key combination
-- as the one used to invoke this action.
cycleWindowSets :: (WindowSet -> [WindowSet]) -- ^ A function used to create a list of WindowSets to choose from
-> [KeySym] -- ^ A list of modifier keys used when invoking this action.
-- As soon as one of them is released, the final WindowSet is chosen and the action exits.
-> KeySym -- ^ Key used to preview next WindowSet from the list of generated options
-> KeySym -- ^ Key used to preview previous WindowSet from the list of generated options.
-- If it's the same as nextOption key, it is effectively ignored.
-> X ()
cycleWindowSets genOptions mods keyNext keyPrev = do
options <- gets $ genOptions . windowset
XConf {theRoot = root, display = d} <- ask
let event = allocaXEvent $ \p -> do
maskEvent d (keyPressMask .|. keyReleaseMask) p
KeyEvent {ev_event_type = t, ev_keycode = c} <- getEvent p
s <- keycodeToKeysym d c 0
return (t, s)
let setOption n = do windows $ const $ options `cycref` n
(t, s) <- io event
case () of
() | t == keyPress && s == keyNext -> setOption (n+1)
| t == keyPress && s == keyPrev -> setOption (n-1)
| t == keyRelease && s `elem` mods -> return ()
| otherwise -> setOption n
io $ grabKeyboard d root False grabModeAsync grabModeAsync currentTime
setOption 0
io $ ungrabKeyboard d currentTime

View File

@@ -0,0 +1,51 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.CycleSelectedLayouts
-- Copyright : (c) Roman Cheplyaka
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Roman Cheplyaka <roma@ro-che.info>
-- Stability : unstable
-- Portability : unportable
--
-- This module allows to cycle through the given subset of layouts.
--
-----------------------------------------------------------------------------
module XMonad.Actions.CycleSelectedLayouts (
-- * Usage
-- $usage
cycleThroughLayouts) where
import XMonad
import Data.List (findIndex)
import Data.Maybe (fromMaybe)
import XMonad.Layout.LayoutCombinators (JumpToLayout(..))
import qualified XMonad.StackSet as S
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad hiding ((|||))
-- > import XMonad.Layout.LayoutCombinators ((|||))
-- > import XMonad.Actions.CycleSelectedLayouts
--
-- > , ((modm, xK_t ), cycleThroughLayouts ["Tall", "Mirror Tall"])
--
-- Make sure you are using NewSelect from XMonad.Layout.LayoutCombinators,
-- rather than the Select defined in xmonad core.
cycleToNext :: (Eq a) => [a] -> a -> Maybe a
cycleToNext lst a = do
-- not beautiful but simple and readable
ind <- findIndex (a==) lst
return $ lst !! if ind == length lst - 1 then 0 else ind+1
-- | If the current layout is in the list, cycle to the next layout. Otherwise,
-- apply the first layout from list.
cycleThroughLayouts :: [String] -> X ()
cycleThroughLayouts lst = do
winset <- gets windowset
let ld = description . S.layout . S.workspace . S.current $ winset
let newld = fromMaybe (head lst) (cycleToNext lst ld)
sendMessage $ JumpToLayout newld

386
XMonad/Actions/CycleWS.hs Normal file
View File

@@ -0,0 +1,386 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.CycleWS
-- Copyright : (c) Joachim Breitner <mail@joachim-breitner.de>,
-- Nelson Elhage <nelhage@mit.edu> (`toggleWS' function)
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Joachim Breitner <mail@joachim-breitner.de>
-- Stability : unstable
-- Portability : unportable
--
-- Provides bindings to cycle forward or backward through the list of
-- workspaces, to move windows between workspaces, and to cycle
-- between screens. More general combinators provide ways to cycle
-- through workspaces in various orders, to only cycle through some
-- subset of workspaces, and to cycle by more than one workspace at a
-- time.
--
-- Note that this module now subsumes the functionality of the former
-- @XMonad.Actions.RotView@. Former users of @rotView@ can simply replace
-- @rotView True@ with @moveTo Next NonEmptyWS@, and so on.
--
-- If you want to exactly replicate the action of @rotView@ (cycling
-- through workspace in order lexicographically by tag, instead of in
-- the order specified in the config), it can be implemented as:
--
-- > rotView b = do t <- findWorkspace getSortByTag (bToDir b) NonEmptyWS 1
-- > windows . greedyView $ t
-- > where bToDir True = Next
-- > bToDir False = Prev
--
-----------------------------------------------------------------------------
module XMonad.Actions.CycleWS (
-- * Usage
-- $usage
-- * Moving between workspaces
-- $moving
nextWS
, prevWS
, shiftToNext
, shiftToPrev
-- * Toggling the previous workspace
-- $toggling
, toggleWS
, toggleWS'
, toggleOrView
-- * Moving between screens (xinerama)
, nextScreen
, prevScreen
, shiftNextScreen
, shiftPrevScreen
, swapNextScreen
, swapPrevScreen
-- * Moving between workspaces, take two!
-- $taketwo
, Direction1D(..)
, WSType(..)
, shiftTo
, moveTo
, doTo
-- * The mother-combinator
, findWorkspace
, toggleOrDoSkip
, skipTags
, screenBy
) where
import Data.List ( find, findIndex )
import Data.Maybe ( isNothing, isJust )
import XMonad hiding (workspaces)
import qualified XMonad.Hooks.WorkspaceHistory as WH
import XMonad.StackSet hiding (filter)
import XMonad.Util.Types
import XMonad.Util.WorkspaceCompare
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file:
--
-- > import XMonad.Actions.CycleWS
-- >
-- > -- a basic CycleWS setup
-- >
-- > , ((modm, xK_Down), nextWS)
-- > , ((modm, xK_Up), prevWS)
-- > , ((modm .|. shiftMask, xK_Down), shiftToNext)
-- > , ((modm .|. shiftMask, xK_Up), shiftToPrev)
-- > , ((modm, xK_Right), nextScreen)
-- > , ((modm, xK_Left), prevScreen)
-- > , ((modm .|. shiftMask, xK_Right), shiftNextScreen)
-- > , ((modm .|. shiftMask, xK_Left), shiftPrevScreen)
-- > , ((modm, xK_z), toggleWS)
--
-- If you want to follow the moved window, you can use both actions:
--
-- > , ((modm .|. shiftMask, xK_Down), shiftToNext >> nextWS)
-- > , ((modm .|. shiftMask, xK_Up), shiftToPrev >> prevWS)
--
-- You can also get fancier with 'moveTo', 'shiftTo', and 'findWorkspace'.
-- For example:
--
-- > , ((modm , xK_f), moveTo Next EmptyWS) -- find a free workspace
-- > , ((modm .|. controlMask, xK_Right), -- a crazy keybinding!
-- > do t <- findWorkspace getSortByXineramaRule Next NonEmptyWS 2
-- > windows . view $ t )
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
--
-- When using the toggle functions, in order to ensure that the workspace
-- to which you switch is the previously viewed workspace, use the
-- 'logHook' in "XMonad.Hooks.WorkspaceHistory".
{- $moving
The following commands for moving the view and windows between
workspaces are somewhat inflexible, but are very simple and probably
Do The Right Thing for most users.
All of the commands in this section cycle through workspaces in the
order in which they are given in your config.
-}
-- | Switch to the next workspace.
nextWS :: X ()
nextWS = switchWorkspace 1
-- | Switch to the previous workspace.
prevWS :: X ()
prevWS = switchWorkspace (-1)
-- | Move the focused window to the next workspace.
shiftToNext :: X ()
shiftToNext = shiftBy 1
-- | Move the focused window to the previous workspace.
shiftToPrev :: X ()
shiftToPrev = shiftBy (-1)
-- $toggling
-- | Toggle to the workspace displayed previously.
toggleWS :: X ()
toggleWS = toggleWS' []
-- | Toggle to the previous workspace while excluding some workspaces.
--
-- > -- Ignore the scratchpad workspace while toggling:
-- > ("M-b", toggleWS' ["NSP"])
toggleWS' :: [WorkspaceId] -> X ()
toggleWS' skips = lastViewedHiddenExcept skips >>= flip whenJust (windows . view)
-- | 'XMonad.StackSet.greedyView' a workspace, or if already there, view
-- the previously displayed workspace ala weechat. Change @greedyView@ to
-- @toggleOrView@ in your workspace bindings as in the 'XMonad.StackSet.view'
-- faq at <http://haskell.org/haskellwiki/Xmonad/Frequently_asked_questions>.
-- For more flexibility see 'toggleOrDoSkip'.
toggleOrView :: WorkspaceId -> X ()
toggleOrView = toggleOrDoSkip [] greedyView
-- | Allows ignoring listed workspace tags (such as scratchpad's \"NSP\"), and
-- running other actions such as view, shift, etc. For example:
--
-- > import qualified XMonad.StackSet as W
-- > import XMonad.Actions.CycleWS
-- >
-- > -- toggleOrView for people who prefer view to greedyView
-- > toggleOrView' = toggleOrDoSkip [] W.view
-- >
-- > -- toggleOrView ignoring scratchpad and named scratchpad workspace
-- > toggleOrViewNoSP = toggleOrDoSkip ["NSP"] W.greedyView
toggleOrDoSkip :: [WorkspaceId] -> (WorkspaceId -> WindowSet -> WindowSet)
-> WorkspaceId -> X ()
toggleOrDoSkip skips f toWS = do
cur <- gets (currentTag . windowset)
if toWS == cur
then lastViewedHiddenExcept skips >>= flip whenJust (windows . f)
else windows (f toWS)
-- | List difference ('\\') for workspaces and tags. Removes workspaces
-- matching listed tags from the given workspace list.
skipTags :: (Eq i) => [Workspace i l a] -> [i] -> [Workspace i l a]
skipTags wss ids = filter ((`notElem` ids) . tag) wss
-- | Ignoring the skips, find the best candidate for the last viewed hidden
-- workspace.
lastViewedHiddenExcept :: [WorkspaceId] -> X (Maybe WorkspaceId)
lastViewedHiddenExcept skips = do
hs <- gets $ map tag . flip skipTags skips . hidden . windowset
vs <- WH.workspaceHistory
return $ choose hs (find (`elem` hs) vs)
where choose [] _ = Nothing
choose (h:_) Nothing = Just h
choose _ vh@(Just _) = vh
switchWorkspace :: Int -> X ()
switchWorkspace d = wsBy d >>= windows . greedyView
shiftBy :: Int -> X ()
shiftBy d = wsBy d >>= windows . shift
wsBy :: Int -> X (WorkspaceId)
wsBy = findWorkspace getSortByIndex Next AnyWS
{- $taketwo
A few more general commands are also provided, which allow cycling
through subsets of workspaces.
For example,
> moveTo Next EmptyWS
will move to the first available workspace with no windows, and
> shiftTo Prev (WSIs $ return (('p' `elem`) . tag))
will move the focused window backwards to the first workspace containing
the letter 'p' in its name. =)
-}
-- | What type of workspaces should be included in the cycle?
data WSType = EmptyWS -- ^ cycle through empty workspaces
| NonEmptyWS -- ^ cycle through non-empty workspaces
| HiddenWS -- ^ cycle through non-visible workspaces
| HiddenNonEmptyWS -- ^ cycle through non-empty non-visible workspaces
| HiddenEmptyWS -- ^ cycle through empty non-visible workspaces
| AnyWS -- ^ cycle through all workspaces
| WSTagGroup Char
-- ^ cycle through workspaces in the same group, the
-- group name is all characters up to the first
-- separator character or the end of the tag
| WSIs (X (WindowSpace -> Bool))
-- ^ cycle through workspaces satisfying
-- an arbitrary predicate
-- | Convert a WSType value to a predicate on workspaces.
wsTypeToPred :: WSType -> X (WindowSpace -> Bool)
wsTypeToPred EmptyWS = return (isNothing . stack)
wsTypeToPred NonEmptyWS = return (isJust . stack)
wsTypeToPred HiddenWS = do hs <- gets (map tag . hidden . windowset)
return (\w -> tag w `elem` hs)
wsTypeToPred HiddenNonEmptyWS = do ne <- wsTypeToPred NonEmptyWS
hi <- wsTypeToPred HiddenWS
return (\w -> hi w && ne w)
wsTypeToPred HiddenEmptyWS = do ne <- wsTypeToPred EmptyWS
hi <- wsTypeToPred HiddenWS
return (\w -> hi w && ne w)
wsTypeToPred AnyWS = return (const True)
wsTypeToPred (WSTagGroup sep) = do cur <- (groupName.workspace.current) `fmap` gets windowset
return $ (cur ==).groupName
where groupName = takeWhile (/=sep).tag
wsTypeToPred (WSIs p) = p
-- | View the next workspace in the given direction that satisfies
-- the given condition.
moveTo :: Direction1D -> WSType -> X ()
moveTo dir t = doTo dir t getSortByIndex (windows . greedyView)
-- | Move the currently focused window to the next workspace in the
-- given direction that satisfies the given condition.
shiftTo :: Direction1D -> WSType -> X ()
shiftTo dir t = doTo dir t getSortByIndex (windows . shift)
-- | Using the given sort, find the next workspace in the given
-- direction of the given type, and perform the given action on it.
doTo :: Direction1D -> WSType -> X WorkspaceSort -> (WorkspaceId -> X ()) -> X ()
doTo dir t srt act = findWorkspace srt dir t 1 >>= act
-- | Given a function @s@ to sort workspaces, a direction @dir@, a
-- predicate @p@ on workspaces, and an integer @n@, find the tag of
-- the workspace which is @n@ away from the current workspace in
-- direction @dir@ (wrapping around if necessary), among those
-- workspaces, sorted by @s@, which satisfy @p@.
--
-- For some useful workspace sorting functions, see
-- "XMonad.Util.WorkspaceCompare".
--
-- For ideas of what to do with a workspace tag once obtained, note
-- that 'moveTo' and 'shiftTo' are implemented by applying @(>>=
-- (windows . greedyView))@ and @(>>= (windows . shift))@, respectively,
-- to the output of 'findWorkspace'.
findWorkspace :: X WorkspaceSort -> Direction1D -> WSType -> Int -> X WorkspaceId
findWorkspace s dir t n = findWorkspaceGen s (wsTypeToPred t) (maybeNegate dir n)
where
maybeNegate Next d = d
maybeNegate Prev d = (-d)
findWorkspaceGen :: X WorkspaceSort -> X (WindowSpace -> Bool) -> Int -> X WorkspaceId
findWorkspaceGen _ _ 0 = gets (currentTag . windowset)
findWorkspaceGen sortX wsPredX d = do
wsPred <- wsPredX
sort <- sortX
ws <- gets windowset
let cur = workspace (current ws)
sorted = sort (workspaces ws)
pivoted = let (a,b) = span ((/= (tag cur)) . tag) sorted in b ++ a
ws' = filter wsPred pivoted
mCurIx = findWsIndex cur ws'
d' = if d > 0 then d - 1 else d
next = if null ws'
then cur
else case mCurIx of
Nothing -> ws' !! (d' `mod` length ws')
Just ix -> ws' !! ((ix + d) `mod` length ws')
return $ tag next
findWsIndex :: WindowSpace -> [WindowSpace] -> Maybe Int
findWsIndex ws wss = findIndex ((== tag ws) . tag) wss
-- | View next screen
nextScreen :: X ()
nextScreen = switchScreen 1
-- | View prev screen
prevScreen :: X ()
prevScreen = switchScreen (-1)
switchScreen :: Int -> X ()
switchScreen d = do s <- screenBy d
mws <- screenWorkspace s
case mws of
Nothing -> return ()
Just ws -> windows (view ws)
{- | Get the 'ScreenId' /d/ places over. Example usage is a variation of the
the default screen keybindings:
> -- mod-{w,e}, Switch to previous/next Xinerama screen
> -- mod-shift-{w,e}, Move client to previous/next Xinerama screen
> --
> [((m .|. modm, key), sc >>= screenWorkspace >>= flip whenJust (windows . f))
> | (key, sc) <- zip [xK_w, xK_e] [(screenBy (-1)),(screenBy 1)]
> , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
-}
screenBy :: Int -> X (ScreenId)
screenBy d = do ws <- gets windowset
--let ss = sortBy screen (screens ws)
let now = screen (current ws)
return $ (now + fromIntegral d) `mod` fromIntegral (length (screens ws))
-- | Swap current screen with next screen
swapNextScreen :: X ()
swapNextScreen = swapScreen 1
-- | Swap current screen with previous screen
swapPrevScreen :: X ()
swapPrevScreen = swapScreen (-1)
swapScreen :: Int -> X ()
swapScreen d = do s <- screenBy d
mws <- screenWorkspace s
case mws of
Nothing -> return ()
Just ws -> windows (greedyView ws)
-- | Move focused window to workspace on next screen
shiftNextScreen :: X ()
shiftNextScreen = shiftScreenBy 1
-- | Move focused window to workspace on prev screen
shiftPrevScreen :: X ()
shiftPrevScreen = shiftScreenBy (-1)
shiftScreenBy :: Int -> X ()
shiftScreenBy d = do s <- screenBy d
mws <- screenWorkspace s
case mws of
Nothing -> return ()
Just ws -> windows (shift ws)

View File

@@ -0,0 +1,235 @@
--------------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.CycleWindows
-- Copyright : (c) Wirt Wolff <wirtwolff@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Wirt Wolff <wirtwolff@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- Provides bindings to cycle windows up or down on the current workspace
-- stack while maintaining focus in place.
--
-- Bindings are available to:
--
-- * Cycle nearby or nth windows into the focused frame
--
-- * Cycle a window halfway around the stack
--
-- * Cycle windows through the focused position.
--
-- * Cycle unfocused windows.
--
-- These bindings are especially useful with layouts that hide some of
-- the windows in the stack, such as Full, "XMonad.Layout.TwoPane" or
-- when using "XMonad.Layout.LimitWindows" to only show three or four
-- panes. See also "XMonad.Actions.RotSlaves" for related actions.
-----------------------------------------------------------------------------
module XMonad.Actions.CycleWindows (
-- * Usage
-- $usage
-- * Cycling nearby or nth window into current frame
-- $cycle
cycleRecentWindows,
cycleStacks',
-- * Cycling half the stack to get rid of a boring window
-- $opposite
rotOpposite', rotOpposite,
-- * Cycling windows through the current frame
-- $focused
rotFocused', rotFocusedUp, rotFocusedDown, shiftToFocus',
-- * Cycling windows through other frames
-- $unfocused
rotUnfocused', rotUnfocusedUp, rotUnfocusedDown,
-- * Updating the mouse pointer
-- $pointer
-- * Generic list rotations
-- $generic
rotUp, rotDown
) where
import XMonad
import qualified XMonad.StackSet as W
import XMonad.Actions.RotSlaves
import Control.Arrow (second)
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file:
--
-- > import XMonad.Actions.CycleWindows
-- > -- config
-- > -- other key bindings with x here your config
-- >
-- > -- make sure mod matches keysym
-- > , ((mod4Mask, xK_s), cycleRecentWindows [xK_Super_L] xK_s xK_w)
-- > , ((modm, xK_z), rotOpposite)
-- > , ((modm , xK_i), rotUnfocusedUp)
-- > , ((modm , xK_u), rotUnfocusedDown)
-- > , ((modm .|. controlMask, xK_i), rotFocusedUp)
-- > , ((modm .|. controlMask, xK_u), rotFocusedDown)
--
-- Also, if you use focus follows mouse, you will want to read the section
-- on updating the mouse pointer below. For detailed instructions on
-- editing your key bindings, see "XMonad.Doc.Extending#Editing_key_bindings".
{- $pointer
With FocusFollowsMouse == True, the focus is updated after binding
actions, possibly focusing a window you didn't intend to focus. Most
people using TwoPane probably already have a logHook causing the mouse
to follow focus. (See "XMonad.Actions.UpdatePointer", or "XMonad.Actions.Warp")
If you want this built into the key binding instead, use the appropriate
action from one of those modules to also have your bindings move the pointer
to the point of your choice on the current window:
> import XMonad.Actions.UpdatePointer -- or Actions.Warp
and either
> -- modify the window rotation bindings
> , ((modm .|. controlMask, xK_i ), rotFocusedUp
> >> updatePointer (Relative 1 1))
> , ((modm .|. controlMask, xK_u ), rotFocusedDown
> >> updatePointer (Relative 1 1))
>
> -- or add to xmonad's logHook
> , logHook = dynamicLogWithPP xmobarPP
> >> updatePointer Nearest -- or your preference
-}
-- $cycle
-- Cycle windows into focus from below or above the focused pane by pressing
-- a key while one or more modifier keys is held down. The window order isn't
-- changed until a modifier is released, leaving the previously focused window
-- just below the new one, (or above if the window just above is chosen.) For
-- best results use the same modifier + key combination as the one used to invoke
-- the \"bring from below\" action. Also, once cycling, pressing a number key n
-- will focus the nth window, with 0 being the one originally focused.
cycleRecentWindows :: [KeySym] -- ^ A list of modifier keys used when invoking this action.
-- As soon as one of them is released, the final switch is made.
-> KeySym -- ^ Key used to shift windows from below the current choice into the current frame.
-> KeySym -- ^ Key used to shift windows from above the current choice into the current frame.
-- If it's the same as the first key, it is effectively ignored.
-> X ()
cycleRecentWindows = cycleStacks' stacks where
stacks s = map (shiftToFocus' `flip` s) (wins s)
wins (W.Stack t l r) = t : r ++ reverse l
-- | Cycle through a /finite/ list of window stacks with repeated presses
-- of a key while a modifier key is held down. For best results use the same
-- mod key + key combination as the one used to invoke the \"bring from below\"
-- action. You could use cycleStacks' with a different stack permutations
-- function to, for example, cycle from one below to one above to two below,
-- etc. instead of in order. You are responsible for having it generate a
-- finite list, though, or xmonad may hang seeking its length.
cycleStacks' :: (W.Stack Window -> [W.Stack Window]) -- ^ A function to a finite list of permutations of a given stack.
-> [KeySym] -- ^ A list of modifier keys used to invoke 'cycleStacks''.
-- As soon as any is released, we're no longer cycling on the [Stack Window]
-> KeySym -- ^ Key used to select a \"next\" stack.
-> KeySym -- ^ Key used to select a \"previous\" stack.
-> X ()
cycleStacks' filteredPerms mods keyNext keyPrev = do
XConf {theRoot = root, display = d} <- ask
stacks <- gets $ maybe [] filteredPerms . W.stack . W.workspace . W.current . windowset
let evt = allocaXEvent $
\p -> do maskEvent d (keyPressMask .|. keyReleaseMask) p
KeyEvent {ev_event_type = t, ev_keycode = c} <- getEvent p
s <- keycodeToKeysym d c 0
return (t, s)
choose n (t, s)
| t == keyPress && s == keyNext = io evt >>= choose (n+1)
| t == keyPress && s == keyPrev = io evt >>= choose (n-1)
| t == keyPress && s `elem` [xK_0..xK_9] = io evt >>= choose (numKeyToN s)
| t == keyRelease && s `elem` mods = return ()
| otherwise = doStack n >> io evt >>= choose n
doStack n = windows . W.modify' . const $ stacks `cycref` n
io $ grabKeyboard d root False grabModeAsync grabModeAsync currentTime
io evt >>= choose 1
io $ ungrabKeyboard d currentTime
where cycref l i = l !! (i `mod` length l) -- modify' ensures l is never [], but must also be finite
numKeyToN = subtract 48 . read . show
-- | Given a stack element and a stack, shift or insert the element (window)
-- at the currently focused position.
shiftToFocus' :: (Eq a, Show a, Read a) => a -> W.Stack a -> W.Stack a
shiftToFocus' w s@(W.Stack _ ls _) = W.Stack w (reverse revls') rs'
where (revls', rs') = splitAt (length ls) . filter (/= w) $ W.integrate s
-- $opposite
-- Shifts the focused window as far as possible from the current focus,
-- i.e. halfway around the stack. Windows above the focus up to the \"opposite\"
-- position remain in place, while those above the insertion shift toward
-- the current focus. This is useful for people who use lots of windows in Full,
-- TwoPane, etc., to get rid of boring windows while cycling and swapping
-- near the focus.
rotOpposite :: X()
rotOpposite = windows $ W.modify' rotOpposite'
-- | The opposite rotation on a Stack.
rotOpposite' :: W.Stack a -> W.Stack a
rotOpposite' (W.Stack t l r) = W.Stack t' l' r'
where rrvl = r ++ reverse l
part = (length rrvl + 1) `div` 2
(l',t':r') = second reverse . splitAt (length l) $
reverse (take part rrvl ++ t : drop part rrvl)
-- $focused
-- Most people will want the @rotAllUp@ or @rotAllDown@ actions from
-- "XMonad.Actions.RotSlaves" to cycle all windows in the stack.
--
-- The following actions keep the \"next\" window stable, which is
-- mostly useful in two window layouts, or when you have a log viewer or
-- buffer window you want to keep next to the cycled window.
-- | Rotate windows through the focused frame, excluding the \"next\" window.
-- With, e.g. TwoPane, this allows cycling windows through either the
-- master or slave pane, without changing the other frame. When the master
-- is focused, the window below is skipped, when a non-master window is
-- focused, the master is skipped.
rotFocusedUp :: X ()
rotFocusedUp = windows . W.modify' $ rotFocused' rotUp
rotFocusedDown :: X ()
rotFocusedDown = windows . W.modify' $ rotFocused' rotDown
-- | The focused rotation on a stack.
rotFocused' :: ([a] -> [a]) -> W.Stack a -> W.Stack a
rotFocused' _ s@(W.Stack _ [] []) = s
rotFocused' f (W.Stack t [] (r:rs)) = W.Stack t' [] (r:rs') -- Master has focus
where (t':rs') = f (t:rs)
rotFocused' f s@(W.Stack _ _ _) = rotSlaves' f s -- otherwise
-- $unfocused
-- Rotate windows through the unfocused frames. This is similar to
-- @rotSlaves@, from "XMonad.Actions.RotSlaves", but excludes the current
-- frame rather than master.
rotUnfocusedUp :: X ()
rotUnfocusedUp = windows . W.modify' $ rotUnfocused' rotUp
rotUnfocusedDown :: X ()
rotUnfocusedDown = windows . W.modify' $ rotUnfocused' rotDown
-- | The unfocused rotation on a stack.
rotUnfocused' :: ([a] -> [a]) -> W.Stack a -> W.Stack a
rotUnfocused' _ s@(W.Stack _ [] []) = s
rotUnfocused' f s@(W.Stack _ [] _ ) = rotSlaves' f s -- Master has focus
rotUnfocused' f (W.Stack t ls rs) = W.Stack t (reverse revls') rs' -- otherwise
where (master:revls) = reverse ls
(revls',rs') = splitAt (length ls) (f $ master:revls ++ rs)
-- $generic
-- Generic list rotations such that @rotUp [1..4]@ is equivalent to
-- @[2,3,4,1]@ and @rotDown [1..4]@ to @[4,1,2,3]@. They both are
-- @id@ for null or singleton lists.
rotUp :: [a] -> [a]
rotUp l = drop 1 l ++ take 1 l
rotDown :: [a] -> [a]
rotDown = reverse . rotUp . reverse

View File

@@ -0,0 +1,102 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.CycleWorkspaceByScreen
-- Copyright : (c) 2017 Ivan Malison
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : IvanMalison@gmail.com
-- Stability : unstable
-- Portability : unportable
--
-- Cycle through previously viewed workspaces in the order they were viewed most
-- recently on the screen where cycling is taking place.
--
-----------------------------------------------------------------------------
module XMonad.Actions.CycleWorkspaceByScreen (
-- * Usage
-- $usage
cycleWorkspaceOnScreen
, cycleWorkspaceOnCurrentScreen
, handleKeyEvent
, repeatableAction
) where
import Control.Monad
import Data.IORef
import Data.List
import Data.Maybe
import Graphics.X11.Xlib.Extras
import XMonad
import XMonad.Hooks.WorkspaceHistory
import qualified XMonad.StackSet as W
-- $usage
-- This module must be used in conjuction with XMonad.Hooks.WorkspaceHistory
--
-- To use, add something like the following to your keybindings
-- , ((mod4Mask, xK_slash), cycleWorkspaceOnCurrentScreen [xK_Super_L] xK_slash xK_p)
repeatableAction :: [KeySym] -> (EventType -> KeySym -> X ()) -> X ()
repeatableAction mods pressHandler = do
XConf {theRoot = root, display = d} <- ask
let getNextEvent = io $ allocaXEvent $ \p ->
do
maskEvent d (keyPressMask .|. keyReleaseMask) p
KeyEvent {ev_event_type = t, ev_keycode = c} <- getEvent p
s <- io $ keycodeToKeysym d c 0
return (t, s)
handleEvent (t, s)
| t == keyRelease && s `elem` mods = return ()
| otherwise = (pressHandler t s) >> getNextEvent >>= handleEvent
io $ grabKeyboard d root False grabModeAsync grabModeAsync currentTime
getNextEvent >>= handleEvent
io $ ungrabKeyboard d currentTime
handleKeyEvent :: EventType
-> KeySym
-> X ()
-> EventType
-> KeySym
-> Maybe (X ())
handleKeyEvent eventType key action = helper
where
helper et k
| et == eventType && k == key = Just action
| otherwise = Nothing
runFirst :: [EventType -> KeySym -> Maybe (X ())] -> EventType -> KeySym -> X ()
runFirst matchers eventType key =
fromMaybe (return ()) $ join $ find isJust $ map (\fn -> fn eventType key) matchers
cycleWorkspaceOnScreen :: ScreenId -> [KeySym] -> KeySym -> KeySym -> X ()
cycleWorkspaceOnScreen screenId mods nextKey prevKey = workspaceHistoryTransaction $ do
startingHistory <- workspaceHistoryByScreen
currentWSIndex <- io $ newIORef 1
let cycleWorkspaces = fromMaybe [] $ lookup screenId startingHistory
getAndIncrementWS increment = do
current <- readIORef currentWSIndex
modifyIORef
currentWSIndex
((`mod` (length cycleWorkspaces)) . (+ increment))
return $ cycleWorkspaces !! current
focusIncrement i = (io $ getAndIncrementWS i) >>= (windows . W.greedyView)
focusIncrement 1 -- Do the first workspace cycle
repeatableAction mods $
runFirst
[ handleKeyEvent keyPress nextKey $ focusIncrement 1
, handleKeyEvent keyPress prevKey $ focusIncrement (-1)
]
return ()
cycleWorkspaceOnCurrentScreen
:: [KeySym] -> KeySym -> KeySym -> X ()
cycleWorkspaceOnCurrentScreen mods n p =
withWindowSet $ \ws ->
cycleWorkspaceOnScreen (W.screen $ W.current ws) mods n p

View File

@@ -0,0 +1,57 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.DeManage
-- Copyright : (c) Spencer Janssen <spencerjanssen@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Spencer Janssen <spencerjanssen@gmail.com>
-- Stability : stable
-- Portability : unportable
--
-- This module provides a method to cease management of a window
-- without unmapping it. This is especially useful for applications
-- like kicker and gnome-panel. See also "XMonad.Hooks.ManageDocks" for
-- more a more automated solution.
--
-- To make a panel display correctly with xmonad:
--
-- * Determine the pixel size of the panel, add that value to
-- 'XMonad.Core.XConfig.defaultGaps'
--
-- * Launch the panel
--
-- * Give the panel window focus, then press @mod-d@ (or whatever key
-- you have bound 'demanage' to)
--
-- * Convince the panel to move\/resize to the correct location. Changing the
-- panel's position setting several times seems to work.
--
-----------------------------------------------------------------------------
module XMonad.Actions.DeManage (
-- * Usage
-- $usage
demanage
) where
import qualified XMonad.StackSet as W
import XMonad
-- $usage
-- To use demanage, add this import to your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.DeManage
--
-- And add a keybinding, such as:
--
-- > , ((modm, xK_d ), withFocused demanage)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Stop managing the currently focused window.
demanage :: Window -> X ()
demanage w = do
-- use modify to defeat automatic 'unmanage' calls.
modify (\s -> s { windowset = W.delete w (windowset s) })
refresh

View File

@@ -0,0 +1,49 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.DwmPromote
-- Copyright : (c) Miikka Koskinen 2007
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : arcatan@kapsi.fi
-- Stability : stable
-- Portability : unportable
--
-- Dwm-like swap function for xmonad.
--
-- Swaps focused window with the master window. If focus is in the
-- master, swap it with the next window in the stack. Focus stays in the
-- master.
--
-----------------------------------------------------------------------------
module XMonad.Actions.DwmPromote (
-- * Usage
-- $usage
dwmpromote
) where
import XMonad
import XMonad.StackSet
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.DwmPromote
--
-- then add a keybinding or substitute 'dwmpromote' in place of promote:
--
-- > , ((modm, xK_Return), dwmpromote)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Swap the focused window with the master window. If focus is in
-- the master, swap it with the next window in the stack. Focus
-- stays in the master.
dwmpromote :: X ()
dwmpromote = windows $ modify' $
\c -> case c of
Stack _ [] [] -> c
Stack t [] (x:rs) -> Stack x [] (t:rs)
Stack t ls rs -> Stack t [] (ys ++ x : rs) where (x:ys) = reverse ls

View File

@@ -0,0 +1,363 @@
{-# LANGUAGE DeriveDataTypeable #-}
--------------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.DynamicProjects
-- Copyright : (c) Peter J. Jones
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Peter Jones <pjones@devalot.com>
-- Stability : unstable
-- Portability : not portable
--
-- Imbues workspaces with additional features so they can be treated
-- as individual project areas.
--------------------------------------------------------------------------------
module XMonad.Actions.DynamicProjects
( -- * Overview
-- $overview
-- * Usage
-- $usage
-- * Types
Project (..)
, ProjectName
-- * Hooks
, dynamicProjects
-- * Bindings
, switchProjectPrompt
, shiftToProjectPrompt
, renameProjectPrompt
, changeProjectDirPrompt
-- * Helper Functions
, switchProject
, shiftToProject
, lookupProject
, currentProject
, activateProject
) where
--------------------------------------------------------------------------------
import Control.Applicative ((<|>))
import Control.Monad (when, unless)
import Data.Char (isSpace)
import Data.List (sort, union, stripPrefix)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Maybe (fromMaybe, isNothing)
import Data.Monoid ((<>))
import System.Directory (setCurrentDirectory, getHomeDirectory)
import XMonad
import XMonad.Actions.DynamicWorkspaces
import XMonad.Prompt
import XMonad.Prompt.Directory
import qualified XMonad.StackSet as W
import qualified XMonad.Util.ExtensibleState as XS
--------------------------------------------------------------------------------
-- $overview
-- Inspired by @TopicSpace@, @DynamicWorkspaces@, and @WorkspaceDir@,
-- @DynamicProjects@ treats workspaces as projects while maintaining
-- compatibility with all existing workspace-related functionality in
-- XMonad.
--
-- Instead of using generic workspace names such as @3@ or @work@,
-- @DynamicProjects@ allows you to dedicate workspaces to specific
-- projects and then switch between projects easily.
--
-- A project is made up of a name, working directory, and a start-up
-- hook. When you switch to a workspace, @DynamicProjects@ changes
-- the working directory to the one configured for the matching
-- project. If the workspace doesn't have any windows, the project's
-- start-up hook is executed. This allows you to launch applications
-- or further configure the workspace/project.
--
-- When using the @switchProjectPrompt@ function, workspaces are
-- created as needed. This means you can create new project spaces
-- (and therefore workspaces) on the fly. (These dynamic projects are
-- not preserved across restarts.)
--
-- Additionally, frequently used projects can be configured statically
-- in your XMonad configuration. Doing so allows you to configure the
-- per-project start-up hook.
--------------------------------------------------------------------------------
-- $usage
-- To use @DynamicProjects@ you need to add it to your XMonad
-- configuration and then configure some optional key bindings.
--
-- > import XMonad.Actions.DynamicProjects
--
-- Start by defining some projects:
--
-- > projects :: [Project]
-- > projects =
-- > [ Project { projectName = "scratch"
-- > , projectDirectory = "~/"
-- > , projectStartHook = Nothing
-- > }
-- >
-- > , Project { projectName = "browser"
-- > , projectDirectory = "~/download"
-- > , projectStartHook = Just $ do spawn "conkeror"
-- > spawn "chromium"
-- > }
-- > ]
--
-- Then inject @DynamicProjects@ into your XMonad configuration:
--
-- > main = xmonad $ dynamicProjects projects def
--
-- And finally, configure some optional key bindings:
--
-- > , ((modm, xK_space), switchProjectPrompt)
-- > , ((modm, xK_slash), shiftToProjectPrompt)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
--------------------------------------------------------------------------------
type ProjectName = String
type ProjectTable = Map ProjectName Project
--------------------------------------------------------------------------------
-- | Details about a workspace that represents a project.
data Project = Project
{ projectName :: !ProjectName -- ^ Workspace name.
, projectDirectory :: !FilePath -- ^ Working directory.
, projectStartHook :: !(Maybe (X ())) -- ^ Optional start-up hook.
} deriving Typeable
--------------------------------------------------------------------------------
-- | Internal project state.
data ProjectState = ProjectState
{ projects :: !ProjectTable
, previousProject :: !(Maybe WorkspaceId)
} deriving Typeable
--------------------------------------------------------------------------------
instance ExtensionClass ProjectState where
initialValue = ProjectState Map.empty Nothing
--------------------------------------------------------------------------------
-- Internal types for working with XPrompt.
data ProjectPrompt = ProjectPrompt ProjectMode [ProjectName]
data ProjectMode = SwitchMode | ShiftMode | RenameMode | DirMode
instance XPrompt ProjectPrompt where
showXPrompt (ProjectPrompt submode _) =
case submode of
SwitchMode -> "Switch or Create Project: "
ShiftMode -> "Send Window to Project: "
RenameMode -> "New Project Name: "
DirMode -> "Change Project Directory: "
completionFunction (ProjectPrompt RenameMode _) = return . (:[])
completionFunction (ProjectPrompt DirMode _) =
let xpt = directoryMultipleModes "" (const $ return ())
in completionFunction xpt
completionFunction (ProjectPrompt _ ns) = mkComplFunFromList' ns
modeAction (ProjectPrompt SwitchMode _) buf auto = do
let name = if null auto then buf else auto
ps <- XS.gets projects
case Map.lookup name ps of
Just p -> switchProject p
Nothing | null name -> return ()
| otherwise -> switchProject (defProject name)
modeAction (ProjectPrompt ShiftMode _) buf auto = do
let name = if null auto then buf else auto
ps <- XS.gets projects
shiftToProject . fromMaybe (defProject name) $ Map.lookup name ps
modeAction (ProjectPrompt RenameMode _) name _ =
when (not (null name) && not (all isSpace name)) $ do
renameWorkspaceByName name
modifyProject (\p -> p { projectName = name })
modeAction (ProjectPrompt DirMode _) buf auto = do
let dir = if null auto then buf else auto
modifyProject (\p -> p { projectDirectory = dir })
--------------------------------------------------------------------------------
-- | Add dynamic projects support to the given config.
dynamicProjects :: [Project] -> XConfig a -> XConfig a
dynamicProjects ps c =
c { startupHook = dynamicProjectsStartupHook ps <> startupHook c
, logHook = dynamicProjectsLogHook <> logHook c
}
--------------------------------------------------------------------------------
-- | Log hook for tracking workspace changes.
dynamicProjectsLogHook :: X ()
dynamicProjectsLogHook = do
name <- gets (W.tag . W.workspace . W.current . windowset)
xstate <- XS.get
unless (Just name == previousProject xstate) $ do
XS.put (xstate {previousProject = Just name})
activateProject . fromMaybe (defProject name) $
Map.lookup name (projects xstate)
--------------------------------------------------------------------------------
-- | Start-up hook for recording configured projects.
dynamicProjectsStartupHook :: [Project] -> X ()
dynamicProjectsStartupHook ps = XS.modify go
where
go :: ProjectState -> ProjectState
go s = s {projects = update $ projects s}
update :: ProjectTable -> ProjectTable
update = Map.union (Map.fromList $ map entry ps)
entry :: Project -> (ProjectName, Project)
entry p = (projectName p, addDefaultHook p)
-- Force the hook to be a @Just@ so that it doesn't automatically
-- get deleted when switching away from a workspace with no
-- windows.
addDefaultHook :: Project -> Project
addDefaultHook p = p { projectStartHook = projectStartHook p <|>
Just (return ())
}
--------------------------------------------------------------------------------
-- | Find a project based on its name.
lookupProject :: ProjectName -> X (Maybe Project)
lookupProject name = Map.lookup name `fmap` XS.gets projects
--------------------------------------------------------------------------------
-- | Fetch the current project (the one being used for the currently
-- active workspace).
currentProject :: X Project
currentProject = do
name <- gets (W.tag . W.workspace . W.current . windowset)
proj <- lookupProject name
return $ fromMaybe (defProject name) proj
--------------------------------------------------------------------------------
-- | Modify the current project using a pure function.
modifyProject :: (Project -> Project) -> X ()
modifyProject f = do
p <- currentProject
ps <- XS.gets projects
-- If a project is renamed to match another project, the old project
-- will be removed and replaced with this one.
let new = f p
ps' = Map.insert (projectName new) new $ Map.delete (projectName p) ps
XS.modify $ \s -> s {projects = ps'}
activateProject new
--------------------------------------------------------------------------------
-- | Switch to the given project.
switchProject :: Project -> X ()
switchProject p = do
oldws <- gets (W.workspace . W.current . windowset)
oldp <- currentProject
let name = W.tag oldws
ws = W.integrate' (W.stack oldws)
-- If the project we are switching away from has no windows, and
-- it's a dynamic project, remove it from the configuration.
when (null ws && isNothing (projectStartHook oldp)) $ do
removeWorkspaceByTag name -- also remove the old workspace
XS.modify (\s -> s {projects = Map.delete name $ projects s})
appendWorkspace (projectName p)
--------------------------------------------------------------------------------
-- | Prompt for a project name and then switch to it. Automatically
-- creates a project if a new name is returned from the prompt.
switchProjectPrompt :: XPConfig -> X ()
switchProjectPrompt = projectPrompt [ SwitchMode
, ShiftMode
, RenameMode
, DirMode
]
--------------------------------------------------------------------------------
-- | Shift the currently focused window to the given project.
shiftToProject :: Project -> X ()
shiftToProject p = do
addHiddenWorkspace (projectName p)
windows (W.shift $ projectName p)
--------------------------------------------------------------------------------
-- | Prompts for a project name and then shifts the currently focused
-- window to that project.
shiftToProjectPrompt :: XPConfig -> X ()
shiftToProjectPrompt = projectPrompt [ ShiftMode
, RenameMode
, SwitchMode
, DirMode
]
--------------------------------------------------------------------------------
-- | Rename the current project.
renameProjectPrompt :: XPConfig -> X ()
renameProjectPrompt = projectPrompt [ RenameMode
, DirMode
, SwitchMode
, ShiftMode
]
--------------------------------------------------------------------------------
-- | Change the working directory used for the current project.
--
-- NOTE: This will only affect new processed started in this project.
-- Existing processes will maintain the previous working directory.
changeProjectDirPrompt :: XPConfig -> X ()
changeProjectDirPrompt = projectPrompt [ DirMode
, SwitchMode
, ShiftMode
, RenameMode
]
--------------------------------------------------------------------------------
-- | Prompt for a project name.
projectPrompt :: [ProjectMode] -> XPConfig -> X ()
projectPrompt submodes c = do
ws <- map W.tag `fmap` gets (W.workspaces . windowset)
ps <- XS.gets projects
let names = sort (Map.keys ps `union` ws)
modes = map (\m -> XPT $ ProjectPrompt m names) submodes
mkXPromptWithModes modes c
--------------------------------------------------------------------------------
-- | Activate a project by updating the working directory and
-- possibly running its start-up hook. This function is automatically
-- invoked when the workspace changes.
activateProject :: Project -> X ()
activateProject p = do
ws <- gets (W.integrate' . W.stack . W.workspace . W.current . windowset)
home <- io getHomeDirectory
-- Change to the project's directory.
catchIO (setCurrentDirectory $ expandHome home $ projectDirectory p)
-- Possibly run the project's startup hook.
when (null ws) $ fromMaybe (return ()) (projectStartHook p)
where
-- Replace an initial @~@ character with the home directory.
expandHome :: FilePath -> FilePath -> FilePath
expandHome home dir = case stripPrefix "~" dir of
Nothing -> dir
Just xs -> home ++ xs
--------------------------------------------------------------------------------
-- | Default project.
defProject :: ProjectName -> Project
defProject name = Project name "~/" Nothing

View File

@@ -0,0 +1,147 @@
{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.DynamicWorkspaceGroups
-- Copyright : (c) Brent Yorgey 2009
-- License : BSD-style (see LICENSE)
--
-- Maintainer : <byorgey@gmail.com>
-- Stability : experimental
-- Portability : unportable
--
-- Dynamically manage \"workspace groups\", sets of workspaces being
-- used together for some common task or purpose, to allow switching
-- between workspace groups in a single action. Note that this only
-- makes sense for multi-head setups.
--
-----------------------------------------------------------------------------
module XMonad.Actions.DynamicWorkspaceGroups
( -- * Usage
-- $usage
WSGroupId
, addRawWSGroup
, addWSGroup
, addCurrentWSGroup
, forgetWSGroup
, viewWSGroup
, promptWSGroupView
, promptWSGroupAdd
, promptWSGroupForget
, WSGPrompt
) where
import Data.List (find)
import Control.Arrow ((&&&))
import qualified Data.Map as M
import XMonad
import qualified XMonad.StackSet as W
import XMonad.Prompt
import qualified XMonad.Util.ExtensibleState as XS
-- $usage
-- You can use this module by importing it into your ~\/.xmonad\/xmonad.hs file:
--
-- > import XMonad.Actions.DynamicWorkspaceGroups
--
-- Then add keybindings like the following (this example uses
-- "XMonad.Util.EZConfig"-style keybindings, but this is not necessary):
--
-- > , ("M-y n", promptWSGroupAdd myXPConfig "Name this group: ")
-- > , ("M-y g", promptWSGroupView myXPConfig "Go to group: ")
-- > , ("M-y d", promptWSGroupForget myXPConfig "Forget group: ")
--
type WSGroup = [(ScreenId,WorkspaceId)]
type WSGroupId = String
data WSGroupStorage = WSG { unWSG :: M.Map WSGroupId WSGroup }
deriving (Typeable, Read, Show)
withWSG :: (M.Map WSGroupId WSGroup -> M.Map WSGroupId WSGroup) -> WSGroupStorage -> WSGroupStorage
withWSG f = WSG . f . unWSG
instance ExtensionClass WSGroupStorage where
initialValue = WSG $ M.empty
extensionType = PersistentExtension
-- | Add a new workspace group of the given name, mapping to an
-- explicitly specified association between screen IDs and workspace
-- names. This function could be useful for, say, creating some
-- standard workspace groups in your startup hook.
addRawWSGroup :: WSGroupId -> [(ScreenId, WorkspaceId)] -> X ()
addRawWSGroup name = XS.modify . withWSG . M.insert name
-- | Add a new workspace group with the given name.
addWSGroup :: WSGroupId -> [WorkspaceId] -> X ()
addWSGroup name wids = withWindowSet $ \w -> do
let wss = map ((W.tag . W.workspace) &&& W.screen) $ W.screens w
wmap = mapM (strength . (flip lookup wss &&& id)) wids
case wmap of
Just ps -> addRawWSGroup name ps
Nothing -> return ()
where strength (ma, b) = ma >>= \a -> return (a,b)
-- | Give a name to the current workspace group.
addCurrentWSGroup :: WSGroupId -> X ()
addCurrentWSGroup name = withWindowSet $ \w ->
addWSGroup name $ map (W.tag . W.workspace) (reverse $ W.current w : W.visible w)
-- | Delete the named workspace group from the list of workspace
-- groups. Note that this has no effect on the workspaces involved;
-- it simply forgets the given name.
forgetWSGroup :: WSGroupId -> X ()
forgetWSGroup = XS.modify . withWSG . M.delete
-- | View the workspace group with the given name.
viewWSGroup :: WSGroupId -> X ()
viewWSGroup name = do
WSG m <- XS.get
case M.lookup name m of
Just grp -> mapM_ (uncurry viewWS) grp
Nothing -> return ()
-- | View the given workspace on the given screen.
viewWS :: ScreenId -> WorkspaceId -> X ()
viewWS sid wid = do
mw <- findScreenWS sid
case mw of
Just w -> do
windows $ W.view w
windows $ W.greedyView wid
Nothing -> return ()
-- | Find the workspace which is currently on the given screen.
findScreenWS :: ScreenId -> X (Maybe WorkspaceId)
findScreenWS sid = withWindowSet $
return . fmap (W.tag . W.workspace) . find ((==sid) . W.screen) . W.screens
data WSGPrompt = WSGPrompt String
instance XPrompt WSGPrompt where
showXPrompt (WSGPrompt s) = s
-- | Prompt for a workspace group to view.
promptWSGroupView :: XPConfig -> String -> X ()
promptWSGroupView xp s = do
gs <- fmap (M.keys . unWSG) XS.get
mkXPrompt (WSGPrompt s) xp (mkComplFunFromList' gs) viewWSGroup
-- | Prompt for a name for the current workspace group.
promptWSGroupAdd :: XPConfig -> String -> X ()
promptWSGroupAdd xp s =
mkXPrompt (WSGPrompt s) xp (const $ return []) addCurrentWSGroup
-- | Prompt for a workspace group to forget.
promptWSGroupForget :: XPConfig -> String -> X ()
promptWSGroupForget xp s = do
gs <- fmap (M.keys . unWSG) XS.get
mkXPrompt (WSGPrompt s) xp (mkComplFunFromList' gs) forgetWSGroup

View File

@@ -0,0 +1,195 @@
{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.DynamicWorkspaceOrder
-- Copyright : (c) Brent Yorgey 2009
-- License : BSD-style (see LICENSE)
--
-- Maintainer : <byorgey@gmail.com>
-- Stability : experimental
-- Portability : unportable
--
-- Remember a dynamically updateable ordering on workspaces, together
-- with tools for using this ordering with "XMonad.Actions.CycleWS"
-- and "XMonad.Hooks.DynamicLog".
--
-----------------------------------------------------------------------------
module XMonad.Actions.DynamicWorkspaceOrder
( -- * Usage
-- $usage
getWsCompareByOrder
, getSortByOrder
, swapWith
, updateName
, removeName
, moveTo
, moveToGreedy
, shiftTo
, withNthWorkspace
) where
import XMonad
import qualified XMonad.StackSet as W
import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Util.WorkspaceCompare (WorkspaceCompare, WorkspaceSort, mkWsSort)
import XMonad.Actions.CycleWS (findWorkspace, WSType(..), Direction1D(..), doTo)
import qualified Data.Map as M
import qualified Data.Set as S
import Data.Maybe (fromJust, fromMaybe)
import Data.Ord (comparing)
-- $usage
-- You can use this module by importing it into your ~\/.xmonad\/xmonad.hs file:
--
-- > import qualified XMonad.Actions.DynamicWorkspaceOrder as DO
--
-- Then add keybindings to swap the order of workspaces (these
-- examples use "XMonad.Util.EZConfig" emacs-style keybindings):
--
-- > , ("M-C-<R>", DO.swapWith Next NonEmptyWS)
-- > , ("M-C-<L>", DO.swapWith Prev NonEmptyWS)
--
-- See "XMonad.Actions.CycleWS" for information on the possible
-- arguments to 'swapWith'.
--
-- However, by itself this will do nothing; 'swapWith' does not change
-- the actual workspaces in any way. It simply keeps track of an
-- auxiliary ordering on workspaces. Anything which cares about the
-- order of workspaces must be updated to use the auxiliary ordering.
--
-- To change the order in which workspaces are displayed by
-- "XMonad.Hooks.DynamicLog", use 'getSortByOrder' in your
-- 'XMonad.Hooks.DynamicLog.ppSort' field, for example:
--
-- > ... dynamicLogWithPP $ byorgeyPP {
-- > ...
-- > , ppSort = DO.getSortByOrder
-- > ...
-- > }
--
-- To use workspace cycling commands like those from
-- "XMonad.Actions.CycleWS", use the versions of 'moveTo',
-- 'moveToGreedy', and 'shiftTo' exported by this module. For example:
--
-- > , ("M-S-<R>", DO.shiftTo Next HiddenNonEmptyWS)
-- > , ("M-S-<L>", DO.shiftTo Prev HiddenNonEmptyWS)
-- > , ("M-<R>", DO.moveTo Next HiddenNonEmptyWS)
-- > , ("M-<L>", DO.moveTo Prev HiddenNonEmptyWS)
--
-- For slight variations on these, use the source for examples and
-- tweak as desired.
-- | Extensible state storage for the workspace order.
data WSOrderStorage = WSO { unWSO :: Maybe (M.Map WorkspaceId Int) }
deriving (Typeable, Read, Show)
instance ExtensionClass WSOrderStorage where
initialValue = WSO Nothing
extensionType = PersistentExtension
-- | Lift a Map function to a function on WSOrderStorage.
withWSO :: (M.Map WorkspaceId Int -> M.Map WorkspaceId Int)
-> (WSOrderStorage -> WSOrderStorage)
withWSO f = WSO . fmap f . unWSO
-- | Update the ordering storage: initialize if it doesn't yet exist;
-- add newly created workspaces at the end as necessary.
updateOrder :: X ()
updateOrder = do
WSO mm <- XS.get
case mm of
Nothing -> do
-- initialize using ordering of workspaces from the user's config
ws <- asks (workspaces . config)
XS.put . WSO . Just . M.fromList $ zip ws [0..]
Just m -> do
-- check for new workspaces and add them at the end
curWs <- gets (S.fromList . map W.tag . W.workspaces . windowset)
let mappedWs = M.keysSet m
newWs = curWs `S.difference` mappedWs
nextIndex = 1 + maximum (-1 : M.elems m)
newWsIxs = zip (S.toAscList newWs) [nextIndex..]
XS.modify . withWSO . M.union . M.fromList $ newWsIxs
-- | A comparison function which orders workspaces according to the
-- stored dynamic ordering.
getWsCompareByOrder :: X WorkspaceCompare
getWsCompareByOrder = do
updateOrder
-- after the call to updateOrder we are guaranteed that the dynamic
-- workspace order is initialized and contains all existing
-- workspaces.
WSO (Just m) <- XS.get
return $ comparing (fromMaybe 1000 . flip M.lookup m)
-- | Sort workspaces according to the stored dynamic ordering.
getSortByOrder :: X WorkspaceSort
getSortByOrder = mkWsSort getWsCompareByOrder
-- | Swap the current workspace with another workspace in the stored
-- dynamic order.
swapWith :: Direction1D -> WSType -> X ()
swapWith dir which = findWorkspace getSortByOrder dir which 1 >>= swapWithCurrent
-- | Swap the given workspace with the current one.
swapWithCurrent :: WorkspaceId -> X ()
swapWithCurrent w = do
cur <- gets (W.currentTag . windowset)
swapOrder w cur
-- | Swap the two given workspaces in the dynamic order.
swapOrder :: WorkspaceId -> WorkspaceId -> X ()
swapOrder w1 w2 = do
io $ print (w1,w2)
WSO (Just m) <- XS.get
let [i1,i2] = map (fromJust . flip M.lookup m) [w1,w2]
XS.modify (withWSO (M.insert w1 i2 . M.insert w2 i1))
windows id -- force a status bar update
-- | Update the name of a workspace in the stored order.
updateName :: WorkspaceId -> WorkspaceId -> X ()
updateName oldId newId = XS.modify . withWSO $ changeKey oldId newId
-- | Remove a workspace from the stored order.
removeName :: WorkspaceId -> X ()
removeName = XS.modify . withWSO . M.delete
-- | Update a key in a Map.
changeKey :: Ord k => k -> k -> M.Map k a -> M.Map k a
changeKey oldKey newKey oldMap =
case M.updateLookupWithKey (\_ _ -> Nothing) oldKey oldMap of
(Nothing, _) -> oldMap
(Just val, newMap) -> M.insert newKey val newMap
-- | View the next workspace of the given type in the given direction,
-- where \"next\" is determined using the dynamic workspace order.
moveTo :: Direction1D -> WSType -> X ()
moveTo dir t = doTo dir t getSortByOrder (windows . W.view)
-- | Same as 'moveTo', but using 'greedyView' instead of 'view'.
moveToGreedy :: Direction1D -> WSType -> X ()
moveToGreedy dir t = doTo dir t getSortByOrder (windows . W.greedyView)
-- | Shift the currently focused window to the next workspace of the
-- given type in the given direction, using the dynamic workspace order.
shiftTo :: Direction1D -> WSType -> X ()
shiftTo dir t = doTo dir t getSortByOrder (windows . W.shift)
-- | Do something with the nth workspace in the dynamic order. The
-- callback is given the workspace's tag as well as the 'WindowSet'
-- of the workspace itself.
withNthWorkspace :: (String -> WindowSet -> WindowSet) -> Int -> X ()
withNthWorkspace job wnum = do
sort <- getSortByOrder
ws <- gets (map W.tag . sort . W.workspaces . windowset)
case drop wnum ws of
(w:_) -> windows $ job w
[] -> return ()

View File

@@ -0,0 +1,260 @@
{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.DynamicWorkspaces
-- Copyright : (c) David Roundy <droundy@darcs.net>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : none
-- Stability : unstable
-- Portability : unportable
--
-- Provides bindings to add and delete workspaces.
--
-----------------------------------------------------------------------------
module XMonad.Actions.DynamicWorkspaces (
-- * Usage
-- $usage
addWorkspace, addWorkspacePrompt,
appendWorkspace, appendWorkspacePrompt,
addWorkspaceAt,
removeWorkspace,
removeWorkspaceByTag,
removeEmptyWorkspace,
removeEmptyWorkspaceByTag,
removeEmptyWorkspaceAfter,
removeEmptyWorkspaceAfterExcept,
addHiddenWorkspace, addHiddenWorkspaceAt,
withWorkspace,
selectWorkspace, renameWorkspace,
renameWorkspaceByName,
toNthWorkspace, withNthWorkspace,
setWorkspaceIndex, withWorkspaceIndex,
WorkspaceIndex
) where
import XMonad hiding (workspaces)
import XMonad.StackSet hiding (filter, modify, delete)
import XMonad.Prompt.Workspace ( Wor(Wor), workspacePrompt )
import XMonad.Prompt ( XPConfig, mkXPrompt )
import XMonad.Util.WorkspaceCompare ( getSortByIndex )
import Data.List (find)
import Data.Maybe (isNothing)
import Control.Monad (when)
import qualified Data.Map.Strict as Map
import qualified XMonad.Util.ExtensibleState as XS
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file:
--
-- > import XMonad.Actions.DynamicWorkspaces
-- > import XMonad.Actions.CopyWindow(copy)
--
-- Then add keybindings like the following:
--
-- > , ((modm .|. shiftMask, xK_BackSpace), removeWorkspace)
-- > , ((modm .|. shiftMask, xK_v ), selectWorkspace def)
-- > , ((modm, xK_m ), withWorkspace def (windows . W.shift))
-- > , ((modm .|. shiftMask, xK_m ), withWorkspace def (windows . copy))
-- > , ((modm .|. shiftMask, xK_r ), renameWorkspace def)
--
-- > -- mod-[1..9] %! Switch to workspace N in the list of workspaces
-- > -- mod-shift-[1..9] %! Move client to workspace N in the list of workspaces
-- > ++
-- > zip (zip (repeat (modm)) [xK_1..xK_9]) (map (withNthWorkspace W.greedyView) [0..])
-- > ++
-- > zip (zip (repeat (modm .|. shiftMask)) [xK_1..xK_9]) (map (withNthWorkspace W.shift) [0..])
--
-- Alternatively, you can associate indexes (which don't depend of the
-- workspace list order) to workspaces by using following keybindings:
--
-- > -- mod-[1..9] %! Switch to workspace of index N
-- > -- mod-control-[1..9] %! Set index N to the current workspace
-- > ++
-- > zip (zip (repeat (modm)) [xK_1..xK_9]) (map (withWorkspaceIndex W.greedyView) [1..])
-- > ++
-- > zip (zip (repeat (modm .|. controlMask)) [xK_1..xK_9]) (map (setWorkspaceIndex) [1..])
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings". See also the documentation for
-- "XMonad.Actions.CopyWindow", 'windows', 'shift', and 'XPConfig'.
type WorkspaceTag = String
-- | The workspace index is mapped to a workspace tag by the user and
-- can be updated.
type WorkspaceIndex = Int
-- | Internal dynamic project state that stores a mapping between
-- workspace indexes and workspace tags.
data DynamicWorkspaceState = DynamicWorkspaceState {workspaceIndexMap :: Map.Map WorkspaceIndex WorkspaceTag}
deriving (Typeable, Read, Show)
instance ExtensionClass DynamicWorkspaceState where
initialValue = DynamicWorkspaceState Map.empty
extensionType = PersistentExtension
-- | Set the index of the current workspace.
setWorkspaceIndex :: WorkspaceIndex -> X ()
setWorkspaceIndex widx = do
wtag <- gets (currentTag . windowset)
wmap <- XS.gets workspaceIndexMap
XS.modify $ \s -> s {workspaceIndexMap = Map.insert widx wtag wmap}
withWorkspaceIndex :: (String -> WindowSet -> WindowSet) -> WorkspaceIndex -> X ()
withWorkspaceIndex job widx = do
wtag <- ilookup widx
maybe (return ()) (windows . job) wtag
where
ilookup :: WorkspaceIndex -> X (Maybe WorkspaceTag)
ilookup idx = Map.lookup idx `fmap` XS.gets workspaceIndexMap
mkCompl :: [String] -> String -> IO [String]
mkCompl l s = return $ filter (\x -> take (length s) x == s) l
withWorkspace :: XPConfig -> (String -> X ()) -> X ()
withWorkspace c job = do ws <- gets (workspaces . windowset)
sort <- getSortByIndex
let ts = map tag $ sort ws
job' t | t `elem` ts = job t
| otherwise = addHiddenWorkspace t >> job t
mkXPrompt (Wor "") c (mkCompl ts) job'
renameWorkspace :: XPConfig -> X ()
renameWorkspace conf = workspacePrompt conf renameWorkspaceByName
renameWorkspaceByName :: String -> X ()
renameWorkspaceByName w = do old <- gets (currentTag . windowset)
windows $ \s -> let sett wk = wk { tag = w }
setscr scr = scr { workspace = sett $ workspace scr }
sets q = q { current = setscr $ current q }
in sets $ removeWorkspace' w s
updateIndexMap old w
where updateIndexMap old new = do
wmap <- XS.gets workspaceIndexMap
XS.modify $ \s -> s {workspaceIndexMap = Map.map (\t -> if t == old then new else t) wmap}
toNthWorkspace :: (String -> X ()) -> Int -> X ()
toNthWorkspace job wnum = do sort <- getSortByIndex
ws <- gets (map tag . sort . workspaces . windowset)
case drop wnum ws of
(w:_) -> job w
[] -> return ()
withNthWorkspace :: (String -> WindowSet -> WindowSet) -> Int -> X ()
withNthWorkspace job wnum = do sort <- getSortByIndex
ws <- gets (map tag . sort . workspaces . windowset)
case drop wnum ws of
(w:_) -> windows $ job w
[] -> return ()
selectWorkspace :: XPConfig -> X ()
selectWorkspace conf = workspacePrompt conf $ \w ->
do s <- gets windowset
if tagMember w s
then windows $ greedyView w
else addWorkspace w
-- | Add a new workspace with the given name, or do nothing if a
-- workspace with the given name already exists; then switch to the
-- newly created workspace.
addWorkspace :: String -> X ()
addWorkspace = addWorkspaceAt (:)
-- | Same as addWorkspace, but adds the workspace to the end of the list of workspaces
appendWorkspace :: String -> X()
appendWorkspace = addWorkspaceAt (flip (++) . return)
-- | Adds a new workspace with the given name to the current list of workspaces.
-- This function allows the user to pass a function that inserts an element
-- into a list at an arbitrary spot.
addWorkspaceAt :: (WindowSpace -> [WindowSpace] -> [WindowSpace]) -> String -> X ()
addWorkspaceAt add newtag = addHiddenWorkspaceAt add newtag >> windows (greedyView newtag)
-- | Prompt for the name of a new workspace, add it if it does not
-- already exist, and switch to it.
addWorkspacePrompt :: XPConfig -> X ()
addWorkspacePrompt conf = mkXPrompt (Wor "New workspace name: ") conf (const (return [])) addWorkspace
-- | Prompt for the name of a new workspace, appending it to the end of the list of workspaces
-- if it does not already exist, and switch to it.
appendWorkspacePrompt :: XPConfig -> X ()
appendWorkspacePrompt conf = mkXPrompt (Wor "New workspace name: ") conf (const (return [])) appendWorkspace
-- | Add a new hidden workspace with the given name, or do nothing if
-- a workspace with the given name already exists. Takes a function to insert
-- the workspace at an arbitrary spot in the list.
addHiddenWorkspaceAt :: (WindowSpace -> [WindowSpace] -> [WindowSpace]) -> String -> X ()
addHiddenWorkspaceAt add newtag =
whenX (gets (not . tagMember newtag . windowset)) $ do
l <- asks (layoutHook . config)
windows (addHiddenWorkspace' add newtag l)
-- | Add a new hidden workspace with the given name, or do nothing if
-- a workspace with the given name already exists.
addHiddenWorkspace :: String -> X ()
addHiddenWorkspace = addHiddenWorkspaceAt (:)
-- | Remove the current workspace if it contains no windows.
removeEmptyWorkspace :: X ()
removeEmptyWorkspace = gets (currentTag . windowset) >>= removeEmptyWorkspaceByTag
-- | Remove the current workspace.
removeWorkspace :: X ()
removeWorkspace = gets (currentTag . windowset) >>= removeWorkspaceByTag
-- | Remove workspace with specific tag if it contains no windows.
removeEmptyWorkspaceByTag :: String -> X ()
removeEmptyWorkspaceByTag t = whenX (isEmpty t) $ removeWorkspaceByTag t
-- | Remove workspace with specific tag.
removeWorkspaceByTag :: String -> X ()
removeWorkspaceByTag torem = do
s <- gets windowset
case s of
StackSet { current = Screen { workspace = cur }, hidden = (w:_) } -> do
when (torem==tag cur) $ windows $ view $ tag w
windows $ removeWorkspace' torem
_ -> return ()
-- | Remove the current workspace after an operation if it is empty and hidden.
-- Can be used to remove a workspace if it is empty when leaving it. The
-- operation may only change workspace once, otherwise the workspace will not
-- be removed.
removeEmptyWorkspaceAfter :: X () -> X ()
removeEmptyWorkspaceAfter = removeEmptyWorkspaceAfterExcept []
-- | Like 'removeEmptyWorkspaceAfter' but use a list of sticky workspaces,
-- whose entries will never be removed.
removeEmptyWorkspaceAfterExcept :: [String] -> X () -> X ()
removeEmptyWorkspaceAfterExcept sticky f = do
before <- gets (currentTag . windowset)
f
after <- gets (currentTag . windowset)
when (before/=after && before `notElem` sticky) $ removeEmptyWorkspaceByTag before
isEmpty :: String -> X Bool
isEmpty t = do wsl <- gets $ workspaces . windowset
let mws = find (\ws -> tag ws == t) wsl
return $ maybe True (isNothing . stack) mws
addHiddenWorkspace' :: (Workspace i l a -> [Workspace i l a] -> [Workspace i l a]) -> i -> l -> StackSet i l a sid sd -> StackSet i l a sid sd
addHiddenWorkspace' add newtag l s@(StackSet { hidden = ws }) = s { hidden = add (Workspace newtag l Nothing) ws }
-- | Remove the hidden workspace with the given tag from the StackSet, if
-- it exists. All the windows in that workspace are moved to the current
-- workspace.
removeWorkspace' :: (Eq i) => i -> StackSet i l a sid sd -> StackSet i l a sid sd
removeWorkspace' torem s@(StackSet { current = scr@(Screen { workspace = wc })
, hidden = hs })
= let (xs, ys) = break ((== torem) . tag) hs
in removeWorkspace'' xs ys
where meld Nothing Nothing = Nothing
meld x Nothing = x
meld Nothing x = x
meld (Just x) (Just y) = differentiate (integrate x ++ integrate y)
removeWorkspace'' xs (y:ys) = s { current = scr { workspace = wc { stack = meld (stack y) (stack wc) } }
, hidden = xs ++ ys }
removeWorkspace'' _ _ = s

View File

@@ -1,52 +1,51 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.FindEmptyWorkspace
-- Module : XMonad.Actions.FindEmptyWorkspace
-- Copyright : (c) Miikka Koskinen 2007
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : arcatan@kapsi.fi
-- Stability : unstable
-- Stability : stable
-- Portability : unportable
--
-- Find an empty workspace in XMonad.
-- Find an empty workspace.
--
-----------------------------------------------------------------------------
module XMonadContrib.FindEmptyWorkspace (
module XMonad.Actions.FindEmptyWorkspace (
-- * Usage
-- $usage
viewEmptyWorkspace, tagToEmptyWorkspace
viewEmptyWorkspace, tagToEmptyWorkspace, sendToEmptyWorkspace
) where
import Control.Monad.State
import Data.List
import Data.Maybe ( isNothing )
import XMonad
import StackSet
import qualified Operations as O
import XMonad.StackSet
-- $usage
--
-- To use, modify your Config.hs to:
--
-- > import XMonadContrib.FindEmptyWorkspace
-- To use, import this module into your @~\/.xmonad\/xmonad.hs@:
--
-- and add a keybinding:
-- > import XMonad.Actions.FindEmptyWorkspace
--
-- > , ((modMask, xK_m ), viewEmptyWorkspace)
-- > , ((modMask .|. shiftMask, xK_m ), tagToEmptyWorkspace)
-- and add the desired keybindings, for example:
--
-- Now you can jump to an empty workspace with mod-m. Mod-shift-m will
-- tag the current window to an empty workspace and view it.
-- > , ((modm, xK_m ), viewEmptyWorkspace)
-- > , ((modm .|. shiftMask, xK_m ), tagToEmptyWorkspace)
--
-- Now you can jump to an empty workspace with @mod-m@. @Mod-shift-m@
-- will tag the current window to an empty workspace and view it.
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Find the first hidden empty workspace in a StackSet. Returns
-- Nothing if all workspaces are in use. Function searches currently
-- focused workspace, other visible workspaces (when in Xinerama) and
-- hidden workspaces in this order.
findEmptyWorkspace :: StackSet i a s sd -> Maybe (Workspace i a)
findEmptyWorkspace :: StackSet i l a s sd -> Maybe (Workspace i l a)
findEmptyWorkspace = find (isNothing . stack) . allWorkspaces
where
allWorkspaces ss = (workspace . current) ss :
@@ -60,9 +59,14 @@ withEmptyWorkspace f = do
-- | Find and view an empty workspace. Do nothing if all workspaces are
-- in use.
viewEmptyWorkspace :: X ()
viewEmptyWorkspace = withEmptyWorkspace O.view
viewEmptyWorkspace = withEmptyWorkspace (windows . view)
-- | Tag current window to an empty workspace and view it. Do nothing if
-- all workspaces are in use.
tagToEmptyWorkspace :: X ()
tagToEmptyWorkspace = withEmptyWorkspace $ \w -> O.shift w >> O.view w
tagToEmptyWorkspace = withEmptyWorkspace $ \w -> windows $ view w . shift w
-- | Send current window to an empty workspace. Do nothing if
-- all workspaces are in use.
sendToEmptyWorkspace :: X ()
sendToEmptyWorkspace = withEmptyWorkspace $ \w -> windows $ shift w

View File

@@ -0,0 +1,135 @@
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.FlexibleManipulate
-- Copyright : (c) Michael Sloan
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : <mgsloan@gmail.com>
-- Stability : stable
-- Portability : unportable
--
-- Move and resize floating windows without warping the mouse.
--
-----------------------------------------------------------------------------
-- Based on the FlexibleResize code by Lukas Mai (mauke).
module XMonad.Actions.FlexibleManipulate (
-- * Usage
-- $usage
mouseWindow, discrete, linear, resize, position
) where
import XMonad
import qualified Prelude as P
import Prelude (($), (.), fst, snd, uncurry, const, id, Ord(..), Monad(..), fromIntegral, Double, Integer, map, round, otherwise)
-- $usage
-- First, add this import to your @~\/.xmonad\/xmonad.hs@:
--
-- > import qualified XMonad.Actions.FlexibleManipulate as Flex
--
-- Now set up the desired mouse binding, for example:
--
-- > , ((modm, button1), (\w -> focus w >> Flex.mouseWindow Flex.linear w))
--
-- * Flex.'linear' indicates that positions between the edges and the
-- middle indicate a combination scale\/position.
--
-- * Flex.'discrete' indicates that there are discrete pick
-- regions. (The window is divided by thirds for each axis.)
--
-- * Flex.'resize' performs only a resize of the window, based on which
-- quadrant the mouse is in.
--
-- * Flex.'position' is similar to the built-in
-- 'XMonad.Operations.mouseMoveWindow'.
--
-- You can also write your own function for this parameter. It should take
-- a value between 0 and 1 indicating position, and return a value indicating
-- the corresponding position if plain Flex.'linear' was used.
--
-- For detailed instructions on editing your mouse bindings, see
-- "XMonad.Doc.Extending#Editing_mouse_bindings".
discrete, linear, resize, position :: Double -> Double
-- | Manipulate the window based on discrete pick regions; the window
-- is divided into regions by thirds along each axis.
discrete x | x < 0.33 = 0
| x > 0.66 = 1
| otherwise = 0.5
-- | Scale\/reposition the window by factors obtained from the mouse
-- position by linear interpolation. Dragging precisely on a corner
-- resizes that corner; dragging precisely in the middle moves the
-- window without resizing; anything else is an interpolation
-- between the two.
linear = id
-- | Only resize the window, based on the window quadrant the mouse is in.
resize x = if x < 0.5 then 0 else 1
-- | Only reposition the window.
position = const 0.5
-- | Given an interpolation function, implement an appropriate window
-- manipulation action.
mouseWindow :: (Double -> Double) -> Window -> X ()
mouseWindow f w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
[wpos, wsize] <- io $ getWindowAttributes d w >>= return . winAttrs
sh <- io $ getWMNormalHints d w
pointer <- io $ queryPointer d w >>= return . pointerPos
let uv = (pointer - wpos) / wsize
fc = mapP f uv
mul = mapP (\x -> 2 P.- 2 P.* P.abs(x P.- 0.5)) fc --Fudge factors: interpolation between 1 when on edge, 2 in middle
atl = ((1, 1) - fc) * mul
abr = fc * mul
mouseDrag (\ex ey -> io $ do
let offset = (fromIntegral ex, fromIntegral ey) - pointer
npos = wpos + offset * atl
nbr = (wpos + wsize) + offset * abr
ntl = minP (nbr - (32, 32)) npos --minimum size
nwidth = applySizeHintsContents sh $ mapP (round :: Double -> Integer) (nbr - ntl)
moveResizeWindow d w (round $ fst ntl) (round $ snd ntl) `uncurry` nwidth
return ())
(float w)
float w
where
pointerPos (_,_,_,px,py,_,_,_) = (fromIntegral px,fromIntegral py) :: Pnt
winAttrs :: WindowAttributes -> [Pnt]
winAttrs x = pairUp $ map (fromIntegral . ($ x)) [wa_x, wa_y, wa_width, wa_height]
-- I'd rather I didn't have to do this, but I hate writing component 2d math
type Pnt = (Double, Double)
pairUp :: [a] -> [(a,a)]
pairUp [] = []
pairUp [_] = []
pairUp (x:y:xs) = (x, y) : (pairUp xs)
mapP :: (a -> b) -> (a, a) -> (b, b)
mapP f (x, y) = (f x, f y)
zipP :: (a -> b -> c) -> (a,a) -> (b,b) -> (c,c)
zipP f (ax,ay) (bx,by) = (f ax bx, f ay by)
minP :: Ord a => (a,a) -> (a,a) -> (a,a)
minP = zipP min
infixl 6 +, -
infixl 7 *, /
(+), (-), (*) :: (P.Num a) => (a,a) -> (a,a) -> (a,a)
(+) = zipP (P.+)
(-) = zipP (P.-)
(*) = zipP (P.*)
(/) :: (P.Fractional a) => (a,a) -> (a,a) -> (a,a)
(/) = zipP (P./)

View File

@@ -0,0 +1,79 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.FlexibleResize
-- Copyright : (c) Lukas Mai
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : <l.mai@web.de>
-- Stability : unstable
-- Portability : unportable
--
-- Resize floating windows from any corner.
--
-----------------------------------------------------------------------------
module XMonad.Actions.FlexibleResize (
-- * Usage
-- $usage
XMonad.Actions.FlexibleResize.mouseResizeWindow,
XMonad.Actions.FlexibleResize.mouseResizeEdgeWindow
) where
import XMonad
import XMonad.Util.XUtils (fi)
import Foreign.C.Types
-- $usage
-- To use, first import this module into your @~\/.xmonad\/xmonad.hs@ file:
--
-- > import qualified XMonad.Actions.FlexibleResize as Flex
--
-- Then add an appropriate mouse binding:
--
-- > , ((modm, button3), (\w -> focus w >> Flex.mouseResizeWindow w))
--
-- For detailed instructions on editing your mouse bindings, see
-- "XMonad.Doc.Extending#Editing_mouse_bindings".
-- | Resize a floating window from whichever corner the mouse is
-- closest to.
mouseResizeWindow
:: Window -- ^ The window to resize.
-> X ()
mouseResizeWindow = mouseResizeEdgeWindow 0
-- | Resize a floating window from whichever corner or edge the mouse is
-- closest to.
mouseResizeEdgeWindow
:: Rational -- ^ The size of the area where only one edge is resized.
-> Window -- ^ The window to resize.
-> X ()
mouseResizeEdgeWindow edge w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
sh <- io $ getWMNormalHints d w
(_, _, _, _, _, ix, iy, _) <- io $ queryPointer d w
let
[pos_x, pos_y, width, height] = map (fi . ($ wa)) [wa_x, wa_y, wa_width, wa_height]
west = findPos ix width
north = findPos iy height
(cx, fx, gx) = mkSel west width pos_x
(cy, fy, gy) = mkSel north height pos_y
io $ warpPointer d none w 0 0 0 0 cx cy
mouseDrag (\ex ey -> do let (nw,nh) = applySizeHintsContents sh (gx ex, gy ey)
io $ moveResizeWindow d w (fx nw) (fy nh) nw nh)
(float w)
where
findPos :: CInt -> Position -> Maybe Bool
findPos m s = if p < 0.5 - edge/2
then Just True
else if p < 0.5 + edge/2
then Nothing
else Just False
where p = fi m / fi s
mkSel :: Maybe Bool -> Position -> Position -> (Position, Dimension -> Position, Position -> Dimension)
mkSel b k p = case b of
Just True -> (0, (fi k + fi p -).fi, (fi k + fi p -).fi)
Nothing -> (k `div` 2, const p, const $ fi k)
Just False -> (k, const p, subtract (fi p) . fi)

123
XMonad/Actions/FloatKeys.hs Normal file
View File

@@ -0,0 +1,123 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.FloatKeys
-- Copyright : (c) Karsten Schoelzel <kuser@gmx.de>
-- License : BSD
--
-- Maintainer : Karsten Schoelzel <kuser@gmx.de>
-- Stability : stable
-- Portability : unportable
--
-- Move and resize floating windows.
-----------------------------------------------------------------------------
module XMonad.Actions.FloatKeys (
-- * Usage
-- $usage
keysMoveWindow,
keysMoveWindowTo,
keysResizeWindow,
keysAbsResizeWindow,
P, G,
) where
import XMonad
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.FloatKeys
--
-- Then add appropriate key bindings, for example:
--
-- > , ((modm, xK_d ), withFocused (keysResizeWindow (-10,-10) (1,1)))
-- > , ((modm, xK_s ), withFocused (keysResizeWindow (10,10) (1,1)))
-- > , ((modm .|. shiftMask, xK_d ), withFocused (keysAbsResizeWindow (-10,-10) (1024,752)))
-- > , ((modm .|. shiftMask, xK_s ), withFocused (keysAbsResizeWindow (10,10) (1024,752)))
-- > , ((modm, xK_a ), withFocused (keysMoveWindowTo (512,384) (1%2,1%2)))
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | @keysMoveWindow (dx, dy)@ moves the window by @dx@ pixels to the
-- right and @dy@ pixels down.
keysMoveWindow :: D -> Window -> X ()
keysMoveWindow (dx,dy) w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
io $ moveWindow d w (fromIntegral (fromIntegral (wa_x wa) + dx))
(fromIntegral (fromIntegral (wa_y wa) + dy))
float w
-- | @keysMoveWindowTo (x, y) (gx, gy)@ moves the window relative
-- point @(gx, gy)@ to the point @(x,y)@, where @(gx,gy)@ gives a
-- position relative to the window border, i.e. @gx = 0@ is the left
-- border, @gx = 1@ is the right border, @gy = 0@ is the top border, and
-- @gy = 1@ the bottom border.
--
-- For example, on a 1024x768 screen:
--
-- > keysMoveWindowTo (512,384) (1%2, 1%2) -- center the window on screen
-- > keysMoveWindowTo (1024,0) (1, 0) -- put window in the top right corner
keysMoveWindowTo :: P -> G -> Window -> X ()
keysMoveWindowTo (x,y) (gx, gy) w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
io $ moveWindow d w (x - round (gx * fromIntegral (wa_width wa)))
(y - round (gy * fromIntegral (wa_height wa)))
float w
type G = (Rational, Rational)
type P = (Position, Position)
-- | @keysResizeWindow (dx, dy) (gx, gy)@ changes the width by @dx@
-- and the height by @dy@, leaving the window-relative point @(gx,
-- gy)@ fixed.
--
-- For example:
--
-- > keysResizeWindow (10, 0) (0, 0) -- make the window 10 pixels larger to the right
-- > keysResizeWindow (10, 0) (0, 1%2) -- does the same, unless sizeHints are applied
-- > keysResizeWindow (10, 10) (1%2, 1%2) -- add 5 pixels on each side
-- > keysResizeWindow (-10, -10) (0, 1) -- shrink the window in direction of the bottom-left corner
keysResizeWindow :: D -> G -> Window -> X ()
keysResizeWindow = keysMoveResize keysResizeWindow'
-- | @keysAbsResizeWindow (dx, dy) (ax, ay)@ changes the width by @dx@
-- and the height by @dy@, leaving the screen absolute point @(ax,
-- ay)@ fixed.
--
-- For example:
--
-- > keysAbsResizeWindow (10, 10) (0, 0) -- enlarge the window; if it is not in the top-left corner it will also be moved down and to the right.
keysAbsResizeWindow :: D -> D -> Window -> X ()
keysAbsResizeWindow = keysMoveResize keysAbsResizeWindow'
keysAbsResizeWindow' :: SizeHints -> P -> D -> D -> D -> (P,D)
keysAbsResizeWindow' sh (x,y) (w,h) (dx,dy) (ax, ay) = ((round nx, round ny), (nw, nh))
where
(nw, nh) = applySizeHintsContents sh (w + dx, h + dy)
nx :: Rational
nx = fromIntegral (ax * w + nw * (fromIntegral x - ax)) / fromIntegral w
ny :: Rational
ny = fromIntegral (ay * h + nh * (fromIntegral y - ay)) / fromIntegral h
keysResizeWindow' :: SizeHints -> P -> D -> D -> G -> (P,D)
keysResizeWindow' sh (x,y) (w,h) (dx,dy) (gx, gy) = ((nx, ny), (nw, nh))
where
(nw, nh) = applySizeHintsContents sh (w + dx, h + dy)
nx = round $ fromIntegral x + gx * fromIntegral w - gx * fromIntegral nw
ny = round $ fromIntegral y + gy * fromIntegral h - gy * fromIntegral nh
keysMoveResize :: (SizeHints -> P -> D -> a -> b -> (P,D)) -> a -> b -> Window -> X ()
keysMoveResize f move resize w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
sh <- io $ getWMNormalHints d w
let wa_dim = (fromIntegral $ wa_width wa, fromIntegral $ wa_height wa)
wa_pos = (fromIntegral $ wa_x wa, fromIntegral $ wa_y wa)
(wn_pos, wn_dim) = f sh wa_pos wa_dim move resize
io $ resizeWindow d w `uncurry` wn_dim
io $ moveWindow d w `uncurry` wn_pos
float w

338
XMonad/Actions/FloatSnap.hs Normal file
View File

@@ -0,0 +1,338 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Layout.FloatSnap
-- Copyright : (c) 2009 Anders Engstrom <ankaan@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Anders Engstrom <ankaan@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- Move and resize floating windows using other windows and the edge of the
-- screen as guidelines.
-----------------------------------------------------------------------------
module XMonad.Actions.FloatSnap (
-- * Usage
-- $usage
Direction2D(..),
snapMove,
snapGrow,
snapShrink,
snapMagicMove,
snapMagicResize,
snapMagicMouseResize,
afterDrag,
ifClick,
ifClick') where
import XMonad
import Control.Applicative((<$>))
import Data.List (sort)
import Data.Maybe (listToMaybe,fromJust,isNothing)
import qualified XMonad.StackSet as W
import qualified Data.Set as S
import XMonad.Hooks.ManageDocks (calcGap)
import XMonad.Util.Types (Direction2D(..))
import XMonad.Actions.AfterDrag
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.FloatSnap
--
-- Then add appropriate key bindings, for example:
--
-- > , ((modm, xK_Left), withFocused $ snapMove L Nothing)
-- > , ((modm, xK_Right), withFocused $ snapMove R Nothing)
-- > , ((modm, xK_Up), withFocused $ snapMove U Nothing)
-- > , ((modm, xK_Down), withFocused $ snapMove D Nothing)
-- > , ((modm .|. shiftMask, xK_Left), withFocused $ snapShrink R Nothing)
-- > , ((modm .|. shiftMask, xK_Right), withFocused $ snapGrow R Nothing)
-- > , ((modm .|. shiftMask, xK_Up), withFocused $ snapShrink D Nothing)
-- > , ((modm .|. shiftMask, xK_Down), withFocused $ snapGrow D Nothing)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
--
-- And possibly add appropriate mouse bindings, for example:
--
-- > , ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> ifClick (snapMagicMove (Just 50) (Just 50) w)))
-- > , ((modm .|. shiftMask, button1), (\w -> focus w >> mouseMoveWindow w >> ifClick (snapMagicResize [L,R,U,D] (Just 50) (Just 50) w)))
-- > , ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> ifClick (snapMagicResize [R,D] (Just 50) (Just 50) w)))
--
-- For detailed instructions on editing your mouse bindings, see
-- "XMonad.Doc.Extending#Editing_mouse_bindings".
--
-- Using these mouse bindings, it will not snap while moving, but allow you to click the window once after it has been moved or resized to snap it into place.
-- Note that the order in which the commands are applied in the mouse bindings are important. Snapping can also be used together with other window resizing
-- functions, such as those from "XMonad.Actions.FlexibleResize"
--
-- An alternative set of mouse bindings that will always snap after the drag is:
--
-- > , ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> afterDrag (snapMagicMove (Just 50) (Just 50) w)))
-- > , ((modm .|. shiftMask, button1), (\w -> focus w >> mouseMoveWindow w >> afterDrag (snapMagicResize [L,R,U,D] (Just 50) (Just 50) w)))
-- > , ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> afterDrag (snapMagicResize [R,D] (Just 50) (Just 50) w)))
--
-- Interesting values for the distance to look for window in the orthogonal axis are Nothing (to snap against every window), Just 0 (to only snap
-- against windows that we should collide with geometrically while moving) and Just 1 (to also snap against windows we brush against).
--
-- For 'snapMagicMove', 'snapMagicResize' and 'snapMagicMouseResize', try instead setting it to the same as the maximum snapping distance.
--
-- When a value is specified it can be geometrically conceived as adding a border with the specified width around the window and then checking which
-- windows it should collide with.
-- | Resize the window by each edge independently to snap against the closest part of other windows or the edge of the screen. Use the location of the
-- mouse over the window to decide which edges to snap. In corners, the two adjoining edges will be snapped, along the middle of an edge only that edge
-- will be snapped. In the center of the window all edges will snap. Intended to be used together with "XMonad.Actions.FlexibleResize" or
-- "XMonad.Actions.FlexibleManipulate".
snapMagicMouseResize
:: Rational -- ^ How big the middle snap area of each axis should be.
-> Maybe Int -- ^ The distance in the orthogonal axis to look for windows to snap against. Use Nothing to snap against every window.
-> Maybe Int -- ^ The maximum distance to snap. Use Nothing to not impose any boundary.
-> Window -- ^ The window to move and resize.
-> X ()
snapMagicMouseResize middle collidedist snapdist w = whenX (isClient w) $ withDisplay $ \d -> do
wa <- io $ getWindowAttributes d w
(_, _, _, px, py, _, _, _) <- io $ queryPointer d w
let x = (fromIntegral px - wx wa)/(ww wa)
y = (fromIntegral py - wy wa)/(wh wa)
ml = if x <= (0.5 - middle/2) then [L] else []
mr = if x > (0.5 + middle/2) then [R] else []
mu = if y <= (0.5 - middle/2) then [U] else []
md = if y > (0.5 + middle/2) then [D] else []
mdir = ml++mr++mu++md
dir = if mdir == []
then [L,R,U,D]
else mdir
snapMagicResize dir collidedist snapdist w
where
wx = fromIntegral.wa_x
wy = fromIntegral.wa_y
ww = fromIntegral.wa_width
wh = fromIntegral.wa_height
-- | Resize the window by each edge independently to snap against the closest part of other windows or the edge of the screen.
snapMagicResize
:: [Direction2D] -- ^ The edges to snap.
-> Maybe Int -- ^ The distance in the orthogonal axis to look for windows to snap against. Use Nothing to snap against every window.
-> Maybe Int -- ^ The maximum distance to snap. Use Nothing to not impose any boundary.
-> Window -- ^ The window to move and resize.
-> X ()
snapMagicResize dir collidedist snapdist w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
(xbegin,xend) <- handleAxis True d wa
(ybegin,yend) <- handleAxis False d wa
let xbegin' = if L `elem` dir then xbegin else (wx wa)
xend' = if R `elem` dir then xend else (wx wa + ww wa)
ybegin' = if U `elem` dir then ybegin else (wy wa)
yend' = if D `elem` dir then yend else (wy wa + wh wa)
io $ moveWindow d w (fromIntegral $ xbegin') (fromIntegral $ ybegin')
io $ resizeWindow d w (fromIntegral $ xend' - xbegin') (fromIntegral $ yend' - ybegin')
float w
where
wx = fromIntegral.wa_x
wy = fromIntegral.wa_y
ww = fromIntegral.wa_width
wh = fromIntegral.wa_height
handleAxis horiz d wa = do
((mbl,mbr,bs),(mfl,mfr,fs)) <- getSnap horiz collidedist d w
let begin = if bs
then wpos wa
else case (mbl,mbr) of
(Just bl,Just br) -> if wpos wa - bl < br - wpos wa then bl else br
(Just bl,Nothing) -> bl
(Nothing,Just br) -> br
(Nothing,Nothing) -> wpos wa
end = if fs
then wpos wa + wdim wa
else case (if mfl==(Just begin) then Nothing else mfl,mfr) of
(Just fl,Just fr) -> if wpos wa + wdim wa - fl < fr - wpos wa - wdim wa then fl else fr
(Just fl,Nothing) -> fl
(Nothing,Just fr) -> fr
(Nothing,Nothing) -> wpos wa + wdim wa
begin' = if isNothing snapdist || abs (begin - wpos wa) <= fromJust snapdist then begin else (wpos wa)
end' = if isNothing snapdist || abs (end - wpos wa - wdim wa) <= fromJust snapdist then end else (wpos wa + wdim wa)
return (begin',end')
where
(wpos, wdim, _, _) = constructors horiz
-- | Move a window by both axises in any direction to snap against the closest part of other windows or the edge of the screen.
snapMagicMove
:: Maybe Int -- ^ The distance in the orthogonal axis to look for windows to snap against. Use Nothing to snap against every window.
-> Maybe Int -- ^ The maximum distance to snap. Use Nothing to not impose any boundary.
-> Window -- ^ The window to move.
-> X ()
snapMagicMove collidedist snapdist w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
nx <- handleAxis True d wa
ny <- handleAxis False d wa
io $ moveWindow d w (fromIntegral nx) (fromIntegral ny)
float w
where
handleAxis horiz d wa = do
((mbl,mbr,bs),(mfl,mfr,fs)) <- getSnap horiz collidedist d w
return $ if bs || fs
then wpos wa
else let b = case (mbl,mbr) of
(Just bl,Just br) -> if wpos wa - bl < br - wpos wa then bl else br
(Just bl,Nothing) -> bl
(Nothing,Just br) -> br
(Nothing,Nothing) -> wpos wa
f = case (mfl,mfr) of
(Just fl,Just fr) -> if wpos wa + wdim wa - fl < fr - wpos wa - wdim wa then fl else fr
(Just fl,Nothing) -> fl
(Nothing,Just fr) -> fr
(Nothing,Nothing) -> wpos wa
newpos = if abs (b - wpos wa) <= abs (f - wpos wa - wdim wa) then b else (f - wdim wa)
in if isNothing snapdist || abs (newpos - wpos wa) <= fromJust snapdist then newpos else (wpos wa)
where
(wpos, wdim, _, _) = constructors horiz
-- | Move a window in the specified direction until it snaps against another window or the edge of the screen.
snapMove
:: Direction2D -- ^ What direction to move the window in.
-> Maybe Int -- ^ The distance in the orthogonal axis to look for windows to snap against. Use Nothing to snap against every window.
-> Window -- ^ The window to move.
-> X ()
snapMove L = doSnapMove True True
snapMove R = doSnapMove True False
snapMove U = doSnapMove False True
snapMove D = doSnapMove False False
doSnapMove :: Bool -> Bool -> Maybe Int -> Window -> X ()
doSnapMove horiz rev collidedist w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
((bl,br,_),(fl,fr,_)) <- getSnap horiz collidedist d w
let (mb,mf) = if rev then (bl,fl)
else (br,fr)
newpos = fromIntegral $ case (mb,mf) of
(Just b,Nothing) -> b
(Nothing,Just f) -> f - wdim wa
(Just b,Just f) -> if rev /= (b < f - wdim wa)
then b
else f - wdim wa
_ -> wpos wa
if horiz then io $ moveWindow d w newpos (fromIntegral $ wa_y wa)
else io $ moveWindow d w (fromIntegral $ wa_x wa) newpos
float w
where
(wpos, wdim, _, _) = constructors horiz
-- | Grow the specified edge of a window until it snaps against another window or the edge of the screen.
snapGrow
:: Direction2D -- ^ What edge of the window to grow.
-> Maybe Int -- ^ The distance in the orthogonal axis to look for windows to snap against. Use Nothing to snap against every window.
-> Window -- ^ The window to grow.
-> X ()
snapGrow = snapResize True
-- | Shrink the specified edge of a window until it snaps against another window or the edge of the screen.
snapShrink
:: Direction2D -- ^ What edge of the window to shrink.
-> Maybe Int -- ^ The distance in the orthogonal axis to look for windows to snap against. Use Nothing to snap against every window.
-> Window -- ^ The window to shrink.
-> X ()
snapShrink = snapResize False
snapResize :: Bool -> Direction2D -> Maybe Int -> Window -> X ()
snapResize grow dir collidedist w = whenX (isClient w) $ withDisplay $ \d -> do
io $ raiseWindow d w
wa <- io $ getWindowAttributes d w
mr <- case dir of
L -> do ((mg,ms,_),(_,_,_)) <- getSnap True collidedist d w
return $ case (if grow then mg else ms) of
Just v -> Just (v, wy wa, ww wa + wx wa - v, wh wa)
_ -> Nothing
R -> do ((_,_,_),(ms,mg,_)) <- getSnap True collidedist d w
return $ case (if grow then mg else ms) of
Just v -> Just (wx wa, wy wa, v - wx wa, wh wa)
_ -> Nothing
U -> do ((mg,ms,_),(_,_,_)) <- getSnap False collidedist d w
return $ case (if grow then mg else ms) of
Just v -> Just (wx wa, v, ww wa, wh wa + wy wa - v)
_ -> Nothing
D -> do ((_,_,_),(ms,mg,_)) <- getSnap False collidedist d w
return $ case (if grow then mg else ms) of
Just v -> Just (wx wa, wy wa, ww wa, v - wy wa)
_ -> Nothing
case mr of
Nothing -> return ()
Just (nx,ny,nw,nh) -> if nw>0 && nh>0 then do io $ moveWindow d w (fromIntegral nx) (fromIntegral ny)
io $ resizeWindow d w (fromIntegral nw) (fromIntegral nh)
else return ()
float w
where
wx = fromIntegral.wa_x
wy = fromIntegral.wa_y
ww = fromIntegral.wa_width
wh = fromIntegral.wa_height
getSnap :: Bool -> Maybe Int -> Display -> Window -> X ((Maybe Int,Maybe Int,Bool),(Maybe Int,Maybe Int,Bool))
getSnap horiz collidedist d w = do
wa <- io $ getWindowAttributes d w
screen <- W.current <$> gets windowset
let sr = screenRect $ W.screenDetail screen
wl = W.integrate' . W.stack $ W.workspace screen
gr <- fmap ($sr) $ calcGap $ S.fromList [minBound .. maxBound]
wla <- filter (collides wa) `fmap` (io $ mapM (getWindowAttributes d) $ filter (/=w) wl)
return ( neighbours (back wa sr gr wla) (wpos wa)
, neighbours (front wa sr gr wla) (wpos wa + wdim wa)
)
where
wborder = fromIntegral.wa_border_width
(wpos, wdim, rpos, rdim) = constructors horiz
(refwpos, refwdim, _, _) = constructors $ not horiz
back wa sr gr wla = dropWhile (< rpos sr) $
takeWhile (< rpos sr + rdim sr) $
sort $ (rpos sr):(rpos gr):(rpos gr + rdim gr):
foldr (\a as -> (wpos a):(wpos a + wdim a + wborder a + wborder wa):as) [] wla
front wa sr gr wla = dropWhile (<= rpos sr) $
takeWhile (<= rpos sr + rdim sr) $
sort $ (rpos gr - 2*wborder wa):(rpos gr + rdim gr - 2*wborder wa):(rpos sr + rdim sr - 2*wborder wa):
foldr (\a as -> (wpos a - wborder a - wborder wa):(wpos a + wdim a):as) [] wla
neighbours l v = ( listToMaybe $ reverse $ takeWhile (< v) l
, listToMaybe $ dropWhile (<= v) l
, v `elem` l
)
collides wa oa = case collidedist of
Nothing -> True
Just dist -> ( refwpos oa - wborder oa < refwpos wa + refwdim wa + wborder wa + dist
&& refwpos wa - wborder wa - dist < refwpos oa + refwdim oa + wborder oa )
constructors :: Bool -> (WindowAttributes -> Int, WindowAttributes -> Int, Rectangle -> Int, Rectangle -> Int)
constructors True = ( fromIntegral.wa_x
, fromIntegral.wa_width
, fromIntegral.rect_x
, fromIntegral.rect_width
)
constructors False = ( fromIntegral.wa_y
, fromIntegral.wa_height
, fromIntegral.rect_y
, fromIntegral.rect_height
)

View File

@@ -0,0 +1,62 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.FocusNth
-- Copyright : (c) Karsten Schoelzel <kuser@gmx.de>
-- License : BSD
--
-- Maintainer : Karsten Schoelzel <kuser@gmx.de>
-- Stability : stable
-- Portability : unportable
--
-- Focus the nth window of the current workspace.
-----------------------------------------------------------------------------
module XMonad.Actions.FocusNth (
-- * Usage
-- $usage
focusNth,focusNth',
swapNth,swapNth') where
import XMonad.StackSet
import XMonad
-- $usage
-- Add the import to your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.FocusNth
--
-- Then add appropriate keybindings, for example:
--
-- > -- mod4-[1..9] @@ Switch to window N
-- > ++ [((modm, k), focusNth i)
-- > | (i, k) <- zip [0 .. 8] [xK_1 ..]]
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Give focus to the nth window of the current workspace.
focusNth :: Int -> X ()
focusNth = windows . modify' . focusNth'
focusNth' :: Int -> Stack a -> Stack a
focusNth' n s@(Stack _ ls rs) | (n < 0) || (n > length(ls) + length(rs)) = s
| otherwise = listToStack n (integrate s)
-- | Swap current window with nth. Focus stays in the same position
swapNth :: Int -> X ()
swapNth = windows . modify' . swapNth'
swapNth' :: Int -> Stack a -> Stack a
swapNth' n s@(Stack c l r)
| (n < 0) || (n > length l + length r) || (n == length l) = s
| n < length l = let (nl, nc:nr) = splitAt (length l - n - 1) l in Stack nc (nl ++ c : nr) r
| otherwise = let (nl, nc:nr) = splitAt (n - length l - 1) r in Stack nc l (nl ++ c : nr)
listToStack :: Int -> [a] -> Stack a
listToStack n l = Stack t ls rs
where
(t:rs) = drop n l
ls = reverse (take n l)

View File

@@ -0,0 +1,795 @@
{-# LANGUAGE ScopedTypeVariables, GeneralizedNewtypeDeriving, TypeSynonymInstances, FlexibleInstances, OverlappingInstances #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.GridSelect
-- Copyright : Clemens Fruhwirth <clemens@endorphin.org>
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Clemens Fruhwirth <clemens@endorphin.org>
-- Stability : unstable
-- Portability : unportable
--
-- GridSelect displays items(e.g. the opened windows) in a 2D grid and lets
-- the user select from it with the cursor/hjkl keys or the mouse.
--
-----------------------------------------------------------------------------
module XMonad.Actions.GridSelect (
-- * Usage
-- $usage
-- ** Customizing
-- *** Using a common GSConfig
-- $commonGSConfig
-- *** Custom keybindings
-- $keybindings
-- * Configuration
GSConfig(..),
def,
defaultGSConfig,
TwoDPosition,
buildDefaultGSConfig,
-- * Variations on 'gridselect'
gridselect,
gridselectWindow,
withSelectedWindow,
bringSelected,
goToSelected,
gridselectWorkspace,
gridselectWorkspace',
spawnSelected,
runSelectedAction,
-- * Colorizers
HasColorizer(defaultColorizer),
fromClassName,
stringColorizer,
colorRangeFromClassName,
-- * Navigation Mode assembly
TwoD,
makeXEventhandler,
shadowWithKeymap,
-- * Built-in Navigation Mode
defaultNavigation,
substringSearch,
navNSearch,
-- * Navigation Components
setPos,
move,
moveNext, movePrev,
select,
cancel,
transformSearchString,
-- * Rearrangers
-- $rearrangers
Rearranger,
noRearranger,
searchStringRearrangerGenerator,
-- * Screenshots
-- $screenshots
-- * Types
TwoDState,
) where
import Data.Maybe
import Data.Bits
import Data.Char
import Data.Ord (comparing)
import Control.Applicative
import Control.Monad.State
import Control.Arrow
import Data.List as L
import qualified Data.Map as M
import XMonad hiding (liftX)
import XMonad.Util.Font
import XMonad.Prompt (mkUnmanagedWindow)
import XMonad.StackSet as W
import XMonad.Layout.Decoration
import XMonad.Util.NamedWindows
import XMonad.Actions.WindowBringer (bringWindow)
import Text.Printf
import System.Random (mkStdGen, genRange, next)
import Data.Word (Word8)
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.GridSelect
--
-- Then add a keybinding, e.g.
--
-- > , ((modm, xK_g), goToSelected defaultGSConfig)
--
-- This module also supports displaying arbitrary information in a grid and letting
-- the user select from it. E.g. to spawn an application from a given list, you
-- can use the following:
--
-- > , ((modm, xK_s), spawnSelected defaultGSConfig ["xterm","gmplayer","gvim"])
-- $commonGSConfig
--
-- It is possible to bind a @gsconfig@ at top-level in your configuration. Like so:
--
-- > -- the top of your config
-- > {-# LANGUAGE NoMonomorphismRestriction #-}
-- > import XMonad
-- > ...
-- > gsconfig1 = defaultGSConfig { gs_cellheight = 30, gs_cellwidth = 100 }
--
-- An example where 'buildDefaultGSConfig' is used instead of 'defaultGSConfig'
-- in order to specify a custom colorizer is @gsconfig2@ (found in
-- "XMonad.Actions.GridSelect#Colorizers"):
--
-- > gsconfig2 colorizer = (buildDefaultGSConfig colorizer) { gs_cellheight = 30, gs_cellwidth = 100 }
--
-- > -- | A green monochrome colorizer based on window class
-- > greenColorizer = colorRangeFromClassName
-- > black -- lowest inactive bg
-- > (0x70,0xFF,0x70) -- highest inactive bg
-- > black -- active bg
-- > white -- inactive fg
-- > white -- active fg
-- > where black = minBound
-- > white = maxBound
--
-- Then you can bind to:
--
-- > ,((modm, xK_g), goToSelected $ gsconfig2 myWinColorizer)
-- > ,((modm, xK_p), spawnSelected $ spawnSelected defaultColorizer)
-- $keybindings
--
-- You can build you own navigation mode and submodes by combining the
-- exported action ingredients and assembling them using 'makeXEventhandler' and 'shadowWithKeymap'.
--
-- > myNavigation :: TwoD a (Maybe a)
-- > myNavigation = makeXEventhandler $ shadowWithKeymap navKeyMap navDefaultHandler
-- > where navKeyMap = M.fromList [
-- > ((0,xK_Escape), cancel)
-- > ,((0,xK_Return), select)
-- > ,((0,xK_slash) , substringSearch myNavigation)
-- > ,((0,xK_Left) , move (-1,0) >> myNavigation)
-- > ,((0,xK_h) , move (-1,0) >> myNavigation)
-- > ,((0,xK_Right) , move (1,0) >> myNavigation)
-- > ,((0,xK_l) , move (1,0) >> myNavigation)
-- > ,((0,xK_Down) , move (0,1) >> myNavigation)
-- > ,((0,xK_j) , move (0,1) >> myNavigation)
-- > ,((0,xK_Up) , move (0,-1) >> myNavigation)
-- > ,((0,xK_y) , move (-1,-1) >> myNavigation)
-- > ,((0,xK_i) , move (1,-1) >> myNavigation)
-- > ,((0,xK_n) , move (-1,1) >> myNavigation)
-- > ,((0,xK_m) , move (1,-1) >> myNavigation)
-- > ,((0,xK_space) , setPos (0,0) >> myNavigation)
-- > ]
-- > -- The navigation handler ignores unknown key symbols
-- > navDefaultHandler = const myNavigation
--
-- You can then define @gsconfig3@ which may be used in exactly the same manner as @gsconfig1@:
--
-- > gsconfig3 = def
-- > { gs_cellheight = 30
-- > , gs_cellwidth = 100
-- > , gs_navigate = myNavigation
-- > }
-- $screenshots
--
-- Selecting a workspace:
--
-- <<http://haskell.org/wikiupload/a/a9/Xmonad-gridselect-workspace.png>>
--
-- Selecting a window by title:
--
-- <<http://haskell.org/wikiupload/3/35/Xmonad-gridselect-window-aavogt.png>>
-- | The 'Default' instance gives a basic configuration for 'gridselect', with
-- the colorizer chosen based on the type.
--
-- If you want to replace the 'gs_colorizer' field, use 'buildDefaultGSConfig'
-- instead of 'def' to avoid ambiguous type variables.
data GSConfig a = GSConfig {
gs_cellheight :: Integer,
gs_cellwidth :: Integer,
gs_cellpadding :: Integer,
gs_colorizer :: a -> Bool -> X (String, String),
gs_font :: String,
gs_navigate :: TwoD a (Maybe a),
gs_rearranger :: Rearranger a,
gs_originFractX :: Double,
gs_originFractY :: Double,
gs_bordercolor :: String
}
-- | That is 'fromClassName' if you are selecting a 'Window', or
-- 'defaultColorizer' if you are selecting a 'String'. The catch-all instance
-- @HasColorizer a@ uses the 'focusedBorderColor' and 'normalBorderColor'
-- colors.
class HasColorizer a where
defaultColorizer :: a -> Bool -> X (String, String)
instance HasColorizer Window where
defaultColorizer = fromClassName
instance HasColorizer String where
defaultColorizer = stringColorizer
instance HasColorizer a where
defaultColorizer _ isFg =
let getColor = if isFg then focusedBorderColor else normalBorderColor
in asks $ flip (,) "black" . getColor . config
instance HasColorizer a => Default (GSConfig a) where
def = buildDefaultGSConfig defaultColorizer
{-# DEPRECATED defaultGSConfig "Use def (from Data.Default, and re-exported from XMonad.Actions.GridSelect) instead." #-}
defaultGSConfig :: HasColorizer a => GSConfig a
defaultGSConfig = def
type TwoDPosition = (Integer, Integer)
type TwoDElementMap a = [(TwoDPosition,(String,a))]
data TwoDState a = TwoDState { td_curpos :: TwoDPosition
, td_availSlots :: [TwoDPosition]
, td_elements :: [(String,a)]
, td_gsconfig :: GSConfig a
, td_font :: XMonadFont
, td_paneX :: Integer
, td_paneY :: Integer
, td_drawingWin :: Window
, td_searchString :: String
, td_elementmap :: TwoDElementMap a
}
generateElementmap :: TwoDState a -> X (TwoDElementMap a)
generateElementmap s = do
rearrangedElements <- rearranger searchString sortedElements
return $ zip positions rearrangedElements
where
TwoDState {td_availSlots = positions,
td_gsconfig = gsconfig,
td_searchString = searchString} = s
GSConfig {gs_rearranger = rearranger} = gsconfig
-- Filter out any elements that don't contain the searchString (case insensitive)
filteredElements = L.filter ((searchString `isInfixOfI`) . fst) (td_elements s)
-- Sorts the elementmap
sortedElements = orderElementmap searchString filteredElements
-- Case Insensitive version of isInfixOf
needle `isInfixOfI` haystack = (upper needle) `isInfixOf` (upper haystack)
upper = map toUpper
-- | We enforce an ordering such that we will always get the same result. If the
-- elements position changes from call to call of gridselect, then the shown
-- positions will also change when you search for the same string. This is
-- especially the case when using gridselect for showing and switching between
-- workspaces, as workspaces are usually shown in order of last visited. The
-- chosen ordering is "how deep in the haystack the needle is" (number of
-- characters from the beginning of the string and the needle).
orderElementmap :: String -> [(String,a)] -> [(String,a)]
orderElementmap searchString elements = if not $ null searchString then sortedElements else elements
where
upper = map toUpper
-- Calculates a (score, element) tuple where the score is the depth of the (case insensitive) needle.
calcScore element = ( length $ takeWhile (not . isPrefixOf (upper searchString)) (tails . upper . fst $ element)
, element)
-- Use the score and then the string as the parameters for comparing, making
-- it consistent even when two strings that score the same, as it will then be
-- sorted by the strings, making it consistent.
compareScore = comparing (\(score, (str,_)) -> (score, str))
sortedElements = map snd . sortBy compareScore $ map calcScore elements
newtype TwoD a b = TwoD { unTwoD :: StateT (TwoDState a) X b }
deriving (Monad,Functor,MonadState (TwoDState a))
instance Applicative (TwoD a) where
(<*>) = ap
pure = return
liftX :: X a1 -> TwoD a a1
liftX = TwoD . lift
evalTwoD :: TwoD a1 a -> TwoDState a1 -> X a
evalTwoD m s = flip evalStateT s $ unTwoD m
diamondLayer :: (Enum a, Num a, Eq a) => a -> [(a, a)]
diamondLayer 0 = [(0,0)]
diamondLayer n =
-- tr = top right
-- r = ur ++ 90 degree clock-wise rotation of ur
let tr = [ (x,n-x) | x <- [0..n-1] ]
r = tr ++ (map (\(x,y) -> (y,-x)) tr)
in r ++ (map (negate *** negate) r)
diamond :: (Enum a, Num a, Eq a) => [(a, a)]
diamond = concatMap diamondLayer [0..]
diamondRestrict :: Integer -> Integer -> Integer -> Integer -> [(Integer, Integer)]
diamondRestrict x y originX originY =
L.filter (\(x',y') -> abs x' <= x && abs y' <= y) .
map (\(x', y') -> (x' + fromInteger originX, y' + fromInteger originY)) .
take 1000 $ diamond
findInElementMap :: (Eq a) => a -> [(a, b)] -> Maybe (a, b)
findInElementMap pos = find ((== pos) . fst)
drawWinBox :: Window -> XMonadFont -> (String, String) -> String -> Integer -> Integer -> String -> Integer -> Integer -> Integer -> X ()
drawWinBox win font (fg,bg) bc ch cw text x y cp =
withDisplay $ \dpy -> do
gc <- liftIO $ createGC dpy win
bordergc <- liftIO $ createGC dpy win
liftIO $ do
Just fgcolor <- initColor dpy fg
Just bgcolor <- initColor dpy bg
Just bordercolor <- initColor dpy bc
setForeground dpy gc fgcolor
setBackground dpy gc bgcolor
setForeground dpy bordergc bordercolor
fillRectangle dpy win gc (fromInteger x) (fromInteger y) (fromInteger cw) (fromInteger ch)
drawRectangle dpy win bordergc (fromInteger x) (fromInteger y) (fromInteger cw) (fromInteger ch)
stext <- shrinkWhile (shrinkIt shrinkText)
(\n -> do size <- liftIO $ textWidthXMF dpy font n
return $ size > (fromInteger (cw-(2*cp))))
text
-- calculate the offset to vertically centre the text based on the ascender and descender
(asc,desc) <- liftIO $ textExtentsXMF font stext
let offset = ((ch - fromIntegral (asc + desc)) `div` 2) + fromIntegral asc
printStringXMF dpy win font gc bg fg (fromInteger (x+cp)) (fromInteger (y+offset)) stext
liftIO $ freeGC dpy gc
liftIO $ freeGC dpy bordergc
updateAllElements :: TwoD a ()
updateAllElements =
do
s <- get
updateElements (td_elementmap s)
grayoutElements :: Int -> TwoD a ()
grayoutElements skip =
do
s <- get
updateElementsWithColorizer grayOnly $ drop skip (td_elementmap s)
where grayOnly _ _ = return ("#808080", "#808080")
updateElements :: TwoDElementMap a -> TwoD a ()
updateElements elementmap = do
s <- get
updateElementsWithColorizer (gs_colorizer (td_gsconfig s)) elementmap
updateElementsWithColorizer :: (a -> Bool -> X (String, String)) -> TwoDElementMap a -> TwoD a ()
updateElementsWithColorizer colorizer elementmap = do
TwoDState { td_curpos = curpos,
td_drawingWin = win,
td_gsconfig = gsconfig,
td_font = font,
td_paneX = paneX,
td_paneY = paneY} <- get
let cellwidth = gs_cellwidth gsconfig
cellheight = gs_cellheight gsconfig
paneX' = div (paneX-cellwidth) 2
paneY' = div (paneY-cellheight) 2
updateElement (pos@(x,y),(text, element)) = liftX $ do
colors <- colorizer element (pos == curpos)
drawWinBox win font
colors
(gs_bordercolor gsconfig)
cellheight
cellwidth
text
(paneX'+x*cellwidth)
(paneY'+y*cellheight)
(gs_cellpadding gsconfig)
mapM_ updateElement elementmap
stdHandle :: Event -> TwoD a (Maybe a) -> TwoD a (Maybe a)
stdHandle (ButtonEvent { ev_event_type = t, ev_x = x, ev_y = y }) contEventloop
| t == buttonRelease = do
s @ TwoDState { td_paneX = px, td_paneY = py,
td_gsconfig = (GSConfig ch cw _ _ _ _ _ _ _ _) } <- get
let gridX = (fi x - (px - cw) `div` 2) `div` cw
gridY = (fi y - (py - ch) `div` 2) `div` ch
case lookup (gridX,gridY) (td_elementmap s) of
Just (_,el) -> return (Just el)
Nothing -> contEventloop
| otherwise = contEventloop
stdHandle (ExposeEvent { }) contEventloop = updateAllElements >> contEventloop
stdHandle _ contEventloop = contEventloop
-- | Embeds a key handler into the X event handler that dispatches key
-- events to the key handler, while non-key event go to the standard
-- handler.
makeXEventhandler :: ((KeySym, String, KeyMask) -> TwoD a (Maybe a)) -> TwoD a (Maybe a)
makeXEventhandler keyhandler = fix $ \me -> join $ liftX $ withDisplay $ \d -> liftIO $ allocaXEvent $ \e -> do
maskEvent d (exposureMask .|. keyPressMask .|. buttonReleaseMask) e
ev <- getEvent e
if ev_event_type ev == keyPress
then do
(ks,s) <- lookupString $ asKeyEvent e
return $ do
mask <- liftX $ cleanMask (ev_state ev)
keyhandler (fromMaybe xK_VoidSymbol ks, s, mask)
else
return $ stdHandle ev me
-- | When the map contains (KeySym,KeyMask) tuple for the given event,
-- the associated action in the map associated shadows the default key
-- handler
shadowWithKeymap :: M.Map (KeyMask, KeySym) a -> ((KeySym, String, KeyMask) -> a) -> (KeySym, String, KeyMask) -> a
shadowWithKeymap keymap dflt keyEvent@(ks,_,m') = fromMaybe (dflt keyEvent) (M.lookup (m',ks) keymap)
-- Helper functions to use for key handler functions
-- | Closes gridselect returning the element under the cursor
select :: TwoD a (Maybe a)
select = do
s <- get
return $ fmap (snd . snd) $ findInElementMap (td_curpos s) (td_elementmap s)
-- | Closes gridselect returning no element.
cancel :: TwoD a (Maybe a)
cancel = return Nothing
-- | Sets the absolute position of the cursor.
setPos :: (Integer, Integer) -> TwoD a ()
setPos newPos = do
s <- get
let elmap = td_elementmap s
newSelectedEl = findInElementMap newPos (td_elementmap s)
oldPos = td_curpos s
when (isJust newSelectedEl && newPos /= oldPos) $ do
put s { td_curpos = newPos }
updateElements (catMaybes [(findInElementMap oldPos elmap), newSelectedEl])
-- | Moves the cursor by the offsets specified
move :: (Integer, Integer) -> TwoD a ()
move (dx,dy) = do
s <- get
let (x,y) = td_curpos s
newPos = (x+dx,y+dy)
setPos newPos
moveNext :: TwoD a ()
moveNext = do
position <- gets td_curpos
elems <- gets td_elementmap
let n = length elems
m = case findIndex (\p -> fst p == position) elems of
Nothing -> Nothing
Just k | k == n-1 -> Just 0
| otherwise -> Just (k+1)
whenJust m $ \i ->
setPos (fst $ elems !! i)
movePrev :: TwoD a ()
movePrev = do
position <- gets td_curpos
elems <- gets td_elementmap
let n = length elems
m = case findIndex (\p -> fst p == position) elems of
Nothing -> Nothing
Just 0 -> Just (n-1)
Just k -> Just (k-1)
whenJust m $ \i ->
setPos (fst $ elems !! i)
-- | Apply a transformation function the current search string
transformSearchString :: (String -> String) -> TwoD a ()
transformSearchString f = do
s <- get
let oldSearchString = td_searchString s
newSearchString = f oldSearchString
when (newSearchString /= oldSearchString) $ do
-- FIXME curpos might end up outside new bounds
let s' = s { td_searchString = newSearchString }
m <- liftX $ generateElementmap s'
let s'' = s' { td_elementmap = m }
oldLen = length $ td_elementmap s
newLen = length $ td_elementmap s''
-- All the elements in the previous element map should be
-- grayed out, except for those which will be covered by
-- elements in the new element map.
when (newLen < oldLen) $ grayoutElements newLen
put s''
updateAllElements
-- | By default gridselect used the defaultNavigation action, which
-- binds left,right,up,down and vi-style h,l,j,k navigation. Return
-- quits gridselect, returning the selected element, while Escape
-- cancels the selection. Slash enters the substring search mode. In
-- substring search mode, every string-associated keystroke is
-- added to a search string, which narrows down the object
-- selection. Substring search mode comes back to regular navigation
-- via Return, while Escape cancels the search. If you want that
-- navigation style, add 'defaultNavigation' as 'gs_navigate' to your
-- 'GSConfig' object. This is done by 'buildDefaultGSConfig' automatically.
defaultNavigation :: TwoD a (Maybe a)
defaultNavigation = makeXEventhandler $ shadowWithKeymap navKeyMap navDefaultHandler
where navKeyMap = M.fromList [
((0,xK_Escape) , cancel)
,((0,xK_Return) , select)
,((0,xK_slash) , substringSearch defaultNavigation)
,((0,xK_Left) , move (-1,0) >> defaultNavigation)
,((0,xK_h) , move (-1,0) >> defaultNavigation)
,((0,xK_Right) , move (1,0) >> defaultNavigation)
,((0,xK_l) , move (1,0) >> defaultNavigation)
,((0,xK_Down) , move (0,1) >> defaultNavigation)
,((0,xK_j) , move (0,1) >> defaultNavigation)
,((0,xK_Up) , move (0,-1) >> defaultNavigation)
,((0,xK_k) , move (0,-1) >> defaultNavigation)
,((0,xK_Tab) , moveNext >> defaultNavigation)
,((0,xK_n) , moveNext >> defaultNavigation)
,((shiftMask,xK_Tab), movePrev >> defaultNavigation)
,((0,xK_p) , movePrev >> defaultNavigation)
]
-- The navigation handler ignores unknown key symbols, therefore we const
navDefaultHandler = const defaultNavigation
-- | This navigation style combines navigation and search into one mode at the cost of losing vi style
-- navigation. With this style, there is no substring search submode,
-- but every typed character is added to the substring search.
navNSearch :: TwoD a (Maybe a)
navNSearch = makeXEventhandler $ shadowWithKeymap navNSearchKeyMap navNSearchDefaultHandler
where navNSearchKeyMap = M.fromList [
((0,xK_Escape) , cancel)
,((0,xK_Return) , select)
,((0,xK_Left) , move (-1,0) >> navNSearch)
,((0,xK_Right) , move (1,0) >> navNSearch)
,((0,xK_Down) , move (0,1) >> navNSearch)
,((0,xK_Up) , move (0,-1) >> navNSearch)
,((0,xK_Tab) , moveNext >> navNSearch)
,((shiftMask,xK_Tab), movePrev >> navNSearch)
,((0,xK_BackSpace), transformSearchString (\s -> if (s == "") then "" else init s) >> navNSearch)
]
-- The navigation handler ignores unknown key symbols, therefore we const
navNSearchDefaultHandler (_,s,_) = do
transformSearchString (++ s)
navNSearch
-- | Navigation submode used for substring search. It returns to the
-- first argument navigation style when the user hits Return.
substringSearch :: TwoD a (Maybe a) -> TwoD a (Maybe a)
substringSearch returnNavigation = fix $ \me ->
let searchKeyMap = M.fromList [
((0,xK_Escape) , transformSearchString (const "") >> returnNavigation)
,((0,xK_Return) , returnNavigation)
,((0,xK_BackSpace), transformSearchString (\s -> if (s == "") then "" else init s) >> me)
]
searchDefaultHandler (_,s,_) = do
transformSearchString (++ s)
me
in makeXEventhandler $ shadowWithKeymap searchKeyMap searchDefaultHandler
-- FIXME probably move that into Utils?
-- Conversion scheme as in http://en.wikipedia.org/wiki/HSV_color_space
hsv2rgb :: Fractional a => (Integer,a,a) -> (a,a,a)
hsv2rgb (h,s,v) =
let hi = (div h 60) `mod` 6 :: Integer
f = (((fromInteger h)/60) - (fromInteger hi)) :: Fractional a => a
q = v * (1-f)
p = v * (1-s)
t = v * (1-(1-f)*s)
in case hi of
0 -> (v,t,p)
1 -> (q,v,p)
2 -> (p,v,t)
3 -> (p,q,v)
4 -> (t,p,v)
5 -> (v,p,q)
_ -> error "The world is ending. x mod a >= a."
-- | Default colorizer for Strings
stringColorizer :: String -> Bool -> X (String, String)
stringColorizer s active =
let seed x = toInteger (sum $ map ((*x).fromEnum) s) :: Integer
(r,g,b) = hsv2rgb ((seed 83) `mod` 360,
(fromInteger ((seed 191) `mod` 1000))/2500+0.4,
(fromInteger ((seed 121) `mod` 1000))/2500+0.4)
in if active
then return ("#faff69", "black")
else return ("#" ++ concat (map (twodigitHex.(round :: Double -> Word8).(*256)) [r, g, b] ), "white")
-- | Colorize a window depending on it's className.
fromClassName :: Window -> Bool -> X (String, String)
fromClassName w active = runQuery className w >>= flip defaultColorizer active
twodigitHex :: Word8 -> String
twodigitHex a = printf "%02x" a
-- | A colorizer that picks a color inside a range,
-- and depending on the window's class.
colorRangeFromClassName :: (Word8, Word8, Word8) -- ^ Beginning of the color range
-> (Word8, Word8, Word8) -- ^ End of the color range
-> (Word8, Word8, Word8) -- ^ Background of the active window
-> (Word8, Word8, Word8) -- ^ Inactive text color
-> (Word8, Word8, Word8) -- ^ Active text color
-> Window -> Bool -> X (String, String)
colorRangeFromClassName startC endC activeC inactiveT activeT w active =
do classname <- runQuery className w
if active
then return (rgbToHex activeC, rgbToHex activeT)
else return (rgbToHex $ mix startC endC
$ stringToRatio classname, rgbToHex inactiveT)
where rgbToHex :: (Word8, Word8, Word8) -> String
rgbToHex (r, g, b) = '#':twodigitHex r
++twodigitHex g++twodigitHex b
-- | Creates a mix of two colors according to a ratio
-- (1 -> first color, 0 -> second color).
mix :: (Word8, Word8, Word8) -> (Word8, Word8, Word8)
-> Double -> (Word8, Word8, Word8)
mix (r1, g1, b1) (r2, g2, b2) r = (mix' r1 r2, mix' g1 g2, mix' b1 b2)
where mix' a b = truncate $ (fi a * r) + (fi b * (1 - r))
-- | Generates a Double from a string, trying to
-- achieve a random distribution.
-- We create a random seed from the sum of all characters
-- in the string, and use it to generate a ratio between 0 and 1
stringToRatio :: String -> Double
stringToRatio "" = 0
stringToRatio s = let gen = mkStdGen $ sum $ map fromEnum s
range = (\(a, b) -> b - a) $ genRange gen
randomInt = foldr1 combine $ replicate 20 next
combine f1 f2 g = let (_, g') = f1 g in f2 g'
in fi (fst $ randomInt gen) / fi range
-- | Brings up a 2D grid of elements in the center of the screen, and one can
-- select an element with cursors keys. The selected element is returned.
gridselect :: GSConfig a -> [(String,a)] -> X (Maybe a)
gridselect _ [] = return Nothing
gridselect gsconfig elements =
withDisplay $ \dpy -> do
rootw <- asks theRoot
scr <- gets $ screenRect . W.screenDetail . W.current . windowset
win <- liftIO $ mkUnmanagedWindow dpy (defaultScreenOfDisplay dpy) rootw
(rect_x scr) (rect_y scr) (rect_width scr) (rect_height scr)
liftIO $ mapWindow dpy win
liftIO $ selectInput dpy win (exposureMask .|. keyPressMask .|. buttonReleaseMask)
status <- io $ grabKeyboard dpy win True grabModeAsync grabModeAsync currentTime
io $ grabPointer dpy win True buttonReleaseMask grabModeAsync grabModeAsync none none currentTime
font <- initXMF (gs_font gsconfig)
let screenWidth = toInteger $ rect_width scr
screenHeight = toInteger $ rect_height scr
selectedElement <- if (status == grabSuccess) then do
let restriction ss cs = (fromInteger ss/fromInteger (cs gsconfig)-1)/2 :: Double
restrictX = floor $ restriction screenWidth gs_cellwidth
restrictY = floor $ restriction screenHeight gs_cellheight
originPosX = floor $ ((gs_originFractX gsconfig) - (1/2)) * 2 * fromIntegral restrictX
originPosY = floor $ ((gs_originFractY gsconfig) - (1/2)) * 2 * fromIntegral restrictY
coords = diamondRestrict restrictX restrictY originPosX originPosY
s = TwoDState { td_curpos = (head coords),
td_availSlots = coords,
td_elements = elements,
td_gsconfig = gsconfig,
td_font = font,
td_paneX = screenWidth,
td_paneY = screenHeight,
td_drawingWin = win,
td_searchString = "",
td_elementmap = [] }
m <- generateElementmap s
evalTwoD (updateAllElements >> (gs_navigate gsconfig))
(s { td_elementmap = m })
else
return Nothing
liftIO $ do
unmapWindow dpy win
destroyWindow dpy win
ungrabPointer dpy currentTime
sync dpy False
releaseXMF font
return selectedElement
-- | Like `gridSelect' but with the current windows and their titles as elements
gridselectWindow :: GSConfig Window -> X (Maybe Window)
gridselectWindow gsconf = windowMap >>= gridselect gsconf
-- | Brings up a 2D grid of windows in the center of the screen, and one can
-- select a window with cursors keys. The selected window is then passed to
-- a callback function.
withSelectedWindow :: (Window -> X ()) -> GSConfig Window -> X ()
withSelectedWindow callback conf = do
mbWindow <- gridselectWindow conf
case mbWindow of
Just w -> callback w
Nothing -> return ()
windowMap :: X [(String,Window)]
windowMap = do
ws <- gets windowset
wins <- mapM keyValuePair (W.allWindows ws)
return wins
where keyValuePair w = flip (,) w `fmap` decorateName' w
decorateName' :: Window -> X String
decorateName' w = do
fmap show $ getName w
-- | Builds a default gs config from a colorizer function.
buildDefaultGSConfig :: (a -> Bool -> X (String,String)) -> GSConfig a
buildDefaultGSConfig col = GSConfig 50 130 10 col "xft:Sans-8" defaultNavigation noRearranger (1/2) (1/2) "white"
-- | Brings selected window to the current workspace.
bringSelected :: GSConfig Window -> X ()
bringSelected = withSelectedWindow $ \w -> do
windows (bringWindow w)
XMonad.focus w
windows W.shiftMaster
-- | Switches to selected window's workspace and focuses that window.
goToSelected :: GSConfig Window -> X ()
goToSelected = withSelectedWindow $ windows . W.focusWindow
-- | Select an application to spawn from a given list
spawnSelected :: GSConfig String -> [String] -> X ()
spawnSelected conf lst = gridselect conf (zip lst lst) >>= flip whenJust spawn
-- | Select an action and run it in the X monad
runSelectedAction :: GSConfig (X ()) -> [(String, X ())] -> X ()
runSelectedAction conf actions = do
selectedActionM <- gridselect conf actions
case selectedActionM of
Just selectedAction -> selectedAction
Nothing -> return ()
-- | Select a workspace and view it using the given function
-- (normally 'W.view' or 'W.greedyView')
--
-- Another option is to shift the current window to the selected workspace:
--
-- > gridselectWorkspace (\ws -> W.greedyView ws . W.shift ws)
gridselectWorkspace :: GSConfig WorkspaceId ->
(WorkspaceId -> WindowSet -> WindowSet) -> X ()
gridselectWorkspace conf viewFunc = gridselectWorkspace' conf (windows . viewFunc)
-- | Select a workspace and run an arbitrary action on it.
gridselectWorkspace' :: GSConfig WorkspaceId -> (WorkspaceId -> X ()) -> X ()
gridselectWorkspace' conf func = withWindowSet $ \ws -> do
let wss = map W.tag $ W.hidden ws ++ map W.workspace (W.current ws : W.visible ws)
gridselect conf (zip wss wss) >>= flip whenJust func
-- $rearrangers
--
-- Rearrangers allow for arbitrary post-filter rearranging of the grid
-- elements.
--
-- For example, to be able to switch to a new dynamic workspace by typing
-- in its name, you can use the following keybinding action:
--
-- > import XMonad.Actions.DynamicWorkspaces (addWorkspace)
-- >
-- > gridselectWorkspace' defaultGSConfig
-- > { gs_navigate = navNSearch
-- > , gs_rearranger = searchStringRearrangerGenerator id
-- > }
-- > addWorkspace
-- | A function taking the search string and a list of elements, and
-- returning a potentially rearranged list of elements.
type Rearranger a = String -> [(String, a)] -> X [(String, a)]
-- | A rearranger that leaves the elements unmodified.
noRearranger :: Rearranger a
noRearranger _ = return
-- | A generator for rearrangers that append a single element based on the
-- search string, if doing so would not be redundant (empty string or value
-- already present).
searchStringRearrangerGenerator :: (String -> a) -> Rearranger a
searchStringRearrangerGenerator f =
let r "" xs = return $ xs
r s xs | s `elem` map fst xs = return $ xs
| otherwise = return $ xs ++ [(s, f s)]
in r

View File

@@ -0,0 +1,218 @@
{-# LANGUAGE DeriveDataTypeable #-}
----------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.GroupNavigation
-- Copyright : (c) nzeh@cs.dal.ca
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : nzeh@cs.dal.ca
-- Stability : unstable
-- Portability : unportable
--
-- Provides methods for cycling through groups of windows across
-- workspaces, ignoring windows that do not belong to this group. A
-- group consists of all windows matching a user-provided boolean
-- query.
--
-- Also provides a method for jumping back to the most recently used
-- window in any given group.
--
----------------------------------------------------------------------
module XMonad.Actions.GroupNavigation ( -- * Usage
-- $usage
Direction (..)
, nextMatch
, nextMatchOrDo
, nextMatchWithThis
, historyHook
) where
import Control.Monad.Reader
import Data.Foldable as Fold
import Data.Map as Map
import Data.Sequence as Seq
import Data.Set as Set
import Graphics.X11.Types
import Prelude hiding (concatMap, drop, elem, filter, null, reverse)
import XMonad.Core
import XMonad.ManageHook
import XMonad.Operations (windows, withFocused)
import qualified XMonad.StackSet as SS
import qualified XMonad.Util.ExtensibleState as XS
{- $usage
Import the module into your @~\/.xmonad\/xmonad.hs@:
> import XMonad.Actions.GroupNavigation
To support cycling forward and backward through all xterm windows, add
something like this to your keybindings:
> , ((modm , xK_t), nextMatch Forward (className =? "XTerm"))
> , ((modm .|. shiftMask, xK_t), nextMatch Backward (className =? "XTerm"))
These key combinations do nothing if there is no xterm window open.
If you rather want to open a new xterm window if there is no open
xterm window, use 'nextMatchOrDo' instead:
> , ((modm , xK_t), nextMatchOrDo Forward (className =? "XTerm") (spawn "xterm"))
> , ((modm .|. shiftMask, xK_t), nextMatchOrDo Backward (className =? "XTerm") (spawn "xterm"))
You can use 'nextMatchWithThis' with an arbitrary query to cycle
through all windows for which this query returns the same value as the
current window. For example, to cycle through all windows in the same
window class as the current window use:
> , ((modm , xK_f), nextMatchWithThis Forward className)
> , ((modm , xK_b), nextMatchWithThis Backward className)
Finally, you can define keybindings to jump to the most recent window
matching a certain Boolean query. To do this, you need to add
'historyHook' to your logHook:
> main = xmonad $ def { logHook = historyHook }
Then the following keybindings, for example, allow you to return to
the most recent xterm or emacs window or to simply to the most recent
window:
> , ((modm .|. controlMask, xK_e), nextMatch History (className =? "Emacs"))
> , ((modm .|. controlMask, xK_t), nextMatch History (className =? "XTerm"))
> , ((modm , xK_BackSpace), nextMatch History (return True))
Again, you can use 'nextMatchOrDo' instead of 'nextMatch' if you want
to execute an action if no window matching the query exists. -}
--- Basic cyclic navigation based on queries -------------------------
-- | The direction in which to look for the next match
data Direction = Forward -- ^ Forward from current window or workspace
| Backward -- ^ Backward from current window or workspace
| History -- ^ Backward in history
-- | Focuses the next window for which the given query produces the
-- same result as the currently focused window. Does nothing if there
-- is no focused window (i.e., the current workspace is empty).
nextMatchWithThis :: Eq a => Direction -> Query a -> X ()
nextMatchWithThis dir qry = withFocused $ \win -> do
prop <- runQuery qry win
nextMatch dir (qry =? prop)
-- | Focuses the next window that matches the given boolean query.
-- Does nothing if there is no such window. This is the same as
-- 'nextMatchOrDo' with alternate action @return ()@.
nextMatch :: Direction -> Query Bool -> X ()
nextMatch dir qry = nextMatchOrDo dir qry (return ())
-- | Focuses the next window that matches the given boolean query. If
-- there is no such window, perform the given action instead.
nextMatchOrDo :: Direction -> Query Bool -> X () -> X ()
nextMatchOrDo dir qry act = orderedWindowList dir
>>= focusNextMatchOrDo qry act
-- Produces the action to perform depending on whether there's a
-- matching window
focusNextMatchOrDo :: Query Bool -> X () -> Seq Window -> X ()
focusNextMatchOrDo qry act = findM (runQuery qry)
>=> maybe act (windows . SS.focusWindow)
-- Returns the list of windows ordered by workspace as specified in
-- ~/.xmonad/xmonad.hs
orderedWindowList :: Direction -> X (Seq Window)
orderedWindowList History = liftM (\(HistoryDB w ws) -> maybe ws (ws |>) w) XS.get
orderedWindowList dir = withWindowSet $ \ss -> do
wsids <- asks (Seq.fromList . workspaces . config)
let wspcs = orderedWorkspaceList ss wsids
wins = dirfun dir
$ Fold.foldl' (><) Seq.empty
$ fmap (Seq.fromList . SS.integrate' . SS.stack) wspcs
cur = SS.peek ss
return $ maybe wins (rotfun wins) cur
where
dirfun Backward = Seq.reverse
dirfun _ = id
rotfun wins x = rotate $ rotateTo (== x) wins
-- Returns the ordered workspace list as specified in ~/.xmonad/xmonad.hs
orderedWorkspaceList :: WindowSet -> Seq String -> Seq WindowSpace
orderedWorkspaceList ss wsids = rotateTo isCurWS wspcs'
where
wspcs = SS.workspaces ss
wspcsMap = Fold.foldl' (\m ws -> Map.insert (SS.tag ws) ws m) Map.empty wspcs
wspcs' = fmap (\wsid -> wspcsMap ! wsid) wsids
isCurWS ws = SS.tag ws == SS.tag (SS.workspace $ SS.current ss)
--- History navigation, requires a layout modifier -------------------
-- The state extension that holds the history information
data HistoryDB = HistoryDB (Maybe Window) -- currently focused window
(Seq Window) -- previously focused windows
deriving (Read, Show, Typeable)
instance ExtensionClass HistoryDB where
initialValue = HistoryDB Nothing Seq.empty
extensionType = PersistentExtension
-- | Action that needs to be executed as a logHook to maintain the
-- focus history of all windows as the WindowSet changes.
historyHook :: X ()
historyHook = XS.get >>= updateHistory >>= XS.put
-- Updates the history in response to a WindowSet change
updateHistory :: HistoryDB -> X HistoryDB
updateHistory (HistoryDB oldcur oldhist) = withWindowSet $ \ss -> do
let newcur = SS.peek ss
wins = Set.fromList $ SS.allWindows ss
newhist = flt (flip Set.member wins) (ins oldcur oldhist)
return $ HistoryDB newcur (del newcur newhist)
where
ins x xs = maybe xs (<| xs) x
del x xs = maybe xs (\x' -> flt (/= x') xs) x
--- Two replacements for Seq.filter and Seq.breakl available only in
--- containers-0.3.0.0, which only ships with ghc 6.12. Once we
--- decide to no longer support ghc < 6.12, these should be replaced
--- with Seq.filter and Seq.breakl.
flt :: (a -> Bool) -> Seq a -> Seq a
flt p = Fold.foldl (\xs x -> if p x then xs |> x else xs) Seq.empty
brkl :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
brkl p xs = flip Seq.splitAt xs
$ snd
$ Fold.foldr (\x (i, j) -> if p x then (i-1, i-1) else (i-1, j)) (l, l) xs
where
l = Seq.length xs
--- Some sequence helpers --------------------------------------------
-- Rotates the sequence by one position
rotate :: Seq a -> Seq a
rotate xs = rotate' (viewl xs)
where
rotate' EmptyL = Seq.empty
rotate' (x' :< xs') = xs' |> x'
-- Rotates the sequence until an element matching the given condition
-- is at the beginning of the sequence.
rotateTo :: (a -> Bool) -> Seq a -> Seq a
rotateTo cond xs = let (lxs, rxs) = brkl cond xs in rxs >< lxs
--- A monadic find ---------------------------------------------------
-- Applies the given action to every sequence element in turn until
-- the first element is found for which the action returns true. The
-- remaining elements in the sequence are ignored.
findM :: Monad m => (a -> m Bool) -> Seq a -> m (Maybe a)
findM cond xs = findM' cond (viewl xs)
where
findM' _ EmptyL = return Nothing
findM' qry (x' :< xs') = do
isMatch <- qry x'
if isMatch
then return (Just x')
else findM qry xs'

156
XMonad/Actions/KeyRemap.hs Normal file
View File

@@ -0,0 +1,156 @@
{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.KeyRemap
-- Copyright : (c) Christian Dietrich
-- License : BSD-style (as xmonad)
--
-- Maintainer : stettberger@dokucde.de
-- Stability : unstable
-- Portability : unportable
--
-- Remap Keybinding on the fly, e.g having Dvorak char, but everything with Control/Shift
-- is left us Layout
--
-----------------------------------------------------------------------------
module XMonad.Actions.KeyRemap (
-- * Usage
-- $usage
setKeyRemap,
buildKeyRemapBindings,
setDefaultKeyRemap,
KeymapTable (KeymapTable),
emptyKeyRemap,
dvorakProgrammerKeyRemap
) where
import XMonad
import XMonad.Util.Paste
import Data.List
import qualified XMonad.Util.ExtensibleState as XS
import Control.Monad
data KeymapTable = KeymapTable [((KeyMask, KeySym), (KeyMask, KeySym))] deriving (Typeable, Show)
instance ExtensionClass KeymapTable where
initialValue = KeymapTable []
-- $usage
-- Provides the possibility to remap parts of the keymap to generate different keys
--
-- * E.g You want to type Programmers Dvorak, but your keybindings should be the normal us layout
-- after all
--
-- First, you must add all possible keybindings for all layout you want to use:
--
-- > keys = myKeys ++ buildKeyRemapBindings [dvorakProgrammerKeyRemap,emptyKeyRemap]
--
-- Then you must add setDefaultKeyRemap to your startup hook (e.g. you want to set the
-- empty keyremap (no remapping is done) as default after startup):
--
-- > myStartupHook :: X()
-- > myStartupHook = do
-- > setWMName "LG3D"
-- > setDefaultKeyRemap emptyKeyRemap [dvorakProgrammerKeyRemap, emptyKeyRemap]
--
-- Then you add keybindings for changing keyboard layouts;
--
-- > , ((0 , xK_F1 ), setKeyRemap emptyKeyRemap)
-- > , ((0 , xK_F2 ), setKeyRemap dvorakProgrammerKeyRemap)
--
-- When defining your own keymappings, please be aware of:
--
-- * If you want to emulate a key that is shifted on us you must emulate that keypress:
--
-- > KeymapTable [((0, xK_a), (shiftMask, xK_5))] -- would bind 'a' to '%'
-- > KeymapTable [((shiftMask, xK_a), (0, xK_5))] -- would bind 'A' to '5'
--
-- * the dvorakProgrammerKeyRemap uses the original us layout as lookuptable to generate
-- the KeymapTable
--
-- * KeySym and (ord Char) are incompatible, therefore the magic numbers in dvorakProgrammerKeyRemap
-- are nessesary
doKeyRemap :: KeyMask -> KeySym -> X()
doKeyRemap mask sym = do
table <- XS.get
let (insertMask, insertSym) = extractKeyMapping table mask sym
sendKey insertMask insertSym
-- | Using this in the keybindings to set the actual Key Translation table
setKeyRemap :: KeymapTable -> X()
setKeyRemap table = do
let KeymapTable newtable = table
KeymapTable oldtable <- XS.get
XConf { display = dpy, theRoot = rootw } <- ask
let grab kc m = io $ grabKey dpy kc m rootw True grabModeAsync grabModeAsync
let ungrab kc m = io $ ungrabKey dpy kc m rootw
forM_ oldtable $ \((mask, sym), _) -> do
kc <- io $ keysymToKeycode dpy sym
-- "If the specified KeySym is not defined for any KeyCode,
-- XKeysymToKeycode() returns zero."
when (kc /= 0) $ ungrab kc mask
forM_ newtable $ \((mask, sym), _) -> do
kc <- io $ keysymToKeycode dpy sym
-- "If the specified KeySym is not defined for any KeyCode,
-- XKeysymToKeycode() returns zero."
when (kc /= 0) $ grab kc mask
XS.put table
-- | Adding this to your startupHook, to select your default Key Translation table.
-- You also must give it all the KeymapTables you are willing to use
setDefaultKeyRemap :: KeymapTable -> [KeymapTable] -> X()
setDefaultKeyRemap dflt keyremaps = do
XS.put (KeymapTable mappings)
setKeyRemap dflt
where
mappings = nub (keyremaps >>= \(KeymapTable table) -> table)
extractKeyMapping :: KeymapTable -> KeyMask -> KeySym -> (KeyMask, KeySym)
extractKeyMapping (KeymapTable table) mask sym =
insertKey filtered
where filtered = filter (\((m, s),_) -> m == mask && s == sym) table
insertKey [] = (mask, sym)
insertKey ((_, to):_) = to
-- | Append the output of this function to your keybindings with ++
buildKeyRemapBindings :: [KeymapTable] -> [((KeyMask, KeySym), X ())]
buildKeyRemapBindings keyremaps =
[((mask, sym), doKeyRemap mask sym) | (mask, sym) <- bindings]
where mappings = concat (map (\(KeymapTable table) -> table) keyremaps)
bindings = nub (map (\binding -> fst binding) mappings)
-- Here come the Keymappings
-- | The empty KeymapTable, does no translation
emptyKeyRemap :: KeymapTable
emptyKeyRemap = KeymapTable []
-- | The dvorak Programmers keymap, translates from us keybindings to dvorak programmers
dvorakProgrammerKeyRemap :: KeymapTable
dvorakProgrammerKeyRemap =
KeymapTable [((charToMask maskFrom, from), (charToMask maskTo, to)) |
(maskFrom, from, maskTo, to) <- (zip4 layoutUsShift layoutUsKey layoutDvorakShift layoutDvorakKey)]
where
layoutUs = map (fromIntegral . fromEnum) "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>?" :: [KeySym]
layoutUsKey = map (fromIntegral . fromEnum) "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./" :: [KeySym]
layoutUsShift = "0000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111"
layoutDvorak = map (fromIntegral . fromEnum) "$&[{}(=*)+]!#;,.pyfgcrl/@\\aoeuidhtns-'qjkxbmwvz~%7531902468`:<>PYFGCRL?^|AOEUIDHTNS_\"QJKXBMWVZ" :: [KeySym]
layoutDvorakShift = map getShift layoutDvorak
layoutDvorakKey = map getKey layoutDvorak
getKey char = let Just index = elemIndex char layoutUs
in layoutUsKey !! index
getShift char = let Just index = elemIndex char layoutUs
in layoutUsShift !! index
charToMask char = if [char] == "0" then 0 else shiftMask

123
XMonad/Actions/Launcher.hs Normal file
View File

@@ -0,0 +1,123 @@
{- |
Module : XMonad.Actions.Launcher
Copyright : (C) 2012 Carlos López-Camey
License : None; public domain
Maintainer : <c.lopez@kmels.net>
Stability : unstable
A set of prompts for XMonad
-}
module XMonad.Actions.Launcher(
-- * Description and use
-- $description
defaultLauncherModes
, ExtensionActions
, LauncherConfig(..)
, launcherPrompt
) where
import Data.List (find, findIndex, isPrefixOf, tails)
import qualified Data.Map as M
import Data.Maybe (isJust)
import XMonad hiding (config)
import XMonad.Prompt
import XMonad.Util.Run
{- $description
This module exemplifies usage of `XMonad.Prompt.mkXPromptWithModes`. It includes two modes:
* Hoogle mode: Search for functions using hoogle, choosing a function leads you to documentation in Haddock.
* Calc: Uses the program calc to do calculations.
To test it, modify your local .xmonad:
> import XMonad.Prompt(def)
> import XMonad.Actions.Launcher
> ((modm .|. controlMask, xK_l), launcherPrompt def $ defaultLauncherModes launcherConfig)
A LauncherConfig contains settings for the default modes, modify them accordingly.
> launcherConfig = LauncherConfig { pathToHoogle = "/home/YOU/.cabal/bin/hoogle" , browser = "firefox"}
Restart xmonad. Press Ctrl + Your_Modkey + L and the first prompt should pop up.
If you used the default 'XPConfig', you can change mode with 'xK_grave'. If you are using your own 'XPConfig', define the value for 'changeModeKey'.
-}
data HoogleMode = HMode FilePath String --path to hoogle and browser
data CalculatorMode = CalcMode
data LauncherConfig = LauncherConfig {
browser :: String
, pathToHoogle :: String
}
type ExtensionActions = M.Map String (String -> X())
-- | Uses the command `calc` to compute arithmetic expressions
instance XPrompt CalculatorMode where
showXPrompt CalcMode = "calc %s> "
commandToComplete CalcMode = id --send the whole string to `calc`
completionFunction CalcMode = \s -> if (length s == 0) then return [] else do
fmap lines $ runProcessWithInput "calc" [s] ""
modeAction CalcMode _ _ = return () -- do nothing; this might copy the result to the clipboard
-- | Uses the program `hoogle` to search for functions
instance XPrompt HoogleMode where
showXPrompt _ = "hoogle %s> "
commandToComplete _ = id
completionFunction (HMode pathToHoogleBin' _) = \s -> completionFunctionWith pathToHoogleBin' ["--count","8",s]
-- This action calls hoogle again to find the URL corresponding to the autocompleted item
modeAction (HMode pathToHoogleBin'' browser') query result = do
completionsWithLink <- liftIO $ completionFunctionWith pathToHoogleBin'' ["--count","5","--link",query]
let link = do
s <- find (isJust . \complStr -> findSeqIndex complStr result) completionsWithLink
i <- findSeqIndex s "http://"
return $ drop i s
case link of
Just l -> spawn $ browser' ++ " " ++ l
_ -> return ()
where
-- | Receives a sublist and a list. It returns the index where the sublist appears in the list.
findSeqIndex :: (Eq a) => [a] -> [a] -> Maybe Int
findSeqIndex xs xss = findIndex (isPrefixOf xss) $ tails xs
-- | Creates an autocompletion function for a programm given the program's name and a list of args to send to the command.
completionFunctionWith :: String -> [String] -> IO [String]
completionFunctionWith cmd args = do fmap lines $ runProcessWithInput cmd args ""
-- | Creates a prompt with the given modes
launcherPrompt :: XPConfig -> [XPMode] -> X()
launcherPrompt config modes = mkXPromptWithModes modes config
-- | Create a list of modes based on :
-- a list of extensions mapped to actions
-- the path to hoogle
defaultLauncherModes :: LauncherConfig -> [XPMode]
defaultLauncherModes cnf = let
ph = pathToHoogle cnf
in [ hoogleMode ph $ browser cnf
, calcMode]
hoogleMode :: FilePath -> String -> XPMode
hoogleMode pathToHoogleBin browser' = XPT $ HMode pathToHoogleBin browser'
calcMode :: XPMode
calcMode = XPT CalcMode
{-
-- ideas for XMonad.Prompt running on mode XPMultipleModes
* Switch to mode by name of the prompt, 1. ':' at an empty(?) buffer, 2. autocomplete name in buffer should happen, 3. switch to mode with enter (cancel switch with C-g)
* Support for actions of type String -> X a
-- ideas for this module
* Hoogle mode: add a setting in the action to either go to documentation or to the source code (needs hoogle change?)
* Hoogle mode: add setting to query hoogle at haskell.org instead (with &mode=json)
-}

View File

@@ -0,0 +1,169 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.LinkWorkspaces
-- Copyright : (c) Jan-David Quesel <quesel@gmail.org>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : none
-- Stability : unstable
-- Portability : unportable
--
-- Provides bindings to add and delete links between workspaces. It is aimed
-- at providing useful links between workspaces in a multihead setup. Linked
-- workspaces are view at the same time.
--
-----------------------------------------------------------------------------
{-# LANGUAGE DeriveDataTypeable #-}
module XMonad.Actions.LinkWorkspaces (
-- * Usage
-- $usage
switchWS,
removeAllMatchings,
unMatch,
toggleLinkWorkspaces,
defaultMessageConf,
MessageConfig(..)
) where
import XMonad
import qualified XMonad.StackSet as W
import XMonad.Layout.IndependentScreens(countScreens)
import qualified XMonad.Util.ExtensibleState as XS (get, put)
import XMonad.Actions.OnScreen(Focus(FocusCurrent), onScreen')
import qualified Data.Map as M
( insert, delete, Map, lookup, empty, filter )
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file:
--
-- > import XMonad.Actions.LinkWorkspaces
--
-- and add a function to print messages like
--
-- > message_command (S screen) = " dzen2 -p 1 -w 300 -xs " ++ show (screen + 1)
-- > message_color_func c1 c2 msg = dzenColor c1 c2 msg
-- > message screen c1 c2 msg = spawn $ "echo '" ++ (message_color_func c1 c2 msg) ++ "' | " ++ message_command screen
--
-- alternatively you can use the noMessages function as the argument
--
-- Then add keybindings like the following:
--
-- > ,((modm, xK_p), toggleLinkWorkspaces message)
-- > ,((modm .|. shiftMask, xK_p), removeAllMatchings message)
--
-- > [ ((modm .|. m, k), a i)
-- > | (a, m) <- [(switchWS (\y -> windows $ view y) message, 0),(switchWS (\x -> windows $ shift x . view x) message, shiftMask)]
-- > , (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]]
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
data MessageConfig = MessageConfig { messageFunction :: (ScreenId -> [Char] -> [Char] -> [Char] -> X())
, foreground :: [Char]
, alertedForeground :: [Char]
, background :: [Char]
}
defaultMessageConf :: MessageConfig
defaultMessageConf = MessageConfig { messageFunction = noMessageFn
, background = "#000000"
, alertedForeground = "#ff7701"
, foreground = "#00ff00" }
noMessageFn :: ScreenId -> [Char] -> [Char] -> [Char] -> X()
noMessageFn _ _ _ _ = return () :: X ()
-- | Stuff for linking workspaces
data WorkspaceMap = WorkspaceMap (M.Map WorkspaceId WorkspaceId) deriving (Read, Show, Typeable)
instance ExtensionClass WorkspaceMap
where initialValue = WorkspaceMap M.empty
extensionType = PersistentExtension
switchWS :: (WorkspaceId -> X ()) -> MessageConfig -> WorkspaceId -> X ()
switchWS f m ws = switchWS' f m ws Nothing
-- | Switch to the given workspace in a non greedy way, stop if we reached the first screen
-- | we already did switching on
switchWS' :: (WorkspaceId -> X ()) -> MessageConfig -> WorkspaceId -> (Maybe ScreenId) -> X ()
switchWS' switchFn message workspace stopAtScreen = do
ws <- gets windowset
nScreens <- countScreens
let now = W.screen (W.current ws)
let next = ((now + 1) `mod` nScreens)
switchFn workspace
case stopAtScreen of
Nothing -> sTM now next (Just now)
Just sId -> if sId == next then return () else sTM now next (Just sId)
where sTM = switchToMatching (switchWS' switchFn message) message workspace
-- | Switch to the workspace that matches the current one, executing switches for that workspace as well.
-- | The function switchWorkspaceNonGreedy' will take of stopping if we reached the first workspace again.
switchToMatching :: (WorkspaceId -> (Maybe ScreenId) -> X ()) -> MessageConfig -> WorkspaceId -> ScreenId
-> ScreenId -> (Maybe ScreenId) -> X ()
switchToMatching f message t now next stopAtScreen = do
WorkspaceMap matchings <- XS.get :: X WorkspaceMap
case (M.lookup t matchings) of
Nothing -> return () :: X()
Just newWorkspace -> do
onScreen' (f newWorkspace stopAtScreen) FocusCurrent next
messageFunction message now (foreground message) (background message) ("Switching to: " ++ (t ++ " and " ++ newWorkspace))
-- | Insert a mapping between t1 and t2 or remove it was already present
toggleMatching :: MessageConfig -> WorkspaceId -> WorkspaceId -> X ()
toggleMatching message t1 t2 = do
WorkspaceMap matchings <- XS.get :: X WorkspaceMap
case (M.lookup t1 matchings) of
Nothing -> setMatching message t1 t2 matchings
Just t -> if t == t2 then removeMatching' message t1 t2 matchings else setMatching message t1 t2 matchings
return ()
-- | Insert a mapping between t1 and t2 and display a message
setMatching :: MessageConfig -> WorkspaceId -> WorkspaceId -> M.Map WorkspaceId WorkspaceId -> X ()
setMatching message t1 t2 matchings = do
ws <- gets windowset
let now = W.screen (W.current ws)
XS.put $ WorkspaceMap $ M.insert t1 t2 matchings
messageFunction message now (foreground message) (background message) ("Linked: " ++ (t1 ++ " " ++ t2))
-- currently this function is called manually this means that if workspaces
-- were deleted, some links stay in the RAM even though they are not used
-- anymore... because of the small amount of memory used for those there is no
-- special cleanup so far
removeMatching' :: MessageConfig -> WorkspaceId -> WorkspaceId -> M.Map WorkspaceId WorkspaceId -> X ()
removeMatching' message t1 t2 matchings = do
ws <- gets windowset
let now = W.screen (W.current ws)
XS.put $ WorkspaceMap $ M.delete t1 matchings
messageFunction message now (alertedForeground message) (background message) ("Unlinked: " ++ t1 ++ " " ++ t2)
-- | Remove all maps between workspaces
removeAllMatchings :: MessageConfig -> X ()
removeAllMatchings message = do
ws <- gets windowset
let now = W.screen (W.current ws)
XS.put $ WorkspaceMap $ M.empty
messageFunction message now (alertedForeground message) (background message) "All links removed!"
-- | remove all matching regarding a given workspace
unMatch :: WorkspaceId -> X ()
unMatch workspace = do
WorkspaceMap matchings <- XS.get :: X WorkspaceMap
XS.put $ WorkspaceMap $ M.delete workspace (M.filter (/= workspace) matchings)
-- | Toggle the currently displayed workspaces as matching. Starting from the one with focus
-- | a linked list of workspaces is created that will later be iterated by switchToMatching.
toggleLinkWorkspaces :: MessageConfig -> X ()
toggleLinkWorkspaces message = withWindowSet $ \ws -> toggleLinkWorkspaces' (W.screen (W.current ws)) message
toggleLinkWorkspaces' :: ScreenId -> MessageConfig -> X ()
toggleLinkWorkspaces' first message = do
ws <- gets windowset
nScreens <- countScreens
let now = W.screen (W.current ws)
let next = (now + 1) `mod` nScreens
if next == first then return () else do -- this is also the case if there is only one screen
case (W.lookupWorkspace next ws) of
Nothing -> return ()
Just name -> toggleMatching message (W.currentTag ws) (name)
onScreen' (toggleLinkWorkspaces' first message) FocusCurrent next

View File

@@ -0,0 +1,276 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.MessageFeedback
-- Copyright : (c) -- Quentin Moser <moserq@gmail.com>
-- 2018 Yclept Nemo
-- License : BSD3
--
-- Maintainer : orphaned
-- Stability : unstable
-- Portability : unportable
--
-- Alternative to 'XMonad.Operations.sendMessage' that provides knowledge
-- of whether the message was handled, and utility functions based on
-- this facility.
-----------------------------------------------------------------------------
module XMonad.Actions.MessageFeedback
( -- * Usage
-- $usage
-- * Messaging variants
-- ** 'SomeMessage'
sendSomeMessageB, sendSomeMessage
, sendSomeMessageWithNoRefreshB, sendSomeMessageWithNoRefresh
, sendSomeMessageWithNoRefreshToCurrentB, sendSomeMessageWithNoRefreshToCurrent
-- ** 'Message'
, sendMessageB
, sendMessageWithNoRefreshB
, sendMessageWithNoRefreshToCurrentB, sendMessageWithNoRefreshToCurrent
-- * Utility Functions
-- ** Send All
, sendSomeMessagesB, sendSomeMessages, sendMessagesB, sendMessages
-- ** Send Until
, tryInOrderB, tryInOrderWithNoRefreshToCurrentB, tryInOrderWithNoRefreshToCurrent
, tryMessageB, tryMessageWithNoRefreshToCurrentB, tryMessageWithNoRefreshToCurrent
-- ** Aliases
, sm
-- * Backwards Compatibility
-- $backwardsCompatibility
, send, sendSM, sendSM_
, tryInOrder, tryInOrder_
, tryMessage, tryMessage_
) where
import XMonad ( Window )
import XMonad.Core ( X(), Message, SomeMessage(..), LayoutClass(..), windowset, catchX, WorkspaceId, Layout, whenJust )
import XMonad.StackSet ( Workspace, current, workspace, layout, tag )
import XMonad.Operations ( updateLayout, refresh, windows )
import Data.Maybe ( isJust )
import Control.Monad ( when, void )
import Control.Monad.State ( gets )
import Control.Applicative ( (<$>), liftA2 )
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.MessageFeedback
--
-- You can then use this module's functions wherever an action is expected. All
-- feedback variants are supported:
--
-- * message to any workspace with no refresh
-- * message to current workspace with no refresh
-- * message to current workspace with refresh
--
-- Except "message to any workspace with refresh" which makes little sense.
--
-- Note that most functions in this module have a return type of @X Bool@
-- whereas configuration options will expect a @X ()@ action. For example, the
-- key binding:
--
-- > -- Shrink the master area of a tiled layout, or move the focused window
-- > -- to the left in a WindowArranger-based layout
-- > ((modKey, xK_Left), tryMessageWithNoRefreshToCurrentB Shrink (MoveLeft 50))
--
-- is mis-typed. For this reason, this module provides alternatives (not ending
-- with an uppercase \"B\", e.g. 'XMonad.Operations.sendMessage' rather than
-- 'sendMessageB') that discard their boolean result and return an @X ()@. For
-- example, to correct the previous example:
--
-- > ((modKey, xK_Left), tryMessageWithNoRefreshToCurrent Shrink (MoveLeft 50))
--
-- This module also provides 'SomeMessage' variants of each 'Message' function
-- for when the messages are of differing types (but still instances of
-- 'Message'). First box each message using 'SomeMessage' or the convenience
-- alias 'sm'. Then, for example, to send each message:
--
-- > sendSomeMessages [sm messageOfTypeA, sm messageOfTypeB]
--
-- This is /not/ equivalent to the following example, which will not refresh
-- the workspace unless the last message is handled:
--
-- > sendMessageWithNoRefreshToCurrent messageOfTypeA >> sendMessage messageOfTypeB
-- | Variant of 'XMonad.Operations.sendMessage'. Accepts 'SomeMessage'; to use
-- 'Message' see 'sendMessageB'. Returns @True@ if the message was handled,
-- @False@ otherwise. Instead of using 'sendSomeMessageWithNoRefreshToCurrentB'
-- for efficiency this is pretty much an exact copy of the
-- 'XMonad.Operations.sendMessage' code - foregoes the O(n) 'updateLayout'.
sendSomeMessageB :: SomeMessage -> X Bool
sendSomeMessageB m = do
w <- workspace . current <$> gets windowset
ml <- handleMessage (layout w) m `catchX` return Nothing
whenJust ml $ \l ->
windows $ \ws -> ws { current = (current ws)
{ workspace = (workspace $ current ws)
{ layout = l }}}
return $ isJust ml
-- | Variant of 'sendSomeMessageB' that discards the result.
sendSomeMessage :: SomeMessage -> X ()
sendSomeMessage = void . sendSomeMessageB
-- | Variant of 'XMonad.Operations.sendMessageWithNoRefresh'. Accepts
-- 'SomeMessage'; to use 'Message' see 'sendMessageWithNoRefreshB'. Returns
-- @True@ if the message was handled, @False@ otherwise.
sendSomeMessageWithNoRefreshB :: SomeMessage -> Workspace WorkspaceId (Layout Window) Window -> X Bool
sendSomeMessageWithNoRefreshB m w
= handleMessage (layout w) m `catchX` return Nothing
>>= liftA2 (>>) (updateLayout $ tag w) (return . isJust)
-- | Variant of 'sendSomeMessageWithNoRefreshB' that discards the result.
sendSomeMessageWithNoRefresh :: SomeMessage -> Workspace WorkspaceId (Layout Window) Window -> X ()
sendSomeMessageWithNoRefresh m = void . sendSomeMessageWithNoRefreshB m
-- | Variant of 'XMonad.Operations.sendMessageWithNoRefresh' that sends the
-- message to the current layout. Accepts 'SomeMessage'; to use 'Message' see
-- 'sendMessageWithNoRefreshToCurrentB'. Returns @True@ if the message was
-- handled, @False@ otherwise. This function is somewhat of a cross between
-- 'XMonad.Operations.sendMessage' (sends to the current layout) and
-- 'XMonad.Operations.sendMessageWithNoRefresh' (does not refresh).
sendSomeMessageWithNoRefreshToCurrentB :: SomeMessage -> X Bool
sendSomeMessageWithNoRefreshToCurrentB m
= (gets $ workspace . current . windowset)
>>= sendSomeMessageWithNoRefreshB m
-- | Variant of 'sendSomeMessageWithNoRefreshToCurrentB' that discards the
-- result.
sendSomeMessageWithNoRefreshToCurrent :: SomeMessage -> X ()
sendSomeMessageWithNoRefreshToCurrent = void . sendSomeMessageWithNoRefreshToCurrentB
-- | Variant of 'sendSomeMessageB' which like 'XMonad.Operations.sendMessage'
-- accepts 'Message' rather than 'SomeMessage'. Returns @True@ if the message
-- was handled, @False@ otherwise.
sendMessageB :: Message a => a -> X Bool
sendMessageB = sendSomeMessageB . SomeMessage
-- | Variant of 'sendSomeMessageWithNoRefreshB' which like
-- 'XMonad.Operations.sendMessageWithNoRefresh' accepts 'Message' rather than
-- 'SomeMessage'. Returns @True@ if the message was handled, @False@ otherwise.
sendMessageWithNoRefreshB :: Message a => a -> Workspace WorkspaceId (Layout Window) Window -> X Bool
sendMessageWithNoRefreshB = sendSomeMessageWithNoRefreshB . SomeMessage
-- | Variant of 'sendSomeMessageWithNoRefreshToCurrentB' which accepts
-- 'Message' rather than 'SomeMessage'. Returns @True@ if the message was
-- handled, @False@ otherwise.
sendMessageWithNoRefreshToCurrentB :: Message a => a -> X Bool
sendMessageWithNoRefreshToCurrentB = sendSomeMessageWithNoRefreshToCurrentB . SomeMessage
-- | Variant of 'sendMessageWithNoRefreshToCurrentB' that discards the result.
sendMessageWithNoRefreshToCurrent :: Message a => a -> X ()
sendMessageWithNoRefreshToCurrent = void . sendMessageWithNoRefreshToCurrentB
-- | Send each 'SomeMessage' to the current layout without refresh (using
-- 'sendSomeMessageWithNoRefreshToCurrentB') and collect the results. If any
-- message was handled, refresh. If you want to sequence a series of messages
-- that would have otherwise used 'XMonad.Operations.sendMessage' while
-- minimizing refreshes, use this.
sendSomeMessagesB :: [SomeMessage] -> X [Bool]
sendSomeMessagesB m
= mapM sendSomeMessageWithNoRefreshToCurrentB m
>>= liftA2 (>>) (flip when refresh . or) return
-- | Variant of 'sendSomeMessagesB' that discards the results.
sendSomeMessages :: [SomeMessage] -> X ()
sendSomeMessages = void . sendSomeMessagesB
-- | Variant of 'sendSomeMessagesB' which accepts 'Message' rather than
-- 'SomeMessage'. Use this if all the messages are of the same type.
sendMessagesB :: Message a => [a] -> X [Bool]
sendMessagesB = sendSomeMessagesB . map SomeMessage
-- | Variant of 'sendMessagesB' that discards the results.
sendMessages :: Message a => [a] -> X ()
sendMessages = void . sendMessagesB
-- | Apply the dispatch function in order to each message of the list until one
-- is handled. Returns @True@ if so, @False@ otherwise.
tryInOrderB :: (SomeMessage -> X Bool) -> [SomeMessage] -> X Bool
tryInOrderB _ [] = return False
tryInOrderB f (m:ms) = do b <- f m
if b then return True else tryInOrderB f ms
-- | Variant of 'tryInOrderB' that sends messages to the current layout without
-- refresh using 'sendSomeMessageWithNoRefreshToCurrentB'.
tryInOrderWithNoRefreshToCurrentB :: [SomeMessage] -> X Bool
tryInOrderWithNoRefreshToCurrentB = tryInOrderB sendSomeMessageWithNoRefreshToCurrentB
-- | Variant of 'tryInOrderWithNoRefreshToCurrent' that discards the results.
tryInOrderWithNoRefreshToCurrent :: [SomeMessage] -> X ()
tryInOrderWithNoRefreshToCurrent = void . tryInOrderWithNoRefreshToCurrentB
-- | Apply the dispatch function to the first message, and if it was not
-- handled, apply it to the second. Returns @True@ if either message was
-- handled, @False@ otherwise.
tryMessageB :: (Message a, Message b) => (SomeMessage -> X Bool) -> a -> b -> X Bool
tryMessageB f m1 m2 = tryInOrderB f [sm m1,sm m2]
-- | Variant of 'tryMessageB' that sends messages to the current layout without
-- refresh using 'sendMessageWithNoRefreshToCurrentB'.
tryMessageWithNoRefreshToCurrentB :: (Message a, Message b) => a -> b -> X Bool
tryMessageWithNoRefreshToCurrentB = tryMessageB sendSomeMessageWithNoRefreshToCurrentB
-- | Variant of 'tryMessage' that discards the results.
tryMessageWithNoRefreshToCurrent :: (Message a, Message b) => a -> b -> X ()
tryMessageWithNoRefreshToCurrent m = void . tryMessageWithNoRefreshToCurrentB m
-- | Convenience shorthand for 'SomeMessage'.
sm :: Message a => a -> SomeMessage
sm = SomeMessage
--------------------------------------------------------------------------------
-- Backwards Compatibility:
--------------------------------------------------------------------------------
{-# DEPRECATED send "Use sendMessageB instead." #-}
{-# DEPRECATED sendSM "Use sendSomeMessageB instead." #-}
{-# DEPRECATED sendSM_ "Use sendSomeMessage instead." #-}
{-# DEPRECATED tryInOrder "Use tryInOrderWithNoRefreshToCurrentB instead." #-}
{-# DEPRECATED tryInOrder_ "Use tryInOrderWithNoRefreshToCurrent instead." #-}
{-# DEPRECATED tryMessage "Use tryMessageWithNoRefreshToCurrentB instead." #-}
{-# DEPRECATED tryMessage_ "Use tryMessageWithNoRefreshToCurrent instead." #-}
-- $backwardsCompatibility
-- The following functions exist solely for compatibility with pre-0.14
-- releases.
-- | See 'sendMessageWithNoRefreshToCurrentB'.
send :: Message a => a -> X Bool
send = sendMessageWithNoRefreshToCurrentB
-- | See 'sendSomeMessageWithNoRefreshToCurrentB'.
sendSM :: SomeMessage -> X Bool
sendSM = sendSomeMessageWithNoRefreshToCurrentB
-- | See 'sendSomeMessageWithNoRefreshToCurrent'.
sendSM_ :: SomeMessage -> X ()
sendSM_ = sendSomeMessageWithNoRefreshToCurrent
-- | See 'tryInOrderWithNoRefreshToCurrentB'.
tryInOrder :: [SomeMessage] -> X Bool
tryInOrder = tryInOrderWithNoRefreshToCurrentB
-- | See 'tryInOrderWithNoRefreshToCurrent'.
tryInOrder_ :: [SomeMessage] -> X ()
tryInOrder_ = tryInOrderWithNoRefreshToCurrent
-- | See 'tryMessageWithNoRefreshToCurrentB'.
tryMessage :: (Message a, Message b) => a -> b -> X Bool
tryMessage = tryMessageWithNoRefreshToCurrentB
-- | See 'tryMessageWithNoRefreshToCurrent'.
tryMessage_ :: (Message a, Message b) => a -> b -> X ()
tryMessage_ = tryMessageWithNoRefreshToCurrent

144
XMonad/Actions/Minimize.hs Normal file
View File

@@ -0,0 +1,144 @@
----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.Minimize
-- Copyright : (c) Bogdan Sinitsyn (2016)
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Bogdan Sinitsyn <bogdan.sinitsyn@gmail.com>
-- Stability : unstable
-- Portability : not portable
--
-- Adds actions for minimizing and maximizing windows
--
-- This module should be used with "XMonad.Layout.Minimize". Add 'minimize' to your
-- layout modifiers as described in "XMonad.Layout.Minimized" and use actions from
-- this module
--
-- Possible keybindings:
--
-- > , ((modm, xK_m ), withFocused minimizeWindow)
-- > , ((modm .|. shiftMask, xK_m ), withLastMinimized maximizeWindowAndFocus)
--
-----------------------------------------------------------------------------
module XMonad.Actions.Minimize
( -- * Usage
-- $usage
minimizeWindow
, maximizeWindow
, maximizeWindowAndFocus
, withLastMinimized
, withLastMinimized'
, withFirstMinimized
, withFirstMinimized'
, withMinimized
) where
import XMonad
import qualified XMonad.StackSet as W
import qualified XMonad.Layout.BoringWindows as BW
import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Util.Minimize
import XMonad.Util.WindowProperties (getProp32)
import Foreign.C.Types (CLong)
import Control.Applicative((<$>))
import Control.Monad (join)
import Data.Maybe (fromMaybe, listToMaybe)
import qualified Data.List as L
import qualified Data.Map as M
-- $usage
-- Import this module with "XMonad.Layout.Minimize" and "XMonad.Layout.BoringWindows":
-- > import XMonad.Actions.Minimize
-- > import XMonad.Layout.Minimize
-- > import qualified XMonad.Layout.BoringWindows as BW
--
-- Then apply 'minimize' and 'boringWindows' to your layout hook and use some
-- actions from this module:
-- > main = xmonad def { layoutHook = minimize . BW.boringWindows $ whatever }
-- Example keybindings:
-- > , ((modm, xK_m ), withFocused minimizeWindow )
-- > , ((modm .|. shiftMask, xK_m ), withLastMinimized maximizeWindow)
setMinimizedState :: Window -> Int -> (CLong -> [CLong] -> [CLong]) -> X ()
setMinimizedState win st f = do
setWMState win st
withDisplay $ \dpy -> do
wm_state <- getAtom "_NET_WM_STATE"
hidden <- fromIntegral <$> getAtom "_NET_WM_STATE_HIDDEN"
wstate <- fromMaybe [] <$> getProp32 wm_state win
io $ changeProperty32 dpy win wm_state aTOM propModeReplace (f hidden wstate)
setMinimized :: Window -> X ()
setMinimized win = setMinimizedState win iconicState (:)
setNotMinimized :: Window -> X ()
setNotMinimized win = setMinimizedState win normalState L.delete
-- It does not just set minimizedStack to newWindows because it should save
-- order in which elements were added (newer first)
modified :: (RectMap -> RectMap) -> X Bool
modified f = XS.modified $
\Minimized { rectMap = oldRectMap, minimizedStack = oldStack } ->
let newRectMap = f oldRectMap
newWindows = M.keys newRectMap
in Minimized { rectMap = newRectMap
, minimizedStack = (newWindows L.\\ oldStack)
++
(oldStack `L.intersect` newWindows)
}
-- | Minimize a window
minimizeWindow :: Window -> X ()
minimizeWindow w = withWindowSet $ \ws ->
whenX (modified $ M.insert w (M.lookup w $ W.floating ws)) $ do
setMinimized w
windows $ W.sink w
BW.focusDown
-- | Maximize window and apply a function to maximized window and 'WindowSet'
maximizeWindowAndChangeWSet :: (Window -> WindowSet -> WindowSet) -> Window -> X ()
maximizeWindowAndChangeWSet f w = do
mrect <- XS.gets (join . M.lookup w . rectMap)
whenX (modified $ M.delete w) $ do
setNotMinimized w
broadcastMessage BW.UpdateBoring
windows $ f w . maybe id (W.float w) mrect
-- | Just maximize a window without focusing
maximizeWindow :: Window -> X ()
maximizeWindow = maximizeWindowAndChangeWSet $ const id
-- | Maximize a window and then focus it
maximizeWindowAndFocus :: Window -> X ()
maximizeWindowAndFocus = maximizeWindowAndChangeWSet W.focusWindow
-- | Perform an action with first minimized window on current workspace
-- or do nothing if there is no minimized windows on current workspace
withFirstMinimized :: (Window -> X ()) -> X ()
withFirstMinimized action = withFirstMinimized' (flip whenJust action)
-- | Like withFirstMinimized but the provided action is always invoked with a
-- 'Maybe Window', that will be nothing if there is no first minimized window.
withFirstMinimized' :: (Maybe Window -> X ()) -> X ()
withFirstMinimized' action = withMinimized (action . listToMaybe . reverse)
-- | Perform an action with last minimized window on current workspace
-- or do nothing if there is no minimized windows on current workspace
withLastMinimized :: (Window -> X ()) -> X ()
withLastMinimized action = withLastMinimized' (flip whenJust action)
-- | Like withLastMinimized but the provided action is always invoked with a
-- 'Maybe Window', that will be nothing if there is no last minimized window.
withLastMinimized' :: (Maybe Window -> X ()) -> X ()
withLastMinimized' action = withMinimized (action . listToMaybe)
withMinimized :: ([Window] -> X a) -> X a
withMinimized action = do
minimized <- XS.gets minimizedStack
currentStack <- withWindowSet $ return . W.index
action $ minimized `L.intersect` currentStack

View File

@@ -0,0 +1,137 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.MouseGestures
-- Copyright : (c) Lukas Mai
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : <l.mai@web.de>
-- Stability : unstable
-- Portability : unportable
--
-- Support for simple mouse gestures.
--
-----------------------------------------------------------------------------
module XMonad.Actions.MouseGestures (
-- * Usage
-- $usage
Direction2D(..),
mouseGestureH,
mouseGesture,
mkCollect
) where
import XMonad
import XMonad.Util.Types (Direction2D(..))
import Data.IORef
import qualified Data.Map as M
import Data.Map (Map)
import Data.Maybe
import Control.Monad
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.MouseGestures
-- > import qualified XMonad.StackSet as W
--
-- then add an appropriate mouse binding:
--
-- > , ((modm .|. shiftMask, button3), mouseGesture gestures)
--
-- where @gestures@ is a 'Data.Map.Map' from gestures to actions on
-- windows, for example:
--
-- > gestures = M.fromList
-- > [ ([], focus)
-- > , ([U], \w -> focus w >> windows W.swapUp)
-- > , ([D], \w -> focus w >> windows W.swapDown)
-- > , ([R, D], \_ -> sendMessage NextLayout)
-- > ]
--
-- This is just an example, of course; you can use any mouse button and
-- gesture definitions you want.
--
-- For detailed instructions on editing your mouse bindings, see
-- "XMonad.Doc.Extending#Editing_mouse_bindings".
type Pos = (Position, Position)
delta :: Pos -> Pos -> Position
delta (ax, ay) (bx, by) = max (d ax bx) (d ay by)
where
d a b = abs (a - b)
dir :: Pos -> Pos -> Direction2D
dir (ax, ay) (bx, by) = trans . (/ pi) $ atan2 (fromIntegral $ ay - by) (fromIntegral $ bx - ax)
where
trans :: Double -> Direction2D
trans x
| rg (-3/4) (-1/4) x = D
| rg (-1/4) (1/4) x = R
| rg (1/4) (3/4) x = U
| otherwise = L
rg a z x = a <= x && x < z
gauge :: (Direction2D -> X ()) -> Pos -> IORef (Maybe (Direction2D, Pos)) -> Position -> Position -> X ()
gauge hook op st nx ny = do
let np = (nx, ny)
stx <- io $ readIORef st
let
(~(Just od), pivot) = case stx of
Nothing -> (Nothing, op)
Just (d, zp) -> (Just d, zp)
cont = do
guard $ significant np pivot
return $ do
let d' = dir pivot np
when (isNothing stx || od /= d') $ hook d'
io $ writeIORef st (Just (d', np))
fromMaybe (return ()) cont
where
significant a b = delta a b >= 10
-- | @'mouseGestureH' moveHook endHook@ is a mouse button
-- event handler. It collects mouse movements, calling @moveHook@ for each
-- update; when the button is released, it calls @endHook@.
mouseGestureH :: (Direction2D -> X ()) -> X () -> X ()
mouseGestureH moveHook endHook = do
dpy <- asks display
root <- asks theRoot
(pos, acc) <- io $ do
(_, _, _, ix, iy, _, _, _) <- queryPointer dpy root
r <- newIORef Nothing
return ((fromIntegral ix, fromIntegral iy), r)
mouseDrag (gauge moveHook pos acc) endHook
-- | A utility function on top of 'mouseGestureH'. It uses a 'Data.Map.Map' to
-- look up the mouse gesture, then executes the corresponding action (if any).
mouseGesture :: Map [Direction2D] (Window -> X ()) -> Window -> X ()
mouseGesture tbl win = do
(mov, end) <- mkCollect
mouseGestureH (\d -> mov d >> return ()) $ end >>= \gest ->
case M.lookup gest tbl of
Nothing -> return ()
Just f -> f win
-- | A callback generator for 'mouseGestureH'. 'mkCollect' returns two
-- callback functions for passing to 'mouseGestureH'. The move hook will
-- collect mouse movements (and return the current gesture as a list); the end
-- hook will return a list of the completed gesture, which you can access with
-- 'Control.Monad.>>='.
mkCollect :: (MonadIO m, MonadIO m') => m (Direction2D -> m' [Direction2D], m' [Direction2D])
mkCollect = liftIO $ do
acc <- newIORef []
let
mov d = liftIO $ do
ds <- readIORef acc
let ds' = d : ds
writeIORef acc ds'
return $ reverse ds'
end = liftIO $ do
ds <- readIORef acc
writeIORef acc []
return $ reverse ds
return (mov, end)

View File

@@ -0,0 +1,134 @@
{-# LANGUAGE GeneralizedNewtypeDeriving, MultiParamTypeClasses, PatternGuards, TypeSynonymInstances #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.MouseResize
-- Copyright : (c) 2007 Andrea Rossato
-- License : BSD-style (see xmonad/LICENSE)
--
-- Maintainer : andrea.rossato@unibz.it
-- Stability : unstable
-- Portability : unportable
--
-- A layout modifier to resize windows with the mouse by grabbing the
-- window's lower right corner.
--
-- This module must be used together with "XMonad.Layout.WindowArranger".
-----------------------------------------------------------------------------
module XMonad.Actions.MouseResize
( -- * Usage:
-- $usage
mouseResize
, MouseResize (..)
) where
import XMonad
import XMonad.Layout.Decoration
import XMonad.Layout.WindowArranger
import XMonad.Util.XUtils
-- $usage
-- Usually this module is used to create layouts, but you can also use
-- it to resize windows in any layout, together with the
-- "XMonad.Layout.WindowArranger". For usage example see
-- "XMonad.Layout.SimpleFloat" or "XMonad.Layout.DecorationMadness".
--
-- You can use this module with the following in your
-- @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.MouseResize
-- > import XMonad.Layout.WindowArranger
--
-- Then edit your @layoutHook@ by modifying a given layout:
--
-- > myLayout = mouseResize $ windowArrange $ layoutHook def
--
-- and then:
--
-- > main = xmonad def { layoutHook = myLayout }
--
-- For more detailed instructions on editing the layoutHook see:
--
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
mouseResize :: l a -> ModifiedLayout MouseResize l a
mouseResize = ModifiedLayout (MR [])
data MouseResize a = MR [((a,Rectangle),Maybe a)]
instance Show (MouseResize a) where show _ = ""
instance Read (MouseResize a) where readsPrec _ s = [(MR [], s)]
instance LayoutModifier MouseResize Window where
redoLayout _ _ Nothing wrs = return (wrs, Nothing)
redoLayout (MR st) _ (Just s) wrs
| [] <- st = initState >>= \nst -> return (wrs, Just $ MR nst)
| otherwise = processState >>= \nst -> return (wrs, Just $ MR nst)
where
wrs' = wrs_to_state [] . filter (isInStack s . fst) $ wrs
initState = mapM createInputWindow wrs'
processState = mapM (deleteInputWin . snd) st >> mapM createInputWindow wrs'
inputRectangle (Rectangle x y wh ht) = Rectangle (x + fi wh - 5) (y + fi ht - 5) 10 10
wrs_to_state rs ((w,r):xs)
| ir `isVisible` rs = ((w,r),Just ir) : wrs_to_state (r:ir:rs) xs
| otherwise = ((w,r),Nothing) : wrs_to_state (r: rs) xs
where ir = inputRectangle r
wrs_to_state _ [] = []
handleMess (MR s) m
| Just e <- fromMessage m :: Maybe Event = handleResize s e >> return Nothing
| Just Hide <- fromMessage m = releaseResources >> return (Just $ MR [])
| Just ReleaseResources <- fromMessage m = releaseResources >> return (Just $ MR [])
where releaseResources = mapM_ (deleteInputWin . snd) s
handleMess _ _ = return Nothing
handleResize :: [((Window,Rectangle),Maybe Window)] -> Event -> X ()
handleResize st ButtonEvent { ev_window = ew, ev_event_type = et }
| et == buttonPress
, Just (w,Rectangle wx wy _ _) <- getWin ew st = do
focus w
mouseDrag (\x y -> do
let rect = Rectangle wx wy
(max 1 . fi $ x - wx)
(max 1 . fi $ y - wy)
sendMessage (SetGeometry rect)) (return ())
where
getWin w (((win,r),tw):xs)
| Just w' <- tw
, w == w' = Just (win,r)
| otherwise = getWin w xs
getWin _ [] = Nothing
handleResize _ _ = return ()
createInputWindow :: ((Window,Rectangle), Maybe Rectangle) -> X ((Window,Rectangle),Maybe Window)
createInputWindow ((w,r),mr) = do
case mr of
Just tr -> withDisplay $ \d -> do
tw <- mkInputWindow d tr
io $ selectInput d tw (exposureMask .|. buttonPressMask)
cursor <- io $ createFontCursor d xC_bottom_right_corner
io $ defineCursor d tw cursor
io $ freeCursor d cursor
showWindow tw
return ((w,r), Just tw)
Nothing -> return ((w,r), Nothing)
deleteInputWin :: Maybe Window -> X ()
deleteInputWin = maybe (return ()) deleteWindow
mkInputWindow :: Display -> Rectangle -> X Window
mkInputWindow d (Rectangle x y w h) = do
rw <- asks theRoot
let screen = defaultScreenOfDisplay d
visual = defaultVisualOfScreen screen
attrmask = cWOverrideRedirect
io $ allocaSetWindowAttributes $
\attributes -> do
set_override_redirect attributes True
createWindow d rw x y w h 0 0 inputOnly visual attrmask attributes

View File

@@ -0,0 +1,965 @@
{-# LANGUAGE DeriveDataTypeable, MultiParamTypeClasses, PatternGuards, RankNTypes, TypeSynonymInstances #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Layout.Navigation2D
-- Copyright : (c) 2011 Norbert Zeh <nzeh@cs.dal.ca>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Norbert Zeh <nzeh@cs.dal.ca>
-- Stability : unstable
-- Portability : unportable
--
-- Navigation2D is an xmonad extension that allows easy directional
-- navigation of windows and screens (in a multi-monitor setup).
-----------------------------------------------------------------------------
module XMonad.Actions.Navigation2D ( -- * Usage
-- $usage
-- * Finer points
-- $finer_points
-- * Alternative directional navigation modules
-- $alternatives
-- * Incompatibilities
-- $incompatibilities
-- * Detailed technical discussion
-- $technical
-- * Exported functions and types
-- #Exports#
navigation2D
, navigation2DP
, additionalNav2DKeys
, additionalNav2DKeysP
, withNavigation2DConfig
, Navigation2DConfig(..)
, def
, defaultNavigation2DConfig
, Navigation2D
, lineNavigation
, centerNavigation
, sideNavigation
, sideNavigationWithBias
, hybridOf
, hybridNavigation
, fullScreenRect
, singleWindowRect
, switchLayer
, windowGo
, windowSwap
, windowToScreen
, screenGo
, screenSwap
, Direction2D(..)
) where
import Control.Applicative
import qualified Data.List as L
import qualified Data.Map as M
import Data.Maybe
import Data.Ord (comparing)
import XMonad hiding (Screen)
import qualified XMonad.StackSet as W
import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Util.EZConfig (additionalKeys, additionalKeysP)
import XMonad.Util.Types
-- $usage
-- #Usage#
-- Navigation2D provides directional navigation (go left, right, up, down) for
-- windows and screens. It treats floating and tiled windows as two separate
-- layers and provides mechanisms to navigate within each layer and to switch
-- between layers. Navigation2D provides three different navigation strategies
-- (see <#Technical_Discussion> for details): /Line navigation/ and
-- /Side navigation/ feel rather natural but may make it impossible to navigate
-- to a given window from the current window, particularly in the floating
-- layer. /Center navigation/ feels less natural in certain situations but
-- ensures that all windows can be reached without the need to involve the
-- mouse. Another option is to use a /Hybrid/ of the three strategies,
-- automatically choosing whichever first provides a suitable target window.
-- Navigation2D allows different navigation strategies to be used in the two
-- layers and allows customization of the navigation strategy for the tiled
-- layer based on the layout currently in effect.
--
-- You can use this module with (a subset of) the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.Navigation2D
--
-- Then add the configuration of the module to your main function:
--
-- > main = xmonad $ navigation2D def
-- > (xK_Up, xK_Left, xK_Down, xK_Right)
-- > [(mod4Mask, windowGo ),
-- > (mod4Mask .|. shiftMask, windowSwap)]
-- > False
-- > $ def
--
-- Alternatively, you can use navigation2DP:
--
-- > main = xmonad $ navigation2DP def
-- > ("<Up>", "<Left>", "<Down>", "<Right>")
-- > [("M-", windowGo ),
-- > ("M-S-", windowSwap)]
-- > False
-- > $ def
--
-- That's it. If instead you'd like more control, you can combine
-- withNavigation2DConfig and additionalNav2DKeys or additionalNav2DKeysP:
--
-- > main = xmonad $ withNavigation2DConfig def
-- > $ additionalNav2DKeys (xK_Up, xK_Left, xK_Down, xK_Right)
-- > [(mod4Mask, windowGo ),
-- > (mod4Mask .|. shiftMask, windowSwap)]
-- > False
-- > $ additionalNav2DKeys (xK_u, xK_l, xK_d, xK_r)
-- > [(mod4Mask, screenGo ),
-- > (mod4Mask .|. shiftMask, screenSwap)]
-- > False
-- > $ def
--
-- Or you can add the configuration of the module to your main function:
--
-- > main = xmonad $ withNavigation2DConfig def $ def
--
-- And specify your keybindings normally:
--
-- > -- Switch between layers
-- > , ((modm, xK_space), switchLayer)
-- >
-- > -- Directional navigation of windows
-- > , ((modm, xK_Right), windowGo R False)
-- > , ((modm, xK_Left ), windowGo L False)
-- > , ((modm, xK_Up ), windowGo U False)
-- > , ((modm, xK_Down ), windowGo D False)
-- >
-- > -- Swap adjacent windows
-- > , ((modm .|. controlMask, xK_Right), windowSwap R False)
-- > , ((modm .|. controlMask, xK_Left ), windowSwap L False)
-- > , ((modm .|. controlMask, xK_Up ), windowSwap U False)
-- > , ((modm .|. controlMask, xK_Down ), windowSwap D False)
-- >
-- > -- Directional navigation of screens
-- > , ((modm, xK_r ), screenGo R False)
-- > , ((modm, xK_l ), screenGo L False)
-- > , ((modm, xK_u ), screenGo U False)
-- > , ((modm, xK_d ), screenGo D False)
-- >
-- > -- Swap workspaces on adjacent screens
-- > , ((modm .|. controlMask, xK_r ), screenSwap R False)
-- > , ((modm .|. controlMask, xK_l ), screenSwap L False)
-- > , ((modm .|. controlMask, xK_u ), screenSwap U False)
-- > , ((modm .|. controlMask, xK_d ), screenSwap D False)
-- >
-- > -- Send window to adjacent screen
-- > , ((modm .|. mod1Mask, xK_r ), windowToScreen R False)
-- > , ((modm .|. mod1Mask, xK_l ), windowToScreen L False)
-- > , ((modm .|. mod1Mask, xK_u ), windowToScreen U False)
-- > , ((modm .|. mod1Mask, xK_d ), windowToScreen D False)
--
-- For detailed instruction on editing the key binding see:
--
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- $finer_points
-- #Finer_Points#
-- The above should get you started. Here are some finer points:
--
-- Navigation2D has the ability to wrap around at screen edges. For example, if
-- you navigated to the rightmost window on the rightmost screen and you
-- continued to go right, this would get you to the leftmost window on the
-- leftmost screen. This feature may be useful for switching between screens
-- that are far apart but may be confusing at least to novice users. Therefore,
-- it is disabled in the above example (e.g., navigation beyond the rightmost
-- window on the rightmost screen is not possible and trying to do so will
-- simply not do anything.) If you want this feature, change all the 'False'
-- values in the above example to 'True'. You could also decide you want
-- wrapping only for a subset of the operations and no wrapping for others.
--
-- By default, all layouts use the 'defaultTiledNavigation' strategy specified
-- in the 'Navigation2DConfig' (by default, line navigation is used). To
-- override this behaviour for some layouts, add a pair (\"layout name\",
-- navigation strategy) to the 'layoutNavigation' list in the
-- 'Navigation2DConfig', where \"layout name\" is the string reported by the
-- layout's description method (normally what is shown as the layout name in
-- your status bar). For example, all navigation strategies normally allow only
-- navigation between mapped windows. The first step to overcome this, for
-- example, for the Full layout, is to switch to center navigation for the Full
-- layout:
--
-- > myNavigation2DConfig = def { layoutNavigation = [("Full", centerNavigation)] }
-- >
-- > main = xmonad $ withNavigation2DConfig myNavigation2DConfig
-- > $ def
--
-- The navigation between windows is based on their screen rectangles, which are
-- available /and meaningful/ only for mapped windows. Thus, as already said,
-- the default is to allow navigation only between mapped windows. However,
-- there are layouts that do not keep all windows mapped. One example is the
-- Full layout, which unmaps all windows except the one that has the focus,
-- thereby preventing navigation to any other window in the layout. To make
-- navigation to unmapped windows possible, unmapped windows need to be assigned
-- rectangles to pretend they are mapped, and a natural way to do this for the
-- Full layout is to pretend all windows occupy the full screen and are stacked
-- on top of each other so that only the frontmost one is visible. This can be
-- done as follows:
--
-- > myNavigation2DConfig = def { layoutNavigation = [("Full", centerNavigation)]
-- > , unmappedWindowRect = [("Full", singleWindowRect)]
-- > }
-- >
-- > main = xmonad $ withNavigation2DConfig myNavigation2DConfig
-- > $ def
--
-- With this setup, Left/Up navigation behaves like standard
-- 'XMonad.StackSet.focusUp' and Right/Down navigation behaves like
-- 'XMonad.StackSet.focusDown', thus allowing navigation between windows in the
-- layout.
--
-- In general, each entry in the 'unmappedWindowRect' association list is a pair
-- (\"layout description\", function), where the function computes a rectangle
-- for each unmapped window from the screen it is on and the window ID.
-- Currently, Navigation2D provides only two functions of this type:
-- 'singleWindowRect' and 'fullScreenRect'.
--
-- With per-layout navigation strategies, if different layouts are in effect on
-- different screens in a multi-monitor setup, and different navigation
-- strategies are defined for these active layouts, the most general of these
-- navigation strategies is used across all screens (because Navigation2D does
-- not distinguish between windows on different workspaces), where center
-- navigation is more general than line navigation, as discussed formally under
-- <#Technical_Discussion>.
-- $alternatives
-- #Alternatives#
--
-- There exist two alternatives to Navigation2D:
-- "XMonad.Actions.WindowNavigation" and "XMonad.Layout.WindowNavigation".
-- X.L.WindowNavigation has the advantage of colouring windows to indicate the
-- window that would receive the focus in each navigation direction, but it does
-- not support navigation across multiple monitors, does not support directional
-- navigation of floating windows, and has a very unintuitive definition of
-- which window receives the focus next in each direction. X.A.WindowNavigation
-- does support navigation across multiple monitors but does not provide window
-- colouring while retaining the unintuitive navigational semantics of
-- X.L.WindowNavigation. This makes it very difficult to predict which window
-- receives the focus next. Neither X.A.WindowNavigation nor
-- X.L.WindowNavigation supports directional navigation of screens.
-- $technical
-- #Technical_Discussion#
-- An in-depth discussion of the navigational strategies implemented in
-- Navigation2D, including formal proofs of their properties, can be found
-- at <http://www.cs.dal.ca/~nzeh/xmonad/Navigation2D.pdf>.
-- $incompatibilities
-- #Incompatibilities#
-- Currently Navigation2D is known not to play nicely with tabbed layouts, but
-- it should work well with any other tiled layout. My hope is to address the
-- incompatibility with tabbed layouts in a future version. The navigation to
-- unmapped windows, for example in a Full layout, by assigning rectangles to
-- unmapped windows is more a workaround than a clean solution. Figuring out
-- how to deal with tabbed layouts may also lead to a more general and cleaner
-- solution to query the layout for a window's rectangle that may make this
-- workaround unnecessary. At that point, the 'unmappedWindowRect' field of the
-- 'Navigation2DConfig' will disappear.
-- | A rectangle paired with an object
type Rect a = (a, Rectangle)
-- | A shorthand for window-rectangle pairs. Reduces typing.
type WinRect = Rect Window
-- | A shorthand for workspace-rectangle pairs. Reduces typing.
type WSRect = Rect WorkspaceId
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- --
-- PUBLIC INTERFACE --
-- --
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- | Encapsulates the navigation strategy
data Navigation2D = N Generality (forall a . Eq a => Direction2D -> Rect a -> [Rect a] -> Maybe a)
runNav :: forall a . Eq a => Navigation2D -> (Direction2D -> Rect a -> [Rect a] -> Maybe a)
runNav (N _ nav) = nav
-- | Score that indicates how general a navigation strategy is
type Generality = Int
instance Eq Navigation2D where
(N x _) == (N y _) = x == y
instance Ord Navigation2D where
(N x _) <= (N y _) = x <= y
-- | Line navigation. To illustrate this navigation strategy, consider
-- navigating to the left from the current window. In this case, we draw a
-- horizontal line through the center of the current window and consider all
-- windows that intersect this horizontal line and whose right boundaries are to
-- the left of the left boundary of the current window. From among these
-- windows, we choose the one with the rightmost right boundary.
lineNavigation :: Navigation2D
lineNavigation = N 1 doLineNavigation
-- | Center navigation. Again, consider navigating to the left. Then we
-- consider the cone bounded by the two rays shot at 45-degree angles in
-- north-west and south-west direction from the center of the current window. A
-- window is a candidate to receive the focus if its center lies in this cone.
-- We choose the window whose center has minimum L1-distance from the current
-- window center. The tie breaking strategy for windows with the same distance
-- is a bit complicated (see <#Technical_Discussion>) but ensures that all
-- windows can be reached and that windows with the same center are traversed in
-- their order in the window stack, that is, in the order
-- 'XMonad.StackSet.focusUp' and 'XMonad.StackSet.focusDown' would traverse
-- them.
centerNavigation :: Navigation2D
centerNavigation = N 2 doCenterNavigation
-- | Side navigation. Consider navigating to the right this time. The strategy
-- is to take the line segment forming the right boundary of the current window,
-- and push it to the right until it intersects with at least one other window.
-- Of those windows, one with a point that is the closest to the centre of the
-- line (+1) is selected. This is probably the most intuitive strategy for the
-- tiled layer when using XMonad.Layout.Spacing.
sideNavigation :: Navigation2D
sideNavigation = N 1 (doSideNavigationWithBias 1)
-- | Side navigation with bias. Consider a case where the screen is divided
-- up into three vertical panes; the side panes occupied by one window each and
-- the central pane split across the middle by two windows. By the criteria
-- of side navigation, the two central windows are equally good choices when
-- navigating inwards from one of the side panes. Hence in order to be
-- equitable, symmetric and pleasant to use, different windows are chosen when
-- navigating from different sides. In particular, the lower is chosen when
-- going left and the higher when going right, causing L, L, R, R, L, L, etc to
-- cycle through the four windows clockwise. This is implemented by using a bias
-- of 1. /Bias/ is how many pixels off centre the vertical split can be before
-- this behaviour is lost and the same window chosen every time. A negative bias
-- swaps the preferred window for each direction. A bias of zero disables the
-- behaviour.
sideNavigationWithBias :: Int -> Navigation2D
sideNavigationWithBias b = N 1 (doSideNavigationWithBias b)
-- | Hybrid of two modes of navigation, preferring the motions of the first.
-- Use this if you want to fall back on a second strategy whenever the first
-- does not find a candidate window. E.g.
-- @hybridOf lineNavigation centerNavigation@ is a good strategy for the
-- floating layer, and @hybridOf sideNavigation centerNavigation@ will enable
-- you to take advantage of some of the latter strategy's more interesting
-- motions in the tiled layer.
hybridOf :: Navigation2D -> Navigation2D -> Navigation2D
hybridOf (N g1 s1) (N g2 s2) = N (max g1 g2) $ applyToBoth s1 s2
where
applyToBoth f g a b c = f a b c <|> g a b c
{-# DEPRECATED hybridNavigation "Use hybridOf with lineNavigation and centerNavigation as arguments." #-}
hybridNavigation :: Navigation2D
hybridNavigation = hybridOf lineNavigation centerNavigation
-- | Stores the configuration of directional navigation. The 'Default' instance
-- uses line navigation for the tiled layer and for navigation between screens,
-- and center navigation for the float layer. No custom navigation strategies
-- or rectangles for unmapped windows are defined for individual layouts.
data Navigation2DConfig = Navigation2DConfig
{ defaultTiledNavigation :: Navigation2D -- ^ default navigation strategy for the tiled layer
, floatNavigation :: Navigation2D -- ^ navigation strategy for the float layer
, screenNavigation :: Navigation2D -- ^ strategy for navigation between screens
, layoutNavigation :: [(String, Navigation2D)] -- ^ association list of customized navigation strategies
-- for different layouts in the tiled layer. Each pair
-- is of the form (\"layout description\", navigation
-- strategy). If there is no pair in this list whose first
-- component is the name of the current layout, the
-- 'defaultTiledNavigation' strategy is used.
, unmappedWindowRect :: [(String, Screen -> Window -> X (Maybe Rectangle))]
-- ^ list associating functions to calculate rectangles
-- for unmapped windows with layouts to which they are
-- to be applied. Each pair in this list is of
-- the form (\"layout description\", function), where the
-- function calculates a rectangle for a given unmapped
-- window from the screen it is on and its window ID.
-- See <#Finer_Points> for how to use this.
} deriving Typeable
-- | Shorthand for the tedious screen type
type Screen = W.Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail
-- | Convenience function for enabling Navigation2D with typical keybindings.
-- Takes a Navigation2DConfig, an (up, left, down, right) tuple, a mapping from
-- modifier key to action, and a bool to indicate if wrapping should occur, and
-- returns a function from XConfig to XConfig.
-- Example:
--
-- > navigation2D def (xK_w, xK_a, xK_s, xK_d) [(mod4Mask, windowGo), (mod4Mask .|. shiftMask, windowSwap)] False myConfig
navigation2D :: Navigation2DConfig -> (KeySym, KeySym, KeySym, KeySym) -> [(ButtonMask, Direction2D -> Bool -> X ())] ->
Bool -> XConfig l -> XConfig l
navigation2D navConfig (u, l, d, r) modifiers wrap xconfig =
additionalNav2DKeys (u, l, d, r) modifiers wrap $
withNavigation2DConfig navConfig xconfig
-- | Convenience function for enabling Navigation2D with typical keybindings,
-- using the syntax defined in 'XMonad.Util.EZConfig.mkKeymap'. Takes a
-- Navigation2DConfig, an (up, left, down, right) tuple, a mapping from key
-- prefix to action, and a bool to indicate if wrapping should occur, and
-- returns a function from XConfig to XConfig. Example:
--
-- > navigation2DP def ("w", "a", "s", "d") [("M-", windowGo), ("M-S-", windowSwap)] False myConfig
navigation2DP :: Navigation2DConfig -> (String, String, String, String) -> [(String, Direction2D -> Bool -> X ())] ->
Bool -> XConfig l -> XConfig l
navigation2DP navConfig (u, l, d, r) modifiers wrap xconfig =
additionalNav2DKeysP (u, l, d, r) modifiers wrap $
withNavigation2DConfig navConfig xconfig
-- | Convenience function for adding keybindings. Takes an (up, left, down,
-- right) tuple, a mapping from key prefix to action, and a bool to indicate if
-- wrapping should occur, and returns a function from XConfig to XConfig.
-- Example:
--
-- > additionalNav2DKeys (xK_w, xK_a, xK_s, xK_d) [(mod4Mask, windowGo), (mod4Mask .|. shiftMask, windowSwap)] False myConfig
additionalNav2DKeys :: (KeySym, KeySym, KeySym, KeySym) -> [(ButtonMask, Direction2D -> Bool -> X ())] ->
Bool -> XConfig l -> XConfig l
additionalNav2DKeys (u, l, d, r) modifiers wrap =
flip additionalKeys [((modif, k), func dir wrap) | (modif, func) <- modifiers, (k, dir) <- dirKeys]
where dirKeys = [(u, U), (l, L), (d, D), (r, R)]
-- | Convenience function for adding keybindings, using the syntax defined in
-- 'XMonad.Util.EZConfig.mkKeymap'. Takes an (up, left, down, right) tuple, a
-- mapping from key prefix to action, and a bool to indicate if wrapping should
-- occur, and returns a function from XConfig to XConfig. Example:
--
-- > additionalNav2DKeysP def ("w", "a", "s", "d") [("M-", windowGo), ("M-S-", windowSwap)] False myConfig
additionalNav2DKeysP :: (String, String, String, String) -> [(String, Direction2D -> Bool -> X ())] ->
Bool -> XConfig l -> XConfig l
additionalNav2DKeysP (u, l, d, r) modifiers wrap =
flip additionalKeysP [(modif ++ k, func dir wrap) | (modif, func) <- modifiers, (k, dir) <- dirKeys]
where dirKeys = [(u, U), (l, L), (d, D), (r, R)]
-- So we can store the configuration in extensible state
instance ExtensionClass Navigation2DConfig where
initialValue = def
-- | Modifies the xmonad configuration to store the Navigation2D configuration
withNavigation2DConfig :: Navigation2DConfig -> XConfig a -> XConfig a
withNavigation2DConfig conf2d xconf = xconf { startupHook = startupHook xconf
>> XS.put conf2d
}
{-# DEPRECATED defaultNavigation2DConfig "Use def (from Data.Default, and re-exported from XMonad.Actions.Navigation2D) instead." #-}
defaultNavigation2DConfig :: Navigation2DConfig
defaultNavigation2DConfig = def
instance Default Navigation2DConfig where
def = Navigation2DConfig { defaultTiledNavigation = lineNavigation
, floatNavigation = centerNavigation
, screenNavigation = lineNavigation
, layoutNavigation = []
, unmappedWindowRect = []
}
-- | Switches focus to the closest window in the other layer (floating if the
-- current window is tiled, tiled if the current window is floating). Closest
-- means that the L1-distance between the centers of the windows is minimized.
switchLayer :: X ()
switchLayer = actOnLayer otherLayer
( \ _ cur wins -> windows
$ doFocusClosestWindow cur wins
)
( \ _ cur wins -> windows
$ doFocusClosestWindow cur wins
)
( \ _ _ _ -> return () )
False
-- | Moves the focus to the next window in the given direction and in the same
-- layer as the current window. The second argument indicates whether
-- navigation should wrap around (e.g., from the left edge of the leftmost
-- screen to the right edge of the rightmost screen).
windowGo :: Direction2D -> Bool -> X ()
windowGo dir wrap = actOnLayer thisLayer
( \ conf cur wins -> windows
$ doTiledNavigation conf dir W.focusWindow cur wins
)
( \ conf cur wins -> windows
$ doFloatNavigation conf dir W.focusWindow cur wins
)
( \ conf cur wspcs -> windows
$ doScreenNavigation conf dir W.view cur wspcs
)
wrap
-- | Swaps the current window with the next window in the given direction and in
-- the same layer as the current window. (In the floating layer, all that
-- changes for the two windows is their stacking order if they're on the same
-- screen. If they're on different screens, each window is moved to the other
-- window's screen but retains its position and size relative to the screen.)
-- The second argument indicates wrapping (see 'windowGo').
windowSwap :: Direction2D -> Bool -> X ()
windowSwap dir wrap = actOnLayer thisLayer
( \ conf cur wins -> windows
$ doTiledNavigation conf dir swap cur wins
)
( \ conf cur wins -> windows
$ doFloatNavigation conf dir swap cur wins
)
( \ _ _ _ -> return () )
wrap
-- | Moves the current window to the next screen in the given direction. The
-- second argument indicates wrapping (see 'windowGo').
windowToScreen :: Direction2D -> Bool -> X ()
windowToScreen dir wrap = actOnScreens ( \ conf cur wspcs -> windows
$ doScreenNavigation conf dir W.shift cur wspcs
)
wrap
-- | Moves the focus to the next screen in the given direction. The second
-- argument indicates wrapping (see 'windowGo').
screenGo :: Direction2D -> Bool -> X ()
screenGo dir wrap = actOnScreens ( \ conf cur wspcs -> windows
$ doScreenNavigation conf dir W.view cur wspcs
)
wrap
-- | Swaps the workspace on the current screen with the workspace on the screen
-- in the given direction. The second argument indicates wrapping (see
-- 'windowGo').
screenSwap :: Direction2D -> Bool -> X ()
screenSwap dir wrap = actOnScreens ( \ conf cur wspcs -> windows
$ doScreenNavigation conf dir W.greedyView cur wspcs
)
wrap
-- | Maps each window to a fullscreen rect. This may not be the same rectangle the
-- window maps to under the Full layout or a similar layout if the layout
-- respects statusbar struts. In such cases, it may be better to use
-- 'singleWindowRect'.
fullScreenRect :: Screen -> Window -> X (Maybe Rectangle)
fullScreenRect scr _ = return (Just . screenRect . W.screenDetail $ scr)
-- | Maps each window to the rectangle it would receive if it was the only
-- window in the layout. Useful, for example, for determining the default
-- rectangle for unmapped windows in a Full layout that respects statusbar
-- struts.
singleWindowRect :: Screen -> Window -> X (Maybe Rectangle)
singleWindowRect scr win = listToMaybe
. map snd
. fst
<$> runLayout ((W.workspace scr) { W.stack = W.differentiate [win] })
(screenRect . W.screenDetail $ scr)
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- --
-- PRIVATE X ACTIONS --
-- --
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- | Acts on the appropriate layer using the given action functions
actOnLayer :: ([WinRect] -> [WinRect] -> [WinRect]) -- ^ Chooses which layer to operate on, relative
-- to the current window (same or other layer)
-> (Navigation2DConfig -> WinRect -> [WinRect] -> X ()) -- ^ The action for the tiled layer
-> (Navigation2DConfig -> WinRect -> [WinRect] -> X ()) -- ^ The action for the float layer
-> (Navigation2DConfig -> WSRect -> [WSRect] -> X ()) -- ^ The action if the current workspace is empty
-> Bool -- ^ Should navigation wrap around screen edges?
-> X ()
actOnLayer choice tiledact floatact wsact wrap = withWindowSet $ \winset -> do
conf <- XS.get
(floating, tiled) <- navigableWindows conf wrap winset
let cur = W.peek winset
case cur of
Nothing -> actOnScreens wsact wrap
Just w | Just rect <- L.lookup w tiled -> tiledact conf (w, rect) (choice tiled floating)
| Just rect <- L.lookup w floating -> floatact conf (w, rect) (choice floating tiled)
| otherwise -> return ()
-- | Returns the list of windows on the currently visible workspaces
navigableWindows :: Navigation2DConfig -> Bool -> WindowSet -> X ([WinRect], [WinRect])
navigableWindows conf wrap winset = L.partition (\(win, _) -> M.member win (W.floating winset))
. addWrapping winset wrap
. catMaybes
. concat
<$>
( mapM ( \scr -> mapM (maybeWinRect scr)
$ W.integrate'
$ W.stack
$ W.workspace scr
)
. sortedScreens
) winset
where
maybeWinRect scr win = do
winrect <- windowRect win
rect <- case winrect of
Just _ -> return winrect
Nothing -> maybe (return Nothing)
(\f -> f scr win)
(L.lookup (description . W.layout . W.workspace $ scr) (unmappedWindowRect conf))
return ((,) win <$> rect)
-- | Returns the current rectangle of the given window, Nothing if the window isn't mapped
windowRect :: Window -> X (Maybe Rectangle)
windowRect win = withDisplay $ \dpy -> do
mp <- isMapped win
if mp then do (_, x, y, w, h, bw, _) <- io $ getGeometry dpy win
return $ Just $ Rectangle x y (w + 2 * bw) (h + 2 * bw)
`catchX` return Nothing
else return Nothing
-- | Acts on the screens using the given action function
actOnScreens :: (Navigation2DConfig -> WSRect -> [WSRect] -> X ())
-> Bool -- ^ Should wrapping be used?
-> X ()
actOnScreens act wrap = withWindowSet $ \winset -> do
conf <- XS.get
let wsrects = visibleWorkspaces winset wrap
cur = W.tag . W.workspace . W.current $ winset
rect = fromJust $ L.lookup cur wsrects
act conf (cur, rect) wsrects
-- | Determines whether a given window is mapped
isMapped :: Window -> X Bool
isMapped win = withDisplay
$ \dpy -> io
$ (waIsUnmapped /=)
. wa_map_state
<$> getWindowAttributes dpy win
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- --
-- PRIVATE PURE FUNCTIONS --
-- --
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- | Finds the window closest to the given window and focuses it. Ties are
-- broken by choosing the first window in the window stack among the tied
-- windows. (The stack order is the one produced by integrate'ing each visible
-- workspace's window stack and concatenating these lists for all visible
-- workspaces.)
doFocusClosestWindow :: WinRect
-> [WinRect]
-> (WindowSet -> WindowSet)
doFocusClosestWindow (cur, rect) winrects
| null winctrs = id
| otherwise = W.focusWindow . fst $ L.foldl1' closer winctrs
where
ctr = centerOf rect
winctrs = filter ((cur /=) . fst)
$ map (\(w, r) -> (w, centerOf r)) winrects
closer wc1@(_, c1) wc2@(_, c2) | lDist ctr c1 > lDist ctr c2 = wc2
| otherwise = wc1
-- | Implements navigation for the tiled layer
doTiledNavigation :: Navigation2DConfig
-> Direction2D
-> (Window -> WindowSet -> WindowSet)
-> WinRect
-> [WinRect]
-> (WindowSet -> WindowSet)
doTiledNavigation conf dir act cur winrects winset
| Just win <- runNav nav dir cur winrects = act win winset
| otherwise = winset
where
layouts = map (description . W.layout . W.workspace)
$ W.screens winset
nav = maximum
$ map ( fromMaybe (defaultTiledNavigation conf)
. flip L.lookup (layoutNavigation conf)
)
$ layouts
-- | Implements navigation for the float layer
doFloatNavigation :: Navigation2DConfig
-> Direction2D
-> (Window -> WindowSet -> WindowSet)
-> WinRect
-> [WinRect]
-> (WindowSet -> WindowSet)
doFloatNavigation conf dir act cur winrects
| Just win <- runNav nav dir cur winrects = act win
| otherwise = id
where
nav = floatNavigation conf
-- | Implements navigation between screens
doScreenNavigation :: Navigation2DConfig
-> Direction2D
-> (WorkspaceId -> WindowSet -> WindowSet)
-> WSRect
-> [WSRect]
-> (WindowSet -> WindowSet)
doScreenNavigation conf dir act cur wsrects
| Just ws <- runNav nav dir cur wsrects = act ws
| otherwise = id
where
nav = screenNavigation conf
-- | Implements line navigation. For layouts without overlapping windows, there
-- is no need to break ties between equidistant windows. When windows do
-- overlap, even the best tie breaking rule cannot make line navigation feel
-- natural. Thus, we fairly arbtitrarily break ties by preferring the window
-- that comes first in the window stack. (The stack order is the one produced
-- by integrate'ing each visible workspace's window stack and concatenating
-- these lists for all visible workspaces.)
doLineNavigation :: Eq a => Direction2D -> Rect a -> [Rect a] -> Maybe a
doLineNavigation dir (cur, rect) winrects
| null winrects' = Nothing
| otherwise = Just . fst $ L.foldl1' closer winrects'
where
-- The current window's center
ctr@(xc, yc) = centerOf rect
-- The list of windows that are candidates to receive focus.
winrects' = filter dirFilter
$ filter ((cur /=) . fst)
$ winrects
-- Decides whether a given window matches the criteria to be a candidate to
-- receive the focus.
dirFilter (_, r) = (dir == L && leftOf r rect && intersectsY yc r)
|| (dir == R && leftOf rect r && intersectsY yc r)
|| (dir == U && above r rect && intersectsX xc r)
|| (dir == D && above rect r && intersectsX xc r)
-- Decide whether r1 is left of/above r2.
leftOf r1 r2 = rect_x r1 + fi (rect_width r1) <= rect_x r2
above r1 r2 = rect_y r1 + fi (rect_height r1) <= rect_y r2
-- Check whether r's x-/y-range contains the given x-/y-coordinate.
intersectsX x r = rect_x r <= x && rect_x r + fi (rect_width r) >= x
intersectsY y r = rect_y r <= y && rect_y r + fi (rect_height r) >= y
-- Decides whether r1 is closer to the current window's center than r2
closer wr1@(_, r1) wr2@(_, r2) | dist ctr r1 > dist ctr r2 = wr2
| otherwise = wr1
-- Returns the distance of r from the point (x, y)
dist (x, y) r | dir == L = x - rect_x r - fi (rect_width r)
| dir == R = rect_x r - x
| dir == U = y - rect_y r - fi (rect_height r)
| otherwise = rect_y r - y
-- | Implements center navigation
doCenterNavigation :: Eq a => Direction2D -> Rect a -> [Rect a] -> Maybe a
doCenterNavigation dir (cur, rect) winrects
| ((w, _):_) <- onCtr' = Just w
| otherwise = closestOffCtr
where
-- The center of the current window
(xc, yc) = centerOf rect
-- All the windows with their center points relative to the current
-- center rotated so the right cone becomes the relevant cone.
-- The windows are ordered in the order they should be preferred
-- when they are otherwise tied.
winctrs = map (\(w, r) -> (w, dirTransform . centerOf $ r))
$ stackTransform
$ winrects
-- Give preference to windows later in the stack for going left or up and to
-- windows earlier in the stack for going right or down. (The stack order
-- is the one produced by integrate'ing each visible workspace's window
-- stack and concatenating these lists for all visible workspaces.)
stackTransform | dir == L || dir == U = reverse
| otherwise = id
-- Transform a point into a difference to the current window center and
-- rotate it so that the relevant cone becomes the right cone.
dirTransform (x, y) | dir == R = ( x - xc , y - yc )
| dir == L = (-(x - xc), -(y - yc))
| dir == D = ( y - yc , x - xc )
| otherwise = (-(y - yc), -(x - xc))
-- Partition the points into points that coincide with the center
-- and points that do not.
(onCtr, offCtr) = L.partition (\(_, (x, y)) -> x == 0 && y == 0) winctrs
-- All the points that coincide with the current center and succeed it
-- in the (appropriately ordered) window stack.
onCtr' = L.tail $ L.dropWhile ((cur /=) . fst) onCtr
-- tail should be safe here because cur should be in onCtr
-- All the points that do not coincide with the current center and which
-- lie in the (rotated) right cone.
offCtr' = L.filter (\(_, (x, y)) -> x > 0 && y < x && y >= -x) offCtr
-- The off-center point closest to the center and
-- closest to the bottom ray of the cone. Nothing if no off-center
-- point is in the cone
closestOffCtr = if null offCtr' then Nothing
else Just $ fst $ L.foldl1' closest offCtr'
closest wp@(_, p@(_, yp)) wq@(_, q@(_, yq))
| lDist (0, 0) q < lDist (0, 0) p = wq -- q is closer than p
| lDist (0, 0) p < lDist (0, 0) q = wp -- q is farther away than p
| yq < yp = wq -- q is closer to the bottom ray than p
| otherwise = wp -- q is farther away from the bottom ray than p
-- or it has the same distance but comes later
-- in the window stack
-- x -y w h format is a pain. Let's use side coordinates. We assume x1 <= x2 and
-- y1 <= y2, and make the assumption valid by initialising SideRects with the
-- property and carefully preserving it over any individual transformation.
data SideRect = SideRect { x1 :: Int, x2 :: Int, y1 :: Int, y2 :: Int }
deriving Show
-- Conversion from Rectangle format to SideRect.
toSR :: Rectangle -> SideRect
toSR (Rectangle x y w h) = SideRect (fi x) (fi x + fi w) (-fi y - fi h) (-fi y)
-- Implements side navigation with bias.
doSideNavigationWithBias ::
Eq a => Int -> Direction2D -> Rect a -> [Rect a] -> Maybe a
doSideNavigationWithBias bias dir (cur, rect)
= fmap fst . listToMaybe
. L.sortBy (comparing dist) . foldr acClosest []
. filter (`toRightOf` (cur, transform rect))
. map (fmap transform)
where
-- Getting the center of the current window so we can make it the new origin.
cOf r = ((x1 r + x2 r) `div` 2, (y1 r + y2 r) `div` 2)
(x0, y0) = cOf . toSR $ rect
-- Translate the given SideRect by (-x0, -y0).
translate r = SideRect (x1 r - x0) (x2 r - x0) (y1 r - y0) (y2 r - y0)
-- Rotate the given SideRect 90 degrees counter-clockwise about the origin.
rHalfPiCC r = SideRect (-y2 r) (-y1 r) (x1 r) (x2 r)
-- Apply the above function until d becomes synonymous with R (wolog).
rotateToR d = let (_, _:l) = break (d ==) [U, L, D, R]
in foldr (const $ (.) rHalfPiCC) id l
transform = rotateToR dir . translate . toSR
-- (_, r) `toRightOf` (_, c) iff r has points to the right of c that aren't
-- below or above c, i.e. iff:
-- [x1 r, x2 r] x [y1 r, y2 r] intersects (x2 c, infinity) x (y1 c, y2 c)
toRightOf (_, r) (_, c) = (x2 r > x2 c) && (y2 r > y1 c) && (y1 r < y2 c)
-- Greedily accumulate the windows tied for the leftmost left side.
acClosest (w, r) l@((_, r'):_) | x1 r == x1 r' = (w, r) : l
| x1 r > x1 r' = l
acClosest (w, r) _ = (w, r) : []
-- Given a (_, SideRect), calculate how far it is from the y=bias line.
dist (_, r) | (y1 r <= bias) && (bias <= y2 r) = 0
| otherwise = min (abs $ y1 r - bias) (abs $ y2 r - bias)
-- | Swaps the current window with the window given as argument
swap :: Window -> WindowSet -> WindowSet
swap win winset = W.focusWindow cur
$ L.foldl' (flip W.focusWindow) newwinset newfocused
where
-- The current window
cur = fromJust $ W.peek winset
-- All screens
scrs = W.screens winset
-- All visible workspaces
visws = map W.workspace scrs
-- The focused windows of the visible workspaces
focused = mapMaybe (\ws -> W.focus <$> W.stack ws) visws
-- The window lists of the visible workspaces
wins = map (W.integrate' . W.stack) visws
-- Update focused windows and window lists to reflect swap of windows.
newfocused = map swapWins focused
newwins = map (map swapWins) wins
-- Replaces the current window with the argument window and vice versa.
swapWins x | x == cur = win
| x == win = cur
| otherwise = x
-- Reconstruct the workspaces' window stacks to reflect the swap.
newvisws = zipWith (\ws wns -> ws { W.stack = W.differentiate wns }) visws newwins
newscrs = zipWith (\scr ws -> scr { W.workspace = ws }) scrs newvisws
newwinset = winset { W.current = head newscrs
, W.visible = tail newscrs
}
-- | Calculates the center of a rectangle
centerOf :: Rectangle -> (Position, Position)
centerOf r = (rect_x r + fi (rect_width r) `div` 2, rect_y r + fi (rect_height r) `div` 2)
-- | Shorthand for integer conversions
fi :: (Integral a, Num b) => a -> b
fi = fromIntegral
-- | Functions to choose the subset of windows to operate on
thisLayer, otherLayer :: a -> a -> a
thisLayer = curry fst
otherLayer = curry snd
-- | Returns the list of visible workspaces and their screen rects
visibleWorkspaces :: WindowSet -> Bool -> [WSRect]
visibleWorkspaces winset wrap = addWrapping winset wrap
$ map ( \scr -> ( W.tag . W.workspace $ scr
, screenRect . W.screenDetail $ scr
)
)
$ sortedScreens winset
-- | Creates five copies of each (window/workspace, rect) pair in the input: the
-- original and four offset one desktop size (desktop = collection of all
-- screens) to the left, to the right, up, and down. Wrap-around at desktop
-- edges is implemented by navigating into these displaced copies.
addWrapping :: WindowSet -- ^ The window set, used to get the desktop size
-> Bool -- ^ Should wrapping be used? Do nothing if not.
-> [Rect a] -- ^ Input set of (window/workspace, rect) pairs
-> [Rect a]
addWrapping _ False wrects = wrects
addWrapping winset True wrects = [ (w, r { rect_x = rect_x r + fi x
, rect_y = rect_y r + fi y
}
)
| (w, r) <- wrects
, (x, y) <- [(0, 0), (-xoff, 0), (xoff, 0), (0, -yoff), (0, yoff)]
]
where
(xoff, yoff) = wrapOffsets winset
-- | Calculates the offsets for window/screen coordinates for the duplication
-- of windows/workspaces that implements wrap-around.
wrapOffsets :: WindowSet -> (Integer, Integer)
wrapOffsets winset = (max_x - min_x, max_y - min_y)
where
min_x = fi $ minimum $ map rect_x rects
min_y = fi $ minimum $ map rect_y rects
max_x = fi $ maximum $ map (\r -> rect_x r + (fi $ rect_width r)) rects
max_y = fi $ maximum $ map (\r -> rect_y r + (fi $ rect_height r)) rects
rects = map snd $ visibleWorkspaces winset False
-- | Returns the list of screens sorted primarily by their centers'
-- x-coordinates and secondarily by their y-coordinates.
sortedScreens :: WindowSet -> [Screen]
sortedScreens winset = L.sortBy cmp
$ W.screens winset
where
cmp s1 s2 | x1 < x2 = LT
| x1 > x2 = GT
| y1 < x2 = LT
| y1 > y2 = GT
| otherwise = EQ
where
(x1, y1) = centerOf (screenRect . W.screenDetail $ s1)
(x2, y2) = centerOf (screenRect . W.screenDetail $ s2)
-- | Calculates the L1-distance between two points.
lDist :: (Position, Position) -> (Position, Position) -> Int
lDist (x1, y1) (x2, y2) = abs (fi $ x1 - x2) + abs (fi $ y1 - y2)

View File

@@ -0,0 +1,33 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.NoBorders
-- Copyright : (c) Lukas Mai
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Lukas Mai <l.mai@web.de>
-- Stability : stable
-- Portability : unportable
--
-- This module provides helper functions for dealing with window borders.
--
-----------------------------------------------------------------------------
module XMonad.Actions.NoBorders (
toggleBorder
) where
import XMonad
-- | Toggle the border of the currently focused window. To use it, add a
-- keybinding like so:
--
-- > , ((modm, xK_g ), withFocused toggleBorder)
--
toggleBorder :: Window -> X ()
toggleBorder w = do
bw <- asks (borderWidth . config)
withDisplay $ \d -> io $ do
cw <- wa_border_width `fmap` getWindowAttributes d w
if cw == 0
then setWindowBorderWidth d w bw
else setWindowBorderWidth d w 0

188
XMonad/Actions/OnScreen.hs Normal file
View File

@@ -0,0 +1,188 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.OnScreen
-- Copyright : (c) 2009 Nils Schweinsberg
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Nils Schweinsberg <mail@n-sch.de>
-- Stability : unstable
-- Portability : unportable
--
-- Control workspaces on different screens (in xinerama mode).
--
-----------------------------------------------------------------------------
module XMonad.Actions.OnScreen (
-- * Usage
-- $usage
onScreen
, onScreen'
, Focus(..)
, viewOnScreen
, greedyViewOnScreen
, onlyOnScreen
, toggleOnScreen
, toggleGreedyOnScreen
) where
import XMonad
import XMonad.StackSet hiding (new)
import Control.Monad (guard)
-- import Control.Monad.State.Class (gets)
import Data.Maybe (fromMaybe)
-- | Focus data definitions
data Focus = FocusNew -- ^ always focus the new screen
| FocusCurrent -- ^ always keep the focus on the current screen
| FocusTag WorkspaceId -- ^ always focus tag i on the new stack
| FocusTagVisible WorkspaceId -- ^ focus tag i only if workspace with tag i is visible on the old stack
-- | Run any function that modifies the stack on a given screen. This function
-- will also need to know which Screen to focus after the function has been
-- run.
onScreen :: (WindowSet -> WindowSet) -- ^ function to run
-> Focus -- ^ what to do with the focus
-> ScreenId -- ^ screen id
-> WindowSet -- ^ current stack
-> WindowSet
onScreen f foc sc st = fromMaybe st $ do
ws <- lookupWorkspace sc st
let fStack = f $ view ws st
return $ setFocus foc st fStack
-- set focus for new stack
setFocus :: Focus
-> WindowSet -- ^ old stack
-> WindowSet -- ^ new stack
-> WindowSet
setFocus FocusNew _ new = new
setFocus FocusCurrent old new =
case lookupWorkspace (screen $ current old) new of
Nothing -> new
Just i -> view i new
setFocus (FocusTag i) _ new = view i new
setFocus (FocusTagVisible i) old new =
if i `elem` map (tag . workspace) (visible old)
then setFocus (FocusTag i) old new
else setFocus FocusCurrent old new
-- | A variation of @onScreen@ which will take any @X ()@ function and run it
-- on the given screen.
-- Warning: This function will change focus even if the function it's supposed
-- to run doesn't succeed.
onScreen' :: X () -- ^ X function to run
-> Focus -- ^ focus
-> ScreenId -- ^ screen id
-> X ()
onScreen' x foc sc = do
st <- gets windowset
case lookupWorkspace sc st of
Nothing -> return ()
Just ws -> do
windows $ view ws
x
windows $ setFocus foc st
-- | Switch to workspace @i@ on screen @sc@. If @i@ is visible use @view@ to
-- switch focus to the workspace @i@.
viewOnScreen :: ScreenId -- ^ screen id
-> WorkspaceId -- ^ index of the workspace
-> WindowSet -- ^ current stack
-> WindowSet
viewOnScreen sid i =
onScreen (view i) (FocusTag i) sid
-- | Switch to workspace @i@ on screen @sc@. If @i@ is visible use @greedyView@
-- to switch the current workspace with workspace @i@.
greedyViewOnScreen :: ScreenId -- ^ screen id
-> WorkspaceId -- ^ index of the workspace
-> WindowSet -- ^ current stack
-> WindowSet
greedyViewOnScreen sid i =
onScreen (greedyView i) (FocusTagVisible i) sid
-- | Switch to workspace @i@ on screen @sc@. If @i@ is visible do nothing.
onlyOnScreen :: ScreenId -- ^ screen id
-> WorkspaceId -- ^ index of the workspace
-> WindowSet -- ^ current stack
-> WindowSet
onlyOnScreen sid i =
onScreen (view i) FocusCurrent sid
-- | @toggleOrView@ as in "XMonad.Actions.CycleWS" for @onScreen@ with view
toggleOnScreen :: ScreenId -- ^ screen id
-> WorkspaceId -- ^ index of the workspace
-> WindowSet -- ^ current stack
-> WindowSet
toggleOnScreen sid i =
onScreen (toggleOrView' view i) FocusCurrent sid
-- | @toggleOrView@ from "XMonad.Actions.CycleWS" for @onScreen@ with greedyView
toggleGreedyOnScreen :: ScreenId -- ^ screen id
-> WorkspaceId -- ^ index of the workspace
-> WindowSet -- ^ current stack
-> WindowSet
toggleGreedyOnScreen sid i =
onScreen (toggleOrView' greedyView i) FocusCurrent sid
-- a \"pure\" version of X.A.CycleWS.toggleOrDoSkip
toggleOrView' :: (WorkspaceId -> WindowSet -> WindowSet) -- ^ function to run
-> WorkspaceId -- ^ tag to look for
-> WindowSet -- ^ current stackset
-> WindowSet
toggleOrView' f i st = fromMaybe (f i st) $ do
let st' = hidden st
-- make sure we actually have to do something
guard $ i == (tag . workspace $ current st)
guard $ not (null st')
-- finally, toggle!
return $ f (tag . head $ st') st
-- $usage
--
-- This module provides an easy way to control, what you see on other screens in
-- xinerama mode without having to focus them. Put this into your
-- @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.OnScreen
--
-- Then add the appropriate keybindings, for example replace your current keys
-- to switch the workspaces with this at the bottom of your keybindings:
--
-- > ++
-- > [ ((m .|. modm, k), windows (f i))
-- > | (i, k) <- zip (workspaces conf) ([xK_1 .. xK_9] ++ [xK_0])
-- > , (f, m) <- [ (viewOnScreen 0, 0)
-- > , (viewOnScreen 1, controlMask)
-- > , (greedyView, controlMask .|. shiftMask) ]
-- > ]
--
-- This will provide you with the following keybindings:
--
-- * modkey + 1-0:
-- Switch to workspace 1-0 on screen 0
--
-- * modkey + control + 1-0:
-- Switch to workspace 1-0 on screen 1
--
-- * modkey + control + shift + 1-0:
-- Default greedyView behaviour
--
--
-- A more basic version inside the default keybindings would be:
--
-- > , ((modm .|. controlMask, xK_1), windows (viewOnScreen 0 "1"))
--
-- where 0 is the first screen and \"1\" the workspace with the tag \"1\".
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".

View File

@@ -0,0 +1,49 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.PerWorkspaceKeys
-- Copyright : (c) Roman Cheplyaka, 2008
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Roman Cheplyaka <roma@ro-che.info>
-- Stability : unstable
-- Portability : unportable
--
-- Define key-bindings on per-workspace basis.
--
-----------------------------------------------------------------------------
module XMonad.Actions.PerWorkspaceKeys (
-- * Usage
-- $usage
chooseAction,
bindOn
) where
import XMonad
import XMonad.StackSet as S
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.PerWorkspaceKeys
--
-- > ,((0, xK_F2), bindOn [("1", spawn "rxvt"), ("2", spawn "xeyes"), ("", spawn "xmessage hello")])
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Uses supplied function to decide which action to run depending on current workspace name.
chooseAction :: (String->X()) -> X()
chooseAction f = withWindowSet (f . S.currentTag)
-- | If current workspace is listed, run appropriate action (only the first match counts!)
-- If it isn't listed, then run default action (marked with empty string, \"\"), or do nothing if default isn't supplied.
bindOn :: [(String, X())] -> X()
bindOn bindings = chooseAction chooser where
chooser ws = case lookup ws bindings of
Just action -> action
Nothing -> case lookup "" bindings of
Just action -> action
Nothing -> return ()

View File

@@ -0,0 +1,149 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.PhysicalScreens
-- Copyright : (c) Nelson Elhage <nelhage@mit.edu>
-- License : BSD
--
-- Maintainer : Nelson Elhage <nelhage@mit.edu>
-- Stability : unstable
-- Portability : unportable
--
-- Manipulate screens ordered by physical location instead of ID
-----------------------------------------------------------------------------
module XMonad.Actions.PhysicalScreens (
-- * Usage
-- $usage
PhysicalScreen(..)
, getScreen
, viewScreen
, sendToScreen
, onNextNeighbour
, onPrevNeighbour
, horizontalScreenOrderer
, verticalScreenOrderer
, ScreenComparator(ScreenComparator)
, getScreenIdAndRectangle
, screenComparatorById
, screenComparatorByRectangle
) where
import XMonad
import qualified XMonad.StackSet as W
import Data.List (sortBy,findIndex)
import Data.Function (on)
{- $usage
This module allows you name Xinerama screens from XMonad using their
physical location relative to each other (as reported by Xinerama),
rather than their @ScreenID@ s, which are arbitrarily determined by
your X server and graphics hardware.
You can specify how to order the screen by giving a ScreenComparator.
To create a screen comparator you can use screenComparatorByRectangle or screenComparatorByScreenId.
The default ScreenComparator orders screens by the upper-left-most corner, from top-to-bottom
and then left-to-right.
Example usage in your @~\/.xmonad\/xmonad.hs@ file:
> import XMonad.Actions.PhysicalScreens
> import Data.Default
> , ((modMask, xK_a), onPrevNeighbour def W.view)
> , ((modMask, xK_o), onNextNeighbour def W.view)
> , ((modMask .|. shiftMask, xK_a), onPrevNeighbour def W.shift)
> , ((modMask .|. shiftMask, xK_o), onNextNeighbour def W.shift)
> --
> -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
> -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
> --
> [((modm .|. mask, key), f sc)
> | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
> , (f, mask) <- [(viewScreen, 0), (sendToScreen def, shiftMask)]]
For detailed instructions on editing your key bindings, see
"XMonad.Doc.Extending#Editing_key_bindings".
-}
-- | The type of the index of a screen by location
newtype PhysicalScreen = P Int deriving (Eq,Ord,Show,Read,Enum,Num,Integral,Real)
getScreenIdAndRectangle :: (W.Screen i l a ScreenId ScreenDetail) -> (ScreenId, Rectangle)
getScreenIdAndRectangle screen = (W.screen screen, rect) where
rect = screenRect $ W.screenDetail screen
-- | Translate a physical screen index to a "ScreenId"
getScreen:: ScreenComparator -> PhysicalScreen -> X (Maybe ScreenId)
getScreen (ScreenComparator cmpScreen) (P i) = do w <- gets windowset
let screens = W.current w : W.visible w
if i<0 || i >= length screens
then return Nothing
else let ss = sortBy (cmpScreen `on` getScreenIdAndRectangle) screens
in return $ Just $ W.screen $ ss !! i
-- | Switch to a given physical screen
viewScreen :: ScreenComparator -> PhysicalScreen -> X ()
viewScreen sc p = do i <- getScreen sc p
whenJust i $ \s -> do
w <- screenWorkspace s
whenJust w $ windows . W.view
-- | Send the active window to a given physical screen
sendToScreen :: ScreenComparator -> PhysicalScreen -> X ()
sendToScreen sc p = do i <- getScreen sc p
whenJust i $ \s -> do
w <- screenWorkspace s
whenJust w $ windows . W.shift
-- | A ScreenComparator allow to compare two screen based on their coordonate and Xinerama Id
newtype ScreenComparator = ScreenComparator ((ScreenId, Rectangle) -> (ScreenId, Rectangle) -> Ordering)
-- | The default ScreenComparator orders screens by the upper-left-most corner, from top-to-bottom
instance Default ScreenComparator where
def= verticalScreenOrderer
-- | Compare screen only by their coordonate
screenComparatorByRectangle :: (Rectangle -> Rectangle -> Ordering) -> ScreenComparator
screenComparatorByRectangle rectComparator = ScreenComparator comparator where
comparator (_, rec1) (_, rec2) = rectComparator rec1 rec2
-- | Compare screen only by their Xinerama id
screenComparatorById :: (ScreenId -> ScreenId -> Ordering) -> ScreenComparator
screenComparatorById idComparator = ScreenComparator comparator where
comparator (id1, _) (id2, _) = idComparator id1 id2
-- | orders screens by the upper-left-most corner, from top-to-bottom
verticalScreenOrderer :: ScreenComparator
verticalScreenOrderer = screenComparatorByRectangle comparator where
comparator (Rectangle x1 y1 _ _) (Rectangle x2 y2 _ _) = compare (y1, x1) (y2, x2)
-- | orders screens by the upper-left-most corner, from left-to-right
horizontalScreenOrderer :: ScreenComparator
horizontalScreenOrderer = screenComparatorByRectangle comparator where
comparator (Rectangle x1 y1 _ _) (Rectangle x2 y2 _ _) = compare (x1, y1) (x2, y2)
-- | Get ScreenId for neighbours of the current screen based on position offset.
getNeighbour :: ScreenComparator -> Int -> X ScreenId
getNeighbour (ScreenComparator cmpScreen) d =
do w <- gets windowset
let ss = map W.screen $ sortBy (cmpScreen `on` getScreenIdAndRectangle) $ W.current w : W.visible w
curPos = maybe 0 id $ findIndex (== W.screen (W.current w)) ss
pos = (curPos + d) `mod` length ss
return $ ss !! pos
neighbourWindows :: ScreenComparator -> Int -> (WorkspaceId -> WindowSet -> WindowSet) -> X ()
neighbourWindows sc d f = do s <- getNeighbour sc d
w <- screenWorkspace s
whenJust w $ windows . f
-- | Apply operation on a WindowSet with the WorkspaceId of the next screen in the physical order as parameter.
onNextNeighbour :: ScreenComparator -> (WorkspaceId -> WindowSet -> WindowSet) -> X ()
onNextNeighbour sc = neighbourWindows sc 1
-- | Apply operation on a WindowSet with the WorkspaceId of the previous screen in the physical order as parameter.
onPrevNeighbour :: ScreenComparator -> (WorkspaceId -> WindowSet -> WindowSet) -> X ()
onPrevNeighbour sc = neighbourWindows sc (-1)

230
XMonad/Actions/Plane.hs Normal file
View File

@@ -0,0 +1,230 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.Plane
-- Copyright : (c) Marco Túlio Gontijo e Silva <marcot@riseup.net>,
-- Leonardo Serra <leoserra@minaslivre.org>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Marco Túlio Gontijo e Silva <marcot@riseup.net>
-- Stability : unstable
-- Portability : unportable
--
-- This module has functions to navigate through workspaces in a bidimensional
-- manner. It allows the organization of workspaces in lines, and provides
-- functions to move and shift windows in all four directions (left, up, right
-- and down) possible in a surface.
--
-- This functionality was inspired by GNOME (finite) and KDE (infinite)
-- keybindings for workspace navigation, and by "XMonad.Actions.CycleWS" for
-- the idea of applying this approach to XMonad.
-----------------------------------------------------------------------------
module XMonad.Actions.Plane
(
-- * Usage
-- $usage
-- * Data types
Direction (..)
, Limits (..)
, Lines (..)
-- * Key bindings
, planeKeys
-- * Navigating through workspaces
, planeShift
, planeMove
)
where
import Control.Monad
import Data.List
import Data.Map hiding (split)
import Data.Maybe
import XMonad
import XMonad.StackSet hiding (workspaces)
import XMonad.Util.Run
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@ file:
--
-- > import XMonad.Actions.Plane
-- > import Data.Map (union)
-- >
-- > main = xmonad def {keys = myKeys}
-- >
-- > myKeys conf = union (keys def conf) $ myNewKeys conf
-- >
-- > myNewKeys (XConfig {modMask = modm}) = planeKeys modm (Lines 3) Finite
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Direction to go in the plane.
data Direction = ToLeft | ToUp | ToRight | ToDown deriving Enum
-- | Defines the behaviour when you're trying to move out of the limits.
data Limits
= Finite -- ^ Ignore the function call, and keep in the same workspace.
| Circular -- ^ Get on the other side, like in the Snake game.
| Linear -- ^ The plan comes as a row, so it goes to the next or prev if
-- the workspaces were numbered.
deriving Eq
-- | The number of lines in which the workspaces will be arranged. It's
-- possible to use a number of lines that is not a divisor of the number of
-- workspaces, but the results are better when using a divisor. If it's not a
-- divisor, the last line will have the remaining workspaces.
data Lines
= GConf -- ^ Use @gconftool-2@ to find out the number of lines.
| Lines Int -- ^ Specify the number of lines explicitly.
-- | This is the way most people would like to use this module. It attaches the
-- 'KeyMask' passed as a parameter with 'xK_Left', 'xK_Up', 'xK_Right' and
-- 'xK_Down', associating it with 'planeMove' to the corresponding 'Direction'.
-- It also associates these bindings with 'shiftMask' to 'planeShift'.
planeKeys :: KeyMask -> Lines -> Limits -> Map (KeyMask, KeySym) (X ())
planeKeys modm ln limits =
fromList $
[ ((keyMask, keySym), function ln limits direction)
| (keySym, direction) <- zip [xK_Left .. xK_Down] $ enumFrom ToLeft
, (keyMask, function) <- [(modm, planeMove), (shiftMask .|. modm, planeShift)]
]
-- | Shift a window to the next workspace in 'Direction'. Note that this will
-- also move to the next workspace. It's a good idea to use the same 'Lines'
-- and 'Limits' for all the bindings.
planeShift :: Lines -> Limits -> Direction -> X ()
planeShift = plane shift'
shift' ::
(Eq s, Eq i, Ord a) => i -> StackSet i l a s sd -> StackSet i l a s sd
shift' area = greedyView area . shift area
-- | Move to the next workspace in 'Direction'.
planeMove :: Lines -> Limits -> Direction -> X ()
planeMove = plane greedyView
plane ::
(WorkspaceId -> WindowSet -> WindowSet) -> Lines -> Limits -> Direction ->
X ()
plane function numberLines_ limits direction = do
st <- get
xconf <- ask
numberLines <-
liftIO $
case numberLines_ of
Lines numberLines__ ->
return numberLines__
GConf ->
do
numberLines__ <-
runProcessWithInput gconftool parameters ""
case reads numberLines__ of
[(numberRead, _)] -> return numberRead
_ ->
do
trace $
"XMonad.Actions.Plane: Could not parse the output of " ++ gconftool ++
unwords parameters ++ ": " ++ numberLines__ ++ "; assuming 1."
return 1
let
notBorder :: Bool
notBorder = (replicate 2 (circular_ < currentWS) ++ replicate 2 (circular_ > currentWS)) !! fromEnum direction
circular_ :: Int
circular_ = circular currentWS
circular :: Int -> Int
circular =
[ onLine pred
, onColumn pred
, onLine succ
, onColumn succ
]
!! fromEnum direction
linear :: Int -> Int
linear =
[ onLine pred . onColumn pred
, onColumn pred . onLine pred
, onLine succ . onColumn succ
, onColumn succ . onLine succ
]
!! fromEnum direction
onLine :: (Int -> Int) -> Int -> Int
onLine f currentWS_
| line < areasLine = mod_ columns
| otherwise = mod_ areasColumn
where
line, column :: Int
(line, column) = split currentWS_
mod_ :: Int -> Int
mod_ columns_ = compose line $ mod (f column) columns_
onColumn :: (Int -> Int) -> Int -> Int
onColumn f currentWS_
| column < areasColumn || areasColumn == 0 = mod_ numberLines
| otherwise = mod_ $ pred numberLines
where
line, column :: Int
(line, column) = split currentWS_
mod_ :: Int -> Int
mod_ lines_ = compose (mod (f line) lines_) column
compose :: Int -> Int -> Int
compose line column = line * columns + column
split :: Int -> (Int, Int)
split currentWS_ =
(operation div, operation mod)
where
operation :: (Int -> Int -> Int) -> Int
operation f = f currentWS_ columns
areasLine :: Int
areasLine = div areas columns
areasColumn :: Int
areasColumn = mod areas columns
columns :: Int
columns =
if mod areas numberLines == 0 then preColumns else preColumns + 1
currentWS :: Int
currentWS = fromJust mCurrentWS
preColumns :: Int
preColumns = div areas numberLines
mCurrentWS :: Maybe Int
mCurrentWS = elemIndex (currentTag $ windowset st) areaNames
areas :: Int
areas = length areaNames
run :: (Int -> Int) -> X ()
run f = windows $ function $ areaNames !! f currentWS
areaNames :: [String]
areaNames = workspaces $ config xconf
when (isJust mCurrentWS) $
case limits of
Finite -> when notBorder $ run circular
Circular -> run circular
Linear -> if notBorder then run circular else run linear
gconftool :: String
gconftool = "gconftool-2"
parameters :: [String]
parameters = ["--get", "/apps/panel/applets/workspace_switcher_screen0/prefs/num_rows"]

49
XMonad/Actions/Promote.hs Normal file
View File

@@ -0,0 +1,49 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.Promote
-- Copyright : (c) Miikka Koskinen 2007
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : xmonad@s001.ethrael.com
-- Stability : unstable
-- Portability : unportable
--
-- Alternate promote function for xmonad.
--
-- Moves the focused window to the master pane. All other windows
-- retain their order. If focus is in the master, swap it with the
-- next window in the stack. Focus stays in the master.
--
-----------------------------------------------------------------------------
module XMonad.Actions.Promote (
-- * Usage
-- $usage
promote
) where
import XMonad
import XMonad.StackSet
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.Promote
--
-- then add a keybinding or substitute 'promote' in place of swapMaster:
--
-- > , ((modm, xK_Return), promote)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Move the focused window to the master pane. All other windows
-- retain their order. If focus is in the master, swap it with the
-- next windo in the stack. Focus stays in the master.
promote :: X ()
promote = windows $ modify' $
\c -> case c of
Stack _ [] [] -> c
Stack t [] (x:rs) -> Stack x [] (t:rs)
Stack t ls rs -> Stack t [] (reverse ls ++ rs)

View File

@@ -0,0 +1,72 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.RandomBackground
-- Copyright : (c) 2009 Anze Slosar
-- translation to Haskell by Adam Vogt
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : <vogt.adam@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- An action to start terminals with a random background color
--
-----------------------------------------------------------------------------
module XMonad.Actions.RandomBackground (
-- * Usage
-- $usage
randomBg',
randomBg,
RandomColor(HSV,RGB)
) where
import XMonad(X, XConf(config), XConfig(terminal), io, spawn,
MonadIO, asks)
import System.Random
import Control.Monad(liftM)
import Numeric(showHex)
-- $usage
--
-- Add to your keybindings something like:
--
-- > ,((modm .|. shiftMask, xK_Return), randomBg $ HSV 0xff 0x20
-- | RandomColor fixes constraints when generating random colors. All
-- parameters should be in the range 0 -- 0xff
data RandomColor = RGB { _colorMin :: Int
, _colorMax :: Int
} -- ^ specify the minimum and maximum lowest values for each color channel.
| HSV { _colorSaturation :: Double
, _colorValue :: Double
} -- ^ specify the saturation and value, leaving the hue random.
toHex :: [Int] -> String
toHex = ("'#"++) . (++"'") . concatMap (ensure 2 . ($ "") . showHex)
where ensure x = reverse . take x . (++repeat '0') . reverse
randPermutation :: (RandomGen g) => [a] -> g -> [a]
randPermutation xs g = swap $ zip (randoms g) xs
where
swap ((True,x):(c,y):ys) = y:swap ((c,x):ys)
swap ((False,x):ys) = x:swap ys
swap x = map snd x
-- | @randomBg'@ produces a random hex number in the form @'#xxyyzz'@
randomBg' :: (MonadIO m) => RandomColor -> m String
randomBg' (RGB l h) = io $ liftM (toHex . take 3 . randomRs (l,h)) newStdGen
randomBg' (HSV s v) = io $ do
g <- newStdGen
let x = (^(2::Int)) $ fst $ randomR (0,sqrt $ pi / 3) g
return $ toHex $ map round $ randPermutation [v,(v-s)*x + s,s] g
-- | @randomBg@ starts a terminal with the background color taken from 'randomBg''
--
-- This depends on the your 'terminal' configuration field accepting an
-- argument like @-bg '#ff0023'@
randomBg :: RandomColor -> X ()
randomBg x = do
t <- asks (terminal . config)
c <- randomBg' x
spawn $ t ++ " -bg " ++ c

View File

@@ -0,0 +1,62 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.RotSlaves
-- Copyright : (c) Hans Philipp Annen <haphi@gmx.net>, Mischa Dieterle <der_m@freenet.de>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Hans Philipp Annen <haphi@gmx.net>
-- Stability : stable
-- Portability : unportable
--
-- Rotate all windows except the master window and keep the focus in
-- place.
-----------------------------------------------------------------------------
module XMonad.Actions.RotSlaves (
-- $usage
rotSlaves', rotSlavesUp, rotSlavesDown,
rotAll', rotAllUp, rotAllDown
) where
import XMonad.StackSet
import XMonad
-- $usage
--
-- To use this module, import it with:
--
-- > import XMonad.Actions.RotSlaves
--
-- and add whatever keybindings you would like, for example:
--
-- > , ((modm .|. shiftMask, xK_Tab ), rotSlavesUp)
--
-- This operation will rotate all windows except the master window,
-- while the focus stays where it is. It is useful together with the
-- TwoPane layout (see "XMonad.Layout.TwoPane").
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Rotate the windows in the current stack, excluding the first one
-- (master).
rotSlavesUp,rotSlavesDown :: X ()
rotSlavesUp = windows $ modify' (rotSlaves' (\l -> (tail l)++[head l]))
rotSlavesDown = windows $ modify' (rotSlaves' (\l -> [last l]++(init l)))
-- | The actual rotation, as a pure function on the window stack.
rotSlaves' :: ([a] -> [a]) -> Stack a -> Stack a
rotSlaves' _ s@(Stack _ [] []) = s
rotSlaves' f (Stack t [] rs) = Stack t [] (f rs) -- Master has focus
rotSlaves' f s@(Stack _ ls _ ) = Stack t' (reverse revls') rs' -- otherwise
where (master:ws) = integrate s
(revls',t':rs') = splitAt (length ls) (master:(f ws))
-- | Rotate all the windows in the current stack.
rotAllUp,rotAllDown :: X ()
rotAllUp = windows $ modify' (rotAll' (\l -> (tail l)++[head l]))
rotAllDown = windows $ modify' (rotAll' (\l -> [last l]++(init l)))
-- | The actual rotation, as a pure function on the window stack.
rotAll' :: ([a] -> [a]) -> Stack a -> Stack a
rotAll' f s = Stack r (reverse revls) rs
where (revls,r:rs) = splitAt (length (up s)) (f (integrate s))

387
XMonad/Actions/Search.hs Normal file
View File

@@ -0,0 +1,387 @@
{- | Module : XMonad.Actions.Search
Copyright : (C) 2007 Gwern Branwen
License : None; public domain
Maintainer : <gwern0@gmail.com>
Stability : unstable
Portability : unportable; depends on XSelection, XPrompt
A module for easily running Internet searches on web sites through xmonad.
Modeled after the handy Surfraw CLI search tools at <https://secure.wikimedia.org/wikipedia/en/wiki/Surfraw>.
Additional sites welcomed. -}
module XMonad.Actions.Search ( -- * Usage
-- $usage
search,
SearchEngine(..),
searchEngine,
searchEngineF,
promptSearch,
promptSearchBrowser,
selectSearch,
selectSearchBrowser,
isPrefixOf,
escape,
use,
intelligent,
(!>),
prefixAware,
namedEngine,
amazon,
alpha,
codesearch,
deb,
debbts,
debpts,
dictionary,
google,
hackage,
hoogle,
images,
imdb,
isohunt,
lucky,
maps,
mathworld,
openstreetmap,
scholar,
stackage,
thesaurus,
wayback,
wikipedia,
wiktionary,
youtube,
vocabulary,
duckduckgo,
multi,
-- * Use case: searching with a submap
-- $tip
-- * Types
Browser, Site, Query, Name, Search
) where
import Codec.Binary.UTF8.String (encode)
import Data.Char (isAlphaNum, isAscii)
import Data.List (isPrefixOf)
import Text.Printf
import XMonad (X (), liftIO)
import XMonad.Prompt (XPConfig (), XPrompt (showXPrompt, nextCompletion, commandToComplete),
getNextCompletion,
historyCompletionP, mkXPrompt)
import XMonad.Prompt.Shell (getBrowser)
import XMonad.Util.Run (safeSpawn)
import XMonad.Util.XSelection (getSelection)
{- $usage
This module is intended to allow easy access to databases on the
Internet through xmonad's interface. The idea is that one wants to
run a search but the query string and the browser to use must come
from somewhere. There are two places the query string can come from
- the user can type it into a prompt which pops up, or the query
could be available already in the X Windows copy\/paste buffer
(perhaps you just highlighted the string of interest).
Thus, there are two main functions: 'promptSearch', and
'selectSearch' (implemented using the more primitive 'search'). To
each of these is passed an engine function; this is a function that
knows how to search a particular site.
For example, the 'google' function knows how to search Google, and
so on. You pass 'promptSearch' and 'selectSearch' the engine you
want, the browser you want, and anything special they might need;
this whole line is then bound to a key of you choosing in your
xmonad.hs. For specific examples, see each function. This module
is easily extended to new sites by using 'searchEngine'.
The currently available search engines are:
* 'amazon' -- Amazon keyword search.
* 'alpha' -- Wolfram|Alpha query.
* 'codesearch' -- Google Labs Code Search search.
* 'deb' -- Debian package search.
* 'debbts' -- Debian Bug Tracking System.
* 'debpts' -- Debian Package Tracking System.
* 'dictionary' -- dictionary.reference.com search.
* 'google' -- basic Google search.
* 'hackage' -- Hackage, the Haskell package database.
* 'hoogle' -- Hoogle, the Haskell libraries API search engine.
* 'stackage' -- Stackage, An alternative Haskell libraries API search engine.
* 'images' -- Google images.
* 'imdb' -- the Internet Movie Database.
* 'isohunt' -- isoHunt search.
* 'lucky' -- Google "I'm feeling lucky" search.
* 'maps' -- Google maps.
* 'mathworld' -- Wolfram MathWorld search.
* 'openstreetmap' -- OpenStreetMap free wiki world map.
* 'scholar' -- Google scholar academic search.
* 'thesaurus' -- thesaurus.reference.com search.
* 'wayback' -- the Wayback Machine.
* 'wikipedia' -- basic Wikipedia search.
* 'youtube' -- Youtube video search.
* 'vocabulary' -- Dictionary search
* 'duckduckgo' -- DuckDuckGo search engine.
* 'multi' -- Search based on the prefix. \"amazon:Potter\" will use amazon, etc. With no prefix searches google.
Feel free to add more! -}
{- $tip
In combination with "XMonad.Actions.Submap" you can create a powerful
and easy way to search without adding a whole bunch of bindings.
First import the necessary modules:
> import qualified XMonad.Prompt as P
> import qualified XMonad.Actions.Submap as SM
> import qualified XMonad.Actions.Search as S
Then add the following to your key bindings:
> ...
> -- Search commands
> , ((modm, xK_s), SM.submap $ searchEngineMap $ S.promptSearch P.def)
> , ((modm .|. shiftMask, xK_s), SM.submap $ searchEngineMap $ S.selectSearch)
>
> ...
>
> searchEngineMap method = M.fromList $
> [ ((0, xK_g), method S.google)
> , ((0, xK_h), method S.hoogle)
> , ((0, xK_w), method S.wikipedia)
> ]
Or in combination with XMonad.Util.EZConfig:
> ...
> ] -- end of regular keybindings
> -- Search commands
> ++ [("M-s " ++ k, S.promptSearch P.def f) | (k,f) <- searchList ]
> ++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ]
>
> ...
>
> searchList :: [(String, S.SearchEngine)]
> searchList = [ ("g", S.google)
> , ("h", S.hoohle)
> , ("w", S.wikipedia)
> ]
Make sure to set firefox to open new pages in a new window instead of
in a new tab: @Firefox -> Edit -> Preferences -> Tabs -> New pages
should be opened in...@
Now /mod-s/ + /g/\//h/\//w/ prompts you for a search string, then
opens a new firefox window that performs the search on Google, Hoogle
or Wikipedia respectively.
If you select something in whatever application and hit /mod-shift-s/ +
/g/\//h/\//w/ it will search the selected string with the specified
engine.
Happy searching! -}
-- | A customized prompt indicating we are searching, and the name of the site.
data Search = Search Name
instance XPrompt Search where
showXPrompt (Search name)= "Search [" ++ name ++ "]: "
nextCompletion _ = getNextCompletion
commandToComplete _ c = c
-- | Escape the search string so search engines understand it. Only
-- digits and ASCII letters are not encoded. All non ASCII characters
-- which are encoded as UTF8
escape :: String -> String
escape = concatMap escapeURIChar
escapeURIChar :: Char -> String
escapeURIChar c | isAscii c && isAlphaNum c = [c]
| otherwise = concatMap (printf "%%%02X") $ encode [c]
type Browser = FilePath
type Query = String
type Site = String -> String
type Name = String
data SearchEngine = SearchEngine Name Site
-- | Given an already defined search engine, extracts its transformation
-- function, making it easy to create compound search engines.
-- For an instance you can use @use google@ to get a function which
-- makes the same transformation as the google search engine would.
use :: SearchEngine -> Site
use (SearchEngine _ engine) = engine
-- | Given a browser, a search engine's transformation function, and a search term, perform the
-- requested search in the browser.
search :: Browser -> Site -> Query -> X ()
search browser site query = safeSpawn browser [site query]
{- | Given a base URL, create the 'SearchEngine' that escapes the query and
appends it to the base. You can easily define a new engine locally using
exported functions without needing to modify "XMonad.Actions.Search":
> myNewEngine = searchEngine "site" "http://site.com/search="
The important thing is that the site has a interface which accepts the escaped query
string as part of the URL. Alas, the exact URL to feed searchEngine varies
from site to site, often considerably, so there\'s no general way to cover this.
Generally, examining the resultant URL of a search will allow you to reverse-engineer
it if you can't find the necessary URL already described in other projects such as Surfraw. -}
searchEngine :: Name -> String -> SearchEngine
searchEngine name site = searchEngineF name (\s -> site ++ (escape s))
{- | If your search engine is more complex than this (you may want to identify
the kind of input and make the search URL dependent on the input or put the query
inside of a URL instead of in the end) you can use the alternative 'searchEngineF' function.
> searchFunc :: String -> String
> searchFunc s | "wiki:" `isPrefixOf` s = "http://en.wikipedia.org/wiki/" ++ (escape $ tail $ snd $ break (==':') s)
> | "http://" `isPrefixOf` s = s
> | otherwise = (use google) s
> myNewEngine = searchEngineF "mymulti" searchFunc
@searchFunc@ here searches for a word in wikipedia if it has a prefix
of \"wiki:\" (you can use the 'escape' function to escape any forbidden characters), opens an address
directly if it starts with \"http:\/\/\" and otherwise uses the provided google search engine.
You can use other engines inside of your own through the 'use' function as shown above to make
complex searches.
The user input will be automatically escaped in search engines created with 'searchEngine',
'searchEngineF', however, completely depends on the transformation function passed to it. -}
searchEngineF :: Name -> Site -> SearchEngine
searchEngineF = SearchEngine
-- The engines.
amazon, alpha, codesearch, deb, debbts, debpts, dictionary, google, hackage, hoogle,
images, imdb, isohunt, lucky, maps, mathworld, openstreetmap, scholar, stackage, thesaurus, vocabulary, wayback, wikipedia, wiktionary,
youtube, duckduckgo :: SearchEngine
amazon = searchEngine "amazon" "http://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords="
alpha = searchEngine "alpha" "http://www.wolframalpha.com/input/?i="
codesearch = searchEngine "codesearch" "http://www.google.com/codesearch?q="
deb = searchEngine "deb" "http://packages.debian.org/"
debbts = searchEngine "debbts" "http://bugs.debian.org/"
debpts = searchEngine "debpts" "http://packages.qa.debian.org/"
dictionary = searchEngine "dict" "http://dictionary.reference.com/browse/"
google = searchEngine "google" "http://www.google.com/search?num=100&q="
hackage = searchEngine "hackage" "http://hackage.haskell.org/package/"
hoogle = searchEngine "hoogle" "http://www.haskell.org/hoogle/?q="
images = searchEngine "images" "http://images.google.fr/images?q="
imdb = searchEngine "imdb" "http://www.imdb.com/find?s=all&q="
isohunt = searchEngine "isohunt" "http://isohunt.com/torrents/?ihq="
lucky = searchEngine "lucky" "http://www.google.com/search?btnI&q="
maps = searchEngine "maps" "http://maps.google.com/maps?q="
mathworld = searchEngine "mathworld" "http://mathworld.wolfram.com/search/?query="
openstreetmap = searchEngine "openstreetmap" "http://gazetteer.openstreetmap.org/namefinder/?find="
scholar = searchEngine "scholar" "http://scholar.google.com/scholar?q="
stackage = searchEngine "stackage" "www.stackage.org/lts/hoogle?q="
thesaurus = searchEngine "thesaurus" "http://thesaurus.reference.com/search?q="
wikipedia = searchEngine "wiki" "http://en.wikipedia.org/wiki/Special:Search?go=Go&search="
wiktionary = searchEngine "wikt" "http://en.wiktionary.org/wiki/Special:Search?go=Go&search="
youtube = searchEngine "youtube" "http://www.youtube.com/results?search_type=search_videos&search_query="
wayback = searchEngineF "wayback" ("http://web.archive.org/web/*/"++)
vocabulary = searchEngine "vocabulary" "http://www.vocabulary.com/search?q="
duckduckgo = searchEngine "duckduckgo" "https://duckduckgo.com/?t=lm&q="
multi :: SearchEngine
multi = namedEngine "multi" $ foldr1 (!>) [amazon, alpha, codesearch, deb, debbts, debpts, dictionary, google, hackage, hoogle, images, imdb, isohunt, lucky, maps, mathworld, openstreetmap, scholar, thesaurus, wayback, wikipedia, wiktionary, duckduckgo, (prefixAware google)]
{- | This function wraps up a search engine and creates a new one, which works
like the argument, but goes directly to a URL if one is given rather than
searching.
> myIntelligentGoogleEngine = intelligent google
Now if you search for http:\/\/xmonad.org it will directly open in your browser-}
intelligent :: SearchEngine -> SearchEngine
intelligent (SearchEngine name site) = searchEngineF name (\s -> if (fst $ break (==':') s) `elem` ["http", "https", "ftp"] then s else (site s))
-- | > removeColonPrefix "foo://bar" ~> "//bar"
-- > removeColonPrefix "foo//bar" ~> "foo//bar"
removeColonPrefix :: String -> String
removeColonPrefix s = if ':' `elem` s then drop 1 $ dropWhile (':' /=) s else s
{- | Connects a few search engines into one. If the search engines\' names are
\"s1\", \"s2\" and \"s3\", then the resulting engine will use s1 if the query
is @s1:word@, s2 if you type @s2:word@ and s3 in all other cases.
Example:
> multiEngine = intelligent (wikipedia !> mathworld !> (prefixAware google))
Now if you type \"wiki:Haskell\" it will search for \"Haskell\" in Wikipedia,
\"mathworld:integral\" will search mathworld, and everything else will fall back to
google. The use of intelligent will make sure that URLs are opened directly. -}
(!>) :: SearchEngine -> SearchEngine -> SearchEngine
(SearchEngine name1 site1) !> (SearchEngine name2 site2) = searchEngineF (name1 ++ "/" ++ name2) (\s -> if (name1++":") `isPrefixOf` s then site1 (removeColonPrefix s) else site2 s)
{- | Makes a search engine prefix-aware. Especially useful together with '!>'.
It will automatically remove the prefix from a query so that you don\'t end
up searching for google:xmonad if google is your fallback engine and you
explicitly add the prefix. -}
prefixAware :: SearchEngine -> SearchEngine
prefixAware (SearchEngine name site) = SearchEngine name (\s -> if (name++":") `isPrefixOf` s then site $ removeColonPrefix s else site s)
{- | Changes search engine's name -}
namedEngine :: Name -> SearchEngine -> SearchEngine
namedEngine name (SearchEngine _ site) = searchEngineF name site
{- | Like 'search', but for use with the output from a Prompt; it grabs the
Prompt's result, passes it to a given searchEngine and opens it in a given
browser. -}
promptSearchBrowser :: XPConfig -> Browser -> SearchEngine -> X ()
promptSearchBrowser config browser (SearchEngine name site) =
mkXPrompt (Search name) config (historyCompletionP ("Search [" `isPrefixOf`)) $ search browser site
{- | Like 'search', but in this case, the string is not specified but grabbed
from the user's response to a prompt. Example:
> , ((modm, xK_g), promptSearch greenXPConfig google)
This specializes "promptSearchBrowser" by supplying the browser argument as
supplied by 'getBrowser' from "XMonad.Prompt.Shell". -}
promptSearch :: XPConfig -> SearchEngine -> X ()
promptSearch config engine = liftIO getBrowser >>= \ browser -> promptSearchBrowser config browser engine
-- | Like 'search', but for use with the X selection; it grabs the selection,
-- passes it to a given searchEngine and opens it in a given browser.
selectSearchBrowser :: Browser -> SearchEngine -> X ()
selectSearchBrowser browser (SearchEngine _ site) = search browser site =<< getSelection
{- | Like 'search', but for use with the X selection; it grabs the selection,
passes it to a given searchEngine and opens it in the default browser . Example:
> , ((modm .|. shiftMask, xK_g), selectSearch google)
This specializes "selectSearchBrowser" by supplying the browser argument as
supplied by 'getBrowser' from "XMonad.Prompt.Shell". -}
selectSearch :: SearchEngine -> X ()
selectSearch engine = liftIO getBrowser >>= \browser -> selectSearchBrowser browser engine

121
XMonad/Actions/ShowText.hs Normal file
View File

@@ -0,0 +1,121 @@
{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.ShowText
-- Copyright : (c) Mario Pastorelli (2012)
-- License : BSD-style (see xmonad/LICENSE)
--
-- Maintainer : pastorelli.mario@gmail.com
-- Stability : unstable
-- Portability : unportable
--
-- ShowText displays text for sometime on the screen similar to "XMonad.Util.Dzen"
-- which offers more features (currently)
-----------------------------------------------------------------------------
module XMonad.Actions.ShowText
( -- * Usage
-- $usage
def
, defaultSTConfig
, handleTimerEvent
, flashText
, ShowTextConfig(..)
) where
import Control.Monad (when)
import Data.Map (Map,empty,insert,lookup)
import Data.Monoid (mempty, All)
import Prelude hiding (lookup)
import XMonad
import XMonad.StackSet (current,screen)
import XMonad.Util.Font (Align(AlignCenter)
, initXMF
, releaseXMF
, textExtentsXMF
, textWidthXMF)
import XMonad.Util.Timer (startTimer)
import XMonad.Util.XUtils (createNewWindow
, deleteWindow
, fi
, showWindow
, paintAndWrite)
import qualified XMonad.Util.ExtensibleState as ES
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.ShowText
--
-- Then add the event hook handler:
--
-- > xmonad { handleEventHook = myHandleEventHooks <+> handleTimerEvent }
--
-- You can then use flashText in your keybindings:
--
-- > ((modMask, xK_Right), flashText def 1 "->" >> nextWS)
--
-- | ShowText contains the map with timers as keys and created windows as values
newtype ShowText = ShowText (Map Atom Window)
deriving (Read,Show,Typeable)
instance ExtensionClass ShowText where
initialValue = ShowText empty
-- | Utility to modify a ShowText
modShowText :: (Map Atom Window -> Map Atom Window) -> ShowText -> ShowText
modShowText f (ShowText m) = ShowText $ f m
data ShowTextConfig =
STC { st_font :: String -- ^ Font name
, st_bg :: String -- ^ Background color
, st_fg :: String -- ^ Foreground color
}
instance Default ShowTextConfig where
def =
STC { st_font = "-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*"
, st_bg = "black"
, st_fg = "white"
}
{-# DEPRECATED defaultSTConfig "Use def (from Data.Default, and re-exported by XMonad.Actions.ShowText) instead." #-}
defaultSTConfig :: ShowTextConfig
defaultSTConfig = def
-- | Handles timer events that notify when a window should be removed
handleTimerEvent :: Event -> X All
handleTimerEvent (ClientMessageEvent _ _ _ dis _ mtyp d) = do
(ShowText m) <- ES.get :: X ShowText
a <- io $ internAtom dis "XMONAD_TIMER" False
when (mtyp == a && length d >= 1)
(whenJust (lookup (fromIntegral $ d !! 0) m) deleteWindow)
mempty
handleTimerEvent _ = mempty
-- | Shows a window in the center of the screen with the given text
flashText :: ShowTextConfig
-> Rational -- ^ number of seconds
-> String -- ^ text to display
-> X ()
flashText c i s = do
f <- initXMF (st_font c)
d <- asks display
sc <- gets $ fi . screen . current . windowset
width <- textWidthXMF d f s
(as,ds) <- textExtentsXMF f s
let hight = as + ds
ht = displayHeight d sc
wh = displayWidth d sc
y = (fi ht - hight + 2) `div` 2
x = (fi wh - width + 2) `div` 2
w <- createNewWindow (Rectangle (fi x) (fi y) (fi width) (fi hight))
Nothing "" True
showWindow w
paintAndWrite w f (fi width) (fi hight) 0 (st_bg c) ""
(st_fg c) (st_bg c) [AlignCenter] [s]
releaseXMF f
io $ sync d False
t <- startTimer i
ES.modify $ modShowText (insert (fromIntegral t) w)

View File

@@ -1,9 +1,9 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonadContrib.SimpleDate
-- Module : XMonad.Actions.SimpleDate
-- Copyright : (c) Don Stewart 2007
-- License : BSD3-style (see LICENSE)
--
--
-- Maintainer : dons@cse.unsw.edu.au
-- Stability : stable
-- Portability : portable
@@ -13,24 +13,28 @@
--
-----------------------------------------------------------------------------
module XMonadContrib.SimpleDate (
module XMonad.Actions.SimpleDate (
-- * Usage
-- $usage
date
) where
import XMonad
import XMonad.Core
import XMonad.Util.Run
-- $usage
-- To use, modify your Config.hs to:
-- To use, import this module into @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonadContrib.SimpleDate
-- > import XMonad.Actions.SimpleDate
--
-- and add a keybinding:
-- and add a keybinding, for example:
--
-- > , ((modMask, xK_d ), date)
-- > , ((modm, xK_d ), date)
--
-- a popup date menu will now be bound to mod-d
-- In this example, a popup date menu will now be bound to @mod-d@.
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
date :: X ()
date = spawn "(date; sleep 10) | dzen2"
date = unsafeSpawn "(date; sleep 10) | dzen2"

34
XMonad/Actions/SinkAll.hs Normal file
View File

@@ -0,0 +1,34 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.SinkAll
-- License : BSD3-style (see LICENSE)
-- Stability : unstable
-- Portability : unportable
--
-- Provides a simple binding that pushes all floating windows on the
-- current workspace back into tiling. Note that the functionality of
-- this module has been folded into the more general
-- "XMonad.Actions.WithAll"; this module simply re-exports the
-- 'sinkAll' function for backwards compatibility.
-----------------------------------------------------------------------------
module XMonad.Actions.SinkAll (
-- * Usage
-- $usage
sinkAll) where
import XMonad.Actions.WithAll (sinkAll)
-- $usage
--
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.SinkAll
--
-- then add a keybinding; for example:
--
-- > , ((modm .|. shiftMask, xK_t), sinkAll)
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".

161
XMonad/Actions/SpawnOn.hs Normal file
View File

@@ -0,0 +1,161 @@
{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.SpawnOn
-- Copyright : (c) Spencer Janssen
-- License : BSD
--
-- Maintainer : Spencer Janssen <spencerjanssen@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- Provides a way to modify a window spawned by a command(e.g shift it to the workspace
-- it was launched on) by using the _NET_WM_PID property that most windows set on creation.
-- Hence this module won't work on applications that don't set this property.
--
-----------------------------------------------------------------------------
module XMonad.Actions.SpawnOn (
-- * Usage
-- $usage
Spawner,
manageSpawn,
manageSpawnWithGC,
spawnHere,
spawnOn,
spawnAndDo,
shellPromptHere,
shellPromptOn
) where
import Control.Exception (tryJust)
import Control.Monad (guard)
import Data.List (isInfixOf)
import Data.Maybe (isJust)
import System.IO.Error (isDoesNotExistError)
import System.IO.Unsafe (unsafePerformIO)
import System.Posix.Types (ProcessID)
import Text.Printf (printf)
import XMonad
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Prompt
import XMonad.Prompt.Shell
import qualified XMonad.Util.ExtensibleState as XS
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.SpawnOn
--
-- > main = do
-- > xmonad def {
-- > ...
-- > manageHook = manageSpawn <+> manageHook def
-- > ...
-- > }
--
-- To ensure that application appears on a workspace it was launched at, add keybindings like:
--
-- > , ((mod1Mask,xK_o), spawnHere "urxvt")
-- > , ((mod1Mask,xK_s), shellPromptHere def)
--
-- The module can also be used to apply other manage hooks to the window of
-- the spawned application(e.g. float or resize it).
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
newtype Spawner = Spawner {pidsRef :: [(ProcessID, ManageHook)]} deriving Typeable
instance ExtensionClass Spawner where
initialValue = Spawner []
getPPIDOf :: ProcessID -> Maybe ProcessID
getPPIDOf pid =
case unsafePerformIO . tryJust (guard . isDoesNotExistError) . readFile . printf "/proc/%d/stat" $ toInteger pid of
Left _ -> Nothing
Right contents -> case lines contents of
[] -> Nothing
first : _ -> case words first of
_ : _ : _ : ppid : _ -> Just $ fromIntegral (read ppid :: Int)
_ -> Nothing
getPPIDChain :: ProcessID -> [ProcessID]
getPPIDChain pid' = ppid_chain pid' []
where ppid_chain pid acc =
if pid == 0
then acc
else case getPPIDOf pid of
Nothing -> acc
Just ppid -> ppid_chain ppid (ppid : acc)
-- | Get the current Spawner or create one if it doesn't exist.
modifySpawner :: ([(ProcessID, ManageHook)] -> [(ProcessID, ManageHook)]) -> X ()
modifySpawner f = XS.modify (Spawner . f . pidsRef)
-- | Provides a manage hook to react on process spawned with
-- 'spawnOn', 'spawnHere' etc.
manageSpawn :: ManageHook
manageSpawn = manageSpawnWithGC (return . take 20)
manageSpawnWithGC :: ([(ProcessID, ManageHook)] -> X [(ProcessID, ManageHook)])
-- ^ function to stop accumulation of entries for windows that never set @_NET_WM_PID@
-> ManageHook
manageSpawnWithGC garbageCollect = do
Spawner pids <- liftX XS.get
mp <- pid
let ppid_chain = case mp of
Just winpid -> winpid : getPPIDChain winpid
Nothing -> []
known_window_handlers = [ mh
| ppid <- ppid_chain
, let mpid = lookup ppid pids
, isJust mpid
, let (Just mh) = mpid ]
case known_window_handlers of
[] -> idHook
(mh:_) -> do
whenJust mp $ \p -> liftX $ do
ps <- XS.gets pidsRef
XS.put . Spawner =<< garbageCollect (filter ((/= p) . fst) ps)
mh
mkPrompt :: (String -> X ()) -> XPConfig -> X ()
mkPrompt cb c = do
cmds <- io $ getCommands
mkXPrompt Shell c (getShellCompl cmds $ searchPredicate c) cb
-- | Replacement for Shell prompt ("XMonad.Prompt.Shell") which launches
-- application on current workspace.
shellPromptHere :: XPConfig -> X ()
shellPromptHere = mkPrompt spawnHere
-- | Replacement for Shell prompt ("XMonad.Prompt.Shell") which launches
-- application on given workspace.
shellPromptOn :: WorkspaceId -> XPConfig -> X ()
shellPromptOn ws = mkPrompt (spawnOn ws)
-- | Replacement for 'spawn' which launches
-- application on current workspace.
spawnHere :: String -> X ()
spawnHere cmd = withWindowSet $ \ws -> spawnOn (W.currentTag ws) cmd
-- | Replacement for 'spawn' which launches
-- application on given workspace.
spawnOn :: WorkspaceId -> String -> X ()
spawnOn ws cmd = spawnAndDo (doShift ws) cmd
-- | Spawn an application and apply the manage hook when it opens.
spawnAndDo :: ManageHook -> String -> X ()
spawnAndDo mh cmd = do
p <- spawnPID $ mangle cmd
modifySpawner $ ((p,mh) :)
where
-- TODO this is silly, search for a better solution
mangle xs | any (`elem` metaChars) xs || "exec" `isInfixOf` xs = xs
| otherwise = "exec " ++ xs
metaChars = "&|;"

97
XMonad/Actions/Submap.hs Normal file
View File

@@ -0,0 +1,97 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.Submap
-- Copyright : (c) Jason Creighton <jcreigh@gmail.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Jason Creighton <jcreigh@gmail.com>
-- Stability : unstable
-- Portability : unportable
--
-- A module that allows the user to create a sub-mapping of key bindings.
--
-----------------------------------------------------------------------------
module XMonad.Actions.Submap (
-- * Usage
-- $usage
submap,
submapDefault,
submapDefaultWithKey
) where
import Data.Bits
import Data.Maybe (fromMaybe)
import XMonad hiding (keys)
import qualified Data.Map as M
import Control.Monad.Fix (fix)
{- $usage
First, import this module into your @~\/.xmonad\/xmonad.hs@:
> import XMonad.Actions.Submap
Allows you to create a sub-mapping of keys. Example:
> , ((modm, xK_a), submap . M.fromList $
> [ ((0, xK_n), spawn "mpc next")
> , ((0, xK_p), spawn "mpc prev")
> , ((0, xK_z), spawn "mpc random")
> , ((0, xK_space), spawn "mpc toggle")
> ])
So, for example, to run 'spawn \"mpc next\"', you would hit mod-a (to
trigger the submapping) and then 'n' to run that action. (0 means \"no
modifier\"). You are, of course, free to use any combination of
modifiers in the submapping. However, anyModifier will not work,
because that is a special value passed to XGrabKey() and not an actual
modifier.
For detailed instructions on editing your key bindings, see
"XMonad.Doc.Extending#Editing_key_bindings".
-}
-- | Given a 'Data.Map.Map' from key bindings to X () actions, return
-- an action which waits for a user keypress and executes the
-- corresponding action, or does nothing if the key is not found in
-- the map.
submap :: M.Map (KeyMask, KeySym) (X ()) -> X ()
submap = submapDefault (return ())
-- | Like 'submap', but executes a default action if the key did not match.
submapDefault :: X () -> M.Map (KeyMask, KeySym) (X ()) -> X ()
submapDefault = submapDefaultWithKey . const
-- | Like 'submapDefault', but sends the unmatched key to the default
-- action as argument.
submapDefaultWithKey :: ((KeyMask, KeySym) -> X ())
-> M.Map (KeyMask, KeySym) (X ())
-> X ()
submapDefaultWithKey defAction keys = do
XConf { theRoot = root, display = d } <- ask
io $ grabKeyboard d root False grabModeAsync grabModeAsync currentTime
io $ grabPointer d root False buttonPressMask grabModeAsync grabModeAsync
none none currentTime
(m, s) <- io $ allocaXEvent $ \p -> fix $ \nextkey -> do
maskEvent d (keyPressMask .|. buttonPressMask) p
ev <- getEvent p
case ev of
KeyEvent { ev_keycode = code, ev_state = m } -> do
keysym <- keycodeToKeysym d code 0
if isModifierKey keysym
then nextkey
else return (m, keysym)
_ -> return (0, 0)
-- Remove num lock mask and Xkb group state bits
m' <- cleanMask $ m .&. ((1 `shiftL` 12) - 1)
io $ ungrabPointer d currentTime
io $ ungrabKeyboard d currentTime
fromMaybe (defAction (m', s)) (M.lookup (m', s) keys)

View File

@@ -0,0 +1,407 @@
{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.SwapPromote
-- Copyright : (c) 2018 Yclept Nemo
-- License : BSD-style (see LICENSE)
--
-- Maintainer :
-- Stability : unstable
-- Portability : unportable
--
-- Module for tracking master window history per workspace, and associated
-- functions for manipulating the stack using such history.
--
-----------------------------------------------------------------------------
module XMonad.Actions.SwapPromote
( -- * Usage
-- $usage
MasterHistory (..)
-- * State Accessors
, getMasterHistoryMap
, getMasterHistoryFromTag
, getMasterHistoryCurrent
, getMasterHistoryFromWindow
, modifyMasterHistoryFromTag
, modifyMasterHistoryCurrent
-- * Log Hook
, masterHistoryHook
-- * Log Hook Building Blocks
, masterHistoryHook'
, updateMasterHistory
-- * Actions
, swapPromote
, swapPromote'
, swapIn
, swapIn'
, swapHybrid
, swapHybrid'
-- * Action Building Blocks
, swapApply
, swapPromoteStack
, swapInStack
, swapHybridStack
-- * List Utilities
, cycleN
, split
, split'
, merge
, merge'
-- * Stack Utilities
, stackSplit
, stackMerge
) where
import XMonad
import qualified XMonad.StackSet as W
import qualified XMonad.Util.ExtensibleState as XS
import qualified Data.Map as M
import qualified Data.Set as S
import Data.List
import Data.Maybe
import Control.Arrow
import Control.Applicative ((<$>),(<*>))
import Control.Monad
-- $usage
-- Given your configuration file, import this module:
--
-- > import XMonad.Actions.SwapPromote
--
-- First add 'masterHistoryHook' to your 'logHook' to track master windows per
-- workspace:
--
-- > myLogHook = otherHook >> masterHistoryHook
--
-- Then replace xmonad's default promote keybinding with 'swapPromote'':
--
-- > , ((mod1Mask, xK_Return), swapPromote' False)
--
-- Depending on your xmonad configuration or window actions the master history
-- may be empty. If this is the case you can still chain another promotion
-- function:
--
-- > import XMonad.Actions.DwmPromote
-- > , ((mod1Mask, xK_Return), whenX (swapPromote False) dwmpromote)
--
-- To be clear, this is only called when the lack of master history hindered
-- the swap and not other conditions, such as having a only a single window.
--
-- While 'swapPromote' preserves window focus, 'swapIn' preserves the focus
-- position - effectively "swapping" new windows into focus without moving the
-- zipper. A mix of both, 'swapHybrid' promotes focused non-master windows
-- while swapping windows into the focused master. This works well on layouts
-- with large masters. Both come with chainable variants, see 'swapIn'' and
-- 'swapHybrid''.
--
-- So far floating windows have been treated no differently than tiled windows
-- even though their positions are independent of the stack. Often, yanking
-- floating windows in and out of the workspace will obliterate the stack
-- history - particularly frustrating with 'XMonad.Util.Scratchpad' since it is
-- toggled so frequenty and always replaces the master window. That's why the
-- swap functions accept a boolean argument; when @True@ non-focused floating
-- windows will be ignored.
--
-- All together:
--
-- > , ((mod1Mask, xK_Return), whenX (swapHybrid True) dwmpromote)
-- | Mapping from workspace tag to master history list. The current master is
-- the head of the list, the previous master the second element, and so on.
-- Without history, the list is empty.
newtype MasterHistory = MasterHistory
{ getMasterHistory :: M.Map WorkspaceId [Window]
} deriving (Read,Show,Typeable)
instance ExtensionClass MasterHistory where
initialValue = MasterHistory M.empty
-- | Return the master history map from the state.
getMasterHistoryMap :: X (M.Map WorkspaceId [Window])
getMasterHistoryMap = XS.gets getMasterHistory
-- | Return the master history list of a given tag. The master history list may
-- be empty. An invalid tag will also result in an empty list.
getMasterHistoryFromTag :: WorkspaceId -> X [Window]
getMasterHistoryFromTag t = M.findWithDefault [] t <$> getMasterHistoryMap
-- | Return the master history list of the current workspace.
getMasterHistoryCurrent :: X [Window]
getMasterHistoryCurrent = gets (W.currentTag . windowset)
>>= getMasterHistoryFromTag
-- | Return the master history list of the workspace containing the given
-- window. Return an empty list if the window is not in the stackset.
getMasterHistoryFromWindow :: Window -> X [Window]
getMasterHistoryFromWindow w = gets (W.findTag w . windowset)
>>= maybe (return []) getMasterHistoryFromTag
-- | Modify the master history list of a given workspace, or the empty list of
-- no such workspace is mapped. The result is then re-inserted into the master
-- history map.
modifyMasterHistoryFromTag :: WorkspaceId -> ([Window] -> [Window]) -> X ()
modifyMasterHistoryFromTag t f = XS.modify $ \(MasterHistory m) ->
let l = M.findWithDefault [] t m
in MasterHistory $ M.insert t (f l) m
-- | Modify the master history list of the current workspace. While the current
-- workspace is guaranteed to exist; its master history may not. For more
-- information see 'modifyMasterHistoryFromTag'.
modifyMasterHistoryCurrent :: ([Window] -> [Window]) -> X ()
modifyMasterHistoryCurrent f = gets (W.currentTag . windowset)
>>= flip modifyMasterHistoryFromTag f
-- | A 'logHook' to update the master history mapping. Non-existent workspaces
-- are removed, and the master history list for the current workspaces is
-- updated. See 'masterHistoryHook''.
masterHistoryHook :: X ()
masterHistoryHook = masterHistoryHook' True updateMasterHistory
-- | Backend for 'masterHistoryHook'.
masterHistoryHook' :: Bool
-- ^ If @True@, remove non-existent workspaces.
-> ([Window] -> [Window] -> [Window])
-- ^ Function used to update the master history list of
-- the current workspace. First argument is the master
-- history, second is the integrated stack. See
-- 'updateMasterHistory' for more details.
-> X ()
masterHistoryHook' removeWorkspaces historyModifier = do
wset <- gets windowset
let W.Workspace wid _ mst = W.workspace . W.current $ wset
tags = map W.tag $ W.workspaces wset
st = W.integrate' mst
XS.modify $ \(MasterHistory mm) ->
let mm' = if removeWorkspaces
then restrictKeys mm $ S.fromList tags
else mm
ms = M.findWithDefault [] wid mm'
ms' = historyModifier ms st
in MasterHistory $ M.insert wid ms' mm'
-- | Less efficient version of 'M.restrictKeys'. Given broader eventual
-- adoption, replace this with 'M.restrictKeys'.
restrictKeys :: Ord k => M.Map k a -> S.Set k -> M.Map k a
restrictKeys m s = M.filterWithKey (\k _ -> k `S.member` s) m
-- | Given the current master history list and an integrated stack, return the
-- new master history list. The current master is either moved (if it exists
-- within the history) or added to the head of the list, and all missing (i.e.
-- closed) windows are removed.
updateMasterHistory :: [Window] -- ^ The master history list.
-> [Window] -- ^ The integrated stack.
-> [Window]
updateMasterHistory _ [] = []
updateMasterHistory ms ws@(w:_) = (w : delete w ms) `intersect` ws
-- | Wrap 'swapPromoteStack'; see also 'swapApply'.
swapPromote :: Bool -> X Bool
swapPromote = flip swapApply swapPromoteStack
-- | Like 'swapPromote'' but discard the result.
swapPromote' :: Bool -> X ()
swapPromote' = void . swapPromote
-- | Wrap 'swapInStack'; see also 'swapApply'.
swapIn :: Bool -> X Bool
swapIn = flip swapApply swapInStack
-- | Like 'swapIn'' but discard the result.
swapIn' :: Bool -> X ()
swapIn' = void . swapIn
-- | Wrap 'swapHybridStack'; see also 'swapApply'.
swapHybrid :: Bool -> X Bool
swapHybrid = flip swapApply swapHybridStack
-- | Like 'swapHybrid'' but discard the result.
swapHybrid' :: Bool -> X ()
swapHybrid' = void . swapHybrid
-- | Apply the given master history stack modifier to the current stack. If
-- given @True@, all non-focused floating windows will be ignored. Return
-- @True@ if insufficient history; if so use 'whenX' to sequence a backup
-- promotion function.
swapApply :: Bool
-> (Maybe Window -> W.Stack Window -> (Bool,W.Stack Window))
-> X Bool
swapApply ignoreFloats swapFunction = do
fl <- gets $ W.floating . windowset
st <- gets $ W.stack . W.workspace . W.current . windowset
ch <- getMasterHistoryCurrent
let swapApply' s1 =
let fl' = if ignoreFloats then M.keysSet fl else S.empty
ff = (||) <$> (`S.notMember` fl') <*> (== W.focus s1)
fh = filter ff ch
pm = listToMaybe . drop 1 $ fh
(r,s2) = stackSplit s1 fl' :: ([(Int,Window)],W.Stack Window)
(b,s3) = swapFunction pm s2
s4 = stackMerge s3 r
mh = let w = head . W.integrate $ s3
in const $ w : delete w ch
in (b,Just s4,mh)
(x,y,z) = maybe (False,Nothing,id) swapApply' st
-- Any floating master windows will be added to the history when 'windows'
-- calls the log hook.
modifyMasterHistoryCurrent z
windows $ W.modify Nothing . const $ y
return x
-- | If the focused window is the master window and there is no previous
-- master, do nothing. Otherwise swap the master with the previous master. If
-- the focused window is not the master window, swap it with the master window.
-- In either case focus follows the original window, i.e. the focused window
-- does not change, only its position.
--
-- The first argument is the previous master (which may not exist), the second
-- a window stack. Return @True@ if the master history hindered the swap; the
-- history is either empty or out-of-sync. Though the latter shouldn't happen
-- this function never changes the stack under such circumstances.
swapPromoteStack :: Maybe Window -> W.Stack Window -> (Bool,W.Stack Window)
swapPromoteStack _ st@(W.Stack _x [] []) = (False,st)
swapPromoteStack Nothing st@(W.Stack _x [] _r) = (True,st)
swapPromoteStack (Just pm) (W.Stack x [] r) =
let (r',l') = (reverse *** cycleN 1) $ span (/= pm) $ reverse r
st' = W.Stack x l' r'
b = null l'
in (b,st')
swapPromoteStack _ (W.Stack x l r) =
let r' = (++ r) . cycleN 1 . reverse $ l
st' = W.Stack x [] r'
in (False,st')
-- | Perform the same swap as 'swapPromoteStack'. However the new window
-- receives the focus; it appears to "swap into" the position of the original
-- window. Under this model focus follows stack position and the zipper does
-- not move.
--
-- See 'swapPromoteStack' for more details regarding the parameters.
swapInStack :: Maybe Window -> W.Stack Window -> (Bool,W.Stack Window)
swapInStack _ st@(W.Stack _x [] []) = (False,st)
swapInStack Nothing st@(W.Stack _x [] _r) = (True,st)
swapInStack (Just pm) (W.Stack x [] r) =
let (x',r') = case span (/= pm) r of
(__,[]) -> (x,r)
(sl,sr) -> (pm,sl ++ x : drop 1 sr)
st' = W.Stack x' [] r'
b = x' == x
in (b,st')
swapInStack _ (W.Stack x l r) =
let l' = init l ++ [x]
x' = last l
st' = W.Stack x' l' r
in (False,st')
-- | If the focused window is the master window, use 'swapInStack'. Otherwise use
-- 'swapPromoteStack'.
--
-- See 'swapPromoteStack' for more details regarding the parameters.
swapHybridStack :: Maybe Window -> W.Stack Window -> (Bool,W.Stack Window)
swapHybridStack m st@(W.Stack _ [] _) = swapInStack m st
swapHybridStack m st = swapPromoteStack m st
-- | Cycle a list by the given count. If positive, cycle to the left. If
-- negative, cycle to the right:
--
-- >>> cycleN 2 [1,2,3,4,5]
-- [3,4,5,1,2]
-- >>> cycleN (-2) [1,2,3,4,5]
-- [4,5,1,2,3]
cycleN :: Int -> [a] -> [a]
cycleN n ls =
let l = length ls
in take l $ drop (n `mod` l) $ cycle ls
-- | Wrap 'split'' with an initial index of @0@, discarding the list's length.
split :: (Num a, Enum a) => (b -> Bool) -> [b] -> ([(a,b)],[b])
split p l =
let (_,ys,ns) = split' p 0 l
in (ys,ns)
-- | Given a predicate, an initial index and a list, return a tuple containing:
--
-- * List length.
-- * Indexed list of elements which satisfy the predicate. An indexed element
-- is a tuple containing the element index (offset by the initial index) and
-- the element.
-- * List of elements which do not satisfy the predicate.
--
-- The initial index and length of the list simplify chaining calls to this
-- function, such as for zippers of lists.
split' :: (Num a, Enum a) => (b -> Bool) -> a -> [b] -> (a,[(a,b)],[b])
split' p i l =
let accumulate e (c,ys,ns) = if p (snd e)
then (c+1,e:ys,ns)
else (c+1,ys,e:ns)
(c',ys',ns') = foldr accumulate (0,[],[]) $ zip [i..] l
in (c',ys',snd . unzip $ ns')
-- | Wrap 'merge'' with an initial virtual index of @0@. Return only the
-- unindexed list with elements from the leftover indexed list appended.
merge :: (Ord a, Num a) => [(a,b)] -> [b] -> [b]
merge il ul =
let (_,il',ul') = merge' 0 il ul
in ul' ++ map snd il'
-- | Inverse of 'split'. Merge an indexed list with an unindexed list (see
-- 'split''). Given a virtual index, an indexed list and an unindexed list,
-- return a tuple containing:
--
-- * Virtual index /after/ the unindexed list
-- * Remainder of the indexed list
-- * Merged unindexed list
--
-- If the indexed list is empty, this functions consumes the entire unindexed
-- list. If the unindexed list is empty, this function consumes only adjacent
-- indexed elements. For example, @[(10,"ten"),(12,"twelve")]@ implies missing
-- unindexed elements and so once @(10,"ten")@ is consumed this function
-- concludes.
--
-- The indexed list is assumed to have been created by 'split'' and not checked
-- for correctness. Indices are assumed to be ascending, i.e.
-- > [(1,"one"),(2,"two"),(4,"four")]
--
-- The initial and final virtual indices simplify chaining calls to the this
-- function, as as for zippers of lists. Positive values shift the unindexed
-- list towards the tail, as if preceded by that many elements.
merge' :: (Ord a, Num a) => a -> [(a,b)] -> [b] -> (a,[(a,b)],[b])
merge' i il@((j,a):ps) ul@(b:bs) = if j <= i
then let (x,y,z) = merge' (i+1) ps ul
in (x,y,a:z)
else let (x,y,z) = merge' (i+1) il bs
in (x,y,b:z)
merge' i [] (b:bs) =
let (x,y,z) = merge' (i+1) [] bs
in (x,y,b:z)
merge' i il@((j,a):ps) [] = if j <= i
then let (x,y,z) = merge' (i+1) ps []
in (x,y,a:z)
else (i,il,[])
merge' i [] [] =
(i,[],[])
-- | Remove all elements of the set from the stack. Skip the currently focused
-- member. Return an indexed list of excluded elements and the modified stack.
-- Use 'stackMerge' to re-insert the elements using this list.
stackSplit :: (Num a, Enum a, Ord b) => W.Stack b -> S.Set b -> ([(a,b)],W.Stack b)
stackSplit (W.Stack x l r) s =
let (c,fl,tl) = split' (`S.member` s) 0 (reverse l)
(_,fr,tr) = split' (`S.member` s) (c+1) r
in (fl++fr,W.Stack x (reverse tl) tr)
-- | Inverse of 'stackSplit'. Given a list of elements and their original
-- indices, re-insert the elements into these same positions within the stack.
-- Skip the currently focused member. Works best if the stack's length hasn't
-- changed, though if shorter any leftover elements will be tacked on.
stackMerge :: (Ord a, Num a) => W.Stack b -> [(a,b)] -> W.Stack b
stackMerge (W.Stack x l r) il =
let (i,il1,l') = merge' 0 il (reverse l)
(_,il2,r') = merge' (i+1) il1 r
in W.Stack x (reverse l') (r' ++ map snd il2)

View File

@@ -0,0 +1,64 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.SwapWorkspaces
-- Copyright : (c) Devin Mullins <me@twifkak.com>
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Devin Mullins <me@twifkak.com>
-- Stability : unstable
-- Portability : unportable
--
-- Lets you swap workspace tags, so you can keep related ones next to
-- each other, without having to move individual windows.
--
-----------------------------------------------------------------------------
module XMonad.Actions.SwapWorkspaces (
-- * Usage
-- $usage
swapWithCurrent,
swapTo,
swapWorkspaces,
Direction1D(..)
) where
import XMonad (windows, X())
import XMonad.StackSet
import XMonad.Actions.CycleWS
import XMonad.Util.WorkspaceCompare
-- $usage
-- Add this import to your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.SwapWorkspaces
--
-- Then throw something like this in your keys definition:
--
-- > ++
-- > [((modm .|. controlMask, k), windows $ swapWithCurrent i)
-- > | (i, k) <- zip workspaces [xK_1 ..]]
--
-- After installing this update, if you're on workspace 1, hitting mod-ctrl-5
-- will swap workspaces 1 and 5.
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | Swaps the currently focused workspace with the given workspace tag, via
-- @swapWorkspaces@.
swapWithCurrent :: Eq i => i -> StackSet i l a s sd -> StackSet i l a s sd
swapWithCurrent t s = swapWorkspaces t (currentTag s) s
-- | Say @swapTo Next@ or @swapTo Prev@ to move your current workspace.
-- This is an @X ()@ so can be hooked up to your keybindings directly.
swapTo :: Direction1D -> X ()
swapTo dir = findWorkspace getSortByIndex dir AnyWS 1 >>= windows . swapWithCurrent
-- | Takes two workspace tags and an existing XMonad.StackSet and returns a new
-- one with the two corresponding workspaces' tags swapped.
swapWorkspaces :: Eq i => i -> i -> StackSet i l a s sd -> StackSet i l a s sd
swapWorkspaces t1 t2 = mapWorkspace swap
where swap w = if tag w == t1 then w { tag = t2 }
else if tag w == t2 then w { tag = t1 }
else w

View File

@@ -0,0 +1,199 @@
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Actions.TagWindows
-- Copyright : (c) Karsten Schoelzel <kuser@gmx.de>
-- License : BSD
--
-- Maintainer : Karsten Schoelzel <kuser@gmx.de>
-- Stability : unstable
-- Portability : unportable
--
-- Functions for tagging windows and selecting them by tags.
-----------------------------------------------------------------------------
module XMonad.Actions.TagWindows (
-- * Usage
-- $usage
addTag, delTag, unTag,
setTags, getTags, hasTag,
withTaggedP, withTaggedGlobalP, withFocusedP,
withTagged , withTaggedGlobal ,
focusUpTagged, focusUpTaggedGlobal,
focusDownTagged, focusDownTaggedGlobal,
shiftHere, shiftToScreen,
tagPrompt,
tagDelPrompt,
TagPrompt,
) where
import Data.List (nub,sortBy)
import Control.Monad
import Control.Exception as E
import XMonad.StackSet hiding (filter)
import XMonad.Prompt
import XMonad hiding (workspaces)
econst :: Monad m => a -> IOException -> m a
econst = const . return
-- $usage
--
-- To use window tags, import this module into your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Actions.TagWindows
-- > import XMonad.Prompt -- to use tagPrompt
--
-- and add keybindings such as the following:
--
-- > , ((modm, xK_f ), withFocused (addTag "abc"))
-- > , ((modm .|. controlMask, xK_f ), withFocused (delTag "abc"))
-- > , ((modm .|. shiftMask, xK_f ), withTaggedGlobalP "abc" W.sink)
-- > , ((modm, xK_d ), withTaggedP "abc" (W.shiftWin "2"))
-- > , ((modm .|. shiftMask, xK_d ), withTaggedGlobalP "abc" shiftHere)
-- > , ((modm .|. controlMask, xK_d ), focusUpTaggedGlobal "abc")
-- > , ((modm, xK_g ), tagPrompt def (\s -> withFocused (addTag s)))
-- > , ((modm .|. controlMask, xK_g ), tagDelPrompt def)
-- > , ((modm .|. shiftMask, xK_g ), tagPrompt def (\s -> withTaggedGlobal s float))
-- > , ((modWinMask, xK_g ), tagPrompt def (\s -> withTaggedP s (W.shiftWin "2")))
-- > , ((modWinMask .|. shiftMask, xK_g ), tagPrompt def (\s -> withTaggedGlobalP s shiftHere))
-- > , ((modWinMask .|. controlMask, xK_g ), tagPrompt def (\s -> focusUpTaggedGlobal s))
--
-- NOTE: Tags are saved as space separated strings and split with
-- 'unwords'. Thus if you add a tag \"a b\" the window will have
-- the tags \"a\" and \"b\" but not \"a b\".
--
-- For detailed instructions on editing your key bindings, see
-- "XMonad.Doc.Extending#Editing_key_bindings".
-- | set multiple tags for a window at once (overriding any previous tags)
setTags :: [String] -> Window -> X ()
setTags = setTag . unwords
-- | set a tag for a window (overriding any previous tags)
-- writes it to the \"_XMONAD_TAGS\" window property
setTag :: String -> Window -> X ()
setTag s w = withDisplay $ \d ->
io $ internAtom d "_XMONAD_TAGS" False >>= setTextProperty d w s
-- | read all tags of a window
-- reads from the \"_XMONAD_TAGS\" window property
getTags :: Window -> X [String]
getTags w = withDisplay $ \d ->
io $ E.catch (internAtom d "_XMONAD_TAGS" False >>=
getTextProperty d w >>=
wcTextPropertyToTextList d)
(econst [[]])
>>= return . words . unwords
-- | check a window for the given tag
hasTag :: String -> Window -> X Bool
hasTag s w = (s `elem`) `fmap` getTags w
-- | add a tag to the existing ones
addTag :: String -> Window -> X ()
addTag s w = do
tags <- getTags w
if (s `notElem` tags) then setTags (s:tags) w else return ()
-- | remove a tag from a window, if it exists
delTag :: String -> Window -> X ()
delTag s w = do
tags <- getTags w
setTags (filter (/= s) tags) w
-- | remove all tags
unTag :: Window -> X ()
unTag = setTag ""
-- | Move the focus in a group of windows, which share the same given tag.
-- The Global variants move through all workspaces, whereas the other
-- ones operate only on the current workspace
focusUpTagged, focusDownTagged, focusUpTaggedGlobal, focusDownTaggedGlobal :: String -> X ()
focusUpTagged = focusTagged' (reverse . wsToList)
focusDownTagged = focusTagged' wsToList
focusUpTaggedGlobal = focusTagged' (reverse . wsToListGlobal)
focusDownTaggedGlobal = focusTagged' wsToListGlobal
wsToList :: (Ord i) => StackSet i l a s sd -> [a]
wsToList ws = crs ++ cls
where
(crs, cls) = (cms down, cms (reverse . up))
cms f = maybe [] f (stack . workspace . current $ ws)
wsToListGlobal :: (Ord i) => StackSet i l a s sd -> [a]
wsToListGlobal ws = concat ([crs] ++ rws ++ lws ++ [cls])
where
curtag = currentTag ws
(crs, cls) = (cms down, cms (reverse . up))
cms f = maybe [] f (stack . workspace . current $ ws)
(lws, rws) = (mws (<), mws (>))
mws cmp = map (integrate' . stack) . sortByTag . filter (\w -> tag w `cmp` curtag) . workspaces $ ws
sortByTag = sortBy (\x y -> compare (tag x) (tag y))
focusTagged' :: (WindowSet -> [Window]) -> String -> X ()
focusTagged' wl t = gets windowset >>= findM (hasTag t) . wl >>=
maybe (return ()) (windows . focusWindow)
findM :: (Monad m) => (a -> m Bool) -> [a] -> m (Maybe a)
findM _ [] = return Nothing
findM p (x:xs) = do b <- p x
if b then return (Just x) else findM p xs
-- | apply a pure function to windows with a tag
withTaggedP, withTaggedGlobalP :: String -> (Window -> WindowSet -> WindowSet) -> X ()
withTaggedP t f = withTagged' t (winMap f)
withTaggedGlobalP t f = withTaggedGlobal' t (winMap f)
winMap :: (Window -> WindowSet -> WindowSet) -> [Window] -> X ()
winMap f tw = when (tw /= []) (windows $ foldl1 (.) (map f tw))
withTagged, withTaggedGlobal :: String -> (Window -> X ()) -> X ()
withTagged t f = withTagged' t (mapM_ f)
withTaggedGlobal t f = withTaggedGlobal' t (mapM_ f)
withTagged' :: String -> ([Window] -> X ()) -> X ()
withTagged' t m = gets windowset >>= filterM (hasTag t) . index >>= m
withTaggedGlobal' :: String -> ([Window] -> X ()) -> X ()
withTaggedGlobal' t m = gets windowset >>=
filterM (hasTag t) . concat . map (integrate' . stack) . workspaces >>= m
withFocusedP :: (Window -> WindowSet -> WindowSet) -> X ()
withFocusedP f = withFocused $ windows . f
shiftHere :: (Ord a, Eq s, Eq i) => a -> StackSet i l a s sd -> StackSet i l a s sd
shiftHere w s = shiftWin (currentTag s) w s
shiftToScreen :: (Ord a, Eq s, Eq i) => s -> a -> StackSet i l a s sd -> StackSet i l a s sd
shiftToScreen sid w s = case filter (\m -> sid /= screen m) ((current s):(visible s)) of
[] -> s
(t:_) -> shiftWin (tag . workspace $ t) w s
data TagPrompt = TagPrompt
instance XPrompt TagPrompt where
showXPrompt TagPrompt = "Select Tag: "
tagPrompt :: XPConfig -> (String -> X ()) -> X ()
tagPrompt c f = do
sc <- tagComplList
mkXPrompt TagPrompt c (mkComplFunFromList' sc) f
tagComplList :: X [String]
tagComplList = gets (concat . map (integrate' . stack) . workspaces . windowset) >>=
mapM getTags >>=
return . nub . concat
tagDelPrompt :: XPConfig -> X ()
tagDelPrompt c = do
sc <- tagDelComplList
if (sc /= [])
then mkXPrompt TagPrompt c (mkComplFunFromList' sc) (\s -> withFocused (delTag s))
else return ()
tagDelComplList :: X [String]
tagDelComplList = gets windowset >>= maybe (return []) getTags . peek

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