Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Forcing Discord on Linux to have native titlebar

Not a lot to say other than the contents of the script.

files/2025/listings/discord-use-native-titlebar.sh (Source)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# File: discord-use-native-titlebar.sh
# Location: ~/bin
# Author: bgstack15
# Startdate: 2025-12-03-4 20:23
# Title: Force Discord to Use Native Titlebar
# Purpose: Turn on fluxbox titlebar to discord
# History:
#    2025-12-01 after OS updates, this version of Discord (an electron app) really does not want the native titlebar enabled. I wanted to still use it.
# Usage:
#    Run it after Discord is running
# Reference:
#    See documentation
# Improve:
# Dependencies:
#    dep-binaries: xdotool, xprop
#    dep-devuan: x11-utils, xdotool
# Documentation:
#    https://bgstack15.ddns.net/blog/posts/2025/12/21/forcing-discord-on-linux-to-have-native-titlebar/
for win in $( xdotool search --name '.*- Discord' ) ;
do
    # Not sure if this is different or better.
    #xprop -id "${win}" -f _MOTIF_WM_HINTS 32c -set _MOTIF_WM_HINTS "0x2, 0x0, 0x1, 0x0, 0x0"
    xprop -id "${win}" -f _MOTIF_WM_HINTS 32c -set _MOTIF_WM_HINTS "0x2, 0x0, 0x0, 0x0"
    # and then remap it to get all the decorations (titlebar, including its buttons) immediately
    xdotool windowunmap "${win}" windowmap "${win}"
done

References

Web searches

xprop _MOTIF_WM_HINTS display titlebar

To display the title bar of a window using _MOTIF_WM_HINTS, you can set the hint to indicate that the window should be decorated. You can use the command: xprop -name "WindowName" -f _MOTIF_WM_HINTS 32c -set \_MOTIF_WM_HINTS "0x2, 0x0, 0x1, 0x0, 0x0" where "WindowName" is the name of your window. Arch Linux forums.bunsenlabs.org

Web links

  1. [solved] Undecorate a single window in Gnome Shell / Applications & Desktop Environments / Arch Linux Forums
  2. How to Undecorate window at command line (any method will do) / GUI & Applications / BunsenLabs Linux Forums

Comments