You are not logged in.

#1 2012-03-15 17:59:37

anti-destin
Member
Registered: 2009-02-14
Posts: 234

[solved] script/keybinding to launch terminal and run command

the answer is probably simple. but here's the idea.

i use cmus as my music player. at the moment, i have to open a terminal and then type 'cmus'. i'd like to set up a keybinding to run cmus. (incidentally, i'm trying to do this in i3.)

the code

exec cmus

doesn't work, presumably because 'cmus' has to be loaded from within the terminal. (is that right?) what's the syntax for passing on the command 'cmus' to the terminal? what's the best way to do this?

Last edited by anti-destin (2012-03-15 23:52:40)

Offline

#2 2012-03-15 18:11:31

wolfcore
Member
From: California
Registered: 2012-03-06
Posts: 137

Re: [solved] script/keybinding to launch terminal and run command

Try XBindKeys.

Edit: modifying a simple example from the wiki page:

"cmus"
    m:0x8 + c:32
    Alt + o

Alternatively, consider using dmenu to launch applications, although it might take more than a couple keystrokes smile

Last edited by wolfcore (2012-03-15 18:16:19)

Offline

#3 2012-03-15 18:11:58

ernibert
Member
Registered: 2012-03-09
Posts: 13

Re: [solved] script/keybinding to launch terminal and run command

at least,  starting a terminal and executing a command  works with

  xterm -e <command>

so in your example it should read

  xterm -e cmus

Simply add the parameters behin the command as you usually do.

--
Thomas

Offline

#4 2012-03-15 19:14:21

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: [solved] script/keybinding to launch terminal and run command

bindsym mod+c exec urxvtc -name cmus -e cmus

urxvtc => Your terminal here if you use something else. Most support -name and -e. Please read their man pages.
-name => Useful for xprop. It assigns the WM_CLASS which can be used for tagging clients.

man urxvt

-e command [arguments]
	   Run the command with its command-line arguments in the urxvt
	   window; also sets the window title and icon name to be the basename
	   of the program being executed if neither -title (-T) nor -n are
	   given on the command line. If this option is used, it must be the
	   last on the command-line. If there is no -e option then the default
	   is to run the program specified by the SHELL environment variable
	   or, failing that, sh(1).

Last edited by Earnestly (2012-03-15 19:19:25)

Offline

#5 2012-03-15 23:52:28

anti-destin
Member
Registered: 2009-02-14
Posts: 234

Re: [solved] script/keybinding to launch terminal and run command

thanks for the suggestions, everyone. the '-e' switch worked. i don't know how i missed that.

Offline

Board footer

Powered by FluxBB