Giter VIP home page Giter VIP logo

swayest_workstyle's Introduction

Swayest Workstyle

AUR version Crates.io

Map workspace name to icons defined depending on the windows inside of the workspace.

An executable similar to workstyle.

Differences between sworkstyle and workstyle:

  • Plug-and-play solution, build-in matching config, you can extend this config by creating/modifying .config/sworkstyle/config.toml or you can make a PR for your package manager or this repository with new matchers.

  • Way better matching: using regex, exact app names and generic app titles.

  • Specifically meant for Sway and Wayland

  • Fallback Icon

  • Deduplication

Your workspace shall never contain an empty icon again!

An example of what it does (using waybar which also hides the workspace index):


Installation

Cargo

cargo install sworkstyle

Arch Linux

You can install it manually or use a aur helper like Yay.

yay -S sworkstyle

Usage

sworkstyle

Sway Configuration

Add the follow line to your sway config file (~/.config/sway/config).

exec sworkstyle &> /tmp/sworkstyle.log

NOTE: When using the cargo install make sure to add the .cargo/bin to the PATH environment variable before executing sway. You can do this by adding export PATH="$HOME/.cargo/bin:$PATH" to .zprofile or .profile

You should configure anything mentioning a workspace (assign, keybinding) to use numbered workspaces. This is because sworkstyle will rename your workspaces many times so it needs a constant number that doesn't change in order to work correctly.

Prefer

assign [class="^Steam$"] number 1
bindsym $mod+1 workspace number 1

over

assign [class="^Steam$"] 1
bindsym $mod+1 workspace 1

Sworkstyle Configuration

The main configuration consists of deciding which icons to use for which applications.

The config file is located at ${XDG_CONFIG_HOME}/sworkstyle/config.toml. Its values will take precedence over the defaults. The syntax is in TOML and should be pretty self-explanatory.

When an app isn't recognized in the config, sworkstyle will log the application name as a warning. Simply add that string to your config file, with an icon of your choice.

Note that the crate find_unicode can help find a unicode character directly from the command line. It now supports all of nerdfonts unicode space.

For a reference to the regex syntax see the regex crate

Matching

Standard

'{pattern}' = '{icon}'

# pattern: Can either be the exact "app_name" (app_id/class) of the window or a regex string in the format of `"/{regex}/"` which will match the window "title".
# icon: Your beautiful icon

Verbose

'{pattern}' = { type = 'generic' | 'exact', value = '{icon}' }

Note: You'll only have to use the verbose format when matching generic with a case insensitive text. 'case insensitive title' = { type = 'generic', value = 'A' }

Troubleshooting

If it couldn't match something it will print:

WARN [sworkstyle:config] No match for '{app_name}' with title '{title}'

You can use {title} to do a generic matching

You can use {app_name} to do an exact match

Default Config

The default config uses font-awesome for icon mappinigs.

The default config is always appended to whatever custom config you define. You can overwrite any matching or make a PR if you feel like a matching should be a default.

fallback = ''

[matching]
'discord' = ''
'balena-etcher' = ''
'Chia Blockchain' = ''
'Steam' = ''
'vlc' = ''
'org.qbittorrent.qBittorrent' = ''
'Thunderbird' = ''
'thunderbird' = ''
'Postman' = ''
'Insomnia' = ''
'Bitwarden' = ''
'Google-chrome' = ''
'Chromium' = ''
'Slack' = ''
'Code' = ''
'code-oss' = ''
'jetbrains-studio' = ''
'Spotify' = ''
'GitHub Desktop' = ''
'/(?i)Github.*Firefox/' = ''
'firefox' = ''
'Nightly' = ''
'firefoxdeveloperedition' = ''
'/nvim ?\w*/' = ''
'/npm/' = ''
'/node/' = ''
'/yarn/' = ''
'Alacritty' = ''

Package Maintainers

If you want to change the build-in config, change src/default_config.toml with your config and install the project.

You might also want font-awesome as a dependency depending on your config.

You can also make a PR to add a badge and add your install method under #Installation or to add matchers to the build-in config.

See aur for an example build.

Roadmap

  • An --unique param where you only have a single icon per workspace based on the matching with biggest priority.
  • Add hyprland support

Known Issues

  • Using sway's alt-tab behavior can cause a workspace to be not named

swayest_workstyle's People

Contributors

lyr-7d1h avatar gullegugg avatar alxchk 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.