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?
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?
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.
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.
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.
Use IcoFx. _why himself suggested this utility on the mailing list. You will find the instruction in the tutorial section of the icoFX website.
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.
© 2022 - 2024 — McMap. All rights reserved.