Giter Site home page Giter Site logo

jakestanger / ironbar Goto Github PK

View Code? Open in Web Editor NEW
422.0 8.0 32.0 1.85 MB

Customisable Wayland gtk bar written in Rust.

Home Page: https://crates.io/crates/ironbar

License: MIT License

Rust 97.37% Nix 2.07% Shell 0.52% Lua 0.04%
bar desktop gtk gtk-layer-shell rust sway wayland hyprland wlroots

ironbar's Introduction

--- Ironbar ---


A customisable and feature-rich GTK bar for wlroots compositors, written in Rust.

Ironbar is designed to support anything from a lightweight bar to a full desktop panel with ease.


Getting Started

Wiki | Configuration Guide | Style Guide


Screenshot of fully configured bar with MPD widget open

✨ Looking for a starting point, or want to show off? Head to Show and tell


Features

  • First-class support for Sway and Hyprland
  • Fully themeable with hot-loaded CSS
  • Popups to show rich content
  • Ability to create custom widgets, run scripts and embed dynamic content
  • Easy to configure anything from a single bar across all monitors, to multiple different unique bars per monitor
  • Support for multiple config languages

Installation

Packaging status

Cargo

crate

Ensure you have the build dependencies installed.

cargo install ironbar

Arch Linux

aur package

yay -S ironbar-git

Nix

nix package

nix-shell -p ironbar

Flake

A flake is included with the repo which can be used with Home Manager.

