Nothing Special   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polybar modules title-xmonad and workspaces-xmonad not appearing #459

Open
rainer2208 opened this issue Jun 24, 2023 · 0 comments
Open

Polybar modules title-xmonad and workspaces-xmonad not appearing #459

rainer2208 opened this issue Jun 24, 2023 · 0 comments

Comments

@rainer2208
Copy link

I am on Arch Linux and using xmonad for a little while now, after working with awesomewm, i3 and leftwm.

I am trying to build my polybar and am quite suceessful, the only two modules that are do not appear are title-xmonad and workspaces-xmonad.

The simple xmonad module I am adding like this to my config.ini :

[module/xmonad]
type = custom/script
exec = xmonad-log
tail = true

This part works okay.

Now I found two more polybar modules on the polybar website that I wanted to check out: title-xmonad and workspaces-xmonad .
As suggested by the site, I am adding the Haskell code to my xmonad.hs like this :

import Data.Function (on)
import Control.Monad (forM_, join)
import XMonad.Util.Run (safeSpawn)
import XMonad.Util.NamedWindows (getName)
import qualified XMonad.StackSet as W


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))

main = do
    forM_ [".xmonad-workspace-log", ".xmonad-title-log"] $ \file -> do
    safeSpawn "mkfifo" ["/tmp/" ++ file]

    dbus <- D.connectSession
    -- Request access to the DBus name
    D.requestName dbus (D.busName_ "org.xmonad.Log")
        [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue]

    xmonad $ewmh $ docks $ defaults { logHook = dynamicLogWithPP (myLogHook dbus) }

defaults = def{
   ..........
    , startupHook = myStartupHook
    , logHook         = eventLogHook
    }

To my config.ini , I add the following :


[module/workspaces-xmonad]
type = custom/script
exec = tail -F /tmp/.xmonad-workspace-log
exec-if = [ -p /tmp/.xmonad-workspace-log ]
tail = true

[module/title-xmonad]
type = custom/script
exec = tail -F /tmp/.xmonad-title-log
exec-if = [ -p /tmp/.xmonad-title-log ]
tail = true

And what appears on the polybar is ............................... nothing. :-(

Compilation with xmonad --recompile and x-monad --restart does not return any errors.

I have installed almost every package that hat xmonad in it, like xomonad-dbus and arcolinux-xmonad-polybar ....

Any hints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant