Merge branch 'master' of github.com:js0ny/dotfiles

This commit is contained in:
js0ny 2025-01-07 22:09:42 +00:00
commit 71c0e4be7b
26 changed files with 1795 additions and 262 deletions

5
.gitignore vendored
View file

@ -1,3 +1,6 @@
# Log
*.log
# Private Files # Private Files
*private* *private*
.private.env.* .private.env.*
@ -46,3 +49,5 @@ common/fzfrc
platforms/win/komorebi/applications.json platforms/win/komorebi/applications.json
gitconfig gitconfig
check_update

View file

@ -30,4 +30,8 @@
".wslconfig": "properties", ".wslconfig": "properties",
"WindowsTerminal.json": "jsonc", "WindowsTerminal.json": "jsonc",
}, },
} "[json]": {
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
}
}

View file

@ -16,10 +16,9 @@ Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
# Set Environment Variables # Set Environment Variables
# Use %PATH_EXT% to prevent PATH from being too long # 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", "D:\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") [System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\jsony\AppData\Local\Cargo\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\citoy\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\citoy\AppData\Local\Cargo\bin", "User") [System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\jsony\AppData\Local\Cargo\bin", "User")
[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "", "User")
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User") $currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($currentPath -notlike "*%PATH_EXT%*") { if ($currentPath -notlike "*%PATH_EXT%*") {
$currentPath += ";%PATH_EXT_0%;%PATH_EXT_1%;%PATH_EXT_2%" $currentPath += ";%PATH_EXT_0%;%PATH_EXT_1%;%PATH_EXT_2%"

17
bootstrap/common-pm.txt Normal file
View file

@ -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

View file

@ -16,7 +16,7 @@ ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml
ln -sf $DOTFILES/common/haskeline ~/.haskeline ln -sf $DOTFILES/common/haskeline ~/.haskeline
ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey 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/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf ln -sf $DOTFILES/common/pip.conf $XDG_CONFIG_HOME/pip/pip.conf
ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf ln -sf $DOTFILES/common/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf

View file

@ -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

606
common/lazygit.yaml Normal file
View file

@ -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` (<c-l> 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` (<c-l> 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: <c-c>
return: <esc>
quitWithoutChangingDirectory: Q
togglePanel: <tab>
prevItem: <up>
nextItem: <down>
prevItem-alt: e
nextItem-alt: "n"
prevPage: ","
nextPage: .
scrollLeft: H
scrollRight: L
gotoTop: <
gotoBottom: ">"
toggleRangeSelect: v
rangeSelectDown: <s-down>
rangeSelectUp: <s-up>
prevBlock: <left>
nextBlock: <right>
prevBlock-alt: h
nextBlock-alt: i
nextBlock-alt2: <tab>
prevBlock-alt2: <backtab>
jumpToBlock:
- "1"
- "2"
- "3"
- "4"
- "5"
nextMatch: "k"
prevMatch: "K"
startSearch: /
optionMenu: <disabled>
optionMenu-alt1: "?"
select: <space>
goInto: <enter>
confirm: <enter>
confirmInEditor: <a-enter>
remove: d
new: "n"
edit: l
openFile: o
scrollUpMain: <pgup>
scrollDownMain: <pgdown>
scrollUpMain-alt1: K
scrollDownMain-alt1: J
scrollUpMain-alt2: <c-u>
scrollDownMain-alt2: <c-d>
executeShellCommand: ":"
createRebaseOptionsMenu: m
# 'Files' appended for legacy reasons
pushFiles: P
# 'Files' appended for legacy reasons
pullFiles: p
refresh: R
createPatchOptionsMenu: <c-p>
nextTab: "]"
prevTab: "["
nextScreenMode: +
prevScreenMode: _
undo: z
redo: <c-z>
filteringMenu: <c-s>
diffingMenu: W
diffingMenu-alt: <c-e>
copyToClipboard: <c-o>
openRecentRepos: <c-r>
submitEditorText: <enter>
extrasMenu: "@"
toggleWhitespaceInDiffView: <c-w>
increaseContextInDiffView: "}"
decreaseContextInDiffView: "{"
increaseRenameSimilarityThreshold: )
decreaseRenameSimilarityThreshold: (
openDiffTool: <c-t>
status:
checkForUpdate: u
recentRepos: <enter>
allBranchesLogGraph: a
files:
commitChanges: c
commitChangesWithoutHook: w
amendLastCommit: A
commitChangesWithEditor: C
findBaseCommitForFixup: <c-f>
confirmDiscard: x
ignoreFile: i
refreshFiles: r
stashAllChanges: s
viewStashOptions: S
toggleStagedAll: a
viewResetOptions: D
fetch: f
toggleTreeView: "`"
openMergeTool: M
openStatusFilter: <c-b>
copyFileInfoToClipboard: "y"
branches:
createPullRequest: o
viewPullRequestOptions: O
copyPullRequestURL: <c-y>
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: <c-j>
moveUpCommit: <c-k>
amendToCommit: A
resetCommitAuthor: a
pickCommit: p
revertCommit: t
cherryPickCopy: C
pasteCommits: V
markCommitAsBaseForRebase: B
tagCommit: T
checkoutCommit: <space>
resetCherryPick: <c-R>
copyCommitAttributeToClipboard: "y"
openLogMenu: <c-l>
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: <c-o>

View file

@ -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", "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": { "logo": {
@ -59,4 +59,4 @@
"poweradapter", "poweradapter",
"locale" "locale"
] ]
} }

