LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 02-05-2021, 12:23 AM   #1
shachter
Member
 
Registered: Jul 2007
Posts: 101

Rep: Reputation: 2
How Do I Draw To Part Of The Root Window, Leaving The Rest Of It Unchanged?


Esteemed Colleagues:

How do I draw an image to part of the root window, leaving the rest of the root window unchanged? Yes, I know I could write a program that does that, but there should be an existing program capable of doing it.

The scenario is a computer connected to two monitors, and xrandr has placed one to the right of the other. In the general case the two monitors will have different sizes, let us say $H1 and $W1 are the dimensions of the first monitor, and $H2 and $W2 are the dimensions of the second monitor. I want to draw an image to the 2nd monitor's root window without changing the 1st monitor's root window. The command

display -window root -geometry +${W1}+0 -resize ${W2}x${H2} bg.png

will draw the image onto the 2nd monitor's root window, but it will replace the 1st monitor's root window with solid black. I want to leave the 1st monitor's root window unchanged. The solution does not have to use the display program; it can be xsetroot or xv or any standard program. I would also be satisfied with a Perl/Tk script.
Thank you in advance for any and all replies.

Jay F. Shachter

jay at m5 dot chicago dot il dot us
 
Old 02-05-2021, 06:04 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,453

Rep: Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342Reputation: 2342
I'd go at replicating what occurs when you pick a window by it's title bar with a mouse and move it left/right. From the software perspective, left and right are one big virtual screen.

I thought a lot of that zooming/replicating/resizing stuff was handled in the GPU.
 
Old 02-06-2021, 02:11 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by shachter View Post
How do I draw an image to part of the root window, leaving the rest of the root window unchanged? Yes, I know I could write a program that does that, but there should be an existing program capable of doing it.

The scenario is a computer connected to two monitors, and xrandr has placed one to the right of the other. In the general case the two monitors will have different sizes, let us say $H1 and $W1 are the dimensions of the first monitor, and $H2 and $W2 are the dimensions of the second monitor. I want to draw an image to the 2nd monitor's root window without changing the 1st monitor's root window. The command

display -window root -geometry +${W1}+0 -resize ${W2}x${H2} bg.png

will draw the image onto the 2nd monitor's root window, but it will replace the 1st monitor's root window with solid black. I want to leave the 1st monitor's root window unchanged. The solution does not have to use the display program; it can be xsetroot or xv or any standard program. I would also be satisfied with a Perl/Tk script.
Thank you in advance for any and all replies.
Some *setroot programs used to be able to do sth like that. imlibsetroot iirc, maybe also hsetroot or 'setroot'.
Or conky.
 
Old 02-06-2021, 11:45 PM   #4
shachter
Member
 
Registered: Jul 2007
Posts: 101

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by ondoho View Post
Some *setroot programs used to be able to do sth like that. imlibsetroot iirc, maybe also hsetroot or 'setroot'.
Or conky.
The setroot program comes closest to what I asked for -- thank you for telling me about it -- but it does not do quite what I asked for (unless it can be done with some undocumented or poorly documented feature). The setroot command can be used to draw an image onto the first monitor's background, and to simultaneously draw a different image onto the second monitor's background, and it works well even when the two monitors have different sizes, and different aspect ratios. But if you try to set the background of only one of the monitors, the other monitor's background turns to solid black. I still do not see a way of changing one monitor's background, while leaving the other monitor unaffected.
 
Old 02-07-2021, 01:15 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by shachter View Post
But if you try to set the background of only one of the monitors, the other monitor's background turns to solid black. I still do not see a way of changing one monitor's background, while leaving the other monitor unaffected.
I thought about this after I posted.
All the setroots will have this drawback afaics; you will have to tell it to redraw both screens even when changing only one.
Conky can do exactly what you want but I'd consider it extremely hackish in this situation. It is good though for drawing logos on your background etc.

For now, I'll leave you with this search query.
 
Old 02-07-2021, 11:02 AM   #6
shachter
Member
 
Registered: Jul 2007
Posts: 101

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by ondoho View Post
Conky can do exactly what you want ...
I downloaded, built and installed conky.

1. It seems that you cannot get conky to draw on the root window. When it detects that it is being asked to draw on a root window, it creates another window -- above the root window, although below all the other windows -- on which to draw. It is able to get the window manager (if there is a window manager running) to leave this window undecorated, so it looks like it is drawing on the root window. My reason for thinking that it is actually drawing on its own window -- even when I explicitly set "own_window" to "false" in the conky configuration file -- is that when conky exits, this window disappears, and the former contents of the root window reappear. So I would have to keep conky running indefinitely; I cannot ask it to draw on the root window, and then exit. Okay, I can live with that. I am not happy about it, but I can live with it. However,

2. The program is (please forgive me for saying this) poorly documented, and amazingly complex. Scanning the documentation quickly, or even slowly, does not inform me of any way I can use this program to draw an image on a window. I think it would take me about a month to become proficient in this program, if all I have are the documentation and my own resources. I hate saying this, because I hate when other people say this, but, even though this program is documented, or purports to be documented, I could use some help from someone who is already proficient in its use. If I have $H1 and $W1 as the height and width of the first monitor (I don't think I need $H1) and $H2 and $W2 as the height and width of the second monitor, and bg.png as the name of the image file that I want to draw on the second monitor's background, without changing the first monitor's background, how do I use conky to do this? Thank you in advance for any and all replies.
 
Old 02-08-2021, 05:25 AM   #7
shachter
Member
 
Registered: Jul 2007
Posts: 101

Original Poster
Rep: Reputation: 2
After re-reading the conky documentation one more time, and seeing the "image" command which somehow I had failed to see before, I figured out how to do it with conky (make sure "own_window" is set to "false" in the configuration file):

conky -t "\${image bg.png -p $W1,0 -s ${W2}x$H2}" -a tl -x0 -y0

Thank you for your help, I shall now mark this thread as "solved".
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Creating Servers via REST API on RDO Mitaka via Chrome Advanced REST Client LXer Syndicated Linux News 0 04-24-2016 11:57 PM
help with cut command using find. Cut last 8 characters leaving the rest ncsuapex Programming 4 09-16-2009 08:55 PM
lm-sensors unchanged values ndm Linux - Laptop and Netbook 1 02-25-2004 06:44 AM
Need serious help in vi (Red Hat 9, unchanged kernel) Echs Bochs Linux - General 8 01-23-2004 03:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 03:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration