[XMonad] Remove dynamic workspace naming

This commit is contained in:
Ivan Malison 2017-01-31 04:14:07 -08:00
parent 55071ede05
commit 73c79ef656
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -27,7 +27,6 @@ import XMonad.Actions.Minimize
import XMonad.Actions.UpdatePointer import XMonad.Actions.UpdatePointer
import XMonad.Actions.WindowBringer import XMonad.Actions.WindowBringer
import XMonad.Actions.WindowGo import XMonad.Actions.WindowGo
import XMonad.Actions.WorkspaceNames
import XMonad.Config () import XMonad.Config ()
import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.FadeInactive import XMonad.Hooks.FadeInactive
@ -57,11 +56,9 @@ import XMonad.Util.NamedScratchpad
(NamedScratchpad(NS), nonFloating, namedScratchpadAction) (NamedScratchpad(NS), nonFloating, namedScratchpadAction)
import XMonad.Util.NamedWindows (getName) import XMonad.Util.NamedWindows (getName)
myGetWorkspaceNameFromTag getWSName tag =
printf "%s: %s " tag (fromMaybe "(Empty)" (getWSName tag))
main = main =
xmonad . docks $ def xmonad . docks . pagerHints . ewmh $
def
{ modMask = mod4Mask { modMask = mod4Mask
, terminal = "urxvt" , terminal = "urxvt"
, manageHook = myManageHook <+> manageHook def , manageHook = myManageHook <+> manageHook def
@ -70,13 +67,11 @@ main =
, normalBorderColor = "#000000" , normalBorderColor = "#000000"
, focusedBorderColor = "#455a64" , focusedBorderColor = "#455a64"
, logHook = , logHook =
updatePointer (0.5, 0.5) (0, 0) +++ toggleFadeInactiveLogHook 0.9 +++ updatePointer (0.5, 0.5) (0, 0) +++
ewmhWorkspaceNamesLogHook' myGetWorkspaceNameFromTag +++ toggleFadeInactiveLogHook 0.9
(myGetWorkspaceNameFromTag <$> getWorkspaceNames' >>= pagerHintsLogHookCustom) , handleEventHook =
, handleEventHook = fullscreenEventHook +++ fullscreenEventHook +++ followIfNoMagicFocus +++ minimizeEventHook
ewmhDesktopsEventHook +++ pagerHintsEventHook +++ , startupHook = myStartup
followIfNoMagicFocus +++ minimizeEventHook
, startupHook = myStartup +++ ewmhWorkspaceNamesLogHook
, keys = customKeys (const []) addKeys , keys = customKeys (const []) addKeys
} }
where where
@ -159,7 +154,7 @@ htopCommand = "urxvt -e htop"
transmissionCommand = "transmission-gtk" transmissionCommand = "transmission-gtk"
volumeCommand = "pavucontrol" volumeCommand = "pavucontrol"
keepassCommand = "systemctl --user restart keepassx.service" keepassCommand = "systemctl --user restart keepassx.service"
taffybarCommand = "systemctl --user restart taffybar.service" taffybarCommand = "restart_taffybar.sh"
-- Startup hook -- Startup hook
@ -329,36 +324,6 @@ myBringWindow WindowBringerConfig { menuCommand = cmd
, windows $ W.focusWindow window . bringWindow window , windows $ W.focusWindow window . bringWindow window
] ]
-- Dynamic Workspace Renaming
windowClassFontAwesomeFile =
fmap (</> ".lib/resources/window_class_to_fontawesome.json") getHomeDirectory
getClassRemap =
fmap (fromMaybe M.empty . decode) $
windowClassFontAwesomeFile >>= B.readFile
getClassRemapF = flip maybeRemap <$> getClassRemap
getWSClassNames' w = mapM getClass $ W.integrate' $ W.stack w
getWSClassNames w = io (fmap map getClassRemapF) <*> getWSClassNames' w
currentWSName ws = fromMaybe "" <$> (getWorkspaceNames' <*> pure (W.tag ws))
desiredWSName = (intercalate "|" <$>) . getWSClassNames
setWorkspaceNameToFocusedWindow workspace = do
currentName <- currentWSName workspace
newName <- desiredWSName workspace
when (currentName /= newName) $ setWorkspaceName (W.tag workspace) newName
setWorkspaceNames =
gets windowset >>= mapM_ setWorkspaceNameToFocusedWindow . W.workspaces
data WorkspaceNamesHook a = WorkspaceNamesHook deriving (Show, Read)
instance LayoutModifier WorkspaceNamesHook Window where
hook _ = setWorkspaceNames
workspaceNamesHook = ModifiedLayout WorkspaceNamesHook
-- Toggleable fade -- Toggleable fade
newtype ToggleFade a = newtype ToggleFade a =
@ -681,6 +646,7 @@ addKeys conf@XConfig {modMask = modm} =
, ((modm, xK_z), shiftToNextScreenX) , ((modm, xK_z), shiftToNextScreenX)
, ((modm .|. shiftMask, xK_z), shiftToEmptyNextScreen) , ((modm .|. shiftMask, xK_z), shiftToEmptyNextScreen)
, ((modm .|. shiftMask, xK_h), shiftToEmptyAndView) , ((modm .|. shiftMask, xK_h), shiftToEmptyAndView)
-- These need to be rebound to support boringWindows -- These need to be rebound to support boringWindows
, ((modm, xK_j), focusDown) , ((modm, xK_j), focusDown)
, ((modm, xK_k), focusUp) , ((modm, xK_k), focusUp)