flyingpie / windows-terminal-quake

Turn any app into a Quake-style toggleable app.
https://wtq.flyingpie.nl
MIT License
547 stars 35 forks source link

screen cleaned when losing then getting back focus #99

Closed mikemowgli closed 2 years ago

mikemowgli commented 2 years ago

When the focus is lost and the shell is hidden, then open back again, all the lines on the screen are flushed and only one prompt line is displayed at the top (as if I used the 'clear' linux command). I use v1.3 and can confirm this behavior so far for wsl and powershell.

Just in case it matters (but I don't see why it'd change anything):

flyingpie commented 2 years ago

@mikemowgli Thank you for reporting this! Could you post your config file?

worthwhileindustries commented 2 years ago

@flyingpie Here is my config. Same thing happens to me too.

{
    "$schema": "./windows-terminal-quake.schema.1.json",

    // If your editor supports it, this file should be editable with auto-completion through the included JSON schema.
    // Also, see https://flyingpie.github.io/windows-terminal-quake/ for more information.
    // Please report bugs and/or feature requests at https://github.com/flyingpie/windows-terminal-quake/issues.

    ////////////////////////////////////////////////////////////////////////////////////
    /// Hotkeys & Suppression
    ////////////////////////////////////////////////////////////////////////////////////

    // The keys that can be used to toggle the terminal.
    // See "Hotkeys" bellow for possible values.
    "Hotkeys": [
        {
            "Modifiers": "Control",
            "Key": "OemTilde"
        }
    ],

    // # HotKeys
    // ## Modifiers
    // Alt, Control, Shift, Windows
    //
    // ## Key
    // ### Special keys
    // Alt, Back, CapsLock, Control, Escape, LControlKey, LShiftKey, LWin, RControlKey, RShiftKey, RWin, Shift, Space, Tab
    //
    // ### Middle part of the keyboard
    // Delete, End, Home, Insert, PageDown, PageUp, PrintScreen
    // Down, Left, Right, Up
    //
    // ### Number keys
    // D0 - D9
    //
    // ### Letters
    // A-Z
    //
    // ### Numpad
    // NumPad0 - NumPad9
    // Add, Decimal, Divide, Multiply, NumLock, Separator, Subtract
    //
    // ### Function keys
    // F1 - F24
    //
    // ### Special characters
    // OemBackslash, OemClear, OemCloseBrackets, Oemcomma, OemMinus, OemOpenBrackets,
    // OemPeriod, OemPipe, Oemplus, OemQuestion, OemQuotes, OemSemicolon, Oemtilde
    // Oem1 - Oem8, Oem102

    // Disables toggling of the terminal window if the currently active application is running in fullscreen mode on primary monitor.
    "DisableWhenActiveAppIsInFullscreen": false,

    // Temporarily disable the toggle hotkeys when any of these processes has focus.
    "SuppressHotKeyForProcesses": [ "someprocess.exe" ],

    ////////////////////////////////////////////////////////////////////////////////////
    /// Size & Align
    ////////////////////////////////////////////////////////////////////////////////////

    // When "HorizontalScreenCoverage" is below 100, this setting determines where the terminal is place horizontally.
    // "Center", "Left" or "Right".
    "HorizontalAlign": "Center",

    // How much horizontal space the terminal should use. When this is below 100, the terminal is centered.
    // This can also be above 100, which can be useful to compensate for the window not always taking a 100% of the screen width,
    // due to the terminal being bound to column widths (eg. try 100.5 or 101).
    "HorizontalScreenCoverage": 100,

    // How much room to leave between the top of the terminal and the top of the screen.
    "VerticalOffset": 0,

    // How far the terminal should come down, in percentage (eg. 50 = half way, 100 = full screen).
    "VerticalScreenCoverage": 80,

    // Whether to maximize the terminal after it has toggled into view.
    // Note that this only applies when both "HorizontalScreenCoverage" and "VerticalScreenCoverage" are at least 100.
    "MaximizeAfterToggle": true,

    ////////////////////////////////////////////////////////////////////////////////////
    /// Toggle Animation
    ////////////////////////////////////////////////////////////////////////////////////

    // Make the window see-through (applies to the entire window, including the title bar).
    // 0 (invisible) - 100 (opaque)
    "Opacity": 95,

    // When the terminal window taskbar icon should be visible.
    // "AlwaysHidden", "AlwaysVisible", "WhenTerminalVisible".
    "TaskBarIconVisibility": "AlwaysHidden",

    // How long each frame in the toggle animation takes in milliseconds.
    // The lower this value, the smoother the animation. (If set to 0, the frame rate limiter is removed.)
    "ToggleAnimationFrameTimeMs": 25,

    // How long the toggle up/down takes in milliseconds.
    "ToggleDurationMs": 250,

    // Which animation type is used during toggle up/down.
    // "Linear", "EaseInBack", "EaseInCubic", "EaseInOutSine", "EaseInQuart", "EaseOutBack", "EaseOutCubic" or "EaseOutQuart".
    "ToggleAnimationType": "EaseOutQuart",

    /// How the terminal actually gets toggled on- and off the screen.
    /// "Resize" (default) or "Move".
    /// "Resize" should work on any setup, but may cause characters in the terminal to jump around after toggling.
    /// "Move" keeps the size of the terminal constant, but moves the terminal off-screen to the top, which won't work great with vertically stacked monitors.
    "ToggleMode": "Resize",

    ////////////////////////////////////////////////////////////////////////////////////
    /// Multi-Monitor
    ////////////////////////////////////////////////////////////////////////////////////

    // What monitor to preferrably drop the terminal
    // "WithCursor" (default), "Primary" or "AtIndex"
    "PreferMonitor": "WithCursor",

    // If "PreferMonitor" is set to "AtIndex", this setting determines what monitor to choose.
    // Zero based, eg. 0, 1, etc.
    "MonitorIndex": 1,

    ////////////////////////////////////////////////////////////////////////////////////
    /// Misc
    ////////////////////////////////////////////////////////////////////////////////////

    // Whether to keep the terminal window always on top (requires restart).
    "AlwaysOnTop": false,

    // When clicking or alt-tabbing away to another app, the terminal will automatically (and instantly) hide.
    "HideOnFocusLost": true,

    // For troubleshooting purposes.
    "LogLevel": "Error",

    // Whether to show notifications when the app starts and when the settings are reloaded.
    "Notifications": true,

    // Whether to hide the terminal window immediately after app start.
    "StartHidden": false,

    // The command/file path to execute when the app starts and Windows Terminal is not yet running.
    "WindowsTerminalCommand": "wt.exe"
}

