hyprwm / contrib

Community scripts and utilities for Hypr projects
MIT License
294 stars 39 forks source link

grimblast freeze option doesn't work #118

Closed Gigas002 closed 2 months ago

Gigas002 commented 2 months ago

Program

grimblast

Maintainers of the program

@fufexan, @Misterio77

Bug or Regression?

Bug

Description

Running grimblsat with freeze option doesn't freeze screen contents

How to reproduce

Run some video on youtube, then run grimblast copy area --freeze in terminal and see that video still runs, while taking a screenshot

Hyprland crash reports, program logs, images, videos

No response

fufexan commented 2 months ago

Does grimblast check say you're missing anything?

Gigas002 commented 2 months ago

I was missing hyprpicker, but after installing it nothing changed

╰─ grimblast check
Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH...
   grim: OK
   slurp: OK
   hyprctl: OK
   hyprpicker: OK
   wl-copy: OK
   jq: OK
   notify-send: OK
fahimscirex commented 2 months ago

Can confirm it doesn't work for me.

➜  ~ grimblast check
Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH...
   grim: OK
   slurp: OK
   hyprctl: OK
   wl-copy: OK
   jq: OK
   notify-send: OK
fufexan commented 2 months ago

Can you try hyprpicker -r and see whether that freezes your screen?

fahimscirex commented 2 months ago

yes it does.

fufexan commented 2 months ago

@fahimscirex how old is your grimblast? I don't see any mention of hyprpicker in the grimblast check output.

fahimscirex commented 2 months ago

grimblast-git r108.1e531dc-1 the latest source I guess, I don't know why hyprpicker isn't showing but it's indeed installed.

fahimscirex commented 2 months ago

i think this isn't the latest one, just tried directly from the source and it works.

edit: just found out i had an older version saved in $PATH, which was being used instead the packaged one.

fufexan commented 2 months ago

Yeah that's what I suspected.

LRitzdorf commented 2 months ago

Just encountered this as well, and my check output did include hyprpicker. Solved by rebuilding/reinstalling the AUR package.

Gigas002 commented 2 months ago

hyprpicker -r freezes the screen for me, but yet again, grimblast copy area --freeze doesn't. Tried reinstalling the hyprutils-git, hyprpicker-git and grimblast-git packages, no difference

fufexan commented 2 months ago

@Gigas002 can you add set -xeuo pipefail at the top of the script? Maybe the output can help us debug.

Gigas002 commented 2 months ago
 ./grimblast copy area --freeze
