Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
js0ny 2024-12-19 20:10:24 +00:00
commit ea9d6d0c5f
67 changed files with 5519 additions and 1591 deletions

15
platforms/linux/zshrc Normal file
View file

@ -0,0 +1,15 @@
# Use powerline
USE_POWERLINE="true"
# Has weird character width
# Example:
#  is not a diamond
HAS_WIDECHARS="false"
alias open=dolphin
# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
source /usr/share/zsh/manjaro-zsh-config
fi
# Use manjaro zsh prompt
# if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
# source /usr/share/zsh/manjaro-zsh-prompt
# fi

View file

@ -0,0 +1,11 @@
// ~/Library/Keybindings/DefaultKeyBinding.dict
{
// Colemak Vim Style Arrows
"^h" = "moveBackward:";
"^n" = "moveDown:";
"^e" = "moveUp:";
"^i" = "moveForward:";
// Colemak Vim Style Home/End, Insert & Append
"^l" = "moveToBeginningOfLine:";
"^a" = "moveToEndOfLine:";
}

View file

@ -0,0 +1,28 @@
#!/bin/sh
PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)"
CHARGING="$(pmset -g batt | grep 'AC Power')"
if [ "$PERCENTAGE" = "" ]; then
exit 0
fi
case "${PERCENTAGE}" in
9[0-9]|100) ICON=""
;;
[6-8][0-9]) ICON=""
;;
[3-5][0-9]) ICON=""
;;
[1-2][0-9]) ICON=""
;;
*) ICON=""
esac
if [[ "$CHARGING" != "" ]]; then
ICON=""
fi
# The item invoking this script (name $NAME) will get its icon and label
# updated with the current battery status
sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%"

View file

@ -0,0 +1,8 @@
#!/bin/sh
# The $NAME variable is passed from sketchybar and holds the name of
# the item invoking this script:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
sketchybar --set "$NAME" label="$(date '+%d日周%u %H:%M')"

View file

@ -0,0 +1,10 @@
#!/bin/sh
# Some events send additional information specific to the event in the $INFO
# variable. E.g. the front_app_switched event sends the name of the newly
# focused application in the $INFO variable:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
if [ "$SENDER" = "front_app_switched" ]; then
sketchybar --set "$NAME" label="$INFO"
fi

View file

@ -0,0 +1,8 @@
#!/bin/bash
music_info=$(curlie GET http://localhost:10767/api/v1/playback/now-playing | jq -r '"\(.info.name) - \(.info.artistName)"')
ICON=""
sketchybar --set $NAME label="$music_info" icon="$ICON"

View file

@ -0,0 +1,7 @@
#!/bin/sh
# The $SELECTED variable is available for space components and indicates if
# the space invoking this script (with name: $NAME) is currently selected:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
sketchybar --set "$NAME" background.drawing="$SELECTED"

View file

@ -0,0 +1,20 @@
#!/bin/sh
# The volume_change event supplies a $INFO variable in which the current volume
# percentage is passed to the script.
if [ "$SENDER" = "volume_change" ]; then
VOLUME="$INFO"
case "$VOLUME" in
[6-9][0-9]|100) ICON="󰕾"
;;
[3-5][0-9]) ICON="󰖀"
;;
[1-9]|[1-2][0-9]) ICON="󰕿"
;;
*) ICON="󰖁"
esac
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
fi

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/mac/sketchybarrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Author: js0ny
# TODO: Reorganize this file
# This is a demo config to showcase some of the most important commands.
# It is meant to be changed and configured, as it is intentionally kept sparse.
@ -41,7 +41,7 @@ sketchybar --default "${default[@]}"
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
# to indicate active and available mission control spaces.
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
SPACE_ICONS=("" "" "" "󰖟" "" "" "7" "8" "9" "10")
for i in "${!SPACE_ICONS[@]}"
do
sid="$(($i+1))"
@ -89,7 +89,7 @@ sketchybar --add item clock center \
--add item battery right \
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
--subscribe battery system_woke power_source_change \
--add item apple_music right
--add item apple_music right
sketchybar --add item music right
sketchybar --set music \

View file

