Giter Site home page Giter Site logo

yctrl's Introduction

YCtrl

Thin wrapper around yabai that adds convenient and intuitive fixes.

By thin wrapper we mean that you could just replace yabai with yctrl and expect everting to work as is. Though, you need to get ride of -m and -- before actions/commands. e.g.

Same as yabai -m cli, it communicate with yabai socket directly.

yabai -m window --focus next
yctrl window focus next

Enhancements

  • inc enhance resize that just accept either right or left. (works as you would expect)
  • next/prev: cycles with spaces and windows on all commands.
  • focus next/prev: accounts for floating windows (isn't that the default?).
  • focus next/prev: If current space has only one window then window next would go to next/prev space window
  • event: Auto close empty spaces.
  • event: keep focus in current space last window. (space change, new window in different space, window destroy)
  • scratchpad: toggle (hide/unhide) a pre-defeined scratchpad (configured by grid '<rows>:<cols>:<start-x>:<start-y>:<width>:<height>'
  • Auto-switch focus to last window on window destory/minimize/hide

Someday

  • Ergonomics
    • Move to next/prev space should auto created space if it doesn't exists
    • Auto create space by id if it doesn't exists.
  • Control and Access
    • Maintain internal state of yabai objects
  • Scratchpad
    • Moving mouse from scratchpad automatically hides it.
    • Have scratchpad window appear in all spaces (now switches to space where it has the scratchpad)
    • toggle last
  • Bugs
    • Fix installation by nix overlay
    • Only switch focus to last window if current isn't hover

Setup

In yabairc:

yctrl &

# Setup event listeners
send() {; echo "echo event $@ | nc -U -w 1 /tmp/yctrl.socket"; }

yabai -m signal --add event='space_changed' action=$(send 'space_changed $YABAI_SPACE_ID $YABAI_RECENT_SPACE_ID')
yabai -m signal --add event='window_destroyed' action=$(send 'window_destroyed $YABAI_WINDOW_ID')
yabai -m signal --add event='application_hidden' action=$(send 'application_hidden $YABAI_WINDOW_ID')

yctrl config yctrl_auto_close_empty_spaces false # Disable auto close of empty spaces
yctrl config window_topmost on # redirect to yabai socket

# Scratchpad (definition are written json5) (special thanks to @arpandaze)
yctrl config yctrl_scratchpad_grid "6:4:1:1:2:4"
yctrl config yctrl_scratchpads '[
  {
    tag: "alacritty",
    kind: "title",
    target: "TermScratchpad",
    command: ["open", "-a", "Alacritty.app", "--title", "TermScratchpad"]
  },
  {
    tag: "discord",
    kind: "app",
    target: "Discord",
    command: ["open", "-a", "Discord.app"]
  },
]'

Installation

Cargo

cargo install --git https://github.com/kkharji/yctrl

Flakes

{
  inputs = {
    yctrl.url = "github:kkharji/yctrl";
    yctrl.inputs.nixpkgs.follows = "nixpkgs";
  };
  output = { self, ... }@inputs {
    /// ......
    {
      nixpkgs.overlays = [ inputs.yctrl.overlay ];
    };
  };
}

Legacy

{
  nixpkgs.overlays = [
    (import (builtins.fetchTarball {
      url = https://github.com/kkharji/yctrl/archive/master.tar.gz;
    }))
  ];
}

Inspirations

yctrl's People

Contributors

kkharji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.