Coder Social home page Coder Social logo

i3blocklets's Introduction

i3blocklets

Demo

This repository contains the bash scripts which I use with i3blocks.

Dependencies

To use these scripts, the following dependencies need to be satisfied:

bar {
    # .... other stuff
    font pango:DejaVu Sans Mono, FontAwesome 9
}

Installation

  • Place example.conf as i3blocks.conf in your i3 config directory.
  • Replace PATH_TO_BLOCKLETS in the i3blocks.conf file with the directory's path which contains your blocklets.

Usage

Music Block

[music]
label= ๐ŸŽง
interval=1
instance=""
signal=3

You can also pass arguments to playerctl through the instance config variable. For example, instance="-p audacious" will be interpreted as playerctl -p audacious <random command>.

The following actions can be performed via the mouse

  • Left click - Switch to the previous song;
  • Right click - Switch to the next song;
  • Middle click - Pause/play the current song.
  • Scroll up - Seek song forward by 5 seconds;
  • Scroll down - Seek song backward by 5 seconds.

This seeking capability is only available for audacious currently.

The seeking capability has now been extended to all music players.

This script focuses only on MPRIS media players. Therefore this script won't work for cmus< v2.8.0. You may either update cmus or just add a bit of code as a workaround as done in this older commit.


Gmail Block

[gmail]
label=๐Ÿ“ง
interval=1800
instance=.gmail

This block will check your gmail account for mails every 1800 seconds, that is the interval time. This blocket uses OAuth2 for authorizing itself. To use this blocklet:

  • Create a project on Google API Console, enable Gmail API for your project, and create authorization credentials for this blocklet. Choose Other as Application Type while creating the OAuth client ID. Make sure to provide your application read-only access.

  • Once created, take note of the Client ID and Client Secret. These will be used later on.

  • Edit the configFile for this blocklet according to your needs and place it in the $HOME directory. You may rename it if you like. I personally prefer .gmail.

    The tokenFile variable must contain the path to the file which you want to create for storing access tokens for the API.

  • Now, generate your access token using genToken.sh by running ./genToken.sh -c <configFile> in the terminal. For example:

    # Specify config file using -c flag
    ./genToken.sh -c <path to config file>
    # Or simply use ~/.gmail as config file
    ./genToken.sh

    Google's user consent webpage will open up in your default browser. Allow this application there. This will generate a JSON file at the path specified in tokenFile variable in configFile.

Everything's done now. Just add the gmail block to your i3blocks config as shown above.

Note that the instance variable holds the path of the config file relative to the home directory, therefore .gmail is implicitly expanded to ~/.gmail.

The following actions can be performed via the mouse

  • Left click - Open GMail in the default browser;
  • Right click - Update mail count.

Average Load Block

[loadavg]
label=๏ƒค
interval=10
markup=pango
instance=3

Shows the average load of the processor. The output is colored red if the average load exceeds the threshold value. The threshold value can be provided through instance variable, which defaults to 5.

The following actions can be performed via the mouse:

  • Left click- Refresh average load value.

Storage Block

[disk]
label=๐Ÿ—„
interval=3600
markup=pango
instance=""

This block shows the remaining space on your disk. By default, the free space of $HOME partition will be shown, however, you may specify other partitions as well using the instance config variable. For exampe, instance="/dev/sda2".


Volume Block

[volume]
interval=once
signal=1

This block shows the volume level in percent. To reduce load, this script is loaded only once and then triggered on the press of media keys and block clicks. Therefore, it is highly important to bind the following command to your volume keys on the keyboard, otherwise the changes won't appear on the i3bar.

pkill -RTMIN+1 i3blocks

The following actions can be performed via the mouse

  • Left click - Mute;
  • Scroll up - Increase volume by 5%;
  • Scroll down - Decrease volume by 5%.

Internet Block

[internet]
interval=1800
markup=pango

This block shows whether your PC is connected to the internet or not. It relies on the ping command.

The following actions can be performed via the mouse

  • Left click - Refresh internet status.

For additional insight, you may also look into my i3blocks config file: i3blocks.conf.

i3blocklets's People

Contributors

brunetton avatar utkarshverma avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

i3blocklets's Issues

What version of font awesome are you using ?

I'm playing around with your scripts, but some glyphs are not displaying correctely (for example: disk usage). I'm using Font Awesome v4.7.0
What version of Font Awesome are you using ?

Thanks

Music

Mouse not usable in music as guided

Time not working on browser music (Online Youtube)

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.