From baf0ee5255225fe58e2aeed7b38de194e21959fa Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 22 Dec 2024 09:24:18 +0000 Subject: [PATCH 1/4] feat(wezterm): add wezterm config --- .gitignore | 2 + bootstrap/Windows.ps1 | 7 +- {scripts => tools/powershell}/Completions.ps1 | 1 + tools/powershell/Config.ps1 | 15 ++- tools/powershell/Modules.ps1 | 2 +- tools/powershell/Prompt.ps1 | 2 +- tools/wezterm/wezterm.lua | 121 ++++++++++++++++++ 7 files changed, 142 insertions(+), 8 deletions(-) rename {scripts => tools/powershell}/Completions.ps1 (78%) create mode 100644 tools/wezterm/wezterm.lua diff --git a/.gitignore b/.gitignore index e5cd05f..32a3502 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ common/fzfrc platforms/win/komorebi/applications.json gitconfig + +check_update diff --git a/bootstrap/Windows.ps1 b/bootstrap/Windows.ps1 index 2c1046d..4d59e65 100644 --- a/bootstrap/Windows.ps1 +++ b/bootstrap/Windows.ps1 @@ -16,10 +16,9 @@ Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression # Set Environment Variables # Use %PATH_EXT% to prevent PATH from being too long [System.Environment]::SetEnvironmentVariable("Path_EXT_0", "D:\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\jsony\AppData\Local\Cargo\bin", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\jsony\AppData\Local\Go\bin", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\jsony\AppData\Local\Cargo\bin", "User") $currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User") if ($currentPath -notlike "*%PATH_EXT%*") { $currentPath += ";%PATH_EXT_0%;%PATH_EXT_1%;%PATH_EXT_2%" diff --git a/scripts/Completions.ps1 b/tools/powershell/Completions.ps1 similarity index 78% rename from scripts/Completions.ps1 rename to tools/powershell/Completions.ps1 index 2050048..5db5e55 100644 --- a/scripts/Completions.ps1 +++ b/tools/powershell/Completions.ps1 @@ -5,5 +5,6 @@ function Invoke-Completion { 'git' { Import-Module Posh-Git } 'hugo' { hugo completion powershell | Out-String | Invoke-Expression } 'pip' { pip completion --powershell | Out-String | Invoke-Expression } + 'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression } } } diff --git a/tools/powershell/Config.ps1 b/tools/powershell/Config.ps1 index e7cb656..4d5ed8c 100644 --- a/tools/powershell/Config.ps1 +++ b/tools/powershell/Config.ps1 @@ -1,7 +1,18 @@ # Use XDG Base Directory Specification and its similar structure for Windows # wget -${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args} +if (Get-Command wget -ErrorAction SilentlyContinue) { + ${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args} +} # yarn v1 -${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args} +if (Get-Command yarn -ErrorAction SilentlyContinue) { + ${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args} +} + +if ($Env:WEZTERM) { # Environment variable injected by wezterm/wezterm.lua + ${function:icat} = {wezterm imgcat $args} +} +elseif ($Env:KITTY) { + ${function:icat} = {kitty +kitten icat $args} +} diff --git a/tools/powershell/Modules.ps1 b/tools/powershell/Modules.ps1 index 0137d59..8236f40 100644 --- a/tools/powershell/Modules.ps1 +++ b/tools/powershell/Modules.ps1 @@ -1,4 +1,4 @@ -Import-Module -Name Terminal-Icons +# Import-Module -Name Terminal-Icons Import-Module -Name CompletionPredictor if ($IsWindows) { # Chocolatey diff --git a/tools/powershell/Prompt.ps1 b/tools/powershell/Prompt.ps1 index 9f43a8a..da645ef 100644 --- a/tools/powershell/Prompt.ps1 +++ b/tools/powershell/Prompt.ps1 @@ -4,7 +4,7 @@ # Use starship to set prompt $ENV:STARSHIP_CONFIG = Join-Path $DOTFILES "tools" "starship" "starship_pwsh.toml" -# Invoke-Expression (&starship init powershell) +Invoke-Expression (&starship init powershell) # Below is the backup of original prompt function # $promptTime = $true diff --git a/tools/wezterm/wezterm.lua b/tools/wezterm/wezterm.lua new file mode 100644 index 0000000..3c8affb --- /dev/null +++ b/tools/wezterm/wezterm.lua @@ -0,0 +1,121 @@ +-- $DOTFILES/tools\wezterm\wezterm.lua +-- Date: 2024-12-22 +-- Author: js0ny + +-- Location: +-- $XDG_CONFIG_HOME/wezterm/wezterm.lua +-- Linking: +-- ln -sf $DOTFILES/tools/wezterm/wezterm.lua $XDG_CONFIG_HOME/wezterm/wezterm.lua + +local wezterm = require 'wezterm' + +local config = {} + +local os_type = "" +if package.config:sub(1,1) == "\\" then + -- Windows + os_type = "Windows" +elseif package.config:sub(1,1) == "/" then + -- Unix-like (Linux, macOS, etc.) + if os.getenv("HOME") then + os_type = "Unix-like" + -- You can differentiate further by checking for macOS or Linux if needed + if os.getenv("XDG_SESSION_TYPE") then + -- Likely Linux + os_type = "Linux" + elseif os.execute("uname -s | grep -i darwin") == 0 then + -- macOS + os_type = "macOS" + end + end +end + +print("[DEBUG] Detected OS: " .. os_type) + + +-- Appearance +------------------ +-- Font and color scheme +config.font = wezterm.font("FiraCode Nerd Font") +config.color_scheme = "Ayu Mirage" +config.font_size = 12.0 +if os_type == "Windows" then + config.window_background_opacity = 0.7 + config.win32_system_backdrop = 'Acrylic' +end +-- Tab appearance +config.hide_tab_bar_if_only_one_tab = true +config.tab_bar_at_bottom = true + +-- Keybindings +------------------ +config.leader = { key="q", mods="CTRL" } +config.keys = { + { + key = 'q', + mods = 'LEADER', + action = wezterm.action.SendKey {key = 'q', mods = 'CTRL'}, + }, + -- Windows Management + { + key = '|', + mods = 'LEADER|SHIFT', + action = wezterm.action.SplitHorizontal{domain="CurrentPaneDomain"} + }, + { + key = '-', + mods = 'LEADER', + action = wezterm.action.SplitVertical{domain="CurrentPaneDomain"} + }, + { + key = 'h', + mods = 'LEADER', + action = wezterm.action.ActivatePaneDirection 'Left' + }, + { + key = 'n', + mods = 'LEADER', + action = wezterm.action.ActivatePaneDirection 'Down' + }, + { + key = 'e', + mods = 'LEADER', + action = wezterm.action.ActivatePaneDirection 'Up' + }, + { + key = 'i', + mods = 'LEADER', + action = wezterm.action.ActivatePaneDirection 'Right' + }, + { + key = 'H', + mods = 'LEADER', + action = wezterm.action.AdjustPaneSize { 'Left', 5 }, + }, + { + key = 'N', + mods = 'LEADER', + action = wezterm.action.AdjustPaneSize { 'Down', 5 }, + }, + { + key = 'E', + mods = 'LEADER', + action = wezterm.action.AdjustPaneSize { 'Up', 5 }, + }, + { + key = 'I', + mods = 'LEADER', + action = wezterm.action.AdjustPaneSize { 'Right', 5 }, + }, +} +-- Environment +------------------ +if os_type == "Windows" then + config.default_prog = { "pwsh.exe" } +else + config.default_prog = { "fish" } +end +config.set_environment_variables = { + WEZTERM="true", +} +return config From 4657765e21a58564fa5486990c7c9f025dc85eee Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 25 Dec 2024 05:57:41 +0000 Subject: [PATCH 2/4] Add lazygit keybindings --- common/lazygit.yaml | 606 ++++++++++++++++++ .../win/fastfetch.jsonc | 4 +- tools/powershell/Aliases.ps1 | 3 +- tools/powershell/Completions.ps1 | 22 + tools/powershell/Keymap.ps1 | 3 + tools/powershell/readme.md | 17 + 6 files changed, 652 insertions(+), 3 deletions(-) create mode 100644 common/lazygit.yaml rename tools/fastfetch/win.jsonc => platforms/win/fastfetch.jsonc (96%) diff --git a/common/lazygit.yaml b/common/lazygit.yaml new file mode 100644 index 0000000..c4a5cc5 --- /dev/null +++ b/common/lazygit.yaml @@ -0,0 +1,606 @@ +# $DOTFILES/common/lazygit.yaml +# Date: 2024-12-22 +# Author: js0ny + +# Location: +# macOS: ~/Library/Application Support/lazygit/config.yml +# Linux: ~/.config/lazygit/config.yml +# Windows: %APPDATA%\lazygit\config.yml + +yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json + +# Config relating to the Lazygit UI +gui: + # The number of lines you scroll by when scrolling the main window + scrollHeight: 2 + + # If true, allow scrolling past the bottom of the content in the main window + scrollPastBottom: true + + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#scroll-off-margin + scrollOffMargin: 2 + + # One of: 'margin' (default) | 'jump' + scrollOffBehavior: margin + + # If true, capture mouse events. + # When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS. + mouseEvents: true + + # If true, do not show a warning when discarding changes in the staging view. + skipDiscardChangeWarning: false + + # If true, do not show warning when applying/popping the stash + skipStashWarning: false + + # If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files. + skipNoStagedFilesWarning: false + + # If true, do not show a warning when rewording a commit via an external editor + skipRewordInEditorWarning: false + + # Fraction of the total screen width to use for the left side section. You may want to pick a small number (e.g. 0.2) if you're using a narrow screen, so that you can see more of the main section. + # Number from 0 to 1.0. + sidePanelWidth: 0.3333 + + # If true, increase the height of the focused side window; creating an accordion effect. + expandFocusedSidePanel: false + + # The weight of the expanded side panel, relative to the other panels. 2 means + # twice as tall as the other panels. Only relevant if `expandFocusedSidePanel` is true. + expandedSidePanelWeight: 2 + + # Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split. + # Options are: + # - 'horizontal': split the window horizontally + # - 'vertical': split the window vertically + # - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically + mainPanelSplitMode: flexible + + # How the window is split when in half screen mode (i.e. after hitting '+' once). + # Possible values: + # - 'left': split the window horizontally (side panel on the left, main view on the right) + # - 'top': split the window vertically (side panel on top, main view below) + enlargedSideViewLocation: left + + # One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru' + language: auto + + # Format used when displaying time e.g. commit time. + # Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format + timeFormat: 02 Jan 06 + + # Format used when displaying time if the time is less than 24 hours ago. + # Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format + shortTimeFormat: 3:04PM + + # Config relating to colors and styles. + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#color-attributes + theme: + # Border color of focused window + activeBorderColor: + - green + - bold + + # Border color of non-focused windows + inactiveBorderColor: + - default + + # Border color of focused window when searching in that window + searchingActiveBorderColor: + - cyan + - bold + + # Color of keybindings help text in the bottom line + optionsTextColor: + - blue + + # Background color of selected line. + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line + selectedLineBgColor: + - blue + + # Background color of selected line when view doesn't have focus. + inactiveViewSelectedLineBgColor: + - bold + + # Foreground color of copied commit + cherryPickedCommitFgColor: + - blue + + # Background color of copied commit + cherryPickedCommitBgColor: + - cyan + + # Foreground color of marked base commit (for rebase) + markedBaseCommitFgColor: + - blue + + # Background color of marked base commit (for rebase) + markedBaseCommitBgColor: + - yellow + + # Color for file with unstaged changes + unstagedChangesColor: + - red + + # Default text color + defaultFgColor: + - default + + # Config relating to the commit length indicator + commitLength: + # If true, show an indicator of commit message length + show: true + + # If true, show the '5 of 20' footer at the bottom of list views + showListFooter: true + + # If true, display the files in the file views as a tree. If false, display the files as a flat list. + # This can be toggled from within Lazygit with the '~' key, but that will not change the default. + showFileTree: true + + # If true, show the number of lines changed per file in the Files view + showNumstatInFilesView: false + + # If true, show a random tip in the command log when Lazygit starts + showRandomTip: true + + # If true, show the command log + showCommandLog: true + + # If true, show the bottom line that contains keybinding info and useful buttons. If false, this line will be hidden except to display a loader for an in-progress action. + showBottomLine: true + + # If true, show jump-to-window keybindings in window titles. + showPanelJumps: true + + # Deprecated: use nerdFontsVersion instead + showIcons: false + + # Nerd fonts version to use. + # One of: '2' | '3' | empty string (default) + # If empty, do not show icons. + nerdFontsVersion: "" + + # If true (default), file icons are shown in the file views. Only relevant if NerdFontsVersion is not empty. + showFileIcons: true + + # Length of author name in (non-expanded) commits view. 2 means show initials only. + commitAuthorShortLength: 2 + + # Length of author name in expanded commits view. 2 means show initials only. + commitAuthorLongLength: 17 + + # Length of commit hash in commits view. 0 shows '*' if NF icons aren't on. + commitHashLength: 8 + + # If true, show commit hashes alongside branch names in the branches view. + showBranchCommitHash: false + + # Whether to show the divergence from the base branch in the branches view. + # One of: 'none' | 'onlyArrow' | 'arrowAndNumber' + showDivergenceFromBaseBranch: none + + # Height of the command log view + commandLogSize: 8 + + # Whether to split the main window when viewing file changes. + # One of: 'auto' | 'always' + # If 'auto', only split the main window when a file has both staged and unstaged changes + splitDiff: auto + + # Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default). + # One of: 'normal' (default) | 'half' | 'full' + windowSize: normal + + # Window border style. + # One of 'rounded' (default) | 'single' | 'double' | 'hidden' + border: rounded + + # If true, show a seriously epic explosion animation when nuking the working tree. + animateExplosion: true + + # Whether to stack UI components on top of each other. + # One of 'auto' (default) | 'always' | 'never' + portraitMode: auto + + # How things are filtered when typing '/'. + # One of 'substring' (default) | 'fuzzy' + filterMode: substring + + # Config relating to the spinner. + spinner: + # The frames of the spinner animation. + frames: + - "|" + - / + - "-" + - \ + + # The "speed" of the spinner in milliseconds. + rate: 50 + + # Status panel view. + # One of 'dashboard' (default) | 'allBranchesLog' + statusPanelView: dashboard + + # If true, jump to the Files panel after popping a stash + switchToFilesAfterStashPop: true + + # If true, jump to the Files panel after applying a stash + switchToFilesAfterStashApply: true + + # If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead + switchTabsWithPanelJumpKeys: false + +# Config relating to git +git: + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md + paging: + # Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never' + colorArg: always + + # e.g. + # diff-so-fancy + # delta --dark --paging=never + # ydiff -p cat -s --wrap --width={{columnWidth}} + pager: "" + + # If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). + useConfig: false + + # e.g. 'difft --color=always' + externalDiffCommand: "" + + # Config relating to committing + commit: + # If true, pass '--signoff' flag when committing + signOff: false + + # Automatic WYSIWYG wrapping of the commit message as you type + autoWrapCommitMessage: true + + # If autoWrapCommitMessage is true, the width to wrap to + autoWrapWidth: 72 + + # Config relating to merging + merging: + # If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang + # Only applicable to unix users. + manualCommit: false + + # Extra args passed to `git merge`, e.g. --no-ff + args: "" + + # The commit message to use for a squash merge commit. Can contain "{{selectedRef}}" and "{{currentBranch}}" placeholders. + squashMergeMessage: Squash merge {{selectedRef}} into {{currentBranch}} + + # list of branches that are considered 'main' branches, used when displaying commits + mainBranches: + - master + - main + + # Prefix to use when skipping hooks. E.g. if set to 'WIP', then pre-commit hooks will be skipped when the commit message starts with 'WIP' + skipHookPrefix: WIP + + # If true, periodically fetch from remote + autoFetch: true + + # If true, periodically refresh files and submodules + autoRefresh: true + + # If true, pass the --all arg to git fetch + fetchAll: true + + # If true, lazygit will automatically stage files that used to have merge + # conflicts but no longer do; and it will also ask you if you want to + # continue a merge or rebase if you've resolved all conflicts. If false, it + # won't do either of these things. + autoStageResolvedConflicts: true + + # Command used when displaying the current branch git log in the main window + branchLogCmd: git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} -- + + # Command used to display git log of all branches in the main window. + # Deprecated: Use `allBranchesLogCmds` instead. + allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium + + # If true, do not spawn a separate process when using GPG + overrideGpg: false + + # If true, do not allow force pushes + disableForcePushing: false + + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix + commitPrefix: + # pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*" + pattern: "" + + # Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] " + replace: "" + + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix + branchPrefix: "" + + # If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀 + # (This should really be under 'gui', not 'git') + parseEmoji: false + + # Config for showing the log in the commits view + log: + # One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default' + # 'topo-order' makes it easier to read the git log graph, but commits may not + # appear chronologically. See https://git-scm.com/docs/ + # + # Deprecated: Configure this with `Log menu -> Commit sort order` ( in the commits window by default). + order: topo-order + + # This determines whether the git graph is rendered in the commits panel + # One of 'always' | 'never' | 'when-maximised' + # + # Deprecated: Configure this with `Log menu -> Show git graph` ( in the commits window by default). + showGraph: always + + # displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`) + showWholeGraph: false + + # When copying commit hashes to the clipboard, truncate them to this + # length. Set to 40 to disable truncation. + truncateCopiedCommitHashesTo: 12 + +# Periodic update checks +update: + # One of: 'prompt' (default) | 'background' | 'never' + method: prompt + + # Period in days between update checks + days: 14 + +# Background refreshes +refresher: + # File/submodule refresh interval in seconds. + # Auto-refresh can be disabled via option 'git.autoRefresh'. + refreshInterval: 10 + + # Re-fetch interval in seconds. + # Auto-fetch can be disabled via option 'git.autoFetch'. + fetchInterval: 60 + +# If true, show a confirmation popup before quitting Lazygit +confirmOnQuit: false + +# If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close +quitOnTopLevelReturn: false + +# Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc +os: + # Command for editing a file. Should contain "{{filename}}". + edit: "" + + # Command for editing a file at a given line number. Should contain + # "{{filename}}", and may optionally contain "{{line}}". + editAtLine: "" + + # Same as EditAtLine, except that the command needs to wait until the + # window is closed. + editAtLineAndWait: "" + + # For opening a directory in an editor + openDirInEditor: "" + + # A built-in preset that sets all of the above settings. Supported presets + # are defined in the getPreset function in editor_presets.go. + editPreset: "" + + # Command for opening a file, as if the file is double-clicked. Should + # contain "{{filename}}", but doesn't support "{{line}}". + open: "" + + # Command for opening a link. Should contain "{{link}}". + openLink: "" + + # EditCommand is the command for editing a file. + # Deprecated: use Edit instead. Note that semantics are different: + # EditCommand is just the command itself, whereas Edit contains a + # "{{filename}}" variable. + editCommand: "" + + # EditCommandTemplate is the command template for editing a file + # Deprecated: use EditAtLine instead. + editCommandTemplate: "" + + # OpenCommand is the command for opening a file + # Deprecated: use Open instead. + openCommand: "" + + # OpenLinkCommand is the command for opening a link + # Deprecated: use OpenLink instead. + openLinkCommand: "" + + # CopyToClipboardCmd is the command for copying to clipboard. + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard + copyToClipboardCmd: "" + + # ReadFromClipboardCmd is the command for reading the clipboard. + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard + readFromClipboardCmd: "" + +# If true, don't display introductory popups upon opening Lazygit. +disableStartupPopups: false + +# What to do when opening Lazygit outside of a git repo. +# - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo +# - 'create': initialize a new repo +# - 'skip': open most recent repo +# - 'quit': exit Lazygit +notARepository: prompt + +# If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit. +promptToReturnFromSubprocess: true + +# Keybindings +keybinding: + universal: + quit: q + quit-alt1: + return: + quitWithoutChangingDirectory: Q + togglePanel: + prevItem: + nextItem: + prevItem-alt: e + nextItem-alt: "n" + prevPage: "," + nextPage: . + scrollLeft: H + scrollRight: L + gotoTop: < + gotoBottom: ">" + toggleRangeSelect: v + rangeSelectDown: + rangeSelectUp: + prevBlock: + nextBlock: + prevBlock-alt: h + nextBlock-alt: i + nextBlock-alt2: + prevBlock-alt2: + jumpToBlock: + - "1" + - "2" + - "3" + - "4" + - "5" + nextMatch: "k" + prevMatch: "K" + startSearch: / + optionMenu: + optionMenu-alt1: "?" + select: + goInto: + confirm: + confirmInEditor: + remove: d + new: "n" + edit: l + openFile: o + scrollUpMain: + scrollDownMain: + scrollUpMain-alt1: K + scrollDownMain-alt1: J + scrollUpMain-alt2: + scrollDownMain-alt2: + executeShellCommand: ":" + createRebaseOptionsMenu: m + + # 'Files' appended for legacy reasons + pushFiles: P + + # 'Files' appended for legacy reasons + pullFiles: p + refresh: R + createPatchOptionsMenu: + nextTab: "]" + prevTab: "[" + nextScreenMode: + + prevScreenMode: _ + undo: z + redo: + filteringMenu: + diffingMenu: W + diffingMenu-alt: + copyToClipboard: + openRecentRepos: + submitEditorText: + extrasMenu: "@" + toggleWhitespaceInDiffView: + increaseContextInDiffView: "}" + decreaseContextInDiffView: "{" + increaseRenameSimilarityThreshold: ) + decreaseRenameSimilarityThreshold: ( + openDiffTool: + status: + checkForUpdate: u + recentRepos: + allBranchesLogGraph: a + files: + commitChanges: c + commitChangesWithoutHook: w + amendLastCommit: A + commitChangesWithEditor: C + findBaseCommitForFixup: + confirmDiscard: x + ignoreFile: i + refreshFiles: r + stashAllChanges: s + viewStashOptions: S + toggleStagedAll: a + viewResetOptions: D + fetch: f + toggleTreeView: "`" + openMergeTool: M + openStatusFilter: + copyFileInfoToClipboard: "y" + branches: + createPullRequest: o + viewPullRequestOptions: O + copyPullRequestURL: + checkoutBranchByName: c + forceCheckoutBranch: F + rebaseBranch: r + renameBranch: R + mergeIntoCurrentBranch: M + viewGitFlowOptions: i + fastForward: f + createTag: T + pushTag: P + setUpstream: u + fetchRemote: f + sortOrder: s + worktrees: + viewWorktreeOptions: w + commits: + squashDown: s + renameCommit: r + renameCommitWithEditor: R + viewResetOptions: g + markCommitAsFixup: f + createFixupCommit: F + squashAboveCommits: S + moveDownCommit: + moveUpCommit: + amendToCommit: A + resetCommitAuthor: a + pickCommit: p + revertCommit: t + cherryPickCopy: C + pasteCommits: V + markCommitAsBaseForRebase: B + tagCommit: T + checkoutCommit: + resetCherryPick: + copyCommitAttributeToClipboard: "y" + openLogMenu: + openInBrowser: o + viewBisectOptions: b + startInteractiveRebase: i + amendAttribute: + resetAuthor: a + setAuthor: A + addCoAuthor: c + stash: + popStash: g + renameStash: r + commitFiles: + checkoutCommitFile: c + main: + toggleSelectHunk: a + pickBothHunks: b + editSelectHunk: E + submodules: + init: i + update: u + bulkMenu: b + commitMessage: + commitMenu: diff --git a/tools/fastfetch/win.jsonc b/platforms/win/fastfetch.jsonc similarity index 96% rename from tools/fastfetch/win.jsonc rename to platforms/win/fastfetch.jsonc index 2b5c2e6..dcdcad7 100644 --- a/tools/fastfetch/win.jsonc +++ b/platforms/win/fastfetch.jsonc @@ -1,4 +1,4 @@ -// ~\.config\fastfetch\config.jsonc +// %UserProfile%\.config\fastfetch\config.jsonc { "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", "logo": { @@ -59,4 +59,4 @@ "poweradapter", "locale" ] -} +} \ No newline at end of file diff --git a/tools/powershell/Aliases.ps1 b/tools/powershell/Aliases.ps1 index 35986f6..367eced 100644 --- a/tools/powershell/Aliases.ps1 +++ b/tools/powershell/Aliases.ps1 @@ -31,5 +31,6 @@ Set-Alias "py" "python" Set-Alias "ipy" "ipython" if ($isWindows) { -function kex { wsl -d kali-linux kex --sl -s } + # Debugging + # function kex { wsl -d kali-linux kex --sl -s } } diff --git a/tools/powershell/Completions.ps1 b/tools/powershell/Completions.ps1 index 5db5e55..1647b2e 100644 --- a/tools/powershell/Completions.ps1 +++ b/tools/powershell/Completions.ps1 @@ -5,6 +5,28 @@ function Invoke-Completion { 'git' { Import-Module Posh-Git } 'hugo' { hugo completion powershell | Out-String | Invoke-Expression } 'pip' { pip completion --powershell | Out-String | Invoke-Expression } + 'uv' { uv generate-shell-completion powershell | Out-String | Invoke-Expression } 'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression } + 'winget' { + # https://learn.microsoft.com/en-us/windows/package-manager/winget/tab-completion + Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock { + param($wordToComplete, $commandAst, $cursorPosition) + [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new() + $Local:word = $wordToComplete.Replace('"', '""') + $Local:ast = $commandAst.ToString().Replace('"', '""') + winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object { + [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) + } + } + } } } +Set-Alias "icmp" "Invoke-Completion" + +Register-ArgumentCompleter -CommandName Invoke-Completion -ParameterName 'command' -ScriptBlock { + param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) + + $cmds = @('docker', 'git', 'hugo', 'pip', 'uv', 'wezterm', 'winget') + + $cmds | Where-Object { $_ -like "$wordToComplete*" } +} diff --git a/tools/powershell/Keymap.ps1 b/tools/powershell/Keymap.ps1 index ca110f3..41e78f8 100644 --- a/tools/powershell/Keymap.ps1 +++ b/tools/powershell/Keymap.ps1 @@ -23,6 +23,9 @@ Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine +Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory +Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory +Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory ## Use to Invoke MenuComplete Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete diff --git a/tools/powershell/readme.md b/tools/powershell/readme.md index 7cd9a86..db44094 100644 --- a/tools/powershell/readme.md +++ b/tools/powershell/readme.md @@ -20,3 +20,20 @@ This is the cross-platform PowerShell profile for PowerShell Core | `^a` | To Beginning of Line | All | | `^e` | To End of Line | All | | `^[` | To Normal Mode | Insert | + +## `Get-Command` vs `which.exe` under Windows + +```powershell +PS > hyperfine "pwsh.exe -NoProfile -Command 'Get-Command which'" "pwsh.exe -NoProfile -Command 'which which'" --warmup 10 +Benchmark 1: pwsh.exe -NoProfile -Command 'Get-Command which' + Time (mean ± σ): 152.1 ms ± 1.3 ms [User: 112.2 ms, System: 89.3 ms] + Range (min … max): 150.0 ms … 155.3 ms 18 runs + +Benchmark 2: pwsh.exe -NoProfile -Command 'which which' + Time (mean ± σ): 153.7 ms ± 6.4 ms [User: 126.7 ms, System: 101.9 ms] + Range (min … max): 147.8 ms … 169.5 ms 19 runs + +Summary + pwsh.exe -NoProfile -Command 'Get-Command which' ran + 1.01 ± 0.04 times faster than pwsh.exe -NoProfile -Command 'which which' +``` From 8b3b5d1b23c624c5bb1ab1b1f1f95309ec7fd27a Mon Sep 17 00:00:00 2001 From: whoami Date: Sun, 5 Jan 2025 15:16:58 +0000 Subject: [PATCH 3/4] fix: unix bootstrap symlink --- bootstrap/set_symlink_unix.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap/set_symlink_unix.bash b/bootstrap/set_symlink_unix.bash index f693c70..faeb3a8 100644 --- a/bootstrap/set_symlink_unix.bash +++ b/bootstrap/set_symlink_unix.bash @@ -17,7 +17,7 @@ ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml ln -sf $DOTFILES/common/haskeline ~/.haskeline ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey -ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG +# ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config ln -sf $DOTFILES/common/obsidian.vimrc $HOME/Obsidian/.obsidian.vimrc ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf @@ -32,7 +32,7 @@ ln -sf $DOTFILES/tools/yazi/config/yazi.toml ~/.config/yazi/yazi.toml ln -sf $DOTFILES/tools/fish ~/.config -if [ $(uname) = "Darwin"]; then +if [ $(uname) = "Darwin" ]; then mkdir -p ~/.config/karabiner $XDG_CONFIG_HOME/skhd $XDG_CONFIG_HOME/yabai $XDG_CONFIG_HOME/sketchybar ln -sf $DOTFILES/platforms/mac/karabiner/karabiner.json ~/.config/karabiner/karabiner.json ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc From 22ca99086ccf73fd8ad60ff16b766b132e59f094 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 5 Jan 2025 21:14:28 +0000 Subject: [PATCH 4/4] feat(glazewm): Change Windows TWM to GlazeWM --- .gitignore | 3 + .vscode/settings.json | 6 +- bootstrap/common-pm.txt | 17 + bootstrap/win/Defender.ps1 | 20 ++ platforms/win/glzr/.gitignore | 4 + platforms/win/glzr/glazewm/config.yaml | 314 ++++++++++++++++++ platforms/win/glzr/readme.md | 29 ++ .../win/glzr/zebar/minimal/bar.zebar.json | 22 ++ platforms/win/glzr/zebar/minimal/index.html | 29 ++ platforms/win/glzr/zebar/minimal/scripts.jsx | 197 +++++++++++ platforms/win/glzr/zebar/minimal/styles.css | 115 +++++++ platforms/win/glzr/zebar/normalize.css | 204 ++++++++++++ platforms/win/glzr/zebar/settings.json | 9 + tools/browser/surfingkeys.js | 253 +------------- tools/powershell/Completions.ps1 | 12 +- tools/powershell/Config.ps1 | 18 +- 16 files changed, 999 insertions(+), 253 deletions(-) create mode 100644 bootstrap/common-pm.txt create mode 100644 bootstrap/win/Defender.ps1 create mode 100644 platforms/win/glzr/.gitignore create mode 100644 platforms/win/glzr/glazewm/config.yaml create mode 100644 platforms/win/glzr/readme.md create mode 100644 platforms/win/glzr/zebar/minimal/bar.zebar.json create mode 100644 platforms/win/glzr/zebar/minimal/index.html create mode 100644 platforms/win/glzr/zebar/minimal/scripts.jsx create mode 100644 platforms/win/glzr/zebar/minimal/styles.css create mode 100644 platforms/win/glzr/zebar/normalize.css create mode 100644 platforms/win/glzr/zebar/settings.json diff --git a/.gitignore b/.gitignore index 32a3502..ebfba8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Log +*.log + # Private Files *private* .private.env.* diff --git a/.vscode/settings.json b/.vscode/settings.json index a719ff3..5826f1c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,4 +30,8 @@ ".wslconfig": "properties", "WindowsTerminal.json": "jsonc", }, -} \ No newline at end of file + "[json]": { + "editor.formatOnPaste": false, + "editor.formatOnSave": false, + } +} diff --git a/bootstrap/common-pm.txt b/bootstrap/common-pm.txt new file mode 100644 index 0000000..c7c52a4 --- /dev/null +++ b/bootstrap/common-pm.txt @@ -0,0 +1,17 @@ +# nodejs +npm install -g typescript +npm install -g tsx + +# dotnet +dotnet tool install -g dotnet-script +dotnet tool install -g dotnet-repl + +# python +pip install neovim +pip install requests +pip install ipython +pip install jupyter +pip install numpy +pip install matplotlib +pip install pandas +pip install scipy diff --git a/bootstrap/win/Defender.ps1 b/bootstrap/win/Defender.ps1 new file mode 100644 index 0000000..007c5f1 --- /dev/null +++ b/bootstrap/win/Defender.ps1 @@ -0,0 +1,20 @@ +# Run as Administrator + +Set-MpPreference -EnableControlledFolderAccess 1 + +$protected = (Get-MpPreference).ControlledFolderAccessProtectedFolders +$protected += "$env:USERPROFILE\.ssh" +$protected += "$env:USERPROFILE\.config" +Set-MpPreference -ControlledFolderAccessProtectedFolders $protected + +$apps = (Get-MpPreference).ControlledFolderAccessAllowedApplications +$apps += "$Env:Windir\System32\OpenSSH\ssh.exe" +$apps += "$Env:ProgramFiles\GPSoftware\Directory Opus\DOpus.exe" +$apps += "$Env:UserProfile\scoop\apps\pwsh\current\pwsh.exe" +Set-MpPreference -ControlledFolderAccessAllowedApplications $apps + +$exclusion = (Get-MpPreference).ExclusionPath +$exclusion += "$env:ProgramFiles\JetBrains" +$exclusion += "$env:LocalAppData\JetBrains" +$exclusion += "D:\Source" +Set-MpPreference -ExclusionPath $exclusion diff --git a/platforms/win/glzr/.gitignore b/platforms/win/glzr/.gitignore new file mode 100644 index 0000000..40ddb92 --- /dev/null +++ b/platforms/win/glzr/.gitignore @@ -0,0 +1,4 @@ +# New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force +boilerplate* +starter/ +neobrutal/ diff --git a/platforms/win/glzr/glazewm/config.yaml b/platforms/win/glzr/glazewm/config.yaml new file mode 100644 index 0000000..79984ea --- /dev/null +++ b/platforms/win/glzr/glazewm/config.yaml @@ -0,0 +1,314 @@ +# $DOTFILES/platforms/win/glzr/glazewm/config.yaml +# Date: 2025-01-05 +# Author: js0ny + +# Location: +# - %UserProfile%\.glzr\glazewm\config.yaml +# Linking: Link to whole directory +# New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force + +general: + # Commands to run when the WM has started. This is useful for running a + # script or launching another application. + # Example: The below command launches Zebar. + startup_commands: ["shell-exec zebar"] + + # Commands to run just before the WM is shutdown. + # Example: The below command kills Zebar. + shutdown_commands: ["shell-exec taskkill /IM zebar.exe /F"] + + # Commands to run after the WM config is reloaded. + config_reload_commands: [] + + # Whether to automatically focus windows underneath the cursor. + focus_follows_cursor: false + + # Whether to switch back and forth between the previously focused + # workspace when focusing the current workspace. + toggle_workspace_on_refocus: false + + cursor_jump: + # Whether to automatically move the cursor on the specified trigger. + enabled: true + + # Trigger for cursor jump: + # - 'monitor_focus': Jump when focus changes between monitors. + # - 'window_focus': Jump when focus changes between windows. + trigger: "monitor_focus" + + # How windows should be hidden when switching workspaces. + # - 'cloak': Recommended. Hides windows with no animation. + # - 'hide': Legacy method (v3.5 and earlier) that has a brief animation, + # but has stability issues with some apps. + hide_method: "cloak" + + # Affects which windows get shown in the native Windows taskbar. Has no + # effect if `hide_method: 'hide'`. + # - 'true': Show all windows (regardless of workspace). + # - 'false': Only show windows from the currently shown workspaces. + show_all_in_taskbar: false + +gaps: + # Whether to scale the gaps with the DPI of the monitor. + scale_with_dpi: true + + # Gap between adjacent windows. + inner_gap: "20px" + + # Gap between windows and the screen edge. + outer_gap: + top: "60px" + right: "20px" + bottom: "20px" + left: "20px" + +window_effects: + # Visual effects to apply to the focused window. + focused_window: + # Highlight the window with a colored border. + # ** Exclusive to Windows 11 due to API limitations. + border: + enabled: true + color: "#8dbcff" + + # Remove the title bar from the window's frame. Note that this can + # cause rendering issues for some applications. + hide_title_bar: + enabled: false + + # Change the corner style of the window's frame. + # ** Exclusive to Windows 11 due to API limitations. + corner_style: + enabled: false + # Allowed values: 'square', 'rounded', 'small_rounded'. + style: "square" + + # Visual effects to apply to non-focused windows. + other_windows: + border: + enabled: true + color: "#a1a1a1" + hide_title_bar: + enabled: false + corner_style: + enabled: false + style: "square" + +window_behavior: + # New windows are created in this state whenever possible. + # Allowed values: 'tiling', 'floating'. + initial_state: "tiling" + + # Sets the default options for when a new window is created. This also + # changes the defaults for when the state change commands, like + # `set-floating`, are used without any flags. + state_defaults: + floating: + # Whether to center floating windows by default. + centered: true + + # Whether to show floating windows as always on top. + shown_on_top: false + + fullscreen: + # Maximize the window if possible. If the window doesn't have a + # maximize button, then it'll be fullscreen'ed normally instead. + maximized: false + + # Whether to show fullscreen windows as always on top. + shown_on_top: false + +workspaces: + - name: "1" + - name: "2" + - name: "3" + - name: "4" + - name: "5" + - name: "6" + - name: "7" + - name: "8" + - name: "9" + +window_rules: + - commands: ["ignore"] + match: + # Ignores any Zebar windows. + - window_process: { equals: "zebar" } + + # Ignores picture-in-picture windows for browsers. + - window_title: { regex: "[Pp]icture.in.[Pp]icture" } + window_class: { regex: "Chrome_WidgetWin_1|MozillaDialogClass" } + + # Ignore rules for various 3rd-party apps. + - window_process: { equals: "PowerToys" } + window_class: { regex: 'HwndWrapper\[PowerToys\.PowerAccent.*?\]' } + - window_process: { equals: "PowerToys" } + window_title: { regex: ".*? - Peek" } + - window_process: { equals: "Lively" } + window_class: { regex: "HwndWrapper" } + +binding_modes: + # When enabled, the focused window can be resized via arrow keys or HJKL. + - name: "resize" + keybindings: + - commands: ["resize --width -2%"] + bindings: ["h", "left"] + - commands: ["resize --width +2%"] + bindings: ["i", "right"] + - commands: ["resize --height +2%"] + bindings: ["e", "up"] + - commands: ["resize --height -2%"] + bindings: ["n", "down"] + # Press enter/escape to return to default keybindings. + - commands: ["wm-disable-binding-mode --name resize"] + bindings: ["escape", "enter"] + +keybindings: + # Shift focus in a given direction. + - commands: ["focus --direction left"] + bindings: ["lwin+h", "lwin+left"] + - commands: ["focus --direction right"] + bindings: ["lwin+i", "lwin+right"] + - commands: ["focus --direction up"] + bindings: ["lwin+e", "lwin+up"] + - commands: ["focus --direction down"] + bindings: ["lwin+n", "lwin+down"] + + # Move focused window in a given direction. + - commands: ["move --direction left"] + bindings: ["lwin+shift+h", "lwin+shift+left"] + - commands: ["move --direction right"] + bindings: ["lwin+shift+i", "lwin+shift+right"] + - commands: ["move --direction up"] + bindings: ["lwin+shift+e", "lwin+shift+up"] + - commands: ["move --direction down"] + bindings: ["lwin+shift+n", "lwin+shift+down"] + + # Resize focused window by a percentage or pixel amount. + - commands: ["resize --width -2%"] + bindings: ["alt+u"] + - commands: ["resize --width +2%"] + bindings: ["alt+p"] + - commands: ["resize --height +2%"] + bindings: ["alt+o"] + - commands: ["resize --height -2%"] + bindings: ["alt+i"] + + # As an alternative to the resize keybindings above, resize mode enables + # resizing via arrow keys or HJKL. The binding mode is defined above with + # the name 'resize'. + - commands: ["wm-enable-binding-mode --name resize"] + bindings: ["lwin+shift+r"] + + # Disables window management and all other keybindings until alt+shift+p + # is pressed again. + - commands: ["wm-toggle-pause"] + bindings: ["alt+shift+p"] + + # Change tiling direction. This determines where new tiling windows will + # be inserted. + - commands: ["toggle-tiling-direction"] + bindings: ["lwin+v"] + + # Change focus from tiling windows -> floating -> fullscreen. + # - commands: ["wm-cycle-focus"] + # bindings: ["alt+space"] + + # Change the focused window to be floating. + - commands: ["toggle-floating --centered"] + bindings: ["alt+shift+space"] + + # Change the focused window to be tiling. + - commands: ["toggle-tiling"] + bindings: ["lwin+t"] + + # Change the focused window to be fullscreen. + - commands: ["toggle-fullscreen"] + bindings: ["lwin+f"] + + # Minimize focused window. + - commands: ["toggle-minimized"] + bindings: ["lwin+m"] + + # Close focused window. + - commands: ["close"] + bindings: ["lwin+q"] + + # Kill GlazeWM process safely. + - commands: ["wm-exit"] + bindings: ["alt+shift+e"] + + # Re-evaluate configuration file. + - commands: ["wm-reload-config"] + bindings: ["alt+shift+r"] + + # Redraw all windows. + - commands: ["wm-redraw"] + bindings: ["alt+shift+w"] + + # Launch CMD terminal. Alternatively, use `shell-exec wt` or + # `shell-exec %ProgramFiles%/Git/git-bash.exe` to start Windows + # Terminal and Git Bash respectively. + - commands: ["shell-exec wt"] + bindings: ["lwin+r"] + + # Focus the next/previous active workspace defined in `workspaces` config. + - commands: ["focus --next-active-workspace"] + bindings: ["alt+s"] + - commands: ["focus --prev-active-workspace"] + bindings: ["alt+a"] + + # Focus the workspace that last had focus. + - commands: ["focus --recent-workspace"] + bindings: ["alt+d"] + + # Change focus to a workspace defined in `workspaces` config. + - commands: ["focus --workspace 1"] + bindings: ["lwin+1"] + - commands: ["focus --workspace 2"] + bindings: ["lwin+2"] + - commands: ["focus --workspace 3"] + bindings: ["lwin+3"] + - commands: ["focus --workspace 4"] + bindings: ["lwin+4"] + - commands: ["focus --workspace 5"] + bindings: ["lwin+5"] + - commands: ["focus --workspace 6"] + bindings: ["lwin+6"] + - commands: ["focus --workspace 7"] + bindings: ["lwin+7"] + - commands: ["focus --workspace 8"] + bindings: ["lwin+8"] + - commands: ["focus --workspace 9"] + bindings: ["lwin+9"] + + # Move the focused window's parent workspace to a monitor in a given + # direction. + - commands: ["move-workspace --direction left"] + bindings: ["alt+shift+a"] + - commands: ["move-workspace --direction right"] + bindings: ["alt+shift+f"] + - commands: ["move-workspace --direction up"] + bindings: ["alt+shift+d"] + - commands: ["move-workspace --direction down"] + bindings: ["alt+shift+s"] + + # Move focused window to a workspace defined in `workspaces` config. + - commands: ["move --workspace 1", "focus --workspace 1"] + bindings: ["lwin+shift+1"] + - commands: ["move --workspace 2", "focus --workspace 2"] + bindings: ["lwin+shift+2"] + - commands: ["move --workspace 3", "focus --workspace 3"] + bindings: ["lwin+shift+3"] + - commands: ["move --workspace 4", "focus --workspace 4"] + bindings: ["lwin+shift+4"] + - commands: ["move --workspace 5", "focus --workspace 5"] + bindings: ["lwin+shift+5"] + - commands: ["move --workspace 6", "focus --workspace 6"] + bindings: ["lwin+shift+6"] + - commands: ["move --workspace 7", "focus --workspace 7"] + bindings: ["lwin+shift+7"] + - commands: ["move --workspace 8", "focus --workspace 8"] + bindings: ["lwin+shift+8"] + - commands: ["move --workspace 9", "focus --workspace 9"] + bindings: ["lwin+shift+9"] diff --git a/platforms/win/glzr/readme.md b/platforms/win/glzr/readme.md new file mode 100644 index 0000000..095effb --- /dev/null +++ b/platforms/win/glzr/readme.md @@ -0,0 +1,29 @@ +# GlazeWM Setup + +Link the whole `glzr` directory to the user's home directory. + +```powershell +New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force +``` + +The Zebar config should be downloaded from [this repository](https://github.com/js0ny/neobrutal-zebar) and extracted to the `glzr\zebar` directory. + +Or use the minimal setup, by changing `glzr\zebar\settings.json`: `startupConfigs.path` to `minimal/bar.zebar.json`. + +```json +{ + "$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/settings-schema.json", + "startupConfigs": [ + { + "path": "minimal/bar.zebar.json", + "preset": "default" + } + ] +} +``` + +```powershell +Invoke-WebRequest -Uri "https://github.com/js0ny/neobrutal-zebar/releases/download/2/neobrutal.zip" -OutFile "$Env:UserProfile\.glzr\zebar\neobrutal.zip" +Expand-Archive -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip" -DestinationPath "$Env:UserProfile\.glzr\zebar" +Remove-Item -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip" +``` diff --git a/platforms/win/glzr/zebar/minimal/bar.zebar.json b/platforms/win/glzr/zebar/minimal/bar.zebar.json new file mode 100644 index 0000000..1dcb03c --- /dev/null +++ b/platforms/win/glzr/zebar/minimal/bar.zebar.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/widget-schema.json", + "htmlPath": "./index.html", + "zOrder": "normal", + "shownInTaskbar": false, + "focused": false, + "resizable": false, + "transparent": true, + "presets": [ + { + "name": "default", + "anchor": "top_left", + "offsetX": "0px", + "offsetY": "0px", + "width": "100%", + "height": "40px", + "monitorSelection": { + "type": "all" + } + } + ] +} diff --git a/platforms/win/glzr/zebar/minimal/index.html b/platforms/win/glzr/zebar/minimal/index.html new file mode 100644 index 0000000..b97b52f --- /dev/null +++ b/platforms/win/glzr/zebar/minimal/index.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/platforms/win/glzr/zebar/minimal/scripts.jsx b/platforms/win/glzr/zebar/minimal/scripts.jsx new file mode 100644 index 0000000..fbbace9 --- /dev/null +++ b/platforms/win/glzr/zebar/minimal/scripts.jsx @@ -0,0 +1,197 @@ +import React, { + useState, + useEffect, +} from 'https://esm.sh/react@18?dev'; +import { createRoot } from 'https://esm.sh/react-dom@18/client?dev'; +import * as zebar from 'https://esm.sh/zebar@2'; + +const providers = zebar.createProviderGroup({ + // network: { type: 'network' }, + glazewm: { type: 'glazewm' }, + cpu: { type: 'cpu' }, + date: { type: 'date', formatting: 'HH:mm:ss MMM月d日 EEE', locale: 'zh-CN' }, + battery: { type: 'battery' }, + memory: { type: 'memory' }, + weather: { type: 'weather' }, +}); + +function getNetworkIcon(networkOutput) { + switch (networkOutput.defaultInterface?.type) { + case 'ethernet': + return ; + case 'wifi': + if (networkOutput.defaultGateway?.signalStrength >= 80) { + return ; + } else if ( + networkOutput.defaultGateway?.signalStrength >= 65 + ) { + return ; + } else if ( + networkOutput.defaultGateway?.signalStrength >= 40 + ) { + return ; + } else if ( + networkOutput.defaultGateway?.signalStrength >= 25 + ) { + return ; + } else { + return ; + } + default: + return ( + + ); + } +} +// Get icon to show for how much of the battery is charged. +function getBatteryIcon(batteryOutput) { + if (batteryOutput.chargePercent > 90) + return ; + if (batteryOutput.chargePercent > 70) + return ; + if (batteryOutput.chargePercent > 40) + return ; + if (batteryOutput.chargePercent > 20) + return ; + return ; +} +// Get icon to show for current weather status. +function getWeatherIcon(weatherOutput) { + switch (weatherOutput.status) { + case 'clear_day': + return ; + case 'clear_night': + return ; + case 'cloudy_day': + return ; + case 'cloudy_night': + return ; + case 'light_rain_day': + return ; + case 'light_rain_night': + return ; + case 'heavy_rain_day': + return ; + case 'heavy_rain_night': + return ; + case 'snow_day': + return ; + case 'snow_night': + return ; + case 'thunder_day': + return ; + case 'thunder_night': + return ; + } +} + +createRoot(document.getElementById('root')).render(); + +function App() { + const [output, setOutput] = useState(providers.outputMap); + + useEffect(() => { + providers.onOutput(() => setOutput(providers.outputMap)); + }, []); + + + + return ( +
+
+ + {output.glazewm && ( +
+ {output.glazewm.currentWorkspaces.map(workspace => ( + + ))} +
+ )} +
+ +
{output.date?.formatted}
+ +
+ {output.glazewm && ( + <> + {output.glazewm.bindingModes.map(bindingMode => ( + + ))} + + + + )} + + {output.network && ( +
+ {getNetworkIcon(output.network)} + {output.network.defaultGateway?.ssid} +
+ )} + + {output.memory && ( +
+ + {Math.round(output.memory.usage)}% +
+ )} + + {output.cpu && ( +
+ + + {/* Change the text color if the CPU usage is high. */} + 85 ? 'high-usage' : ''} + > + {Math.round(output.cpu.usage)}% + +
+ )} + + {output.battery && ( +
+ {/* Show icon for whether battery is charging. */} + {output.battery.isCharging && ( + + )} + {getBatteryIcon(output.battery)} + {Math.round(output.battery.chargePercent)}% +
+ )} + + {output.weather && ( +
+ {getWeatherIcon(output.weather)} + {Math.round(output.weather.celsiusTemp)}°C +
+ )} +
+
+ ); +} diff --git a/platforms/win/glzr/zebar/minimal/styles.css b/platforms/win/glzr/zebar/minimal/styles.css new file mode 100644 index 0000000..c28280d --- /dev/null +++ b/platforms/win/glzr/zebar/minimal/styles.css @@ -0,0 +1,115 @@ +/** + * Import the Nerdfonts icon font. + * Ref https://www.nerdfonts.com/cheat-sheet for a cheatsheet of available Nerdfonts icons. + */ +@import 'https://www.nerdfonts.com/assets/css/webfont.css'; + +i { + color: rgb(115 130 175 / 95%); + margin-right: 7px; +} + +body { + color: rgb(255 255 255 / 90%); + font-family: "JetBrainsMono Nerd Font", "LXGW Wenkai", ui-monospace, monospace; + font-size: 12px; + overflow: hidden; +} + +html, +body, +#root { + height: 100%; +} + +#root { + border-bottom: 1px solid rgb(255 255 255 / 5%); + background: linear-gradient(rgb(0 0 0 / 90%), rgb(5 2 20 / 85%)); +} + +.app { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + align-items: center; + height: 100%; + padding: 4px 1.5vw; +} + +.left, +.center, +.right { + display: flex; + align-items: center; +} + +.center { + justify-self: center; +} + +.right { + justify-self: end; +} + +.logo, +.binding-mode, +.tiling-direction, +.network, +.memory, +.cpu, +.battery { + margin-right: 20px; +} + +.workspaces { + display: flex; + align-items: center; +} + +.workspace { + background: rgb(255 255 255 / 5%); + margin-right: 4px; + padding: 4px 8px; + color: rgb(255 255 255 / 90%); + border: none; + border-radius: 2px; + cursor: pointer; + + &.displayed { + background: rgb(255 255 255 / 15%); + } + + &.focused, + &:hover { + background: rgb(75 115 255 / 50%); + } +} + +.binding-mode, +.tiling-direction { + background: rgb(255 255 255 / 15%); + color: rgb(255 255 255 / 90%); + border-radius: 2px; + line-height: 1; + padding: 4px 8px; + border: 0; + cursor: pointer; +} + +.binding-mode { + margin-right: 4px; +} + +.cpu .high-usage { + color: #900029; +} + +.battery { + position: relative; +} + +.battery .charging-icon { + position: absolute; + font-size: 7px; + left: -8px; + top: 3px; +} diff --git a/platforms/win/glzr/zebar/normalize.css b/platforms/win/glzr/zebar/normalize.css new file mode 100644 index 0000000..2204e78 --- /dev/null +++ b/platforms/win/glzr/zebar/normalize.css @@ -0,0 +1,204 @@ +/** + * Base CSS styles for better consistency across platforms. + * Yoinked from: https://github.com/sindresorhus/modern-normalize + */ + +/* +Document +======== +*/ + +/** +Use a better box model (opinionated). +*/ + +*, +::before, +::after { + box-sizing: border-box; +} + +html { + /* Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) */ + font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, + 'Apple Color Emoji', 'Segoe UI Emoji'; + line-height: 1.15; /* 1. Correct the line height in all browsers. */ + -webkit-text-size-adjust: 100%; /* 2. Prevent adjustments of font size after orientation changes in iOS. */ + tab-size: 4; /* 3. Use a more readable tab size (opinionated). */ +} + +/* +Sections +======== +*/ + +body { + margin: 0; /* Remove the margin in all browsers. */ +} + +/* +Text-level semantics +==================== +*/ + +/** +Add the correct font weight in Chrome and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/** +1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) +2. Correct the odd 'em' font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', + Menlo, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/** +Prevent 'sub' and 'sup' elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +Tabular data +============ +*/ + +/** +Correct table border color inheritance in Chrome and Safari. (https://issues.chromium.org/issues/40615503, https://bugs.webkit.org/show_bug.cgi?id=195016) +*/ + +table { + border-color: currentcolor; +} + +/* +Forms +===== +*/ + +/** +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** +Correct the inability to style clickable types in iOS and Safari. +*/ + +button, +[type='button'], +[type='reset'], +[type='submit'] { + -webkit-appearance: button; +} + +/** +Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers. +*/ + +legend { + padding: 0; +} + +/** +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/** +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/** +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to 'inherit' in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* +Interactive +=========== +*/ + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} diff --git a/platforms/win/glzr/zebar/settings.json b/platforms/win/glzr/zebar/settings.json new file mode 100644 index 0000000..66efb4e --- /dev/null +++ b/platforms/win/glzr/zebar/settings.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/settings-schema.json", + "startupConfigs": [ + { + "path": "neobrutal/bar.zebar.json", + "preset": "default" + } + ] +} diff --git a/tools/browser/surfingkeys.js b/tools/browser/surfingkeys.js index d778b0a..3302020 100644 --- a/tools/browser/surfingkeys.js +++ b/tools/browser/surfingkeys.js @@ -73,6 +73,7 @@ const forwardFactory = { } } // #endregion + // #region Keymap const mapLists = { /// scroll page @@ -165,7 +166,6 @@ api.addSearchAlias('c', 'ChatGPT', 'https://chatgpt.com/?q=', 's', 'https://duck // #endregion // #region Site-specific - // chatgpt.com api.unmap('t', /chatgpt.com/); api.mapkey('tn', 'New Chat', function () { @@ -184,245 +184,24 @@ api.mapkey('S', 'Start/Stop Generating', function () { var btn = document.querySelector('button.h-8:nth-child(2)'); btn.click(); }, { domain: /chatgpt.com/ }); +api.mapkey('an', 'New Chat', function () { + var btn = document.querySelector('div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)') + btn.click(); +}, { domain: /chatgpt.com/ }); +api.mapkey('as', 'Start/Stop Generating', function () { + var btn = document.querySelector('button.h-8:nth-child(2)'); + btn.click(); +}, { domain: /chatgpt.com/ }); +api.mapkey('as', 'Start/Stop Generating', function () { + var btn = document.querySelector('button.h-8:nth-child(2)'); + btn.click(); +}, { domain: /chatgpt.com/ }); //api.mapkey('tm', 'Toggle Model', function () { // var btn = document.querySelector('#radix -\: r2i\:'); // btn.click(); //}, { domain: /chatgpt.com/ }); +// perplexity.ai +api.unmap('', /perplexity.ai/); + // #endregion - -// #region Theme -// reference to https://github.com/Foldex/surfingkeys-config -// api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;'); -// api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text"); -// api.Visual.style('marks', 'background-color: #A3BE8C99;'); -// api.Visual.style('cursor', 'background-color: #88C0D0;'); -// settings.theme = ` -// fg: #E5E9F0; -// bg: #3B4252; -// bg-dark: #2E3440; -// border: #4C566A; -// main-fg: #88C0D0; -// accent-fg: #A3BE8C; -// info-fg: #5E81AC; -// select: #4C566A; -// /* ---------- Generic ---------- */ -// .sk_theme { -// background: var(--bg); -// color: var(--fg); -// background-color: var(--bg); -// border-color: var(--border); -// font-family: var(--font); -// font-size: var(--font-size); -// font-weight: var(--font-weight); -// } - -// input { -// font-family: var(--font); -// font-weight: var(--font-weight); -// } - -// .sk_theme tbody { -// color: var(--fg); -// } - -// .sk_theme input { -// color: var(--fg); -// } - -// /* Hints */ -// #sk_hints .begin { -// color: var(--accent-fg) !important; -// } - -// #sk_tabs .sk_tab { -// background: var(--bg-dark); -// border: 1px solid var(--border); -// } - -// #sk_tabs .sk_tab_title { -// color: var(--fg); -// } - -// #sk_tabs .sk_tab_url { -// color: var(--main-fg); -// } - -// #sk_tabs .sk_tab_hint { -// background: var(--bg); -// border: 1px solid var(--border); -// color: var(--accent-fg); -// } - -// .sk_theme #sk_frame { -// background: var(--bg); -// opacity: 0.2; -// color: var(--accent-fg); -// } - -// /* ---------- Omnibar ---------- */ -// /* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */ -// /* .sk_theme#sk_omnibar { -// width: 100%; -// left: 0; -// } */ - -// .sk_theme .title { -// color: var(--accent-fg); -// } - -// .sk_theme .url { -// color: var(--main-fg); -// } - -// .sk_theme .annotation { -// color: var(--accent-fg); -// } - -// .sk_theme .omnibar_highlight { -// color: var(--accent-fg); -// } - -// .sk_theme .omnibar_timestamp { -// color: var(--info-fg); -// } - -// .sk_theme .omnibar_visitcount { -// color: var(--accent-fg); -// } - -// .sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) { -// background: var(--bg-dark); -// } - -// .sk_theme #sk_omnibarSearchResult ul li.focused { -// background: var(--border); -// } - -// .sk_theme #sk_omnibarSearchArea { -// border-top-color: var(--border); -// border-bottom-color: var(--border); -// } - -// .sk_theme #sk_omnibarSearchArea input, -// .sk_theme #sk_omnibarSearchArea span { -// font-size: var(--font-size); -// } - -// .sk_theme .separator { -// color: var(--accent-fg); -// } - -// /* ---------- Popup Notification Banner ---------- */ -// #sk_banner { -// font-family: var(--font); -// font-size: var(--font-size); -// font-weight: var(--font-weight); -// background: var(--bg); -// border-color: var(--border); -// color: var(--fg); -// opacity: 0.9; -// } - -// /* ---------- Popup Keys ---------- */ -// #sk_keystroke { -// background-color: var(--bg); -// } - -// .sk_theme kbd .candidates { -// color: var(--info-fg); -// } - -// .sk_theme span.annotation { -// color: var(--accent-fg); -// } - -// /* ---------- Popup Translation Bubble ---------- */ -// #sk_bubble { -// background-color: var(--bg) !important; -// color: var(--fg) !important; -// border-color: var(--border) !important; -// } - -// #sk_bubble * { -// color: var(--fg) !important; -// } - -// #sk_bubble div.sk_arrow div:nth-of-type(1) { -// border-top-color: var(--border) !important; -// border-bottom-color: var(--border) !important; -// } - -// #sk_bubble div.sk_arrow div:nth-of-type(2) { -// border-top-color: var(--bg) !important; -// border-bottom-color: var(--bg) !important; -// } - -// /* ---------- Search ---------- */ -// #sk_status, -// #sk_find { -// font-size: var(--font-size); -// border-color: var(--border); -// } - -// .sk_theme kbd { -// background: var(--bg-dark); -// border-color: var(--border); -// box-shadow: none; -// color: var(--fg); -// } - -// .sk_theme .feature_name span { -// color: var(--main-fg); -// } - -// /* ---------- ACE Editor ---------- */ -// #sk_editor { -// background: var(--bg-dark) !important; -// height: 50% !important; -// /* Remove this to restore the default editor size */ -// } - -// .ace_dialog-bottom { -// border-top: 1px solid var(--bg) !important; -// } - -// .ace-chrome .ace_print-margin, -// .ace_gutter, -// .ace_gutter-cell, -// .ace_dialog { -// background: var(--bg) !important; -// } - -// .ace-chrome { -// color: var(--fg) !important; -// } - -// .ace_gutter, -// .ace_dialog { -// color: var(--fg) !important; -// } - -// .ace_cursor { -// color: var(--fg) !important; -// } - -// .normal-mode .ace_cursor { -// background-color: var(--fg) !important; -// border: var(--fg) !important; -// opacity: 0.7 !important; -// } - -// .ace_marker-layer .ace_selection { -// background: var(--select) !important; -// } - -// .ace_editor, -// .ace_dialog span, -// .ace_dialog input { -// font-family: var(--font); -// font-size: var(--font-size); -// font-weight: var(--font-weight); -// }`; -// click `Save` button to make above settings to take effect. -// #endregion diff --git a/tools/powershell/Completions.ps1 b/tools/powershell/Completions.ps1 index 1647b2e..9dd8cb7 100644 --- a/tools/powershell/Completions.ps1 +++ b/tools/powershell/Completions.ps1 @@ -2,9 +2,19 @@ function Invoke-Completion { param ([string]$command) switch ($command) { 'docker' { docker completion powershell | Out-String | Invoke-Expression } + 'dotnet' { + # https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#powershell + Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock { + param($wordToComplete, $commandAst, $cursorPosition) + dotnet complete --position $cursorPosition "$commandAst" | ForEach-Object { + [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) + } + } + } 'git' { Import-Module Posh-Git } 'hugo' { hugo completion powershell | Out-String | Invoke-Expression } 'pip' { pip completion --powershell | Out-String | Invoke-Expression } + 'rg' { rg --generate complete-powershell | Out-String | Invoke-Expression } 'uv' { uv generate-shell-completion powershell | Out-String | Invoke-Expression } 'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression } 'winget' { @@ -26,7 +36,7 @@ Set-Alias "icmp" "Invoke-Completion" Register-ArgumentCompleter -CommandName Invoke-Completion -ParameterName 'command' -ScriptBlock { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) - $cmds = @('docker', 'git', 'hugo', 'pip', 'uv', 'wezterm', 'winget') + $cmds = @('docker', 'dotnet', 'git', 'hugo', 'pip', 'rg', 'uv', 'wezterm', 'winget') $cmds | Where-Object { $_ -like "$wordToComplete*" } } diff --git a/tools/powershell/Config.ps1 b/tools/powershell/Config.ps1 index 4d5ed8c..431131c 100644 --- a/tools/powershell/Config.ps1 +++ b/tools/powershell/Config.ps1 @@ -1,18 +1,8 @@ -# Use XDG Base Directory Specification and its similar structure for Windows -# wget -if (Get-Command wget -ErrorAction SilentlyContinue) { - ${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args} -} - -# yarn v1 -if (Get-Command yarn -ErrorAction SilentlyContinue) { - ${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args} -} - -if ($Env:WEZTERM) { # Environment variable injected by wezterm/wezterm.lua - ${function:icat} = {wezterm imgcat $args} +if ($Env:WEZTERM) { + # Environment variable injected by wezterm/wezterm.lua + ${function:icat} = { wezterm imgcat $args } } elseif ($Env:KITTY) { - ${function:icat} = {kitty +kitten icat $args} + ${function:icat} = { kitty +kitten icat $args } }