All Projects → shdown → Luastatus

shdown / Luastatus

Licence: gpl-3.0
universal status bar content generator

Programming Languages

c
50402 projects - #5 most used programming language
lua
6591 projects

Projects that are alternatives of or similar to Luastatus

I3 Workspace Groups
Manage i3wm workspaces in groups you control
Stars: ✭ 139 (-28.72%)
Mutual labels:  i3, i3wm
I3 Wm Gruvbox Theme
An i3-wm gruvbox theme implementation
Stars: ✭ 188 (-3.59%)
Mutual labels:  i3, i3wm
I3lock Fancy Rapid
A faster implementation of i3lock-fancy.
Stars: ✭ 102 (-47.69%)
Mutual labels:  i3, i3wm
Connmap
connmap is an X11 desktop widget that shows location of your current network peers on a world map (tested only with i3wm). Made with C and libcairo.
Stars: ✭ 90 (-53.85%)
Mutual labels:  i3, i3wm
Tmux Tilish
Plugin which makes tmux work and feel like i3wm
Stars: ✭ 149 (-23.59%)
Mutual labels:  i3, i3wm
Dotfiles
My [NeoVim + Tmux + Fish Shell] Setup /w install scripts
Stars: ✭ 180 (-7.69%)
Mutual labels:  i3, i3wm
Azote
Wallpaper and colour manager for Sway, i3 and some other WMs
Stars: ✭ 138 (-29.23%)
Mutual labels:  i3, i3wm
I3keys
Lists available bindings for i3 or Sway with a graphical or text keyboard
Stars: ✭ 81 (-58.46%)
Mutual labels:  i3, i3wm
Sgtk Menu
GTK launchers for sway & other WMs w/ menu, dmenu, application grid and button bar
Stars: ✭ 112 (-42.56%)
Mutual labels:  i3, i3wm
I3 Wm Config
I3 tiling window manager configuration
Stars: ✭ 109 (-44.1%)
Mutual labels:  i3, i3wm
I3 Polybar Config
My i3 configuration with polybar for HiDPI screen (4k)
Stars: ✭ 84 (-56.92%)
Mutual labels:  i3, i3wm
Wmfocus
Visually focus windows by label
Stars: ✭ 132 (-32.31%)
Mutual labels:  i3, i3wm
I3lock Fancy
i3lock script that takes a screenshot of the desktop, blurs the background and adds a lock icon and text
Stars: ✭ 1,249 (+540.51%)
Mutual labels:  i3, i3wm
I3 Gnome Pomodoro
🍅 Integrate gnome-pomodoro into i3
Stars: ✭ 159 (-18.46%)
Mutual labels:  i3, i3wm
I3 Config
i3wm configuration files
Stars: ✭ 81 (-58.46%)
Mutual labels:  i3, i3wm
I3 Autodisplay
i3wm multiple monitors auto configuration
Stars: ✭ 104 (-46.67%)
Mutual labels:  i3, i3wm
I3 Config
I3-gaps configuration
Stars: ✭ 67 (-65.64%)
Mutual labels:  i3, i3wm
I3ipc Glib
A C interface library to i3wm
Stars: ✭ 72 (-63.08%)
Mutual labels:  i3, i3wm
I3wsr
Change i3-wm workspace names based on content
Stars: ✭ 107 (-45.13%)
Mutual labels:  i3, i3wm
3mux
Terminal multiplexer inspired by i3
Stars: ✭ 1,687 (+765.13%)
Mutual labels:  i3, i3wm

CircleCI build status Gitter

luastatus is a universal status bar content generator. It allows you to configure the way the data from event sources is processed and shown, with Lua.

Its main feature is that the content can be updated immediately as some event occurs, be it a change of keyboard layout, active window title, volume or a song in your favorite music player (provided that there is a plugin for it) — a thing rather uncommon for tiling window managers.

Its motto is:

No more heavy-forking, second-lagging shell-script status bar generators!

Screenshot

Screenshot

Above is i3bar with luastatus with Bitcoin price, time, volume, and keyboard layout widgets.

Key concepts

Explanation

