Code Monkey home page Code Monkey logo

i3firefox's Introduction

Keep Firefox windows on their i3 workspaces

Context: I am using i3 and multiple Firefox windows across many workspaces, and have Firefox automatically restore the previous session’s windows and tabs.

Issue: When I quit and restart Firefox, all the windows are dumped on the current workspace and I have to spend a minute sending each of them to where they belong.

There is code in Firefox that attempts to restore each window to the desktop it was closed on, but this code does not work on i3 and specifically disabled.

There are general tools for i3 to restore window configuration, but it’s not easy to identify Firefox windows in order to swallow them to their respective workspaces. In particular, a Firefox window first opens with a generic Mozilla Firefox title, and changes that to the current tab’s title a few milliseconds later. This throws off the i3 swallowing logic.

This script is tailored specifically for Firefox. It maintains a list of currently open Firefox windows and recently closed windows both in memory and in a disk file. When a new window opens and first changes its title, it will be moved to the workspace that title was last seen on.

If the script is started while Firefox is already running, it will skip loading the window configuration file and just rebuild its state from the current window configuration.

The state is kept in $XDG_STATE_HOME/i3firefox.json (or $HOME/.local/state/i3firefox.json if $XDG_STATE_HOME is not set).

Installation

apt-get install python3-i3ipc

and arrange for this script to run on i3 startup.

i3firefox's People

Contributors

yurikhan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.