Code Monkey home page Code Monkey logo

sway-easyfocus's Introduction

sway-easyfocus

A tool to help efficiently focus windows in Sway inspired by i3-easyfocus.

demo.mp4

Config File

The config file is found at $XDG_CONFIG_HOME/sway-easyfocus/config.yaml If a key is not found in the config file nor provided as a cli option, then it uses a default value.

An example config is with the default options is shown below:

chars: 'fjghdkslaemuvitywoqpcbnxz'

window_background_color: '1d1f21'
window_background_opacity: 0.2

label_background_color: '1d1f21'
label_background_opacity: 1.0
label_text_color: 'c5c8c6'

focused_background_color: '285577'
focused_background_opacity: 1.0
focused_text_color: 'ffffff'

font_family: monospace
font_weight: bold
font_size: medium

label_padding_x: 4
label_padding_y: 0
label_margin_x: 4
label_margin_y: 2

Usage

A tool to help efficiently focus windows in Sway inspired by i3-easyfocus.

Usage: sway-easyfocus [OPTIONS] [COMMAND]

Commands:
  focus  Focus the selected window (default)
  swap   Swap focused window with the selected window
  print  Print the selected window's ID
  help   Print this message or the help of the given subcommand(s)

Options:
      --chars <CHARS>
          list of chars to use for hints <fjghdkslaemuvitywoqpcbnxz>
      --window-background-color <WINDOW_BACKGROUND_COLOR>
          set the window background color <rrggbb>
      --window-background-opacity <WINDOW_BACKGROUND_OPACITY>
          set the window background opacity <0-1.0>
      --label-background-color <LABEL_BACKGROUND_COLOR>
          set the label background color <rrggbb>
      --label-background-opacity <LABEL_BACKGROUND_OPACITY>
          set the label background opacity <0-1.0>
      --label-text-color <LABEL_TEXT_COLOR>
          set the label text color <rrggbb>
      --focused-background-color <FOCUSED_BACKGROUND_COLOR>
          set the label background color <rrggbb>
      --focused-background-opacity <FOCUSED_BACKGROUND_OPACITY>
          set the focused background opacity <0-1.0>
      --focused-text-color <FOCUSED_TEXT_COLOR>
          set the focused text color <rrggbb>
      --font-family <FONT_FAMILY>
          set the font family
      --font-weight <FONT_WEIGHT>
          set the font weight
      --font-size <FONT_SIZE>
          set the font size, see: https://www.w3.org/TR/css-fonts-3/#font-size-prop
      --label-padding-x <LABEL_PADDING_X>
          set the label padding-x <px>
      --label-padding-y <LABEL_PADDING_Y>
          set the label padding-y <px>
      --label-margin-x <LABEL_MARGIN_X>
          set the label margin-x <px>
      --label-margin-y <LABEL_MARGIN_Y>
          set the label margin-y <px>
  -h, --help
          Print help
  -V, --version
          Print version

The default action is to focus the selected window. The swap command can be used to swap the focused window with the selected window, and the print command can be used to print the selected window ID (sway container ID).

Build

This program is written in Rust. The Rust compiler can be installed by following the instructions on the official download page.

You also need to have gtk and gtk-layer-shell installed.

# Clone this repo
$ git clone https://github.com/edzdez/sway-easyfocus.git

# Build with cargo
$ cargo build --release
$ ./target/release/sway-easyfocus

# Alternatively, build and run in one step
$ cargo run --release

sway-easyfocus's People

Contributors

edzdez avatar markstos avatar pjones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

markstos pjones

sway-easyfocus's Issues

allow window / font-size adjustment.

I've got a large, high-resolution screen and need the labels to be larger. Thanks!

I've waiting for years for a tool like this to work on Wayland. Thanks so much!

[Feature] Config File

It would be nice to have a config file to override the default options rather than always passing arguments to the binary.

wish: more ergonomic default keys (start with home row keys)

Other tools which work in a similar way often have a nice touch by putting the easiest to reach keys as the most likely ones to be used for labels. Here's how wmfocus does it:

https://github.com/svenstaro/wmfocus/blob/5305b00bf1084fb742249867ac00ab244c61c4e9/src/args.rs#L125

This list of characters would also be nice to have in the config file for those that use non-QWERTY layouts.


I see there's another TODO item in the code about supporting more than 26 windows, which is something that may be run into more once multi-monitor support is is implemented.

wmfocus handles that by starting to use multiple characters instead of one.

But honestly, I have three monitors and I doubt I ever have more than 26 visible windows, so limiting the tool to the 26 first visible windows also works for me!

But then, there's also the question of whether you also want to support focusing parent containers or just windows. Supporting just windows should handle more than 95% of uses and could be another nice simplification. Supporting only windows will also help keep the number below 26.

Feature request: Add visual feedback of the just-focused window

When focusing a borderless window, there may be no immediate feedback to confirm which window has been focused.

One idea:

After focus switches to the new window, the hints remain for a very short period (probably even < 1 second would do). During this time the color of the hint could change to match the "current window" (as requested in #11) to give visual confirmation where the focus has gone. At the same time, coloring of the window switched from loses it's "current window" decoration scheme.

Opacity effects could also be used to used to highlight what's focused.

Since this confirmation is happening after the new window has focused, the new window remains immediately ready for input without waiting for the confirmation visualization to complete.

[Feature] multi-monitor support

Display labels (and allow focusing) on windows in active workspaces on all outputs. For example, we should be able to jump directly from a window on output 1 to a window on output 2 without having to navigate first to the workspace on output 2.

wish: highlight current window

It would be a nice enhancement if the currently focused window was visually noted during the overlay.

For example, usually white letters are shown on a black square. Perhaps for the currently focused window, black letters on a white square could be used.

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.