You are not logged in.
is there a way in sway to move focus to the 1st/last tab with a single keybind (e.g. mod+Home; mod+End) in tabbed mode?
Last edited by tpfkanep (2025-01-29 10:38:06)
Offline
Do you have a fixed number of workspaces?
If so, just bind em to WS1 and WS9 or whatever.
else it'll need a little bit of scripting with swaymsg.
If you mean going back to the last used WS, it's:
bindsym keybind workspace back_and_forth
Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...
Offline
Yeah, played around with using workspaces: it's difficult for me to get used to working that way. Very jarring. Closest to what I want is hyprland (with the hy3 plugin - but it only has a keyboard-bind to go to the 1st tab)...
I'll look into swaymsg. Later.
Thanks.
Offline
Is sway your first tiling WM? You'll get used to it.
Did you actually mean tabs (those stacked windows)? I never use those tho.
What I do is I have numbered workspaces from 0-5 and I bind them to alt+num (alt+§ for 0 as it's better to reach than shifting it all one to the right).
alt+tab goes back to the last.
alt+caps (caps is bound as backspace) for the scratchpad (e.g. minimize) mostly for a terminal for compiling when developing.
add a shift to all the above to move the window there instead of going there.
You do know hy3 is supposed to be like i3, just like sway?
swaymsg is the command line utility for interacting with sway. some examples:
swaymsg -t get_outputs (get all monitors)
swaymsg workspace 1 (go to WS 1)
Last edited by jl2 (2025-01-28 12:59:04)
Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...
Offline
Started with i3 for a little while. Switched to sway and never looked back. Sway's digital poetry and something I've grown to love and admire.
Don't utilise workspaces a lot - one or two (very rarely) is all I need.
I have sway config with workspace_layout tabbed as default mode. My 1st tab in [WS 1] is alacritty and the last one is ranger. In between those two can be any number of apps (normally 3-5) open. Looking into this first/last tab shortcut; I stumbled upon hy3 and after setting it up in hyprland to my liking I was pleasantly surprised how well it suited my requirement (with the exception of not having a 'move-to-last-tab' shortcut).
I don't feel like switching to hyprland + hy3 yet... but who knows how it will go tomorrow...?
Offline
Offline
I think it should somehow be possible with "swaymsg -t get_tree" (add -r for json, -p for pretty, be aware it switches automatically when piped), then somehow parse it to get the last window, and focus it with 'swaymsg <criteria> focus', but this is something I would use a more rock-solid language than shell piping but use python or rust.
I think you could open a issue for this tho, https://github.com/swaywm/sway. The folks on IRC #sway are very helpful too.
Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...
Offline
jl2!
Yep! Yep! Yep!
Your swaymsg <criteria> focus got me on the right path.
I open alacritty now with a title of '1st_tab' and ranger with a title of 'last_tab'
swaymsg [title='1st_tab'] focus works like a charm from the commandline. Now to get that magic into my config. I do not think I will need scripting or python or rust for this.
PS: and just like that the latest update of hyprland brings about a popup on startup [thankfully can be disabled] and hy3 changes the way my tabs look. Not cool guys. Not cool.
Offline