this post was submitted on 10 Nov 2023
1701 points (94.1% liked)

linuxmemes

20703 readers
1126 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 0 points 10 months ago* (last edited 10 months ago) (1 children)

This is always the first thing I get set up:

# focus next available workspace on this output

bindsym $mod+q exec --no-startup-id ws=$(i3-msg -t get_workspaces | jq '.[] | select(.focused) | .num') && ofs=$(i3-msg -t get_outputs | jq 'map(select(.active)) | length') && i3-msg workspace $(($ws-$ofs))

bindsym $mod+w exec --no-startup-id ws=$(i3-msg -t get_workspaces | jq '.[] | select(.focused) | .num') && ofs=$(i3-msg -t get_outputs | jq 'map(select(.active)) | length') && i3-msg workspace $(($ws+$ofs))

# move window to next available workspace on this output

bindsym $mod+Shift+q exec --no-startup-id ws=$(i3-msg -t get_workspaces | jq '.[] | select(.focused) | .num') && ofs=$(i3-msg -t get_outputs | jq 'map(select(.active)) | length') && dest=$(($ws-$ofs)) && i3-msg move workspace $dest && i3-msg workspace $dest

bindsym $mod+Shift+w exec --no-startup-id ws=$(i3-msg -t get_workspaces | jq '.[] | select(.focused) | .num') && ofs=$(i3-msg -t get_outputs | jq 'map(select(.active)) | length') && dest=$(($ws+$ofs)) && i3-msg move workspace $dest && i3-msg workspace $dest

Works with sway if you replace i3-msg with swaymsg (and remove --no-startup-id, since it's not needed for Wayland).

Edit: ampersand issues, trying quote instead of code block

[–] [email protected] 2 points 10 months ago* (last edited 10 months ago) (1 children)

This is so much smoother than my vim config and tmux config…

[–] [email protected] 1 points 10 months ago (1 children)

My neovim config is a total mess :D. But yeah i3-msg+jq is great, I've written a number of solutions to this problem before using the API and external scripts, but it's nice having things inline in the config file

[–] [email protected] 2 points 10 months ago (1 children)

My neovim config is unruly.

I have a folder with config files that I source, one for plugin installs, one for custom commands and hot keys, one for themes (I have a script to manage light and dark modes by time of day), one for project specific file type augroups. I’ve got a bunch of scripts in my home/.bin folder that parse different project files into json on git commit, and then I use vim script and FZF to do custom completion helpers and jump tools with that data. Then there’s my snippets folder…

I can never leave vim. It has taken over the pathways in my brain.

[–] [email protected] 1 points 10 months ago

Nice, sounds pretty cool. FZF is great, I need to try out some new things with it. Never got into snippets but I'm sure that speeds things up considerably, will think about it.

Yeah separate config files is probably the best approach if you have a lot of things configured. I haven't done that yet, but might try soon. My config has generally been pretty simple, mostly bindings and plugin settings. But I started developing in the TTY and had to shoehorn-in a conditional theme and such to get it to work properly, leaving it pretty unorganized.

| I can never leave vim. It has taken over the pathways in my brain.

Haha, yeah