linux-cachyos 6.9 kernel

unbound dns caching
some hyprland bash scripts
fix graphical glitches on laptop
tailsacle no accept dns
This commit is contained in:
delta 2024-06-18 22:29:17 +03:00
parent 2a176a4aa8
commit 27c9f432a5
37 changed files with 792 additions and 90 deletions

View file

@ -0,0 +1,54 @@
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, rustPlatform
, marked-man
, coreutils
, vulkan-loader
, wayland
, pkg-config
, udev
, v4l-utils
, dbus
, darwin
}:
rustPlatform.buildRustPackage rec {
pname = "wluma";
version = "unstable-2024-02-29";
src = fetchFromGitHub {
owner = "avalsch";
repo = "wluma";
rev = "27624132a862af36e7d51c8ca215cf6f2dfbed1d";
hash = "sha256-C29i+y/J7ABsEewMhQXCHMRpADogzp4PYtL+Ar0CKTw=";
};
cargoHash = "sha256-aOdBNIpZqigcQC25bxtAqDSO5nwGzcJ3VC3z6MUgmO8=";
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
];
buildInputs = [
dbus
udev
vulkan-loader
v4l-utils
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreGraphics
darwin.apple_sdk.frameworks.IOKit
] ++ lib.optionals stdenv.isLinux [
wayland
];
meta = with lib; {
description = "Automatic brightness adjustment based on screen contents and ALS";
homepage = "https://github.com/avalsch/wluma/tree/als.cmd";
license = licenses.isc;
maintainers = with maintainers; [ ];
mainProgram = "wluma";
};
}

View file

@ -0,0 +1,79 @@
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, rustPlatform
, marked-man
, coreutils
, vulkan-loader
, wayland
, pkg-config
, udev
, v4l-utils
, dbus
, nix-update-script
}:
rustPlatform.buildRustPackage rec {
pname = "wluma";
version = "4.40";
src = fetchFromGitHub {
owner = "avalsch";
repo = "wluma";
rev = "27624132a862af36e7d51c8ca215cf6f2dfbed1d";
sha256 = "sha256-C29i+y/J7ABsEewMhQXCHMRpADogzp4PYtL+Ar0CKTw==";
};
postPatch = ''
substituteInPlace Makefile --replace \
'target/release/$(BIN)' \
'target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/$(BIN)'
# Needs chmod and chgrp
substituteInPlace 90-wluma-backlight.rules --replace \
'RUN+="/bin/' 'RUN+="${coreutils}/bin/'
substituteInPlace wluma.service --replace \
'ExecStart=/usr/bin/wluma' 'ExecStart=${placeholder "out"}/bin/wluma'
'';
cargoHash = "sha256-90l1lO7ERrsbYCo7ZX7zikemehBgUHN/HTfx+EoBMjc=";
nativeBuildInputs = [
makeWrapper
pkg-config
rustPlatform.bindgenHook
marked-man
];
buildInputs = [
udev
v4l-utils
vulkan-loader
dbus
];
postBuild = ''
make docs
'';
dontCargoInstall = true;
installFlags = [ "PREFIX=${placeholder "out"}" ];
postInstall = ''
wrapProgram $out/bin/wluma \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ wayland ]}"
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Automatic brightness adjustment based on screen contents and ALS";
homepage = "https://github.com/maximbaz/wluma";
changelog = "https://github.com/maximbaz/wluma/releases/tag/${version}";
license = licenses.isc;
maintainers = with maintainers; [ yshym jmc-figueira atemu ];
platforms = platforms.linux;
mainProgram = "wluma";
};
}

View file

