Skip to content

Commit

Permalink
chore: bump to last hyprland-rs, wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrinux committed Aug 27, 2024
1 parent e7f1722 commit 05b8875
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .direnv/bin/nix-direnv-reload
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
if [[ ! -d "/home/cyril/personal/hyprland-autoname-workspaces" ]]; then
echo "Cannot find source directory; Did you move it?"
echo "(Looking for "/home/cyril/personal/hyprland-autoname-workspaces")"
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
exit 1
fi

# rebuild the cache forcefully
_nix_direnv_force_reload=1 direnv exec "/home/cyril/personal/hyprland-autoname-workspaces" true

# Update the mtime for .envrc.
# This will cause direnv to reload again - but without re-building.
touch "/home/cyril/personal/hyprland-autoname-workspaces/.envrc"

# Also update the timestamp of whatever profile_rc we have.
# This makes sure that we know we are up to date.
touch -r "/home/cyril/personal/hyprland-autoname-workspaces/.envrc" "/home/cyril/personal/hyprland-autoname-workspaces/.direnv"/*.rc
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export NIX_CONFIG="extra-experimental-features = nix-command flakes"
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
*.html
.direnv/
93 changes: 93 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
inputs = {
naersk.url = "github:nix-community/naersk/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils, naersk }:
let systems = [ "x86_64-linux" "aarch64-linux" ];
in flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
libs = with pkgs; [ libxkbcommon libinput libpulseaudio systemd ];
in
{
defaultPackage = naersk-lib.buildPackage {
src = ./.;
meta.mainProgram = "hyprland-autoname-workspaces";
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = libs;
};
devShell = with pkgs; mkShell {
buildInputs = [ cargo rustc rustfmt pre-commit rustPackages.clippy pkg-config ] ++ libs;
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
}
);
}
11 changes: 8 additions & 3 deletions src/renamer/formatter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::renamer::ConfigFile;
use crate::renamer::IconStatus::*;
use crate::{AppClient, Renamer};
use hyprland::data::FullscreenMode;
use std::collections::HashMap;
use strfmt::strfmt;

Expand Down Expand Up @@ -103,8 +104,8 @@ impl Renamer {
println!("client: {client:#?}\nformatter vars => {vars:#?}");
}

let is_grouped =
client.is_fullscreen && (client.is_active || !is_dedup_inactive_fullscreen);
let is_grouped = client.is_fullscreen != FullscreenMode::None
&& (client.is_active || !is_dedup_inactive_fullscreen);

match (is_grouped, is_dedup) {
(true, true) => formatter(fmt_client_dup_fullscreen, &vars),
Expand Down Expand Up @@ -141,7 +142,11 @@ pub fn generate_counted_clients(
) -> Vec<(AppClient, i32)> {
if need_dedup {
let mut sorted_clients = clients;
sorted_clients.sort_by(|a, b| b.is_fullscreen.cmp(&a.is_fullscreen));
sorted_clients.sort_by(|a, b| {
let bf = b.is_fullscreen != FullscreenMode::None;
let af = a.is_fullscreen != FullscreenMode::None;
bf.cmp(&af)
});
sorted_clients.sort_by(|a, b| b.is_active.cmp(&a.is_active));

sorted_clients
Expand Down

0 comments on commit 05b8875

Please sign in to comment.