From 0da2b3060f42e46d7328ec583de1245721c89e06 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Tue, 12 Mar 2024 10:42:17 +0100 Subject: [PATCH] mjau --- home/light.sh | 10 ++++++++++ home/rachel.nix | 42 +++++++++++++++++++++++++++++++----------- home/vol.sh | 23 +++++++++++++++++++++++ home/xinitrc | 12 +++++++----- 4 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 home/light.sh create mode 100644 home/vol.sh diff --git a/home/light.sh b/home/light.sh new file mode 100644 index 0000000..2fe6017 --- /dev/null +++ b/home/light.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +msgTag="lightdunst" + +brightnessctl set "$1" + +light="$(brightnessctl -m | cut -d, -f4)" +dunstify -a "changeLight" -u low \ + -h string:x-dunst-stack-tag:$msgTag \ + -h int:value:"$light" "Brightness: $light" diff --git a/home/rachel.nix b/home/rachel.nix index 01e4954..16ab1e9 100644 --- a/home/rachel.nix +++ b/home/rachel.nix @@ -8,8 +8,9 @@ let username = "rachel"; exec ${hpkgs.haskell-language-server}/bin/haskell-language-server-wrapper "$@" ''; rzk = hpkgs.rzk; -in -{ + vol = pkgs.writeScript "vol" (builtins.readFile ./vol.sh); + light = pkgs.writeScript "light" (builtins.readFile ./light.sh); +in rec { home = { username = username; homeDirectory = homeDir; @@ -86,7 +87,10 @@ in lean4 slippi-netplay xwallpaper - networkmanagerapplet + blueberry + pulseaudio + brightnessctl + maim ]; file.".config/berry/autostart" = { source = ./berry_config; @@ -471,10 +475,12 @@ in sxhkd = { enable = true; + package = pkgs.sxhkd; + extraOptions = [ "-m 1" ]; keybindings = { "super + Return" = "alacritty"; "super + BackSpace" = "firefox"; - "super + r" = "rofi -show run"; + "super + r" = "rofi -show drun"; "super + p" = "cpypsk"; "super + l" = "betterlockscreen -l"; "super + Left" = "berryc snap_left"; @@ -483,15 +489,15 @@ in "super + {1,2,3,4}" = "berryc switch_workspace {0,1,2,3}"; "super + shift + {1,2,3,4}" = "berryc send_to_workspace {0,1,2,3}"; "super + f" = "berryc fullscreen_state"; - "super + {h,j,k,l}" = "berryc cardinal_focus {2,3,1,0}"; "alt + Tab" = "berryc cycle_focus"; "~button1" = "berryc pointer_focus"; - "Print" = "${pkgs.maim}/bin/maim -s ~/img/scrot$(date +%s).png"; - "XF86AudioMute" = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; - "XF86AudioRaiseVolume" = "${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%"; - "XF86AudioLowerVolume" = "${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%"; - "XF86MonBrightnessUp" = "${pkgs.brightnessctl}/bin/brightnessctl set 5%+"; - "XF86MonBrightnessDown" = "${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; + "~Escape" = "dunstctl close-all"; + "Print" = "maim -s ~/img/scrot$(date +%s).png"; + "XF86AudioMute" = "${vol} mute"; + "XF86AudioRaiseVolume" = "${vol} +5%"; + "XF86AudioLowerVolume" = "${vol} -5%"; + "XF86MonBrightnessUp" = "${light} 5%+"; + "XF86MonBrightnessDown" = "${light} 5%-"; }; }; @@ -508,6 +514,20 @@ in dunst = { enable = true; + settings = { + volume = { + appname = "changeVolume"; + history_ignore = "yes"; + }; + light = { + appname = "changeLight"; + history_ignore = "yes"; + }; + }; + }; + + network-manager-applet = { + enable = true; }; betterlockscreen = { diff --git a/home/vol.sh b/home/vol.sh new file mode 100644 index 0000000..e5075fd --- /dev/null +++ b/home/vol.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +msgTag="voldunst" + +case "$1" in + mute) + pactl set-sink-mute @DEFAULT_SINK@ toggle > /dev/null + ;; + *) + pactl set-sink-volume @DEFAULT_SINK@ "$1" > /dev/null + ;; +esac + +volume="$(pactl get-sink-volume @DEFAULT_SINK@ | head -1 | awk '{ print $5 }')" +mute="$(pactl get-sink-mute @DEFAULT_SINK@ | cut -d' ' -f2)" +if [[ $volume == "0%" || "$mute" == "yes" ]]; then + dunstify -a "changeVolume" -u low \ + -h string:x-dunst-stack-tag:$msgTag "Volume muted" +else + dunstify -a "changeVolume" -u low \ + -h string:x-dunst-stack-tag:$msgTag \ + -h int:value:"$volume" "Volume: ${volume}" +fi diff --git a/home/xinitrc b/home/xinitrc index 6f0c743..dbfc758 100644 --- a/home/xinitrc +++ b/home/xinitrc @@ -10,9 +10,11 @@ if command -v dbus-update-activation-environment >/dev/null 2>&1; then fi xwallpaper --zoom "$HOME"/img/wallpaper -nm-applet & -polybar & -sxhkd & -picom & -dusnt & + +systemctl stop --user sxhkd.scope +systemd-cat -t sxhkd systemd-run --user --scope --property=OOMPolicy=continue -u sxhkd sxhkd -m 1 & +systemctl restart --user dunst +systemctl restart --user picom +systemctl restart --user polybar +systemctl restart --user network-manager-applet exec berry