@ -38,6 +38,45 @@
"type": "github" "type": "github"
} }
}, },
"chaotic": {
"inputs": {
"compare-to": "compare-to",
"flake-schemas": "flake-schemas",
"home-manager": "home-manager",
"jovian": "jovian",
"nixpkgs": "nixpkgs",
"systems": "systems_2",
"yafas": "yafas"
},
"locked": {
"lastModified": 1718673414,
"narHash": "sha256-1qT6lASTdJ19MMd1KX6nsJgvtt1ttO40n4jZOmVoDdw=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "ae7b3c61e11fb89c2d893b92c83a0b9b1f342c3c",
"type": "github"
},
"original": {
"owner": "chaotic-cx",
"ref": "nyxpkgs-unstable",
"repo": "nyx",
"type": "github"
}
},
"compare-to": {
"locked": {
"lastModified": 1695341185,
"narHash": "sha256-htO6DSbWyCgaDkxi7foPjXwJFPzGjVt3RRUbPSpNtZY=",
"rev": "98b8e330823a3570d328720f87a1153f8a7f2224",
"revCount": 2,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/chaotic-cx/nix-empty-flake/0.1.2%2Brev-98b8e330823a3570d328720f87a1153f8a7f2224/018aba35-d228-7fa9-b205-7616c89ef4e0/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/chaotic-cx/nix-empty-flake/%3D0.1.2.tar.gz"
}
},
"devshell": { "devshell": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
@ -171,9 +210,23 @@
"type": "github" "type": "github"
} }
}, },
"flake-schemas": {
"locked": {
"lastModified": 1693491534,
"narHash": "sha256-ifw8Td8kD08J8DxFbYjeIx5naHcDLz7s2IFP3X42I/U=",
"rev": "c702cbb663d6d70bbb716584a2ee3aeb35017279",
"revCount": 21,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.1/018a4c59-80e1-708a-bb4d-854930c20f72/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.1.tar.gz"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems_2" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@ -191,7 +244,7 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems_4" "systems": "systems_5"
}, },
"locked": { "locked": {
"lastModified": 1701680307, "lastModified": 1701680307,
@ -209,7 +262,7 @@
}, },
"flake-utils_3": { "flake-utils_3": {
"inputs": { "inputs": {
"systems": "systems_5" "systems": "systems_6"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@ -227,7 +280,7 @@
}, },
"flake-utils_4": { "flake-utils_4": {
"inputs": { "inputs": {
"systems": "systems_6" "systems": "systems_7"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@ -293,6 +346,27 @@
} }
}, },
"home-manager": { "home-manager": {
"inputs": {
"nixpkgs": [
"chaotic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1718526747,
"narHash": "sha256-sKrD/utGvmtQALvuDj4j0CT3AJXP1idOAq2p+27TpeE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0a7ffb28e5df5844d0e8039c9833d7075cdee792",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -312,7 +386,7 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": { "home-manager_3": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixvim", "nixvim",
@ -368,8 +442,8 @@
"hyprlang": "hyprlang", "hyprlang": "hyprlang",
"hyprutils": "hyprutils", "hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner", "hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"systems": "systems_3", "systems": "systems_4",
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
@ -514,6 +588,28 @@
"type": "github" "type": "github"
} }
}, },
"jovian": {
"inputs": {
"nix-github-actions": "nix-github-actions",
"nixpkgs": [
"chaotic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1718431241,
"narHash": "sha256-vOsklVeiGCvf9LBOz0sjHMNvohgUw8/Oe/8MpdFnF+Y=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "f02a01aab60c68b7898043c2e7f5bc97c93fb07b",
"type": "github"
},
"original": {
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"type": "github"
}
},
"lib-aggregate": { "lib-aggregate": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
@ -570,13 +666,36 @@
"type": "github" "type": "github"
} }
}, },
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"chaotic",
"jovian",
"nixpkgs"
]
},
"locked": {
"lastModified": 1690328911,
"narHash": "sha256-fxtExYk+aGf2YbjeWQ8JY9/n9dwuEt+ma1eUFzF8Jeo=",
"owner": "zhaofengli",
"repo": "nix-github-actions",
"rev": "96df4a39c52f53cb7098b923224d8ce941b64747",
"type": "github"
},
"original": {
"owner": "zhaofengli",
"ref": "matrix-name",
"repo": "nix-github-actions",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1718318537, "lastModified": 1718530797,
"narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", "narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", "rev": "b60ebf54c15553b393d144357375ea956f89e9a9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -682,6 +801,22 @@
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 1718318537,
"narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1717602782, "lastModified": 1717602782,
"narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", "narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=",
@ -697,7 +832,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1716769173, "lastModified": 1716769173,
"narHash": "sha256-7EXDb5WBw+d004Agt+JHC/Oyh/KTUglOaQ4MNjBbo5w=", "narHash": "sha256-7EXDb5WBw+d004Agt+JHC/Oyh/KTUglOaQ4MNjBbo5w=",
@ -713,7 +848,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1712791164, "lastModified": 1712791164,
"narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=", "narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=",
@ -729,7 +864,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_6": {
"locked": { "locked": {
"lastModified": 1712883908, "lastModified": 1712883908,
"narHash": "sha256-icE1IJE9fHcbDfJ0+qWoDdcBXUoZCcIJxME4lMHwvSM=", "narHash": "sha256-icE1IJE9fHcbDfJ0+qWoDdcBXUoZCcIJxME4lMHwvSM=",
@ -745,7 +880,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_6": { "nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1714906307, "lastModified": 1714906307,
"narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=", "narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=",
@ -767,9 +902,9 @@
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"git-hooks": "git-hooks", "git-hooks": "git-hooks",
"home-manager": "home-manager_2", "home-manager": "home-manager_3",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_4",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
@ -789,11 +924,12 @@
"root": { "root": {
"inputs": { "inputs": {
"anyrun": "anyrun", "anyrun": "anyrun",
"chaotic": "chaotic",
"firefox": "firefox", "firefox": "firefox",
"home-manager": "home-manager", "home-manager": "home-manager_2",
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprland-contrib": "hyprland-contrib", "hyprland-contrib": "hyprland-contrib",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_3",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"nixpkgs2105": "nixpkgs2105", "nixpkgs2105": "nixpkgs2105",
@ -805,7 +941,7 @@
}, },
"secrets": { "secrets": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_5",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
}, },
"locked": { "locked": {
@ -849,7 +985,7 @@
}, },
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_5", "nixpkgs": "nixpkgs_6",
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
@ -882,21 +1018,6 @@
} }
}, },
"systems_2": { "systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": { "locked": {
"lastModified": 1689347949, "lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
@ -911,7 +1032,7 @@
"type": "github" "type": "github"
} }
}, },
"systems_4": { "systems_3": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@ -926,6 +1047,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_4": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_5": { "systems_5": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
@ -956,10 +1092,25 @@
"type": "github" "type": "github"
} }
}, },
"systems_7": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tdesktop": { "tdesktop": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_6" "nixpkgs": "nixpkgs_7"
}, },
"locked": { "locked": {
"lastModified": 1715005420, "lastModified": 1715005420,
@ -1025,6 +1176,31 @@
"repo": "xdg-desktop-portal-hyprland", "repo": "xdg-desktop-portal-hyprland",
"type": "github" "type": "github"
} }
},
"yafas": {
"inputs": {
"flake-schemas": [
"chaotic",
"flake-schemas"
],
"systems": [
"chaotic",
"systems"
]
},
"locked": {
"lastModified": 1695926485,
"narHash": "sha256-wNFFnItckgSs8XeYhhv8vlJs2WF09fSQaWgw4xkDqHQ=",
"owner": "UbiqueLambda",
"repo": "yafas",
"rev": "7772afd6686458ca0ddbc599a52cf5d337367653",
"type": "github"
},
"original": {
"owner": "UbiqueLambda",
"repo": "yafas",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -34,6 +34,8 @@
inputs.nixpkgs.follows = "nixpkgs-unstable"; inputs.nixpkgs.follows = "nixpkgs-unstable";
}; };
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
}; };
outputs = inputs@{ self, nixpkgs, home-manager, ... }: outputs = inputs@{ self, nixpkgs, home-manager, ... }:

