An i3/Sway utility to switch focus to your last focused window. Alt+Tab in i3

Related tags

Command-line i3-back
Overview

i3-back

An i3/Sway utility to switch focus to your last focused window. Allows for behavior similar to Alt+Tab on other desktop environments.

Features:

  • Can switch between your 2 most recent windows
    • Runs a daemon (background process) to listen for focus changes and sets a mark
  • Supports i3 and Sway
  • Supports floating windows
  • Can be binded to any key through i3's bindsym

Demo

2023-02-25.18-32-33.mp4

Installation

i3-back requires i3/Sway. It is written in Rust. It can be installed through many method:

  • Cargo (Rust's package manager) package:

    cargo install i3-back
    
  • Arch Linux from the AUR (i3-back-bin):

    yay -S i3-back-bin # Or with paru or other AUR wrappers
    # Or manually: https://wiki.archlinux.org/title/Arch_User_Repository#Installing_and_upgrading_packages
    
  • Debian/Ubuntu as a deb from GitHub releases

  • Binary from GitHub releases

Setup

In your i3/Sway configuration (~/.config/i3/config/~/.config/sway/config):

# Start the daemon which listens to focus changes and sets _back mark
exec --no-startup-id ~/.cargo/bin/i3-back

# Bind a switch key, which focuses the previously focused window
bindsym $mod+Tab [con_mark=_back] focus

Replace ~/.cargo/bin with wherever the i3-back binary is placed if not installed through Cargo.

Options

All options are optional. Options are passed to i3-back as flags.

Example exec with options:

exec --no-startup-id ~/.cargo/bin/i3-back --debug --mark _last

Available options:

  • --help/-h: See help text. Also see --version
  • --mark <MARK>/-m <MARK>: Change the default _back mark name. Make sure to update your switcher bind's con_mark to match
  • --debug/-d: Print extra debugging information

Example i3-back --help:

An i3/Sway utility to switch focus to your last focused window. Allows for behavior similar to Alt+Tab on other desktop environments.

Usage: i3-back [OPTIONS]

Options:
  -m, --mark <MARK>  Change the name of the mark to set [default: _back]
  -d, --debug        Print extra debugging information
  -h, --help         Print help
  -V, --version      Print version

How it works

The daemon (i3-back) listen for i3 window events (through i3's socket, from the I3SOCK environment variable). When a window event is received, i3-back records the previously focused window ID. When the previous focus has changed, it sets the _back mark (or whichever is configured through the --mark flag) to the last focused window.

When the switch bind is called (through i3's bindsym), it focuses the mark set by the daemon.

Prior work

You might also like...
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

A CLI to easily switch between multiple Neovim configuration environments, written in Rust

Neovim Configuration Switcher Neovim Configuration Switcher (short nvims) is a CLI to easily switch between multiple Neovim configuration environments

Rust no-BS Dead Man's Switch TUI
Rust no-BS Dead Man's Switch TUI

Dead Man's Switch This is a simple implementation of a Dead Man's Switch. Use at your own risk. Check the f****(as in friendly) code. Dead man's switc

A monitor (service) for your monitor (display). Intercepts window behaviour when monitor configuration changes.

Mon-Mon A monitor (service) for your monitor (display). Listens for changes to display configuration (e.g. plugging in an additional screen) and allow

rip is a command-line deletion tool focused on safety, ergonomics, and performance

rip (Rm ImProved) rip is a command-line deletion tool focused on safety, ergonomics, and performance. It favors a simple interface, and does not imple

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting
Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

An open source, programmed in rust, privacy focused tool for reading programming resources (like stackoverflow) fast, efficient and asynchronous from the terminal.

Falion An open source, programmed in rust, privacy focused tool for reading programming resources (like StackOverFlow) fast, efficient and asynchronou

YAML(ish) - Terminal UI framework based on templates focused on simplicity
YAML(ish) - Terminal UI framework based on templates focused on simplicity

A YAML(ish) based terminal GUI framework for- and by Rust, focussed on making it quick and easy to create a functional UI for an app or game. Based on Crossterm and inspired by Kivy.

Unopinionated low level API bindings focused on soundness, safety, and stronger types over raw FFI.

πŸ”₯ firehazard πŸ”₯ Create a fire hazard by locking down your (Microsoft) Windows so nobody can escape (your security sandbox.) Unopinionated low level A

Releases(v0.3.2)
Owner
Charles C
Charles C
"Better" tab and stack navigation for Sway WM.

sway_bfocus "Better" tab and stack navigation for Sway WM. Proof of concept. This program lets you create one set of keybinds exclusively for cycling

null 42 Oct 23, 2022
Adds back-and-forth jumping between current and previous focused windows to Sway.

sway-focus-back-and-forth Implements back-and-forth movement between the current and the previous focused windows. It also can be seen as a fix to thi

VinΓ­cius MΓΌller 4 Aug 11, 2022
Keybinder to type diacrytical characters without needing to hack the layout itself. Supports bindings to the left Alt + letter

ΔŽΓ­Γ‘Η©Ε™Γ­Ε₯Γ­Η©Γ‘d I just thought that it's a shame the word diakritika does not have any diacritics in it. Key points diakritika is a simple Windows daemon

null 4 Feb 26, 2024
skyWM is an extensible tiling window manager written in Rust. skyWM has a clear and distinct focus adhering to the KISS and Unix philosophy.

Please note: skyWM is currently in heavy development and is not usable as of yet. Documentation and versions will change quickly. skyWM skyWM is an ex

MrBeeBenson 74 Dec 28, 2022
🧠 A command-line utility for switching git branches more easily. Switch branches interactively or use a fuzzy search to find that long-forgotten branch name.

git-smart-checkout A git command extension for switching git branches more efficiently. About Interactively switch branches or fuzzy search for that f

Cezar Craciun 51 Dec 29, 2022
Nushell "extern" definitions for tab completion generated from Fish's

Nushell completions pack This is a system for generating extern defs (tab-completion) in nu. Background The fish shell project has a long, complicated

Scott Boggs 7 Feb 28, 2023
A cli utility for playing music mixes for programming & focus from musicforprogramming.net

mfp: music for programming A command-line utility for playing music mixes for programming & focus (from musicforprogramming.net), unlocking the flow s

Rohit Gupta 10 Jul 12, 2023
A Rust CLI to provide last publish dates for packages in a package-lock.json file

NPM Package Age A Rust CLI which if you provide a npm lockfile (package-lock.json to start), it will give you a listing of all of the packages & the l

Benjamin Lannon 1 Feb 4, 2022
A native screenshot tool for wlroots based compositors such as sway and river written in Rust

A native screenshot tool for wlroots based compositors such as sway and river written in Rust. X11 support coming soon.

Waycrate 66 Dec 28, 2022
Attempt to make a git profile switcher to switch profiles.

Git Profile Switcher β–ˆβ–€β–€β€ƒβ–ˆβ€ƒβ–€β–ˆβ–€β€ƒ β€ƒβ–ˆβ–€β€ƒβ–ˆβ–‘β–ˆβ–‘β–ˆβ€ƒβ–ˆβ€ƒβ–€β–ˆβ–€β€ƒβ–ˆβ–€β–€β€ƒβ–ˆβ–‘β–ˆβ€ƒβ–ˆβ–€β–€β€ƒβ–ˆβ–€β–ˆ β–ˆβ–„β–ˆβ€ƒβ–ˆβ€ƒβ–‘β–ˆβ–‘β€ƒ β€ƒβ–„β–ˆβ€ƒβ–€β–„β–€β–„β–€β€ƒβ–ˆβ€ƒβ–‘β–ˆβ–‘β€ƒβ–ˆβ–„β–„β€ƒβ–ˆβ–€β–ˆ

Srikanth K 2 Sep 23, 2022