Skip to content

Commit

Permalink
FocusHint: Add a focus hint
Browse files Browse the repository at this point in the history
This commits  basically integrates https://github.com/Leleat/focus-indicator-prototype
into Tiling Assistant. The other extension was just a prototype in
cooperation with a GNOME Designer. But it is more polished than the
active window hint that is currently in Tiling Assistant. I did some
slight refactoring. I also removed the focus indication when using
swipe gestures since the animation didn't work quite well (and had
a bug during the animation with multiple monitors).

This time however, the focus hint will be disabled by default as I don't
believe it is that useful of a feature anymore, it deviates a bit too
much from the stock GNOME behavior, and it may even be an unexpected
behavior from a users perspective, if they don't know what it is or how
it gets triggered. This is feature is also less tested as they are a lot
of permutations of situations to test (multi-monitor, workspaces on all/
primary display, etc). Additionally, it is put behind the advanced and
experimental settings toggle. Some of the settings for the focus hint
are not exposed in the UI (like the outline border radius, outline)
because I'd like to cut down on the settings. Even putting them behind
the advanced toggle doesn't feel good because eventually the advanced
settings will grow so big that there is at least one setting for someone
out there, which will eventually make the advanced settings 'mandatory'.
I kinda regret exposing so many settings in the prefs UI... oh well.

Fixes #306
Fixes #222
  • Loading branch information
Leleat committed May 19, 2024
1 parent 93f1edc commit 8cc7052
Show file tree
Hide file tree
Showing 7 changed files with 1,004 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tiling-assistant@leleat-on-github/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import KeybindingHandler from './src/extension/keybindingHandler.js';
import LayoutsManager from './src/extension/layoutsManager.js';
import ActiveWindowHint from './src/extension/activeWindowHint.js';
import AltTabOverride from './src/extension/altTab.js';
import FocusHintManager from './src/extension/focusHint.js';
import { Rect } from './src/extension/utility.js';

/**
Expand Down Expand Up @@ -161,6 +162,7 @@ export default class TilingAssistantExtension extends Extension {
this._keybindingHandler = new KeybindingHandler();
this._layoutsManager = new LayoutsManager();
this._activeWindowHintHandler = new ActiveWindowHint();
this._focusHintManager = new FocusHintManager();
this._altTabOverride = new AltTabOverride();

// Disable native tiling.
Expand Down Expand Up @@ -241,6 +243,8 @@ export default class TilingAssistantExtension extends Extension {
this._layoutsManager = null;
this._activeWindowHintHandler.destroy();
this._activeWindowHintHandler = null;
this._focusHintManager.destroy();
this._focusHintManager = null;

this._altTabOverride.destroy();
this._altTabOverride = null;
Expand Down
14 changes: 11 additions & 3 deletions tiling-assistant@leleat-on-github/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ export default class Prefs extends ExtensionPreferences {
'screen-left-gap',
'screen-right-gap',
'screen-bottom-gap',
'active-window-hint-border-size',
'active-window-hint-inner-border-size',
'focus-hint-outline-size',
'toggle-maximize-tophalf-timer',
'vertical-preview-area',
'horizontal-preview-area'
Expand Down Expand Up @@ -135,7 +134,7 @@ export default class Prefs extends ExtensionPreferences {
*/
_bindColorButtons(settings, builder) {
const switches = [
'active-window-hint-color'
'focus-hint-color'
];

switches.forEach(key => {
Expand Down Expand Up @@ -177,6 +176,15 @@ export default class Prefs extends ExtensionPreferences {
'active_window_hint_always_row'
]
},
{
key: 'focus-hint',
rowNames: [
'disabled_focus_hint_row',
'animated_outline_focus_hint_row',
'animated_upscale_focus_hint_row',
'static_outline_focus_hint_row'
]
},
{
key: 'default-move-mode',
rowNames: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
<!-- 0: Disabled, 1: Focus, 2: Tiling State, 3: Tiling State (Windows), 4: Favorite Layout -->
<default>0</default>
</key>
<key name="focus-hint" type="i">
<default>0</default>
</key>
<key name="focus-hint-color" type="s">
<default>''</default>
</key>
<key name="focus-hint-outline-border-radius" type="i">
<default>8</default>
</key>
<key name="focus-hint-outline-size" type="i">
<default>8</default>
</key>
<key name="active-window-hint" type="i">
<!-- 0: Disabled, 1: Minimal, 2: Always -->
<default>1</default>
Expand Down
7 changes: 7 additions & 0 deletions tiling-assistant@leleat-on-github/src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ export class DynamicKeybindings {
static FAVORITE_LAYOUT = 4;
}

export const FocusHint = Object.freeze({
DISABLED: 0,
ANIMATED_OUTLINE: 1,
ANIMATED_UPSCALE: 2,
STATIC_OUTLINE: 3
});

export class MoveModes {
// Order comes from prefs
static EDGE_TILING = 0;
Expand Down
2 changes: 2 additions & 0 deletions tiling-assistant@leleat-on-github/src/dependencies/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ export {
gettext as _
} from 'resource:///org/gnome/shell/extensions/extension.js';

export * as AppFavorites from 'resource:///org/gnome/shell/ui/appFavorites.js';
export * as AltTab from 'resource:///org/gnome/shell/ui/altTab.js';
export * as Main from 'resource:///org/gnome/shell/ui/main.js';
export * as OsdWindow from 'resource:///org/gnome/shell/ui/osdWindow.js';
export * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
export * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
export * as SwitcherPopup from 'resource:///org/gnome/shell/ui/switcherPopup.js';
Expand Down
Loading

0 comments on commit 8cc7052

Please sign in to comment.