You are not logged in.

#1 2018-09-11 12:12:54

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

bl-conkypin

Following on from @john's post, I had another look at bl-conkypin.

    own_window_type = 'desktop'

allows the Show Desktop keybind to work, without hiding the conky, but then bl-conkypin doesn't work, as we know sad

According to the Conky wiki:

own_window_class 	Manually set the WM_CLASS name. Defaults to "Conky". 

But if this line is left out, Conky actually defaults to using "conky":

 $ obxprop | grep WM_CLASS
WM_CLASS(STRING) = "conky", "conky"

So to use bl-conkypin with "own_window_type = 'normal'" and have no shadows,  the conky needs to have the Class set explicitly (as per BL default conkys) with

    own_window_class = 'Conky',

or include the actual Class name that conky defaults to in compton.conf using

    "class_g = 'conky'",

Would it be an idea to add this to the default compton.conf? I had been using 'desktop' instead of 'normal' for some conkys, so I could remove the shadows, without realising that I needed to have this compton setting.

BTW I think bl-conkypin is a very useful tool, and it is probably unique to Bunsenlabs smile


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#2 2018-09-11 21:59:51

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,036
Website

Re: bl-conkypin

Not a conk guy, no opinion here except that I always change window type to desktop on BL. Whatever you guys decide is fine by me.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#3 2018-09-12 07:56:04

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: bl-conkypin

So there are two things here, right?

1) For compton to remove shadows it needs to know what window class to look for. So Damo, does your suggested compton.conf line disable shadows for both conky and Conky classes? If so, let's belt and braces and do it.

2) For bl-conkypin to work the window type needs to be "normal", regardless of shadows issues. But that breaks the "show desktop" action. I think an extension to the script should be able to note down the window type if it's not "normal", temporarily change it to "normal", then back to the original setting after the move.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#4 2018-09-12 14:30:07

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: bl-conkypin

johnraff wrote:

So there are two things here, right?

1) For compton to remove shadows it needs to know what window class to look for. So Damo, does your suggested compton.conf line disable shadows for both conky and Conky classes? If so, let's belt and braces and do it.

It seems that if the conkyrc does not explicitly have own_window_class = 'Conky',, then compton.conf needs

    "class_g = 'Conky'",       <-- this covers it when class is set as 'Conky'
    "class_g = 'conky'",       <-- this handles it when no class has been set

2) For bl-conkypin to work the window type needs to be "normal", regardless of shadows issues. But that breaks the "show desktop" action. I think an extension to the script should be able to note down the window type if it's not "normal", temporarily change it to "normal", then back to the original setting after the move.

I had also thought of that, and got as far as getting bl-conkypin to change the conky from desktop to normal to allow it to be moved (just using a simple sed replace), before I noticed the own_window_class thing. It would be a very clunky solution though - it looks so weird when it happens that it might need a pop-up to explain it! Better to have compton and/or conkyrc set up right, and have 'normal' conky windows which can be pinned.

Users like hhh can change to 'desktop' if that is the result required, IMO.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2018-09-12 17:44:33

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,036
Website

Re: bl-conkypin

damo wrote:

Users like hhh can change to 'desktop' if that is the result required, IMO.

I'm fine with that. smile


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#6 2018-09-13 07:43:11

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: bl-conkypin

Surely the window class thing is about shadows, and unrelated to the moveability issue?

Anyway, I was thinking that after the move, bl-conkypin could set the window type back to whatever it was before, so users would be unbothered.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#7 2018-09-13 23:49:07

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: bl-conkypin

Just had another look at the bl-conkypin code. Since we already have functions that read from and write to the conky config file it looks as if all we'd have to do would be call parse_conkyfile() a bit earlier, do a run of edit_conkyfile() to change own_window_type to "normal" before the move, if necessary, and add a trap to restore the original value of own_window_type when the script exits.

I'll have a try and post here if it works.

(If I have time after getting the computer set up again.
Not to mention Firefox Quantum disabling all my favourite addons. roll)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#8 2018-09-14 02:29:06

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: bl-conkypin

I started doing exactly that with bl-conkypin... I would have got there eventually I guess!


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#9 2018-09-29 04:28:48

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: bl-conkypin

Sorry damo, I grabbed that ball... and dropped it.
Along with hard disk failure and some RL stuff, I almost forgot about the conky mover, but went back last week.

The window type fix in fact didn't take too much code. First, so that the parse and edit functions could be used in various places, define generic names as soon as the config file path is known with:

    if grep -q '[[:blank:]]*conky.config[[:blank:]]*=' "$CONKYPATH"
    then
        parseconky() {
            parse_conkyfile "$@"
        }
        editconky() {
            edit_conkyfile "$@"
        }
    else
        yad_info "This conky uses v1.09 syntax.\nIt is recommended to convert the conky to v1.10 syntax.\nSee: https://forums.bunsenlabs.org/viewtopic.php?id=3983"
        parseconky() {
            parse_conkyfile_1.09 "$@"
        }
        editconky() {
            edit_conkyfile_1.09 "$@"
        }
    fi

