HokieGeek / dotfiles

My linux config files
0 stars 0 forks source link

Dynamic workspace creation #15

Closed HokieGeek closed 9 years ago

HokieGeek commented 10 years ago

Ideal solution here: Mod + = Creates it if it doesn't exist and navigates to it Mod + n = Create a new workspace (and navigate there?) Current empty workspace is deleted when navigating away from it

HokieGeek commented 10 years ago
HokieGeek commented 10 years ago

Brainstorming on the AddNextWorkspace :: String function. This function should make addWorkspace :: String do most of the heavy lifting.

Basic algorithm:

addWorkspace head unusedWorkspaces
currentWorkspaces = currentWorkspaces ++ head unusedWorkspaces
unusedWorkspaces = tail unusedWorkspaces
HokieGeek commented 10 years ago

Brainstorming on the removal of empty workspaces: Need to modify the following to make use of removeEmptyWorkspaceAfter :: X()

            ++
            [((m .|. modm, k), windows $ f i)
                | (i, k) <- zip myWorkspaces myWorkspaceKeys
                , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

Whatever this does, it will probably need to do the following:

unusedWorkspaces = last currentWorkspaces : unusedWorkspaces
currentWorkspaces = init currentWorkspaces
HokieGeek commented 10 years ago

Looks like addWorkspace adds the new workspace to the front of the list, which is very lispy/haskelly but not the way humans think so you wind up with a weird discontinuity between the displayed workspaces and their keys. In other words, if I add 3 workspaces, I will access them by pressing 1, 2, or 3 on my keyboard, but they'll be displayed on the dzen bar as 3, 2, 1. sigh

Any way to force that list to be sorted, I wonder?

HokieGeek commented 10 years ago

Maybe a solution here would be to force dzen to display just a symbol - the same one - for each workspace, instead if its name

HokieGeek commented 10 years ago

How about using black circle (http://unicodelookup.com/#black circle/1) as the label to use for all of the workspaces?

HokieGeek commented 10 years ago

So, two potential ideas:

  1. Change all of the workspace names to be black circle. Would need to change explictly named workspaces with array item retrieval (eg. (myWorkspaces !! 1))
  2. Add ppCurrent/Visible/etc the symbol I want. Look at how ppLayout is commonly overwritten?
, ppLayout            =   dzenColor "#ebac54" "#161616" .
                                (\x -> case x of
                                    "ResizableTall"             ->      "^i(" ++ myBitmapsDir ++ "/tall.xbm)"
                                    "Mirror ResizableTall"      ->      "^i(" ++ myBitmapsDir ++ "/mtall.xbm)"
                                    "Full"                      ->      "^i(" ++ myBitmapsDir ++ "/full.xbm)"
                                    "Simple Float"              ->      "~"
                                    _                           ->      x
                                )

http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DynamicLog.html#v:dynamicLogWithPP

HokieGeek commented 10 years ago
ppSort = reverse getSortByIndex
HokieGeek commented 10 years ago

Will create an XBM dot (just copy unicode black circle? .... although maybe smaller would be better) and use that instead of a unicode character, since dzen is dumb.

dzenWorkspaceSymbol :: WorkspaceId -> String
dzenWorkspaceSymbol x = "^i($HOME/.xmonad/imgs/workspace.xbm)"
HokieGeek commented 10 years ago

Try this, instead:

      , ppOutput            =   hPutStrLn h    
}
where dzenWorkspaceSymbol x = "^i(\$HOME/.xmonad/imgs/workspace.xbm)"
HokieGeek commented 10 years ago

Ok, so next step: have the keys up top match up to a position in the list of known workspaces

So refactor this:

            ++            
             [((m .|. modm, k), windows $ f i)                
                   | (i, k) <- zip myWorkspaces myWorkspaceKeys                
                   , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

So that it goes back to doing something like this:

                   | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]

Could it be as easy as:

                   | (i, k) <- zip (XMonad.workspaces conf) myWorkspaceKeys

What would happen to the above if len(XMonad.workspaces conf) < len(myWorkspaceKeys)?

HokieGeek commented 10 years ago

I am currently really liking seeing all 12 desktops (as symbols) and won't focus so much on the JIT workspaces.

HokieGeek commented 10 years ago

This is interesting.

rotate [] = []
rotate (x:xs) = xs ++ [x]

rotate' = reverse . rotate . reverse

Maybe use it with the dzen log:

ppSort = rotate

Take a look at this:

HokieGeek commented 10 years ago

Ok, so the thing above is dumb, what I need is something more like this:

addSpecialWorkspace :: X()
addSpecialWorkspace n = addWorkspace n >> rotate [WORKSPACES]
HokieGeek commented 9 years ago

I might, at some point, come back to this. But after months of using Xmonad, I'm not really seeing a need for this. If I do come back to this, it'll be as an exercise in learning to write in Haskell.