@ -1,36 +1,174 @@
# $DOTFILES/platforms/mac/skhdrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Author: js0ny
# Location: $XDG_CONFIG_HOME/skhd/skhdrc
# Linking:
# ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc
# # Location: $XDG_CONFIG_HOME/skhd/skhdrc
# # Linking:
# # ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc
# Navigation
cmd - h : yabai -m window --focus west
cmd - n : yabai -m window --focus south
cmd - e : yabai -m window --focus north
cmd - i : yabai -m window --focus east
# # Navigation
# alt - h : yabai -m window --focus west
# alt - n : yabai -m window --focus south
# alt - e : yabai -m window --focus north
# alt - i : yabai -m window --focus east
# Moving windows
# # Moving windows
# shift + alt - h : yabai -m window --warp west
# shift + alt - n : yabai -m window --warp south
# shift + alt - e : yabai -m window --warp north
# shift + alt - i : yabai -m window --warp east
# ctrl - 1 : yabai -m space --focus 1
# ctrl - 2 : yabai -m space --focus 2
# ctrl - 3 : yabai -m space --focus 3
# ctrl - 4 : yabai -m space --focus 4
# ctrl - 5 : yabai -m space --focus 5
# ctrl - 6 : yabai -m space --focus 6
# ctrl - 7 : yabai -m space --focus 7
# ctrl - 8 : yabai -m space --focus 8
# ctrl - 9 : yabai -m space --focus 9
# ctrl - 0 : yabai -m space --focus 10
# # minimize window
# alt - m : yabai -m window --minimize
# # float / unfloat window and center on screen
# alt - f : yabai -m window --toggle float
# # toggle window native fullscreen
# shift + alt - f : yabai -m window --toggle native-fullscreen
# # send window to a space
# shift + ctrl - 1 : yabai -m window --space 1
# shift + ctrl - 2 : yabai -m window --space 2
# shift + ctrl - 3 : yabai -m window --space 3
# shift + ctrl - 4 : yabai -m window --space 4
# shift + ctrl - 5 : yabai -m window --space 5
# shift + ctrl - 6 : yabai -m window --space 6
# shift + ctrl - 7 : yabai -m window --space 7
# shift + ctrl - 8 : yabai -m window --space 8
# shift + ctrl - 9 : yabai -m window --space 9
# shift + ctrl - 0 : yabai -m window --space 10
# open terminal
ctrl - r : open -n -a "Kitty"
# moves focus between windows in the current focused display
alt - h : yabai -m window --focus west
alt - n : yabai -m window --focus south
alt - e : yabai -m window --focus north
alt - i : yabai -m window --focus east
# moves focus between spaces
alt - 1 : yabai -m space --focus 1
alt - 2 : yabai -m space --focus 2
alt - 3 : yabai -m space --focus 3
alt - 4 : yabai -m space --focus 4
alt - 5 : yabai -m space --focus 5
alt - 6 : yabai -m space --focus 6
alt - 7 : yabai -m space --focus 7
alt - 8 : yabai -m space --focus 8
alt - 9 : yabai -m space --focus 9
alt - 0 : yabai -m space --focus 10
# delete focused space
alt - q : yabai -m space --destroy
# toggle window split type
alt - e : yabai -m window --toggle split
# close window
alt - x : yabai -m window --close
# minimize window
alt - m : yabai -m window --minimize
# rotate tree
alt - r : yabai -m space --rotate 90
# mirror tree y-axis
alt - y : yabai -m space --mirror y-axis
# toggle desktop offset
alt - a : yabai -m space --toggle padding; yabai -m space --toggle gap
# toggle window parent zoom
alt - d : yabai -m window --focus mouse && \
yabai -m window --toggle zoom-parent
# float / unfloat window and center on screen
alt - t : yabai -m window --toggle float;\
yabai -m window --grid 4:4:1:1:2:2
# toggle window fullscreen zoom
alt - f : yabai -m window --focus mouse && \
yabai -m window --toggle zoom-fullscreen
# toggle window native fullscreen
shift + alt - f : yabai -m window --toggle native-fullscreen
# increase gap in focused space
alt - g : yabai -m space --gap rel:10
# decrease gap in focused space
shift + alt - g : yabai -m space --gap rel:-10
# create a new space and follow focus
alt - n : yabai -m space --create && \
index="$(yabai -m query --displays --display | jq '.spaces[-1]')" && \
yabai -m space --focus "${index}"
# create a new space, move window and follow focus
shift + alt - n : yabai -m space --create && \
index="$(yabai -m query --displays --display | jq '.spaces[-1]')" && \
yabai -m window --space "${index}" && \
yabai -m space --focus "${index}"
# balance size of windows
shift + alt - 0 : yabai -m space --balance
# swap window
shift + alt - h : yabai -m window --swap west
shift + alt - n : yabai -m window --swap south
shift + alt - e : yabai -m window --swap north
shift + alt - i : yabai -m window --swap east
# move window
shift + cmd - h : yabai -m window --warp west
shift + cmd - n : yabai -m window --warp south
shift + cmd - e : yabai -m window --warp north
shift + cmd - i : yabai -m window --warp east
shift + alt - h : \
yabai -m window --resize left:-20:0 ; \
yabai -m window --resize right:-20:0
# send window to a space
shift + alt - 1 : yabai -m window --space 1
shift + alt - 2 : yabai -m window --space 2
shift + alt - 3 : yabai -m window --space 3
shift + alt - 4 : yabai -m window --space 4
shift + alt - 5 : yabai -m window --space 5
shift + alt - 6 : yabai -m window --space 6
shift + alt - 7 : yabai -m window --space 7
shift + alt - 8 : yabai -m window --space 8
shift + alt - 9 : yabai -m window --space 9
shift + alt - 0 : yabai -m window --space 10
shift + alt - n : \
yabai -m window --resize bottom:0:20 ; \
yabai -m window --resize top:0:20
# change layout of desktop
ctrl + alt - a : yabai -m space --layout bsp
ctrl + alt - d : yabai -m space --layout float
shift + alt - e : \
yabai -m window --resize top:0:-20 ; \
yabai -m window --resize bottom:0:-20
# increase window size
ctrl + alt - h : yabai -m window --resize left:-40:0
ctrl + alt - n : yabai -m window --resize bottom:0:40
ctrl + alt - e : yabai -m window --resize top:0:-40
ctrl + alt - i : yabai -m window --resize right:40:0
shift + alt - i : \
yabai -m window --resize right:20:0 ; \
yabai -m window --resize left:20:0
# decrease window size
ctrl + alt + cmd - h : yabai -m window --resize left:40:0
ctrl + alt + cmd - n : yabai -m window --resize bottom:0:-40
ctrl + alt + cmd - e : yabai -m window --resize top:0:40
ctrl + alt + cmd - i : yabai -m window --resize right:-40:0
# restart yabai
ctrl + alt + cmd - r : launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"
ctrl + alt + cmd - o : node ~/Projects/Personal/philips-hue-experiments/commands/turn-on.js --all
ctrl + alt + cmd - f : node ~/Projects/Personal/philips-hue-experiments/commands/turn-off.js --all

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh
# $DOTFILES/platforms/mac/yabairc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Author: js0ny
# TODO: Reorganize this file
#

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/mac/zshrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Author: js0ny
# Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用macOS 特定配置
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
@ -25,3 +25,4 @@ fi
unset __conda_setup
# <<< conda initialize <<<
alias start-twm="source $DOTFILES/scripts/__twm_osx_start.zsh"

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms\win\Microsoft.PowerShell_profile.ps1
# Date: 2024-12-01
# Author: contact@js0ny.net
# Author: js0ny
# PowerShell profile for Windows
### Load Configs ###
@ -72,3 +72,5 @@ ${function:wini} = { winget install $args }
${function:winr} = { winget uninstall $args }
${function:wins} = { winget search $args }
${function:winu} = { winget upgrade $args }
${function:killp} = {ps | ? ProcessName -like $args | kill -Force}

