LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   [solved] XMonad translate workspace switching to emacs-style keybind syntax (https://www.linuxquestions.org/questions/linux-desktop-74/%5Bsolved%5D-xmonad-translate-workspace-switching-to-emacs-style-keybind-syntax-4175429601/)

Siljrath 09-29-2012 09:14 AM

[solved] XMonad translate workspace switching to emacs-style keybind syntax
 
additionalKeysP from EZConfig, is really nice for cleaning up and sweetening xmonad.hs. also expands keybind paradigms, opening up way more possibilities.

however, i am stuck without move and switch to workspace.

i tried figuring this out from reading about XMonad.Util.EZConfig, but i'm not quite getting it.


as lifted from default example xmonad.hs i found on my other computer:
Code:

    ++

    --
    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    --
    [((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
    ++

    --
    -- 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
    --
    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

i have the rest of it easily translated, and have been using the short format for many more keybinds for use with other extensions, but i still have not figured out how to translate the workspace/screen switching/moving portion.

anyone know how to get me a "M-[1-9]" sort of switching keybind setup?

Siljrath 09-29-2012 02:20 PM

-- (2012-09-29 15:14:37) dr_bs:
zip (map (\x -> fst x++[snd x]) ((zip (repeat "M-") (['1'..'9'])))) (map (withNthWorkspace W.greedyView) [0..])

-- and extrapolated to also have move window to workspace in emacs keybind format:
zip (map (\x -> fst x++[snd x]) ((zip (repeat "M-S-") (['1'..'9'])))) (map (withNthWorkspace W.shift) [0..])


All times are GMT -5. The time now is 07:40 AM.