is there a way to focus an image displayed by conky so it appears on top of all other windows? [SOLVED]
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
is there a way to focus an image displayed by conky so it appears on top of all other windows? [SOLVED]
Hello,
The title says it all.
The title says it all.
Last edited by Logansfury on Tue Jan 30, 2024 8:44 am, edited 1 time in total.
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Yes there is!
Needs to be dock
and
needs above
And now your conky windows sticks out on top of all..
And you can still click on things below it!
Needs to be dock
own_window_type = 'dock',
and
needs above
own_window_hints = 'skip_taskbar,skip_pager,undecorated,above',
And now your conky windows sticks out on top of all..
And you can still click on things below it!
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Far out! do I put that code into the conkyrc or the pic.lua?Koentje wrote: ⤴Mon Jan 29, 2024 10:27 pm Yes there is!
Needs to be dock
own_window_type = 'dock',
and
needs above
own_window_hints = 'skip_taskbar,skip_pager,undecorated,above',
And now your conky windows sticks out on top of all..
Schermafdruk van 2024-01-30 03-27-53.jpg
And you can still click on thing below it!
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
found the own_window = desktop and changed that to dock and added the second line underneath but when I closed and relaunched the picture it wasnt top focus it was buried behind a webbrowser window
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Paste your current conky script.. there must be something wrong, because that calendar i screenshotted, was above all my open windows!
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Here ya go!
conkyrc:
Code: Select all
--[[
Bleys 2024
]]
conky.config = {
-- — Conky settings
background = false,
update_interval = 1,
total_run_times = 0,
no_buffers = true,
-- — Window specifications with Background
own_window = true,
own_window_type = dock,
own_window_hints = 'skip_taskbar,skip_pager,undecorated,above',
own_window_transparent = false,
own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_colour = '000000',
double_buffer = true,
minimum_width = 300, minimum_height = 263,
alignment = 'middle_middle',
gap_x = 20,
gap_y = 20,
-- Lua Load
lua_load = '/home/logansfury/.conky/Biohazzard_sm/pic.lua',
lua_draw_hook_post = 'main',
};
conky.text = [[
]];
Code: Select all
--[[
2024 Bleys
]]
require 'cairo'
require "imlib2"
home_path = os.getenv ('HOME')
function fDrawImage(cr,path,xx,yy,ww,hh,arc)
cairo_save (cr)
local img = cairo_image_surface_create_from_png(path)
local w_img, h_img = cairo_image_surface_get_width(img), cairo_image_surface_get_height(img)
cairo_translate (cr, xx, yy)
if arc then
cairo_rotate (cr, arc)
end
cairo_scale (cr, ww/w_img, hh/h_img)
cairo_set_source_surface (cr, img, -w_img/2, -h_img/2)
cairo_paint (cr)
cairo_surface_destroy (img)
collectgarbage ()
cairo_restore (cr)
end
function conky_main()
if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
local cr=cairo_create(cs)
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num>4 then
fDrawImage(cr,'/home/logansfury/Pictures/bio_sm.png',150,132,300,263)
end
cairo_surface_destroy(cs)
cairo_destroy(cr)
end
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
AHA!!
Its this isnt it?
own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
deleting that line now, stand by...
Its this isnt it?
own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
deleting that line now, stand by...
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
WOOOHOO that did it!Logansfury wrote: ⤴Mon Jan 29, 2024 10:46 pm AHA!!
Its this isnt it?
own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
deleting that line now, stand by...
my image is now top focus
Thank you so much!
Last edited by Logansfury on Mon Jan 29, 2024 11:23 pm, edited 1 time in total.
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Another satisfied customer! (well.. i got only one customer )
Last edited by Koentje on Mon Jan 29, 2024 10:58 pm, edited 1 time in total.
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
It says the thing..Logansfury wrote: ⤴Mon Jan 29, 2024 10:46 pm own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
You're gonna want this stuff, obviously you haven't seen it.
and right on the same wiki page, you need those:
https://github.com/brndnmtthws/conky/wi ... s#settings
https://github.com/brndnmtthws/conky/wi ... #variables
you do
man conky > conky-manual
and you have it as a text file into the current directory, open right up with text editor, also searchable easily, open that and ctrl+f
and type own_window
.- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Guilty as charged. I haven't cracked open any manuals yet, I figured it would be over my head.
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
I got my routine to kill the image after I take the garbage out.
5 mins after the biohazzard pic and the mp3 announcing garbage time launch, a second .sh script launches:
clickbox.sh
this creates a box around the biohazzard image, and waits for the mouse to enter the box. Once mouse enters the box another script is activated:
close_bio.sh
I have tried to get a script out of chatgpt3.5 that waits for a mouse click instead of a mouse-over but it's not capable of scripting it.
5 mins after the biohazzard pic and the mp3 announcing garbage time launch, a second .sh script launches:
clickbox.sh
Code: Select all
#!/bin/bash
# Define the coordinates of the clickable box
box_x=780
box_y=385
box_width=300
box_height=260
# Function to check if the mouse is inside the box
mouse_inside_box() {
mouse_x=$(xdotool getmouselocation --shell | grep 'X' | awk -F'=' '{print $2}')
mouse_y=$(xdotool getmouselocation --shell | grep 'Y' | awk -F'=' '{print $2}')
if [ "$mouse_x" -ge "$box_x" ] && [ "$mouse_x" -le "$((box_x + box_width))" ] && \
[ "$mouse_y" -ge "$box_y" ] && [ "$mouse_y" -le "$((box_y + box_height))" ]; then
return 0 # Mouse is inside the box
else
return 1 # Mouse is outside the box
fi
}
# Wait for a mouse click event within the specified box
while true; do
if mouse_inside_box && xdotool click 1; then
# Run your script after a mouse click
/home/logansfury/xdotool/stop_bio.sh
break # Exit the loop after the script is executed
fi
sleep 0.1 # Adjust the sleep duration as needed
done
close_bio.sh
Code: Select all
pkill -f "conky -c /home/logansfury/.conky/Biohazzard/conkyrc"
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Why the second script?? That one line could also be done in the first script..
I see in your first script stop_bio.sh and your second scriptname is close_bio.sh... is that a typo or are those 2 different scripts?
If it's a typo and they are the same, then replace that line with the line of your second script!
I see in your first script stop_bio.sh and your second scriptname is close_bio.sh... is that a typo or are those 2 different scripts?
If it's a typo and they are the same, then replace that line with the line of your second script!
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Good catch, yes I did make a typo and the script is actually named stop_bio.shKoentje wrote: ⤴Tue Jan 30, 2024 12:15 am Why the second script?? That one line could also be done in the first script..
I see in your first script stop_bio.sh and your second scriptname is close_bio.sh... is that a typo or are those 2 different scripts?
If it's a typo and they are the same, then replace that line with the line of your second script!
I had an existing .sh named beep.sh that does what you would expect. I started on chatgpt with the clickbox activating the beep.sh for quick confirmation that mouseovers were being registered. I then edited the script called by the mouseover from beep.sh to stop_bio.sh.
I just left it in the state of one script calling another when I was done with beep.sh
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
And what if you move the conky window? Then your box doesn't fit the conky window anymore...
Why not use the conky
So instead of
Use this
Why not use the conky
gap_x, gap_y, minimum_width, minimum_height
of your conky config?So instead of
Code: Select all
box_x=780
box_y=385
box_width=300
box_height=260
Code: Select all
conkyconf="/home/logansfury/.conky/Biohazzard/conkyrc"
box_x=$(cat "$conkyconf" | grep gap_x | awk -F'=' '{print $2}'); box_x=${box_x:1:-1}
box_y=$(cat "$conkyconf" | grep gap_y | awk -F'=' '{print $2}'); box_y=${box_y:1:-1}
box_width=$(cat "$conkyconf" | grep minimum_width | awk -F'=' '{print $2}'); box_width=${box_width:1:-1}
box_height=$(cat "$conkyconf" | grep minimum_height | awk -F'=' '{print $2}'); box_height=${box_height:1:-1}
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
If it is just one line, then it's better to put it in the first script, or else you loose track of scripts!Logansfury wrote: ⤴Tue Jan 30, 2024 12:23 am I just left it in the state of one script calling another when I was done with beep.sh
When the second script is a whole other story, then maybe keep it seperate. But i kind of keep the same topic in one script, unless it can't be this way. Like the server script in my inxi-report. It has a loop after starting the server that i can't build in the inxi-report script, that's why it is seperated...
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
I see your logic. I can most likely do a combining of the scipts, I just have to edit part of my crontab if I do to keep things operating.Koentje wrote: ⤴Tue Jan 30, 2024 12:30 amIf it is just one line, then it's better to put it in the first script, or else you loose track of scripts!Logansfury wrote: ⤴Tue Jan 30, 2024 12:23 am I just left it in the state of one script calling another when I was done with beep.sh
When the second script is a whole other story, then maybe keep it seperate. But i kind of keep the same topic in one script, unless it can't be this way. Like the server script in my inxi-report. It has a loop after starting the server that i can't build in the inxi-report script, that's why it is seperated...
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
This looks very cool! The bot spat out the existing code for I dont know what reason but the box it defines surrounds the bio image on screen perfectly and there is nothing that should make the image change position. The script isn't dependent on the conky manager 2 gui window being open.Koentje wrote: ⤴Tue Jan 30, 2024 12:26 am And what if you move the conky window? Then your box doesn't fit the conky window anymore...
Why not use the conkygap_x, gap_y, minimum_width, minimum_height
of your conky config?
So instead ofUse thisCode: Select all
box_x=780 box_y=385 box_width=300 box_height=260
Code: Select all
conkyconf="/home/logansfury/.conky/Biohazzard/conkyrc" box_x=$(cat "$conkyconf" | grep gap_x | awk -F'=' '{print $2}'); box_x=${box_x:1:-1} box_y=$(cat "$conkyconf" | grep gap_y | awk -F'=' '{print $2}'); box_y=${box_y:1:-1} box_width=$(cat "$conkyconf" | grep minimum_width | awk -F'=' '{print $2}'); box_width=${box_width:1:-1} box_height=$(cat "$conkyconf" | grep minimum_height | awk -F'=' '{print $2}'); box_height=${box_height:1:-1}
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Why? Just copy the line from stop_bio.sh and place it in the first script where you call stop_bio.sh
What i'm trying to say is when you've long forgotten the scripts and after a year or so you move your bio hazzard window to the other screen or make it smaller or you move it around (as i have done multipledozents of times over the years) you begin to wonder why all of a sudden your perfectly working setup doesn't work anymore... and totally forgotten how, what and where you did who!
You have only a few configs running, so maybe you can remember it all.. i have 57 conky's running and another 50 bash scripts, and 12 lua scripts! Every time i move my scripts around to fit new ones i have to do some serious changes in the scripts to keep it running as is.. and everytime i upgrade them so i have to do less each time i want to move them!
Just my 2 cents...
Keep conky manager 2 and conky windows/scripts/configs seperate! The manager only starts and stops scripts, nothing more. For that matter, you don't even need conky manager to start a conky script, it is just very handy!This looks very cool! The bot spat out the existing code for I dont know what reason but the box it defines surrounds the bio image on screen perfectly and there is nothing that should make the image change position. The script isn't dependent on the conky manager 2 gui window being open.
What i'm trying to say is when you've long forgotten the scripts and after a year or so you move your bio hazzard window to the other screen or make it smaller or you move it around (as i have done multipledozents of times over the years) you begin to wonder why all of a sudden your perfectly working setup doesn't work anymore... and totally forgotten how, what and where you did who!
You have only a few configs running, so maybe you can remember it all.. i have 57 conky's running and another 50 bash scripts, and 12 lua scripts! Every time i move my scripts around to fit new ones i have to do some serious changes in the scripts to keep it running as is.. and everytime i upgrade them so i have to do less each time i want to move them!
Just my 2 cents...
- Logansfury
- Level 6
- Posts: 1237
- Joined: Fri Oct 27, 2023 4:08 pm
- Location: Las Vegas NV, USA
Re: is there a way to focus an image displayed by conky so it appears on top of all other windows?
Sounds like an easy edit.Koentje wrote: ⤴Tue Jan 30, 2024 12:51 am Why? Just copy the line from stop_bio.sh and place it in the first script where you call stop_bio.sh
Keep conky manager 2 and conky windows/scripts/configs seperate! The manager only starts and stops scripts, nothing more. For that matter, you don't even need conky manager to start a conky script, it is just very handy!This looks very cool! The bot spat out the existing code for I dont know what reason but the box it defines surrounds the bio image on screen perfectly and there is nothing that should make the image change position. The script isn't dependent on the conky manager 2 gui window being open.
What i'm trying to say is when you've long forgotten the scripts and after a year or so you move your bio hazzard window to the other screen or make it smaller or you move it around (as i have done multipledozents of times over the years) you begin to wonder why all of a sudden your perfectly working setup doesn't work anymore... and totally forgotten how, what and where you did who!
You have only a few configs running, so maybe you can remember it all.. i have 57 conky's running and another 50 bash scripts, and 12 lua scripts! Every time i move my scripts around to fit new ones i have to do some serious changes in the scripts to keep it running as is.. and everytime i upgrade them so i have to do less each time i want to move them!
Just my 2 cents...
This seems very sound advice, thank you!