mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-12-12 09:51:11 +01:00
meta: Replace avizo with dunst scripts
Avizo had some issues that ultimately made me return to the old and reliable dunst. For example, the home-manager service would fail to restart after the computer was idle for a set amount of time. The way avizo manages its window also resulted in compositors like Hyprland and picom showing a blur artifact when avizo tried to fade itself. Ultimately using dunst simplifies things and avoids having to look in two different places for notifications.
This commit is contained in:
parent
2193d86585
commit
b7b19601fe
@ -1,37 +0,0 @@
|
|||||||
{ config, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (config.lib.stylix.colors)
|
|
||||||
base01-rgb-r
|
|
||||||
base01-rgb-g
|
|
||||||
base01-rgb-b
|
|
||||||
base02-rgb-r
|
|
||||||
base02-rgb-g
|
|
||||||
base02-rgb-b
|
|
||||||
base05-rgb-r
|
|
||||||
base05-rgb-g
|
|
||||||
base05-rgb-b
|
|
||||||
;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
services.avizo = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
settings.default = {
|
|
||||||
time = 1;
|
|
||||||
image-opacity = lib.mkForce 1;
|
|
||||||
height = 190;
|
|
||||||
padding = 10;
|
|
||||||
y-offset = 0.5;
|
|
||||||
border-width = 0;
|
|
||||||
block-height = 10;
|
|
||||||
block-spacing = 0;
|
|
||||||
fade-in = 0.2;
|
|
||||||
fade-out = 0.2;
|
|
||||||
background = lib.mkForce "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, 1)";
|
|
||||||
border-color = lib.mkForce "rgba(${base01-rgb-r}, ${base01-rgb-g}, ${base01-rgb-b}, 1)";
|
|
||||||
bar-fg-color = lib.mkForce "rgba(${base05-rgb-r}, ${base05-rgb-g}, ${base05-rgb-b}, 1)";
|
|
||||||
bar-bg-color = lib.mkForce "rgba(${base02-rgb-r}, ${base02-rgb-g}, ${base02-rgb-b}, 1)";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
13
home/dwm.nix
13
home/dwm.nix
@ -37,7 +37,6 @@ in
|
|||||||
static const char *const autostart[] = {
|
static const char *const autostart[] = {
|
||||||
"mpDris2", NULL,
|
"mpDris2", NULL,
|
||||||
"dunst", NULL,
|
"dunst", NULL,
|
||||||
"avizo-service", NULL,
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -69,13 +68,13 @@ in
|
|||||||
static const char *dmenucmd[] = { "rofi", "-show", "drun", NULL };
|
static const char *dmenucmd[] = { "rofi", "-show", "drun", NULL };
|
||||||
static const char *quitcmd[] = { "kill", "xinit", NULL };
|
static const char *quitcmd[] = { "kill", "xinit", NULL };
|
||||||
static const char *termcmd[] = { "kitty", NULL };
|
static const char *termcmd[] = { "kitty", NULL };
|
||||||
static const char *brighter[] = { "lightctl", "-d", "up", NULL };
|
static const char *brighter[] = { "mb-up", NULL };
|
||||||
static const char *dimmer[] = { "lightctl", "-d", "down", NULL };
|
static const char *dimmer[] = { "mb-down", NULL };
|
||||||
static const char *print[] = { "scrot", NULL };
|
static const char *print[] = { "scrot", NULL };
|
||||||
static const char *up_vol[] = { "volumectl", "-d", "up", NULL };
|
static const char *up_vol[] = { "mv-up", NULL };
|
||||||
static const char *down_vol[] = { "volumectl", "-d", "down", NULL };
|
static const char *down_vol[] = { "mv-down", NULL };
|
||||||
static const char *mute_vol[] = { "volumectl", "-d", "toggle-mute", NULL };
|
static const char *mute_vol[] = { "mv-mute", NULL };
|
||||||
static const char *mute_mic[] = { "volumectl", "-d", "-m", "toggle-mute", NULL };
|
static const char *mute_mic[] = { "mv-mic", NULL };
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
{ 0, XF86XK_AudioMute, spawn, {.v = mute_vol } },
|
{ 0, XF86XK_AudioMute, spawn, {.v = mute_vol } },
|
||||||
|
@ -229,12 +229,12 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
bindl = [
|
bindl = [
|
||||||
", XF86AudioMute, exec, volumectl -d toggle-mute"
|
", XF86AudioMute, exec, mv-mute"
|
||||||
", XF86AudioRaiseVolume, exec, volumectl -d up"
|
", XF86AudioRaiseVolume, exec, mv-up"
|
||||||
", XF86AudioLowerVolume, exec, volumectl -d down"
|
", XF86AudioLowerVolume, exec, mv-down"
|
||||||
", XF86AudioMicMute, exec, volumectl -d -m toggle-mute"
|
", XF86AudioMicMute, exec, mv-mic"
|
||||||
", XF86MonBrightnessDown, exec, lightctl -d down"
|
", XF86MonBrightnessDown, exec, mb-down"
|
||||||
", XF86MonBrightnessUp, exec, lightctl -d up"
|
", XF86MonBrightnessUp, exec, mb-up"
|
||||||
", XF86Display, exec, ~/.config/${monitorScript}"
|
", XF86Display, exec, ~/.config/${monitorScript}"
|
||||||
", XF86Messenger, togglespecialworkspace"
|
", XF86Messenger, togglespecialworkspace"
|
||||||
", XF86Favorites, exec, killall rofi || rofi -show drun"
|
", XF86Favorites, exec, killall rofi || rofi -show drun"
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
final: prev: {
|
|
||||||
avizo = prev.avizo.overrideAttrs (oldAttrs: {
|
|
||||||
version = "1.3-unstable-2024-09-04";
|
|
||||||
|
|
||||||
src = prev.fetchFromGitHub {
|
|
||||||
owner = "heyjuvi";
|
|
||||||
repo = "avizo";
|
|
||||||
rev = "bc2fb780da58a312191edbf007fc3c8ef1e4eb15";
|
|
||||||
hash = "sha256-aYA/ls6MLHuE/6noVff4LUEJzyh0EEs+u2dallnevcI=";
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
105
packages/dunst-scripts.nix
Normal file
105
packages/dunst-scripts.nix
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenvNoCC,
|
||||||
|
writeTextFile,
|
||||||
|
makeWrapper,
|
||||||
|
fish,
|
||||||
|
pipewire,
|
||||||
|
brightnessctl,
|
||||||
|
libnotify,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
volume = writeTextFile {
|
||||||
|
name = "volume";
|
||||||
|
text = # fish
|
||||||
|
''
|
||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
wpctl set-volume --limit 1 @DEFAULT_AUDIO_SINK@ 5%+
|
||||||
|
|
||||||
|
set VOL "$(wpctl get-volume '@DEFAULT_AUDIO_SINK@')"
|
||||||
|
|
||||||
|
notify-send \
|
||||||
|
--icon "multimedia-volume-control" \
|
||||||
|
--hint "string:x-dunst-stack-tag:volume" \
|
||||||
|
--hint "int:value:$(math "$(echo "$VOL" | awk '{print $2}') * 100")" \
|
||||||
|
"音量" \
|
||||||
|
"$(echo "$VOL" | awk '{print $3}' | sed -e 's/\[MUTED\]/ミュート/' | tr --delete '\n')"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
brightness = writeTextFile {
|
||||||
|
name = "brightness";
|
||||||
|
text = # fish
|
||||||
|
''
|
||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
notify-send \
|
||||||
|
--icon "brightness" \
|
||||||
|
--hint "string:x-dunst-stack-tag:brightness" \
|
||||||
|
--hint "int:value:$(brightnessctl set 5%+ -m | awk --field-separator , '{print $4}')" \
|
||||||
|
"明るさ"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
pname = "dunst-scripts";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
install -Dm755 ${brightness} $out/bin/mb-up
|
||||||
|
install -Dm755 ${brightness} $out/bin/mb-down
|
||||||
|
install -Dm755 ${volume} $out/bin/mv-up
|
||||||
|
install -Dm755 ${volume} $out/bin/mv-down
|
||||||
|
install -Dm755 ${volume} $out/bin/mv-mute
|
||||||
|
|
||||||
|
substituteInPlace $out/bin/mb-down \
|
||||||
|
--replace-fail "5%+" "5%-"
|
||||||
|
|
||||||
|
substituteInPlace $out/bin/mv-down \
|
||||||
|
--replace-fail "5%+" "5%-"
|
||||||
|
|
||||||
|
substituteInPlace $out/bin/mv-mute \
|
||||||
|
--replace-fail "set-volume --limit 1" "set-mute" \
|
||||||
|
--replace-fail "5%+" "toggle"
|
||||||
|
|
||||||
|
install -Dm755 $out/bin/mv-mute $out/bin/mv-mic
|
||||||
|
|
||||||
|
substituteInPlace $out/bin/mv-mic \
|
||||||
|
--replace-fail "DEFAULT_AUDIO_SINK" "DEFAULT_AUDIO_SOURCE" \
|
||||||
|
--replace-fail "multimedia-volume-control" "audio-input-microphone" \
|
||||||
|
--replace-fail "x-dunst-stack-tag:volume" "x-dunst-stack-tag:microphone" \
|
||||||
|
--replace-fail "音量" "マイク"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
for bin in $out/bin/*; do
|
||||||
|
wrapProgram "$bin" \
|
||||||
|
--prefix PATH ":" "${
|
||||||
|
lib.makeBinPath [
|
||||||
|
fish
|
||||||
|
pipewire
|
||||||
|
brightnessctl
|
||||||
|
libnotify
|
||||||
|
]
|
||||||
|
}"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "https://github.com/donovanglover/nix-config";
|
||||||
|
description = "Dunst scripts for brightness and volume";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
maintainers = with lib.maintainers; [ donovanglover ];
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user