Example usage
{
  # Add the ironbar flake input
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  inputs.ironbar = {
    url = "github:JakeStanger/ironbar";
    inputs.nixpkgs.follows = "nixpkgs";
  };
  inputs.hm = {
    url = "github:nix-community/home-manager";
    inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = inputs: {
    homeManagerConfigurations."USER@HOSTNAME" = inputs.hm.lib.homeManagerConfiguration {
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
      modules = [
        # And add the home-manager module
        inputs.ironbar.homeManagerModules.default
        {
          # And configure
          programs.ironbar = {
            enable = true;
            config = {};
            style = "";
            package = inputs.ironbar;
            features = ["feature" "another_feature"];
          };
        }
      ];
    };
  };
}

CI builds are automatically cached by Garnix. You can use their binary cache by following the steps here.

Void Linux

void package

xbps-install ironbar

Source

repo

Ensure you have the build dependencies installed.

git clone https://github.com/jakestanger/ironbar.git
cd ironbar
cargo build --release
# change path to wherever you want to install
install target/release/ironbar ~/.local/bin/ironbar

By default, all features are enabled. See here for controlling which features are included.

Running

Once installed, you will need to create a config and optionally a stylesheet in .config/ironbar. See the Configuration Guide and Style Guide for full details.

Ironbar can be launched using the ironbar binary.

The IRONBAR_LOG and IRONBAR_FILE_LOG environment variables can be set to change console and file log verbosity respectively. You can use any of error, warn, info, debug or trace.

These default to IRONBAR_LOG=info and IRONBAR_FILE_LOG=warn. Note that you cannot increase the file log verbosity above console verbosity.

Log files can be found at ~/.local/share/ironbar/.log.

Status

Ironbar is an alpha project. It is unfinished and subject to constant breaking changes, and will continue that way until the foundation is rock solid.

If you would like to take the risk and help shape development, any bug reports, feature requests and discussion is welcome.

I use Ironbar on my daily driver, so development is active. Features aim to be stable and well documented before being merged.

Contribution Guidelines

All are welcome, but I ask a few basic things to help make things easier. Please check here for details.

Acknowledgements

  • Waybar - A lot of the initial inspiration, and a pretty great bar.
  • Rustbar - Served as a good demo for writing a basic GTK bar in Rust
  • Smithay Client Toolkit - Essential in being able to communicate to Wayland
  • gtk-layer-shell - Ironbar and many other projects would be impossible without this
  • Mixxc - Basis for Ironbar's PulseAudio client code and a cool standalone volume widget.

ironbar's People

Contributors

a-cloud-ninja avatar body20002 avatar calops avatar chmanie avatar christoph00 avatar claireneveu avatar colemickens avatar cyhyraethz avatar delliottxyz avatar dependabot[bot] avatar disr0 avatar eclairevoyant avatar github-actions[bot] avatar jakestanger avatar malicean avatar nyadiia avatar oknozor avatar p00f avatar pinkcreeper100 avatar rdnelson avatar schweber avatar slowsage avatar thmasq avatar ttoino avatar yavko avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ironbar's Issues

[MPRIS] Remote images not displaying

Describe the bug
Some players provide the Art URL as an HTTPS link rather than a local file. These error when trying to load them.

2023-01-27T20:46:31.651819Z ERROR ironbar::modules::music: Error { domain: g-file-error-quark, code: 4, message: "Failed to open file “https://i.scdn.co/image/ab67616d0000b273020c9abc9f33ca3d104509de”: No such file or directory" }

To Reproduce
Steps to reproduce the behavior:

  1. Use local Spotify client
  2. Play track
  3. Open music widget popup

Expected behavior
The art should appear

System information:

  • Ironbar version: 0.9.0 (git)

Eww style Basic Var

Is your feature request related to a problem? Please describe.
Not exactly a problem, but just an annoyance

Describe the solution you'd like
Add support for variables, like eww's defvar image this would reduce the required scripting to make it work. Without this, I would have to use external scripts to save the state into a lock, which works, but get tedious real quickly. Although this feature is probably out of scope to this issue anyway

Describe alternatives you've considered
using script and lock.

Additional context
#70 originates in this issue

Improve build/install instructions

Is your feature request related to a problem? Please describe.

Cargo install fails building atk-sys, gdk-sys and possibly more.

Describe the solution you'd like

In a utopia ironbar would not link to/need any system packages installed. It would help adoption if there where a list of ubuntu/debian packages needed to (cargo) install.

Describe alternatives you've considered

A list of the system libraries needed with their major versions.

Additional context

The following errors were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "atk" "atk >= 2.28"` did not exit successfully: exit status: 1

error: failed to run custom build command for `atk-sys v0.16.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installAm9TUy/release/build/atk-sys-b04eb869269e6d91/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=ATK_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=`"pkg-config" "--libs" "--cflags" "atk" "atk >= 2.28"` did not exit successfully: exit status: 1
  error: could not find system library 'atk' required by the 'atk-sys' crate

  --- stderr
  Package atk was not found in the pkg-config search path.
  Perhaps you should add the directory containing `atk.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'atk' found
  Package atk was not found in the pkg-config search path.
  Perhaps you should add the directory containing `atk.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'atk' found

warning: build failed, waiting for other jobs to finish...
error: failed to compile `ironbar v0.10.0`, intermediate artifacts can be found at `/tmp/cargo-installAm9TUy`

[Launcher] Item state does not change on startup

If the bar launches on startup (I think, might be something else?), Sway events stop being received by the module. Clicking items still works according to their current state, but focus/urgency/open states do not change.

Notification tray module

Would be cool to be able to connect to notification daemons and keep track of past notifications, displaying them in a popout panel/tray of sorts.

Update examples

Lots of config changes since examples were made - go through and make sure they're all up to date. Also update screenshots.

High CPU usage

Bar seems to use quite a bit of CPU power to just sit there.

Make config errors more easy to debug

Currently I'm in the middle of writing a config.
image
I'm... trying to debug? but the error msg isn't exactly useful
image
I hope that at least we can add an message to tell the user which line of the config has gone wrong

Popups often open in wrong place

If a launcher item with multiple windows is hovered over, and you hover over another item with multiple windows right next to it, the popup position is incorrectly indicated.

One possible way around this would to use something based of GTK menus rather than a whole separate window for the popups, but it doesn't seem trivial to stop them grabbing mouse focus.

Usage of symbolic icons from the system icon theme

Is your feature request related to a problem? Please describe.

having to use a nerd font for icons

Describe the solution you'd like

allow for using the icons from the system icon theme for modules/widgets

Support for onhover Module-level options

Is your feature request related to a problem? Please describe.
I could barely script this using hyprctl cursorpos but it's just too ugly and spamming sockets generally isn't a good idea.

Describe the solution you'd like
More specifically, onhover and onhoverlost. Using script [oneshot] is fine, but I would like to propose an alternate solution.
Add support for variables, like eww's defvar
image
this would reduce the required scripting to make it work. Without this, I would have to use external scripts to save the state into a lock, which works, but get tedious real quickly.
Although this feature is probably out of scope to this issue anyway

Tooltip script embedding doesn't respect ordering

Describe the bug

title
image

To Reproduce
Steps to reproduce the behavior:
set this somewhere in config tooltip = "{{~/.config/ironbar/scripts/ram_info}} GiB"
the bug happened

Expected behavior
I would like it to be 14.475 GiB

System information:

  • Arch Linux
  • Hyprland
  • Ironbar version: 0.1.0

Configuration

Share your bar configuration and stylesheet as applicable:

https://gitea.com/SimplyKyle/dotfiles/src/branch/main/home/.config/ironbar

Additional context
Haven't used ironbar in a while, might be a configuration error

Does not work with `swaybar_command`

The bar does not start when setting in sway config like so:

bar {
  swaybar_command ironbar
}

Can workaround by executing directly (I think):

exec ironbar

Tray issues

Describe the bug
When I use the tray icon from nm-applet,

  1. The icons don't get updated (for example the icon should become a lock when a VPN is enabled but this doesn't happen until I restart the bar)

  2. There are no checkboxes (each of the three vpn connections is supposed to have a checkbox to its left)
    Screenshot from 2023-03-19 at 16_37_27 951359431

  3. The bar crashes after some time of interacting with tray items:
    https://paste.sr.ht/~p00f/6c6afbfd14a1aacaee2ba6d49cb9e582323eded4

  4. Clicking buttons doesn't work in the main dropdown

