contrib icon indicating copy to clipboard operation
contrib copied to clipboard

Grimblast throwing error only on keybind invocation

Open rohrsben opened this issue 11 months ago • 6 comments

Program

Grimblast

Maintainers of the program

@fufexan, @Misterio77

Bug or Regression?

Bug

Description

I have print bound to an area selection: bind = ,Print, exec, grimblast --notify save area $XDG_PICTURES_DIR/screenshots/$(date +'%b%d-%T.png')

When invoked by pressing print, I get a notification saying Error: Unable to invoke grim. When running the exact same command in the terminal, it works as expected. Additionally, grimblast check returns all OKs.

How to reproduce

  1. Set keybind as above
  2. Press key

...maybe? not sure if this will reproduce

Hyprland crash reports, program logs, images, videos

Nixos unstable, grimblast installed via flake

rohrsben avatar Jan 12 '25 11:01 rohrsben

Doesn't happen on my end. How are you launching Hyprland?

fufexan avatar Jan 12 '25 12:01 fufexan

uwsm start default.

I forgot to mention that the keybind used to work, though I have no idea when it broke as I don't take many screenshots.

rohrsben avatar Jan 12 '25 19:01 rohrsben

If you configure hyprland through HM, can you add this? (assuming it's not like this already)

bind = [
  # ...
  ", Print, exec, ${grimblast} --notify save area $XDG_PICTURES_DIR/screenshots/$(date +'%b%d-%T.png')"
];

If you don't configure with HM, then maybe try using the full path to grimblast.

fufexan avatar Jan 12 '25 20:01 fufexan

bind = ,Print, exec, /nix/store/jq18d66r9rv2wmd1h440nxx9n8sbkn8n-grimblast-0.1/bin/grimblast --notify save area $XDG_PICTURES_DIR/screenshots/$(date +'%b%d-%T.png')

No luck.

rohrsben avatar Jan 12 '25 22:01 rohrsben

In case some clarifying info helps, grimblast does launch. I can select an area/window just fine, its only when I release the mouse button to take the screenshot that it tells me the error.

rohrsben avatar Jan 12 '25 22:01 rohrsben

Did a bit of troubleshooting: $FILE at line 171 in grimblast is set to /screenshots/<date>.png, not <xdgpics>/screenshots/<date>.png, causing grim to fail on no such file/dir. echo <xdgpics> in my term has correct output, and hardcoding the xdg pictures dir a la bind = ,Print, exec, <nixstore>grimblast --notify save area /home/error/xdg/pictures/screenshots/$(date +'%b%d-%T.png') makes the screenshot succeed.

I don't know anything about systemd or uwsm, but somehow XDG_PICTURES_DIR isn't propagating through.

Additional attempt: bind = ,Print, exec, notify-send "pics dir" "$XDG_PICTURES_DIR" sends an empty notification.

rohrsben avatar Jan 13 '25 05:01 rohrsben

Forgot to mark this as solved:

If anyone reading sets custom xdg dirs like I do, you can just directly interpolate them in scripts a la ${config.xdg.userDirs.pictures}. Probably a healthier way to do it anyways

rohrsben avatar May 14 '25 15:05 rohrsben