Giter VIP home page Giter VIP logo

goblocks's Introduction

Goblocks

Goblocks is a dwm status bar program partially inspired by dwmblocks.

Goblocks in action

It is lightweight, fast, multithreaded, well(-ish) documented and easily customizable. It is also one of very few status bars done correctly. Most of them "naively" scan for changes every 1s or so, whereas goblocks only updates when there are updates to be done.

Installation

Pull this repo and run:

make install

This will build this project and generate default config file at $HOME/.config/goblocks.json. After that you can simply run it with

goblocks &!

If you want to uninstall it, just run.

make uninstall

Customization

You can add your own blocks in config file. Just remember to modify config at ~/.config/ goblocks.json. After you have applied your changes, just re run the aplication.

In order to add new block to the bar add new action object to actions array in goblocks.json:

"actions":
	[
		{
			"prefix": "๐Ÿ—“ ",
			"updateSignal": "35",
			"command": "#Date",
			"format": "Monday 02/01/2006 15:04:05",
			"timer": "1s"
		},
		{
			"prefix": "๐Ÿ”Š ",
			"updateSignal": "36",
			"command": "amixer get Master | awk ' \/%\/ {print $5 $6}' | head -1 | sed -e 's\/]\\[\/ \/g'",
			"timer": "0"
		},
		{
			"prefix": "Mem: ",
			"updateSignal": "37",
			"command": "#Memory",
			"suffix": "%",
			"format": "%.2f",	
			"timer": "2s"
		},
		{
			"prefix": "CPU: ",
			"updateSignal": "38",
			"command": "#Cpu",
			"suffix": "%",
			"format": "%.2f",	
			"timer": "2s"
		}
	]

Config properties

  1. prefix(optional):text that will be displayed before the output of command.
  2. updateSignal: signal that can be sent to goblocks to re-run the command and refresh output in bar. This value must be in range 34-64 inclusive.
  3. command: functionality that will produce the text for status bar. If it starts with hash-tag goblocks will try to invoke corresponding built-in function. If it doesn't then goblocks will run command in shell(sh) and put it's output in status bar.
  4. suffix(optional): Text that will be displayed after the output of command
  5. Timer: Time period after which command is being re-run and text in status bar refreshed. s for seconds(1s), m for minutes(1m), h for hours(1h). When set to 0 the block will only update at startup and when updateSignal is sent to goblocks.

Signaling Blocks

Blocks can be updated immediately by sending the corresponding updateSignal to the goblocks process. For example, kill -35 $(pidof goblocks) will update the block with updateSignal 35. Alternatively, you can signal a block with pkill -RTMIN+<x> goblocks where x is the updateSignal minus 34. So pkill -RTMIN+1 goblocks will update blocks with updateSignal 35.

Note if multiple blocks are assigned the same updateSignal only the first will be updated.

Miscellaneous

Formating date with #Date built in program

Format a reference layout parameter (Mon Jan 2 15:04:05 MST 2006) in a way that you would like to have your time formatted. If you have trouble check out this guideline.

Escape sh commands

Some sh commands have characters (e.g. \) which have a special meaning in JSON format. To easily escape them just dump your sh commands to json formatter.

TODO

  1. Create a block that displays weather condition. Done
  2. Add implementation documentation Code is pretty readable and has comments. This should be enough
  3. Add support for colour text in blocks.

Feedback

Your feedback is more than welcome and if you have some questions/issues/feature ideas just post them on issues page.

goblocks's People

Contributors

bramverb avatar codesoap avatar ldaxar avatar lordrusk avatar nrocy 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.