neXromancers / hacksaw

hacksaw (Select Operation)
Mozilla Public License 2.0
97 stars 7 forks source link

Screen is dim when hacksaw is running #33

Closed HennadiiM closed 4 years ago

HennadiiM commented 4 years ago

I use hacksaw with shotgun:

#!/bin/sh -e

selection=$(hacksaw -g 3 -s 3 -c "#81A1C1" -f "-i %i -g %g")
shotgun $selection - | xclip -t 'image/png' -selection clipboard

But brightness of screenshots much lower then expected. So, is it possible not to dim screen during hacksaw session (like on gif in readme)?

Maintainer edit

In most cases this problem comes from picom's shadow effect. To fix it, you'll either want to disable shadows completely, or tell picom not to draw shadows on your selection tool. For hacksaw, add this snippet to your configuration file:

shadow-exclude = [
  "name = 'hacksaw'"
]
expectocode commented 4 years ago

I don't really have enough information to be sure, but this could be a compositing issue - see https://github.com/neXromancers/shotgun/issues/19

HennadiiM commented 4 years ago

I don't really have enough information to be sure, but this could be a compositing issue - see neXromancers/shotgun#19

Yeah! Thanks for a hint! Really, without picom all works good.

Any ideas, how to remove "dim" effect if I running picom?

I did an attempt to fix situation by adding sleep 0.2 (0.2 s gives the best result for me):

#!/bin/sh -e

selection=$(hacksaw -g 3 -s 3 -c "#81A1C1" -f "-i %i -g %g")
sleep 0.2
shotgun $selection - | xclip -t 'image/png' -selection clipboard

Nevertheless, it's dirty way, as for me

9ary commented 4 years ago

Does hacksaw dim the screen, or is it only the screenshot that comes out too dark? Can you post your picom configuration? Also try with the defaults (no configuration). There's a feature that dims inactive windows, could that be it? https://wiki.archlinux.org/index.php/Picom#slock

HennadiiM commented 4 years ago

Does hacksaw dim the screen, or is it only the screenshot that comes out too dark? Can you post your picom configuration? Also try with the defaults (no configuration). There's a feature that dims inactive windows, could that be it? https://wiki.archlinux.org/index.php/Picom#slock

This fixed the issue for me (in file ~/.config/picom.conf): opacity-rule = [ "100:class_g = 'hacksaw' && focused", ];

Source: https://wiki.archlinux.org/index.php/Picom#Configuration

Thanks for help

9ary commented 4 years ago

I'd still like to see your complete configuration to understand the problem better.

HennadiiM commented 4 years ago

Does hacksaw dim the screen, or is it only the screenshot that comes out too dark? Can you post your picom configuration? Also try with the defaults (no configuration). There's a feature that dims inactive windows, could that be it? https://wiki.archlinux.org/index.php/Picom#slock

And yes, hacksaw dims the screen. This is why sleep 0.2 gives good screenshots (affect from hacksaw died for 0.2 s)

My config in /etc/xdg/picom.conf is standard. In .config/picom.comf just this 3 lines:

opacity-rule = [
"100:class_g = 'hacksaw' && focused",
];
9ary commented 4 years ago

Ok that's interesting, I guess it's a problem with the default config picom ships with then. One last thing then, what if you just leave your config empty?

HennadiiM commented 4 years ago

Ok that's interesting, I guess it's a problem with the default config picom ships with then. One last thing then, what if you just leave your config empty?

All works fine (I removed 3 lines, ~/.config/picom.conf is empty). Lol, fine lesson for me :) What causes the problem, then? I'm interested

9ary commented 4 years ago

I believe what you did is just a no-op config, because all windows should have 100% opacity by default. Something in the example config must be causing the dimming, but having an empty config file makes picom use the default settings instead. I'm going to take a look at that config, and file a bug report over there. This is definitely their fault and not ours. :P

9ary commented 4 years ago

Actually, one more question: are you using the picom package from Arch Linux [community]? It looks like they ship a non-standard config as the default, and install the official sample config to a different path. https://github.com/archlinux/svntogit-community/blob/a41dea56b5b8625e085c4eb7bce11c299d119b2c/trunk/PKGBUILD#L43-L47 https://github.com/archlinux/svntogit-community/blob/packages/picom/trunk/picom.conf

9ary commented 4 years ago

Possibly related: https://bugs.archlinux.org/task/66469, https://github.com/archlinux/svntogit-community/commit/ab51aa47e5a7828d12f50942dc266c5e3da91441.

TheLudd commented 3 years ago

I had the same problem so thanks for pointing me in the right direction. I set the option shadow in the picom file to shadow = false; This removed the dim overlay when using hacksaw.

Barbaross93 commented 3 years ago

Add "class_i = 'hacksaw'" to your shadow-exclude rules.