GtkDialog - tips
I don't know how to do this in GTK, but there is a workaround setting a JWM class
from the first post:
---------------------------------------------------------------
Override JWM-settings - skip taskbar, sticky, layer, border
This is how to override default settings in your JWM configuration.
Your gtkdialog gui must be called with the --class parameterThen this code must be in your jwm configuration file - $HOME/.jwmrc (to be set permanently, it must be added to /etc/xdg/templates/_root_.jwmrc)
>> The option 'nolist' does avoid your app showing up in the taskbar.
>> The option 'sticky' shows your app on all desktops.
>> The option 'noborder' is equal to the gtkdialog attribute <window decorated="false">.
>> The option 'layer:x' defines if other windows should cover your app, or if it should be on top. layers can be 0-12 where 12 is the on-top setting.
from the first post:
---------------------------------------------------------------
Override JWM-settings - skip taskbar, sticky, layer, border
This is how to override default settings in your JWM configuration.
Your gtkdialog gui must be called with the --class parameter
Code: Select all
gtkdialog --class=APPLET -f myfile
Code: Select all
<Group>
<Class>APPLET</Class>
<Option>nolist</Option>
<Option>sticky</Option>
<Option>noborder</Option>
<Option>layer:12</Option>
</Group>
>> The option 'sticky' shows your app on all desktops.
>> The option 'noborder' is equal to the gtkdialog attribute <window decorated="false">.
>> The option 'layer:x' defines if other windows should cover your app, or if it should be on top. layers can be 0-12 where 12 is the on-top setting.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Unlike yad gtkdialog doesn't seem to have a way to set a window to maximized state, but you could use gtkdialog's geometry option -G to achieve almost the same effect:jlst wrote:how do i make a dialog show maximized?
- #! /bin/sh
XWININFO=$(xwininfo -root)
GEOMETRY=${XWININFO#*-geometry }
echo '
<window allow-shrink="true">
<text label="Dialog set to geometry '$GEOMETRY'" space-expand="true"></text>
</window>'|gtkdialog -G $GEOMETRY -s
Above example uses the command xwininfo -root to read the geometry of the root window, which happens to be the maximum window size. The window manager honors this size - minus the size it may need for its tray. The result should be visually the same as a maximized window.
The geometry option actually sets the minimum size, i.e. the user can't resize the window smaller. Use the allow-shrink="true" option if you need unrestricted resizing.
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
Hi all
How do I create a dialogbox with gtkdialog or yad or zenity which displays text, but shows neither Cancel nor OK button, and with a timeout so that the box vanishes after a specified timeout interval?
How do I create a dialogbox with gtkdialog or yad or zenity which displays text, but shows neither Cancel nor OK button, and with a timeout so that the box vanishes after a specified timeout interval?
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
thanks for the advice. for such a complex and complete gtk gui... this is outrageous
gtkdialog has the --center option. well, center, maximized... i guess these are gtk window properties. i mean this could be implemented replicating the --center option, changing one line perhaps..
i remember asking the yad developer to add the --no-escape option to make yad dialogs behave gtkdialog, and basically the opposite can be applied to gtkdialog.
there are patches for everything somewhere, i actually found one that was submitted like 2-3 years before it got applied!
https://sourceforge.net/p/yad-dialog/tickets/253/
gtkdialog has the --center option. well, center, maximized... i guess these are gtk window properties. i mean this could be implemented replicating the --center option, changing one line perhaps..
i remember asking the yad developer to add the --no-escape option to make yad dialogs behave gtkdialog, and basically the opposite can be applied to gtkdialog.
there are patches for everything somewhere, i actually found one that was submitted like 2-3 years before it got applied!
https://sourceforge.net/p/yad-dialog/tickets/253/
-
- Posts: 1543
- Joined: Mon 22 Feb 2016, 19:43
In Puppy I see they use yaf-splash a lot for those, but maybe that's not what you want?B.K. Johnson wrote:Hi all
How do I create a dialogbox with gtkdialog or yad or zenity which displays text, but shows neither Cancel nor OK button, and with a timeout so that the box vanishes after a specified timeout interval?
Code: Select all
yaf-splash -bg pink -placement top -close never -timeout 5 -text "This message will self-destruct in 5 seconds"
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
@Sailor Enceladus
Thanks for responding.
You are correct that I don't want this:
Thanks for responding.
You are correct that I don't want this:
Code: Select all
yaf-splash -bg pink -placement top -timeout 5 -text "This message will self-destruct in 5 seconds
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
This works as a message box.B.K. Johnson wrote:Hi all
How do I create a dialogbox with gtkdialog or yad or zenity which displays text, but shows neither Cancel nor OK button, and with a timeout so that the box vanishes after a specified timeout interval?
Code: Select all
yad --title="Yad Message Box" --fixed --text-align="center" --skip-taskbar --window-icon="gtk-dialog-info" \
--text="<big><b>
This is a Yad message box
</b></big>" --no-buttons --timeout="3"
Last edited by Geoffrey on Sun 14 Aug 2016, 06:56, edited 1 time in total.
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
You can create a splash in gtkdialog by using a progress bar - just put a sleep inside that and after force the progress bar to complete to its 100 total. Sorry, I don't have the exact code at my fingertips just now. The progress bar itself can be constructed with <invisible> tags or something like that.
EDIT: Actually, just noted that zigbert gives a splash screen example in his first post of this thread - near the end of his post.
William
EDIT: Actually, just noted that zigbert gives a splash screen example in his first post of this thread - near the end of his post.
William
github mcewanw
This works for gtkdialog, Ah it does skip the taskbar using skip_taskbar_hint="true"
Code: Select all
#! /bin/bash
TEXT="<big><b>
This is a gtkdialog message box
</b></big>"
export Message_Box='
<window title="Message Box" icon-name="gtk-dialog-info" resizable="false" skip_taskbar_hint="true">
<vbox>
<text wrap="false" xalign="0" use-markup="true">
<label>"'$TEXT'"</label>
</text>
</vbox>
<timer seconds="true" interval="5" visible="false">
<action>EXIT:exit</action>
</timer>
</window>'
gtkdialog --program=Message_Box
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
@Geoffrey
Thanks for those 2 examples.
Bonus question:
What's the definitive link for yad commands. I did not see "timeout" and "no-buttons" anywhere I looked?
Thanks for those 2 examples.
Bonus question:
What's the definitive link for yad commands. I did not see "timeout" and "no-buttons" anywhere I looked?
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
http://smokey01.com/help/yad-tips-0.0.1.ncd.tar.xzWhat's the definitive link for yad commands.
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
In the terminal type either of these.B.K. Johnson wrote: I did not see "timeout" and "no-buttons" anywhere I looked?
Code: Select all
Help Options:
-h, --help Show help options
--help-all Show all help options
--help-general Show general options
--help-common Show common options
--help-calendar Show calendar options
--help-color Show color selection options
--help-dnd Show drag-n-drop options
--help-entry Show text entry options
--help-file Show file selection options
--help-font Show font selection options
--help-form Show form options
--help-icons Show icons box options
--help-list Show list options
--help-multi-progress Show multi progress bars options
--help-notebook Show notebook dialog options
--help-notification Show notification icon options
--help-paned Show paned dialog options
--help-picture Show picture dialog options
--help-print Show print dialog options
--help-progress Show progress options
--help-scale Show scale options
--help-text Show text information options
--help-filter Show file filter options
--help-misc Show miscellaneous options
--help-gtk
Code: Select all
# yad --help-general
Usage:
yad [OPTION...] - Yet another dialoging program
General options
--title=TITLE Set the dialog title
--window-icon=ICONPATH Set the window icon
--width=WIDTH Set the width
--height=HEIGHT Set the height
--geometry=WxH+X+Y Set the window geometry
--timeout=TIMEOUT Set dialog timeout in seconds
--timeout-indicator=POS Show remaining time indicator (top, bottom, left, right)
--text=TEXT Set the dialog text
--text-align=TYPE Set the dialog text alignment (left, center, right, fill)
--image=IMAGE Set the dialog image
--image-on-top Show image above main widget
--icon-theme=THEME Use specified icon theme instead of default
--expander=TEXT Hide main widget with expander
--button=NAME:ID Add dialog button (may be used multiple times)
--no-buttons Don't show buttons
--buttons-layout=TYPE Set buttons layout type (spread, edge, start, end or center)
--no-markup Don't use pango markup language in dialog's text
--no-escape Don't close dialog if Escape was pressed
--borders=NUMBER Set window borders
--always-print-result Always print result
--selectable-labels Dialog text can be selected
--sticky Set window sticky
--fixed Set window unresizable
--on-top Place window on top
--center Place window on center of screen
--mouse Place window at the mouse position
--undecorated Set window undecorated
--skip-taskbar Don't show window in taskbar
--maximized Set window maximized
--fullscreen Set window fulscreen
--no-focus Don't focus dialog window
--splash Open window as a splashscreen
--plug=KEY Special type of dialog for XEMBED
--tabnum=NUMBER Tab nubmer of this dialog
--parent-win=XID XID of parent window
--kill-parent=SIGNAL Send SIGNAL to parent
--print-xid Print X Window Id to the stderr
--image-path=PATH Add path for search icons by name
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
That is just wonderful Geoffrey.
Greatly appreciated.
Greatly appreciated.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
I'm trying to find a way to make the GUI refresh depending if a file called checkfile exists in /root.
The create button creates the file and the delete buttons deletes it. I want the frame to hide if no checkfile exist and show if it does. It works fine if the GUI is restarted.
Thanks
The create button creates the file and the delete buttons deletes it. I want the frame to hide if no checkfile exist and show if it does. It works fine if the GUI is restarted.
Code: Select all
#!/bin/bash
[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog
CHECK () {
if [ -f /root/checkfile ]; then
eth0=true
else
eth0=false
fi
}
export -f CHECK
CHECK
export MAIN_DIALOG='
<window window-position="3" icon-name="gtk-network" title="'"$eth0"'" resizable="true" border-width="0">
<vbox>
<frame Create/Delete>
<hbox>
<button>
<input file stock="gtk-add"></input>
<label>Create</label>
<action>echo checkfile > /root/checkfile &</action>
</button>
<button>
<input file stock="gtk-delete"></input>
<label>Delete</label>
<action>rm /root/checkfile &</action>
</button>
</hbox>
</frame>
<vbox visible="'"$eth0"'">
<frame Boo>
<hbox homogeneous="true" auto-refresh="true">
<button>
<input file>/usr/share/pixmaps/midi-icons/home48.png</input>
<action>yad --text="Bingo" --center &</action>
<action>CHECK</action>
<action type="refresh">eth0</action>
<variable>eth0</variable>
</button>
</hbox>
</frame>
</vbox>
<vbox>
<hbox>
<button ok>
</button>
</hbox>
</vbox>
</vbox>
</window>'
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
This should do it:smokey01 wrote:I'm trying to find a way to make the GUI refresh depending if a file called checkfile exists in /root.
The create button creates the file and the delete buttons deletes it.
Code: Select all
#! /bin/sh
export MAIN_DIALOG='
<window window-position="3" icon-name="gtk-network" resizable="true" border-width="0">
<vbox>
<frame Create/Delete>
<hbox>
<button>
<input file stock="gtk-add"></input>
<label>Create</label>
<action>echo checkfile > /root/checkfile &</action>
<action>show:vBOO</action>
<action>refresh:vWIN</action>
</button>
<button>
<input file stock="gtk-delete"></input>
<label>Delete</label>
<action>rm /root/checkfile &</action>
<action>hide:vBOO</action>
<action>refresh:vWIN</action>
</button>
</hbox>
</frame>
<vbox>
<frame Boo>
<hbox homogeneous="true" auto-refresh="true">
<button>
<input file>/usr/share/pixmaps/midi-icons/home48.png</input>
<action>yad --text="Bingo" --center &</action>
</button>
</hbox>
</frame>
<variable>vBOO</variable>
</vbox>
<vbox>
<hbox>
<button ok>
</button>
</hbox>
</vbox>
</vbox>
<action signal="show" condition="command_is_true([[ -f /root/checkfile ]] || echo true )">hide:vBOO</action>
<variable>vWIN</variable>
<input>[[ -f /root/checkfile ]] && echo checkfile exists || echo no checkfile</input>
</window>'
gtkdialog --program=MAIN_DIALOG
I noticed that you use window-position="3" resizeable="true". AFAIK you can't resize a centered gtkdialog.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
It does exactly what you asked for ("I want the frame to hide if no checkfile exist and show if it does"). It is hiding the frame.smokey01 wrote:That's great MochiMoppel but it's hiding the image and not the frame.
Geoffrey's trick does it and I have no idea why. I haven't found any explanation of a window tag attribute resizable , not in this tutorial and not in the gtkdialog reference though the GtkWindow Manual lists the “resizableI want the GUI to shrink when there's no image