View file

@ -0,0 +1,90 @@
Shortcuts [
[
Cmd = CmdToggleBookmark
Key = Ctrl + \\
]
[
Cmd = CmdRenameFile
Key = R
]
[
Cmd = CmdFindNext
Key = k
]
[
Cmd = CmdFindPrev
Key = K
]
[
Cmd = CmdScrollUp
Key = e
]
[
Cmd = CmdScrollDown
Key = n
]
[
Cmd = CmdScrollUpHalfPage
Key = E
]
[
Cmd = CmdScrollDownHalfPage
Key = N
]
[
Cmd = CmdScrollRight
Key = i
]
[
Cmd = CmdInvertColors
Key = l
]
[
Cmd = CmdPrevTab
Key = Shift+H
]
[
Cmd = CmdNextTab
Key = Shift+I
]
[
Cmd = CmdGoToFirstPage
Key = g
]
[
Cmd = CmdGoToLastPage
Key = G
]
[
Cmd = CmdGoToPage
Key = :
]
[
Cmd = CmdRotateLeft
Key = {
]
[
Cmd = CmdRotateRight
Key = }
]
[
Cmd = CmdNavigateBack
Key = [
]
[
Cmd = CmdNavigateForward
Key = ]
]
[
Cmd = CmdNavigateBack
Key = b
]
[
Cmd = CmdNavigateForward
Key = f
]
[
Cmd = CmdHelpOpenKeyboardShortcuts
Key = ?
]
]

