Open toniz4 opened 3 years ago
How important is it to you that it's only displayed while holding Alt? I can see that this would be a nifty thing to be able to do, but I suspect it would require a fair amount of work, and provide only marginal benefit over what can be done already. From the quick grep i just did, it looks like keys only have Press events, whereas mouse buttons have different Press and Release events. So my supposition is that this would need to be enhanced, as well as adding infrastructure to bind functions to the different events.
Having the tablist hidden most of the time,
and displaying it only occasionally could be achieved
by binding a key to modify the tablist.visibility
setting,
but then you'd need to hit the key again to re-hide it:
local settings = require("settings")
modes.add_binds("normal", {
{ "<mod1-t>", "toggle tablist visibility",
function (w)
if( settings.tablist.visibility == "always" )
then
settings.tablist.visibility = "never"
else
settings.tablist.visibility = "always"
end
end },
})
If you use luakit in it's own F11
fullscreen mode,
you might also want to read #875.
If you use dmenu
(you linked to tabbed
, so you know suckless)
you could also use that to display a list of tabs (see #889).
And there's also the tabmenu
plugin.
Would there be a way to combine that with @c0dev0id's configuration in #889 to expand/collapse the tab list?
Something along those lines:
-- Load tab_favicons module
local tab_favicons = require "tab_favicons"
local tab = require("lousy.widget.tab")
-- Load plugins (https://github.com/luakit/luakit-plugins; uaswitch broken, prevents launching Luakit, deleted it)
require("plugins")
-- Ctrl+Alt+t to toggle tablist visibility
-- Alt+t to show tabmenu
local settings = require("settings")
modes.add_binds("normal", {
{ "<Control-mod1-t>", "Collapse/expand vertical tab bar.",
function (w)
if( settings.vertical_tabs.sidebar_width == 140 )
then
settings.vertical_tabs.sidebar_width = 20
lousy.widget.tab.label_format = '<span foreground="#353535" font="Monospace">{index}</span>'
else
settings.vertical_tabs.sidebar_width = 140
lousy.widget.tab.label_format = '<span foreground="#ffffff" font="Monospace">{index} {title}</span>'
end
end },
{ "<mod1-t>", "Open tabmenu.", function (w) w:enter_cmd(":tabmenu ") w:activate() end },
})
This does change the vertical_tabs width in the settings page, but the tab bar is not updated accordingly, even if I hide it and show it again manually. The labels are properly updated, but only after reloading or re-activating each tab, and since the width is not updated, this is not of much use at the moment.
Ideally, the bind would:
vertical_tabs
bar,vertical_tabs
scenario) should overlap over the webview instead of pushing it to the right every Control-mod1-t
is pressed to avoid redrawing the content all the time,I came up with something similar in Firefox with some CSS hacks and TreeStyleTabs (see expanded and collapsed, screenshots are from a mobile device, please ignore the dpi), which works with mouseover too, but it's dirty and breaks often with Firefox updates, plus I'd like to use multiple other features of Luakit and take advantage of its lightness.
Would there be a way to combine that with @c0dev0id's configuration in #889 to expand/collapse the tab list?
Probably.
... the tab bar is not updated accordingly ... ... labels are properly updated, but only after reloading or re-activating each tab ...
lib/vertical_tabs.lua
sets a setting-changed
signal handler,
but then tests for vertical_tabs.side
but not vertical_tabs.sidebar_width
(so vertical_tabs.sidebar_width
changes are not dealt with).
I don't think this would be too hard for a motivated hacker to correct.
As an aside, the vertical_tabs.side
code doesn't seem to check the new value,
so repeatedly doing :set vertical_tabs.side right
toggles the tablist from side to side.
(On restart, it obeys the setting, rather than its last placement.)
By contrast, changing vertical_tabs.side
in the settings page doesn't change the side (without a restart).
(So while someone's implementing the vertical_tabs.sidebar_width
processing,
they might want to think about that.)
Also, setting radio buttons (at least) in the settings page and then restarting causes the setting to take effect, except that the old setting is displayed in the settings page until it's reloaded. Switching tabs between setting change and restart ameliorates this. So there may be quirks in the settings page which may confuse testing (so beware:).
- ... overlap over the webview instead of pushing it to the right ... to avoid redrawing the content all the time,
I don't know how much processor load/user annoyance the redrawing causes (i don't use the tablist), but redrawing is the way its currently done, and changing that would increase the amount of work required.
- The tab list could expand when the mouse is over the index, and collapse again when the cursor is moved away.
Widgets seem to have mouse-enter
and mouse-leave
signals.
(Tabs use these to change the background colour on mouseover.)
So the tablist as a whole might already be able to call your code above when the user moves the mouse to it.
(lib/vertical_tabs.lua
dealing with vertical_tabs.sidebar_width
change would have to be implemented.)
If the tablist doesn't currently have this functionality, i assume it'd be fairly easy for someone to implement,
working by analogy from lib/lousy/widget/tab.lua
.
I haven't played with these signals, so i can't really advise you further.
Thank you for your answer. It's encouraging, it seems all this should be doable with a bit of Lua knowledge. Perhaps (3) would be a bit more difficult but I believe it would be an important milestone to make the collapsible tab list convenient to use (especially if it expands on mouse-over). Unfortunately I am not a programmer and my first Lua experience was with the code snippet above, so I am afraid I won't be able to go much further with that, but I'll have a look in the things you detailed, never know.
I'm submitting a Feature Request
Current Behavior
Tabs can only be toggled off when there is only one tab, or toggled off completly
Expected Behavior
It would be nice to implement a option to only show tabs when alt is pressed, like in this tabbed patch
Environment
Linux Distribution & Version: Gentoo Output of
luakit --version
: luakit 5f25506f built with webkit 2.30.3 (installed version: 2.30.3)