Giter Site home page Giter Site logo

ciavash / sway-config Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 61 KB

A Raku library and script for parsing Sway window manager's config

Home Page: https://codeberg.org/CIAvash/Sway-Config

License: GNU Lesser General Public License v3.0

Raku 100.00%
raku rakulang module raku-module cli command-line library app config parser sway swaywm sway-config

sway-config's Introduction

NAME

Sway::Config - A Raku library and script for parsing Sway window manager's config.

DESCRIPTION

Sway::Config is a module and program for parsing Sway window manager's config, and getting the raw Match, configs, variables, modes and key bindings, either as Raku data structures or as JSON.

INSTALLATION

You need to have Raku and zef, then run:

zef install --/test "Sway::Config:auth<zef:CIAvash>"

or if you have cloned the repo:

zef install .

TESTING

prove -ve 'raku -I.' --ext rakutest

CLI

SYNOPSIS

sway-config - Parses Sway config and prints the specified section

By default gets the config from sway, unless config or config path is provided via stdin or command option.

Then parses the config and prints the requested output as JSON.

Usage:
  bin/sway-config -v|--version -- Prints version
  bin/sway-config all [-i|--stdin] [-c|--config-path=<Str>] -- Prints configs, variables, modes and key_bindings as JSON
  bin/sway-config configs [-i|--stdin] [-c|--config-path=<Str>] -- Prints configs as JSON
  bin/sway-config match [-i|--stdin] [-c|--config-path=<Str>] -- Prints raw match as JSON
  bin/sway-config variable [-i|--stdin] [-c|--config-path=<Str>] -- Prints variables as JSON
  bin/sway-config mode [-i|--stdin] [-c|--config-path=<Str>] -- Prints modes as JSON
  bin/sway-config key_binding [-i|--stdin] [-c|--config-path=<Str>] -- Prints key bindings as JSON (Object/Hash)
  bin/sway-config key_bindings [-i|--stdin] [-c|--config-path=<Str>] -- Prints key bindings as JSON (Array)

COPYRIGHT

Copyright © 2021 Siavash Askari Nasr

LICENSE

sway-config is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

sway-config is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with sway-config. If not, see http://www.gnu.org/licenses/.

LIBRARY

SYNOPSIS

use Sway::Config:auth<zef:CIAvash>;

# By default Sway::Config gets the config from Sway
my $config = Sway::Config.new;

# Giving the config content to Sway::Config
my $config2 = Sway::Config.new: :config('Your Config Here');

# Giving path of a config file to Sway::Config
my $config3 = Sway::Config.new: :config_path<Path to config file>;

put $config.match;

put $config.mode<resize>;

put $config.configs: :json;

ATTRIBUTES

has Str $.config

Content of the config to parse

has IO() $.config_path

Path to the config file

METHODS

multi method match

multi method match() returns Match

Returns the raw match object

multi method match

multi method match(
    Bool:D :json($)
) returns Str

Returns the raw Match object as JSON

multi method configs

multi method configs() returns Array

Returns the parsed confis as an Array

multi method configs

multi method configs(
    Bool:D :json($)
) returns Str

Returns the parsed confis as JSON

multi method variable

multi method variable() returns Hash

Returns the parsed variables as a Hash

multi method variable

multi method variable(
    Bool:D :json($)
) returns Str

Returns the parsed variables as JSON

multi method mode

multi method mode() returns Hash

Returns the parsed modes as a Hash

multi method mode

multi method mode(
    Bool:D :json($)
) returns Str

Returns the parsed modes as JSON

multi method key_binding

multi method key_binding() returns Hash

Returns the parsed key bindings as a Hash

multi method key_binding

multi method key_binding(
    Bool:D :json($)
) returns Str

Returns the parsed key bindings as JSON (Object/Hash)

multi method key_bindings

multi method key_bindings() returns List

Returns the parsed key bindings as a List

multi method key_bindings

multi method key_bindings(
    Bool:D :json($)
) returns Str

Returns the parsed key bindings as JSON (Array)

multi method all

multi method all() returns Hash

Returns the parsed configs, variables, modes and key bindings as a Hash

multi method all

multi method all(
    Bool:D :json($)
) returns Str

Returns the parsed configs, variables, modes and key bindings as JSON

COPYRIGHT

Copyright © 2021 Siavash Askari Nasr

LICENSE

Sway::Config is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Sway::Config is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with Sway::Config. If not, see http://www.gnu.org/licenses/.

REPOSITORY

https://github.com/CIAvash/Sway-Config/

BUG

https://github.com/CIAvash/Sway-Config/issues

AUTHOR

Siavash Askari Nasr - https://www.ciavash.name

sway-config's People

Contributors

ciavash avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

melezhik

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.