Thread from comp.lang.tcl (7 replies)
Can Tcl/Tk be used to create Xfce panel apps?
I'd quite like to create a panel app for the Xfce panel. (I know that Tcl/ Tk can create systray apps, but I want a panel button like "Launcher")Click on article to view all threads in comp.lang.tcl
Re: Can Tcl/Tk be used to create Xfce panel apps?
On Wed, 10 Jul 2024 10:00:56 +0000, Mark Summerfield wrote: >I'd quite like to create a panel app for the Xfce panel. (I know that Tcl/ >Tk can create systray apps, but I want a panel button like "Launcher") ************************** I have no idea regarding integration with XFCE but making an independent panel with buttons that do stuff in Tcl/Tk is not only possible, it's very easy. I suspect it can even be more capable. And you don't really need Gnocl for that but you may want to have a look at it. Maybe it's relevant to your needs. -- Luc >>Click on article to view all threads in comp.lang.tcl
Re: Can Tcl/Tk be used to create Xfce panel apps?
On Wed, 10 Jul 2024 20:16:50 -0300, Luc wrote: > On Wed, 10 Jul 2024 10:00:56 +0000, Mark Summerfield wrote: > >>I'd quite like to create a panel app for the Xfce panel. (I know that >>Tcl/ >>Tk can create systray apps, but I want a panel button like "Launcher") > ************************** > > I have no idea regarding integration with XFCE but making an independent > panel with buttons that do stuff in Tcl/Tk is not only possible, it's > very easy. I suspect it can even be more capable. > > And you don't really need Gnocl for that but you may want to have a look > at it. Maybe it's relevant to your needs. A tiny example would help...Click on article to view all threads in comp.lang.tcl
Re: Can Tcl/Tk be used to create Xfce panel apps?
Am 10.07.24 um 12:00 schrieb Mark Summerfield: > I'd quite like to create a panel app for the Xfce panel. (I know that Tcl/ > Tk can create systray apps, but I want a panel button like "Launcher") Hello, (if I understood your question correctly) Instructions for Creating a Tcl/Tk Panel Application for the Xfce Panel Program Name: xfce_panel_app.tcl (this name is not a default) 1. Make the script executable: chmod +x xfce_panel_app.tcl 2. Script Directory: The script should be placed in a directory. An example directory could be: ~/programs/panel_app 3. Create the Desktop Entry: In the directory ~/.local/share/applications/ (default) or /usr/share/applications/ (for system-wide availability), Create a text file with the .desktop extension. The file name could be xfce_panel_app.desktop. The content of the file should be as follows: [Desktop Entry] Version=1.0 Type=Application Name=xfce panel app Comment=Tcl/Tk Panel App Exec=/home/greg/programs/panel_app/xfce_panel_app.tcl Icon=utilities-terminal Terminal=false Categories=Utility; StartupNotify=false 4. Completion: The application can now be found in the user menu under Utility. 5. Adding to the Panel: Right-click on the panel. Select "Add New Items". Choose "Launcher". Configure the new launcher by selecting the previously created desktop entry. further information: https://wiki.archlinux.org/title/desktop_entries or entry desktop xfce or /usr/share/applications or man exo-desktop-item-edit cd ~/.local/share/applications/ exo-desktop-item-edit xfce_panel_app.tcl best regards GregorClick on article to view all threads in comp.lang.tcl
Re: Can Tcl/Tk be used to create Xfce panel apps?
On Thu, 11 Jul 2024 12:19:58 +0200, greg wrote: [snip] Sorry, I think we are at cross-purposes. You showed how to add something to the existing Xfce Launcher. But what I want is to create my own launcher which I can add to the task bar to _replace_ Xfce's default Launcher.Click on article to view all threads in comp.lang.tcl
Re: Can Tcl/Tk be used to create Xfce panel apps?
On Thu, 11 Jul 2024 10:36:49 +0000, Mark Summerfield wrote: >On Thu, 11 Jul 2024 12:19:58 +0200, greg wrote: >[snip] >Sorry, I think we are at cross-purposes. > >You showed how to add something to the existing Xfce Launcher. > >But what I want is to create my own launcher which I can add to the task >bar to _replace_ Xfce's default Launcher. ************************** proc p.begin {} { package require Tk package require tile wm withdraw . set ::w [toplevel .xxx -background #c0c0c0] wm title $::w "XXXXXXXX" tk appname "XXXXXXXX" wm geometry $::w 200x60+20+20 wm resizable $::w 0 0 bind $::w <Escape> {exit 0} wm protocol $::w WM_DELETE_WINDOW {exit 0} # end of proc p.begin ==================== } p.begin set f1 [frame $::w.frame1] pack $f1 -fill both -expand 1 set b1 [button $f1.button1] $b1 configure -background blue -foreground white $b1 configure -text "click me" $b1 configure -command { tk_messageBox -title "This is button 1" -message "Thanks!" exit } pack $b1 -side left set b2 [button $f1.button2] $b2 configure -background green -foreground #FFFFFF $b2 configure -text "launch xclock" $b2 configure -command { exec xclock exit } pack $b2 -side left -- Luc >>Click on article to view all threads in comp.lang.tcl
Re: Can Tcl/Tk be used to create Xfce panel apps?
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.Click on article to view all threads in comp.lang.tcl
Re: Can Tcl/Tk be used to create Xfce panel apps?
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. }Click on article to view all threads in comp.lang.tcl