View file

@ -25,6 +25,7 @@ in {
colloid-icon-theme colloid-icon-theme
adw-gtk3 adw-gtk3
nerdfonts nerdfonts
tokyonight-gtk-theme
]; ];
sessionVariables.XCURSOR_THEME = cursor-theme; sessionVariables.XCURSOR_THEME = cursor-theme;
pointerCursor = { pointerCursor = {

View file

@ -88,24 +88,45 @@ echo kernel: $(uname -r | tr '[:upper:]' '[:lower:]')
"amd_pstate.shared_mem=1" "amd_pstate.shared_mem=1"
"zfs.zfs_arc_max=19327352832" "zfs.zfs_arc_max=19327352832"
"resume=UUID=a2ff20bd-56f3-4c83-b1b4-933ba0c82f36" "resume=UUID=a2ff20bd-56f3-4c83-b1b4-933ba0c82f36"
# # Disable all mitigations
# "mitigations=off"
# "nopti"
# "tsx=on"
# https://www.phoronix.com/news/Linux-Splitlock-Hurts-Gaming
"split_lock_detect=off"
]; ];
boot.zfs.allowHibernation = true;
boot.zfs.forceImportRoot = false;
boot.resumeDevice = "/dev/mapper/cryptroot0p2";
boot.kernelModules = [ "amd-pstate" "acpi_call" "amdgpu" "kvm-amd" "vfat" "nls_cp437" "nls_iso8859-1" ]; boot.kernelModules = [ "amd-pstate" "acpi_call" "amdgpu" "kvm-amd" "vfat" "nls_cp437" "nls_iso8859-1" ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" "vfat" "nls_cp437" "nls_iso8859-1" ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" "vfat" "nls_cp437" "nls_iso8859-1" ];
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot"; boot.loader.efi.efiSysMountPoint = "/boot";
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.extraModulePackages = with config.boot.kernelPackages; [ usbip.out ]; # boot.extraModulePackages = with config.boot.kernelPackages; [ usbip.out acpi_call zfs];
boot.kernelPackages = # boot.kernelPackages =
with builtins; with lib; let # with builtins; with lib; let
latestCompatibleVersion = config.boot.zfs.package.latestCompatibleLinuxPackages.kernel.version; # latestCompatibleVersion = config.boot.zfs.package.latestCompatibleLinuxPackages.kernel.version;
xanPackages = filterAttrs (name: packages: hasSuffix "_xanmod" name && (tryEval packages).success) pkgs.linuxKernel.packages; # xanPackages = filterAttrs (name: packages: hasSuffix "_xanmod" name && (tryEval packages).success) pkgs.linuxKernel.packages;
compatiblePackages = filter (packages: compareVersions packages.kernel.version latestCompatibleVersion <= 0) (attrValues xanPackages); # compatiblePackages = filter (packages: compareVersions packages.kernel.version latestCompatibleVersion <= 0) (attrValues xanPackages);
orderedCompatiblePackages = sort (x: y: compareVersions x.kernel.version y.kernel.version > 0) compatiblePackages; # orderedCompatiblePackages = sort (x: y: compareVersions x.kernel.version y.kernel.version > 0) compatiblePackages;
selectedKernelPackage = head orderedCompatiblePackages; # selectedKernelPackage = head orderedCompatiblePackages;
in selectedKernelPackage // { # in selectedKernelPackage // {
extraPackages = with selectedKernelPackage; [ acpi_call ]; # extraPackages = with selectedKernelPackage; [ acpi_call ];
}; # };
boot.kernelPackages = lib.mkOverride 99 pkgs.linuxPackages_cachyos;
boot.zfs.package = lib.mkOverride 99 pkgs.zfs_cachyos;
chaotic.scx.scheduler = "scx_rusty";
boot.extraModulePackages = with config.boot.kernelPackages; [ usbip acpi_call ];
boot.plymouth.enable = false; boot.plymouth.enable = false;
@ -116,7 +137,7 @@ echo kernel: $(uname -r | tr '[:upper:]' '[:lower:]')
''; '';
boot.initrd.luks = { boot.initrd.luks = {
yubikeySupport = false; yubikeySupport = true;
devices."cryptroot0" = { devices."cryptroot0" = {
device = "/dev/nvme0n1p2"; device = "/dev/nvme0n1p2";
postOpenCommands = " postOpenCommands = "

View file

@ -44,7 +44,10 @@
services.openssh.enable = true; services.openssh.enable = true;
systemd.services.sshd.wantedBy = lib.mkForce []; systemd.services.sshd.wantedBy = lib.mkForce [];
services.tailscale.enable = true; services.tailscale = {
enable = true;
extraUpFlags = "--accept-dns=false";
};
services.syncthing.enable = true; services.syncthing.enable = true;
#services.blueman.enable = true; #services.blueman.enable = true;
services.tumbler.enable = true; services.tumbler.enable = true;

View file

@ -9,12 +9,16 @@
./hardware.nix ./hardware.nix
./services.nix ./services.nix
./xorg.nix ./xorg.nix
"${self}/pkgs/apps.nix" "${self}/pkgs/apps.nix"
"${self}/pkgs/socks.nix" "${self}/pkgs/socks.nix"
"${self}/pkgs/scripts.nix" "${self}/pkgs/scripts.nix"
"${self}/pkgs/work.nix" "${self}/pkgs/work.nix"
"${self}/pkgs/dns.nix"
inputs.secrets.nixosModules.dlaptop inputs.secrets.nixosModules.dlaptop
inputs.home-manager.nixosModules.home-manager homeSettings inputs.home-manager.nixosModules.home-manager homeSettings
inputs.chaotic.nixosModules.default
]; ];
services.blueman.enable = true; services.blueman.enable = true;
@ -27,11 +31,17 @@
LC_TIME = "en_GB.UTF-8"; LC_TIME = "en_GB.UTF-8";
}; };
documentation.man.enable = false;
documentation.nixos.enable = false;
# networking.timeServers = "";
# services.ntp.servers = "";
networking = { networking = {
hostName = "dlaptop"; hostName = "dlaptop";
nameservers = [ "1.1.1.1" ]; # nameservers = [ "1.1.1.1" ];
#nameservers = [ "100.92.15.128" "fd7a:115c:a1e0::b21c:f80" ]; nameservers = [ "127.0.0.1" ];
networkmanager.dns = "none"; networkmanager.dns = lib.mkForce "none";
networkmanager.enable = true; networkmanager.enable = true;
useDHCP = lib.mkDefault true; useDHCP = lib.mkDefault true;
interfaces.wlp1s0.proxyARP = true; interfaces.wlp1s0.proxyARP = true;

View file

@ -16,6 +16,7 @@
EDITOR = "hx"; EDITOR = "hx";
BROWSER = "firefox"; BROWSER = "firefox";
TERMINAL = "foot"; TERMINAL = "foot";
WLR_DRM_NO_MODIFIERS = 1; # fixes graphical glitches on amd laptop
}; };
environment.variables = lib.mkForce { environment.variables = lib.mkForce {

View file

@ -49,7 +49,7 @@ in {
users.users.delta = { users.users.delta = {
isNormalUser = true; isNormalUser = true;
description = "delta"; description = "delta";
extraGroups = [ "networkmanager" "wheel" "libvirtd" "adbusers" ]; extraGroups = [ "networkmanager" "wheel" "libvirtd" "adbusers" "video"];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGGL2UD0frl9F2OPBiPlSQqxDsuACbAVgwH24F0KT14L" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGGL2UD0frl9F2OPBiPlSQqxDsuACbAVgwH24F0KT14L"
]; ];

View file

@ -42,6 +42,7 @@ in {
(fishPlugins.callPackage ../derivations/fish/fish-functions.nix { }) (fishPlugins.callPackage ../derivations/fish/fish-functions.nix { })
(callPackage ../derivations/opera-proxy.nix { }) (callPackage ../derivations/opera-proxy.nix { })
(callPackage ../derivations/hyprdrop/hyprdrop.nix { }) (callPackage ../derivations/hyprdrop/hyprdrop.nix { })
(callPackage ../derivations/wluma/wluma.nix { })
xorg.xwininfo xorg.xwininfo
jq jq
dropbox dropbox
@ -68,6 +69,7 @@ in {
nom nom
localsend localsend
ktailctl ktailctl
trayscale
fishPlugins.done fishPlugins.done
monero-gui monero-gui
translate-shell translate-shell
@ -87,6 +89,7 @@ in {
shwewo.ephemeralbrowser shwewo.ephemeralbrowser
shwewo.ruchrome shwewo.ruchrome
shwewo.spotify shwewo.spotify
telegram-desktop
#(pkgs.symlinkJoin { #(pkgs.symlinkJoin {
# name = "ExprSelect"; # name = "ExprSelect";
# paths = [ shwewo.spotify ]; # paths = [ shwewo.spotify ];
@ -117,6 +120,7 @@ in {
qrtool qrtool
appimage-run appimage-run
lf lf
hydra-check
(pkgs.writeScriptBin "reboot" ''read -p "Do you REALLY want to reboot? (y/N) " answer; [[ $answer == [Yy]* ]] && ${pkgs.systemd}/bin/reboot'') (pkgs.writeScriptBin "reboot" ''read -p "Do you REALLY want to reboot? (y/N) " answer; [[ $answer == [Yy]* ]] && ${pkgs.systemd}/bin/reboot'')
]); ]);
@ -258,6 +262,9 @@ in {
abbr -a --position command ttlfix TTLfix abbr -a --position command ttlfix TTLfix
abbr -a --position command syspend systemctl suspend abbr -a --position command syspend systemctl suspend
abbr -a --position command suspend systemctl suspend abbr -a --position command suspend systemctl suspend
abbr -a --position command hibernate systemctl hibernate
abbr -a --position command hybernate systemctl hibernate
abbr -- - 'cd -' abbr -- - 'cd -'
abbr cdd 'cd ~/Downloads' abbr cdd 'cd ~/Downloads'
@ -375,7 +382,7 @@ in {
lsp = { lsp = {
enable = true; enable = true;
servers = { servers = {
bashls.enable = true; # bashls.enable = true;
nixd.enable = true; nixd.enable = true;
}; };
keymaps.lspBuf = { keymaps.lspBuf = {

62
pkgs/dns.nix Normal file
View file

@ -0,0 +1,62 @@
{ lib, ... }:
{
networking.nameservers = lib.mkForce [ "127.0.0.1" ];
services.unbound = {
enable = true;
settings = {
server = {
interface = [ "127.0.0.1" ];
do-ip6 = false;
cache-max-ttl = 86400;
cache-min-ttl = 1024;
cache-max-negative-ttl = 86400;
serve-expired = "yes";
serve-expired-ttl = 86400;
serve-expired-ttl-reset = "yes";
prefetch = "yes";
prefetch-key = "yes";
};
forward-zone = [
{
name = ".";
forward-addr = [
"100.92.15.128"
"192.168.150.2@53"
];
forward-first = true;
}
];
remote-control = {
control-enable = true;
control-interface = "127.0.0.1";
control-port = 8953;
};
};
};
# Not using unbound's dnscrypt so i can do it from novpn ns
services.dnscrypt-proxy2 = {
enable = true;
settings = {
ipv6_servers = true;
require_dnssec = true;
server_names = [ "cloudflare" ];
listen_addresses = [ "127.0.0.1:53" "192.168.150.2:53"];
};
};
systemd.services.dnscrypt-proxy2 = {
after = [ "novpn.service" "network-online.target" ];
wants = [ "novpn.service" "network-online.target" ];
bindsTo = [ "novpn.service" ];
wantedBy = lib.mkForce [];
serviceConfig = {
StateDirectory = "dnscrypt-proxy";
NetworkNamespacePath = "/run/netns/novpn";
};
};
}

View file

@ -42,7 +42,7 @@
}; };
}; };
extraPackages = [ pkgs.marksman pkgs.nil pkgs.nodePackages.bash-language-server]; extraPackages = [ pkgs.marksman pkgs.nil ];
}; };
#programs.dircolors.enable = true; #programs.dircolors.enable = true;

View file

@ -11,7 +11,7 @@
users.users.delta.packages = with pkgs; [ users.users.delta.packages = with pkgs; [
swww swww
waybar waybar
stable.swaynotificationcenter swaynotificationcenter
cliphist cliphist
fzf fzf
hyprshot hyprshot
@ -28,6 +28,9 @@
hyprshade # hyprshade toggle blue-light-filter hyprshade # hyprshade toggle blue-light-filter
gammastep # gammastep -O 4500K gammastep # gammastep -O 4500K
hyprlock hyprlock
# wluma
]; ];
# environment.systemPackages = [ # environment.systemPackages = [
# inputs.hyprland-contrib.packages.${pkgs.system}.grimblast.override { license = licenses.gpl3; } # inputs.hyprland-contrib.packages.${pkgs.system}.grimblast.override { license = licenses.gpl3; }
@ -68,5 +71,7 @@
# ]; # ];
}; };
home.file.".config/hypr/env_var.conf".text = builtins.readFile ./env_var.conf; home.file.".config/hypr/env_var.conf".text = builtins.readFile ./env_var.conf;
home.file.".config/hypr/media-binds.conf".text = builtins.readFile ./media-binds.conf;
}; };
} }

