Random Questions

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
facade47

Random Questions

Post by facade47 »

Ok, here's a couple of odd questions I've been wanting to ask for a while :P

1) Is it possible, through the command line, to send a key action? Like, if I for some reason wanted to tell the computer to do the action resulting from the keystrokes Super+C (which on my computer would pause/play the current song in amarok) ...

2) is there a way to tell the compiler (or the configure script) to use dev tools in a special folder whenever possible? For instance, I have a folder $HOME/dev and inside that folder I the folders bin, usr/bin, etc., could I tell the program to compile with its dependencies which are found in that folder? The reason I ask this is because I'm assuming that the compiled program will look for those dependency binaries in that folder, which is exactly what I want.

I hope my wording isn't too confusing :?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Boo
Level 7
Level 7
Posts: 1633
Joined: Mon Mar 26, 2007 7:48 am

Post by Boo »

1) in the old /etc/inittab file you capture the ctl-alt-delete key sequence to give the system the shutdown command. this can be very dangerous and is the first thing you comment out on a server.
so you could put a key capture in there but the new boot stuff uses upstart and the rules/files/events are in /etc/event.d/.
you can create a new inittab file and it will be used but you are better off putting it in the appropriate file in /etc/event.d/.
there is a file in there called control-alt-delete so you could create your own.

2) you could modify the configure script to point to your areas directly. some path reordering may work but not if the configure script has hard coded paths to files.

:D
Image
Now where was i going? Oh yes, crazy!
facade47

Post by facade47 »

Thanks for the reply, Boo =)

Unfortunately, your suggestion for (1) will not work because, looking into the file control-alt-delete, it looks like it basically says (on this keystroke){do this action}, which I can't do because I won't know what action is bound to the specific keystroke...

I haven't had a chance to try out your suggestion to #2 yet..
facade47

Post by facade47 »

I found the answer to my first question, but it uses java instead of bash..

Code: Select all

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;

class Main {
	public static void main( String [] args ) throws AWTException {
		Robot robot = new Robot();
		robot.keyPress(KeyEvent.VK_J);
		robot.keyRelease(KeyEvent.VK_J);
	}
}
This presses the "j" key.... now all I have to do is figure out how to set the focus to an external program :roll:
Locked

Return to “Beginner Questions”