+ grimblastInstanceCheck=/run/user/1000/grimblast.lock
+ '[' -e /run/user/1000/grimblast.lock ']'
+ touch /run/user/1000/grimblast.lock
+ trap 'rm -f '\''/run/user/1000/grimblast.lock'\''' EXIT
+ NOTIFY=no
+ CURSOR=
+ FREEZE=
+ WAIT=no
+ SCALE=
+ HYPRPICKER_PID=-1
+ '[' 3 -gt 0 ']'
+ key=copy
+ case $key in
+ break
+ ACTION=copy
+ SUBJECT=area
+ FILE=--freeze
+ FILE_EDITOR=--freeze
+ '[' copy '!=' save ']'
+ '[' copy '!=' copy ']'
+ '[' copy = check ']'
+ '[' area = active ']'
+ '[' area = screen ']'
+ '[' area = output ']'
+ '[' area = area ']'
+ '[' '' = yes ']'
++ hyprctl -j animations
++ jq -jr '.[0][] | select(.name == "fadeLayers") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", .bezier'
+ FADELAYERS=fadeLayers,0,1,
+ hyprctl keyword animation fadeLayers,0,1,default
++ hyprctl monitors -j
++ jq -r '[(foreach .[] as $monitor (0; if $monitor.specialWorkspace.name == "" then $monitor.activeWorkspace else $monitor.specialWorkspace end)).id]'
+ WORKSPACES='[
  1
]'
++ hyprctl clients -j
++ jq -r --argjson workspaces '[
  1
]' 'map(select([.workspace.id] | inside($workspaces)))'
+ WINDOWS='[
  {
    "address": "0x62a3c2706da0",
    "mapped": true,
    "hidden": false,
    "at": [
      1235,
      44
    ],
    "size": [
      667,
      525
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "org.telegram.desktop",
    "title": "Telegram",
    "initialClass": "org.telegram.desktop",
    "initialTitle": "Telegram",
    "pid": 1607,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 4
  },
  {
    "address": "0x62a3c27c4a00",
    "mapped": true,
    "hidden": false,
    "at": [
      517,
      159
    ],
    "size": [
      904,
      825
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "org.kde.dolphin",
    "title": "downloads — Dolphin",
    "initialClass": "org.kde.dolphin",
    "initialTitle": "downloads — Dolphin",
    "pid": 8609,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 3
  },
  {
    "address": "0x62a3c275d780",
    "mapped": true,
    "hidden": false,
    "at": [
      487,
      27
    ],
    "size": [
      945,
      1025
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "org.kde.dolphin",
    "title": "downloads — Dolphin",
    "initialClass": "org.kde.dolphin",
    "initialTitle": "downloads — Dolphin",
    "pid": 8902,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 2
  },
  {
    "address": "0x62a3c2726870",
    "mapped": true,
    "hidden": false,
    "at": [
      15,
      46
    ],
    "size": [
      1599,
      1003
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "firefox",
    "title": "ChatGPT — Mozilla Firefox",
    "initialClass": "firefox",
    "initialTitle": "Mozilla Firefox",
    "pid": 1680,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 1
  },
  {
    "address": "0x62a3c275c4c0",
    "mapped": true,
    "hidden": false,
    "at": [
      1078,
      413
    ],
    "size": [
      800,
      600
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "Alacritty",
    "title": "./grimblast copy area --freeze",
    "initialClass": "Alacritty",
    "initialTitle": "Alacritty",
    "pid": 7510,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 0
  }
]'
++ echo '[
  {
    "address": "0x62a3c2706da0",
    "mapped": true,
    "hidden": false,
    "at": [
      1235,
      44
    ],
    "size": [
      667,
      525
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "org.telegram.desktop",
    "title": "Telegram",
    "initialClass": "org.telegram.desktop",
    "initialTitle": "Telegram",
    "pid": 1607,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 4
  },
  {
    "address": "0x62a3c27c4a00",
    "mapped": true,
    "hidden": false,
    "at": [
      517,
      159
    ],
    "size": [
      904,
      825
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "org.kde.dolphin",
    "title": "downloads — Dolphin",
    "initialClass": "org.kde.dolphin",
    "initialTitle": "downloads — Dolphin",
    "pid": 8609,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 3
  },
  {
    "address": "0x62a3c275d780",
    "mapped": true,
    "hidden": false,
    "at": [
      487,
      27
    ],
    "size": [
      945,
      1025
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "org.kde.dolphin",
    "title": "downloads — Dolphin",
    "initialClass": "org.kde.dolphin",
    "initialTitle": "downloads — Dolphin",
    "pid": 8902,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 2
  },
  {
    "address": "0x62a3c2726870",
    "mapped": true,
    "hidden": false,
    "at": [
      15,
      46
    ],
    "size": [
      1599,
      1003
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "firefox",
    "title": "ChatGPT — Mozilla Firefox",
    "initialClass": "firefox",
    "initialTitle": "Mozilla Firefox",
    "pid": 1680,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 1
  },
  {
    "address": "0x62a3c275c4c0",
    "mapped": true,
    "hidden": false,
    "at": [
      1078,
      413
    ],
    "size": [
      800,
      600
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": true,
    "pseudo": false,
    "monitor": 0,
    "class": "Alacritty",
++ jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"'
    "title": "./grimblast copy area --freeze",
    "initialClass": "Alacritty",
    "initialTitle": "Alacritty",
    "pid": 7510,
    "xwayland": false,
    "pinned": false,
    "fullscreen": 0,
    "fullscreenClient": 0,
    "grouped": [],
    "tags": [],
    "swallowing": "0x0",
    "focusHistoryID": 0
  }
]'
./grimblast: line 240: SLURP_ARGS: unbound variable
+ GEOM=
+ rm -f /run/user/1000/grimblast.lock

Looking at:

+ FREEZE=
+ FILE=--freeze
+ FILE_EDITOR=--freeze

Gives me an impression argument wasn't read correctly here?

fufexan commented 2 months ago

@Gigas002 arguments' order matters. Run ./grimblast --freeze copy area and it should work.

Gigas002 commented 2 months ago

yep, works this way :)