From fd20921d1e061d6ecb5c1da4a484ed698ba438d3 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 16 Jun 2024 22:16:59 +0100 Subject: [PATCH] emoji-picker notification time, modify sb-scripts, xresources stuff --- .../desktop/dwm/scripts/clipboard-recall.nix | 5 +---- .../desktop/dwm/scripts/emoji-picker.nix | 9 +++++---- .../optional/desktop/dwm/scripts/sb-cpu-pct.nix | 2 +- .../optional/desktop/dwm/scripts/sb-mem-pct.nix | 2 +- .../desktop/dwm/scripts/sb-network-status.nix | 2 +- .../optional/desktop/dwm/scripts/sb-updates.nix | 2 +- .../optional/desktop/dwm/scripts/sb-volume.nix | 2 +- home/common/optional/desktop/dwm/xresources.nix | 9 +++++++-- home/users/sam/default.nix | 16 +++++++++------- hosts/common/optional/dwm.nix | 4 ++-- pkgs/dmenu/default.nix | 4 ++-- pkgs/dwmblocks/default.nix | 4 ++-- 12 files changed, 33 insertions(+), 28 deletions(-) diff --git a/home/common/optional/desktop/dwm/scripts/clipboard-recall.nix b/home/common/optional/desktop/dwm/scripts/clipboard-recall.nix index 35d267e..29d5bbc 100644 --- a/home/common/optional/desktop/dwm/scripts/clipboard-recall.nix +++ b/home/common/optional/desktop/dwm/scripts/clipboard-recall.nix @@ -56,9 +56,6 @@ width=$(${xorg.xwininfo}/bin/xwininfo -root | grep Width | sed "s/^.*:\s//") height=$(${xorg.xwininfo}/bin/xwininfo -root | grep Height | sed "s/^.*:\s//") - offset_horiz=$(( $width/8 )) - offset_vert=$(( $height/8 )) - scale_width=$(( $width/4 + $width/2 )) scale_height=$(( $height/4 + $height/2 )) @@ -67,7 +64,7 @@ exit 1 fi filesdir="$(find $1 -type f -printf '%T@ %p\n' | sort -rn | cut -d ' ' -f 2-)" - output="$(echo "$filesdir" | ${nsxiv}/bin/nsxiv -tioq -g "$scale_width"x"$scale_height"-$offset_horiz-$offset_vert -N nsxiv-float )" + output="$(echo "$filesdir" | ${nsxiv}/bin/nsxiv -tioq -g "$scale_width"x"$scale_height" -N nsxiv-float )" num_lines=$( echo "$output" | wc -l) if [ "$num_lines" -gt 1 ]; then diff --git a/home/common/optional/desktop/dwm/scripts/emoji-picker.nix b/home/common/optional/desktop/dwm/scripts/emoji-picker.nix index 57a37c8..3a6d8c9 100644 --- a/home/common/optional/desktop/dwm/scripts/emoji-picker.nix +++ b/home/common/optional/desktop/dwm/scripts/emoji-picker.nix @@ -11,15 +11,16 @@ # Check if emoji files are installed, if not pull from remote if [ ! -f "$emoji_file" ] || [ ! -f "$nerdfont_file" ]; then - notify-send "Emoji Picker" "Symbol files not found. Fetching from: '$remote'..." + notify-send -t 5000 "Emoji Picker" "Symbol files not found. Fetching from: '$remote'..." mkdir -p "$symbols_dir" git clone "$remote" "$symbols_dir" - [ "$?" != 0 ] && notify-send "Emoji Picker" "Error fetching from: $remote" && exit 1 + [ "$?" != 0 ] && notify-send -t 2000 "Emoji Picker" "Error fetching from: $remote" && exit 1 fi # Concat all emoji files and pipe into dmenu. Remove empty rows with sed. Exit if invalid selection. emoji_row=$(cat "$recent" "$emoji_file" "$nerdfont_file" | sed '/^$/d' | dmenu -l 20) - [ "$emoji_row" == "**** Recent ****" ] || [ "$emoji_row" == "****************" ] && notify-send "Emoji Picker" "Invalid selection." && exit 1 + [ "$emoji_row" == "" ] && notify-send -t 1000 "Emoji Picker" "Cancelled" && exit 0 + [ "$emoji_row" == "**** Recent ****" ] || [ "$emoji_row" == "****************" ] && notify-send -t 1000 "Emoji Picker" "Invalid selection." && exit 1 # Add selected emoji to recent. sed -i "/$emoji_row/d" "$recent" && sed -i "2s/^/$emoji_row\n/" "$recent" @@ -27,7 +28,7 @@ # Copy to clipboard emoji=$(echo "$emoji_row" | sed 's/\s.*//g') echo "$emoji" | xclip -i -r -selection CLIPBOARD - notify-send "Emoji Picker" "$emoji_row copied to clipboard" + notify-send -t 5000 "Emoji Picker" "$emoji_row copied to clipboard" '') ]; } diff --git a/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix b/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix index b2117a0..d89f582 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix @@ -2,7 +2,7 @@ { home.packages = with pkgs; [ (writeShellScriptBin "sb-cpu-pct" '' - echo $(top -bn 1 |grep "Cpu(s)" | awk '{print $2+$6 "%"}' | sed "s/\..//g") + echo "[󰻠 $(top -bn 1 |grep "Cpu(s)" | awk '{print $2+$6 "%"}' | sed "s/\..//g")] " '') ]; } diff --git a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix index 453e807..fa5261a 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix @@ -3,7 +3,7 @@ home.packages = with pkgs; [ (writeShellScriptBin "sb-mem-pct" '' # Gets current ram percent utilisation - echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | ${bc}/bin/bc | awk '{print $1"%"}') + echo "[󰍛 $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | ${bc}/bin/bc | awk '{print $1"%"}')] " '') ]; } diff --git a/home/common/optional/desktop/dwm/scripts/sb-network-status.nix b/home/common/optional/desktop/dwm/scripts/sb-network-status.nix index 9ce8a4a..e1dfe49 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-network-status.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-network-status.nix @@ -43,7 +43,7 @@ then printf "$network_symbol" else - printf "$network_symbol|$IP_ADDRESS" + printf "[$network_symbol|$IP_ADDRESS] " fi '') ]; diff --git a/home/common/optional/desktop/dwm/scripts/sb-updates.nix b/home/common/optional/desktop/dwm/scripts/sb-updates.nix index e20b521..d2df347 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-updates.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-updates.nix @@ -7,7 +7,7 @@ inputs=$(cd /etc/nixos && nix flake update --output-lock-file <(cat flake.nix) 2> /tmp/update && cat /tmp/update | grep -c Update) - printf " $inputs" + printf "[ $inputs] " '') ]; } diff --git a/home/common/optional/desktop/dwm/scripts/sb-volume.nix b/home/common/optional/desktop/dwm/scripts/sb-volume.nix index 1edf8d9..2484526 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-volume.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-volume.nix @@ -28,7 +28,7 @@ fi print_string="$mic_status $icon $vol%" - printf '%s' "''${print_string}" + printf '%s' "[''${print_string}] " '') ]; } diff --git a/home/common/optional/desktop/dwm/xresources.nix b/home/common/optional/desktop/dwm/xresources.nix index 938e59e..69accae 100644 --- a/home/common/optional/desktop/dwm/xresources.nix +++ b/home/common/optional/desktop/dwm/xresources.nix @@ -3,6 +3,9 @@ home.file.".Xresources" = { recursive = true; text = '' + ! scale + Xft.dpi: 144 + ! st st.alpha: 0.8 St.font: monospace:pixelsize=21:antialias=true:autohint=true; @@ -10,7 +13,7 @@ ! dwm dwm.borderpx: 3 - dwm.font: monospace:size=14 + dwm.font: monospace:size=12 dwm.col_base00: #${config.colorScheme.colors.base00} dwm.col_base03: #${config.colorScheme.colors.base03} dwm.col_base04: #${config.colorScheme.colors.base04} @@ -19,7 +22,9 @@ dwm.col_base0B: #${config.colorScheme.colors.base0B} ! dmenu - dmenu.font: monospace:size=14 + dmenu.font: monospace:size=12 + dmenu.font2: NotoColorEmoji:pixelsize=22:antialias=true:autohint=true + dmenu.topbar: 1 dmenu.normfgcolor: #${config.colorScheme.colors.base05} dmenu.normbgcolor: #${config.colorScheme.colors.base03} dmenu.selfgcolor: #${config.colorScheme.colors.base00} diff --git a/home/users/sam/default.nix b/home/users/sam/default.nix index 616fcb8..802dc2c 100644 --- a/home/users/sam/default.nix +++ b/home/users/sam/default.nix @@ -38,16 +38,18 @@ videos = "/home/sam/vids"; }; + # Prevent error when enabling gtk https://github.com/nix-community/home-manager/issues/3113 + # error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files + home.packages = [ pkgs.dconf ]; gtk.enable = true; - gtk.cursorTheme.package = pkgs.bibata-cursors; - gtk.cursorTheme.name = "Bibata-Modern-Ice"; + # Get details about theme package + #cd $(nix build nixpkgs#kanagawa-gtk-theme --print-out-paths --no-link) && nix run nixpkgs#eza -- --tree --level 4 + gtk.theme.package = pkgs.kanagawa-gtk-theme; + gtk.theme.name = "Kanagawa-B"; - gtk.theme.package = pkgs.gruvbox-gtk-theme; - gtk.theme.name = "Gruvbox-Dark-B"; - - gtk.iconTheme.package = pkgs.gruvbox-plus-icons; - gtk.iconTheme.name = "GruvboxPlus"; + gtk.iconTheme.package = pkgs.kanagawa-icon-theme; + gtk.iconTheme.name = "Kanagawa"; qt.enable = true; qt.platformTheme.name = "gtk"; diff --git a/hosts/common/optional/dwm.nix b/hosts/common/optional/dwm.nix index c628d59..132b9c5 100644 --- a/hosts/common/optional/dwm.nix +++ b/hosts/common/optional/dwm.nix @@ -16,8 +16,8 @@ domain = "git.bitlab21.com"; owner = "sam"; repo = "dwm"; - rev = "a49099cfcc5839f88137c44cb4bef416d67591af"; - sha256 = "sha256-NmBr3e6ltt9TowWZ9MfV1jyEhRcr5NJNu7T19J79BVs="; + rev = "e34d0ecdd98e52164c135b560a5583aa11be89b7"; + sha256 = "sha256-er1zi2xYK7AB6oR7JmfkfehesKTw9P4bcgjafj2lIIU="; }; }; }; diff --git a/pkgs/dmenu/default.nix b/pkgs/dmenu/default.nix index 27928ac..8ba680e 100644 --- a/pkgs/dmenu/default.nix +++ b/pkgs/dmenu/default.nix @@ -13,8 +13,8 @@ pkgs.stdenv.mkDerivation { domain = "git.bitlab21.com"; owner = "sam"; repo = "dmenu"; - rev = "aaa18d5eb6c7a935766af489a3e3f3136278d3cc"; - sha256 = "sha256-khcBW6oVbvagLa2dfbteCJfzepbv4Y6GoUauYXHNhQo="; + rev = "b07a6b2368198b9102ee1814ea01c93c9dfa478f"; + sha256 = "sha256-FWuup2N+cyJErAA0n6wuv1Ru28/yiJETjEjqKe44yDE="; }; nativeBuildInputs = [ diff --git a/pkgs/dwmblocks/default.nix b/pkgs/dwmblocks/default.nix index d118abe..0d19322 100644 --- a/pkgs/dwmblocks/default.nix +++ b/pkgs/dwmblocks/default.nix @@ -12,8 +12,8 @@ pkgs.stdenv.mkDerivation { domain = "git.bitlab21.com"; owner = "sam"; repo = "dwmblocks"; - rev = "c4e7a9b1eb98123e239ba76bc551934721fd18ca"; - sha256 = "sha256-F1x8jOT+c2pPCF9qKq5boIWzegMBTCxwzKMVtmtMWGM="; + rev = "1a65ae7eb0ae68f979ac86f0862ffa52d88da366"; + sha256 = "sha256-PiUCHwm4MpoKGT2b/MgSpffejSqzOXdPlxXKGh0QEU4="; }; nativeBuildInputs = [