no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


howtos:change_window_title [2018/11/30 15:15] (current) – initial commit :) urist_mcgeorge
Line 1: Line 1:
 +===== Changing Geany window title text =====
 +
 +The idea is that I regularly work on a couple of repos at the same time, and can have like five Geany windows open, with three of them showing say 'requirements.txt - [...'. I'd prefer to have the window title to start with the project name so I know which window is which project. I thought of patching Geany itself like https://github.com/geany/geany/pull/290, but I am not really proficient in C, so I went for weird Python/Xfce solution.
 +
 +Here it is:
 +
 +1. Run:
 +<code bash>
 +sudo apt install wmctrl xdotool
 +</code>
 +
 +2. Save this script anywhere, name it anything, mine is '~/scripts/change geany titles.py'
 +<code python>
 +import subprocess
 +from time import sleep
 +
 +while True:
 +    windows_details = subprocess.run(['wmctrl', '-l'], stdout=subprocess.PIPE).stdout.decode('UTF-8')
 +    for window_details in windows_details.splitlines():
 +        window_id, _, title = window_details.split(maxsplit=2)
 +        if '] - Geany' in title:
 +            new_title = title[title.find(' [')+2:].replace(' (new instance)', '').replace(']','')
 +            subprocess.run(['xdotool', 'set_window', '--name', new_title, window_id])
 +    sleep(0.1)
 +</code>
 +
 +3. To autostart this, as I use Xfce, I created this '~/.config/autostart/geany titles.desktop' file:
 +<code>
 +[Desktop Entry]
 +Encoding=UTF-8
 +Version=0.9.4
 +Type=Application
 +Name=geany titles
 +Comment=change geany window titles to start with the project
 +Exec=python3 "/home/<your username goes here>/scripts/change geany titles.py"
 +OnlyShowIn=XFCE;
 +StartupNotify=false
 +Terminal=false
 +Hidden=false
 +</code>
 +
 +Hope this helps somebody :)
  
Print/export