xmonad / xmonad-contrib

Contributed modules for xmonad
https://xmonad.org
BSD 3-Clause "New" or "Revised" License
584 stars 274 forks source link

Factor X.A.Cycle* modules; Write Alt+Tab style window switching #766

Closed LSLeary closed 1 year ago

LSLeary commented 1 year ago

Description

Note that I haven't tested these changes beyond seeing that they compile without warnings on GHC 8.8.4 and 9.2.4. I intend to do so, but I'll put it up here so others can also test or review it in the meantime, if they so wish. Commits follow:

Factor shared logic out of X.A.Cycle* modules

These modules were duplicating a substantial amount of low-level code.

X.A.CycleWorkspaceByScreen had already separated most of the implementation details from the logic with repeatableAction; all that was left was to generalise it a little further, put it in a suitable place and express the other modules through it.

Write new module: X.U.History

(for the below)

Write new module: X.A.MostRecentlyUsed

Alt+Tab style window switching. It can be pretty handy, and people are used to having it.

Given the existence of the other repeatable actions, it's quite a glaring omission.

Adjust X.A.Repeatable docs to mention X.A.MRU

Checklist

LSLeary commented 1 year ago

@slotThe And thank you for reviewing—@geekosaur too.

Re the multi-monitor thing, I'd thought about allowing the user to customise out greedyView for view, but I hadn't considered saving the screen in the history. It's a good idea, and it's not a difficult change, so I'll try it.

LSLeary commented 1 year ago

Due to the need to undo select changes and not just discard them all, it was a bit harder to write than I expected. Nevertheless, I like how it turned out. It might even work!

LSLeary commented 1 year ago

I was rebasing to erase conflicts so I went ahead and squashed the accumulated commits—this doesn't mean it's ready to merge; it still needs testing.

There was also one new commit, but the only actual changes were to make Location strict, improve the order and styling in undoer, and tweak the docs of withMostRecentlyUsed for accuracy.

slotThe commented 1 year ago

Just rebasted on top of master and tested everything again—works!