You are not logged in.
I have a question about xbindkeys. Recently, I made a script to run maim from my shell using the Awesome window manager (For X). I have been wondering if it was possible to use this program to bind this shell script to a specific key so that whenever I press it, it will launch it and I can use the prntscrn button to take a snippet of my screen selection.
My script is very, very simple, but I do not quite understand how I can integrate this into xbindkeys. Is it even possible? My only questioning behind this is because that awhile back, I asked how to bind my volume control key on my mouse to this program in a similar manner.
#!/bin/sh
maim -so ~/Pictures/$(date +%s).jpg
So I want to bind this to that button so that whenever I press meta + r, prntscreen launches the my shell script. For some reason, whenever I run this command directly from awesome, I get the selection box, but it doesn't save anything to the output location.
Last edited by scatherinch (2023-10-21 22:39:53)
Offline
Yes you can, like any other command.
A common pitfall w/ screenshot tools (and screenlocker) is that they'll often try to grab server and/or input what fails if there's an active shortcut.
A simple workaround that is to briefly "sleep 0.25" to give yourself the chance to release the key that triggers the shortcut before the tool is actually started.
Offline
Ah, alright. That's good to know!!
In that case,
Here's what I got so far in my .xbindkeysrc file thus far.
# Increase volume
"pactl set-sink-volume @DEFAULT_SINK@ +1%"
XF86AudioRaiseVolume
# Decrease volume
"pactl set-sink-volume @DEFAULT_SINK@ -1%"
XF86AudioLowerVolume
How would I go about bindings this key with that maim command? I got this from that xbindkeys, it's the code for that key
I'm getting
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"(Scheme function)"
m:0x10 + c:107
Mod2 + Print
What should I add to to this file get this to activate that maim command?
Last edited by scatherinch (2023-10-21 19:29:51)
Offline
Exactly what xbindkeys tells you - or you adapt the pattern that's already there.
What exactly have you tried that didn't work?
Offline
I haven't tried anything yet. I was just asking how I could put this maim command ( maim -so ~/Pictures/$(date +%s).jpg ) from a shell script I have on my PC and bind it into xbindkeys, so that when I hit prntscrn, it runs the command from a shell script I made in my home directory. I do not know what to put into .xbindkeyssrc that would point to such a thing to have the command run when I press prntscrn.
My shell script:
maimss.sh
#!/bin/sh
maim -so ~/Pictures/$(date +%s).jpg
Offline
You could also put the maimss.sh there.
If you had to guess, what do you think the entry in .xbindkeysrc should look like?
Offline
You're right! Hey, thank you!!! The answer was right in front of me!!!
#Maim Shell Script
"maim -so ~/Pictures/$(date +%s).jpg"
Mod2 + Print
Offline
\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline