init
This commit is contained in:
Symlink
+1
@@ -0,0 +1 @@
|
||||
flake-profile-2-link
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
/nix/store/dyzaj39zgs8x6qypyzwqvabbwihk5hzm-nix-shell-env
|
||||
Generated
+3560
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "barbar"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
iced = { version = "0.14", default-features = false, features = ["wgpu", "wayland", "crisp", "web-colors", "thread-pool"] }
|
||||
iced_layershell = { version = "0.19", default-features = false }
|
||||
Generated
+77
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1787326676,
|
||||
"narHash": "sha256-lWhBbBvC05/xwivKBBiM2YNizpmgqCgyOIzomvRuwxs=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "692f7e9ef2ece8125b466f66f2af532b3edaed0d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1787964612,
|
||||
"narHash": "sha256-0N9nghg3nwzX6b6qc77EzjR9cu/Z+UR66FlfsCqiURs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e8be7818e19ada32105a8af937a6a473b38167ca",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
{
|
||||
description = "Build a cargo project without extra checks";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
crane.url = "github:ipetkov/crane";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
crane,
|
||||
flake-utils,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
craneLib = crane.mkLib pkgs;
|
||||
|
||||
# Runtime/shared libraries required by iced/iced_layershell/winit.
|
||||
# winit dlopens libwayland at runtime, so these must be on
|
||||
# LD_LIBRARY_PATH (see https://github.com/iced-rs/iced/issues/2385).
|
||||
guiLibs = [
|
||||
pkgs.wayland
|
||||
pkgs.wayland-protocols
|
||||
pkgs.libxkbcommon
|
||||
pkgs.vulkan-loader
|
||||
pkgs.libx11
|
||||
pkgs.libxcursor
|
||||
pkgs.libxrandr
|
||||
pkgs.libxi
|
||||
pkgs.libxcb
|
||||
];
|
||||
|
||||
# Common arguments can be set here to avoid repeating them later
|
||||
# Note: changes here will rebuild all dependency crates
|
||||
commonArgs = {
|
||||
# Exclude build outputs regardless of git state (this repo is not
|
||||
# git-initialized, so cleanCargoSource would otherwise copy target/).
|
||||
src = pkgs.lib.cleanSourceWith {
|
||||
src = ./.;
|
||||
filter = path: type:
|
||||
let
|
||||
base = baseNameOf (toString path);
|
||||
in
|
||||
!(type == "directory" && (base == "target" || base == "result" || base == ".direnv"));
|
||||
};
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgs.pkg-config
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
guiLibs
|
||||
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
|
||||
# Additional darwin specific inputs can be set here
|
||||
pkgs.libiconv
|
||||
];
|
||||
};
|
||||
|
||||
my-crate = craneLib.buildPackage (
|
||||
commonArgs
|
||||
// {
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
# Additional environment variables or build phases/hooks can be set
|
||||
# here *without* rebuilding all dependency crates
|
||||
# MY_CUSTOM_VAR = "some value";
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
checks = {
|
||||
inherit my-crate;
|
||||
};
|
||||
|
||||
packages.default = my-crate;
|
||||
|
||||
apps.default = flake-utils.lib.mkApp {
|
||||
drv = my-crate;
|
||||
};
|
||||
|
||||
devShells.default = craneLib.devShell {
|
||||
# Inherit inputs from checks.
|
||||
checks = self.checks.${system};
|
||||
|
||||
# Put the GUI shared libraries on the runtime library path so winit
|
||||
# can dlopen libwayland and wgpu can find the vulkan loader.
|
||||
shellHook = ''
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath guiLibs}"
|
||||
'';
|
||||
|
||||
# Extra inputs can be added here; cargo and rustc are provided by default.
|
||||
packages = guiLibs;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
//! barbar — a Wayland layer-shell status bar built on `iced` + `iced_layershell`.
|
||||
//!
|
||||
//! Renders a full-width bar pinned to the top of the screen via the
|
||||
//! `wlr-layer-shell` protocol. Optionally target a specific output by
|
||||
//! passing its name as the first CLI argument.
|
||||
|
||||
use iced::widget::{row, text};
|
||||
use iced::{Alignment, Element, Length, Task, Theme};
|
||||
use iced_layershell::application;
|
||||
use iced_layershell::reexport::Anchor;
|
||||
use iced_layershell::settings::{LayerShellSettings, StartMode, Settings};
|
||||
use iced_layershell::to_layer_message;
|
||||
|
||||
/// Height of the bar in logical pixels.
|
||||
const BAR_HEIGHT: u32 = 36;
|
||||
|
||||
/// Optional width of the bar; `None` means "as wide as the output".
|
||||
const BAR_WIDTH: Option<u32> = None;
|
||||
|
||||
pub fn main() -> Result<(), iced_layershell::Error> {
|
||||
// Target a specific output if one was given, otherwise the active one.
|
||||
let start_mode = match std::env::args().nth(1) {
|
||||
Some(output) => StartMode::TargetScreen(output),
|
||||
None => StartMode::Active,
|
||||
};
|
||||
|
||||
application(Bar::default, namespace, update, view)
|
||||
.style(style)
|
||||
.settings(Settings {
|
||||
layer_settings: LayerShellSettings {
|
||||
size: Some((BAR_WIDTH.unwrap_or(0), BAR_HEIGHT)),
|
||||
exclusive_zone: BAR_HEIGHT as i32,
|
||||
anchor: Anchor::Top | Anchor::Left | Anchor::Right,
|
||||
start_mode,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.run()
|
||||
}
|
||||
|
||||
/// Application state. Empty for now; placeholders will evolve into
|
||||
/// workspace/clock/system modules.
|
||||
#[derive(Debug, Default)]
|
||||
struct Bar;
|
||||
|
||||
/// Messages produced by user input, events and subscriptions.
|
||||
#[to_layer_message]
|
||||
#[derive(Debug, Clone)]
|
||||
enum Message {
|
||||
/// No-op used as a fallback target for pending subscriptions.
|
||||
Noop,
|
||||
}
|
||||
|
||||
fn namespace() -> String {
|
||||
String::from("barbar")
|
||||
}
|
||||
|
||||
fn update(_bar: &mut Bar, _message: Message) -> Task<Message> {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
fn view(_bar: &Bar) -> Element<'_, Message> {
|
||||
row![
|
||||
text("workspaces").size(14),
|
||||
text("|").size(14),
|
||||
text("clock").size(14),
|
||||
text("|").size(14),
|
||||
text("system").size(14),
|
||||
]
|
||||
.spacing(12)
|
||||
.padding(8)
|
||||
.align_y(Alignment::Center)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.into()
|
||||
}
|
||||
|
||||
fn style(_bar: &Bar, theme: &Theme) -> iced::theme::Style {
|
||||
use iced::theme::Style;
|
||||
Style {
|
||||
background_color: theme.palette().background,
|
||||
text_color: theme.palette().text,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user