diff --git a/flake.lock b/flake.lock index ab20067..632b8e7 100644 --- a/flake.lock +++ b/flake.lock @@ -237,11 +237,11 @@ ] }, "locked": { - "lastModified": 1718788307, - "narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", + "lastModified": 1718526747, + "narHash": "sha256-sKrD/utGvmtQALvuDj4j0CT3AJXP1idOAq2p+27TpeE=", "owner": "nix-community", "repo": "home-manager", - "rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", + "rev": "0a7ffb28e5df5844d0e8039c9833d7075cdee792", "type": "github" }, "original": { @@ -258,11 +258,11 @@ ] }, "locked": { - "lastModified": 1718526747, - "narHash": "sha256-sKrD/utGvmtQALvuDj4j0CT3AJXP1idOAq2p+27TpeE=", + "lastModified": 1718141734, + "narHash": "sha256-cA+6l8ZCZ7MXGijVuY/1f55+wF/RT4PlTR9+g4bx86w=", "owner": "nix-community", "repo": "home-manager", - "rev": "0a7ffb28e5df5844d0e8039c9833d7075cdee792", + "rev": "892f76bd0aa09a0f7f73eb41834b8a904b6d0fad", "type": "github" }, "original": { @@ -313,11 +313,11 @@ ] }, "locked": { - "lastModified": 1718662658, - "narHash": "sha256-AKG7BsqtVWDlefgzyKz7vjaKTLi4+bmTSBhowbQoZtM=", + "lastModified": 1717976995, + "narHash": "sha256-u3HBinyIyUvL1+N816bODpJmSQdgn0Mbb8BprFw7kqo=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "29b3096a6e283d7e6779187244cb2a3942239fdf", + "rev": "315aa649ba307704db0b16c92f097a08a65ec955", "type": "github" }, "original": { @@ -430,11 +430,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1718530797, - "narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=", + "lastModified": 1718318537, + "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b60ebf54c15553b393d144357375ea956f89e9a9", + "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", "type": "github" }, "original": { @@ -446,11 +446,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1718632497, - "narHash": "sha256-YtlyfqOdYMuu7gumZtK0Kg7jr4OKfHUhJkZfNUryw68=", + "lastModified": 1718541509, + "narHash": "sha256-TmC5TxW5WPAfmovDzi1hLe1i4qqND79s9SH9UOKcSvo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c58b4a9118498c1055c5908a5bbe666e56abe949", + "rev": "ba06293cdba1c94af9710024abf3b94cf8d76349", "type": "github" }, "original": { @@ -462,11 +462,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1718770573, - "narHash": "sha256-tnNrZhmle3RE6DtLFADO+nRy0QuzQp4ztVK0R4tUHSA=", + "lastModified": 1718632497, + "narHash": "sha256-YtlyfqOdYMuu7gumZtK0Kg7jr4OKfHUhJkZfNUryw68=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "31a131649c0bcd9d7d9b87786b3fbb54b4dbe6e0", + "rev": "c58b4a9118498c1055c5908a5bbe666e56abe949", "type": "github" }, "original": { @@ -490,11 +490,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1718739916, - "narHash": "sha256-VgRcAEeS8/ZSZgcwg1hYltavagEo47ZsmR7cRZ6VbRY=", + "lastModified": 1718614971, + "narHash": "sha256-ID/Fvvd9Bz01gpm36mIfjoqXIknb2WkacSukW75cRNw=", "owner": "nix-community", "repo": "nixvim", - "rev": "0e93a59567d0850e54cea26b1b5c541a7182c7cf", + "rev": "b822078ec1b2bbf666af767061e29575edc5ec05", "type": "github" }, "original": { @@ -505,11 +505,11 @@ }, "nur": { "locked": { - "lastModified": 1718789152, - "narHash": "sha256-ttxaX71LiQyTrrFzTPff/ku7E/V2kA3/GwQ/G8G/X7E=", + "lastModified": 1718649005, + "narHash": "sha256-1Aw+JgGQK6e9MZdV4cbO1d3GRvYRKbwOvmet5gSFwvE=", "owner": "nix-community", "repo": "NUR", - "rev": "0b21cf66670516802886950379a292a34a797cbd", + "rev": "d4bfad4cd8a5c44bb469f95f20e6eb4799145046", "type": "github" }, "original": { @@ -527,11 +527,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1718745582, - "narHash": "sha256-TFlVP4YXg6n+MbP/Iv/RIwqvRKuV9KA1JAPihoFmPfo=", + "lastModified": 1718647444, + "narHash": "sha256-RzTDK86nI7yzSrOCYy+jPW+7LZigJm1WnFULNdOXblU=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "48e7ed4ef7832efa5a5558e573986c4128fc478f", + "rev": "d3e889d71b028f61ff6a587cfe437bde16cf8ac1", "type": "github" }, "original": { @@ -552,11 +552,11 @@ "treefmt-nix": "treefmt-nix_3" }, "locked": { - "lastModified": 1718745582, - "narHash": "sha256-TFlVP4YXg6n+MbP/Iv/RIwqvRKuV9KA1JAPihoFmPfo=", + "lastModified": 1718647444, + "narHash": "sha256-RzTDK86nI7yzSrOCYy+jPW+7LZigJm1WnFULNdOXblU=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "48e7ed4ef7832efa5a5558e573986c4128fc478f", + "rev": "d3e889d71b028f61ff6a587cfe437bde16cf8ac1", "type": "github" }, "original": { @@ -720,11 +720,11 @@ ] }, "locked": { - "lastModified": 1718522839, - "narHash": "sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls=", + "lastModified": 1718139168, + "narHash": "sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "68eb1dc333ce82d0ab0c0357363ea17c31ea1f81", + "rev": "1cb529bffa880746a1d0ec4e0f5076876af931f1", "type": "github" }, "original": { diff --git a/home/common/core/nixvim/plugins/lsp.nix b/home/common/core/nixvim/plugins/lsp.nix index 9e6c7d2..15d2ea7 100644 --- a/home/common/core/nixvim/plugins/lsp.nix +++ b/home/common/core/nixvim/plugins/lsp.nix @@ -2,13 +2,13 @@ programs.nixvim.plugins.lsp = { enable = true; servers = { - lua-ls = {enable = true;}; - nixd = {enable = true;}; - bashls = {enable = true;}; - pyright = {enable = true;}; - html = {enable = true;}; - yamlls = {enable = true;}; - marksman = {enable = true;}; + lua-ls = { enable = true; }; + nixd = { enable = true; }; + bashls = { enable = true; }; + pyright = { enable = true; }; + html = { enable = true; }; + yamlls = { enable = true; }; + marksman = { enable = true; }; #sqls = {enable = true;}; }; keymaps = { diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix index 768ed35..6b9cfc1 100644 --- a/home/common/optional/desktop/dwm/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -24,6 +24,7 @@ ./scripts/emoji-picker.nix ./scripts/clipboard-save.nix ./scripts/clipboard-recall.nix + ./scripts/get-focused-monitor.nix ]; home.packages = [ @@ -32,5 +33,6 @@ pkgs.dunst pkgs.picom pkgs.sxhkd + pkgs.nsxiv ]; } diff --git a/home/common/optional/desktop/dwm/scripts/clipboard-recall.nix b/home/common/optional/desktop/dwm/scripts/clipboard-recall.nix index 29d5bbc..a19e923 100644 --- a/home/common/optional/desktop/dwm/scripts/clipboard-recall.nix +++ b/home/common/optional/desktop/dwm/scripts/clipboard-recall.nix @@ -52,18 +52,22 @@ (writeShellScriptBin "clipboard-image-recall" '' # Script to view and select and output images in image clipboard dir to clipboard. - #!/bin/bash - width=$(${xorg.xwininfo}/bin/xwininfo -root | grep Width | sed "s/^.*:\s//") - height=$(${xorg.xwininfo}/bin/xwininfo -root | grep Height | sed "s/^.*:\s//") - + monitor_name=$(get-focused-monitor) + monitor_info=$(xrandr | grep "$monitor_name") + + width=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f1) + height=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f2) + scale_width=$(( $width/4 + $width/2 )) scale_height=$(( $height/4 + $height/2 )) - if [ "$1" == "" ]; then - echo "Please provide directory" + if [ "$1" == "" ] || [ -f "$1" ]; then + notify-send -t 1000 "Clipboard Recall" "Directory not specified or missing." exit 1 fi + filesdir="$(find $1 -type f -printf '%T@ %p\n' | sort -rn | cut -d ' ' -f 2-)" + [ "$filesdir" == "" ] && notify-send -t 1000 "Clipboard Recall" "No images in directory" && exit 1 output="$(echo "$filesdir" | ${nsxiv}/bin/nsxiv -tioq -g "$scale_width"x"$scale_height" -N nsxiv-float )" num_lines=$( echo "$output" | wc -l) diff --git a/home/common/optional/desktop/dwm/scripts/get-focused-monitor.nix b/home/common/optional/desktop/dwm/scripts/get-focused-monitor.nix new file mode 100644 index 0000000..3de584d --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/get-focused-monitor.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "get-focused-monitor" '' + # get the current cursor location into X and Y variables + eval $(xdotool getmouselocation --shell) + + # compare mouse location to monitor coordinates + while IFS= read -r line; do + if [[ $line =~ " connected" ]]; then + display=$(echo "$line" | awk '{print $1}') + coords=$(echo "$line" | grep -oP "\d+x\d+" | tr 'x+' ' ') + + read width height x_offset y_offset <<< $coords + + if (( X >= x_offset && X <= width + x_offset )) && (( Y >= y_offset && Y <= height + y_offset )); then + echo "$display" + break + fi + fi + done < <(xrandr) + + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/xresources.nix b/home/common/optional/desktop/dwm/xresources.nix index 69accae..bbca67f 100644 --- a/home/common/optional/desktop/dwm/xresources.nix +++ b/home/common/optional/desktop/dwm/xresources.nix @@ -30,6 +30,14 @@ dmenu.selfgcolor: #${config.colorScheme.colors.base00} dmenu.selbgcolor: #${config.colorScheme.colors.base0B} + Nsxiv.window.background: #${config.colorScheme.colors.base03} + Nsxiv.window.foreground: #${config.colorScheme.colors.base05} + Nsxiv.mark.foreground: #${config.colorScheme.colors.base08} + + Nsxiv.bar.background: #${config.colorScheme.colors.base00} + Nsxiv.bar.foreground: #${config.colorScheme.colors.base05} + Nsxiv.bar.font: monospace:size=12 + ''; };