diff --git a/default.nix b/default.nix index c9c2506..c70cc79 100644 --- a/default.nix +++ b/default.nix @@ -2,16 +2,17 @@ , scdoc , xclip , maim +, pngquant , stdenvNoCC , nushell , xdotool , ... }: -stdenvNoCC.mkDerivation rec { +stdenvNoCC.mkDerivation { pname = "irs"; version = "0.3"; src = ./src; - nativeBuildInputs = with pkgs; [ + nativeBuildInputs = [ scdoc nushell ]; @@ -39,6 +40,7 @@ stdenvNoCC.mkDerivation rec { substituteInPlace $out/bin/* \ --replace "xclip" "${xclip}/bin/xclip" \ --replace "maim" "${maim}/bin/maim" \ + --replace "pngquant" "${pngquant}/bin/pngquant" \ --replace "xdotool" "${xdotool}/bin/xdotool" ''; diff --git a/flake.nix b/flake.nix index 6d45e37..a000f94 100644 --- a/flake.nix +++ b/flake.nix @@ -1,8 +1,8 @@ { description = "A few random scripts"; inputs = { - nixpkgs.url = github:nixos/nixpkgs/nixos-23.05; - flake-utils.url = github:numtide/flake-utils; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: diff --git a/src/bin/maim-utils b/src/bin/maim-utils index 13ff7a9..05926aa 100755 --- a/src/bin/maim-utils +++ b/src/bin/maim-utils @@ -15,7 +15,7 @@ fullscreen(){ selection(){ maim -su "$filename" - notify-send 'Maim utils' "Shot selection and saved output to:\n\n$filename\n\nBe aware that the selection process can be cancelled using any keypress and that this won't show up due to xclip eating the exit status." + notify-send 'Maim utils' "Shot selection and saved output to:\n\n$filename\n\n" } focus(){ @@ -24,23 +24,23 @@ focus(){ } clip_fullscreen(){ - maim -ui root | xclip -sel clip -t image/png + maim -ui root | pngquant - | xclip -sel clip -t image/png notify-send 'Maim utils' "Shot entire screen and sent it to the clipboard." } clip_selection(){ - maim -su | xclip -sel clip -t image/png + maim -su | pngquant - | xclip -sel clip -t image/png notify-send 'Maim utils' "Shot selection and sent it to the clipboard.\nBe aware that the selection process can be cancelled using any keypress and that this won't show up due to xclip eating the exit status." } clip_focus(){ - maim -ui "$(xdotool getactivewindow)" | xclip -sel clip -t image/png + maim -ui "$(xdotool getactivewindow)" | pngquant - | xclip -sel clip -t image/png notify-send 'Maim utils' "Shot focussed window and sent it to the clipboard." } fancy_clip(){ # nicked straight from the maim README (https://github.com/naelstrof/maim#examples) - maim -st 9999999 | convert - \( +clone -background black -shadow 80x3+5+5 \) +swap -background none -layers merge +repage PNG:- | xclip -sel clip -t image/png + maim -st 9999999 | pngquant - | convert - \( +clone -background black -shadow 80x3+5+5 \) +swap -background none -layers merge +repage PNG:- | xclip -sel clip -t image/png notify-send 'Maim utils' "Shot selection and sent it to the clipboard.\nBe aware that the selection process can be cancelled using any keypress and that this won't show up due to xclip eating the exit status." } diff --git a/src/bin/status-notification b/src/bin/status-notification index 8d86075..3027249 100755 --- a/src/bin/status-notification +++ b/src/bin/status-notification @@ -1,9 +1,5 @@ #!/usr/bin/env nu -# (ls).name | each {|item| (cat $"($item)/capacity") } | lines -# open uevent | lines | parse "{key}={value}" | transpose -r -# let batteries = ( (ls /sys/class/power_supply).name | each {|item| open $"($item)/uevent" } | each {|item| $item | lines | parse "{key}={value}" | transpose -r }) - let dateString = ^date let discordianDate = ^ddate @@ -26,7 +22,7 @@ def get_batteries [] { } | each {|| $in} $batteries | each {|i| - [ $i.POWER_SUPPLY_MANUFACTURER $i.POWER_SUPPLY_MODEL_NAME $i.POWER_SUPPLY_CAPACITY ] + [ $i.POWER_SUPPLY_MANUFACTURER $i.POWER_SUPPLY_MODEL_NAME $i.POWER_SUPPLY_STATUS $i.POWER_SUPPLY_CAPACITY ] | each {|j| $j | first }