migrate to waybar

This commit is contained in:
soraefir 2023-11-21 02:36:47 +01:00
parent dca107f483
commit 285d5caa8e
11 changed files with 3728 additions and 21 deletions

20
flake.lock generated
View File

@ -171,22 +171,6 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1700108881,
"narHash": "sha256-+Lqybl8kj0+nD/IlAWPPG/RDTa47gff9nbei0u7BntE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7414e9ee0b3e9903c24d3379f577a417f0aae5f1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1700426639,
@ -216,7 +200,9 @@
},
"sops-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs"
]

View File

@ -22,6 +22,7 @@
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
nix-colors.url = "github:misterio77/nix-colors";

View File

@ -1 +1 @@
{ ... }: { imports = [ ./dunst ./eww ./kanshi ./waylock ./wofi ]; }
{ ... }: { imports = [ ./dunst ./eww ./kanshi ./waybar ./waylock ./wofi ]; }

View File

@ -0,0 +1,236 @@
{ lib, config, pkgs, ... }:
let
jsonOutput = name: { pre ? "", text ? "", tooltip ? "", alt ? "", class ? "", percentage ? "" }: "${pkgs.writeShellScriptBin "waybar-${name}" ''
set -euo pipefail
${pre}
${pkgs.jq}/bin/jq -cn \
--arg text "${text}" \
--arg tooltip "${tooltip}" \
--arg alt "${alt}" \
--arg class "${class}" \
--arg percentage "${percentage}" \
'{text:$text,tooltip:$tooltip,alt:$alt,class:$class,percentage:$percentage}'
''}/bin/waybar-${name}";
in {
config = lib.mkIf (config.homecfg.wm == "Wayland") {
home.packages = [pkgs.custom.amdgpu_top pkgs.jq];
programs.waybar = {
enable = true;
package = pkgs.waybar;
systemd.enable = false;
style = ''
* {
border: none;
border-radius: ${config.colorScheme.colors.radius};
font-family:'Monospace','Material Design Icons','Openmoji';
font-size: 13pt;
color: #${config.colorScheme.colors.base07};
}
window#waybar {
background: transparent;
}
tooltip {
background: #${config.colorScheme.colors.base01};
border-radius: ${config.colorScheme.colors.radius};
border-color: #${config.colorScheme.colors.base04};
border-width: 2px;
border-style: solid;
font-size: 13pt;
}
tooltip label {
padding: 8px;
}
#workspaces {
background: #${config.colorScheme.colors.base01};
font-size: 64pt;
margin-top: 6pt;
margin-bottom: 10pt;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top: 2px solid #${config.colorScheme.colors.base04};
border-left: 2px solid #${config.colorScheme.colors.base04};
border-bottom: 2px solid #${config.colorScheme.colors.base04};
}
#workspaces button {
padding: 2pt;
padding-left: 4pt;
}
#workspaces button.focused {
color: #${config.colorScheme.colors.base0C};
}
#workspaces button.active {
color: #${config.colorScheme.colors.base0C};
}
#workspaces button.urgent {
color: #${config.colorScheme.colors.base08};
}
#workspaces button:hover icon {
color: #${config.colorScheme.colors.base04};
}
#network,
#pulseaudio,
#backlight, #battery,
#cpu, #memory, #custom-gpu,
#tray,
#custom-powermenu,
#clock, #clock.date, #clock.time
{
background: #${config.colorScheme.colors.base01};
margin-bottom: 4pt;
padding-top: 2px;
padding-left: 2px;
padding-bottom: 2px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top: 2px solid #${config.colorScheme.colors.base04};
border-left: 2px solid #${config.colorScheme.colors.base04};
border-bottom: 2px solid #${config.colorScheme.colors.base04};
}
#custom-powermenu {
margin-bottom: 0pt;
border-bottom-left-radius: 0px;
border-bottom: none;
}
'';
settings = [{
"layer" = "top";
"position" = "right";
modules-left = [
"hyprland/workspaces"
];
modules-center = [
];
modules-right = [
"pulseaudio"
"backlight"
"cpu"
"custom/gpu"
"memory"
"network"
"battery"
"tray"
"clock"
"custom/powermenu"
];
"hyprland/workspaces" = {
"format" = "{icon}";
"on-click" = "activate";
"active-only" = "false";
"format-icons" = {
"default" = "󰝦";
"active" = "󰝥";
"urgent" = "󰺕";
"focused" = "󰪥";
};
"persistent-workspaces" = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
"6" = [];
"7" = [];
"8" = [];
"9" = [];
"10" = [];
};
"on-scroll-up" = "hyprctl dispatch workspace r-1";
"on-scroll-down" = "hyprctl dispatch workspace r+1";
};
"backlight" = {
"device" = "amd_backlight";
"on-scroll-up" = "light -A 5";
"on-scroll-down" = "light -U 5";
"format" = "{icon}";
"format-icons" = [ "󱩎" "󱩑" "󱩔" "󰛨" ];
};
"pulseaudio" = {
"scroll-step" = 5;
"format" = "{icon}";
"format-muted" = "󰝟";
"format-icons" = { "default" = [ "󰕿" "󰖀" "󰕾" ]; };
"on-click" = "amixer -D pulse sset Master toggle -q";
};
"battery" = {
"interval" = 30; "states" = {
"warning" = 20;
"critical" = 10;
};
"format" = "{icon}";
"format-icons" = [ "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ];
"format-full" = "{icon}";
"format-charging" = "{icon}󱐋";
};
"clock" = {
"interval" = 30;
"format" = "{:<b>%H</b>\n%M}";
"tooltip-format" = "<big><b>{:%d/%m/%Y}</b></big>\n<tt><small>{calendar}</small></tt>";
"calendar" = {
"months"= "";
};
};
"memory" = {
"interval" = 5;
"format" = "󰍛\n{icon}";
"format-icons" = [ "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ];
"states" = { "warning" = 85; };
};
"cpu" = {
"interval" = 1;
"format-icons" = [ "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ];
"format" = "󱛠\n{icon}";
};
"custom/gpu" = {
"exec" = jsonOutput "gpu" {
tooltip = ''...'';
percentage = ''$(amdgpu_top -J -n 1 | jq -r '.devices[0].GRBM2."Command Processor - Graphics".value')'';
};
"return-type" = "json";
"interval" = 5;
"format-icons" = [ "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ];
"format" = "󰇞\n{icon}";
};
"network" = {
"format-disconnected" = "󰯡";
"format-ethernet" = "󰀂";
"format-linked" = "󰖪";
"format-wifi" = "󰖩";
"interval" = 1;
"tooltip-format-disconnected" = "Disconnected";
"tooltip-format-ethernet" = "{ifname} @ {ipaddr}";
"tooltip-format-linked" = "{essid}: {ifname} @ -";
"tooltip-format-wifi" = "{essid}: {ifname} @ {ipaddr}";
};
"temperature" = {
# "hwmon-path"= "${env:HWMON_PATH}";
#"critical-threshold"= 80;
"format" = "󰔏 {temperatureC}°C";
};
"custom/powermenu" = {
"format" = "{icon}";
"format-icons" = [ "󰐥" ];
"on-click" = "wlogout";
"tooltip" = false;
};
"tray" = {
"icon-size" = 15;
"spacing" = 5;
};
}];
};
};
}

View File

@ -92,7 +92,8 @@
workspace_swipe = off
}
exec-once = eww open bar
# exec-once = eww open bar
exec-once = waybar
exec-once = dunst
exec-once = swww init

View File

@ -1 +1,5 @@
{ ... }: { imports = [ ./sorahiro_soft.nix ]; }
{ ... }: {
imports = [ ./sorahiro_soft.nix ];
colorScheme.colors.radius = "#8px";
}

View File

@ -5,6 +5,7 @@
slug = "sorahiro-hard";
name = "sorahiro-hard";
author = "Soraefir @ Helcel";
kind = "dark";
colors = {
# Format: Name, Pantone, RAL
base00 = "#030B12"; # Rich Black / 6C / 000-15-00
@ -23,7 +24,6 @@
baseOD = "#9331F5"; # Blue-Violet / 7442C / 300-40-45
base0E = "#F53193"; # Royal Pink / 232C / 350-50-50
base0F = "#F53131"; # Deep Carmine Pink / 1788C / 040-50-70
};
};
}

View File

@ -5,6 +5,7 @@
slug = "sorahiro-soft";
name = "sorahiro-soft";
author = "Soraefir @ Helcel";
kind = "dark";
colors = {
# Format: Name, Pantone, RAL
base00 = "#030B12"; # Rich Black / 6C / 000-15-00

3417
packages/amdgpu_top/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
{ lib
, rustPlatform
, fetchFromGitHub
, libdrm
, libX11
, libGL
, wayland
, wayland-protocols
, libxkbcommon
, libXrandr
, libXi
, libXcursor
}:
rustPlatform.buildRustPackage rec {
pname = "amdgpu_top";
version = "0.3.1";
src = fetchFromGitHub {
owner = "Umio-Yasuno";
repo = pname;
rev = "v${version}";
hash = "sha256-bkrXm3lXJr+sZ09GeVHgfIp8JO3a/Ejrsm1Cm4eY4IU=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"libdrm_amdgpu_sys-0.2.2" = "sha256-2QXT/6octEzokW8+0mHx02R8qQ3kCBDxZT4yyfDkM5A=";
};
};
buildInputs = [
libdrm
libX11
libGL
wayland
wayland-protocols
libxkbcommon
libXrandr
libXi
libXcursor
];
postInstall = ''
install -D ./assets/${pname}.desktop -t $out/share/applications/
'';
postFixup = ''
patchelf --set-rpath "${lib.makeLibraryPath buildInputs}" $out/bin/${pname}
'';
meta = with lib; {
description = "Tool to display AMDGPU usage";
homepage = "https://github.com/Umio-Yasuno/amdgpu_top";
changelog = "https://github.com/Umio-Yasuno/amdgpu_top/releases";
license = licenses.mit;
maintainers = with maintainers; [ geri1701 ];
platforms = platforms.linux;
};
}

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: {
amdgpu_top = pkgs.callPackage ./amdgpu_top { };
simc = pkgs.qt6.callPackage ./simc { };
repalette = pkgs.callPackage ./repalette { };