4
platforms/win/glzr/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force
boilerplate*
starter/
neobrutal/

View file

@ -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"]

View file

@ -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"
```

View file

@ -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"
}
}
]
}

View file

@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Base styles for better consistency across platforms (aka. CSS reset). -->
<link rel="stylesheet" type="text/css" href="../normalize.css" />
<!-- Custom styles. -->
<link rel="stylesheet" type="text/css" href="./styles.css" />
<!-- Add empty favicon to suppress not found errors. -->
<link rel="icon" href="data:;" />
<!-- Allows React to be run buildless via "text/babel" script below. -->
<script
src="https://unpkg.com/@babel/standalone@7.25.6/babel.min.js"
integrity="sha256-aS0B0wnsaDByLfE16h4MDCP1fQFccysd1YWOcV+gbBo="
crossorigin="anonymous"
></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel" data-type="module" src="./scripts.jsx">
</script>
</body>
</html>

View file

@ -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 <i className="nf nf-md-ethernet_cable"></i>;
case 'wifi':
if (networkOutput.defaultGateway?.signalStrength >= 80) {
return <i className="nf nf-md-wifi_strength_4"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 65
) {
return <i className="nf nf-md-wifi_strength_3"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 40
) {
return <i className="nf nf-md-wifi_strength_2"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 25
) {
return <i className="nf nf-md-wifi_strength_1"></i>;
} else {
return <i className="nf nf-md-wifi_strength_outline"></i>;
}
default:
return (
<i className="nf nf-md-wifi_strength_off_outline"></i>
);
}
}
// Get icon to show for how much of the battery is charged.
function getBatteryIcon(batteryOutput) {
if (batteryOutput.chargePercent > 90)
return <i className="nf nf-fa-battery_4"></i>;
if (batteryOutput.chargePercent > 70)
return <i className="nf nf-fa-battery_3"></i>;
if (batteryOutput.chargePercent > 40)
return <i className="nf nf-fa-battery_2"></i>;
if (batteryOutput.chargePercent > 20)
return <i className="nf nf-fa-battery_1"></i>;
return <i className="nf nf-fa-battery_0"></i>;
}
// Get icon to show for current weather status.
function getWeatherIcon(weatherOutput) {
switch (weatherOutput.status) {
case 'clear_day':
return <i className="nf nf-weather-day_sunny"></i>;
case 'clear_night':
return <i className="nf nf-weather-night_clear"></i>;
case 'cloudy_day':
return <i className="nf nf-weather-day_cloudy"></i>;
case 'cloudy_night':
return <i className="nf nf-weather-night_alt_cloudy"></i>;
case 'light_rain_day':
return <i className="nf nf-weather-day_sprinkle"></i>;
case 'light_rain_night':
return <i className="nf nf-weather-night_alt_sprinkle"></i>;
case 'heavy_rain_day':
return <i className="nf nf-weather-day_rain"></i>;
case 'heavy_rain_night':
return <i className="nf nf-weather-night_alt_rain"></i>;
case 'snow_day':
return <i className="nf nf-weather-day_snow"></i>;
case 'snow_night':
return <i className="nf nf-weather-night_alt_snow"></i>;
case 'thunder_day':
return <i className="nf nf-weather-day_lightning"></i>;
case 'thunder_night':
return <i className="nf nf-weather-night_alt_lightning"></i>;
}
}
createRoot(document.getElementById('root')).render(<App />);
function App() {
const [output, setOutput] = useState(providers.outputMap);
useEffect(() => {
providers.onOutput(() => setOutput(providers.outputMap));
}, []);
return (
<div className="app">
<div className="left">
<i className="logo nf nf-custom-windows"></i>
{output.glazewm && (
<div className="workspaces">
{output.glazewm.currentWorkspaces.map(workspace => (
<button
className={`workspace ${workspace.hasFocus && 'focused'} ${workspace.isDisplayed && 'displayed'}`}
onClick={() =>
output.glazewm.runCommand(
`focus --workspace ${workspace.name}`,
)
}
key={workspace.name}
>
{workspace.displayName ?? workspace.name}
</button>
))}
</div>
)}
</div>
<div className="center">{output.date?.formatted}</div>
<div className="right">
{output.glazewm && (
<>
{output.glazewm.bindingModes.map(bindingMode => (
<button
className="binding-mode"
key={bindingMode.name}
onClick={() =>
output.glazewm.runCommand(
`wm-disable-binding-mode --name ${bindingMode.name}`,
)
}
>
{bindingMode.displayName ?? bindingMode.name}
</button>
))}
<button
className={`tiling-direction nf ${output.glazewm.tilingDirection === 'horizontal' ? 'nf-md-swap_horizontal' : 'nf-md-swap_vertical'}`}
onClick={() =>
output.glazewm.runCommand('toggle-tiling-direction')
}
></button>
</>
)}
{output.network && (
<div className="network">
{getNetworkIcon(output.network)}
{output.network.defaultGateway?.ssid}
</div>
)}
{output.memory && (
<div className="memory">
<i className="nf nf-fae-chip"></i>
{Math.round(output.memory.usage)}%
</div>
)}
{output.cpu && (
<div className="cpu">
<i className="nf nf-oct-cpu"></i>
{/* Change the text color if the CPU usage is high. */}
<span
className={output.cpu.usage > 85 ? 'high-usage' : ''}
>
{Math.round(output.cpu.usage)}%
</span>
</div>
)}
{output.battery && (
<div className="battery">
{/* Show icon for whether battery is charging. */}
{output.battery.isCharging && (
<i className="nf nf-md-power_plug charging-icon"></i>
)}
{getBatteryIcon(output.battery)}
{Math.round(output.battery.chargePercent)}%
</div>
)}
{output.weather && (
<div className="weather">
{getWeatherIcon(output.weather)}
{Math.round(output.weather.celsiusTemp)}°C
</div>
)}
</div>
</div>
);
}

View file

@ -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;
}

204
platforms/win/glzr/zebar/normalize.css vendored Normal file
View file

@ -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;
}

View file

@ -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"
}
]
}

View file

@ -1,9 +0,0 @@
function Invoke-Completion {
param ([string]$command)
switch ($command) {
'docker' { docker completion powershell | Out-String | Invoke-Expression }
'git' { Import-Module Posh-Git }
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
}
}

View file

@ -130,6 +130,7 @@ const _addSearchAlias = function (alias, name, searchUrl, searchPrefix = 's', ac
api.addSearchAlias(alias, name, searchUrl, searchPrefix, acUrl, parseResponse); api.addSearchAlias(alias, name, searchUrl, searchPrefix, acUrl, parseResponse);
} }
// #endregion // #endregion
// #region Keymap // #region Keymap
const mapLists = { const mapLists = {
/// scroll page /// scroll page
@ -227,7 +228,6 @@ _addSearchAlias('br', 'Brew', 'https://duckduckgo.com/?q=!brew ')
// #endregion // #endregion
// #region Site-specific // #region Site-specific
// chatgpt.com // chatgpt.com
api.unmap('t', /chatgpt.com/); api.unmap('t', /chatgpt.com/);
api.mapkey('tn', 'New Chat', function () { api.mapkey('tn', 'New Chat', function () {
@ -246,245 +246,28 @@ api.mapkey('S', 'Start/Stop Generating', function () {
var btn = document.querySelector('button.h-8:nth-child(2)'); var btn = document.querySelector('button.h-8:nth-child(2)');
btn.click(); btn.click();
}, { domain: /chatgpt.com/ }); }, { domain: /chatgpt.com/ });
<<<<<<< HEAD
=======
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/ });
>>>>>>> 9557dcb023a49b72674bff74180d1d4224b959e0
// perplexity.ai // perplexity.ai
api.unmap('<Ctrl-i>', /perplexity.ai/); api.unmap('<Ctrl-i>', /perplexity.ai/);
// #endregion // #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.</ctrl-i></ctrl-y>
// #endregion

View file

@ -31,5 +31,6 @@ Set-Alias "py" "python"
Set-Alias "ipy" "ipython" Set-Alias "ipy" "ipython"
if ($isWindows) { if ($isWindows) {
function kex { wsl -d kali-linux kex --sl -s } # Debugging
# function kex { wsl -d kali-linux kex --sl -s }
} }

View file

@ -0,0 +1,42 @@
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' {
# 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', 'dotnet', 'git', 'hugo', 'pip', 'rg', 'uv', 'wezterm', 'winget')
$cmds | Where-Object { $_ -like "$wordToComplete*" }
}

View file

@ -1,7 +1,8 @@
# Use XDG Base Directory Specification and its similar structure for Windows
# wget if ($Env:WEZTERM) {
${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args} # Environment variable injected by wezterm/wezterm.lua
${function:icat} = { wezterm imgcat $args }
# yarn v1 }
${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args} elseif ($Env:KITTY) {
${function:icat} = { kitty +kitten icat $args }
}

View file

@ -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 "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine 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 <Tab> to Invoke MenuComplete ## Use <Tab> to Invoke MenuComplete
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete

View file

@ -1,4 +1,4 @@
Import-Module -Name Terminal-Icons # Import-Module -Name Terminal-Icons
Import-Module -Name CompletionPredictor Import-Module -Name CompletionPredictor
if ($IsWindows) { if ($IsWindows) {
# Chocolatey # Chocolatey

View file

@ -20,3 +20,20 @@ This is the cross-platform PowerShell profile for PowerShell Core
| `^a` | To Beginning of Line | All | | `^a` | To Beginning of Line | All |
| `^e` | To End of Line | All | | `^e` | To End of Line | All |
| `^[` | To Normal Mode | Insert | | `^[` | 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'
```

121
tools/wezterm/wezterm.lua Normal file
View file

@ -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