On Thu, Nov 02, 2006 at 11:01:06AM +0100, Gregor Horvath wrote:
> Hi,
> 
> I am a happy beginner user of the ion2 window manager. Thank's for the
> great work.
> I couldn't found on google an answer to the question if it is possible
> to show the name of the current workspace somewhere (I only found a
> script for Ion3).
> 
> I often have multiple workspaces associated with different domains e.g.
> "private", "programming project A", "programming project B", "support
> customer A" etc.
> 
> When I am browsing through them I often can't figure out immeditaly
> which domain I am currently seeing, because some domains have the same
> programs running. Is there a way to show the name, or is it possible
> that they have different colors?
> 
> Is there a way to rename the strings that's shown on the tabs of the
> programs?
> Is there a way to rename the workspace?

My solution to this is a modified version of statusbar_workspace.lua that
shows workspace names instead of numbers.

It is attached (because it is small).  I definitely found I got a lot more
productive after I had it.

        -Sean

-- 
__________________________________________________________________

Sean Dague                                       Mid-Hudson Valley
sean at dague dot net                            Linux Users Group
http://dague.net                                 http://mhvlug.org

There is no silver bullet.  Plus, werewolves make better neighbors
than zombies, and they tend to keep the vampire population down.
__________________________________________________________________
-- statusbar_workspace.lua
--
-- Show current workspace name or number in the statusbar.
-- 
-- Put any of these in cfg_statusbar.lua's template-line:
--  %workspace_name
--  %workspace_frame
--  %workspace_pager
--
-- This is an internal statusbar monitor and does NOT require
-- a dopath statement (effective after a 2006-02-12 build).
--
-- version 1
-- author: Rico Schiekel <fire at paranetic dot de>
--
-- version 2
-- added 2006-02-14 by Canaan Hadley-Voth:
--  * %workspace_pager shows a list of workspace numbers 
--    with the current one indicated:
--
--    1i  2i  [3f]  4p  5c
--
--    i=WIonWS, f=WFloatWS, p=WPaneWS, c=WClientWin/other
--
--  * %workspace_frame - name of the active frame.
--
--  * Added statusbar_ to the filename (since it *is*
--    an internal statusbar monitor) so that it works without
--    a "dopath" call.
--
--  * Removed timer.  Only needs to run on hook.
--    Much faster this way.
--

local function update_frame()
    local fr
    ioncore.defer( function() 
        local cur=ioncore.current()
        if obj_is(cur, "WClientWin") and
          obj_is(cur:parent(), "WMPlex") then
            cur=cur:parent()
        end
        fr=cur:name()
        mod_statusbar.inform('workspace_frame', fr)
        mod_statusbar.update()
    end)
end

local function update_workspace()
    local scr=ioncore.find_screen_id(0)
    local curws = scr:current()
    local nextws = scr:current()
    local prevws = scr:current()
    local wstype, c
    local pager=""
    local pager_txt=""
    local curindex = scr:get_index(curws)+1
    n = scr:lcount(1)

    if curindex==1 then
        nextws = scr:lnth(1, curindex)
        prevws = scr:lnth(1, n-1)
    elseif curindex==n then
        prevws = scr:lnth(1, curindex - 2)
        nextws = scr:lnth(1, 0)
    else
        nextws = scr:lnth(1, curindex)
        prevws = scr:lnth(1, curindex - 2)
    end

    for i=1,n do
        wstype=obj_typename(scr:lnth(1, i-1))
        if wstype=="WIonWS" then
            c="i"
        elseif wstype=="WFloatWS" then
            c="f"
        elseif wstype=="WPaneWS" then
            c="p"
        else
            c="c"
        end
        
        local curpage = scr:lnth(1, i-1)
        if i==curindex then
        pager_txt=pager_txt.."["..curpage:name().."]"
            pager=pager.." ["..(i)..c.."] "
        else
        pager_txt=pager_txt.." "..curpage:name().." "
            pager=pager.." "..(i)..c.." "
        end
    end

    local fr,cur

    -- Older versions without an ioncore.current() should
    -- skip update_frame.
    update_frame()

    ioncore.defer( function()
        mod_statusbar.inform('workspace_pager', pager_txt)
        mod_statusbar.inform('workspace_name', curws:name())

        mod_statusbar.inform('workspace_cur', curws:name())
        mod_statusbar.inform('workspace_cur_template', "xxxxxx")
        mod_statusbar.inform('workspace_next', nextws:name())
        mod_statusbar.inform('workspace_next_template', "xxxxxx")
        mod_statusbar.inform('workspace_prev', prevws:name())
        mod_statusbar.inform('workspace_prev_template', "xxxxxx")
        mod_statusbar.update()
    end)
end

ioncore.get_hook("region_activated_hook"):add(update_workspace)

Attachment: pgpLEVsbiXHZ1.pgp
Description: PGP signature

Reply via email to