mirror of https://github.com/polybar/polybar.git
remove xmonad, its moved to polybar-scripts
parent
f0673339ca
commit
89a0f01171
|
@ -581,66 +581,3 @@ interval = 3
|
||||||
click-left = claudius &
|
click-left = claudius &
|
||||||
click-right = pkill -f claudius
|
click-right = pkill -f claudius
|
||||||
```
|
```
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
|
|
||||||
# XMonad
|
|
||||||
![](https://i.imgur.com/fsZd7gW.png)
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
This plugin contains two modules, one for displaying workspaces and one for displaying title of current window. The communication between XMonad and polybar is done by named pipes to achieve speed and memory efficiency.
|
|
||||||
|
|
||||||
## Module
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[module/xmonad-workspaces]
|
|
||||||
type = custom/script
|
|
||||||
exec = tail -F /tmp/.xmonad-workspace-log
|
|
||||||
exec-if = [ -p /tmp/.xmonad-workspace-log ]
|
|
||||||
tail = true
|
|
||||||
|
|
||||||
[module/xmonad-title]
|
|
||||||
type = custom/script
|
|
||||||
exec = tail -F /tmp/.xmonad-title-log
|
|
||||||
exec-if = [ -p /tmp/.xmonad-title-log ]
|
|
||||||
tail = true
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
Edit `~/.xmonad/xmonad.hs`:
|
|
||||||
|
|
||||||
```haskell
|
|
||||||
import Data.List (sortBy)
|
|
||||||
import Data.Function (on)
|
|
||||||
import Control.Monad (forM_, join)
|
|
||||||
import qualified XMonad.StackSet as W
|
|
||||||
|
|
||||||
main = do
|
|
||||||
forM_ [".xmonad-workspace-log", ".xmonad-title-log"] $ \file -> do
|
|
||||||
safeSpawn "mkfifo" ["/tmp/" ++ file]
|
|
||||||
|
|
||||||
let myConf = def
|
|
||||||
{ ...
|
|
||||||
, logHook = eventLogHook
|
|
||||||
, ...
|
|
||||||
}
|
|
||||||
|
|
||||||
eventLogHook = do
|
|
||||||
winset <- gets windowset
|
|
||||||
title <- maybe (return "") (fmap show . getName) . W.peek $ winset
|
|
||||||
let currWs = W.currentTag winset
|
|
||||||
let wss = map W.tag $ W.workspaces winset
|
|
||||||
let wsStr = join $ map (fmt currWs) $ sort' wss
|
|
||||||
|
|
||||||
io $ appendFile "/tmp/.xmonad-title-log" (title ++ "\n")
|
|
||||||
io $ appendFile "/tmp/.xmonad-workspace-log" (wsStr ++ "\n")
|
|
||||||
|
|
||||||
where fmt currWs ws
|
|
||||||
| currWs == ws = "[" ++ ws ++ "]"
|
|
||||||
| otherwise = " " ++ ws ++ " "
|
|
||||||
sort' = sortBy (compare `on` (!! 0))
|
|
||||||
```
|
|
||||||
|
|
||||||
You may adjust `eventLogHook` according to your preferences.
|
|
Loading…
Reference in New Issue