View file

@ -11,7 +11,7 @@ env = TERMINAL,footclient
#env = XCURSOR_SIZE,24 #env = XCURSOR_SIZE,24
# Set a GTK theme manually, for those who want to avoid appearance tools such as lxappearance or nwg-look # Set a GTK theme manually, for those who want to avoid appearance tools such as lxappearance or nwg-look
#env = GTK_THEME, env = GTK_THEME,Tokyonight-Dark-B
# Set your cursor theme. The theme needs to be installed and readable by your user. # Set your cursor theme. The theme needs to be installed and readable by your user.
#env = XCURSOR_THEME, #env = XCURSOR_THEME,
@ -53,6 +53,11 @@ env = CLUTTER_BACKEND,wayland
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
#Tells QT based applications to pick your theme from qt5ct, use with Kvantum. #Tells QT based applications to pick your theme from qt5ct, use with Kvantum.
# env = QT_QPA_PLATFORMTHEME,qt5ct env = QT_QPA_PLATFORMTHEME,gtk
env = QT_SCALE_FACTOR,2
env = GDK_SCALE,2 env = QT_SCALE_FACTOR,1.3
env = GDK_SCALE,1.3
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,Hyprland

View file

@ -53,7 +53,7 @@ exec-once = hyprctl setcursor Bibata-Modern-Classic 16
# exec-once = trayscale --hide-window # change tp ktailctl later # exec-once = trayscale --hide-window # change tp ktailctl later
# exec-once = hyprctl dispatch -- exec [workspace special:hdrop silent] "QT_QPA_PLATFORM=xcb telegram-desktop" # exec-once = hyprctl dispatch -- exec [workspace special:hdrop silent] "QT_QPA_PLATFORM=xcb telegram-desktop"
exec-once = /home/delta/.config/hypr/hdrop -b -g '30' -h '60' -f 'keepassxc_lite' --class org.keepassxc.KeePassXC exec-once = /home/delta/.config/hypr/hdrop -b -g '30' -h '60' -f 'keepassxc_lite' --class org.keepassxc.KeePassXC
exec-once = hyprdrop kitty -b -i kitty_hyprdrop exec-once = hyprdrop kitty -b -i kitty_hyprdrop & hyprctl dispatch -- focuswindow "^$CLASS$" || notify "hdrop: Error focusing '$COMMANDLINE' on current workspace"
exec-once = dropbox exec-once = dropbox
exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
@ -404,6 +404,7 @@ bind = $mainMod, P, pseudo, # dwindle
#bind = $mainMod, S, exec,XCURSOR_SIZE=16 sh -c "grim -g "$(slurp)" - | tee >(swappy -f -) | wl-copy" # take a screenshot #bind = $mainMod, S, exec,XCURSOR_SIZE=16 sh -c "grim -g "$(slurp)" - | tee >(swappy -f -) | wl-copy" # take a screenshot
bind = $mainMod, S, exec,XCURSOR_SIZE=16 grimblast --freeze copy area # take a screenshot bind = $mainMod, S, exec,XCURSOR_SIZE=16 grimblast --freeze copy area # take a screenshot
bind = $mainMod SHIFT, S, exec,XCURSOR_SIZE=16 sh -c 'grim -g "$(slurp)" - | qrtool decode | tee >(wl-copy) >(notify-send --icon=clipboard "QR Code Content" "$(cat)")' bind = $mainMod SHIFT, S, exec,XCURSOR_SIZE=16 sh -c 'grim -g "$(slurp)" - | qrtool decode | tee >(wl-copy) >(notify-send --icon=clipboard "QR Code Content" "$(cat)")'
bind = $mainMod CONTROL, S, exec,hyprshade
#bind = $mainMod, Print, exec, /home/delta/.config/hypr/grimblast.sh # take a screenshot #bind = $mainMod, Print, exec, /home/delta/.config/hypr/grimblast.sh # take a screenshot
# bind = $mainMod, Print, exec, /home/delta/scripts/screenshoter.sh # take a screenshot # bind = $mainMod, Print, exec, /home/delta/scripts/screenshoter.sh # take a screenshot
bind = ,Print , exec, wl-paste | swappy -f - # take a screenshot bind = ,Print , exec, wl-paste | swappy -f - # take a screenshot
@ -532,5 +533,5 @@ binde = $mainMod SHIFT CTRL, L, moveactive, 30 0
# Source a file (multi-file configs) # Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf # source = ~/.config/hypr/myColors.conf
###source = ~/.config/hypr/media-binds.conf source = ~/.config/hypr/media-binds.conf
###source = ~/.config/hypr/env_var.conf source = ~/.config/hypr/env_var.conf

