![]() # if so, see if the active window belongs to gnome-terminal comparing pids)Īctive = get()])Ĭm1 = Ĭm2 = Ĭreate a dirctory ~/bin if it doesn't exist yet, either log out out/in or run source ~/. # see if gnome-terminal is running at all (raising error if not) Return subprocess.check_output(cmd).decode("utf-8").strip() Since the script takes the targeted command as an argument, you can put multiple commands under multiple shortcuts. If not, the script does nothing, So it won't paste into other applications. if so, it pastes the command in the active gnome-terminal window, presses Return.looks if the active window is a gnome-terminal window (by its pid).This would however type the command blindly, in any application, and typing the command is not the cleanest option. Of course you could place a simple one-liner under a shortcut key (assuming you have xdotool installed): xdotool type "" Running a command in the currently active gnome-terminal window So these were four ways for you to open the Terminal application on your Debian system. The Terminal will appear every time you do so. This way, you can run any (complex) command in the terminal, without having it closed immediately: $ gnome-terminal -e 'bash -c "wmctrl -d read line"'Īfter pressing Enter the terminal will close. In the Keyboard Shortcuts list, you will be able to see the newly set shortcut in the Custom Shortcuts column as follows: Try this shortcut by pressing Ctrl+Alt+T. Is then to keep the terminal open (until you hit Enter) after the command runs. However, although the command will run successfully, the terminal window will close immediately before you can read the output. To have a new gnome-terminal window opened from command line, and run a command in it, you can use: gnome-terminal -e 'bash -c ' Click the "+" and add the command: gnome-terminal -e 'bash -c "git status read line"'Īlthough your suggested shortcut works, you might pick another key combination then Ctrl+ Enter, since it at least clashes with the LibreOffice shortcut to jump to a new page. Add it to a shortcutĬhoose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". It will open a new gnome-terminal window and run the command inside it. Step 1: Along with your other installed programs, the Terminal application is also there. The GNOME Terminal window will immediately appear. Under a shortcut key combination, will do the job. Step 1: Pressing Ctrl+Alt+T will instantly launch a Terminal window at any moment. Since you need to keep the terminal open after the command ran, putting: gnome-terminal -e 'bash -c "git status read line"' Automatically open a new terminal window, showing the output of your command
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |