Closed humanplayer2 closed 1 year ago
This is an interesting one. It would probably make sense to write a separate program with a preview matrix functionality, but I don't see a good way to it properly. The main challenge would be getting a preview of off-screen workspaces. We can get their geometry via i3 IPC, but I don't think we can get their visuals without activating them and iterating across all workspaces to get previews wouldn't be ideal.
As for the questions above: 1) If you only have the 6 workspaces, you can use cols = 3 instead of rows = 2, this would get you workspaces sorted and then placed. If you do need to specify 2 rows ( i.e. you expect the number of workspaces to grow and want to keep them in 2 rows), it would require a (small) code change. I don't mind adding this feature, so feel free to ask! 2) The positioning of the layer shell windows is controlled by the 4 anchors (one for each of top, left, right and bottom). If you only have 1 anchor, the bar will stick to that edge. Usually it will be centered along the other dimension, but that is up to a compositor. If you specify 3 anchors, i.e. left, right, bottom, the bar will be placed along the odd edge (i.e. bottom) and stretched along it all the way. If you want to place the bar in the center of the screen, you'll need to detach all anchors (these are set in src/bar.c, function bar_new(). There is currently no way to do this in config, but again, it would be possible to implement if needed. 3) This can be done already with sway. Sway supports showing the bar on a modifier. To do this configure:
bar {
...
modifier $mod
}
And bind the same mod to key to workspace changes, i.e.
bindsym $mod+1 workspace number 1
Now the bar will show up when you press $mod, workspace will change once you press 1 while holding $mod and the bar will stay on screen until you release $mod.
Thank you for you're quick answer! I'm very happy you didn't shut me down :)
Though graphical previews of the workspaces could be a very elegant, I think less can do. Already the pager as you've implemented it beats my current vertical Waybar config. If you're the preview functionality could be shown by default (maybe with window titles a la Sway Overview, I think that would be nice, too.
About the questions:
1) I think I'll be happy with this! Thank you!
2) I think being able to set the position of the bar in config would be very nice, in general. For my use case, I'll happily change and rebuild (thank you!), but it is my impression from r/unixporn that a lot of people like bars slightly offset from the screen edge.
3) Ah, greatness! I'm not having much luck, alas. Using the default sfwbar.config
and with the following in my Sway config, sfwbar
just shows:
bar {
swaybar_command sfwbar
hidden_state hide
mode hide
modifier $mod
}
With swaybar_command swaybar
, the bar shows only with $mod
pressed.
Can you point me to the missing piece?
Thank you for you're quick answer! I'm very happy you didn't shut me down :)
I usually try to implement as many use-cases as possible, so long as they fit with the general idea of a taskbar and functionality is reasonably re-usable.
Though graphical previews of the workspaces could be a very elegant, I think less can do. Already the pager as you've implemented it beats my current vertical Waybar config. If you're the preview functionality could be shown by default (maybe with window titles a la Sway Overview, I think that would be nice, too.
Ideally I would have implemented pager as a graphical representation of window layout, but sway doesn't send notification of window geometry changes, so there is no way to determine when the representation needs to be updated. With preview I side-step the issue, since the bar updates the geometry every time preview pops up.
About the questions:
1. I think I'll be happy with this! Thank you!
Done in the current git. You can add primary = rows
or primary = cols
to your pager definition to set the primary dimension.
2. I think being able to set the position of the bar in config would be very nice, in general. For my use case, I'll happily change and rebuild (thank you!), but it is my impression from [r/unixporn](https://www.reddit.com/r/unixporn/) that a lot of people like bars slightly offset from the screen edge.
Do you mean a bar along one of the edges, but not stretching all the way along it? You can achieve this with SetBarSize command in the "SfwbarInit" function. I.e. SetBarSize "800"
to get 800px wide bar.
3. Ah, greatness! I'm not having much luck, alas. Using the default `sfwbar.config` and with the following in my Sway config, `sfwbar` just shows:
bar { swaybar_command sfwbar hidden_state hide mode hide modifier $mod }
With
swaybar_command swaybar
, the bar shows only with$mod
pressed.Can you point me to the missing piece?
Sfwbar starts visible by default (i.e. it doesn't respect your mode hide
setting). You need to hide it from sfwbar config, you can the following to your SfwbarInit function:
Function("SfwbarInit") {
...
SwayCmd "bar mode dock"
SwayCmd "bar mode hide"
}
I usually try to implement as many use-cases as possible, so long as they fit with the general idea of a taskbar and functionality is reasonably re-usable.
I'm very glad my use case fit!
Ideally I would have implemented pager as a graphical representation of window layout, but sway doesn't send notification of window geometry changes, so there is no way to determine when the representation needs to be updated. With preview I side-step the issue, since the bar updates the geometry every time preview pops up.
Ah, yes, I see. There is a difference to GNOME there, I suppose. In the Workspace Matrix extension, even videos playing are shown as playing in the overview.
Done in the current git.
So fast! Nice! This works excellently! Thank you! For the record, I did mean that I'd be happy with using cols
instead of rows
, but I think what you've just added gives a very natural choice.
Do you mean a bar along one of the edges, but not stretching all the way along it? You can achieve this with SetBarSize command in the "SfwbarInit" function. I.e. SetBarSize "800" to get 800px wide bar.
That the bar can be narrowed I got from the default config. I meant that the bar has a bit of "air" between it and the screen edge is popular. The following are three examples taken from the first 10 posts of current Hot on r/uniporn: Example 1, Example 2, Example 3.
I see that I can maybe get that effect (and the centering I'm looking for) by using the padding of grid#layout
, e.g. lifting the bar 10px
above the bottom edge by using:
grid#layout {
background-color: rgba(224, 175, 104, 1);
border-radius: 8px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom: 10px;
}
Alas, the background-color
shows between bar and screen edge, then, and setting the rgba alpha
to 0
seems to be ignored? Can I achieve transparent background somehow?
You need to hide it from sfwbar config, you can the following to your SfwbarInit function:
Marvelous! Thank you very much!
If you want to have a gap between the bar and the main edge, you will indeed need to transparent CSS background for that part of the bar, to do this (I'm assuming bar at the bottom in my example), add the following to your CSS section:
window#sfwbar {
background: transparent;
}
grid#layout {
background: red;
margin-bottom: 10px;
}
(you will probably want to use a better choice of color than red for your grid, since this will be the background color for your bar).
Again, thank you very much! That supplied the missing piece, and I am now very happy with the result.
I really appreciate your work on SFWBar and your direct help: My Sway desktop now feels like home, and this was the missing piece.
The one thing I miss in Sway coming from GNOME is Workspace Matrix. With a bit of creative keybindings, the "space" can emulated, and with
sfwbar
, it can be visualized using the pager. I'm thrilled!The key feature from Workspace Matrix that I miss is their popup workspace overview. The popup shows when switching workspace, and stay shown either for a set time, or---if the time is set to 0---until $mod is released. Being able to see what is on the workspaces is great, but just being able to see where I am would make me happy.
My attempt to use
sfwbar
for the purpose involves a taskbar with the same dimensions as the pager, which has 6 pinned workspaces in 3 rows, as is my preference. I've set the bar to take up 1/3 of my screen height, usingSetLayer "top"
andSetExclusiveZone "-1"
to make it appear on top of my windows. Nice!There are three things I hope you can help me set up:
1) Reorder workspace in pager. Currently, workspaces are order downwards in columns. Is it possible to order them along the rows instead? in
pager
, I have tried playing around with order ofpins = "1", "3", "5", "2", "4", "6"
settingnumeric = false
, but to no avail.2) Set position of taskbar. For the love of me, I can't figure out how to set the vertical positioning of the taskbar. I've looked at the code for the switcher, but I miss it. Then again, calling be a Gtk newbie would be generous.
3) Show taskbar on
$mod+key
, hide taskbar on$mod release
. I would like the workspace overview to show when I switch workspace and show for as long as I keep$mod
pressed, then hide. It is my impression that the way keybindings are implemented in Sway makes it impossible to implement this through the Sway config alone. The patch from this rejected PR makes it possible, but changes--release
a lot, which was given as a reason for rejecting it. Another reason given for the PR rejection is that the behavior should be implementable through current Wayland protocols for apps that use layer-shell---so it should be possible insfwbar
? Apart from being nice for workspace switching, this feature combined with the versatile layout options ofsfwbar
would let me to place all my taskbar elements (clock, tray, etc.) into the "overview taskbar", allowing for a generally bar-free, information-on-demand environment.Is there a chance these three things are already possible?