In short:

  • plugin is a thing that decides when to call the callback function widget.cb and what to pass to it;
  • barlib (bar library) is a thing that decides what to with values that widget.cb function returns;
  • there are also derived plugins, which are plugins written in Lua that use regular plugins.

Examples

ALSA volume widget:

widget = {
    plugin = 'alsa',
    opts = {
        channel = 'PCM'
    },
    cb = function(t)
        if t.mute then
            return {full_text = '[mute]', color = '#e03838'}
        else
            local percent = (t.vol.cur - t.vol.min)
                          / (t.vol.max - t.vol.min)
                          * 100
            return {full_text = string.format('[%3d%%]', math.floor(0.5 + percent)),
                    color = '#718ba6'}
        end
    end,
    event = function(t)
        if t.button == 1 then     -- left mouse button
            os.execute('urxvt -e alsamixer &')
        end
    end
}

GMail widget (uses the derived plugin imap):

--[[
-- Expects 'credentials.lua' to be present in the current directory; it may contain, e.g.,
--     return {
--         gmail = {
--             login = 'john.smith',
--             password = 'qwerty'
--         }
--     }
--]]
credentials = require 'credentials'
widget = luastatus.require_plugin('imap').widget{
    host = 'imap.gmail.com',
    port = 993,
    mailbox = 'Inbox',
    use_ssl = true,
    timeout = 2 * 60,
    handshake_timeout = 10,
    login = credentials.gmail.login,
    password = credentials.gmail.password,
    error_sleep_period = 60,
    cb = function(unseen)
        if unseen == nil then
            return nil
        elseif unseen == 0 then
            return {full_text = '[-]', color = '#595959'}
        else
            return {full_text = string.format('[%d unseen]', unseen)}
        end
    end,
    event = [[                    -- separate-state event function
        local t = ...             -- obtain argument of this implicit function
        if t.button == 1 then     -- left mouse button
            os.execute('xdg-open https://gmail.com &')
        end
    ]]
}

See more examples here.

Installation

cmake . && make && sudo make install

You can specify a Lua library to build with: cmake -DWITH_LUA_LIBRARY=luajit .

You can disable building certain barlibs and plugins, e.g. cmake -DBUILD_PLUGIN_XTITLE=OFF .

You can disable building man pages: cmake -DBUILD_DOCS=OFF .

Getting started

It is recommended to first have a look at the luastatus' man page.

Then, read the barlib's and plugins' documentation, either via directly viewing barlibs/<name>/README.rst and plugins/<name>/README.rst files, or via installing the man pages and reading luastatus-barlib-<name>(7) and luastatus-plugin-<name>(7).

Barlib-specific notes on usage follow.

i3

luastatus-i3-wrapper should be specified as the i3bar's status command in the i3 config, e.g.:

bar {
    status_command cd ~/.config/luastatus && exec luastatus-i3-wrapper -B no_separators time-battery-combined.lua alsa.lua xkb.lua

See also README for i3 and examples for i3.

dwm

luastatus should simply be launched with -b dwm, e.g.:

luastatus -b dwm -B separator=' • ' alsa.lua time-battery-combined.lua

See also README for dwm and examples for dwm.

lemonbar

lemonbar should be launched with luastatus-lemonbar-launcher, e.g.:

luastatus-lemonbar-launcher -p -B#111111 -p -f'Droid Sans Mono for Powerline:pixelsize=12:weight=Bold' -- -Bseparator=' ' alsa.lua time-date.lua

See also README for lemonbar and examples for lemonbar.

stdout

luastatus should be launched with luastatus-stdout-wrapper; or write your own wrapper, see e.g. the wrapper for launching dvtm with luastatus.

See also README for stdout and and examples for stdout.

Supported Lua versions

  • 5.1
  • LuaJIT, which is currently 5.1-compatible with "some language and library extensions from Lua 5.2"
  • 5.2
  • 5.3
  • 5.4

Reporting bugs, requesting features, suggesting patches

Feel free to open an issue or a pull request. You can also chat on our Gitter chat room.

Migrating from older versions

See the Migration Guide.

Acknowledgements

  • I would like to thank wm4 for developing mpv, which, also being a “platform” for running Lua scripts, served as an inspiration for this project.

Donate

You can donate to our collective on Open Collective.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].