Alternative basic focus movement for the sway and i3 window managers.

Overview

sway-overfocus

Alternative basic focus movement for the sway and i3 window managers.

Demo GIF

The primary goal of this program is to create one set of keybinds exclusively for cycling through tabs/stacks, and another set exclusively for navigating between splits. This is accomplished by providing custom focus commands that target only specific layouts. The result is that switching focus generally can be performed in one action rather than some sequence of focus parent and focus [direction] actions.

Installation instructions

The project compiles to a standalone binary that interfaces with sway or i3 over IPC.

Download a release or build with cargo build --release using rustc v1.58 or higher. Copy the binary (located in ./target/release when building) to a location in your $PATH, fx. ~/.local/bin. Then insert/replace keybinds to run exec sway-overfocus ... commands in your sway configuration.

See the usage page for details on constructing focus commands. The following config section is a good starting point, but commands can be configured granularly to suit your needs.

bindsym $mod+h exec sway-overfocus split-lt float-lt output-ls
bindsym $mod+j exec sway-overfocus split-dt float-dt output-ds
bindsym $mod+k exec sway-overfocus split-ut float-ut output-us
bindsym $mod+l exec sway-overfocus split-rt float-rt output-rs
bindsym $mod+Tab exec sway-overfocus group-rw group-dw
bindsym $mod+Shift+Tab exec sway-overfocus group-lw group-uw
Comments
  • doc: add mention of AUR package to README.md

    doc: add mention of AUR package to README.md

    Hey,

    I have created an Arch User Repository (AUR) package for this repository under the name sway-overfocus. Software from the AUR is very convenient to install for users of the pacman package manager (which is the default for Arch Linux and Manjaro) over an installation from source. The package currently tracks the 0.2.3 version, as given by the tag. Feel free to add a mention to this package to the README if you would like.

    Note: While creating the package, I noticed that the package versions for sway-overfocus differ in the Cargo.toml (0.2.3) and Cargo.lock (0.2.2) files. I currently circumvent this issue in the build process by using sed to adjust the version in the lockfile. Please let me know if this intended or if you plan to fix this discrepancy.


    In case you never heard of the AUR, let me quote from the Arch Linux wiki:

    The Arch User Repository (AUR) is a community-driven repository for Arch users. It contains package descriptions that allow you to compile a package from source with makepkg and then install it via pacman. The AUR was created to organize and share new packages from the community and to help expedite popular packages' inclusion into the community repository.


    In case you have any questions or concerns, or would like me to take the package down, please let me know. Thank you for providing this great piece of software!

    opened by leon-richardt 4
  • Make order of operations significant

    Make order of operations significant

    Hiya! Found this via that sway ticket & loving it, great work.

    This request is probably going to seem esoteric but would it be possible to make the order in which the movement arguments were specified semantically significant?

    My use case is essentially this (paraphrased):

    bindsym [hjkl] exec sway-overfocus group-[ldur]w split-[ldur]w
    bindsym Shift+[hjkl] exec sway-overfocus split-[ldur]w group-[ldur]w
    

    So, because I have a layout that frequently ends up as alternations of tab > split > tab > sometimes split, what I'm after is for my basic hjkl movements to move group-wise if the focus is within a tabbed/stacked container, and split-wise if it's not (so, how it works currently). However, I would like, when I shift the keys, for the behaviour to be the exact opposite, where it will move split-wise when the focus is in a tabbed/stacked container, and tab-wise when it's in a split, which for me essentially has the effect of moving containers at the parent level instead of the focus level.

    However, at the moment, unless I've set something up incorrectly, it would appear that both of those commands do the same thing, which I'd assume would mean the order of arguments is not taken into account.

    opened by Myrdden 4
  • Directional movement between outputs, floats

    Directional movement between outputs, floats

    My setup is: External monitor with pos: 0,0 Laptop monitor with pos: 3840,0 My external monitor is physically positioned to the left of my laptop.

    The original focus command in sway allows me to

    1. Have focus in a window/container on my laptop-screen
    2. Press mod+Left
    3. Get focus on a window on my external monitor (positioned to the left of my laptop both virtually and physically)

    sway_bfocus does not transcend desktop boundaries.

    If the aim is to replace the focus command, all "active desktops", i.e. those that are currently displayed, should be taken into account when switching focus.

    enhancement 
    opened by madsobitsoe 3
  • Build requires feature `strip`, not stabilized in Cargo 1.58.0/rustc 1.58.1

    Build requires feature `strip`, not stabilized in Cargo 1.58.0/rustc 1.58.1

    The README states that Cargo 1.58 or newer is required to build, but the project doesn't build with Cargo 1.58. See the output below.

    > cargo build --release
    error: failed to parse manifest at `/home/mads/dev/sway-overfocus/Cargo.toml`
    
    Caused by:
      feature `strip` is required
    
      The package requires the Cargo feature called `strip`, but that feature is not stabilized in this version of Cargo (1.58.0 (f01b232bc 2022-01-19)).
      Consider trying a newer version of Cargo (this may require the nightly release).
      See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-strip-option for more information about the status of this feature.
    
    opened by madsobitsoe 2
  • Attempting to focus a window with no title fails

    Attempting to focus a window with no title fails

    If the target window has no title, sway-overfocus fails.

    $ sway-overfocus split-lw float-lw
    error: no valid focus command
    

    The window that should be the target (notice name is null):

    {
      "id": 63,
      "type": "con",
      "orientation": "none",
      "percent": 0.3319633259563705,
      "urgent": false,
      "marks": [],
      "focused": true,
      "layout": "none",
      "border": "pixel",
      "current_border_width": 4,
      "rect": {
        "x": 2154,
        "y": 18,
        "width": 1050,
        "height": 1668
      },
      "deco_rect": {
        "x": 0,
        "y": 0,
        "width": 0,
        "height": 0
      },
      "window_rect": {
        "x": 4,
        "y": 4,
        "width": 1042,
        "height": 1660
      },
      "geometry": {
        "x": 0,
        "y": 0,
        "width": 500,
        "height": 500
      },
      "name": null,
      "window": 6291457,
      "nodes": [],
      "floating_nodes": [],
      "focus": [],
      "fullscreen_mode": 0,
      "sticky": false,
      "pid": 3670786,
      "app_id": null,
      "visible": true,
      "max_render_time": 0,
      "shell": "xwayland",
      "inhibit_idle": false,
      "idle_inhibitors": {
        "user": "none",
        "application": "none"
      },
      "window_properties": {
        "transient_for": null
      }
    }
    

    If I forcefully set a name with xprop, sway-overfocus works as expected:

    $ xprop -id 6291457 -set WM_NAME test
    $ sway-overfocus split-lw float-lw
    [
      {
        "success": true
      }
    ]
    
    bug 
    opened by b0o 2
  • Floating containers

    Floating containers

    Currently, floating containers are simply ignored, so trying to change focus from one does nothing.

    Since they are only present in workspace containers, we should be able to get basic support by reforming the top nodes of the tree. It might be challenging to support proper directional movement.

    enhancement 
    opened by korreman 2
  • Target several layouts at once

    Target several layouts at once

    Currently I cycle through tabs with bindsym $mod+Tab exec sway_bfocus tabbed forward cycle

    However, I sometimes stack my windows instead of tabbing them.

    Is it possible to make the cycling tab/stack agnostic?

    enhancement 
    opened by madsobitsoe 2
  • Bump regex from 1.5.4 to 1.5.6

    Bump regex from 1.5.4 to 1.5.6

    Bumps regex from 1.5.4 to 1.5.6.

    Changelog

    Sourced from regex's changelog.

    1.5.6 (2022-05-20)

    This release includes a few bug fixes, including a bug that produced incorrect matches when a non-greedy ? operator was used.

    1.5.5 (2022-03-08)

    This releases fixes a security bug in the regex compiler. This bug permits a vector for a denial-of-service attack in cases where the regex being compiled is untrusted. There are no known problems where the regex is itself trusted, including in cases of untrusted haystacks.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Change command syntax in README

    Change command syntax in README

    The following doesn't work in my config

    set $i3_scripts ~/.config/i3/scripts
    bindsym $mod+w exec '$i3_scripts/sway-overfocus split-li group-lw'
    bindsym $mod+e exec '$i3_scripts/sway-overfocus split-ri group-ri'
    

    whereas this works:

    set $i3_scripts ~/.config/i3/scripts
    bindsym $mod+w exec $i3_scripts/sway-overfocus split-li group-lw   # Remove single quotes
    bindsym $mod+e exec $i3_scripts/sway-overfocus split-ri group-ri   # Remove single quotes
    

    Maybe change README to address this?

    documentation 
    opened by RayZ0rr 1
  • Direct IPC

    Direct IPC

    The program runs for sway in 5-15ms on my system, which is acceptable. It takes 30-50ms in i3 however.

    The vast majority of time is spent running the swaymsg/i3-msg commands, while parsing and searching takes less than 1ms. Maybe doing IPC directly would be significantly faster?

    enhancement 
    opened by korreman 0
  • Fullscreen

    Fullscreen

    When a container is fullscreened, the containing workspace should be treated as simply holding that container alone. Currently, containers are always focused as though nothing is full-screen.

    bug 
    opened by korreman 0
  • Moving containers around

    Moving containers around

    It'd be nice to support moving containers using the same logic they are focused with.

    My initial idea is that sway_bfocus move <targets> should find the container that would be focused, then place the currently focused container right before or after it. This wouldn't be as powerful as the builtin directional movement, but it would be more consistent. The lacking functionality could then be achieved with an additional move to parent command.

    enhancement 
    opened by korreman 6
Releases(v0.2.3-fix)
Owner
null
Help project managers and project owners with easy-to-understand views of github issue dependencies.

Help project managers and project owners with easy-to-understand views of github issue dependencies.

nasa 56 Dec 15, 2022
Rust implementation for Wlroots (Sway, Wayfire, Hikari, River, etc.) of Gnome Screenshot and Idle DBUS Server, which Upwork uses to capture the screen as proof of work.

?? upwork-wlroots-bridge ?? Rust Implementation for Wlroots (Sway, Wayfire, Hikari, River, etc.) of Gnome Screenshot and Idle DBUS Server (with extra

Daniel Moretti V. 4 Jan 2, 2023
Keep distractive apps at bay allowing you to focus!

Focus Keep distractive apps at bay allowing you to focus! What it does. The apps specified are killed automatically after a period of 5 seconds till t

null 3 May 11, 2022
A basic rp2040-hal project with blinky and rtt logging example code.

A basic rp2040-hal project with blinky and rtt logging example code. With this you can quickly get started on a new rp2040 project

rp-rs 202 Jan 6, 2023
basic multiple package manager

baka basic multiple package manager Docs Env baka_root_setting Windows: %USERPROFILE%/.baka/config Linux, Mac: $HOME/.baka/config baka_plugins (Just u

null 8 Dec 29, 2021
Basic Rust I2C demo on the TI Launchpad

msp430-i2c-oled-example An example project to talk to an SSD1306 OLED (Adafruit PiOLED) with an MSP430G2553 Launchpad via I2C.

Edward Shin 3 Jul 9, 2021
Edgelord is a library for Cloudflare Workers. You can scaffold a basic bot for discord, slack, etc.

Edge Computing + chūnibyō = Edgelord ✨ ?? Edgelord Edgelord is now working. You can contribute for it. Edgelord is a Rust library for cloudflare worke

null 23 Dec 26, 2022
Basic ActivityPub Server (in Rust)

Basic ActivityPub Server (in Rust) This is a deep-dive on this blog post: https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-s

Mat 10 Nov 24, 2022
Simplistic complier~virtual-machine that transforms AST into a Rust function, with basic type checking

rast-jit-vm rast-jit-vm is a simplistic, proof-of-concept~ish compiler / virtual machine that transforms syntax tree into a Rust function, type-checki

Patryk Wychowaniec 4 Oct 23, 2022
Swayidle alternative to handle wayland idle notifications, sleep and lock events in Rust with Lua scripting based configuration language

swayidle-rs This is intended as a replacement of sway's idle management daemon. I use it as a tool to understand rust message passing and state manage

Reza Jelveh 8 Nov 27, 2023
🐀 Building a federated alternative to reddit in rust

Lemmy A link aggregator / Reddit clone for the fediverse. Join Lemmy · Documentation · Report Bug · Request Feature · Releases · Code of Conduct About

LemmyNet 7.2k Jan 3, 2023
Libreddit - An alternative private front-end to Reddit

Libreddit - An alternative private front-end to Reddit

Spike 3.9k Jan 6, 2023
Blueboat is an open-source alternative to Cloudflare Workers. The monolithic engine for serverless web apps.

Blueboat Blueboat is an open-source alternative to Cloudflare Workers. Blueboat aims to be a developer-friendly, multi-tenant platform for serverless

Heyang Zhou 1.8k Jan 9, 2023
Polydrive an experimental open source alternative to Google Drive

Polydrive is an experimental open source alternative to Google Drive. It allows users to synchronize their files on multiple devices.

null 3 Apr 20, 2022
Rust macro to use a match-like syntax as a elegant alternative to nesting if-else statement

cond Rust macro to use a match-like syntax as an elegant alternative to many if-else statements. I got the idea from empty Go switch statements. I tho

CheckM4te 3 Nov 23, 2023
A Rust proc-macro crate which derives functions to compile and parse back enums and structs to and from a bytecode representation

Bytecode A simple way to derive bytecode for you Enums and Structs. What is this This is a crate that provides a proc macro which will derive bytecode

null 4 Sep 3, 2022
A library and tool for automata and formal languages, inspired by JFLAP

Sugarcubes is a library and application for automata and formal languages. It is inspired by JFLAP, and is intended to eventually to be an alternative to JFLAP.

Henry Sloan 22 Nov 2, 2022
A stupid macro that compiles and executes Rust and spits the output directly into your Rust code

inline-rust This is a stupid macro inspired by inline-python that compiles and executes Rust and spits the output directly into your Rust code. There

William 19 Nov 29, 2022
This is a Discord bot written in Rust to translate to and from the Bottom Encoding Standard using bottom-rs and Serenity.

bottom-bot This is a Discord bot written in Rust to translate to and from the Bottom Encoding Standard using bottom-rs and Serenity. Ever had this pro

Bottom Software Foundation 11 Dec 10, 2022