View file

@ -1,33 +1,142 @@
#Requires AutoHotkey v2.0
; #b::
; Run '"C:\Program Files\Zotero\zotero.exe"'
; return
; #f::
; Run '"C:\Program Files\GPSoftware\Directory Opus\dopus.exe"'
; return
; #q::
; Send '!{F4}'
; return
; #r::
; Run '"C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.21.3231.0_x64__8wekyb3d8bbwe\wt.exe"'
; return
#h::
Send '{Left}'
return
{
Send("{Left}")
}
#n::
Send '{Down}'
return
{
Send("{Down}")
}
#e::
Send '{Up}'
return
{
Send("{Up}")
}
#i::
Send '{Right}'
return
{
Send("{Right}")
}
{
Send("{Home}")
}
#a:: ; Vim-like navigation: Append
{
Send("{End}")
}
#q:: ; Simulate cmd+q in macOS
{
Send("!{F4}")
}
; 定义一个全局状态变量,标记是否触发了组合键
global CapsLockState := false
; 当 CapsLock 作为修饰键与其他键一起使用时
CapsLock & s:: {
global CapsLockState
CapsLockState := true
Run("ShareX.exe -RectangleRegion")
}
; 单独按下 CapsLock 时,发送 Esc
CapsLock:: {
global CapsLockState
; 如果之前未使用组合键,则发送 Esc
if not CapsLockState {
Send("{Esc}")
}
CapsLockState := false ; 重置状态
}
; 释放 CapsLock 时重置状态
*CapsLock Up:: {
global CapsLockState
CapsLockState := false
}
#HotIf WinActive('ahk_exe' 'QQ.exe')
^n::
{
Send("^{Down}")
}
^h::
{
Send("^{Left}")
}
^i::
{
Send("^{Enter}")
}
^e::
{
Send("^{Up}")
}
#HotIf WinActive('ahk_exe' 'Weixin.exe')
^n::
{
Send("{Down}")
}
^e::
{
Send("{Up}")
}
#HotIf WinActive('ahk_exe' 'Discord.exe')
^n::
{
Send("^!{Down}")
}
^e::
{
Send("^!{Up}")
}
#HotIf WinActive('ahk_exe' 'olk.exe')
^n::
{
Send("{Down}")
}
^+n::
{
Send("^.")
}
^+e::
{
Send("^,")
}
^e::
{
Send("{Up}")
}
#HotIf WinActive('ahk_exe' 'SumatraPDF.exe')
^\::
{
Send("{F12}")
}
#HotIf WinActive('ahk_exe' 'Flow.Launcher.exe')
^a::
{
Send("{End}")
}
^+a::
{
Send("^a")
}
^l::
{
Send("{Home}")
}
^+BackSpace::
{
Send("^a{Backspace}")
}
#HotIf WinActive('ahk_exe' 'Obsidian.exe')
^e::
{
Send("^p")
}
#HotIf

View file

@ -6,8 +6,6 @@ for /f "usebackq tokens=2*" %%a in (`reg query %regPath% /v AppsUseLightTheme ^|
if "%currentMode%"=="0x1" (
reg add %regPath% /v AppsUseLightTheme /t REG_DWORD /d 0 /f >nul
echo <20><><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD>ɫģʽ
) else (
reg add %regPath% /v AppsUseLightTheme /t REG_DWORD /d 1 /f >nul
echo <20><><EFBFBD>л<EFBFBD><D0BB><EFBFBD>dzɫģʽ
)

View file

@ -1,6 +1,6 @@
# $DOTFILES\platforms\win\wslconfig
# Date: 2024-12-01
# Author: contact@js0ny.net
# Author: js0ny
# Config Files (mainly for networking) for WSL2 (Windows Subsystem for Linux 2)
# 适用于 Windows 的 Linux 子系统 2 的配置文件(主要用于网络)
@ -12,6 +12,7 @@
# dnsTunneling=true
# firewall=true
# autoProxy=true
guiApplications=true
[experimental]
# requires dnsTunneling but are also OPTIONAL

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/wsl/zshrc
# Date: 2024-12-01
# Author: contact@js0ny.net
# Author: js0ny
# Sourced by user's zshrc if is WSL 在用户的 zshrc 中被引用WSL 特定配置
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)