GithubHelp home page GithubHelp logo

azuline / swaywsr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pedroscaff/swaywsr

1.0 1.0 0.0 574 KB

swaywsr is a small program that uses Sway's IPC Interface to change the name of a workspace based on its contents.

License: MIT License

Rust 100.00%

swaywsr's Introduction

swaywsr - sway workspace renamer

swaywsr is a small program that uses Sways's IPC Interface to change the name of a workspace based on its contents.

It is a port from Daniel Berg's (roosta) i3wsr which I also contributed to. Most of the code is the same.

Details

The chosen name for a workspace is a composite of the app_id (wayland native) or WM_CLASS X11 window property for each window in a workspace. In action it would look something like this:

Installation

Build a release binary,

cargo build --release

Usage

Just launch the program and it'll listen for events if you are running sway. Another option is to put something like this in your sway config

exec_always $PATH_TO_RELEASE_BINARY

Options

You can configure icons for the respective classes, a very basic preset for font-awesome is configured, to enable it use the option --icons awesome (requires font-awesome to be installed).

If you have icons and don't want the names to be displayed, you can use the --no-names flag.

For further customization, use the --config path_to_file.toml option. The toml file has four fields:

  • icons to assign icons to classes
  • aliases to assign alternative names to be displayed
  • general to assign the separator and default icon
  • options to assign additional flags like --no-names

Example config can be found in assets/example_config.toml

[icons]
# font awesome
TelegramDesktop = ""
Firefox = ""
Alacritty = ""
Thunderbird = ""
# smile emoji
MyNiceProgram = "😛"

[aliases]
TelegramDesktop = "Telegram"
"Org.gnome.Nautilus" = "Nautilus"

[general]
seperator = ""

For an overview of available options

$ swaywsr -h
swaywsr - sway workspace renamer 1.1.0
Pedro Scaff <[email protected]>

USAGE:
    swaywsr [FLAGS] [OPTIONS]

FLAGS:
    -h, --help                 Prints help information
    -n, --no-names             Set to no to display only icons (if available)
    -r, --remove-duplicates    Remove duplicate entries in workspace
    -V, --version              Prints version information

OPTIONS:
    -c, --config <config>    Path to toml config file
    -i, --icons <icons>      Sets icons to be used [possible values: awesome]

Configuration

This program depends on numbered workspaces, since we're constantly changing the workspace name. So your sway configuration need to reflect this:

bindsym $mod+1 workspace number 1

If you don't necessarily bind your workspaces to only numbers, or you want to keep a part of the name constant you can do like this:

bindsym $mod+q workspace number 1:[Q]

This way the workspace would look something like this when it gets changed:

1:[Q] Emacs|Firefox

You can take this a bit further by using a bar that trims the workspace number and be left with only

[Q] Emacs|Firefox

Contributors

Attribution

Thanks Daniel Berg (roosta) for the original i3wsr implementation. This program would not be possible without swayipc-rs, a rust library for controlling sway-wm through its IPC interface.

swaywsr's People

Contributors

ammgws avatar ram02z avatar

Stargazers

 avatar

Watchers

 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.