To Reproduce
Steps to reproduce the behavior:

  1. Run nm-applet --indicator
  2. Right click the tray item, "Enable networking" and "Enable Wi-Fi" don't have checkboxes next to them.
  3. Clicking "enable networking" doesn't toggle network (clicking vpn connections > some connection does toggle that connect though)
  4. Interact with the menu items for some time, the bar crashes

System information:

  • Distro: Arch Linux
  • Compositor: River
  • Ironbar version: d4dd8 + my upower commit (I hope that's not relevant)

Configuration

Share your bar configuration and stylesheet as applicable:

Config
position: "top"
height: 25
start:
  - type: "focused"
    show_icon: true
    show_title: true
    truncate: "end"
center:
  - type: "clock"
    format: "%a %d            %H:%M"
end:
  - type: "upower"
    format: "icon:{icon} {percentage}%"
  - type: "tray"

Styles
.background {
    background-color: black;
}

#bar {
    background-color: black;
}


#focused {
    font-size: 17px;
    font-weight: bold;
}

#clock {
    font-size: 17px;
    font-weight: bold;
}

Power menu module

Widget that opens a popup containing shutdown/restart/logoff/lock controls

[BREAKING] Improvements to selecting widgets with CSS

Is your feature request related to a problem? Please describe.
nth-of-type is not supported in GTK3 CSS, which makes it harder to style widgets when you have multiple of each instance.

Describe the solution you'd like

  • Widgets should use classes instead of names to be more standard - this is going to be a BIG BREAKING CHANGE to existing stylesheets.
  • A widget-level name config option should be added to set a custom widget name.

Describe alternatives you've considered
You can currently work around using nth-child but this requires hard-coding the widget's index within the section.

Additional context
Origin: #31

Volume module

A volume module with a popup widget that has a slider. option to choose backend (wpctl, pactl, etc). usage of on-scroll events to change volume without opening the widget.

[Music] Ability to truncate text

Is your feature request related to a problem? Please describe.

Very long song names (or whatever tokens are used) cause the music module to become excessively wide and causes other modules to be pushed out the way.

Describe the solution you'd like

There should be two new options (bikeshed names):

-truncate_width - sets the max width for the widget. Beyond this, the text is truncated.

  • truncate_mode - whether to truncate from the start, middle or end of text.

Describe alternatives you've considered
None.

MPRIS module

An MPRIS widget with the same design as the MPD one would allow for a much wider range of music players to work with the bar.

Clipboard does not correctly paste large images into xwayland apps

Describe the bug
When you copy an image that is large enough to buffer from the clipboard, and attempt to paste it into an xwayland app, it will either fail to paste or only paste partial content.

Pasting the same image into a native Wayland app works fine.

To Reproduce
Steps to reproduce the behavior:

  1. Run ironbar with the clipboard module
  2. Copy a large image (>1MB)
  3. Copy anything else
  4. Switch back to the large image using the clipboard module
  5. Attempt to paste into an xwayland app (such as Discord chat, desktop mail client, xwayland browser app)

Expected behavior
The full image should be correctly pasted.

System information:

  • Distro: Arch Linux
  • Compositor: Sway (git)
  • Wlroots git
  • Ironbar version: 0.10.0 git (d4dd8c4)
λ pacman -Q sway wlroots
sway-force-ssd-git r7095.90c2d631e-1
wlroots-git 0.17.0.r6172.689627f0c-1

Additional context
Have not tested on stable wlroots/compositor, nor on other compositors. Positive this is an xwayland problem, but not sure where in the pipeline the problem lies - presumably there's a workaround for this Ironbar can integrate since the clipboard can normally paste into xwayland apps.

Screenshots
Image dimensions are preserved, but last section is pasted as transparent due to missing data:
image

home-manager module doesn't work

Discussed in #87

Originally posted by riley-martin March 28, 2023
I am trying to use the ironbar home-manager module, but I get this error:

error: attempt to call something which is not a function but a set

       at /nix/store/654cn2v25aifhgqrf4q2rj8fk1brncz5-source/flake.nix:106:31:

          105|       cfg = config.programs.ironbar;
          106|       defaultIronbarPackage = self.packages.${pkgs.hostPlatform.system}.default [];
             |                               ^
          107|       jsonFormat = pkgs.formats.json {};
