• color of toplevel buttons bar

    From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Sat Mar 14 13:30:38 2026
    From Newsgroup: comp.lang.tcl

    I want to make the title bar of a toplevel window dark.
    Is this possible?
    I couldn't find a solution in the toplevel and wm commands.

    Thanks
    Alex
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Helmut Giese@hgiese@ratiosoft.com to comp.lang.tcl on Sat Mar 14 16:24:24 2026
    From Newsgroup: comp.lang.tcl

    Hello,
    I want to make the title bar of a toplevel window dark.
    Is this possible?
    I couldn't find a solution in the toplevel and wm commands.
    no. I think it isn't.
    The title bar is what is called 'decoration' in the docs and it is
    provided by the window manager.
    However, if you choose a dark theme you shoukd get a 'dark' title bar.
    Whether that blends wit the rest of your toplevel is another question.
    HTH
    Helmut
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Sat Mar 14 16:33:09 2026
    From Newsgroup: comp.lang.tcl

    Am 14.03.2026 um 16:24 schrieb Helmut Giese:
    no. I think it isn't.
    The title bar is what is called 'decoration' in the docs and it is
    provided by the window manager.
    However, if you choose a dark theme you shoukd get a 'dark' title bar. Whether that blends wit the rest of your toplevel is another question.
    HTH
    Helmut
    In Windows I use a dark theme.
    But somehow Tcl/Tk does not care about it.
    Other programs automatically switch to a dark color of their title bars.
    So maybe I shouldn't search for a command.
    Instead Tcl/Tk should be fixed in that regard?
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Helmut Giese@hgiese@ratiosoft.com to comp.lang.tcl on Sat Mar 14 21:25:12 2026
    From Newsgroup: comp.lang.tcl

    Am 14.03.2026 um 16:24 schrieb Helmut Giese:
    no. I think it isn't.
    The title bar is what is called 'decoration' in the docs and it is
    provided by the window manager.
    However, if you choose a dark theme you shoukd get a 'dark' title bar.
    Whether that blends wit the rest of your toplevel is another question.
    HTH
    Helmut
    In Windows I use a dark theme.
    But somehow Tcl/Tk does not care about it.
    Other programs automatically switch to a dark color of their title bars.
    So maybe I shouldn't search for a command.
    Sorry, I have absolutely no experience with themes.
    Instead Tcl/Tk should be fixed in that regard?
    Hm, instead of thinking that Tk is at fault I would continue
    searching. How about looking for themed Tk apps (on the wiki?) and
    learning from them?
    HTH
    Helmut
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Sun Mar 15 13:01:30 2026
    From Newsgroup: comp.lang.tcl

    Am 14.03.2026 um 21:25 schrieb Helmut Giese:
    Hm, instead of thinking that Tk is at fault I would continue
    searching. How about looking for themed Tk apps (on the wiki?) and
    learning from them?
    HTH
    Helmut
    I'm already using the awtheme.
    It does not change the color of the title bar.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Sun Mar 15 13:26:21 2026
    From Newsgroup: comp.lang.tcl

    Am 15.03.2026 um 13:01 schrieb meshparts:
    Am 14.03.2026 um 21:25 schrieb Helmut Giese:
    Hm, instead of thinking that Tk is at fault I would continue
    searching. How about looking for themed Tk apps (on the wiki?) and
    learning from them?
    HTH
    Helmut
    I'm already using the awtheme.
    It does not change the color of the title bar.

    Here is written how to enable it:

    https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/apply-windows-themes

    File a ticket in Tk and perhaps somewone will work on the fix.
    AFAI you refuse to touch the C code, so you depend on the grace of
    others ;-).

    Take care,
    Harald
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Sun Mar 15 16:34:31 2026
    From Newsgroup: comp.lang.tcl

    Am 15.03.2026 um 13:26 schrieb Harald Oehlmann:
    Here is written how to enable it:

    https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/ apply-windows-themes

    File a ticket in Tk and perhaps somewone will work on the fix.
    AFAI you refuse to touch the C code, so you depend on the grace of
    others 😉.

    Take care,
    Harald
    Thanks Harald, but I guess this solution is way to complicated for me
    and my knowledge level.

    I might post a ticket then.

    Regards
    Alex
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From et99@et99@rocketship1.me to comp.lang.tcl on Sun Mar 15 16:03:34 2026
    From Newsgroup: comp.lang.tcl

    On 3/15/2026 8:34 AM, meshparts wrote:
    Am 15.03.2026 um 13:26 schrieb Harald Oehlmann:
    Here is written how to enable it:

    https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/ apply-windows-themes

    File a ticket in Tk and perhaps somewone will work on the fix.
    AFAI you refuse to touch the C code, so you depend on the grace of others 😉.

    Take care,
    Harald
    Thanks Harald, but I guess this solution is way to complicated for me and my knowledge level.

    I might post a ticket then.

    Regards
    Alex

    How badly do you want this? :)

    I got an AI to create a truly ugly script that can do this on my windows 10 system. It uses powershell and wscript. The wscript isn't actually needed, and cmd.exe can be used, but then you end up with a brief flash of the cmd window.

    Also, when the window has focus, it will still show the titlebar with the normal window color, blue in my system. It will be dark only when another window has focus.





    proc apply_dark_titlebar {win} {
    update idletasks
    set hwnd [expr {[wm frame $win]}]

    set ps_file "$::env(TEMP)/dark_titlebar.ps1"
    set vbs_file "$::env(TEMP)/dark_titlebar.vbs"

    set ps_script "\$v = 1
    \$hwnd = \[IntPtr\]${hwnd}L
    Add-Type @'
    using System;
    using System.Runtime.InteropServices;
    public class DWM {
    \[DllImport(\"dwmapi.dll\")\]
    public static extern int DwmSetWindowAttribute(IntPtr h, int a, ref int v, int s);
    }
    '@
    \[DWM\]::DwmSetWindowAttribute(\$hwnd, 19, \[ref\]\$v, 4)
    "
    set fh [open $ps_file w]
    puts $fh $ps_script
    close $fh

    set ps_native [file nativename $ps_file]
    set vbs_script "CreateObject(\"WScript.Shell\").Run \"powershell.exe -ExecutionPolicy Bypass -NonInteractive -WindowStyle Hidden -File \"\"$ps_native\"\"\", 0, True"

    set fh [open $vbs_file w]
    puts $fh $vbs_script
    close $fh

    catch { exec wscript.exe $vbs_file }

    # Force DWM to recompose by withdrawing and re-showing
    wm withdraw $win
    wm deiconify $win
    raise $win
    focus $win
    file delete $ps_file
    file delete $vbs_file
    }
    if [catch {
    package require awdark
    ::ttk::style theme use awdark
    } err_code] {
    puts $err_code
    }
    wm geom . 405x200+32+32

    ttk::frame .f
    ttk::button .f.b -text "Apply Dark Title" -command { apply_dark_titlebar . ;after 200 {console show}}
    pack .f .f.b -fill x -expand true




    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Mon Mar 16 10:59:27 2026
    From Newsgroup: comp.lang.tcl

    Thanks !
    Here is the ticket:

    https://core.tcl-lang.org/tk/info/a2125a1bc924cf98

    Take care,
    Harald

    Am 16.03.2026 um 00:03 schrieb et99:



    proc apply_dark_titlebar {win} {
        update idletasks
        set hwnd [expr {[wm frame $win]}]

        set ps_file  "$::env(TEMP)/dark_titlebar.ps1"
        set vbs_file "$::env(TEMP)/dark_titlebar.vbs"

        set ps_script "\$v = 1
    \$hwnd = \[IntPtr\]${hwnd}L
    Add-Type @'
    using System;
    using System.Runtime.InteropServices;
    public class DWM {
        \[DllImport(\"dwmapi.dll\")\]
        public static extern int DwmSetWindowAttribute(IntPtr h, int a, ref int v, int s);
    }
    '@
    \[DWM\]::DwmSetWindowAttribute(\$hwnd, 19, \[ref\]\$v, 4)
    "
        set fh [open $ps_file w]
        puts $fh $ps_script
        close $fh

        set ps_native [file nativename $ps_file]
        set vbs_script "CreateObject(\"WScript.Shell\").Run
    \"powershell.exe -ExecutionPolicy Bypass -NonInteractive -WindowStyle
    Hidden -File \"\"$ps_native\"\"\", 0, True"

        set fh [open $vbs_file w]
        puts $fh $vbs_script
        close $fh

        catch { exec wscript.exe $vbs_file }

        # Force DWM to recompose by withdrawing and re-showing
        wm withdraw $win
        wm deiconify $win
        raise $win
        focus $win
        file delete $ps_file
        file delete $vbs_file
    }
    if [catch {
        package require awdark
        ::ttk::style theme use awdark
    } err_code] {
        puts $err_code
    }
    wm geom . 405x200+32+32

    ttk::frame .f
    ttk::button .f.b -text "Apply Dark Title" -command
    { apply_dark_titlebar . ;after 200 {console show}}
    pack .f .f.b -fill x -expand true



    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Mon Mar 16 11:23:42 2026
    From Newsgroup: comp.lang.tcl

    Am 16.03.2026 um 00:03 schrieb et99:
    How badly do you want this? 🙂

    I got an AI to create a truly ugly script that can do this on my windows
    10 system. It uses powershell and wscript. The wscript isn't actually needed, and cmd.exe can be used, but then you end up with a brief flash
    of the cmd window.

    Also, when the window has focus, it will still show the titlebar with
    the normal window color, blue in my system. It will be dark only when another window has focus.
    Not that bad :)
    I appreciate the effort, but indeed, the side effects are stronger than
    the benefits.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Mon Mar 16 11:24:32 2026
    From Newsgroup: comp.lang.tcl

    Am 16.03.2026 um 10:59 schrieb Harald Oehlmann:
    Here is the ticket:

    https://core.tcl-lang.org/tk/info/a2125a1bc924cf98
    Thank you!
    --- Synchronet 3.21d-Linux NewsLink 1.2