View file

@ -1,18 +1,19 @@
$SCRIPT = ~/.config/HyprV/waybar/scripts
bind = , xf86audioraisevolume, exec, $SCRIPT/volume --inc bind = , xf86audioraisevolume, exec, volume --inc
bind = , xf86audiolowervolume, exec, $SCRIPT/volume --dec bind = , xf86audiolowervolume, exec, volume --dec
bind = , xf86AudioMicMute, exec, $SCRIPT/volume --toggle-mic bind = , xf86AudioMicMute, exec, volume --toggle-mic
bind = , xf86audioMute, exec, $SCRIPT/volume --toggle bind = , xf86audioMute, exec, volume --toggle
#bind = , XF86PowerOff, exec, swaynag -m 'Shutdown?' -Z 'No' '' -b 'Yes' 'systemctl poweroff' #bind = , XF86PowerOff, exec, swaynag -m 'Shutdown?' -Z 'No' '' -b 'Yes' 'systemctl poweroff'
bind = , xf86KbdBrightnessDown, exec, $SCRIPT/kb-brightness --dec # bind = , xf86KbdBrightnessDown, exec, $SCRIPT/kb-brightness --dec
bind = , xf86KbdBrightnessUp, exec, $SCRIPT/kb-brightness --inc # bind = , xf86KbdBrightnessUp, exec, $SCRIPT/kb-brightness --inc
bind = , xf86MonBrightnessDown, exec, $SCRIPT/brightness --dec bind = , xf86MonBrightnessDown, exec, brightness --dec
bind = , xf86MonBrightnessUp, exec, $SCRIPT/brightness --inc bind = , xf86MonBrightnessUp, exec, brightness --inc
bind = , XF86AudioPlay, exec, playerctl play-pause bind = , XF86AudioPlay, exec, playerctl play-pause
bind = , XF86AudioNext, exec, playerctl next bind = , XF86AudioNext, exec, playerctl next
bind = , XF86AudioPrev, exec, playerctl previous bind = , XF86AudioPrev, exec, playerctl previous
bind = CONTROL ALT, DEL, exec, powermenu

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, pkgs, stable, ... }:
let let
ephemeralbrowser = pkgs.writeScriptBin "ephemeralbrowser" '' ephemeralbrowser = pkgs.writeScriptBin "ephemeralbrowser" ''
@ -35,7 +35,7 @@ let
browser_path="${pkgs.google-chrome}/bin/google-chrome-stable https://ifconfig.me" browser_path="${pkgs.google-chrome}/bin/google-chrome-stable https://ifconfig.me"
profile="google-chrome" profile="google-chrome"
elif [[ $browser == "ungoogled_chromium" ]]; then elif [[ $browser == "ungoogled_chromium" ]]; then
browser_path="${pkgs.ungoogled-chromium}/bin/chromium --user-data-dir=/tmp/ephemeralbrowser/.config/chromium https://ifconfig.me" browser_path="${stable.ungoogled-chromium}/bin/chromium --user-data-dir=/tmp/ephemeralbrowser/.config/chromium https://ifconfig.me"
profile="chromium" profile="chromium"
elif [[ $browser == "firefox" ]]; then elif [[ $browser == "firefox" ]]; then
browser_path="${pkgs.firefox}/bin/firefox -no-remote https://ifconfig.me" browser_path="${pkgs.firefox}/bin/firefox -no-remote https://ifconfig.me"