So the parseconky and editconky functions refer to whichever is appropriate.

Then a trap:

restore_wintype() {
	[[ ${CONKYPATH:-X} = 'X' || ${original_wintype:-X} = 'X' ]] && return 0
	editconky "$CONKYPATH" "own_window_type=$original_wintype"  
}

trap restore_wintype EXIT

A function to change the window type if necessary to move it:

adjust_wintype() {
	[[ ${CONKYPATH:-X} = 'X' || ${config[own_window_type]:-normal} = 'normal' ]] && return 0
	original_wintype=${config[own_window_type]}
	editconky "$CONKYPATH" "own_window_type=normal"
	config[own_window_type]=normal
}

And drop it into the script after the config file has been parsed:

parseconky "$CONKYPATH"

adjust_wintype

yad_question "Move the Conky to the desired location\nwith Alt+L-mousebutton Drag.\n\nThen click 'OK' to record the new position." \
     --button="OK:0" --button="gtk-cancel:1"

This seems to be working nicely, but I then noticed that parse_conkyfile() was a bit brittle. It works fine for our conky configs, with everything laid out neatly on separate lines, but breaks if extra spaces appear in certain places or if some items are put on the same line, all of which is OK with conky 10 itself. Rewriting that function took a lot longer, but I think it might be fairly robust now. However, I still need to check edit_conkyfile()...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#10 2018-10-11 08:21:29

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: bl-conkypin

I think bl-conkypin is now doing its thing and not choking on various non-standard formatting in conky files. Uploaded to github, but the package upgrade of bunsen-utilities will have to wait for a tweak to bl-obthemes' buitin configs, and maybe something else...

Anyway, it means that the next bunsen-configs can ship a default conky with own_window_type = 'desktop' cool

btw re: compton.conf, this works for case-insensitive window class:

"class_g ?= 'Conky'",

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#11 2018-10-18 18:11:16

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: bl-conkypin

I haven't "broken" it yet! The own_window_type switch is a neat idea wink

One observation is that if you click on a conky, then cancel the move, the conkyrc is still edited and a line added. Eg...

-- bl-conkypin, original value for own_window_type: desktop

I think it would be nicer if the original file was untouched if the user has cancelled the operation.

Nothing to do with bl-conkypin, but xprop/obxprop can't get a handle on a conky if it doesn't have

	own_window_class = 'Conky', (or 'conky')

    even though it runs fine.


Good work on the parsing, and the intricacies of bash, John. Hats off! big_smile

Is it worth shipping the tweak in compton.conf as well? EDIT: Nevermind, I see you were on the ball with that as well smile

"class_g ?= 'Conky'",

Last edited by damo (2018-10-18 18:13:30)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#12 2018-10-19 04:01:20

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: bl-conkypin

damo wrote:

One observation is that if you click on a conky, then cancel the move, the conkyrc is still edited and a line added. Eg...

-- bl-conkypin, original value for own_window_type: desktop

I think it would be nicer if the original file was untouched if the user has cancelled the operation.

Yes it would. But I'm not sure how easy it would be to implement. The file is edited as soon as the user clicks the conky, ready for the move. If they cancel, then it is edited again, to restore the original setting. The comment is intended to preserve whatever was in the file before bl-conkypin started messing with it, but no history of changes is kept, so I'm not sure how the script would know whether it was OK to delete the comment or not. IE if it was the second or third move, the comment would need to be kept.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#13 2018-10-19 11:25:01

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: bl-conkypin

^ Yeah, I could see the problems, it was just a thought to keep things as clean as possible. Sector11 would hate it!


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#14 2021-06-17 06:03:02

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: bl-conkypin

damo wrote:

One observation is that if you click on a conky, then cancel the move, the conkyrc is still edited and a line added. Eg...

-- bl-conkypin, original value for own_window_type: desktop

I think it would be nicer if the original file was untouched if the user has cancelled the operation.

cZ2cA7K.gif I don't know why I didn't think of it before, but there's no need to re-edit the file or any of that complicated stuff I posted above - just make a backup of the conky file, and copy it back if bl-conkymove is exited/cancelled part way through!

I'll do this now...

BTW right now it leaves the backup file (undated, so only one copy) after a move. Better to remove it if the move was successful?

Last edited by johnraff (2021-06-17 07:27:38)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#15 2021-06-17 06:59:15

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: bl-conkypin

Necrobump FTW big_smile


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#16 2021-06-18 01:45:16

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,036
Website

Re: bl-conkypin

Necrobump approved here. Goddamn, that was hard to type.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#17 2021-06-18 02:35:56

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: bl-conkypin

It was sitting on my todo list for 2 1/2 years.
Posting here saved having to repeat all the context.
Thanks for the approval. smile


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

Board footer

Powered by FluxBB