(use '--show-trace' to show detailed location information)

I am using nixpkgs unstable. Here are (I think) all the relevant parts of my config.

flake.nix:

{
  description = "Home Manager configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    ironbar = {
      url = "github:JakeStanger/ironbar";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    hyprland.url = "github:hyprwm/Hyprland";
  };

  outputs = { nixpkgs, home-manager, hyprland, ironbar, ...} @ inputs:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in {
      homeConfigurations.riley = home-manager.lib.homeManagerConfiguration {
        inherit pkgs;
        modules = [
          hyprland.homeManagerModules.default
          ironbar.homeManagerModules.default
          ./home.nix
        ];
      };
    };
}

And in ironbar.nix, which I import from home.nix I have this:

{ ... }: {
  programs.ironbar = {
    enable = true;
    config = {};
    style = "";
}

I am pretty new to nix; apologies if I missed something really obvious.

More positioning options

Should support:

  • Vertical bars, ie ability to position on the left and right.
    • This will require any Orientation::Horizontal boxes in widgets to automatically switch to Orientation::Vertical
  • Ability to disable anchoring to edges, ie allowing for centered docks

Support for modules embedding in Custom

From what I've observed, you can only put Widget in the Custom modules, I wish you can put modules (e.g. script) in the custom modules.
I want this cause I want to do retractable modules

upower module

upower: https://upower.freedesktop.org/

can be used to listen to device events like charger connected/battery level changed instead of polling.
I want to implement this feature and am planning to use the upower-dbus crate

Run without sway

It would be nice if the bar could run without the features that require sway if it isn't present, also for workspaces to use the standardized wlr_ext_workspace_unstable_v1 protocol. I would love to try this bar, but I run Hyprland and not sway.

But I'm willing to add support for Hyprland as a pr in the future, and it wouldn't be too hard as I have developed a crate to communicate with Hyprland.

Support for simple labels

Is your feature request related to a problem? Please describe.
currently(at least not without using the custom module), it's not possible to create a module that has two running script. (see e.g.)
scripts/wifi_icon scripts/wifi_essid

Describe the solution you'd like
We can either expand the current script module(by adding an option maybe called format)
or create a new module that supports the short-hand for scripts({{script}})

Describe alternatives you've considered
Using the custom module, which works but... it's not elegant
Additional context
While using the custom module workaround. I've found one tiny issue with the label set to this{{100:scripts/wifi_icon scripts/wifi_essid}}
it sometimes would output this instead. but sometimes it works.
image
i'm guessing it's somewhat of an racing condition? or does ironbar simply output the script which got executed first

More types of widgets for the custom module

When configuring custom modules for stuff like volume/brightness/battery/etc. the current selection of widgets is really limiting, I would especially like a slider/progress bar for these situations.

Build feature flags

Is your feature request related to a problem? Please describe.
Compile times are very high. A lot of that time is compiling dependencies only used by a single module that might not be in use.

Describe the solution you'd like
Per-module feature flags would allow users to compile only what they want into the bar to reduce compile time every update.

Describe alternatives you've considered
Distributed binaries. Will probably do this once the project matures in addition.

Coredump on Hyprland/Arch

When I try to start Ironbar I get a coredump:

2023-02-26T18:05:20.661011Z  INFO ironbar: Ironbar version 0.10.0 
2023-02-26T18:05:20.661060Z  INFO ironbar: Starting application 
2023-02-26T18:05:20.728345Z DEBUG ironbar: Loaded config file 
2023-02-26T18:05:20.728374Z DEBUG ironbar: Received 1 outputs from Wayland 
2023-02-26T18:05:20.728411Z DEBUG ironbar: Outputs: [OutputInfo { id: 44, model: "0xA08B", make: "AU Optronics", name: "eDP-1", description: "AU Optronics 0xA08B (eDP-1)", location: (0, 0), physical_size: (340, 190), subpixel: Unknown, transform: Normal, scale_factor: 1, modes: [Mode { dimensions: (1920, 1080), refresh_rate: 60164, is_current: true, is_preferred: false }], obsolete: false }] 
2023-02-26T18:05:20.728459Z  INFO ironbar: Creating bar on 'eDP-1' 
2023-02-26T18:05:20.733976Z DEBUG ironbar::clients::compositor: Getting workspace client for: Hyprland
2023-02-26T18:05:20.734008Z  INFO ironbar::clients::compositor::hyprland: Starting Hyprland event listener
2023-02-26T18:05:20.734484Z DEBUG ironbar::popup: Registered popup content for #1 
Segmentation fault (core dumped) 

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.