[XMonad] Set tag names instead of workspace names
This commit is contained in:
parent
2eb8bcd440
commit
c726b6d56a
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE TypeSynonymInstances, MultiParamTypeClasses #-}
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import qualified Data.ByteString.Lazy as B
|
import qualified Data.ByteString.Lazy as B
|
||||||
@ -13,13 +14,13 @@ import Text.Printf
|
|||||||
import XMonad hiding ( (|||) )
|
import XMonad hiding ( (|||) )
|
||||||
import XMonad.Actions.CycleWS
|
import XMonad.Actions.CycleWS
|
||||||
import XMonad.Actions.WindowBringer
|
import XMonad.Actions.WindowBringer
|
||||||
import XMonad.Actions.WorkspaceNames
|
|
||||||
import XMonad.Config ()
|
import XMonad.Config ()
|
||||||
import XMonad.Hooks.EwmhDesktops
|
import XMonad.Hooks.EwmhDesktops
|
||||||
import XMonad.Hooks.ManageDocks
|
import XMonad.Hooks.ManageDocks
|
||||||
import XMonad.Hooks.FadeInactive
|
import XMonad.Hooks.FadeInactive
|
||||||
import XMonad.Layout.BoringWindows
|
import XMonad.Layout.BoringWindows
|
||||||
import XMonad.Layout.LayoutCombinators
|
import XMonad.Layout.LayoutCombinators
|
||||||
|
import XMonad.Layout.LayoutModifier
|
||||||
import XMonad.Layout.Minimize
|
import XMonad.Layout.Minimize
|
||||||
import XMonad.Layout.MultiColumns
|
import XMonad.Layout.MultiColumns
|
||||||
import XMonad.Layout.MultiToggle
|
import XMonad.Layout.MultiToggle
|
||||||
@ -38,8 +39,7 @@ getClass w = do
|
|||||||
myDecorateName ws w = do
|
myDecorateName ws w = do
|
||||||
name <- show <$> getName w
|
name <- show <$> getName w
|
||||||
classTitle <- getClass w
|
classTitle <- getClass w
|
||||||
workspaceToName <- getWorkspaceNames
|
return $ printf "%-20s%-20s%+15s" classTitle (take 20 name) "in " ++ W.tag ws
|
||||||
return $ printf "%-20s%-40s %+30s" classTitle (take 40 name) "in " ++ workspaceToName (W.tag ws)
|
|
||||||
|
|
||||||
myWindowBringerConfig = WindowBringerConfig { menuCommand = "rofi"
|
myWindowBringerConfig = WindowBringerConfig { menuCommand = "rofi"
|
||||||
, menuArgs = ["-dmenu", "-i"]
|
, menuArgs = ["-dmenu", "-i"]
|
||||||
@ -65,13 +65,14 @@ main = xmonad $ ewmh $ pagerHints def
|
|||||||
|
|
||||||
myLogHook = fadeInactiveLogHook 0.9
|
myLogHook = fadeInactiveLogHook 0.9
|
||||||
|
|
||||||
setWorkspaceNameToFocusedWindow workspace = do
|
setWorkspaceNameToFocusedWindow workspace = do
|
||||||
namedWindows <- mapM getClass $ take 2 $ W.integrate' $ W.stack workspace
|
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
|
||||||
workspaceToName <- getWorkspaceNames
|
|
||||||
renamedWindows <- remapNames namedWindows
|
renamedWindows <- remapNames namedWindows
|
||||||
let newName = intercalate "|" namedWindows
|
let newName = intercalate "|" renamedWindows
|
||||||
when (workspaceToName (W.tag workspace) /= newName) $
|
currentName = W.tag workspace
|
||||||
setWorkspaceName (W.tag workspace) (intercalate "|" renamedWindows)
|
when (currentName /= newName) $ do
|
||||||
|
windows $ W.renameTag currentName newName
|
||||||
|
spawn $ "update_xmonad_stamp.sh " ++ currentName ++ " new:" ++ newName ++ " " ++ "old:"
|
||||||
|
|
||||||
remapNames namedWindows = do
|
remapNames namedWindows = do
|
||||||
remap <- io getClassRemap
|
remap <- io getClassRemap
|
||||||
@ -81,12 +82,20 @@ setWorkspaceNames = do
|
|||||||
ws <- gets windowset
|
ws <- gets windowset
|
||||||
mapM_ setWorkspaceNameToFocusedWindow (W.workspaces ws)
|
mapM_ setWorkspaceNameToFocusedWindow (W.workspaces ws)
|
||||||
|
|
||||||
|
data WorkspaceNamesHook a = WorkspaceNamesHook deriving (Show, Read)
|
||||||
|
|
||||||
|
instance LayoutModifier WorkspaceNamesHook Window where
|
||||||
|
hook _ = setWorkspaceNames
|
||||||
|
|
||||||
|
workspaceNamesHook = ModifiedLayout WorkspaceNamesHook
|
||||||
|
|
||||||
shiftThenView i = W.greedyView i . W.shift i
|
shiftThenView i = W.greedyView i . W.shift i
|
||||||
|
|
||||||
layouts = multiCol [1, 1] 2 0.01 (-0.5) ||| Full ||| Tall 1 (3/100) (1/2)
|
layouts = multiCol [1, 1] 2 0.01 (-0.5) ||| Full ||| Tall 1 (3/100) (1/2)
|
||||||
|
|
||||||
myLayoutHook = avoidStruts . smartSpacing 10 . noBorders . minimize
|
myLayoutHook = avoidStruts . smartSpacing 10 . noBorders . minimize .
|
||||||
. boringWindows . mkToggle (MIRROR ?? EOT) $ layouts
|
boringWindows . mkToggle (MIRROR ?? EOT) . workspaceNamesHook
|
||||||
|
$ layouts
|
||||||
|
|
||||||
myStartup = spawn "systemctl --user start wm.target"
|
myStartup = spawn "systemctl --user start wm.target"
|
||||||
|
|
||||||
@ -103,6 +112,7 @@ addKeys conf@XConfig {modMask = modm} =
|
|||||||
, ((modm, xK_slash), sendMessage $ Toggle MIRROR)
|
, ((modm, xK_slash), sendMessage $ Toggle MIRROR)
|
||||||
, ((modm, xK_m), withFocused minimizeWindow)
|
, ((modm, xK_m), withFocused minimizeWindow)
|
||||||
, ((modm .|. shiftMask, xK_m), sendMessage RestoreNextMinimizedWin)
|
, ((modm .|. shiftMask, xK_m), sendMessage RestoreNextMinimizedWin)
|
||||||
|
, ((modm, xK_x), setWorkspaceNames)
|
||||||
|
|
||||||
-- Hyper bindings
|
-- Hyper bindings
|
||||||
, ((mod3Mask, xK_1), setWorkspaceNames)
|
, ((mod3Mask, xK_1), setWorkspaceNames)
|
||||||
|
Loading…
Reference in New Issue
Block a user