25
pkgs/scripts/bluetoothcharge.sh Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
output=$(bluetoothctl info 2>&1)
if [[ $output == *"Missing device address argument"* ]] || [[ $output == *"DeviceSet (null) not available"* ]]; then
exit 0
fi
charge=$(bluetoothctl info | awk -F ':' '/Battery Percentage: [0-9A-F]+/ {gsub(/.*\(|\).*/, "", $2); print $2}')
tooltip=$(bluetoothctl info | awk -F': ' '/Name/ {print $2}')
#if [[ "$CHARGE" = "0" ]]
#then
# echo ""
#else
#echo "{\"text\":\""$CHARGE"\", \"tooltip\":\""$tooltip"\"}"
#fi
#echo '{"number": "2", "tooltip": "text-text-text"}'
echo -e $charge'%\n'$tooltip
exit 0

52
pkgs/scripts/brightness.sh Executable file
View file

@ -0,0 +1,52 @@
#!/usr/bin/env bash
iDIR="$HOME/Documents/dotfiles/pkgs/scripts/icons"
# Get brightness
get_backlight() {
LIGHT=$(printf "%.0f\n" $(brightnessctl i))
echo "${LIGHT}%"
}
# Get icons
get_icon() {
backlight="$(brightnessctl g)"
current="${backlight%%%}"
if [[ ("$current" -ge "0") && ("$current" -le "52") ]]; then
icon="$iDIR/brightness-20.png"
elif [[ ("$current" -ge "52") && ("$current" -le "103") ]]; then
icon="$iDIR/brightness-40.png"
elif [[ ("$current" -ge "103") && ("$current" -le "155") ]]; then
icon="$iDIR/brightness-60.png"
elif [[ ("$current" -ge "155") && ("$current" -le "207") ]]; then
icon="$iDIR/brightness-80.png"
elif [[ ("$current" -ge "180") && ("$current" -le "255") ]]; then
icon="$iDIR/brightness-100.png"
fi
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Brightness : $(brightnessctl g)"
}
# Increase brightness
inc_backlight() {
brightnessctl set 10%+ && get_icon && notify_user
}
# Decrease brightness
dec_backlight() {
brightnessctl set 10%- && get_icon && notify_user
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
brightnessctl g
elif [[ "$1" == "--inc" ]]; then
inc_backlight
elif [[ "$1" == "--dec" ]]; then
dec_backlight
else
get_backlight
fi

View file

@ -8,6 +8,11 @@ let
"fzfclipboard" "fzfclipboard"
"fzfmenuft" "fzfmenuft"
"swaylock" "swaylock"
"hyprshade"
"bluetoothcharge"
"brightness"
"volume"
"powermenu"
]; ];
# Generate the script binaries # Generate the script binaries

