aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-04-14 12:11:45 -0600
committerJosh Rahm <rahm@google.com>2022-04-14 12:11:45 -0600
commit0992b3df262c9ac91cc87133bd451ddcd4fcc6ad (patch)
tree5190083da7446ab50808429d261d5725af719bec /src/Rahm/Desktop
parent3cc28186cd3ab934e29c4864f7c6b074475906a1 (diff)
downloadrde-0992b3df262c9ac91cc87133bd451ddcd4fcc6ad.tar.gz
rde-0992b3df262c9ac91cc87133bd451ddcd4fcc6ad.tar.bz2
rde-0992b3df262c9ac91cc87133bd451ddcd4fcc6ad.zip
Minor changes
Diffstat (limited to 'src/Rahm/Desktop')
-rw-r--r--src/Rahm/Desktop/Keys.hs36
-rw-r--r--src/Rahm/Desktop/Workspaces.hs13
2 files changed, 34 insertions, 15 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index 6e16c25..1bf1b2f 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -269,17 +269,18 @@ keymap = runKeys $ do
let selectWorkspace :: (KeySym, String) -> Maybe (X WorkspaceId)
selectWorkspace s = case s of
(_, [ch]) | isAlphaNum ch || ch == '*' -> Just $ return [ch]
- (_, "]") -> Just $ adjacentWorkspace next =<< getCurrentWorkspace
- (_, "[") -> Just $ adjacentWorkspace prev =<< getCurrentWorkspace
+ (_, "]") -> Just $ adjacentWorkspaceNotVisible next
+ =<< getCurrentWorkspace
+ (_, "[") -> Just $ adjacentWorkspaceNotVisible prev
+ =<< getCurrentWorkspace
+ (_, ")") -> Just $ adjacentWorkspace next =<< getCurrentWorkspace
+ (_, "(") -> Just $ adjacentWorkspace prev =<< getCurrentWorkspace
(_, "}") -> Just $ adjacentScreen next
(_, "{") -> Just $ adjacentScreen prev
(_, "^") -> Just firstWorkspaceId
(_, "$") -> Just lastWorkspaceId
- (_, "/") -> Just $ do
- cur <- getCurrentWorkspace
- fromMaybe cur <$> runMaybeT (do
- windowId <- MaybeT askWindowId
- MaybeT $ workspaceWithWindow windowId)
+ (_, "/") -> Just $ fromMaybe <$> getCurrentWorkspace <*> runMaybeT (
+ (MaybeT . workspaceWithWindow) =<< MaybeT askWindowId)
(_, " ") -> Just $ accompaningWorkspace <$> getCurrentWorkspace
_ -> Nothing
@@ -289,9 +290,11 @@ keymap = runKeys $ do
\Workspaces are alphanumeric characters. So if the next key typed is an\n\t\
\alphanumeric character, that's the workspace to operate on\n\n\
- \The following special characters can also reference workspaces:\n\t\t\
- \]: The next non-visible workspace\n\t\t\
- \[: The previous non-visible workspace\n\t\t\
+ \\tThe following special characters can also reference workspaces:\n\t\t\
+ \]: The next workspace, skipping those already visible.\n\t\t\
+ \[: The previous workspace, skipping those already visible.\n\t\t\
+ \): The next workspace.\n\t\t\
+ \(: The previous workspace.\n\t\t\
\}: The workspace on the screen to the right\n\t\t\
\{: The workspace on the screen to the left\n\t\t\
\<space>: The accompaningWorkspace (toggled case)\n\t\t\
@@ -299,8 +302,9 @@ keymap = runKeys $ do
\^: The first populated workspace\n\t\t\
\$: The last populated workspace\n\t\t\
\*: The hidden workspace.\n\t\t\
- \_: Black hole. Sending a window here closes it.\n\t\t\
- \F1: display this help.\n" $
+ \_: Black hole. Sending a window here closes it.\n\n\t\
+ \Other keybindings starting with H-g\n\t\t\
+ \F1: display this help.\n\n\t" $
mapNextStringWithKeysym $ \_ keysym str ->
case ((keysym, str), selectWorkspace (keysym, str)) of
(_, Just w) -> pushHistory $ gotoWorkspace =<< w
@@ -725,6 +729,14 @@ mouseMap = runButtons $ do
bind button2 $ noMod $ windows . W.sink
bind button3 $ noMod mouseResizeWindow
+ let swapButtons = [
+ (button6, windows W.swapDown),
+ (button7, windows W.swapUp)
+ ]
+
+ forM_ (map fst swapButtons) $ \b ->
+ bind b $ noMod $ \w -> click >> (continuous swapButtons b) w
+
bind button13 $ noMod $ subMouse $ do
bind button13 $ noMod $ subMouse $ do
bind button13 $ noMod $ noWindow $ spawnX "xsecurelock"
diff --git a/src/Rahm/Desktop/Workspaces.hs b/src/Rahm/Desktop/Workspaces.hs
index 2a266b7..1349fea 100644
--- a/src/Rahm/Desktop/Workspaces.hs
+++ b/src/Rahm/Desktop/Workspaces.hs
@@ -113,8 +113,8 @@ swapWorkspace toWorkspace = do
| t' == toWorkspace = W.Workspace fromWorkspace l s
| otherwise = ws
-adjacentWorkspace :: Selector -> WorkspaceId -> X WorkspaceId
-adjacentWorkspace (Selector selector) from =
+adjacentWorkspaceNotVisible :: Selector -> WorkspaceId -> X WorkspaceId
+adjacentWorkspaceNotVisible (Selector selector) from =
withWindowSet $ \ss ->
let tags = sort $
W.tag . snd <$> filter (\x -> fst x /= Visible) (
@@ -122,9 +122,16 @@ adjacentWorkspace (Selector selector) from =
in
return $ fromMaybe from $ selector (==from) tags
+adjacentWorkspace :: Selector -> WorkspaceId -> X WorkspaceId
+adjacentWorkspace (Selector selector) from =
+ withWindowSet $ \ss ->
+ let tags = sort $ W.tag . snd <$> getPopulatedWorkspaces ss
+ in
+ return $ fromMaybe from $ selector (==from) tags
+
viewAdjacent :: Selector -> X ()
viewAdjacent sel =
- gotoWorkspace =<< (adjacentWorkspace sel =<< getCurrentWorkspace)
+ gotoWorkspace =<< (adjacentWorkspaceNotVisible sel =<< getCurrentWorkspace)
adjacentScreen :: Selector -> X WorkspaceId
adjacentScreen (Selector f) = do