What's new with Garuda Sway? (2024)

Any scratchpad users out there? I was thinking swipe up and swipe down might be nice ones to assign to the scratchpad. Swipe up to send a window to the scratchpad, swipe down to cycle through the scratchpad windows. I don’t really use the scratchpad, but seems like it would be handy.

Turns out there are a ton of supported gestures–four- or five-finger tap/long press/swipe, rotate a certain number of fingers, slide across a specific side of the trackpad with a specific number of fingers, and so on. Check out some of the examples in this issue: Touch bindings · Issue #1904 · swaywm/sway · GitHub

touch {
    set along_the_top "20px x 1.0 @ .5 x 0"
    set bottom_half "1.0 x .5 @ 0 x .5"
    set right_half ".5 x 1.0 @ .5 x 0"

    # five finger tap to spawn a terminal
    gesture exec $term {
        down 5
        delay < 10ms
        up all # optional, all guestures implicitly end with "up all"
        # equivalent shorter version:
        # tap 5
    }

    # five finger long press to lock screen
    gesture exec swaylock {
        down 5
        50ms < delay < 1s
    }

    # slide along the top to right to spawn dmenu
    gesture exec dmenu_run {
        down 1 $along_the_top
        horiz +100px < move
    }

    # two finger slide across bottom half of window to splith
    gesture splith {
        down --window 2 $bottom_half
        horiz +/-0.5 < move
    }
    gesture splitv {
        down --window 2 $top_half
        vert +/-0.5 < move
    }

    # rotate screen with 5 finger rotate
    gesture output LVDS-1 transform +90 {
        down 5
        45deg < rotation < 90deg
        up all
    }

    # drag from right/left to switch workspaces
    # --create to make a new one if you hit the end
    gesture workspace --create next_on_output {
        down 1 "100px x 1.0 @ 1.0-100px x 0"
        horiz -0.25 < move
    }

    gesture workspace --create prev_on_output {
        down 1 "100px x 1.0 @ 0 x 0"
        horiz +0.25 < move
    }

    # 3 finger drag up to float windows
    gesture floating enable {
        down 3 $bottom_half
        move $top_half
    }

    # 3 finger drag down to float windows
    gesture floating disable {
        down 3 $top_half
        move $bottom_half
    }

    # 3 finger drag to move windows
    gesture {
        down --window 3
        # move at least 50px to start an interactive move
        # calculated from the average position of your fingers
        50px < move --attach
    }

    # 3 finger pinch to resize windows
    gesture {
        down --window 3
        50px < expand/shrink --attach
    }

    # 3 finger rotate to rotate floating windows
    gesture floating enable {
        down [floating] 3
        15deg < rotate --attach
    }

    # Except gedit which I want to resize with rotation for some reason
    gesture {
        down [appid="gedit"] 3
        15deg < rotate --attach
    }
}

I’m probably not going to set up a ton of them on the ISO, but maybe a few just to give people an idea of what is possible, then maybe leave a link to this page in the config or something in case people would like to go nuts with it.

Edit:

After reading the thread, it’s not clear to me if these are implemented yet or not so I’ll have to do some testing.

4 Likes

I forgot to follow up on this. It turns out that thread is a brainstorming or development thread of some kind; those gestures are currently not supported–at least not with the syntax described there.


Since we are getting ready to release a new ISO pretty soon, I have been thinking a lot about what to set the gestures to by default. I had pretty nearly settled on this one:

bindgesture swipe:right workspace prev
bindgesture swipe:left exec ~/.config/sway/scripts/advance_workspace.sh
bindgesture swipe:up exec nwg-drawer
bindgesture swipe:down exec wtype -P "Escape"

Swipe up to open the application menu and swipe down to press Esc is pretty boring, but on the other hand is really intuitive and easy for a new user to figure out what just happened when they do it for the first time. I figured folks who want to go further with it can find the settings in the config and change it to do whatever they like.

But then I was testing swipe up to move a window to the scratchpad, and swipe down to show the scratchpad or cycle through pages. I don’t really use the scratchpad myself, but this just seems tremendously more useful from a workflow standpoint and I think showcases the possibilities that are available with gesture bindings a little better.

Using the scratchpad is maybe less intuitive than opening and closing a menu, but I still think it is simple enough that people will be able to figure it out: swipe up, a window disappears and swipe down it comes back. If people think it sucks or whatever I can change it to something else, but for now I think it’s a good starting point.

3 Likes

What if you had different swipe combinations but the unused one commented out? That would make it a tad bit easier for new users coming into Sway. They could just uncomment the gestures they want to use, and comment the ones they don’t want to use. Could group them by direction and include a note that only one of each group should be uncommented? If you’re still feeling a bit undecided on what to use by default, I think the nwg-drawer and Esc options are good. I think scratchpad would be a specific usecase as I don’t use it, nor have I ever iirc. To me as a normal user of Sway, the drawer option would be more helpful.

But then as they’re learning all about the configs of Sway, they can then customize the gestures however they want.

Easy solution: more hardware lol! This one looks worth getting something out of the storage unit…just need to order some Dram…