You are not logged in.
Hello,
I'd like to get xmobar to display a window list, but I can't find any information on how to do so. Does anyone here know if it is possible; and if so, can direct me to an example or documentation on how to achive this?
Offline
By window list, do you mean a list of all the open windows on a particular workspace similar to the gnome window list? The closest thing I can think of will only get you a piece of that: the title of the currently focused window. See the xmobar config section of John Goerzen's Configuration page at the XMonad wiki for some examples and screenshots.
I am only a beginner with XMonad and I'm even greener with Haskell, so there almost definitely is a way which I do not know to do what you are asking about–although it probably won't be clickable; dzen is better suited for clickable bars. A good place to start if you feel like really getting to know your way around XMonad is to experiment with some of the example configurations on their wiki and referencing the XMonad.Doc.Extending page when you are lost.
Good luck!
Offline
I've no idea if xmobar can do it, but if you use XMonad.Hooks.EwmhDesktops, then you can choose from all open windows with
wmctrl -a "$(wmctrl -l | awk '{print $4}' | dmenu)"This might be a way to put something into a clickable area in dzen.
Offline
By window list, do you mean a list of all the open windows on a particular workspace similar to the gnome window list?
Yes, except I don't really need them clickable. If they were, that would be great. I know xmonad has a tabbed layout, but I can't figure out how to shrink the tab bar, so I can use another bar to put a clock on it.
wmctrl -a "$(wmctrl -l | awk '{print $4}' | dmenu)"
I will give something like this a whirl with dzen2. I'll have to use some string magic to format it properly tho, as it ends the line after each window name.
Offline
Welcome to the forums clockworksavior.
dzen2 will happily do what you need it to do. ppTitle is what you need for basic window lists. There's some good documentation that comes with xmonad-contrib, as well as two very long threads here that may be helpful:
https://bbs.archlinux.org/viewtopic.php?id=40636
https://bbs.archlinux.org/viewtopic.php?pid=304851
Last edited by skottish (2011-07-29 01:11:11)
Offline
Thank you.
I looked at the documentation for xmonad-contrib, and ppTitle looks to be only for the current window. The examples in the two threads you posted look like reformatting colors and such for the current window title.
Offline
Thank you.
I looked at the documentation for xmonad-contrib, and ppTitle looks to be only for the current window. The examples in the two threads you posted look like reformatting colors and such for the current window title.
Errr... whoops. Another +1, -1 post for me. Yes, wmctrl...
*** skottish walks away quietly hoping that no one is reading the forums right now ***
Offline
Here is what I ended up with.
#!/bin/sh
while true
SCREEN_WIDTH=1024
DATE=`date "+%D %r"`
i=0
do
# build the windowlist
for window in $(wmctrl -l -x | awk '{print $3}' | sed -e s/^[^.]*.//)
do
windowlist="$windowlist $i: $window"
i=$(($i + 1))
done
# chop some of the windowlist off so the date and clock are not covered
windowlist=`echo "$windowlist" | cut -c -$(expr $SCREEN_WIDTH / 8 - 8)`
# if the windowlist is too short, insert spaces to push the date and clock to the end
if printf ${#windowlist} -le 1003; then
for i in $(seq `expr $SCREEN_WIDTH / 8 - ${#windowlist} - 8`);do windowlist="$windowlist ";done
fi
# print the windowlist, padding, date, and clock
echo -n "$windowlist $padding $DATE"
# clear the windowlist
windowlist=""
echo
sleep 1
doneLast edited by clockworksavior (2011-07-29 19:03:21)
Offline
Hi,
I've written custom logger which returns string with list of all window titles and allows you to format current window title:
(Caution - I'm newbie haskeller so for sure it can be written in less imperative manner :-P !)
import Control.Monad (liftM, sequence)
logTitles :: (String -> String) -> Logger
logTitles ppFocus =
let
windowTitles windowset = sequence (map (fmap showName . getName) (W.index windowset))
where
fw = W.peek windowset
showName nw =
let
window = unName nw
name = show nw
in
if maybe False (== window) fw
then
ppFocus name
else
name
in
withWindowSet $ liftM (Just . (intercalate " | ")) . windowTitlesYou can use it in your dynamicLog configuration (I think it's also better to drop window title from ppOrder):
main = do
...
, logHook = dynamicLogWithPP $ xmobarPP {
...
, ppExtras = [logTitles (xmobarColor "green" "")]
, ppOrder = \(ws:l:t:e) -> [ws, l] ++ e
}
...Last edited by paluh (2012-05-11 10:38:29)
Offline
Thanks paluh, I've just tried out your custom logger and it seems to work well. For the benefit of anyone else wanting to try it, I had to import some extra things to get it working:
import Control.Monad (liftM, sequence)
import XMonad.Util.NamedWindows (getName, unName)
import XMonad.Util.Loggers
import qualified XMonad.StackSet as W
import Data.List (intercalate)Edit: I also added "shorten 50" to truncate long window names in the list, updated code below: (see the "name = shorten 50 (show nw)" line)
logTitles :: (String -> String) -> Logger
logTitles ppFocus =
let
windowTitles windowset = sequence (map (fmap showName . getName) (W.index windowset))
where
fw = W.peek windowset
showName nw =
let
window = unName nw
name = shorten 50 (show nw)
in
if maybe False (== window) fw
then
ppFocus name
else
name
in
withWindowSet $ liftM (Just . (intercalate " | ")) . windowTitlesI've been doing Haskell for approximately an afternoon, so hopefully I've not made a complete fool of myself with that edit
Don't blame me if it makes your monitor explode or something.
Last edited by caolan (2012-07-22 23:33:32)
Offline
For the benefit of anyone else wanting to try it, I had to import some extra things to get it working
Great!
I've been doing Haskell for approximately an afternoon, so hopefully I've not made a complete fool of myself with that edit
Don't blame me if it makes your monitor explode or something.
It looks OK for me ;-)
Thanks
Offline