Skip to content

Instantly share code, notes, and snippets.

@dontdieych
dontdieych / smart-caps-lock.md
Last active April 30, 2024 05:58 — forked from ivyxjc/smart-caps-lock.md
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
[root@nixos1:/etc/nixos]# nixos-rebuild switch
building the system configuration...
trace: warning: system.stateVersion is not set, defaulting to 23.05. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.
trace: warning: The option `boot.cleanTmpDir' defined in `/nix/store/k0i4ccmisxs3b3yh015jb32vg0qlzpix-source/configuration.nix' has been renamed to `boot.tmp.cleanOnBoot'.
updating GRUB 2 menu...
cannot copy /nix/store/r80r91zqfg25516i7wz49vd5paiwd1g5-linux-5.15.110/Image to /boot/kernels/r80r91zqfg25516i7wz49vd5paiwd1g5-linux-5.15.110-Image.tmp: No space left on device
warning: error(s) occurred while switching to the new configuration
[root@nixos1:/etc/nixos]# df -h
{
description = "Home Manager configuration of alarm";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
Main.hs has auto save data; consider M-x recover-this-file
[yas] Prepared just-in-time loading of snippets successfully.
Invalid face reference: 999
Invalid face reference: 1
Invalid face reference: 999
Invalid face reference: 1
Invalid face reference: 999
Invalid face reference: 1
Invalid face reference: 999
Invalid face reference: 1
Build profile: -w ghc-9.2.7 -O1
In order, the following will be built (use -v for more details):
- hs1-0.1.0.0 (exe:hs1) (file app/Main.hs changed)
Preprocessing executable 'hs1' for hs1-0.1.0.0..
Building executable 'hs1' for hs1-0.1.0.0..
[1 of 1] Compiling Main ( app/Main.hs, /home/alarm/hs1/dist-newstyle/build/aarch64-linux/ghc-9.2.7/hs1-0.1.0.0/x/hs1/build/hs1/hs1-tmp/Main.o, /home/alarm/hs1/dist-newstyle/build/aarch64-linux/ghc-9.2.7/hs1-0.1.0.0/x/hs1/build/hs1/hs1-tmp/Main.dyn_o )
app/Main.hs:95:6: error:
• Couldn't match expected type ‘a’ with actual type ‘Client’
‘a’ is a rigid type variable bound by
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE StandaloneDeriving #-}
-- {-# LANGUAGE UndecidableInstances #-}
-- {-# LANGUAGE DataKinds #-}
-- {-# LANGUAGE FlexibleInstances #-}
#!/usr/bin/env fish
function quake3 --description 'run quake3e on 1920x1080'
# Check current inhibited status. if false, turn on do not disturb by global shortcut.
if string match -q -r '^false$' (qdbus org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.Inhibited)
qdbus org.kde.kglobalaccel /component/plasmashell invokeShortcut "toggle do not disturb"
end
# Do something
# xrandr --output eDP-1 --mode 1920x1080
# and ENABLE_VKBASALT=1 VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json \
#!/usr/bin/env fish
function ,paste --description 'Record terminal session then paste to paste.rs'
set _tmp_file (mktemp)
script -q $_tmp_file
and head -n-1 $_tmp_file |\
tail -n+2 |\
strip-ansi |\
curl --silent --data-binary @- https://paste.rs/ |\
xsel -b $argv
[Desktop Action new-private-window]
Exec=/home/a/Downloads/firefox/firefox --private-window %u
Name[en_US]=New Private Window
Name=New Private Window
Name[ach]=Dirica manyen me mung
Name[af]=Nuwe privaatvenster
Name[an]=Nueva finestra privada
Name[ar]=نافذة خاصة جديدة
Name[as]=নতুন ব্যক্তিগত উইন্ডো
Name[ast]=Ventana privada nueva
#!/usr/bin/env fish
function active-port
pacmd list-sinks |\
rg 'active port:' |\
tr -s ' ' |\
cut -d: -f2 |\
string trim
end