29
pkgs/scripts/hyprshade.sh Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Define the options
options=(
"off"
"blue-light-filter"
"extradark"
"noblue-light"
"noblue-smart"
"noblue"
)
# Prompt user to select an option using dmenu
selected_option=$(printf "%s\n" "${options[@]}" | fzfmenuft)
# Check if selected option is empty (user canceled)
if [[ -z "$selected_option" ]]; then
exit 1
fi
# Construct the hyprshade command based on selected option
if [[ "$selected_option" == "off" ]]; then
command="hyprshade off"
else
command="hyprshade on $selected_option"
fi
# Execute the constructed command
eval $command

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

34
pkgs/scripts/powermenu.sh Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Define the options
options="Hibernate\nShutdown\nReboot\nSuspend\nLogout\nLock"
# Use dmenu to get the user's choice
choice=$(echo -e "$options" | fzfmenuft)
# Execute the corresponding command based on the user's choice
case "$choice" in
Hibernate)
systemctl hibernate
;;
Shutdown)
systemctl poweroff
;;
Reboot)
systemctl reboot
;;
Suspend)
systemctl suspend
;;
Logout)
# Assuming you're using a desktop environment that supports 'logout'
# Adjust the command according to your DE/WM
pkill -KILL -u $USER
;;
Lock)
hyprlock
;;
*)
echo "Invalid option" && exit 1
;;
esac

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
sh -c "swaylock -C /home/delta/.config/swaylock/config --indicator-x-position $(shuf -i 100-1750 -n 1) --indicator-y-position $(shuf -i 50-1000 -n 1)" & hyprctl switchxkblayout at-translated-set-2-keyboard 0 sh -c "swaylock -C /home/delta/.config/swaylock/config --indicator-x-position $(shuf -i 100-1750 -n 1) --indicator-y-position $(shuf -i 50-1000 -n 1)" & hyprctl switchxkblayout at-translated-set-2-keyboard 0

129
pkgs/scripts/volume.sh Executable file
View file

