Closed HokieGeek closed 8 years ago
dzenWorkspaceSymbol :: WorkspaceId -> String
dzenWorkspaceSymbol x
| useWorkspaceName = x
| otherwise = "^i(/home/andres/.xmonad/imgs/workspace.xbm)"
-- "^i(\\$HOME/.xmonad/imgs/workspace.xbm)"
And then, I need something like this:
, ((modm, xK_F1), useWorkspaceName = !useWorkspaceName)
Until I figure out how to use not
correctly with this language, the following might suffice:
, ((modm, xK_F1), useWorkspaceName = True)
, ((modm, xK_F2), useWorkspaceName = False)
toggle v = do
t' <- readIORef v
writeIORef v (not t')
BETTER
toggle v = readIORef v >>= \v' -> (writeIORef v) (not v')
So I need the following snippets:
userWorkspaceName <- newIORef False
, ((0, xK_F2), toggle useWorkspaceName)
An example of calling toggle:
toggleTest = do
tester <- newIORef False
readIORef tester >>= print
toggle tester
readIORef tester >>= print
Assuming that I figure out a way for useWorkspaceName
to be in scope:
getDzenWorkspaceSymbol :: Bool -> WorkspaceId -> String
getDzenWorkspaceSymbol wsname id
| wsname = id
| otherwise = "^i(/home/andres/.xmonad/imgs/workspace.xbm)"
dzenWorkspaceSymbol id = readIORef useWorkspaceName >>= \uwn' -> getDzenWorkspaceSymbol uwn' id
dzenWorkspaceSymbol :: WorkspaceId -> String
dzenWorkspaceSymbol id
| useWorkspaceName' = id
| otherwise = "^i(/home/andres/.xmonad/imgs/workspace.xbm)"
where useWorkspaceName' <- readIORef useWorkspaceName
This seems very non-idiomatic
I want the default to be the symbols, but it would be nice - at least while I adjust to it - to be able to toggle, with a key binding, between symbols and the workspace names.