From 4807d916d01a3e2cb188a15840323f789f9e3953 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Sun, 24 Jan 2010 01:05:56 +0000 Subject: [PATCH] Added icon and XDG desktop file for use installing onto X desktops --- ChangeLog | 9 + icons/tkcon-small.svg | 534 ++++++++++++++++++++++++++++++++++++++++ icons/tkcon-small48.png | Bin 0 -> 4183 bytes install-desktop-menu.sh | 26 ++ tkcon-console.desktop | 10 + tkcon.tcl | 35 ++- 6 files changed, 613 insertions(+), 1 deletion(-) create mode 100644 icons/tkcon-small.svg create mode 100644 icons/tkcon-small48.png create mode 100755 install-desktop-menu.sh create mode 100644 tkcon-console.desktop diff --git a/ChangeLog b/ChangeLog index cd69beb..8a35add 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-01-24 Pat Thoyts + + * icons/*: Added an SVG icon and .desktop file suitable + * tkcon-console.desktop: for use installing tkcon into the desktop + * install-desktop-menu.sh: menus on a unix desktop. Also an install + * tkcon.tcl: script to show how it is done. And for + use with 8.6 on X11 - if we can locate the icon, use it as the + tkcon iconphoto so it shows up associated with the running app. + 2010-01-23 Pat Thoyts * tkcon.tcl: Make use of the extended window manager hints from diff --git a/icons/tkcon-small.svg b/icons/tkcon-small.svg new file mode 100644 index 0000000..8d6287b --- /dev/null +++ b/icons/tkcon-small.svg @@ -0,0 +1,534 @@ + + + + + tkcon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + tkcon + 23 Jan 2010 + + + Pat Thoyts + + + Tcl feather icon blended with the console icon fron the tango theme icon package. + + + Pat Thoyts, The Tango Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icons/tkcon-small48.png b/icons/tkcon-small48.png new file mode 100644 index 0000000000000000000000000000000000000000..8797a7673319b6d13cd5bdc6a59a36a12b1de5e7 GIT binary patch literal 4183 zcmXw6c{~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w`!hMj5kL){y;wycBNo$@^-I~~Q?5XL=?0fUfIjf;=hzPA^R4v!2E)z{Sdi%PXU zldt3|D!I4aba4B9GraG1-v!5z*b$|h1;GFzwc62i+M>5sM~WDg;|Okn1D42-C+T!d zU4AO%wIf`cQB7yI&uM9c1#fnp!J+wp%jQv!N8Z^8^d1#XEv8qY`EYJ_E1 boYDD3O@0U&yw*$o9RqYw2FRBPhsXZ|HMPWZ literal 0 HcmV?d00001 diff --git a/install-desktop-menu.sh b/install-desktop-menu.sh new file mode 100755 index 0000000..1e4c4eb --- /dev/null +++ b/install-desktop-menu.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# To install a tkcon entry into a FreeDesktop.org compatible menu system such +# as used by GNOME, KDE or most modern X11 desktop environments the tkcon.desktop +# and icons/* files are installed. This should be done using the xdg-desktop-menu +# utility and xdg-icon-resource utility from the xdg-utils package. See +# http://portland.freedesktop.org/xdg-utils-1.0/ for further details. +# + +PROG_XDG_DESKTOP_MENU=`which xdg-desktop-menu` +PROG_XDG_ICON_RESOURCE=`which xdg-icon-resource` + +ICONFILE=icons/tkcon-small48.png + +if [ -x $PROG_XDG_DESKTOP_MENU -a -x PROG_XDG_ICON_RESOURCE ] +then + $PROG_XDG_DESKTOP_MENU install tkcon-console.desktop + $PROG_XDG_ICON_RESOURCE install --size 48 $ICONFILE tkcon-icon +else + [ -d $HOME/.local/share/applications ] || mkdirhier $HOME/.local/share/applications + [ -d $HOME/.local/share/icons ] || mkdirhier $HOME/.local/share/icons + install tkcon-console.desktop $HOME/.local/share/applications/tkcon-console.desktop + install $ICONFILE $HOME/.local/share/icons/tkcon-icon.png +fi + + diff --git a/tkcon-console.desktop b/tkcon-console.desktop new file mode 100644 index 0000000..0be3094 --- /dev/null +++ b/tkcon-console.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=tkcon +GenericName=Tk console +Comment=Tk console +Exec=tkcon +Icon=tkcon-icon +Terminal=false +Type=Application +Categories=Development;Utility; diff --git a/tkcon.tcl b/tkcon.tcl index 11ffc73..725007b 100755 --- a/tkcon.tcl +++ b/tkcon.tcl @@ -683,6 +683,16 @@ proc ::tkcon::InitUI {title} { grid remove $sbar } + # If we can locate the XDG icon file then make use of it. + if {[package vsatisfies [package provide Tk] 8.6]} { + if {[tk windowingsystem] eq "x11"} { + if {[set icon [locate_xdg_icon tkcon-icon.png]] ne ""} { + image create photo tkcon_icon -file $icon + wm iconphoto $root tkcon_icon + } + } + } + if {!$PRIV(WWW)} { wm title $root "tkcon $PRIV(version) $title" if {$PRIV(showOnStartup)} { wm deiconify $root } @@ -693,6 +703,29 @@ proc ::tkcon::InitUI {title} { } } +# Hunt around the XDG defined directories for the icon. +# Note: hicolor is the standard theme used by xdg-icon-resource. +proc ::tkcon::locate_xdg_icon {name} { + global env + set dirs [list /usr/local/share /usr/share] + if {[info exists env(XDG_DATA_DIRS)]} { + set dirs [split $env(XDG_DATA_DIRS) :] + } + if {[file isdirectory ~/.local/share]} { + set dirs [linsert $dirs 0 ~/.local/share] + } + foreach dir $dirs { + foreach path [list icons icons/hicolor/48x48/apps] { + set path [file join $dir $path $name] + puts "$path [file exists $path]" + if {[file exists $path]} { + return $path + } + } + } + return "" +} + proc ::tkcon::InitTab {w} { variable OPT variable PRIV @@ -6321,7 +6354,7 @@ proc ::send::Pop {varname {nth 0}} { return $r } ## -## end 'send' pacakge +## end 'send' package ## special case 'tk appname' in Tcl plugin if {$::tkcon::PRIV(WWW)} { -- 2.23.0