@ -0,0 +1,129 @@
#!/usr/bin/env bash
iDIR="$HOME/Documents/dotfiles/pkgs/scripts/icons"
# Get Volume
get_volume() {
volume=$(pamixer --get-volume)
echo "$volume"
}
# Get icons
get_icon() {
current=$(get_volume)
if [[ "$current" -eq "0" ]]; then
echo "$iDIR/volume-mute.png"
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
echo "$iDIR/volume-low.png"
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
echo "$iDIR/volume-mid.png"
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
echo "$iDIR/volume-high.png"
fi
}
draw_progressbar() {
# Get the percentage as the first argument
local percentage=$1
# Calculate the number of filled and empty bars based on the percentage
local filled=$((percentage / 4))
local empty=$((25 - filled))
# Create a string of filled bars
local fill=$(printf "%${filled}s")
# Create a string of empty bars
local empt=$(printf "%${empty}s")
# Replace the spaces with the bar symbols
fill=${fill// /█}
empt=${empt// /░}
# Print the progressbar with the percentage
printf "%s%s" "$fill" "$empt"
}
# Notify
notify_user() {
local volume=$(get_volume)
# Call the draw_progressbar function with the volume as the argument
local progressbar=$(draw_progressbar "$volume")
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_icon)" "$volume %" "$progressbar"
}
# Increase Volume
inc_volume() {
pamixer -i 5 && notify_user
}
# Decrease Volume
dec_volume() {
pamixer -d 5 && notify_user
}
# Toggle Mute
toggle_mute() {
if [ "$(pamixer --get-mute)" == "false" ]; then
pamixer -m && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF" "$(draw_progressbar "0")"
elif [ "$(pamixer --get-mute)" == "true" ]; then
pamixer -u && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_icon)" "Volume Switched ON" "$(draw_progressbar "$(get_volume)")"
fi
}
# Toggle Mic
toggle_mic() {
if [ "$(pamixer --default-source --get-mute)" == "false" ]; then
pamixer --default-source -m && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then
pamixer -u --default-source u && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
fi
}
# Get icons
get_mic_icon() {
current=$(pamixer --default-source --get-volume)
if [[ "$current" -eq "0" ]]; then
echo "$iDIR/microphone.png"
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
echo "$iDIR/microphone.png"
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
echo "$iDIR/microphone.png"
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
echo "$iDIR/microphone.png"
fi
}
# Notify
notify_mic_user() {
local volume=$(pamixer --default-source --get-volume)
# Call the draw_progressbar function with the volume as the argument
local progressbar=$(draw_progressbar "$volume")
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_mic_icon)" "Mic-Level : $volume %" "$progressbar"
}
# Increase MIC Volume
inc_mic_volume() {
pamixer --default-source -i 5 && notify_mic_user
}
# Decrease MIC Volume
dec_mic_volume() {
pamixer --default-source -d 5 && notify_mic_user
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_volume
elif [[ "$1" == "--inc" ]]; then
inc_volume
elif [[ "$1" == "--dec" ]]; then
dec_volume
elif [[ "$1" == "--toggle" ]]; then
toggle_mute
elif [[ "$1" == "--toggle-mic" ]]; then
toggle_mic
elif [[ "$1" == "--get-icon" ]]; then
get_icon
elif [[ "$1" == "--get-mic-icon" ]]; then
get_mic_icon
elif [[ "$1" == "--mic-inc" ]]; then
inc_mic_volume
elif [[ "$1" == "--mic-dec" ]]; then
dec_mic_volume
else
get_volume
fi

View file

@ -8,7 +8,7 @@
"height": 20, "height": 20,
"modules-left": [ "modules-left": [
"custom/power_btn", "custom/power_btn",
"custom/launch_apps", // "custom/launch_apps",
"idle_inhibitor", "idle_inhibitor",
"hyprland/workspaces", "hyprland/workspaces",
"hyprland/window" "hyprland/window"
@ -71,13 +71,13 @@
"custom/power_btn": { "custom/power_btn": {
"format": " ", "format": " ",
"on-click": "sh -c '(wlogout --protocol layer-shell)'", "on-click": "sh -c '(powermenu)'",
"tooltip": false "tooltip": false
}, },
"custom/lock_screen": { "custom/lock_screen": {
"format": "", "format": "",
"on-click": "sh -c '(swaylock)'", "on-click": "sh -c '(hyprlock)'",
"tooltip": false "tooltip": false
}, },
@ -120,10 +120,10 @@
"pulseaudio": { "pulseaudio": {
"format": "{icon}", "format": "{icon}",
"format-muted": "", "format-muted": "",
"on-click": "~/.config/utils/waybar/scripts/volume --toggle", "on-click": "volume --toggle",
"on-click-right": "pavucontrol", "on-click-right": "pavucontrol",
"on-scroll-up": "~/.config/utils/waybar/scripts/volume --inc", "on-scroll-up": "volume --inc",
"on-scroll-down": "~/.config/utils/waybar/scripts/volume --dec", "on-scroll-down": "volume --dec",
"scroll-step": 5, "scroll-step": 5,
"format-icons": { "format-icons": {
"headphone": "", "headphone": "",
@ -144,10 +144,10 @@
"format": "{format_source}", "format": "{format_source}",
"format-source": "", "format-source": "",
"format-source-muted": "", "format-source-muted": "",
"on-click": "~/.config/utils/waybar/scripts/volume --toggle-mic", "on-click": "volume --toggle-mic",
"on-click-right": "pavucontrol", "on-click-right": "pavucontrol",
"on-scroll-up": "~/.config/utils/waybar/scripts/volume --mic-inc", "on-scroll-up": "volume --mic-inc",
"on-scroll-down": "~/.config/utils/waybar/scripts/volume --mic-dec", "on-scroll-down": "volume --mic-dec",
"scroll-step": 5, "scroll-step": 5,
"format-alt-click": "click-middle", "format-alt-click": "click-middle",
"format-alt": " {volume}%", "format-alt": " {volume}%",
@ -161,8 +161,8 @@
"format-alt-click": "click-right", "format-alt-click": "click-right",
"format-alt": "{icon} {percent}%", "format-alt": "{icon} {percent}%",
"format-icons": ["󰃞", "󰃟", "󰃠"], "format-icons": ["󰃞", "󰃟", "󰃠"],
"on-scroll-up": "~/.config/utils/waybar/scripts/brightness --inc", "on-scroll-up": "brightness --inc",
"on-scroll-down": "~/.config/utils/waybar/scripts/brightness --dec" "on-scroll-down": "brightness --dec"
}, },
"tray": { "tray": {
@ -181,8 +181,8 @@
"custom/bluetoothcharge": { "custom/bluetoothcharge": {
"format": "{}", "format": "{}",
"tooltip-format": "{}", "tooltip-format": "{}",
"exec": "~/.config/utils/waybar/scripts/bluetoothcharge", "exec": "bluetoothcharge",
"on-click": "~/.config/utils/waybar/scripts/bluetoothcharge", "on-click": "bluetoothcharge",
"interval": 60, "interval": 60,
"tooltip": true "tooltip": true
} }