The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

how do I create an alias in i3?

asked 2014-04-21 21:20:31 +0000

thesoundman20 gravatar image

I have created a shortcut for starting chrome in root. but when i issue a command that opens a browser it gives me the usual "google chrome cannot be run as root". so what im wondering is can i create an alias so that anytime linux tries to run "chrome" it runs my command instead?

edit retag flag offensive close merge delete

Comments

Wait a sec... Running your browser _as_ the user root is a Very Bad Idea. Or do you mean something different with _in_ root?

joepd gravatar imagejoepd ( 2014-04-22 18:13:31 +0000 )edit

What browser is used is not decided by i3. You'll have to look how (and if) a default browser is set for your distribution. Also applications of specific desktop environments (KDE, Gnome, Xfce) will most likely use whatever is set with the respective configuration tool.

Adaephon gravatar imageAdaephon ( 2014-04-23 11:41:32 +0000 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-04-23 14:12:31 +0000

TonyC gravatar image

updated 2014-04-24 22:29:22 +0000

There are two ways to accomplish this.

The first is a shell alias that you can configure from your shell rc file, such as ~/.zshrc or ~/.bashrc which are useful to add default options or shorten commands you commonly use.

alias off="xset dpms force off"
alias xclip="xclip -selection clipboard"
alias dtrx="dtrx --one=here --noninteractive"

For anything more complicated, add a bin directory to your home folder and put it in the front of your PATH. The scripts here will override anything that comes later. Also in your shell rc file:

export PATH=$HOME/bin:$PATH

More info:

intro to zsh aliases

edit flag offensive delete link more
-1

answered 2014-04-23 08:44:18 +0000

thesoundman20 gravatar image

i know that running anything in root is very dangerous, but i am using Kali linux (im an IT student). most of the programs in Kali linux require you to be the root user, so root is the default user that you login to. so having all of that said, and knowing the dangers. Is there a way to create an alias somehow so that when a program calls for the default browser it loads my script not the actual program?? or is there a way to permanently fix chrome to work in root?

edit flag offensive delete link more

Comments

Sorry, if you want to run your browser as root, you are assumed to have some understanding of how stuff works. The fact that you ask this question, and the wording that you choose, seem like you are lacking some of that understanding.

joepd gravatar imagejoepd ( 2014-04-23 10:26:32 +0000 )edit

i know how to run my browser as root. i wrote a script as a "shortcut" so that i could call the script instead of the full command. i can run my browser just fine. my problem is that when an application calls the browser or tries to open the browser as a regular user instead of as root.

thesoundman20 gravatar imagethesoundman20 ( 2014-04-23 10:59:02 +0000 )edit

The format here is like stack overflow. These responses are so called "answers" to the given question and simply saying this is a bad idea is not an answer.

TonyC gravatar imageTonyC ( 2014-04-23 14:03:29 +0000 )edit

Question Tools

Stats

Asked: 2014-04-21 21:20:31 +0000

Seen: 449 times

Last updated: Apr 24 '14