librelist archives

« back to archive

How to set title bar string and icon

How to set title bar string and icon

From:
Cecil Coupe
Date:
2014-12-02 @ 07:47
Hi,

   I have been trying to set the title of a Shoes App and I don't see 
the method in the Shoes manual. In Ruby 3 there is an Shoes.app.name= 
method that could set the title. It doesn't work but it could. Am I 
overlooking something? What does Shoes 4 do?

I'd also like to change the icon in the title bar (and the os taskbar) 
from a Shoes script. I wrote some code for that to create a 
Shoes.app.set_icon("filepath-to-icon") method to Shoes, which (al)mostly 
works in Gtk for Linux and Windows, *IF* the gtk theme permits that. 
Before I go cowboy and just add something to the Shoes 3.2 api and let 
it out in wild,  I'd like some feedback.

Someone here, Luka? asked for Icons and I said it was problem. It is 
that.  Is there a Shoe 4 method for set a windows icon?

--Cecil

Re: [shoes] How to set title bar string and icon

From:
Jason Clark
Date:
2014-12-02 @ 08:03
Hey Cecil




So from what I know, Shoes 4 can set the title during the Shoes.app all:




Shoes.app title: "Different Title” do

  ..

end




Don’t see any other place where the title is exposed. Would make sense for it

to be allowed as a setting of some sort, although `title` would collide with an

existing DSL method.




On icons, I’m pretty sure Shoes 4 is hard-coded at the moment. Witness

https://github.com/shoes/shoes4/blob/master/shoes-swt/lib/shoes/swt/app.rb#L3-L12




Both seem super worthwhile to support to me, though, once you choose a path to

head down.





~Jason

Re: [shoes] How to set title bar string and icon

From:
Cecil Coupe
Date:
2014-12-02 @ 08:29
I hesitate to respond if the mailing list is broken. Then again,
On 12/02/2014 01:03 AM, Jason Clark wrote:
> Hey Cecil
>
> So from what I know, Shoes 4 can set the title during the Shoes.app all:
>
> Shoes.app title: "Different Title” do
>   ..
> end
Ah ! That is the magic about Shoes.app, that I didn't remember.

Re: [shoes] How to set title bar string and icon

From:
Tobias Pfeiffer
Date:
2014-12-02 @ 08:18
FYI there is an open shoes4 ticket about this:
https://github.com/shoes/shoes4/issues/219

no DSL proposed so far, but my friend Lucas expressed interest in
tackling it some time back.

On 02.12.2014 09:03, Jason Clark wrote:
> Hey Cecil
> 
> So from what I know, Shoes 4 can set the title during the Shoes.app all:
> 
> Shoes.app title: "Different Title” do
>   ..
> end
> 
> Don’t see any other place where the title is exposed. Would make sense
> for it
> to be allowed as a setting of some sort, although `title` would collide
> with an
> existing DSL method.
> 
> On icons, I’m pretty sure Shoes 4 is hard-coded at the moment. Witness
> 
https://github.com/shoes/shoes4/blob/master/shoes-swt/lib/shoes/swt/app.rb#L3-L12
> 
> Both seem super worthwhile to support to me, though, once you choose a
> path to
> head down.
> 
> ~Jason

-- 
www.pragtob.info

Re: [shoes] How to set title bar string and icon

From:
Cecil Coupe
Date:
2014-12-02 @ 09:58
On 12/02/2014 01:18 AM, Tobias Pfeiffer wrote:
> FYI there is an open shoes4 ticket about this:
> https://github.com/shoes/shoes4/issues/219
>
> no DSL proposed so far, but my friend Lucas expressed interest in
> tackling it some time back.
>
>
I guess I am (re) discovering the system tray issue.  I remember some of 
that conversation from years ago. Context matters. thank you for the clue.

In Linux, the tray behaviour is theme dependent. It's theme dependent 
for 3.2.xx on Windows too but the default theme (none) behaves nicely.  
At the moment 3.2.19's provisional code  can ask for a new icon to be 
displayed but it might not be honored. I'm OK with that - what could I 
do if I wasn't?

Proposal: A new Shoes.app.set_adornment_hints(hash, &blk) 
:title=>"String" and :icon => "path-to-png". Always returns success  
with no guaranty that the hints will succeed. I'd ignore the blk in 3.2 
but others could write something so I won't close that door.

Please bash the idea and suggest alternatives: names, syntax & intent.

--Cecil

Re: [shoes] How to set title bar string and icon

From:
Jason Clark
Date:
2014-12-03 @ 00:53
My two cents FWIW.




Personally I don't find the "adornment" term to be super obvious, but I 
don'thave a better blanket term. "window_style" maybe?




That said, in terms of discoverability, I kind of prefer straight methods over

hashes. My first whack at these would probably have been:




  Shoes.app.window_title = "thing"

  Shoes.app.window_icon  = "path-to-png"




Or maybe the second should be window_icon_path to make clear that it doesn't

take an image?




Definitely agree that if it's something that can't be applied, just carrying

on is the Shoesy way to handle it... maybe log to the console if Shoes 3 does

that? We don't do much of that in Shoes 4, but I kind of wish we did.




Thanks for pushing this discussion forward Cecil!





~Jason

Re: [shoes] How to set title bar string and icon

From:
Cecil Coupe
Date:
2014-12-03 @ 02:34
That's easier C code so I like that.  I also wrote most of it that way 
before I asked the assembled crowd because I don't want to add features 
to 3.2 that Shoes 4 can't implement. It's also something that many folks 
won't care about.

Gtk always returns success on these set_icon, set_title calls even if 
the theme blocks the effect so there's nothing to log.

--cecil

On 12/02/2014 05:53 PM, Jason Clark wrote:
> My two cents FWIW.
>
> Personally I don't find the "adornment" term to be super obvious, but 
> I don't
> have a better blanket term. "window_style" maybe?
>
> That said, in terms of discoverability, I kind of prefer straight 
> methods over
> hashes. My first whack at these would probably have been:
>
>   Shoes.app.window_title = "thing"
>   Shoes.app.window_icon  = "path-to-png"
>
> Or maybe the second should be window_icon_path to make clear that it 
> doesn't
> take an image?
>
> Definitely agree that if it's something that can't be applied, just 
> carrying
> on is the Shoesy way to handle it... maybe log to the console if Shoes 
> 3 does
> that? We don't do much of that in Shoes 4, but I kind of wish we did.
>
> Thanks for pushing this discussion forward Cecil!
>
> ~Jason