// schema if you need it too

{
    "$schema": "http://json-schema.org/draft-04/schema",
    "$id": "windows-terminal-quake-schema-1",
    "type": "object",
    "title": "Windows Terminal Quake settings schema.",
    "properties": {
        "AlwaysOnTop": {
            "$id": "#/properties/AlwaysOnTop",

            "title": "Always on top",
            "description": "Whether to keep the terminal window always on top (requires restart).",

            "type": "boolean",
            "default": false
        },

        "DisableWhenActiveAppIsInFullscreen": {
            "$id": "#/properties/DisableWhenActiveAppIsInFullscreen",

            "title": "Disable when active app is in fullscreen",
            "description": "When the foreground window is in fullscreen, on the primary monitor, disable the hotkey toggle. This is useful for situations such as games where the terminal should be disabled.",

            "type": "boolean",
            "default": false
        },

        "HideOnFocusLost": {
            "$id": "#/properties/HideOnFocusLost",

            "title": "Hide on focus lost",
            "description": "Whether the terminal should toggle off the screen when another window gains focus.",

            "type": "boolean",
            "default": true
        },

        "HorizontalAlign": {
            "$id": "#/properties/HorizontalAlign",
            "title": "Horizontal alignment",
            "description": "When \"HorizontalScreenCoverage\" is below 100, this setting determines where the terminal is place horizontally.",

            "enum": [
                "Center",
                "Left",
                "Right"
            ],
            "default": "Center"
        },

        "HorizontalScreenCoverage": {
            "$id": "#/properties/HorizontalScreenCoverage",

            "title": "Horizontal screen coverage",
            "description": "Horizontal screen coverage, as a percentage.\n\nNote that since the terminal's size is fixed to character widths, a width of \"100\" might not cover the entire screen. To circumvent this, either use a value large than 100, or use \"MaximizeAfterToggle\".",

            "type": "integer",
            "default": 100
        },

        "Hotkeys": {
            "$id": "#/properties/Hotkeys",

            "title": "Hotkeys",
            "description": "Keys or key combinations which toggle the terminal.",

            "type": "array",
            "default": [
                {
                    "Modifiers": "Control",
                    "Key": "Oemtilde"
                }
            ],
            "examples": [
                [
                    {
                        "Modifiers": "Control",
                        "Key": "Q"
                    }
                ],
                [
                    {
                        "Modifiers": "Control",
                        "Key": "Oemtilde"
                    },
                    {
                        "Modifiers": "Control",
                        "Key": "Q"
                    }
                ]
            ],
            "items": {
                "$id": "#/properties/Hotkeys/items",
                "anyOf": [
                    {
                        "$id": "#/properties/Hotkeys/items/anyOf/0",
                        "type": "object",
                        "title": "Hotkeys",
                        "description": "Keyboard combinations for when to toggle the terminal.",

                        "required": [ "Modifiers", "Key" ],
                        "properties": {
                            "Modifiers": {
                                "$id": "#/properties/Hotkeys/items/anyOf/0/properties/Modifiers",
                                "title": "Modifiers",
                                "description": "Key modifiers, such as control, shift or alt",
                                "enum": [
                                    "Alt",
                                    "Control",
                                    "Shift",
                                    "Windows",
                                    "NoRepeat"
                                ]
                            },
                            "Key": {
                                "$id": "#/properties/Hotkeys/items/anyOf/0/properties/Key",
                                "title": "Key",
                                "description": "Key, such as a letter, a number or a symbol.",
                                "enum": [
                                    "A",
                                    "B",
                                    "C",
                                    "D",
                                    "E",
                                    "F",
                                    "G",
                                    "H",
                                    "I",
                                    "J",
                                    "K",
                                    "L",
                                    "M",
                                    "N",
                                    "O",
                                    "P",
                                    "Q",
                                    "R",
                                    "S",
                                    "T",
                                    "U",
                                    "V",
                                    "W",
                                    "X",
                                    "Y",
                                    "Z",

                                    "D0",
                                    "D1",
                                    "D2",
                                    "D3",
                                    "D4",
                                    "D5",
                                    "D6",
                                    "D7",
                                    "D8",
                                    "D9",

                                    "F1",
                                    "F2",
                                    "F3",
                                    "F4",
                                    "F5",
                                    "F6",
                                    "F7",
                                    "F8",
                                    "F9",
                                    "F10",
                                    "F11",
                                    "F12",
                                    "F13",
                                    "F14",
                                    "F15",
                                    "F16",
                                    "F17",
                                    "F18",
                                    "F19",
                                    "F20",
                                    "F21",
                                    "F22",
                                    "F23",
                                    "F24",

                                    "NumPad0",
                                    "NumPad1",
                                    "NumPad2",
                                    "NumPad3",
                                    "NumPad4",
                                    "NumPad5",
                                    "NumPad6",
                                    "NumPad7",
                                    "NumPad8",
                                    "NumPad9",

                                    "CapsLock",
                                    "Enter",
                                    "Escape",
                                    "Space",
                                    "Tab",

                                    "BrowserBack",
                                    "BrowserFavorites",
                                    "BrowserForward",
                                    "BrowserHome",
                                    "BrowserRefresh",
                                    "BrowserSearch",
                                    "BrowserStop",

                                    "Oem1",
                                    "Oem2",
                                    "Oem3",
                                    "Oem4",
                                    "Oem5",
                                    "Oem6",
                                    "Oem7",
                                    "Oem8",
                                    "Oem102",
                                    "OemBackslash",
                                    "OemClear",
                                    "OemCloseBrackets",
                                    "Oemcomma",
                                    "OemMinus",
                                    "OemOpenBrackets",
                                    "OemPeriod",
                                    "OemPipe",
                                    "Oemplus",
                                    "OemQuestion",
                                    "OemQuotes",
                                    "OemSemicolon",
                                    "Oemtilde",

                                    "Alt",
                                    "Control",
                                    "ControlKey",
                                    "LControlKey",
                                    "LMenu",
                                    "LShiftKey",
                                    "LWin",
                                    "RControlKey",
                                    "RMenu",
                                    "RShiftKey",
                                    "RWin",
                                    "Shift",
                                    "ShiftKey",

                                    "Delete",
                                    "End",
                                    "Home",
                                    "Insert",
                                    "PageDown",
                                    "PageUp",

                                    "LButton",
                                    "MButton",
                                    "RButton",

                                    "Down",
                                    "Left",
                                    "Right",
                                    "Up",

                                    "Add",
                                    "Clear",
                                    "Divide",
                                    "Multiply",
                                    "Subtract",

                                    "MediaNextTrack",
                                    "MediaPlayPause",
                                    "MediaPreviousTrack",
                                    "MediaStop",

                                    "Apps",
                                    "Attn",
                                    "Back",
                                    "Cancel",
                                    "Capital",
                                    "Crsel",
                                    "Decimal",
                                    "EraseEof",
                                    "Execute",
                                    "Exsel",
                                    "FinalMode",
                                    "HanguelMode",
                                    "HangulMode",
                                    "HanjaMode",
                                    "Help",
                                    "IMEAccept",
                                    "IMEAceept",
                                    "IMEConvert",
                                    "IMEModeChange",
                                    "IMENonconvert",
                                    "JunjaMode",
                                    "KanaMode",
                                    "KanjiMode",
                                    "KeyCode",
                                    "LaunchApplication1",
                                    "LaunchApplication2",
                                    "LaunchMail",
                                    "LineFeed",
                                    "Menu",
                                    "Modifiers",
                                    "Next",
                                    "NoName",
                                    "None",
                                    "NumLock",
                                    "Pa1",
                                    "Packet",
                                    "Pause",
                                    "Play",
                                    "Print",
                                    "PrintScreen",
                                    "Prior",
                                    "ProcessKey",
                                    "Return",
                                    "Scroll",
                                    "Select",
                                    "SelectMedia",
                                    "Separator",
                                    "Sleep",
                                    "Snapshot",
                                    "VolumeDown",
                                    "VolumeMute",
                                    "VolumeUp",
                                    "XButton1",
                                    "XButton2",
                                    "Zoom"
                                ]
                            }
                        }
                    }
                ]
            }
        },

        "LogLevel": {
            "$id": "#/properties/LogLevel",

            "title": "Log level",
            "description": "Minimum level of events that are logged.",

            "enum": [
                "Verbose",
                "Debug",
                "Information",
                "Warning",
                "Error",
                "Fatal"
            ],
            "default": "Error"
        },

        "MaximizeAfterToggle": {
            "$id": "#/properties/MaximizeAfterToggle",

            "title": "Maximize after toggle",
            "description": "Whether to maximize the terminal after it has toggled into view.\nNote that this only applies when both HorizontalScreenCoverage and VerticalScreenCoverage are at least 100.",

            "type": "boolean",
            "default": true
        },

        "MonitorIndex": {
            "$id": "#/properties/MonitorIndex",

            "title": "Monitor index",
            "description": "When \"PreferMonitor\" is set to \"AtIndex\", this setting controls what monitor to toggle on. 0-based, eg. \"0\", \"1\", etc.",

            "type": "integer",
            "default": 0
        },

        "Notifications": {
            "$id": "#/properties/Notifications",

            "title": "Toggle notifications",
            "description": "Enable Windows taskbar notifications on events such as settings reload.",

            "type": "boolean",
            "default": true
        },

        "Opacity": {
            "$id": "#/properties/Opacity",

            "title": "Window opacity",
            "description": "Static window opacity, note that this applies to the entire window, including the tabs bar.",

            "type": "integer",
            "default": 80
        },

        "PreferMonitor": {
            "$id": "#/properties/PreferMonitor",

            "title": "Prefer monitor",
            "description": "What monitor the terminal should target when toggling on. When using \"AtIndex\" use the \"MonitorIndex\"-setting to determine the monitor.",

            "enum": [
                "WithCursor",
                "Primary",
                "AtIndex"
            ],
            "default": "WithCursor"
        },

        "StartHidden": {
            "$id": "#/properties/StartHidden",

            "title": "Start hidden",
            "description": "Whether to start the Windows Terminal app in the background, for use when eg. running on system boot.",

            "type": "boolean",
            "default": false
        },

        "SuppressHotkeyForProcesses": {
            "$id": "#/properties/SuppressHotkeyForProcesses",

            "title": "Suppress hotkeys for processes",
            "description": "Temporarily disable the toggle hotkeys when any of these processes has focus.",

            "type": "array",
            "default": [ "someprocess.exe" ]
        },

        "TaskbarIconVisibility": {
            "$id": "#/properties/TaskbarIconVisibility",

            "title": "Taskbar icon visibility",
            "description": "When to show the terminal window icon on the taskbar.",

            "enum": [
                "AlwaysHidden",
                "AlwaysVisible",
                "WhenTerminalVisible"
            ],
            "default": "AlwaysHidden"
        },

        "ToggleAnimationFrameTimeMs": {
            "$id": "#/properties/ToggleAnimationFrameTimeMs",

            "title": "Toggle animation frame time ms",
            "description": "Target time between animation frames.",

            "type": "integer",
            "default": 25
        },

        "ToggleAnimationType": {
            "$id": "#/properties/ToggleAnimationType",

            "title": "Toggle animation type",
            "description": "Which animation type is used during toggle up/down.",

            "enum": [
                "Linear",
                "EaseInBack",
                "EaseInCubic",
                "EaseInOutSine",
                "EaseInQuart",
                "EaseOutBack",
                "EaseOutCubic",
                "EaseOutQuart"
            ],
            "default": "EaseOutQuart"
        },

        "ToggleDurationMs": {
            "$id": "#/properties/ToggleDurationMs",

            "title": "Toggle duration ms",
            "description": "How long the toggle up/down takes in milliseconds.",

            "type": "integer",
            "default": 250
        },

        "ToggleMode": {
            "$id": "#/properties/ToggleMode",

            "title": "Toggle mode",
            "description": "How the terminal actually gets toggled on- and off the screen.\n\nDefault \"Resize\" should work on any setup, but may cause character jumping due to the terminal changing shape.\n\n\"Move\" prevents this, but may not work with vertical monitor setups, pushing the terminal onto the northern monitor.",

            "enum": [
                "Move",
                "Resize"
            ],
            "default": "Resize"
        },

        "VerticalOffset": {
            "$id": "#/properties/VerticalOffset",

            "title": "Vertical offset",
            "description": "How much room to leave between the top of the terminal and the top of the screen.",

            "type": "integer",
            "default": 0
        },

        "VerticalScreenCoverage": {
            "$id": "#/properties/VerticalScreenCoverage",

            "title": "Vertical screen coverage",
            "description": "Vertical screen coverage as a percentage (0-100).",

            "type": "integer",
            "default": 100
        }
    }
}
worthwhileindustries commented 2 years ago

