3

I want to modify my conky placement depending on whether I'm working with my laptop in my lap (one screen) or have it at my desk attached to a larger monitor (dual display).

The problem is that I want it to appear on the bottom left of my laptop screen no matter what. But with my dual display setup, the "bottom left" happens to be on my external monitor.

It seems like there are two solutions:

  • Add an if/else statement to the script I use to launch conky (conky.sh) that launches a different config file depending on my display arrangement.

  • Add an if/else statement to my conky config that sets either the alignment or an indentation value depending on the display arrangement.

(And yes, I realize that at least the shell version only works if I've got things plugged/unplugged when I launch conky. I can live with that.

But ... I don't even know how to detect a dual display or a second monitor in bash or conky.

  • Did you ever get this working? If so, can you share your conky config? – crypdick Nov 12 '17 at 17:19
3

Nathan's suggestion above will give the same result under all circumstances as the xrandr command gives information about all display outputs (connected/disconnected).

This code will work:

$ xrandr | grep -sw 'connected' | wc -l

Note: Not my idea. I just merged Nathan's suggestion and this.

| improve this answer | |
  • In this case, you don't need the -s flag (or the single quotes). – Anthony Geoghegan Oct 27 '16 at 8:54
1

You can use xrandr and grep to detect the connected monitors. Then use wc -l to count the number of lines returned.

Try this in the terminal:

xrandr | grep connected | wc -l
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.