How do I change the icon of my Shoes App?
Asked Answered
H

4

4

I was wondering if it was possible to change the my Shoes app's icon? I imagine its style-oriented, but I haven't been able to find anything on it.

Is this possible?

Halloo answered 9/1, 2009 at 3:16 Comment(1)
you'll see it if you install the runtime. Its just a circle with 3 shoes in it.Halloo
F
2

I don't believe this is possible from within Shoes. This is based on extensive searching, both online and in the source code.

However, there are a couple things external to Shoes that work. One is to simply change the file #{DIR}/static/shoes-icon.png, which is where the runtime pulls its icon from. The other is to change the hardcoded value in the file libshoes.so (or your OS's equivalent); you could use a hex editor, or any other editor that wouldn't mess the file up. Note that for the hardcoded editing to work without crashing, you have to replace the hardcoded string with something of the same length.

Fowkes answered 9/1, 2009 at 6:59 Comment(1)
unfortunately, I believe you are right. Thanks for the answer!!Halloo
B
3

You can do it in Green Shoes, but you have to go under the hood a bit. Here's some very simple code I wrote for SciRuby:

class Shoes
  class App
    def icon filename=nil
      filename.nil? ? win.icon : win.icon = filename
    end

    class << self
      def default_icon= filename
        Gtk::Window.set_default_icon(filename)
      end
    end
  end
end

The second method is optional; you can use it to set the icon for your whole app, I think. The first method sets the icon for the current window, and you would use it like so:

DIR = Pathname.new(__FILE__).realpath.dirname.to_s
ICON_PATH = File.join(DIR, '..', 'static', 'my-icon.png')

# ...

Shoes.app :title => "My App" do
  icon ICON_PATH
end

And for the default:

Shoes::App.default_icon = ICON_PATH

I use a 128x128 png file. I tried a 500x500 one and it didn't work properly. In the code above, ICON_PATH, from the root of your project directory, should be ./static/my-icon.png.

You may also need to require "gtk2" somewhere for the default_icon= method.

Bambara answered 19/9, 2011 at 2:25 Comment(1)
Do you know how to package a green_shoes app for distribution? It doesnt provide one.Watercool
F
2

I don't believe this is possible from within Shoes. This is based on extensive searching, both online and in the source code.

However, there are a couple things external to Shoes that work. One is to simply change the file #{DIR}/static/shoes-icon.png, which is where the runtime pulls its icon from. The other is to change the hardcoded value in the file libshoes.so (or your OS's equivalent); you could use a hex editor, or any other editor that wouldn't mess the file up. Note that for the hardcoded editing to work without crashing, you have to replace the hardcoded string with something of the same length.

Fowkes answered 9/1, 2009 at 6:59 Comment(1)
unfortunately, I believe you are right. Thanks for the answer!!Halloo
P
2

Use IcoFx. _why himself suggested this utility on the mailing list. You will find the instruction in the tutorial section of the icoFX website.

Pot answered 8/4, 2009 at 13:41 Comment(0)
H
0

So far, I am not sure that this is actually possible. in OS X, I was able to modify the package contents to change what the plist is pointing to in terms of icons. However, when the application runs, it uses the Shoes' runtime icon.

I have no clue how you'd do this on Windows.

Halloo answered 9/1, 2009 at 6:15 Comment(1)
I agree that it is not possible. I have searched for some time, including looking at the source, and I cannot find any mention.Fowkes

© 2022 - 2024 — McMap. All rights reserved.