Giter Club home page Giter Club logo

jq-i3's Introduction

jq-i3

A jq module for working with i3 and Sway

Installation:

Copy or link the file i3.jq into your ~/.jq.

Usage:

# Get a flattened list of windows
i3-msg -t get_tree | jq -r 'include "i3"; windows'
# OR
i3-msg -t get_tree | jq -r 'import "i3" as i3; i3::windows'

# Choose a window by name, focus it by id:
i3-msg "[con_id=$(
	i3-msg -t get_tree |
	jq -r 'include "i3"; windows|(.id | tostring) + "\t" + .name' |
	fzf --with-nth='2..' |
	cut -f1
)]" focus

# Get a list of windows matching a certain criteria
i3-msg -t get_tree | jq -r 'include "i3"; windows(contains({"output":"eDP-1"}))'

# Get the list of containers that are anscestors to the currently focused window
i3-msg -t get_tree | jq -r 'include "i3"; stack'
# OR
i3-msg -t get_tree | jq -r 'include "i3"; stack(.focused)'

# Get the container id of the closest anscestor which is a tabbed container
i3-msg -t get_tree | jq -r 'include "i3"; [stack[] | select(.layout == "tabbed")] | last.id'

# Do that, but then move to the next tab, then descend until you reach a window
i3-msg -t get_tree | jq -r 'include "i3"; [stack[] | select(.layout == "tabbed")] | last |
	.focus[1] as $nexttab | (.floating_nodes + .nodes)[] |select(.id == $nexttab) | focus_stack[-1].id'


# Debug your bindings:
i3-msg -t subscribe -m '["binding"]' | jq -r 'include "i3"; print_binds' | xargs -n 2 notify-send

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.