10

How do I put a clock on the desktop background on Ubuntu 19.04 GNOME

Is there maybe an extension that I am not finding?

I have google all I think is relevant.

damadam
  • 2,833
Eirik
  • 277
  • Can you please try the edited code? It should fix the error you saw with own_window_type = 'override',. – DK Bose Dec 14 '19 at 11:03

1 Answers1

11

Install conky by running sudo apt install conky-all

Create the folder conky in ~/.config. Then, in ~/.config/conky, create an empty plain text file called conky.conf.

Open a plain text editor, paste the following content into conky.conf and save the file:

conky.config = {

    background = false,
    update_interval = 1,
    double_buffer = true,
    no_buffers = true,
    text_buffer_size = 2048,
    own_window = true,
    own_window_class = 'conky',
    own_window_argb_visual = true,
    own_window_argb_value = 80,
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
    own_window_colour = '#252525',
    own_window_type = 'desktop',
    background = false,
    minimum_width = 250,
    gap_x = 100,
    gap_y = 200,
    draw_shades = false,
    draw_outline = false,
    draw_borders = false,
    override_utf8_locale = true,
    use_xft = true,
    font = 'Noto:size=8',
    xftalpha = 0.5,
    uppercase = false
};

conky.text = [[
${voffset 5}${offset 15}${font Noto:size=36}${color white}${time %e}
${goto 25}${font Noto:size=18}${color white}${voffset -30}${time %b}${color white}${offset 10}${time %Y}
${font Noto:size=12}${color white}${voffset 5}${goto 20}${time %A}${goto 153}${color white}${time %H}:${time %M}
]];
-- https://store.kde.org/p/1197154/

Open a terminal and run conky -c ~/.config/conky/conky.conf and minimize all your open windows. Somewhere on your screen you'll see the following image:

Clock on desktop


Note that you want to make some changes:

  • modify own_window_colour = '252525' to any other hex color you want. There's no need to include #.
  • gap_x = 100 positions the conky window 100px from the left of the screen. Change as per your needs.
  • gap_y = 200 positions the conky window 200px from the bottom of the screen. Change as per your needs.
  • in the section "conky.txt", you can change the text color to your preference using hex colors as described above or color names as found in /usr/share/X11/rgb.txt.
  • you can play with font and font size, voffset and what you want in terms of time formats (as described in man date).
  • the line own_window_type = 'desktop', helps keep conky visible in Ubuntu 19.10 when minimizing all other open windows (aka Show Desktop) using Ctrl+Meta+D.

Once, you're happy, you can get conky to run on startup by adding it to your distro's autostart.


Credit: code is based on Conky Modern.

DK Bose
  • 42,548
  • 23
  • 127
  • 221
  • 1
    This is super nice, thanks a lot! one problem though. When I use the show desktop key, it also takes away this widget. This is kind of a dealbreaker for me, is there a way to make conky stay? – Eirik Dec 13 '19 at 12:33
  • I think the result may depend on your desktop environment but including own_window_type = 'override', may help. I've edited the code accordingly. If this solves your issue, please click the ✔ near the top left of the answer. – DK Bose Dec 13 '19 at 12:51
  • Got this in return:

    conky: desktop window (800012) is subwindow of root window (140) conky: window type - override conky: drawing to created window (0x4200002) X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 1 (X_CreateWindow) Serial number of failed request: 96 Current serial number in output stream: 100

    – Eirik Dec 13 '19 at 14:06
  • I am using GNOME with Ubuntu 19.04 if that helps in the problemsolving.

    Thanks soo much for your time though <3

    – Eirik Dec 13 '19 at 14:08
  • I use Kubuntu. Are you sure you included the ,? Otherwise, I'm out of ideas. – DK Bose Dec 13 '19 at 14:12
  • Okay, I'm trying with Ubuntu 19.10 (not 19.04). Changing override to desktop seems to work. Try that. – DK Bose Dec 13 '19 at 14:26
  • That did the trick :) superthanks a whole lot! you are fantastic! – Eirik Dec 15 '19 at 15:44