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

How to set the urgency hint in a shell

asked 2012-07-04 12:14:08 +0000

Felicitus gravatar image

Michael gives a great talk about i3 on Google Tech Talks and tells about the urgency hint in a shell. However, no information is given how to actually do that - whenever a process is complete, I want to set the urgency hint in that shell, just as shown in the talk.

The time link to the presentation: http://www.youtube.com/watch?v=QnYN2C...

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted
3

answered 2014-04-09 10:56:00 +0000

TonyC gravatar image
  1. Set URxvt.urgentOnBell in your .Xresources file
  2. Start a long-running command
  3. Type ctrl+t
  4. Do something else for awhile...
  5. Urgent!
edit flag offensive delete link more

Comments

1

This only applies to urxvt

Flimm gravatar imageFlimm ( 2014-12-03 00:36:34 +0000 )edit

This also works for xterm, given that you added `XTerm*bellIsUrgent: true` to your `.Xresources`.

onse gravatar imageonse ( 2015-10-15 12:57:08 +0000 )edit
5

answered 2012-07-04 13:02:21 +0000

Felicitus gravatar image

Here's a complete guide:

Setting urgency hints in i3

You need the following settings in your i3 config to have the workspace indicator go red and draw a red border around your windows which have the urgency hint set:

client.urgent #2f343a #900000 #ffffff #900000

bar {
        colors {
                urgent_workspace   #2f343a #900000 #ffffff
        }
}

Setting urgency hints in your terminal emulator

According to kempurpy, only urxvt and terminator support this. As I only use urxvt, I needed to set the following in my Xdefaults:

urxvt*urgentOnBell:       true

Setting urgency hints in your shell

urxvt will now set the urgency hint whenever a bell is encountered; to do that with bash, I simply use the following alias:

alias enable_alert='PS1="$PS1\a"'

I now can make any shell an alerting shell by simply typing "enable_alert".

Putting it all together

  • reload i3 or restart it to have the new configuration active
  • Make sure your .Xdefaults are in place, you can use xrdb to load the new file:

    xrdb ~/.Xdefaults

  • Set PS1 to output the bell

Hint: If you are using debian, and using urxvturgentOnBell in your config as well as x-terminal-emulator (which is called by i3-sensible-terminal) - that won't work. In that case, use x-terminal-emulatorurgentOnBell or *.URxvt.urgentOnBell.

edit flag offensive delete link more

Comments

2

If you add the bell to PS1 it looks like it will raise urgent whenever the terminal is resized (which is annoying with a tiling window manager). I've found that appending it to PROMPT_COMMAND (when using bash) works better.

joek1010 gravatar imagejoek1010 ( 2013-09-27 22:59:13 +0000 )edit
1

answered 2014-12-15 15:23:51 +0000

gauthier gravatar image

updated 2014-12-16 13:17:15 +0000

This is working in my Ubuntu with XMonad, in gnome-terminal, bash:

  1. install xdotool

  2. build seturgent

  3. create ~/bin/pid-urgent, make sure ~/bin is in your $PATH, and make the script executable:

    #!/bin/bash
    # --any and --name present only as a work-around, see: https://github.com/jordansissel/xdotool/issues/14
    ids=$(xdotool search --any --pid "$1" --name "dummy")
    
    for id in $ids; do
        seturgent "$id"
    done
    
  4. Set the the shell variable PROMPT_COMMAND='pid-urgent $PPID' at login. (I would like to be able to set it only for the next prompt, but that will be for another time.)

Support for several bash children to the same terminal is bad. In my setup, there is only one gnome-terminal running, even if I start several terminal windows. Popping up the urgent window goes to the first terminal I opened.

edit flag offensive delete link more

Comments

Step 4 will probably only work if the shell is a `bash`. For `zsh` you'll have to edit the `precmd` hook function, either directly or by using `add-zsh-hook`.

Adaephon gravatar imageAdaephon ( 2014-12-15 20:35:23 +0000 )edit
0

answered 2012-07-04 12:22:21 +0000

Tucos gravatar image

The simplest way is to have the terminal emulator set urgent on bell (how to do so depends on the TE) and then to include a bell character (\a) in your prompt. As the urgency hint is ignored for focused windows, this won't bother you with short processes.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-07-04 12:14:08 +0000

Seen: 4,177 times

Last updated: Dec 16 '14