Am 12.07.24 um 09:13 schrieb Mark Summerfield:
To clarify: I want to write a Tcl/Tk app that presents itself as a
menubutton (shown as an icon) that appears in the Xfce taskbar.
I don't know if this is possible since it may require using some Xfce C library.
The solution is only an approximation:
#!/usr/bin/env tclsh
package require Tk
# position xfce panel, horizontal or vertical
#
https://docs.xfce.org/xfce/xfconf/xfconf-query
# xfconf-query -c xfce4-panel -lv
if {[catch {exec xfconf-query -vc xfce4-panel -p /panels/panel-1/mode}
msg ]} {
set xpos [winfo pointerx .]
set ypos [winfo pointery .]
} elseif {$msg eq "0"} {
set xpos [winfo pointerx .]
set ypos 0
} else {
set xpos 0
set ypos [winfo pointery .]
}
wm title . "Custom Menu App"
frame .mainWindow
menu .menubar
.menubar add cascade -label "Menu" -menu .menu
menu .menu
.menu add command -label "Option 1" \
-command {tk_messageBox -message "Option 1 selected"}
.menu add command -label "Option 2" \
-command {tk_messageBox -message "Option 2 selected"}
.menu add separator
.menu add command -label "Exit" -command {exit}
. configure -menu .menubar
pack .mainWindow -expand true -fill both
wm geometry . 60x10+$xpos+$ypos
wm attributes . -topmost 1
wm attributes . -alpha 0.5
if {0} {
Adding the script to the XFCE4 panel:
Create a launcher in the XFCE4 panel that runs the Tcl/Tk script.
Right click on the XFCE4 panel and select "Panel" > "Panel preferences".
Go to the "Items" tab and click "Add".
Select "Launcher" and click "Add".
Find the new launcher in the list and click "Edit".
Click "Add a new empty item" and then click "Edit".
Enter a name for the launcher, e.g. "Custom Menu".
Enter the path to your Tcl/Tk script in the "Command" field, e.g. /path/to/custom_menu.tcl.
}
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)