Gemini UI Deep Customization (Smooth Native Animations)

Sets chat width and sidebar width. Overrides native CSS variables to keep animations smooth, plus font and nav item tweaks.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Advertisement:

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Advertisement:

// ==UserScript==
// @name         Gemini UI Deep Customization (Smooth Native Animations)
// @name:zh-CN   Gemini 界面深度定制(保留原生动画顺滑版)
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Sets chat width and sidebar width. Overrides native CSS variables to keep animations smooth, plus font and nav item tweaks.
// @description:zh-CN  修改聊天宽度、侧边栏宽度。劫持原生 CSS 变量保留动画顺滑,并调整字体与列表项高度。
// @icon         https://www.gstatic.com/lamda/images/gemini_sparkle_aurora_33f86dc0c0257da337c63.svg
// @author       Joe_Ye
// @license      MIT
// @match        https://gemini.google.com/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const css = `
        /* 1. 聊天对话区域:修改为固定 1000px */
        .conversation-container,
        div[class*="conversation-container"] {
            max-width: 1050px !important;
            width: 100% !important;
        }

        /* 2. 全局注入侧边栏的 CSS 变量,让所有组件都能读取到 */
        /* 原生收起宽度为 72px,所以新的差值 (diff) 是 500 - 72 = 428px */
        :root, body, bard-sidenav, bard-mode-switcher, top-bar-actions {
            --bard-sidenav-open-width: 380px !important;
            --bard-sidenav-open-closed-width-diff: 308px !important;
        }

        /* 3. 修复顶部栏展开时的位置 */
        /* 利用原生的 .side-nav-expanded 状态类,不破坏收起时的状态 */
        .side-nav-expanded,
        [dir="ltr"] .side-nav-expanded {
            left: 380px !important;
        }

        /* 4. 修改指定字体大小和列表项高度 */
        .gds-emphasized-body-s {
            font-size: 13pt !important; /* 选中项 (已修复注释格式) */
        }

        .title-text.gds-body-s,
        .gds-body-s,
        .title-text.gds-emphasized-body-s {
            font-size: 13pt !important;
            line-height: normal !important; /* 禁用并重置原有的 line-height */
        }

        :not(.is-mobile) .gem-nav-list-item.gmat-override {
            height: 45px !important;
        }
    `;

    const injectStyle = () => {
        if (document.head) {
            const oldStyle = document.getElementById('gemini-custom-fix-v6');
            if (oldStyle) oldStyle.remove();

            const style = document.createElement('style');
            style.id = 'gemini-custom-fix-v6';
            style.textContent = css;
            document.head.appendChild(style);
        }
    };

    injectStyle();

    const observer = new MutationObserver(() => {
        if (document.head && !document.getElementById('gemini-custom-fix-v6')) {
            injectStyle();
        }
    });

    observer.observe(document.documentElement, { childList: true, subtree: true });
})();