Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: greg Newsgroups: comp.lang.tcl Subject: Re: Can Tcl/Tk be used to create Xfce panel apps? Date: Fri, 12 Jul 2024 23:28:18 +0200 Organization: A noiseless patient Spider Lines: 59 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 12 Jul 2024 23:28:18 +0200 (CEST) Injection-Info: dont-email.me; posting-host="90a7842b38cea63e05755422d8836294"; logging-data="3371369"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UnyrUdzrtOEwgYCNiasjA77a8YJwTt94=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Cw05ABpozjdB5YKsWMXsMTQXq94= Content-Language: de-DE In-Reply-To: Bytes: 2991 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. }