herbstluftwm / herbstluftwm

A manual tiling window manager for X11
http://herbstluftwm.org/
Other
1.09k stars 69 forks source link

How to show name of the tabs of the max layout in the panel/bar? #1579

Open QiangF opened 4 months ago

QiangF commented 4 months ago

There are many good panels, such as xfce4-panel, lxqt-panel. Most people use panel to show window titles of the current desktop/tag, for such a purpose the tab bar in max layout is a duplicate. It is quite wasteful of screen area for small displays. I am wondering if the following can be easily done:

  1. hide the tabs in max layout
  2. only show tab names of current frame in the panel (make a frame like a virtual desktop?)
t-wissmann commented 4 months ago

Hi, if I understand you correctly, then you simply need

herbstclient set tabbed_max off

(run it to see its effect and then put it in your autostart to keep it permanently)

QiangF commented 4 months ago

I am an Emacs user and I really like how herbstluftwm handles the screen area, it is similar to how Emacs handles windows and hlwm is more reliable than the Emacs window manager EXWM.

My purpose is to get rid of the duplication of window titles in both the tab and the panel. Now the tab is hidden with "herbstclient set tabbed_max off", but the panel (I mean xfce4-panel) still shows more windows than the now hidden tab of the focused frame, it shows windows of all frames. And it has a problem for "cycle_all", it doesn't cycle in neighbouring order. With the tab, I have a visual feedback so I always know the next window to current window is the window that is to be cycled into.

How to show only window titles of the current focused frame in the panel (xfce4-panel or barpyrus)? Or at least place window on the panel in the same order of window on the tab, and during cycling follow the neighbouring order of windows on the panel?

The xfce-panel show window ordered by timestamp by default https://askubuntu.com/questions/235784/fix-order-of-window-buttons-in-xfce-panel

Maybe we should have an option to cycle_all in the order of timestamp when the tab is hidden, instead of the current by neightbouring.

QiangF commented 4 months ago

I will be very satisfied if I can get barpyrus showing the tab instead of showing above the frame. This is my config.py:

from barpyrus import widgets as W
from barpyrus.core import Theme
from barpyrus import lemonbar
from barpyrus import conky
import sys

# Copy this config to ~/.config/barpyrus/config.py

# set up a connection to herbstluftwm in order to get events
# and in order to call herbstclient commands
hc = hlwm.connect()

# get the geometry of the monitor
monitor = sys.argv[1] if len(sys.argv) >= 2 else 0
(x, y, monitor_w, monitor_h) = hc.monitor_rect(monitor)
height = 32 # height of the panel
width = monitor_w # width of the panel
hc(['pad', str(monitor), str(height)]) # get space for the panel

# you can define custom themes
grey_frame = Theme(bg = '#303030', fg = '#EFEFEF', padding = (3,3))

bar = lemonbar.Lemonbar(
    geometry=(x, y, width, height),
    font = '-*-dejavusansm nerd font mono-*-*-*-*-17-*-*-*-*-*-*-*',
    symbol_font = '-*-dejavusansm nerd font mono-*-*-*-*-17-*-*-*-*-*-*-*',
)

# Widget configuration:
bar.widget = W.ListLayout([
    W.RawLabel('%{l}'),
    hlwm.HLWMTags(hc, monitor),
    W.RawLabel('%{c}'),
    ############################
    # I want the tab shown here, all window titles in the same order as the in the tab
    ############################
    grey_frame(hlwm.HLWMWindowTitle(hc)),
    W.RawLabel('%{r}'),
    conky.ConkyWidget('df /: ${fs_used_perc /}%'),
    grey_frame(W.DateTime('%d. %B, %H:%M')),
])
t-wissmann commented 4 months ago

And it has a problem for "cycle_all", it doesn't cycle in neighbouring order.

I think the WM does not have any control about the order of buttons in the task bar (and also, the window manager can't restrict it further).

But otherwise, I have the impression that you are just trying to rebuild what's in the tab-bar already. Did you try to play with herbstclient attr theme.title_when (it can hide the window titles depending on how many tabs there are)

QiangF commented 4 months ago

I have the impression that you are just trying to rebuild what's in the tab-bar already. Did you try to play with herbstclient attr theme.title_when (it can hide the window titles depending on how many tabs there are)

Yes, I have managed to hide the tab. Now I only wish the tab-bar can be placed inside the barpyrus panel. Because I don't need too much other information on the panel, so the panel is mostly empty.

yousufinternet commented 4 months ago

I don't think this is related to herbstluftwm, because the panel is not part of the window manager, but you can basically use herbstclient list_clients to list windows in current tag and add them as buttons to your panel.

QiangF commented 4 months ago

@yousufinternet Yes, perhaps it is more related to barbyrus. So I should do the following to achieve my goal:

  1. list windows in current focused “Frame”
  2. get window titles and add them to barbyrus, and make the title clickable
  3. update the window title on focus change

Currently to the above done is beyond my skill level.

t-wissmann commented 4 months ago

The list of clients in the focused frame is given by the command:

herbstclient list_clients --frame='@' --title

But it is more demanding (both with respect to skill and time) to implement it in barpyrus (and in particular to update the panel in the right moment). Sorry.