@flyingpie looks like same version

image

mikemowgli commented 2 years ago

here's mine

{
    "$schema": "./windows-terminal-quake.schema.1.json",
    "Hotkeys": [
        {
            "Modifiers": "Control",
            "Key": "OemTilde"
        },
        {
            "Key": "F10"
        }
    ],
    "DisableWhenActiveAppIsInFullscreen": false,
    "SuppressHotKeyForProcesses": [ "someprocess.exe" ],
    "HorizontalAlign": "Center",
    "HorizontalScreenCoverage": 100,
    "VerticalOffset": 0,
    "VerticalScreenCoverage": 100,
    "MaximizeAfterToggle": true,
    "Opacity": 100,
    "TaskBarIconVisibility": "AlwaysVisible",
    "ToggleAnimationFrameTimeMs": 25,
    "ToggleDurationMs": 0,
    "ToggleAnimationType": "Linear",
    "ToggleMode": "Resize",
    "PreferMonitor": "WithCursor",
    "MonitorIndex": 1,
    "AlwaysOnTop": false,
    "HideOnFocusLost": true,
    "LogLevel": "Error",
    "Notifications": true,
    "StartHidden": false,
    "WindowsTerminalCommand": "wt.exe"
}
flyingpie commented 2 years ago

@mikemowgli @worthwhileindustries Thank you guys for posting your configs!

Could you try changing this:

"ToggleMode": "Resize"

To this:

"ToggleMode": "Move"

Let me know what happens! :)

mikemowgli commented 2 years ago

It works! Thank you very much!

worthwhileindustries commented 2 years ago

Works for me too. thanks!

flyingpie commented 2 years ago

@mikemowgli @worthwhileindustries Thank you for reporting back. The 1.3 release has "Move" as the default, since vertical setups are a little more rare than the character jumping.