• ctr1@fl0w.cc
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    1 year ago

    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

      • ctr1@fl0w.cc
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        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

        • EmergMemeHologram@startrek.website
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          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.

          • ctr1@fl0w.cc
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year 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