Skip to content

Conversation

@Charles-Kaminski
Copy link

Some applications can't be matched using wm_class or window title, especially when installed via Snap. For example, the Snap-packaged version of Firefox (the default install for Ubuntu) ignores wm_class and rewrites window titles.

This commit introduces a new mode, "match-cmdline", which enables matching windows based on the full launch command, including arguments. This adds a useful general-purpose capability and, in particular, allows users to assign separate shortcuts to different Firefox profiles under Ubuntu and apply run-or-raise behavior to each.

Some applications can't be matched using wm_class or window title, especially when installed via Snap. For example, the Snap-packaged version of Firefox (the default install for Ubuntu) often ignores wm_class and sets inconsistent window titles.

This commit introduces a new mode, "match-cmdline", which enables matching windows based on the full launch command, including arguments. This adds a useful general-purpose capability and, in particular, allows users to assign separate shortcuts to different Firefox profiles under Ubuntu  and apply run-or-raise behavior to each.
Stops tracking schemas.compiled
@e3rd
Copy link
Member

e3rd commented Aug 4, 2025

Very clever, seems great to me! I'll try to check thoroughly soon

Copy link
Member

@e3rd e3rd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, thanks! To be aligned with the code style, could you remove semicolons and use {} around return statements too?

import Gio from 'gi://Gio'
import GLib from 'gi://GLib'
import Mtk from 'gi://Mtk'
import * as Main from 'resource:///org/gnome/shell/ui/main.js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the Main is not used in your code, what's the purpose here?

@@ -1 +1,3 @@
build
notes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What creates the notes file? I tend to have the code short, if it is unlikely the notes will be created on other machines, I prefer to put such things info .git/info/exclude instead

if (!ok) return "";

try {
const file = Gio.File.new_for_path(`/proc/${pid}/cmdline`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines (which might be perfomance-inefficient) are run twice. Is it on purpose?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants