mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 00:33:00 +00:00
feat(glazewm): Change Windows TWM to GlazeWM
This commit is contained in:
parent
4657765e21
commit
22ca99086c
16 changed files with 999 additions and 253 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,6 @@
|
||||||
|
# Log
|
||||||
|
*.log
|
||||||
|
|
||||||
# Private Files
|
# Private Files
|
||||||
*private*
|
*private*
|
||||||
.private.env.*
|
.private.env.*
|
||||||
|
|
|
||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
|
@ -30,4 +30,8 @@
|
||||||
".wslconfig": "properties",
|
".wslconfig": "properties",
|
||||||
"WindowsTerminal.json": "jsonc",
|
"WindowsTerminal.json": "jsonc",
|
||||||
},
|
},
|
||||||
|
"[json]": {
|
||||||
|
"editor.formatOnPaste": false,
|
||||||
|
"editor.formatOnSave": false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
17
bootstrap/common-pm.txt
Normal file
17
bootstrap/common-pm.txt
Normal 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
|
||||||
20
bootstrap/win/Defender.ps1
Normal file
20
bootstrap/win/Defender.ps1
Normal 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
|
||||||
4
platforms/win/glzr/.gitignore
vendored
Normal file
4
platforms/win/glzr/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\platforms\win\glzr -Force
|
||||||
|
boilerplate*
|
||||||
|
starter/
|
||||||
|
neobrutal/
|
||||||
314
platforms/win/glzr/glazewm/config.yaml
Normal file
314
platforms/win/glzr/glazewm/config.yaml
Normal 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"]
|
||||||
29
platforms/win/glzr/readme.md
Normal file
29
platforms/win/glzr/readme.md
Normal 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"
|
||||||
|
```
|
||||||
22
platforms/win/glzr/zebar/minimal/bar.zebar.json
Normal file
22
platforms/win/glzr/zebar/minimal/bar.zebar.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
29
platforms/win/glzr/zebar/minimal/index.html
Normal file
29
platforms/win/glzr/zebar/minimal/index.html
Normal 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>
|
||||||
197
platforms/win/glzr/zebar/minimal/scripts.jsx
Normal file
197
platforms/win/glzr/zebar/minimal/scripts.jsx
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
115
platforms/win/glzr/zebar/minimal/styles.css
Normal file
115
platforms/win/glzr/zebar/minimal/styles.css
Normal 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
204
platforms/win/glzr/zebar/normalize.css
vendored
Normal 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;
|
||||||
|
}
|
||||||
9
platforms/win/glzr/zebar/settings.json
Normal file
9
platforms/win/glzr/zebar/settings.json
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -73,6 +73,7 @@ const forwardFactory = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region Keymap
|
// #region Keymap
|
||||||
const mapLists = {
|
const mapLists = {
|
||||||
/// scroll page
|
/// scroll page
|
||||||
|
|
@ -165,7 +166,6 @@ api.addSearchAlias('c', 'ChatGPT', 'https://chatgpt.com/?q=', 's', 'https://duck
|
||||||
// #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 () {
|
||||||
|
|
@ -184,245 +184,24 @@ 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/ });
|
||||||
|
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 () {
|
//api.mapkey('tm', 'Toggle Model', function () {
|
||||||
// var btn = document.querySelector('#radix -\: r2i\:');
|
// var btn = document.querySelector('#radix -\: r2i\:');
|
||||||
// btn.click();
|
// btn.click();
|
||||||
//}, { domain: /chatgpt.com/ });
|
//}, { domain: /chatgpt.com/ });
|
||||||
|
// 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
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,19 @@ function Invoke-Completion {
|
||||||
param ([string]$command)
|
param ([string]$command)
|
||||||
switch ($command) {
|
switch ($command) {
|
||||||
'docker' { docker completion powershell | Out-String | Invoke-Expression }
|
'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 }
|
'git' { Import-Module Posh-Git }
|
||||||
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
|
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
|
||||||
'pip' { pip 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 }
|
'uv' { uv generate-shell-completion powershell | Out-String | Invoke-Expression }
|
||||||
'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression }
|
'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression }
|
||||||
'winget' {
|
'winget' {
|
||||||
|
|
@ -26,7 +36,7 @@ Set-Alias "icmp" "Invoke-Completion"
|
||||||
Register-ArgumentCompleter -CommandName Invoke-Completion -ParameterName 'command' -ScriptBlock {
|
Register-ArgumentCompleter -CommandName Invoke-Completion -ParameterName 'command' -ScriptBlock {
|
||||||
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
|
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*" }
|
$cmds | Where-Object { $_ -like "$wordToComplete*" }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,8 @@
|
||||||
# Use XDG Base Directory Specification and its similar structure for Windows
|
|
||||||
|
|
||||||
# wget
|
if ($Env:WEZTERM) {
|
||||||
if (Get-Command wget -ErrorAction SilentlyContinue) {
|
# Environment variable injected by wezterm/wezterm.lua
|
||||||
${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args}
|
${function:icat} = { wezterm imgcat $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}
|
|
||||||
}
|
}
|
||||||
elseif ($Env:KITTY) {
|
elseif ($Env:KITTY) {
|
||||||
${function:icat} = {kitty +kitten icat $args}
|
${function:icat} = { kitty +kitten icat $args }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue