Fórum Ubuntu CZ/SK
Ubuntu pro osobní počítače => Software => Příkazový řádek a programování pro GNU/Linux => Téma založeno: mio69 23 Ledna 2010, 17:48:25
-
Jde nějakým univerzálním způsobem v xml souboru Metacity přidat před text miniaturu ikony? Viz obrázek.
[attachment deleted by admin]
-
Zdravím Vás,
Jde nějakým univerzálním způsobem v xml souboru Metacity přidat před text miniaturu ikony? Viz obrázek.
Nevím, ale pokud máte k dispozici xml (mělo by být v : ~/.themes/SystemG/metacity-1/metacity-theme-1.xml) tak by to mělo teoreticky jít přídáním elementu zapouzdřujícího obrázek ikony, lépe : zapouzdřujícího odkaz na file, v němž leží ona ikona (i když, mám dojem že součástí xml mohou být i části binárního code, takže file ikony nemusí nutně ležet mimo dané xml file......).
Pokud se vám ono xml podaří najít a bude v něm již někde v jeho struktuře definován odkaz na nějakou ikonu, tak přidání podobného odkazu k libovolnému elementu není problém. Jiná je, jestli aplikace , která zpracovává dané xml jest stvořena tak, že zareaguje na takto zvnějšku pomocí text editoru přidaný odkaz, tj, že očekává přítomnost | nepřítomnost odkazu na nějakou ikonu v daném elementu (či atributu).
Zkuste sem podat , prosím, prostřednictvím tagu 'Vložit kód' ono xml, podíváme se, jak je definována jeho struktura. Rozhodně by v něm mělo být slovo ''Taschenrechner" (které by mohlo být textovým node nějakého elementu, či hodnotou jeho atributu, u kterého pak bude odkaz na ikonu kalkulačky...). Každopádněte, pečlivě si uložte kopii onoho xml, než do něj zasáhnete, na bezpečné místo....
-
Zdravím Vás,
Jde nějakým univerzálním způsobem v xml souboru Metacity přidat před text miniaturu ikony? Viz obrázek.
Nevím, ale pokud máte k dispozici xml (mělo by být v : ~/.themes/SystemG/metacity-1/metacity-theme-1.xml) tak by to mělo teoreticky jít přídáním elementu zapouzdřujícího obrázek ikony, lépe : zapouzdřujícího odkaz na file, v němž leží ona ikona (i když, mám dojem že součástí xml mohou být i části binárního code, takže file ikony nemusí nutně ležet mimo dané xml file......).
Pokud se vám ono xml podaří najít a bude v něm již někde v jeho struktuře definován odkaz na nějakou ikonu, tak přidání podobného odkazu k libovolnému elementu není problém. Jiná je, jestli aplikace , která zpracovává dané xml jest stvořena tak, že zareaguje na takto zvnějšku pomocí text editoru přidaný odkaz, tj, že očekává přítomnost | nepřítomnost odkazu na nějakou ikonu v daném elementu (či atributu).
Zkuste sem podat , prosím, prostřednictvím tagu 'Vložit kód' ono xml, podíváme se, jak je definována jeho struktura. Rozhodně by v něm mělo být slovo ''Taschenrechner" (které by mohlo být textovým node nějakého elementu, či hodnotou jeho atributu, u kterého pak bude odkaz na ikonu kalkulačky...). Každopádněte, pečlivě si uložte kopii onoho xml, než do něj zasáhnete, na bezpečné místo....
Děkuji, zkuste najít...<?xml version="1.0"?>
<metacity_theme>
<info>
<name>Plastique2</name>
<author>eamon63 + mod: schollidesign</author>
<copyright>GPL</copyright>
<date>May 2009</date>
<description>non-unified caption</description>
</info>
<constant name="IconSpacing" value="22"/> <!-- spacing between mini-icon and title text -->
<frame_geometry name="normal" rounded_top_left="true" rounded_top_right="true" rounded_bottom_left="false" rounded_bottom_right="false" title_scale="medium">
<distance name="left_width" value="1"/>
<distance name="right_width" value="1"/>
<distance name="bottom_height" value="1"/>
<distance name="left_titlebar_edge" value="5"/>
<distance name="right_titlebar_edge" value="8"/>
<distance name="button_width" value="21"/>
<distance name="button_height" value="20"/>
<distance name="title_vertical_pad" value="7"/>
<border name="title_border" left="0" right="6" top="0" bottom="0"/>
<border name="button_border" left="0" right="0" top="0" bottom="0"/>
</frame_geometry>
<frame_geometry name="border" parent="normal" has_title="false">
<distance name="button_width" value="20"/>
<distance name="button_height" value="20"/>
<border name="title_border" left="0" right="0" top="0" bottom="0"/>
<border name="button_border" left="0" right="0" top="0" bottom="0"/>
</frame_geometry>
<draw_ops name="title-text-focused">
<clip x="0" y="0" width="width" height="height"/>
<icon x="(width - title_width - mini_icon_width - IconSpacing) / 2"
y="(height-mini_icon_height) / 2"
width="mini_icon_width" height="mini_icon_height"/>
<title color="#c3c3c3" x="(width - title_width) / 2 +0" y="(height - title_height) / 2 + 1"/>
<title color="#3c3c3c" x="(width - title_width) / 2" y="(height - title_height) / 2"/>
</draw_ops>
<draw_ops name="title-text-unfocused">
<clip x="0" y="0" width="width" height="height"/>
<icon x="(width - title_width - mini_icon_width - IconSpacing) / 2"
y="(height-mini_icon_height) / 2"
width="mini_icon_width" height="mini_icon_height"
alpha="0.5"/>
<title color="#d2d2d2" x="(width - title_width) / 2 +0" y="(height - title_height) / 2 + 1"/>
<title color="#757575" x="(width - title_width) / 2" y="(height - title_height) / 2"/>
</draw_ops>
<draw_ops name="blank">
</draw_ops>
<draw_ops name="title">
<image filename="pixmaps.active_top_left.png" x="0" y="0" width="object_width" height="height"/>
<image filename="pixmaps.active_top.png" x="70" y="0" width="width - 20" height="height"/>
<image filename="pixmaps.active_top_right.png" x="width - object_width" y="0" width="object_width" height="height"/>
</draw_ops>
<draw_ops name="title-shaded">
<image filename="pixmaps.active_top_left.png" x="0" y="0" width="object_width" height="height"/>
<image filename="pixmaps.active_top.png" x="70" y="0" width="width - 20" height="height"/>
<image filename="pixmaps.active_top_right.png" x="width - object_width" y="0" width="object_width" height="height"/>
</draw_ops>
<draw_ops name="frame-left-focused">
<image filename="pixmaps.active_left.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="frame-right-focused">
<image filename="pixmaps.active_right.png" x="width - 1" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="frame-bottom-focused">
<image filename="frame-bottom-left-focused.png" x="0" y="0" width="width" height="object_height"/>
<image filename="frame-bottom-mid-focused.png" x="20" y="0" width="width - 20" height="object_height"/>
<image filename="frame-bottom-right-focused.png" x="width - object_width" y="0" width="width" height="object_height"/>
</draw_ops>
<draw_ops name="button-close-focused">
<image filename="button-close-focused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-close-unfocused">
<image filename="button-close-unfocused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-close-pressed">
<image filename="button-close-pressed.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-close-inactive">
<image filename="button-shaded.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-maximize-inactive">
<image filename="button-inactive.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-minimize-inactive">
<image filename="button-inactive.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-maximize-focused">
<image filename="button-maximize-focused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-maximize-unfocused">
<image filename="button-maximize-unfocused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-maximize-pressed">
<image filename="button-maximize-pressed.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-minimize-focused">
<image filename="button-minimize-focused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-minimize-unfocused">
<image filename="button-minimize-unfocused.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-minimize-pressed">
<image filename="button-minimize-pressed.png" x="0" y="0" width="width" height="height"/>
</draw_ops>
<draw_ops name="button-menu-focused">
<image filename="button-menu-focused.png" x="0" y="0" width="object_width" height="object_height"/>
</draw_ops>
<draw_ops name="button-menu-unfocused">
<image filename="button-menu-unfocused.png" x="0" y="0" width="object_width" height="object_height"/>
</draw_ops>
<draw_ops name="button-menu-pressed">
<image filename="button-menu-pressed.png" x="0" y="0" width="object_width" height="object_height"/>
</draw_ops>
<frame_style name="normal-focused" geometry="normal">
<piece position="titlebar" draw_ops="title"/>
<piece position="left_edge" draw_ops="frame-left-focused"/>
<piece position="right_edge" draw_ops="frame-right-focused"/>
<piece position="bottom_edge" draw_ops="frame-bottom-focused"/>
<piece position="title" draw_ops="title-text-focused"/>
<button function="close" state="normal" draw_ops="button-close-unfocused"/>
<button function="close" state="prelight" draw_ops="button-close-focused"/>
<button function="close" state="pressed" draw_ops="button-close-pressed"/>
<button function="minimize" state="normal" draw_ops="button-minimize-unfocused"/>
<button function="minimize" state="prelight" draw_ops="button-minimize-focused"/>
<button function="minimize" state="pressed" draw_ops="button-minimize-pressed"/>
<button function="maximize" state="normal" draw_ops="button-maximize-unfocused"/>
<button function="maximize" state="prelight" draw_ops="button-maximize-focused"/>
<button function="maximize" state="pressed" draw_ops="button-maximize-pressed"/>
<button function="menu" state="normal" draw_ops="button-menu-focused"/>
<button function="menu" state="prelight" draw_ops="button-menu-pressed"/>
<button function="menu" state="pressed" draw_ops="button-menu-focused"/>
</frame_style>
<frame_style name="normal-unfocused" geometry="normal">
<piece position="titlebar" draw_ops="title"/>
<piece position="left_edge" draw_ops="frame-left-focused"/>
<piece position="right_edge" draw_ops="frame-right-focused"/>
<piece position="bottom_edge" draw_ops="frame-bottom-focused"/>
<piece position="title" draw_ops="title-text-unfocused"/>
<button function="close" state="normal" draw_ops="button-close-inactive"/>
<button function="close" state="prelight" draw_ops="button-close-focused"/>
<button function="close" state="pressed" draw_ops="button-close-pressed"/>
<button function="minimize" state="normal" draw_ops="button-minimize-inactive"/>
<button function="minimize" state="prelight" draw_ops="button-minimize-focused"/>
<button function="minimize" state="pressed" draw_ops="button-minimize-pressed"/>
<button function="maximize" state="normal" draw_ops="button-maximize-inactive"/>
<button function="maximize" state="prelight" draw_ops="button-maximize-focused"/>
<button function="maximize" state="pressed" draw_ops="button-maximize-pressed"/>
<button function="menu" state="normal" draw_ops="button-menu-unfocused"/>
<button function="menu" state="prelight" draw_ops="button-menu-unfocused"/>
<button function="menu" state="pressed" draw_ops="button-menu-pressed"/>
</frame_style>
<frame_style name="normal-shaded-focused" geometry="normal" parent="normal-focused">
<piece position="titlebar" draw_ops="title-shaded"/>
</frame_style>
<frame_style name="normal-shaded-unfocused" geometry="normal" parent="normal-unfocused">
<piece position="titlebar" draw_ops="title-shaded"/>
</frame_style>
<frame_style_set name="normal">
<frame focus="yes" state="normal" resize="both" style="normal-focused"/>
<frame focus="no" state="normal" resize="both" style="normal-unfocused"/>
<frame focus="yes" state="maximized" style="normal-focused"/>
<frame focus="no" state="maximized" style="normal-unfocused"/>
<frame focus="yes" state="shaded" style="normal-shaded-focused"/>
<frame focus="no" state="shaded" style="normal-shaded-unfocused"/>
<frame focus="yes" state="maximized_and_shaded" style="normal-shaded-focused"/>
<frame focus="no" state="maximized_and_shaded" style="normal-shaded-unfocused"/>
</frame_style_set>
<window type="normal" style_set="normal"/>
<window type="dialog" style_set="normal"/>
<window type="modal_dialog" style_set="normal"/>
<window type="menu" style_set="normal"/>
<window type="utility" style_set="normal"/>
<window type="border" style_set="normal"/>
<menu_icon function="close" state="normal" draw_ops="button-close-focused"/>
<menu_icon function="maximize" state="normal" draw_ops="button-maximize-focused"/>
<menu_icon function="unmaximize" state="normal" draw_ops="button-maximize-focused"/>
<menu_icon function="minimize" state="normal" draw_ops="button-minimize-focused"/>
</metacity_theme>
Asi se jedná o IconSpacing, ale nejsem si jistý....
-
Zdravím Vás,
Takže princip jsme odhadli , zdá se, správně. Toto tvrzení opírám o : http://developer.gnome.org/doc/tutorials/metacity/metacity-themes.html
Rozhodně se na ten odkaz mrkněte. Já bych, maje na mysli rady podané tímto odkazem vložil do <draw_ops name="title-text-focused" /> a do <draw_ops name="title-text-unfocused"> (možná přijdete na lepší místa...) element <image /> takto : (nezapomeňte zálohovat původní metacity xml, kdyby to "ruplo", ať je k čemu se vrátit zpět... ;)) <draw_ops name="title-text-focused">
<clip x="0" y="0" width="width" height="height"/>
<icon x="(width - title_width - mini_icon_width - IconSpacing) / 2"
y="(height-mini_icon_height) / 2"
width="mini_icon_width" height="mini_icon_height">
<image filename="/cesta/na/image/ikonky/my_image.png" x="0" y="0" width="width" height="height" alpha="0"
colorize="#FF3399"/>
</icon>
<title color="#c3c3c3" x="(width - title_width) / 2 +0" y="(height - title_height) / 2 + 1"/>
<title color="#3c3c3c" x="(width - title_width) / 2" y="(height - title_height) / 2"/>
</draw_ops>
<draw_ops name="title-text-unfocused">
<clip x="0" y="0" width="width" height="height"/>
<icon x="(width - title_width - mini_icon_width - IconSpacing) / 2"
y="(height-mini_icon_height) / 2"
width="mini_icon_width" height="mini_icon_height"
alpha="0.5">
<image filename="/cesta/na/image/ikonky/my_image.png" x="0" y="0" width="width" height="height" alpha="0"
colorize="#FF3399"/>
</icon>
<title color="#d2d2d2" x="(width - title_width) / 2 +0" y="(height - title_height) / 2 + 1"/>
<title color="#757575" x="(width - title_width) / 2" y="(height - title_height) / 2"/>
</draw_ops>
Určitě by bylo vhodné se nějakým metacity xml inspirovat : dokázal byste vytěžit xml toho window, kde máte německy psaný nápis "kalkulačka" spolu s ikonou ? Pokud je to soubor typu "metacity xml" tak máte de facto vyřešeno, řekl bych...
Edit : já jsem prošel některé metacity xml, které mám na svých PC s ubuntu, ale žádný vložený element <image /> stylem jak jej popisuji jsem tam nenašel :(, takže je možné, že vkládání ikon je možná realizováno nějakým jiným mechanismem, zatím se mi nepodařilo zjistit jakým... Jsem z toho akosi zmätený, jdu si dát pár bucínů..... (poledne moudřejší večera...) ;D
-
Děkuji moc, za velmi ochotnou pomoc, zkoušel jsem, ale nejde vložit ikonu před text v jakémkoliv tématu metacity. Muselo by být celé xml přepsané, asi nejde jen doplnit pár řádků...Mooc složité a zdlouhavé. Zkusím ještě laborovat až budu mít trochu času. Zatím děkuji.
-
Zdravím Vás,
Děkuji moc, za velmi ochotnou pomoc, zkoušel jsem, ale nejde vložit ikonu před text v jakémkoliv tématu metacity. Muselo by být celé xml přepsané, asi nejde jen doplnit pár řádků...Mooc složité a zdlouhavé. Zkusím ještě laborovat až budu mít trochu času. Zatím děkuji.
Není to tak hrozné. Stačí přepsat jem malý úsek code v daném theme*.xml. Tak nějak mi to nedalo, a zkusil jsem vložení ikony prakticky. Povedlo se a pokusím se zde dát návod jak na to, aplikovatelný na libovolné theme*.xml, které používá metacity. Já si vložil ikonu jablka (soubor "metacity-window-demo.png") do metacity theme*.xml "Atlanta", kterážto ikona se mi nyní zobrazuje v každém title každého window, které otevřu. Jen lituji, že jsem nesehnal na netu icon file nějaké prsatice (pro začátek by stačila třeba Pamela Anderson), upravované theme by získalo na plastičnosti... :D :D
Nuže dosti slov, jdeme na to....
0. Cíl - vložit ikonu k title window do theme*.xml metacity applikace
1. pro kontrolu ověříme, že theme*.xml, které chceme editovat, lze korektně otevřít pomocí Aplikace -> Systém -> Volby -> Vzhled ->Motiv . Na mém PC mám spoustu témat, ale jen některá jdou takto otevřít, možná metacity podrobí kontrole proti *dtd otevíraný theme*.xml a pokudtento kontrole nevyhoví, tak se dále nezpracovává.. . Otevření můžete ověřit i pomocí metacity-theme-viever aplikace, která je v /usr/bin.
2. Pokud jde theme*.xml otevřít aplikací metacity, vytvoříme zálohu daného theme*.xml (přes sudo)
3. Otevřeme theme*.xml, nejlépe xml editorem, v nouzi libovolným textovým editorem (přes sudo)
4. Hledáme element <draw_ops name="title_text_with_icon"> (to je ideální stav) anebo element <draw_ops name="title_text">, obecně : element <draw_ops> v jehož jméně je attribut "name" s hodnotou "*title*"
5. Do nalezeného elementu vložíme element <image>, samozřejmě s povinnými atributy.
Kde o nich nalezneme informaci ? V /usr/share/sgml/metacity-common/metacity-theme.dtd
Toto metacity-theme.dtd obsahuje strukturální definici struktury theme*.xml files.
Pokud <draw_ops> již obsahuje <icon>, tak ten buď zlikvidujeme, nebo (lépe) , zakomentujeme takto :
<!-- icon ............ / -->
Btw. : <!-- toto je commnet v xml -->
6. Ad theme*.xml, které jste zaslal :
a) nalezněte elementy <draw_ops name="title-text-focused"> a <draw_ops name="title-text-unfocused"> a upravte je takto :
<draw_ops name="title-text-focused">
<clip x="0" y="0" width="width" height="height"/>
<image filename="pamela_anderson.png"
x="(width - title_width - mini_icon_width - IconSpacing) / 2"
y="(height-mini_icon_height) / 2"
width="mini_icon_width" height="mini_icon_height"/>
<title color="#c3c3c3" x="(width - title_width) / 2 +0" y="(height - title_height) / 2 + 1"/>
<title color="#3c3c3c" x="(width - title_width) / 2" y="(height - title_height) / 2"/>
</draw_ops>
<draw_ops name="title-text-unfocused">
<clip x="0" y="0" width="width" height="height"/>
<image filename="pamela_anderson.png"
x="(width - title_width - mini_icon_width - IconSpacing) / 2"
y="(height-mini_icon_height) / 2"
width="mini_icon_width" height="mini_icon_height"
alpha="0.5"/>
<title color="#d2d2d2" x="(width - title_width) / 2 +0" y="(height - title_height) / 2 + 1"/>
<title color="#757575" x="(width - title_width) / 2" y="(height - title_height) / 2"/>
</draw_ops>
Samozřejme musíte nahrát file ikony "pamela_anderson.png" do adresáře , kde leží theme*.xml, které editujete.
Srovnejte code snippet, který zasílám, s originálním code Vašeho theme*.xml a vše Vám pravděpodobně bude jasné.. :)
7. Otevřít editované theme*.xml pomocí aplikace metacity a opticky zkontrolovat zdali upravené odpovídá zamýšlenému....
8. Pro ilustraci, tady je příklad úpravy dalšího theme*.xml : "DarkRoom"
<draw_ops name="title_text">
<title color="shade/gtk:bg[NORMAL]/0.75"
x="(3 `max` (width-title_width)) / 2 - 1"
y="(((height - title_height) / 2) `max` 0)"/>
<title color="shade/gtk:bg[SELECTED]/0.5"
x="(3 `max` (width-title_width)) / 2 + 1"
y="(((height - title_height) / 2) `max` 0) + 2"/>
<title color="gtk:fg[NORMAL]"
x="(3 `max` (width-title_width)) / 2"
y="(((height - title_height) / 2) `max` 0)+1 "/>
<image filename="metacity-window-demo.png" x="0" y="0" width="object_width" height="height" />
</draw_ops>
Ikona jablka ("metacity-window-demo.png") je po výše uvedené editaci theme "DarkRoom" a jeho aktivaci "rozpláclá" a leží daleko od window title : je třeba si trochu pohrát s obsahem @x, @y , @width a @height podobně jako to má <image> v bodě 6.
Enjoy ! ;)
Pěkné počtení na téma "metacity" zde : https://help.ubuntu.com/community/Metacity (https://help.ubuntu.com/community/Metacity)
-
Děkuji moc. Až bude čas vyzkouším a dám vědět. Ješte dotaz, s svg by asi nebyl problém?
-
Zravím Vás,
Ješte dotaz, s svg by asi nebyl problém?
Testoval jsem s ikonami typu *svg, je to funkční, bez problémů....