You are not logged in.

#1 2020-04-13 12:16:16

lonlon
Member
Registered: 2019-09-07
Posts: 23

[SOLVED] Script does not get executed via i3 key binding

Hello there,
I am having troubles getting my simple screenshot script to run via key binding.

What does work: running the script directly in my terminal (urxvt) with the command

prntScrn

What does not work: running the script via my key binding

$mod+Print

I am certain that the key binding would work, as I can run different scripts via this binding.

Here is what I have in my i3 config

bindsym $mod+Print exec --no-startup-id $HOME/.scripts/prntScrn 

Here is my screenshot script (prntScrn) that does not get executed that way

#!/bin/bash

magick import ~/Screenshots/$(date +%F_%H%M%S_%N).png

Here is my wallpaper script as an example of a script (setWallpaper), that does get executed that way

#!/bin/bash

feh --bg-fill ~/Wallpapers/Minimal/vapor.jpg

Last edited by lonlon (2020-04-13 13:22:23)

Offline

#2 2020-04-13 12:52:47

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,860

Re: [SOLVED] Script does not get executed via i3 key binding

Screenshot tools will try to grab the server and / or inpt devices which is going to fail because i3 has an active grab for the shortcut invocation. Yaddayaddayadda: prepend a brief "sleep 0.5" or so in your script to allow yourself to release the key before the grabber actually executes.

Offline

#3 2020-04-13 13:25:21

lonlon
Member
Registered: 2019-09-07
Posts: 23

Re: [SOLVED] Script does not get executed via i3 key binding

Perfect, and thank you for the brief explanation.

Offline

Board footer

Powered by FluxBB