diff options
Diffstat (limited to '')
5 files changed, 283 insertions, 1 deletions
diff --git a/pkgs/by-name/i3/i3bar-river-patched/0001-revert-use-std-io-pipe.patch b/pkgs/by-name/i3/i3bar-river-patched/0001-revert-use-std-io-pipe.patch new file mode 100644 index 00000000..e1564753 --- /dev/null +++ b/pkgs/by-name/i3/i3bar-river-patched/0001-revert-use-std-io-pipe.patch @@ -0,0 +1,67 @@ +From 017ed59239e48ca689af36f1ddaec877a3c86175 Mon Sep 17 00:00:00 2001 +From: Benedikt Peetz <benedikt.peetz@b-peetz.de> +Date: Tue, 20 May 2025 17:10:47 +0200 +Subject: [PATCH] Revert "use std::io::pipe" + +This reverts commit c9cee90d765198cf72c5a5155ee0d8ab566d98a9 as this +commit requires rustc 1.87.0 +--- + src/main.rs | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/src/main.rs b/src/main.rs +index 4a86593..2e7aeb2 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -18,8 +18,8 @@ mod text; + mod utils; + mod wm_info_provider; + +-use std::io::{self, ErrorKind, Read}; +-use std::os::fd::AsRawFd; ++use std::io::{self, ErrorKind}; ++use std::os::fd::{AsRawFd, RawFd}; + use std::path::PathBuf; + + use clap::Parser; +@@ -40,7 +40,7 @@ struct Cli { + fn main() -> anyhow::Result<()> { + let args = Cli::parse(); + +- let (mut sig_read, sig_write) = io::pipe()?; ++ let [sig_read, sig_write] = pipe(libc::O_NONBLOCK | libc::O_CLOEXEC)?; + signal_hook::low_level::pipe::register(SIGUSR1, sig_write)?; + + let mut conn = Connection::connect()?; +@@ -55,8 +55,12 @@ fn main() -> anyhow::Result<()> { + Ok(event_loop::Action::Keep) + }); + +- el.register_with_fd(sig_read.as_raw_fd(), move |ctx| { +- sig_read.read_exact(&mut [0u8]).unwrap(); ++ el.register_with_fd(sig_read, move |ctx| { ++ let mut buf = [0u8]; ++ assert_eq!( ++ unsafe { libc::read(sig_read, buf.as_mut_ptr().cast(), 1) }, ++ 1 ++ ); + ctx.state.toggle_visibility(ctx.conn); + Ok(event_loop::Action::Keep) + }); +@@ -104,3 +108,13 @@ fn main() -> anyhow::Result<()> { + el.run(&mut conn, &mut state)?; + unreachable!(); + } ++ ++// TODO: remove once Rust 1.87.0 is stable ++fn pipe(flags: libc::c_int) -> io::Result<[RawFd; 2]> { ++ let mut fds = [0; 2]; ++ if unsafe { libc::pipe2(fds.as_mut_ptr(), flags) } == -1 { ++ Err(io::Error::last_os_error()) ++ } else { ++ Ok(fds) ++ } ++} +-- +2.49.0 + diff --git a/pkgs/by-name/i3/i3bar-river-patched/0002-feat-crate-bar-Put-the-leftmost-block-in-the-middle-.patch b/pkgs/by-name/i3/i3bar-river-patched/0002-feat-crate-bar-Put-the-leftmost-block-in-the-middle-.patch new file mode 100644 index 00000000..6f4bd528 --- /dev/null +++ b/pkgs/by-name/i3/i3bar-river-patched/0002-feat-crate-bar-Put-the-leftmost-block-in-the-middle-.patch @@ -0,0 +1,111 @@ +From b8568a2b626bd4d5f50ee24c304d19177bda5d4b Mon Sep 17 00:00:00 2001 +From: Benedikt Peetz <benedikt.peetz@b-peetz.de> +Date: Tue, 20 May 2025 19:58:57 +0200 +Subject: [PATCH] feat(crate::bar): Put the leftmost block in the middle of the + bar + +This is a workaround for the limitation in the i3 blocks protocol, as +this does not allow for centred blocks. +--- + src/bar.rs | 64 ++++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 53 insertions(+), 11 deletions(-) + +diff --git a/src/bar.rs b/src/bar.rs +index fb88150..e66c2cf 100644 +--- a/src/bar.rs ++++ b/src/bar.rs +@@ -344,16 +344,56 @@ impl Bar { + } + + // Display the blocks +- render_blocks( +- &cairo_ctx, +- ss, +- &self.output, +- ss.blocks_cache.get_computed(), +- &mut self.blocks_btns, +- offset_left, +- width_f, +- height_f, +- ); ++ { ++ if !ss.blocks_cache.get_computed().is_empty() { ++ let first_block = &ss.blocks_cache.get_computed()[0]; ++ ++ let blocks = &ss.blocks_cache.get_computed()[1..]; ++ ++ let other_start = render_blocks( ++ &cairo_ctx, ++ ss, ++ &self.output, ++ blocks, ++ &mut self.blocks_btns, ++ offset_left, ++ width_f, ++ height_f, ++ ); ++ ++ // Draw the first block _after_ the other ones, so that we can nudge it more to the ++ // left, if the others are spanning over the middle. ++ let mut start = (width_f / 2.0) - (first_block.full.width / 2.0); ++ if start + first_block.full.width > other_start { ++ start = other_start - first_block.full.width - first_block.block.separator_block_width as f64; ++ } ++ ++ first_block.full.render( ++ &cairo_ctx, ++ RenderOptions { ++ x_offset: start, ++ bar_height: height_f, ++ fg_color: first_block ++ .block ++ .color ++ .unwrap_or(sfo!(ss, &self.output, color)), ++ bg_color: first_block.block.background, ++ r_left: ss.config.blocks_r, ++ r_right: ss.config.blocks_r, ++ overlap: ss.config.blocks_overlap, ++ }, ++ ); ++ ++ self.blocks_btns.push( ++ start, ++ first_block.full.width, ++ ( ++ first_block.block.name.clone(), ++ first_block.block.instance.clone(), ++ ), ++ ); ++ } ++ } + + self.viewport + .set_destination(conn, self.width as i32, self.height as i32); +@@ -428,7 +468,7 @@ fn render_blocks( + offset_left: f64, + full_width: f64, + full_height: f64, +-) { ++) -> f64 { + context.rectangle(offset_left, 0.0, full_width - offset_left, full_height); + context.clip(); + +@@ -513,6 +553,7 @@ fn render_blocks( + } + + // Render blocks ++ let leftmost_start = full_width - blocks_width; + buttons.clear(); + for series in blocks_computed { + let s_len = series.blocks.len(); +@@ -560,6 +601,7 @@ fn render_blocks( + } + + context.reset_clip(); ++ leftmost_start + } + + fn layer_surface_cb(ctx: EventCtx<State, ZwlrLayerSurfaceV1>) { +-- +2.49.0 + diff --git a/pkgs/by-name/i3/i3bar-river-patched/package.nix b/pkgs/by-name/i3/i3bar-river-patched/package.nix new file mode 100644 index 00000000..88af5d8a --- /dev/null +++ b/pkgs/by-name/i3/i3bar-river-patched/package.nix @@ -0,0 +1,66 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + lib, + fetchFromGitHub, + rustPlatform, + pkg-config, + pango, + fetchpatch2, +}: +rustPlatform.buildRustPackage { + pname = "i3bar-river-patched"; + version = "1.1.0-unstable-2025-05-20"; + + src = fetchFromGitHub { + owner = "MaxVerevkin"; + repo = "i3bar-river"; + rev = "73446cac559b10adf4beb5567a816d1be5273457"; + hash = "sha256-NxlFKTnd2erHtSG56aWlZEkWVzBqe2hqQuVAWDdBq2c="; + }; + + useFetchCargoVendor = true; + cargoHash = "sha256-8sub8cXC/1iDY6v/9opO4FiLAo9CFrGJSDPNQydGvhQ="; + + cargoPatches = [ + # Add a separate theme for unfocused outputs. + (fetchpatch2 { + name = "Add support for special theme for unfocused outputs"; + url = "https://patch-diff.githubusercontent.com/raw/MaxVerevkin/i3bar-river/pull/44.patch"; + hash = "sha256-yH3K52kAXGW19maP77gOTHSauqQX7Px8qCZDua6wo4w="; + }) + + # TODO(@bpeetz): Remove this patch once the rustc update hits unstable. <2025-05-20> + ./0001-revert-use-std-io-pipe.patch + + # TODO(@bpeetz): Open an issues, whether something like that could be upstreamed. <2025-05-20> + ./0002-feat-crate-bar-Put-the-leftmost-block-in-the-middle-.patch + ]; + + # Remove the WMs that I don't use. + buildNoDefaultFeatures = true; + buildFeatures = [ + # "hyprland" + # "niri" + "river" + ]; + + nativeBuildInputs = [pkg-config]; + buildInputs = [pango]; + + meta = with lib; { + description = "Port of i3bar for river"; + homepage = "https://github.com/MaxVerevkin/i3bar-river"; + license = licenses.gpl3Only; + maintainers = with maintainers; [nicegamer7]; + mainProgram = "i3bar-river"; + platforms = platforms.linux; + }; +} diff --git a/pkgs/by-name/i3/i3status-rust-patched/package.nix b/pkgs/by-name/i3/i3status-rust-patched/package.nix new file mode 100644 index 00000000..9f172d49 --- /dev/null +++ b/pkgs/by-name/i3/i3status-rust-patched/package.nix @@ -0,0 +1,34 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + i3status-rust, + fetchpatch2, +}: +i3status-rust.overrideAttrs (final: prev: { + pname = "${prev.pname}-patched"; + + patches = + (prev.patches or []) + ++ [ + # Btrfs support for disk_space block. + (fetchpatch2 { + name = "disk_space: Support btrfs backend"; + url = "https://patch-diff.githubusercontent.com/raw/greshake/i3status-rust/pull/2159.patch"; + hash = "sha256-S2/biX6FTLJNfI9QVgwr+V8IGMRnSFIZnTrhc+1LvqQ="; + }) + + # Correctly calculate the used memory. + (fetchpatch2 { + name = "memory: Avoid estimating available memory, use kernel estimate instead"; + url = "https://patch-diff.githubusercontent.com/raw/greshake/i3status-rust/pull/2160.patch"; + hash = "sha256-1wB2KpXhC/UIxAgRioOYj/bnrzRSuaHAdbeoZ2O5E/Y="; + }) + ]; +}) diff --git a/pkgs/by-name/mp/mpp/package.nix b/pkgs/by-name/mp/mpp/package.nix index 0d2f6c8d..f0e454f7 100644 --- a/pkgs/by-name/mp/mpp/package.nix +++ b/pkgs/by-name/mp/mpp/package.nix @@ -70,6 +70,8 @@ fd "." --hidden --type file | while read -r file_path; do sed --in-place 's/mpc/mpp/g' "$file_path" done + + # TODO(@bpeetz): Also change this in man-pages. <2025-05-20> ''; installPhase = '' @@ -79,6 +81,8 @@ }; in symlinkJoin { - name = "mpp-merged"; + name = "mpp"; paths = [script mpcShare]; + + inherit (script) meta; } |