This commit is contained in:
Yuri Zamyatin 2025-04-20 21:36:44 +00:00
commit 14db7a80f3
48 changed files with 2567 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# Workspace
My scripts and configuration. See [blog post](https://yrz.am/posts/workspace/).

118
arch-platform/README.md Normal file
View File

@ -0,0 +1,118 @@
# arch-platform
## Introduction
This document describes disk partitioning and installation of the minimal Arch Linux system with LVM-in-LUKS, systemd-boot and network capabilities.
Created at 2022-05-22T23:58:54Z and not so well maintained as I rarely use it.
## Create installation medium
1. [Download](https://archlinux.org/download/) via torrent
2. Verify: `sha256sum <path> | grep <checksum>`
3. Find usb device name: `lsblk`
4. Create installation medium: `dd if=<path> of=/dev/<device> bs=1MiB`
## Install
1. Boot to USB image
2. On loader screen press `e`, append `nomodeset` the at end of `linux` commans
3. Partitioning: `parted <disk>` (see name via `lsblk`)
```
mklabel gpt
mkpart ESP fat32 1MiB 513MiB
set 1 boot on
mkpart primary ext4 514MiB 100%
quit
```
4. Encrypt & open:
```bash
cryptsetup luksFormat <disk>p2
cryptsetup luksOpen <disk>p2 <diskname>p2_crypt
```
5. Create volumes:
```bash
pvcreate /dev/mapper/<diskname>p2_crypt
vgcreate main /dev/mapper/<diskname>p2_crypt
lvcreate -L <RAM+2G>G main -n swap
lvcreate -L <N>G main -n root
lvcreate -l 100%FREE main -n home
```
6. Create FS:
```bash
mkfs.ext4 /dev/mapper/main-root
mkfs.ext4 /dev/mapper/main-home
mkswap /dev/mapper/main-swap
mkfs.fat -F32 /dev/<disk>p1
```
7. Mount:
```bash
mount /dev/mapper/main-root /mnt
mkdir /mnt/home /mnt/boot
mount /dev/mapper/main-home /mnt/home
mount /dev/nvme0n1p1 /mnt/boot
swapon /dev/mapper/main-swap
```
8. Wifi setup (if needed)
```bash
iwctl device list
iwctl station [device] connect [network_name]
```
9. Update keyring (iso may be too old): `pacman -Sy archlinux-keyring`
10. Install (for wifi you also need `networkmanager`):
```bash
pacstrap -i /mnt base linux linux-firmware intel-ucode lvm2 sudo vim polkit
```
11. Disks: `genfstab -U /mnt >> /mnt/etc/fstab`
12. Change root: `arch-chroot /mnt`
13. Add loader hooks: `vim /etc/mkinitcpio.conf`, set
```conf
HOOKS=(base udev autodetect microcode keyboard keymap modconf block encrypt lvm2 filesystems fsck)`
```
14. Make initrams: `mkinitcpio -p linux`
15. Install bootloader: `bootctl install --path=/boot`
16. Save disk UUID: `cryptsetup luksUUID /dev/<disk>p2 > /boot/loader/entries/arch.conf`
17. Make boot config: `vim /boot/loader/entries/arch.conf`
```conf
title Arch
linux /vmlinuz-linux
initrd /initramfs-linux.img
options quiet loglevel=3 cryptdevice=UUID=[uuid]:[disk_name]p2_crypt root=/dev/mapper/main-root rw resume=/dev/mapper/main-swap
```
18. Make generic boot config: `vim /boot/loader/loader.conf`, set `default arch`
19. Create sudo group: `groupadd -g 1000 sudo`
20. Grant privileges: `visudo`, uncomment or add line `%sudo ALL=(ALL:ALL) ALL`
21. Add user
```bash
groupadd -g 2000 <username>
useradd -m --groups sudo --gid 2000 --uid 2000 <username>
passwd <username>
```
22. `exit`, `reboot` into real system
23. login, `sudo su`
24. Uncomment locale in `/etc/locale.gen`, run `locale-gen`
25. `echo "<name>" > /etc/hostname`
26. `systemctl enable NetworkManager --now`
27. Enable and sync time: `systemctl enable systemd-timesyncd --now`
28. Get tz from `tzselect`, set via `timedatectl set-timezone [tz]`
29. Update hwclock: `hwclock -w --utc`

View File

@ -0,0 +1,580 @@
# ------------------------------------------------------------------------------
# /etc/tlp.conf - TLP user configuration (version 1.7.0)
# See full explanation: https://linrunner.de/tlp/settings
#
# Copyright (c) 2024 Thomas Koch <linrunner at gmx.net> and others.
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Settings are read in the following order:
#
# 1. Intrinsic defaults
# 2. /etc/tlp.d/*.conf - Drop-in customization snippets
# 3. /etc/tlp.conf - User configuration (this file)
#
# Notes:
# - In case of identical parameters, the last occurence has precedence
# - This also means, parameters enabled here will override anything else
# - However you may append values to a parameter already defined as intrinsic
# default or in a previously read file: use PARAMETER+="add values"
# - IMPORTANT: all parameters here are disabled; remove the leading '#' if you
# like to enable a feature without default or have a value different from the
# default
# - Default *: intrinsic default that is effective when the parameter is missing
# or disabled by a leading '#'; use PARAM="" to disable an intrinsic default
# - Default <none>: do nothing or use kernel/hardware defaults
# - IMPORTANT: parameters must always be specified pairwise i.e. for
# both AC and BAT. Omitting one of the two makes the set value effective for
# both power sources, since a change only occurs when different values are
# defined.
# ------------------------------------------------------------------------------
# tlp - Parameters for power saving
# Set to 0 to disable, 1 to enable TLP.
# Default: 1
#TLP_ENABLE=1
# Control how warnings about invalid settings are issued:
# 0=disabled,
# 1=background tasks (boot, resume, change of power source) report to syslog,
# 2=shell commands report to the terminal (stderr),
# 3=combination of 1 and 2
# Default: 3
#TLP_WARN_LEVEL=3
# Colorize error, warning, notice and success messages. Colors are specified
# with ANSI codes:
# 1=bold black, 90=grey, 91=red, 92=green, 93=yellow, 94=blue, 95=magenta,
# 96=cyan, 97=white.
# Other colors are possible, refer to:
# https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit
# Colors must be specified in the order "<error> <warning> <notice> <success>".
# By default, errors are shown in red, warnings in yellow, notices in bold
# and success in green.
# Default: "91 93 1 92"
#TLP_MSG_COLORS="91 93 1 92"
# Operation mode when no power supply can be detected: AC, BAT.
# Concerns some desktop and embedded hardware only.
# Default: <none>
#TLP_DEFAULT_MODE=AC
# Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
# Note: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
# Default: 0
#TLP_PERSISTENT_DEFAULT=0
# Power supply classes to ignore when determining operation mode: AC, USB, BAT.
# Separate multiple classes with spaces.
# Note: try on laptops where operation mode AC/BAT is incorrectly detected.
# Default: <none>
#TLP_PS_IGNORE="BAT"
# Seconds laptop mode has to wait after the disk goes idle before doing a sync.
# Non-zero value enables, zero disables laptop mode.
# Default: 0 (AC), 2 (BAT)
#DISK_IDLE_SECS_ON_AC=0
#DISK_IDLE_SECS_ON_BAT=2
# Dirty page values (timeouts in secs).
# Default: 15 (AC), 60 (BAT)
#MAX_LOST_WORK_SECS_ON_AC=15
#MAX_LOST_WORK_SECS_ON_BAT=60
# Select a CPU scaling driver operation mode.
# Intel CPU with intel_pstate driver:
# active, passive.
# AMD Zen 2 or newer CPU with amd-pstate driver as of kernel 6.3/6.4(*):
# active, passive, guided(*).
# Default: <none>
#CPU_DRIVER_OPMODE_ON_AC=active
#CPU_DRIVER_OPMODE_ON_BAT=active
# Select a CPU frequency scaling governor.
# Intel CPU with intel_pstate driver or
# AMD CPU with amd-pstate driver in active mode ('amd-pstate-epp'):
# performance, powersave(*).
# Intel CPU with intel_pstate driver in passive mode ('intel_cpufreq') or
# AMD CPU with amd-pstate driver in passive or guided mode ('amd-pstate') or
# Intel, AMD and other CPU brands with acpi-cpufreq driver:
# conservative, ondemand(*), userspace, powersave, performance, schedutil(*).
# Use tlp-stat -p to show the active driver and available governors.
# Important:
# Governors marked (*) above are power efficient for *almost all* workloads
# and therefore kernel and most distributions have chosen them as defaults.
# You should have done your research about advantages/disadvantages *before*
# changing the governor.
# Default: <none>
#CPU_SCALING_GOVERNOR_ON_AC=powersave
#CPU_SCALING_GOVERNOR_ON_BAT=powersave
# Set the min/max frequency available for the scaling governor.
# Possible values depend on your CPU. For available frequencies see
# the output of tlp-stat -p.
# Notes:
# - Min/max frequencies must always be specified for both AC *and* BAT
# - Not recommended for use with the intel_pstate driver, use
# CPU_MIN/MAX_PERF_ON_AC/BAT below instead
# Default: <none>
#CPU_SCALING_MIN_FREQ_ON_AC=0
#CPU_SCALING_MAX_FREQ_ON_AC=0
#CPU_SCALING_MIN_FREQ_ON_BAT=0
#CPU_SCALING_MAX_FREQ_ON_BAT=0
# Set CPU energy/performance policies EPP and EPB:
# performance, balance_performance, default, balance_power, power.
# Values are given in order of increasing power saving.
# Requires:
# * Intel CPU
# EPP: Intel Core i 6th gen. or newer CPU with intel_pstate driver
# EPB: Intel Core i 2nd gen. or newer CPU with intel_pstate driver
# EPP and EPB are mutually exclusive: when EPP is available, Intel CPUs
# will not honor EPB. Only the matching feature will be applied by TLP.
# * AMD Zen 2 or newer CPU
# EPP: amd-pstate driver in active mode ('amd-pstate-epp') as of kernel 6.3
# Default: balance_performance (AC), balance_power (BAT)
#CPU_ENERGY_PERF_POLICY_ON_AC=balance_performance
CPU_ENERGY_PERF_POLICY_ON_BAT=power
# Set Intel CPU P-state performance: 0..100 (%).
# Limit the max/min P-state to control the power dissipation of the CPU.
# Values are stated as a percentage of the available performance.
# Requires Intel Core i 2nd gen. or newer CPU with intel_pstate driver.
# Default: <none>
#CPU_MIN_PERF_ON_AC=0
#CPU_MAX_PERF_ON_AC=100
#CPU_MIN_PERF_ON_BAT=0
#CPU_MAX_PERF_ON_BAT=30
# Set the CPU "turbo boost" (Intel) or "turbo core" (AMD) feature:
# 0=disable, 1=allow.
# Allows to raise the maximum frequency/P-state of some cores if the
# CPU chip is not fully utilized and below it's intended thermal budget.
# Note: a value of 1 does *not* activate boosting, it just allows it.
# Default: <none>
#CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0
# Set CPU dynamic boost feature:
# 0=disable, 1=enable.
# Improve performance by increasing minimum P-state limit dynamically
# whenever a task previously waiting on I/O is selected to run.
# Requires Intel Core i 6th gen. or newer CPU: intel_pstate driver in active mode.
# Note: AMD CPUs currently have no tunable for this.
# Default: <none>
#CPU_HWP_DYN_BOOST_ON_AC=1
#CPU_HWP_DYN_BOOST_ON_BAT=0
# Kernel NMI Watchdog:
# 0=disable (default, saves power), 1=enable (for kernel debugging only).
# Default: 0
#NMI_WATCHDOG=0
# Select platform profile:
# performance, balanced, low-power.
# Controls system operating characteristics around power/performance levels,
# thermal and fan speed. Values are given in order of increasing power saving.
# Note: check the output of tlp-stat -p to determine availability on your
# hardware and additional profiles such as: balanced-performance, quiet, cool.
# Default: <none>
#PLATFORM_PROFILE_ON_AC=performance
#PLATFORM_PROFILE_ON_BAT=low-power
# System suspend mode:
# s2idle: Idle standby - a pure software, light-weight, system sleep state,
# deep: Suspend to RAM - the whole system is put into a low-power state,
# except for memory, usually resulting in higher savings than s2idle.
# CAUTION: changing suspend mode may lead to system instability and even
# data loss. As for the availability of different modes on your system,
# check the output of tlp-stat -s. If unsure, stick with the system default
# by not enabling this.
# Default: <none>
#MEM_SLEEP_ON_AC=s2idle
#MEM_SLEEP_ON_BAT=deep
# Define disk devices on which the following DISK/AHCI_RUNTIME parameters act.
# Separate multiple devices with spaces.
# Devices can be specified by disk ID also (lookup with: tlp diskid).
# Default: "nvme0n1 sda"
#DISK_DEVICES="nvme0n1 sda"
# Disk advanced power management level: 1..254, 255 (max saving, min, off).
# Levels 1..127 may spin down the disk; 255 allowable on most drives.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
# Default: 254 (AC), 128 (BAT)
#DISK_APM_LEVEL_ON_AC="254 254"
#DISK_APM_LEVEL_ON_BAT="128 128"
# Exclude disk classes from advanced power management (APM):
# sata, ata, usb, ieee1394.
# Separate multiple classes with spaces.
# CAUTION: USB and IEEE1394 disks may fail to mount or data may get corrupted
# with APM enabled. Be careful and make sure you have backups of all affected
# media before removing 'usb' or 'ieee1394' from the denylist!
# Default: "usb ieee1394"
#DISK_APM_CLASS_DENYLIST="usb ieee1394"
# Hard disk spin down timeout:
# 0: spin down disabled
# 1..240: timeouts from 5s to 20min (in units of 5s)
# 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
# See 'man hdparm' for details.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
# Default: <none>
#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
# Select I/O scheduler for the disk devices.
# Multi queue (blk-mq) schedulers:
# mq-deadline(*), none, kyber, bfq
# Single queue schedulers:
# deadline(*), cfq, bfq, noop
# (*) recommended.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the kernel default scheduler for the particular disk.
# Notes:
# - Multi queue (blk-mq) may need kernel boot option 'scsi_mod.use_blk_mq=1'
# and 'modprobe mq-deadline-iosched|kyber|bfq' on kernels < 5.0
# - Single queue schedulers are legacy now and were removed together with
# the old block layer in kernel 5.0
# Default: keep
#DISK_IOSCHED="mq-deadline mq-deadline"
# AHCI link power management (ALPM) for SATA disks:
# min_power, med_power_with_dipm(*), medium_power, max_performance.
# (*) recommended.
# Multiple values separated with spaces are tried sequentially until success.
# Default: med_power_with_dipm (AC & BAT)
#SATA_LINKPWR_ON_AC="med_power_with_dipm"
#SATA_LINKPWR_ON_BAT="med_power_with_dipm"
# Exclude SATA links from AHCI link power management (ALPM).
# SATA links are specified by their host. Refer to the output of
# tlp-stat -d to determine the host; the format is "hostX".
# Separate multiple hosts with spaces.
# Default: <none>
#SATA_LINKPWR_DENYLIST="host1"
# Runtime Power Management for NVMe, SATA, ATA and USB disks
# as well as SATA ports:
# on=disable, auto=enable.
# Note: SATA controllers are PCIe bus devices and handled by RUNTIME_PM further
# down.
# Default: on (AC), auto (BAT)
#AHCI_RUNTIME_PM_ON_AC=on
#AHCI_RUNTIME_PM_ON_BAT=auto
# Seconds of inactivity before disk is suspended.
# Note: effective only when AHCI_RUNTIME_PM_ON_AC/BAT is activated.
# Default: 15
#AHCI_RUNTIME_PM_TIMEOUT=15
# Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
# Drive can be powered on again by releasing (and reinserting) the eject lever
# or by pressing the disc eject button on newer models.
# Note: an UltraBay/MediaBay hard disk is never powered off.
# Default: 0
#BAY_POWEROFF_ON_AC=0
#BAY_POWEROFF_ON_BAT=0
# Optical drive device to power off
# Default: sr0
#BAY_DEVICE="sr0"
# Set the min/max/turbo frequency for the Intel GPU.
# Possible values depend on your hardware. For available frequencies see
# the output of tlp-stat -g.
# Default: <none>
#INTEL_GPU_MIN_FREQ_ON_AC=0
#INTEL_GPU_MIN_FREQ_ON_BAT=0
#INTEL_GPU_MAX_FREQ_ON_AC=0
#INTEL_GPU_MAX_FREQ_ON_BAT=0
#INTEL_GPU_BOOST_FREQ_ON_AC=0
#INTEL_GPU_BOOST_FREQ_ON_BAT=0
# AMD GPU power management.
# Performance level (DPM): auto, low, high; auto is recommended.
# Note: requires amdgpu or radeon driver.
# Default: auto
#RADEON_DPM_PERF_LEVEL_ON_AC=auto
#RADEON_DPM_PERF_LEVEL_ON_BAT=auto
# Dynamic power management method (DPM): balanced, battery, performance.
# Note: radeon driver only.
# Default: <none>
#RADEON_DPM_STATE_ON_AC=performance
#RADEON_DPM_STATE_ON_BAT=battery
# Graphics clock speed (profile method): low, mid, high, auto, default;
# auto = mid on BAT, high on AC.
# Note: radeon driver on legacy ATI hardware only (where DPM is not available).
# Default: default
#RADEON_POWER_PROFILE_ON_AC=default
#RADEON_POWER_PROFILE_ON_BAT=default
# Display panel adaptive backlight modulation (ABM) level: 0(off), 1..4.
# Values 1..4 control the maximum brightness reduction allowed by the ABM
# algorithm, where 1 represents the least and 4 the most power saving.
# Notes:
# - Requires AMD Vega or newer GPU with amdgpu driver as of kernel 6.9
# - Savings are made at the expense of color balance
# Default: 0 (AC), 1 (BAT)
#AMDGPU_ABM_LEVEL_ON_AC=0
#AMDGPU_ABM_LEVEL_ON_BAT=3
# Wi-Fi power saving mode: on=enable, off=disable.
# Default: off (AC), on (BAT)
#WIFI_PWR_ON_AC=off
#WIFI_PWR_ON_BAT=on
# Disable Wake-on-LAN: Y/N.
# Default: Y
#WOL_DISABLE=Y
# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
# A value of 0 disables, >= 1 enables power saving.
# Note: 1 is recommended for Linux desktop environments with PulseAudio,
# systems without PulseAudio may require 10.
# Default: 1
#SOUND_POWER_SAVE_ON_AC=1
#SOUND_POWER_SAVE_ON_BAT=1
# Disable controller too (HDA only): Y/N.
# Note: effective only when SOUND_POWER_SAVE_ON_AC/BAT is activated.
# Default: Y
#SOUND_POWER_SAVE_CONTROLLER=Y
# PCIe Active State Power Management (ASPM):
# default(*), performance, powersave, powersupersave.
# (*) keeps BIOS ASPM defaults (recommended)
# Default: <none>
#PCIE_ASPM_ON_AC=default
#PCIE_ASPM_ON_BAT=default
# Runtime Power Management for PCIe bus devices: on=disable, auto=enable.
# Default: on (AC), auto (BAT)
#RUNTIME_PM_ON_AC=on
#RUNTIME_PM_ON_BAT=auto
# Exclude listed PCIe device adresses from Runtime PM.
# Note: this preserves the kernel driver default, to force a certain state
# use RUNTIME_PM_ENABLE/DISABLE instead.
# Separate multiple addresses with spaces.
# Use lspci to get the adresses (1st column).
# Default: <none>
#RUNTIME_PM_DENYLIST="11:22.3 44:55.6"
# Exclude PCIe devices assigned to the listed drivers from Runtime PM.
# Note: this preserves the kernel driver default, to force a certain state
# use RUNTIME_PM_ENABLE/DISABLE instead.
# Separate multiple drivers with spaces.
# Default: "mei_me nouveau radeon xhci_hcd", use "" to disable completely.
#RUNTIME_PM_DRIVER_DENYLIST="mei_me nouveau radeon xhci_hcd"
# Permanently enable/disable Runtime PM for listed PCIe device addresses
# (independent of the power source). This has priority over all preceding
# Runtime PM settings. Separate multiple addresses with spaces.
# Use lspci to get the adresses (1st column).
# Default: <none>
#RUNTIME_PM_ENABLE="11:22.3"
#RUNTIME_PM_DISABLE="44:55.6"
# Set to 0 to disable, 1 to enable USB autosuspend feature.
# Default: 1
#USB_AUTOSUSPEND=1
# Exclude listed devices from USB autosuspend (separate with spaces).
# Use lsusb to get the ids.
# Note: input devices (usbhid) and libsane-supported scanners are excluded
# automatically.
# Default: <none>
#USB_DENYLIST="1111:2222 3333:4444"
# Exclude audio devices from USB autosuspend:
# 0=do not exclude, 1=exclude.
# Default: 1
#USB_EXCLUDE_AUDIO=1
# Exclude bluetooth devices from USB autosuspend:
# 0=do not exclude, 1=exclude.
# Default: 0
#USB_EXCLUDE_BTUSB=0
# Exclude phone devices from USB autosuspend:
# 0=do not exclude, 1=exclude (enable charging).
# Default: 0
#USB_EXCLUDE_PHONE=0
# Exclude printers from USB autosuspend:
# 0=do not exclude, 1=exclude.
# Default: 1
#USB_EXCLUDE_PRINTER=1
# Exclude WWAN devices from USB autosuspend:
# 0=do not exclude, 1=exclude.
# Default: 0
#USB_EXCLUDE_WWAN=0
# Allow USB autosuspend for listed devices even if already denylisted or
# excluded above (separate with spaces). Use lsusb to get the ids.
# Default: 0
#USB_ALLOWLIST="1111:2222 3333:4444"
# Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
# on system startup: 0=disable, 1=enable.
# Note: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
# are ignored when this is enabled.
# Default: 0
#RESTORE_DEVICE_STATE_ON_STARTUP=0
# Radio devices to disable on startup: bluetooth, nfc, wifi, wwan.
# Separate multiple devices with spaces.
# Default: <none>
#DEVICES_TO_DISABLE_ON_STARTUP="bluetooth nfc wifi wwan"
# Radio devices to enable on startup: bluetooth, nfc, wifi, wwan.
# Separate multiple devices with spaces.
# Default: <none>
#DEVICES_TO_ENABLE_ON_STARTUP="wifi"
# Radio devices to enable on AC: bluetooth, nfc, wifi, wwan.
# Default: <none>
#DEVICES_TO_ENABLE_ON_AC="bluetooth nfc wifi wwan"
# Radio devices to disable on battery: bluetooth, nfc, wifi, wwan.
# Default: <none>
#DEVICES_TO_DISABLE_ON_BAT="bluetooth nfc wifi wwan"
# Radio devices to disable on battery when not in use (not connected):
# bluetooth, nfc, wifi, wwan.
# Default: <none>
#DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth nfc wifi wwan"
# Battery Care -- Charge thresholds
# Charging starts when the charger is connected and the charge level
# is below the start threshold. Charging stops when the charge level
# is above the stop threshold.
# Required hardware: Lenovo ThinkPads and select other laptop brands
# are driven via specific plugins
# - Active plugin and support status are shown by tlp-stat -b
# - Vendor specific threshold levels are shown by tlp-stat -b, some
# laptops support only 1 (on)/ 0 (off) instead of a percentage level
# - When your hardware supports a start *and* a stop threshold, you must
# specify both, otherwise TLP will refuse to apply the single threshold
# - When your hardware supports only a stop threshold, set the start
# value to 0
# - Older ThinkPads may require an external kernel module, refer to the
# output of tlp-stat -b
# For further explanation and vendor specific details refer to
# - https://linrunner.de/tlp/settings/battery.html
# - https://linrunner.de/tlp/settings/bc-vendors.html
# BAT0: Primary / Main / Internal battery
# Note: also use for batteries BATC, BATT and CMB0
# Default: <none>
# Battery charge level below which charging will begin.
#START_CHARGE_THRESH_BAT0=75
# Battery charge level above which charging will stop.
#STOP_CHARGE_THRESH_BAT0=80
# BAT1: Secondary / Ultrabay / Slice / Replaceable battery
# Note: primary on some laptops
# Default: <none>
# Battery charge level below which charging will begin.
#START_CHARGE_THRESH_BAT1=75
# Battery charge level above which charging will stop.
#STOP_CHARGE_THRESH_BAT1=80
# Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
# Default: 0
#RESTORE_THRESHOLDS_ON_BAT=1
# ------------------------------------------------------------------------------
# tlp-rdw - Parameters for the radio device wizard
# Possible devices: bluetooth, wifi, wwan.
# Separate multiple radio devices with spaces.
# Default: <none> (for all parameters below)
# Radio devices to disable on connect.
#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
# Radio devices to enable on disconnect.
#DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
# Radio devices to enable/disable when docked.
#DEVICES_TO_ENABLE_ON_DOCK=""
#DEVICES_TO_DISABLE_ON_DOCK=""
# Radio devices to enable/disable when undocked.
#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
#DEVICES_TO_DISABLE_ON_UNDOCK=""

View File

@ -0,0 +1,4 @@
#!/bin/bash
# hardware
install intel-ucode nvidia

View File

@ -0,0 +1,14 @@
#!/bin/bash
# hardware
install intel-media-driver intel-ucode mesa sof-firmware vulkan-intel
# brightness
install brightnessctl
file_has_line "/etc/profile" "export FEAT_BRIGHTNESS=brightnessctl"
# power
install tlp
systemctl enable tlp --now
cp_chown custom/_laptop.sh.yrz.am/tlp.conf /etc/tlp.conf root:root 644
systemctl restart tlp

View File

@ -0,0 +1,7 @@
[terminal]
vt = 1
[default_session]
command = "agreety --cmd .local/bin/init"
source_profile = false
user = "greeter"

106
arch-root/install.sh Executable file
View File

@ -0,0 +1,106 @@
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f -- "$0")")/_install"
PACKAGES=(
# system
linux base linux-firmware lvm2 sudo polkit # base
pulseaudio pulseaudio-bluetooth bluez bluez-utils networkmanager udisks2 # device management
openssh man-db restic htop # admin utils
# generic runtime
nodejs dash
# cli programs
vifm vim # navigation & editors
shellcheck # shell scripting
hugo miniserve neomutt translate-shell # www
gnupg pass pass-otp # crypt
jq libqalculate imagemagick # data processing
git zip # others
# desktop env
greetd sway swaybg swayidle # basic
foot bemenu-wayland i3blocks mako libnotify # terminals, ui
wev wl-clipboard wtype slurp grim # interaction
ttf-roboto ttf-roboto-mono ttf-font-awesome # fonts
# gui apps
imv mpv gimp # media
qutebrowser qt6-wayland # www
sqlitebrowser qt5-wayland # db
# extensions
vim-ale vim-fugitive
# not so good
telegram-desktop libreoffice-still
)
install() {
pacman -S --needed --noconfirm "$@"
}
file_has_line() {
grep -qxF "$2" "$1" || echo "$2" >> "$1"
}
cp_chown() {
cp -rf "$1" "$2"
chown "$3" "$2" -R
chmod "$4" "$2" -R
}
[ "$(id -u)" != "0" ] && echo "ERROR: root required" >&2 && exit 1
pacman -Syu --noconfirm
install "${PACKAGES[@]}"
file_has_line "/etc/profile" "umask 002"
find /etc/pam.d -type f -exec sed -i -e 's/^session optional pam_umask.so$/session optional pam_umask.so usergroups/g' {} \;
# device management
sed -i 's/#AutoEnable=true/AutoEnable=false/' /etc/bluetooth/main.conf
systemctl enable bluetooth --now
while read -r entity; do
# group <name> <id>
# user <name> <id> [<secondary groups>...]
read -ra entity_parts <<< "$entity"
etype="${entity_parts[0]}"
ename="${entity_parts[1]}"
eid="${entity_parts[2]}"
[ "$etype" != "user" ] && [ "$etype" != "group" ] && echo "ERROR: bad entity type" >&2 && exit 1
# every user has their own primary group with id matching uid,
# so for each entry we need a usergroup
if [ -z "$(getent group "$eid")" ]; then
echo "Creating group \"$ename\", id=$eid"
groupadd --gid "$eid" "$ename"
fi
if [ "$etype" = "user" ]; then
if ! id "$eid" >/dev/null 2>&1; then
echo "Creating user \"$ename\", id=$eid"
useradd --gid "$eid" --uid "$eid" -m "$ename"
fi
usermod -aG "$(IFS=,; echo "${entity_parts[*]:3}")" "$ename"
else # group
if [[ "$ename" == share-* ]]; then
echo "Creating shared dir $ename"
mkdir -p "/home/$ename"
chgrp "$ename" -R "/home/$ename"
chmod u=rwX,g=rwX,o= -R "/home/$ename"
find "/home/$ename" -type d -print0 | xargs -0 chmod g+s
fi
fi
done </root/users.conf
cp_chown greetd.toml /etc/greetd/config.toml root:root 644
custom_script="./custom/$(cat /etc/hostname).sh"
if [ -f "$custom_script" ]; then
echo "Executing host-specific $custom_script"
# shellcheck disable=SC1090
source "$custom_script"
fi

View File

@ -0,0 +1,33 @@
#!/bin/bash
set -e
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]; then
echo "bad args" >&2
exit 1
fi
DEST=$(realpath "$2")
cd "$1"
#shellcheck disable=SC2016
find . \
-type f \
-not -path '*/.*' \
-path "$3" | \
xargs -0 -d \\n -n 1 sh -c "mkdir -p $DEST/\$(dirname \"\$1\")" sh
#shellcheck disable=SC2016
find . \
-type f \
-not -path '*/.*' \
-path "$3" \
-printf "$(pwd)/%P\n$DEST/%P\n" | \
xargs -0 -d \\n -n 2 sh -c "$4" sh
#for rel in $(find . -type f -name *.gpg); do
# DESTFILE=$(echo $DEST/$rel | sed 's/\.[^.]*$//')
# [ -f "$DESTFILE" ] && continue
# mkdir -p "$(dirname "$DESTFILE")"
# gpg --output "$DESTFILE" --decrypt "$rel"
#done

9
arch-user/bin/archiso/make.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
sudo rm -rf /tmp/archiso-work /tmp/archiso-out
cd ~/know/archiso
sudo mkarchiso -v -w /tmp/archiso-work -o /tmp/archiso-out "profile-$1"
iso=(/tmp/archiso-out/*)
sudo dd if="$iso" of="$2" status=progress bs=4M
sudo rm -rf /tmp/archiso-work /tmp/archiso-out

251
arch-user/bin/bemenu/pinentry.sh Executable file
View File

@ -0,0 +1,251 @@
#!/bin/bash -efu
### This file is covered by the GNU General Public License,
### which should be included with libshell as the file LICENSE.
### All copyright information are listed in the COPYING.
#exec 2>/tmp/pinentry.log
#set -x
VERSION='1.0'
FLAVOR='bash'
############################### PATCH #################################
. ~/.config/bemenu/env.sh
#######################################################################
keyinfo=''
error=''
timeout=0
touch_file=''
readonly def_desc='Enter password for GPG key'
readonly def_prompt='Password:'
readonly def_title='GPG Key Credentials'
readonly def_repeat='Confirm password for GPG key'
readonly def_labelok='OK'
readonly def_labelnotok='Do not do this'
readonly def_labelcancel='Cancel'
# from /usr/include/gpg-error.h
readonly GPG_ERR_NO_ERROR=0
readonly GPG_ERR_TIMEOUT=62
readonly GPG_ERR_CANCELED=99
readonly GPG_ERR_NOT_CONFIRMED=114
readonly GPG_ERR_ASS_PARAMETER=280
strerror()
{
case "$1" in
$GPG_ERR_NO_ERROR) echo "Success" ;;
$GPG_ERR_TIMEOUT) echo "Timeout" ;;
$GPG_ERR_CANCELED) echo "Operation cancelled" ;;
$GPG_ERR_NOT_CONFIRMED) echo "Not confirmed" ;;
$GPG_ERR_ASS_PARAMETER) echo "IPC parameter error" ;;
esac
}
assuan_result()
{
[ "$1" -gt 0 ] &&
echo -n "ERR $(( 5 << 24 | $1 )) " ||
echo -n "OK "
strerror "$1"
}
cmd_settimeout()
{
[ -n "${1##0*}" ] && [ -n "${1##*[!0-9]*}" ] && [ "$1" -gt 0 ] 2>/dev/null ||
return 0
timeout="$1"
assuan_result $GPG_ERR_NO_ERROR
}
cmd_setkeyinfo()
{
[ "$1" = "--clear" ] &&
keyinfo="" ||
keyinfo="$1"
assuan_result $GPG_ERR_NO_ERROR
}
set_text_variable()
{
printf -v "$1" "${2//%/\\x}"
eval "set_$1=1"
assuan_result $GPG_ERR_NO_ERROR
}
cmd_setoption()
{
case "$1" in
default-prompt=*) set_text_variable prompt "${1#*=}" ;;
default-ok=*) set_text_variable labelok "${1#*=}" ;;
default-cancel=*) set_text_variable labelcancel "${1#*=}" ;;
touch-file=*)
touch_file="${1#*=}"
assuan_result $GPG_ERR_NO_ERROR
;;
*)
assuan_result $GPG_ERR_NO_ERROR
;;
esac
}
cmd_getinfo()
{
case "$1" in
version)
echo "D $VERSION"
assuan_result $GPG_ERR_NO_ERROR
;;
pid)
echo "D $BASHPID"
assuan_result $GPG_ERR_NO_ERROR
;;
flavor)
echo "D $FLAVOR"
assuan_result $GPG_ERR_NO_ERROR
;;
ttyinfo)
echo "D - - - - $(id -u 2>/dev/null || echo 0)/$(id -g 2>/dev/null || echo 0) -"
assuan_result $GPG_ERR_NO_ERROR
;;
*)
assuan_result $GPG_ERR_ASS_PARAMETER
;;
esac
}
cmd_getpin()
{
local ret=0 result output password=1 repeatpassword=3
output="$(
echo -n "|"
############################### PATCH #################################
bemenu \
--password indicator \
--prompt "${prompt:-$def_prompt}" \
</dev/null | tr -d '\n'
ret=${PIPESTATUS[0]}
# yad \
# --splash \
# --no-markup \
# --title="${title:-$def_title}" \
# --form \
# --separator="\n" \
# --field="${desc:-$def_desc}:LBL" \
# --field="${prompt:-$def_prompt}:H" \
# ${set_repeat:+--field="${repeat:-$def_repeat}:LBL"} \
# ${set_repeat:+--field="${prompt-$def_prompt}:H"} \
# ${error:+--field="$error:LBL"} \
# --button="${labelok:-$def_labelok}:0" \
# --button="${labelcancel:-$def_labelcancel}:1" \
# --timeout="${timeout:-0}" \
# </dev/null || ret=$?
######################################################################
echo -n "|"
exit $ret
)" || ret=$?
set_error='' error=''
case "$ret" in
1) assuan_result $GPG_ERR_CANCELED; return 0; ;;
70) assuan_result $GPG_ERR_TIMEOUT; return 0; ;;
esac
output="${output#|}"
output="${output%|}"
############################### PATCH #################################
declare -A result
result[$password]="$output"
result[$repeatpassword]="$output"
# readarray -t result <<<"$output"
# output=''
#
#######################################################################
if [ -n "${set_repeat-}" ]; then
set_repeat='' repeat=''
if [ "${result[$password]}" != "${result[$repeatpassword]}" ]; then
cmd_confirm --one-button "${repeaterror:-Error: Passwords did not match.}"
assuan_result $GPG_ERR_NOT_CONFIRMED
return
fi
echo "S PIN_REPEATED"
fi
[ -z "$touch_file" ] ||
touch "$touch_file"
echo "D ${result[$password]}"
assuan_result $GPG_ERR_NO_ERROR
}
cmd_confirm()
{
local ret=0 showmsg='' showcfm=1
if [ "$1" = '--one-button' ]; then
shift
showmsg=1
showcfm=
fi
yad \
--splash \
--no-markup \
--title="${title:-$def_title}" \
--text="${1:-${desc:-$def_desc}}" \
${showmsg:+--button="${labelok:-$def_labelok}:0"} \
${showcfm:+${error:+--field="$error:LBL"}} \
--timeout="${timeout:-0}" \
< /dev/null ||
ret=$?
set_error='' error=''
case "$ret" in
0) assuan_result $GPG_ERR_NO_ERROR ;;
1) assuan_result $GPG_ERR_CANCELED ;;
70) assuan_result $GPG_ERR_TIMEOUT ;;
*) assuan_result $GPG_ERR_NOT_CONFIRMED ;;
esac
}
echo "OK Your orders please"
while :; do
read -r cmd args 2>/dev/null ||
continue
#echo >&2 "$cmd: $args"
case "$cmd" in
BYE)
echo "OK closing connection"
exit 0
;;
GETPIN) cmd_getpin ;;
CONFIRM) cmd_confirm "$args" ;;
MESSAGE) cmd_confirm --one-button ;;
GETINFO) cmd_getinfo "$args" ;;
SETTIMEOUT) cmd_settimeout "$args" ;;
SETKEYINFO) cmd_setkeyinfo "$args" ;;
OPTION) cmd_setoption "$args" ;;
SETDESC) set_text_variable desc "$args" ;;
SETPROMPT) set_text_variable prompt "$args" ;;
SETTITLE) set_text_variable title "$args" ;;
SETOK) set_text_variable labelok "$args" ;;
SETCANCEL) set_text_variable labelcancel "$args" ;;
SETNOTOK) set_text_variable labelnotok "$args" ;;
SETERROR) set_text_variable error "$args" ;;
SETREPEAT) set_text_variable repeat "$args" ;;
SETREPEATERROR) set_text_variable repeaterror "$args" ;;
*)
assuan_result $GPG_ERR_NO_ERROR
;;
esac
done

View File

@ -0,0 +1,13 @@
#!/bin/bash
set -e
if [ -z "$PASSPHRASE" ]; then
read -srp "Password: " PASSPHRASE
echo
fi
export PASSPHRASE
bash ~/.local/bin/alg/file-tree-apply.sh "$1" "$2" '*.gpg' \
'if [ ! -f "$2" ]; then gpg --decrypt "$1" | gpg --symmetric --output "$2" --passphrase "$PASSPHRASE" --batch --yes; fi'
echo ok

View File

@ -0,0 +1,14 @@
#!/bin/sh
read -r stat </sys/class/power_supply/ACAD/online
read -r cap </sys/class/power_supply/BAT1/capacity
read -r volt </sys/class/power_supply/BAT1/voltage_now
read -r curr </sys/class/power_supply/BAT1/current_now
w=$((volt*curr/1000000000000))
if [ "$stat" = "1" ]; then
echo "🔌 $cap% ${w}W"
else
echo "🔋 $cap% ${w}W"
[ "$cap" -lt "15" ] && exit 33
fi

View File

@ -0,0 +1,23 @@
#!/bin/sh
sink_mute=$(pactl get-sink-mute @DEFAULT_SINK@)
case "$sink_mute" in
*yes*) sink_res=M;;
*) sink_res=$(pactl get-sink-volume @DEFAULT_SINK@ | sed -e 's/.*\s\([0-9]*\)%.*/\1/;t;d');;
esac
source_mute=$(pactl get-source-mute @DEFAULT_SOURCE@)
case "$source_mute" in
*yes*) source_res=M;;
*) source_res=$(pactl get-source-volume @DEFAULT_SOURCE@ | sed -e 's/.*\s\([0-9]*\)%.*/\1/;t;d');;
esac
bt_status="$(bluetoothctl devices Connected)"
if [ -n "$bt_status" ]; then
sink_icon=🎧
else
sink_icon=🔈
fi
echo "$sink_icon $sink_res% 🎙 $source_res%"

View File

@ -0,0 +1,3 @@
#!/bin/bash
curl "https://wttr.in/?format=%l;%t%20%p" --silent | sed 's/^\(.\{3\}\)\(.*\);/\1 /'
echo

View File

@ -0,0 +1,2 @@
#!/bin/sh
swaymsg -t get_inputs | jq -r 'map(select(has("xkb_active_layout_name")))[0].xkb_active_layout_name'

6
arch-user/bin/init Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
. /etc/profile
. ~/.profile
sway --unsupported-gpu >>~/.local/state/sway/out.log 2>>~/.local/state/sway/err.log

View File

@ -0,0 +1,12 @@
#!/bin/bash
for range in $(fc-match --format='%{charset}\n' "$1"); do
for n in $(seq "0x${range%-*}" "0x${range#*-}"); do
printf "%04x\n" "$n"
done
done | while read -r n_hex; do
count=$((count + 1))
printf "%-5s\U$n_hex\t" "$n_hex"
[ $((count % 10)) = 0 ] && printf "\n"
done
printf "\n"

View File

@ -0,0 +1,2 @@
#!/bin/sh
pacman -Qdttq | sudo pacman -Rns -

211
arch-user/bin/run.sh Executable file
View File

@ -0,0 +1,211 @@
#!/bin/bash
LIST=();
# gui
if [ "$USER" = "yrzam" ]; then
LIST+=(
"web" "web projects"
"web" "web life"
)
WEB_HAS_PROFILES=1
else
LIST+=(
"web" "web"
)
fi
LIST+=(
"gui" "telegram-desktop"
"gui" "gimp"
"gui" "sqlitebrowser"
# tui
"shell_tui" "vifm"
"shell_tui" "vim"
"tui" "htop"
"float_tui" "nmtui"
"float_tui" "bluetoothctl"
"man" "man"
"float_tui" "node"
"term" "term"
# native
"screen_pick" "screenshot output"
"screen_pick" "screenshot selection"
"screen_pick" "color-picker"
"todo" "pass"
"calc" "calc"
"todo" "translate ru-en"
"todo" "translate en-ru"
"grep_dict" "dict"
)
if [ "$FEAT_BRIGHTNESS" ]; then
LIST+=(
"brightness" "brightness"
)
fi
LIST+=(
"direct" "sway reload"
"power" "logout"
"todo" "inhibit"
"power" "suspend"
"power" "poweroff"
"power" "poweroff --check-inhibitors=no"
"power" "reboot"
)
sure() {
echo yes | bemenu --prompt "sure?"
}
# generic
exec_gui() {
exec "$@"
}
exec_tui() {
exec footclient -D ~/ "$@"
}
exec_float_tui() { # todo
exec footclient --app-id="footclient_float" -D ~/ "$@"
}
exec_shell_tui() {
exec footclient -D ~/ "$SHELL" -c "$@"
}
exec_shell_full() {
exec footclient -D ~/ "$SHELL" -c "($1); read -n1"
}
exec_direct() {
exec "$@"
}
exec_term() {
exec footclient -D ~/
}
# custom
exec_web() {
shift
if [ "$WEB_HAS_PROFILES" ]; then
shift
fi
qutebrowser "$*"
}
exec_man() {
shift
page="$1"
if [ -z "$page" ]; then
page="$(
man -k . | \
bemenu --prompt "man" | \
sed ' s/\s\+\-.*//;s/ //g'
)"
fi
[ -n "$page" ] && exec footclient "$SHELL" -c "man '$page' || read -n1"
}
exec_screen_pick() {
if [ "$*" = "screenshot output" ]; then
mon="$(swaymsg -t get_outputs | jq -r '. | map(select(.focused == true)) | .[0].name')"
grim -o "$mon" - | wl-copy -t image/png
notify-send Done -a screenshot "PNG image copied to clipboard" -t 3000
elif [ "$*" = "screenshot selection" ]; then
grim -g "$(slurp)" - | wl-copy -t image/png
notify-send Done -a screenshot "PNG image copied to clipboard" -t 3000
elif [ "$*" = "color-picker" ]; then
hex="$(
grim -g "$(slurp -p)" -t ppm - | \
magick - -format '%[pixel:p{0,0}]' txt:- | \
tail -n 1 | \
cut -d ' ' -f 4
)"
notify-send "$hex" -a screenshot "stnrit" -t 3000
fi
}
exec_pass() {
echo 1
}
exec_calc() {
shift
query="$1"
if [ -z "$query" ]; then
query="$(echo "tui" | bemenu --prompt "qalc")"
fi
if [ "$query" = "tui" ]; then
exec_float_tui "qalc"
elif [ -n "$query" ]; then
qalc_res="$(qalc --terse "$query")"
menu_res="$(echo -e "$qalc_res\ntui" | bemenu --prompt "qalc")"
if [ "$qalc_res" = "$menu_res" ]; then
wl-copy "$qalc_res"
notify-send "$qalc_res" -a calc "Result copied to clipboard" -t 3000
elif [ -n "$menu_res" ]; then
exec_calc _ "$menu_res"
fi
fi
}
exec_transl() {
echo 1
}
exec_grep_dict() {
shift
dict="$1"
pattern="$2"
dicts_path="$HOME/know/dict/"
if [ -z "$dict" ]; then
dict="$(find "$dicts_path" -type f -printf "%f\n" | bemenu --prompt "dict")"
[ -z "$dict" ] && return
fi
if [ -z "$pattern" ]; then
pattern="$(echo -n | bemenu --prompt "grep $dict")"
[ -z "$pattern" ] && return
fi
res="$({ echo ..; grep "$pattern" "$dicts_path/$dict"; } | bemenu --prompt " ")"
if [ "$res" = ".." ]; then
exec_grep_dict _ "$dict"
else
wl-copy "$res"
notify-send "$res" -a dict "Word copied to clipboard" -t 3000
fi
}
exec_brightness() {
shift
target="$1"
if [ -z "$target" ]; then
current="$(($(brightnessctl g)*100/$(brightnessctl m)))"
current_i="$((current/5))"
list="$(echo 1%; seq 5 5 100 | sed 's/$/%/')";
target="$(echo "$list" | bemenu --index $current_i --prompt "$current% ->")";
fi
if [ -n "$target" ] && [ "$target" != "$current%" ]; then
brightnessctl set "$target"
[ -z "$1" ] && exec_brightness _
fi
}
exec_power() {
case "$1" in
poweroff|reboot|suspend) sure && systemctl "$@";;
logout) sure && swaymsg exit;;
esac
}
if [ -n "$1" ]; then
out="$*";
else
out=$(
for (( i=1; i<${#LIST[@]}; i+=2 )); do
echo "${LIST[$i]}";
done | bemenu --prompt ">"
)
fi
if [ "$out" ]; then
for (( i=1; i<${#LIST[@]}; i+=2 )); do
if [[ "$out" == "${LIST[$i]}"* ]]; then
executor=${LIST[$((i-1))]}
fi
done
[ -z "$executor" ] && executor=shell_full
if [ "$executor" = "shell_full" ]; then
"exec_$executor" "$out"
else
eval "executor_args=($out)"
#shellcheck disable=SC2154
"exec_$executor" "${executor_args[@]}"
fi
fi

View File

@ -0,0 +1,4 @@
#!/bin/sh
brig="$(brightnessctl set "$1" -m | sed -e 's/.*,\([0-9]*\)%.*/\1/')"
notify-send -t 2000 -h "int:value:$brig" -a "brightness" "$brig%" \
-h string:x-canonical-private-synchronous:brightness

View File

@ -0,0 +1,6 @@
#!/bin/bash
out="$(printf '' | bemenu --prompt ':sway')"
eval "executor_args=($out)"
#shellcheck disable=SC2154
sway "${executor_args[@]}"

View File

@ -0,0 +1,11 @@
#!/bin/bash
[[ $- != *i* ]] && return
stty intr ^K
alias ls='ls --color=auto'
alias grep='grep --color=auto'
export EDITOR=vim
PS1='\[\033[38;2;153;136;255m\]\u@\h:\W\$\[\033[0m\]\[\e[0;91m\]${?#0}\[\e[0m\] '

View File

@ -0,0 +1,24 @@
#!/bin/sh
export BEMENU_OPTS="\
--ignorecase \
--width-factor 0.5 \
--fn \"{{ .theme.font.name_mono }} {{ math.Add .theme.font.size_base_pt .theme.font.size_step_pt }}\" \
--list 500 \
--border 2 \
--scrollbar autohide \
--border-radius 4 \
--bdr #{{ .theme.color.fg_accent }}{{ math.Mul .theme.opacity.med 255 | conv.ToInt64 | printf "%02X" }} \
--scf #{{ .theme.color.fg_accent }}{{ math.Mul .theme.opacity.med 255 | conv.ToInt64 | printf "%02X" }} \
--scb #{{ .theme.color.bg }}{{ math.Mul .theme.opacity.high 255 | conv.ToInt64 | printf "%02X" }} \
--nb #{{ .theme.color.bg }} \
--ab #{{ .theme.color.bg }} \
--hb #{{ .theme.color.bg }} \
--fb #{{ .theme.color.bg }} \
--tb #{{ .theme.color.bg }} \
--nf #{{ .theme.color.fg }} \
--af #{{ .theme.color.fg }} \
--cf #{{ .theme.color.fg }} \
--hf #{{ .theme.color.fg_accent }} \
--tf #{{ .theme.color.fg_accent }} \
--ff #{{ .theme.color.fg_accent }} \
"

View File

@ -0,0 +1,255 @@
# -*- conf -*-
# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
# term=foot (or xterm-256color if built with -Dterminfo=disabled)
# login-shell=no
# app-id=foot # globally set wayland app-id. Default values are "foot" and "footclient" for desktop and server mode
title=term
# locked-title=no
font={{ .theme.font.name_mono }}:size={{ .theme.font.size_base_pt }}
# font-bold=<bold variant of regular font>
# font-italic=<italic variant of regular font>
# font-bold-italic=<bold+italic variant of regular font>
# font-size-adjustment=0.5
# line-height=<font metrics>
# letter-spacing=0
# horizontal-letter-offset=0
# vertical-letter-offset=0
# underline-offset=<font metrics>
# underline-thickness=<font underline thickness>
# strikeout-thickness=<font strikeout thickness>
# box-drawings-uses-font-glyphs=no
# dpi-aware=no
# initial-window-size-pixels=700x500 # Or,
# initial-window-size-chars=<COLSxROWS>
# initial-window-mode=windowed
pad=8x4 # optionally append 'center'
# resize-by-cells=yes
# resize-keep-grid=yes
# resize-delay-ms=100
# bold-text-in-bright=no
# word-delimiters=,│`|:"'()[]{}<>
# selection-target=primary
# workers=<number of logical CPUs>
# utmp-helper=/usr/lib/utempter/utempter # When utmp backend is libutempter (Linux)
# utmp-helper=/usr/libexec/ulog-helper # When utmp backend is ulog (FreeBSD)
[environment]
# name=value
[bell]
urgent=yes
# notify=no
# visual=no
# command=
# command-focused=no
[desktop-notifications]
# command=notify-send --wait --app-name ${app-id} --icon ${app-id} --category ${category} --urgency ${urgency} --expire-time ${expire-time} --hint STRING:image-path:${icon} --hint BOOLEAN:suppress-sound:${muted} --hint STRING:sound-name:${sound-name} --replace-id ${replace-id} ${action-argument} --print-id -- ${title} ${body}
# command-action-argument=--action ${action-name}=${action-label}
# close=""
# inhibit-when-focused=yes
[scrollback]
# lines=1000
# multiplier=3.0
# indicator-position=relative
# indicator-format=""
[url]
# launch=xdg-open ${url}
# label-letters=sadfjklewcmpgh
# osc8-underline=url-mode
# protocols=http, https, ftp, ftps, file, gemini, gopher
# uri-characters=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="'()[]
[cursor]
# style=block
# color=<inverse foreground/background>
# blink=no
blink-rate=250
# beam-thickness=1.5
# underline-thickness=<font underline thickness>
[mouse]
# hide-when-typing=no
# alternate-scroll-mode=yes
[touch]
# long-press-delay=400
[colors]
#alpha=1
background={{ .theme.color.bg }}
foreground={{ .theme.color.fg }}
# flash=7f7f00
# flash-alpha=0.5
## Normal/regular colors (color palette 0-7)
# regular0=242424 # black
# regular1=f62b5a # red
# regular2=47b413 # green
# regular3=e3c401 # yellow
# regular4=24acd4 # blue
# regular5=f2affd # magenta
# regular6=13c299 # cyan
# regular7=e6e6e6 # white
## Bright colors (color palette 8-15)
# bright0=616161 # bright black
# bright1=ff4d51 # bright red
# bright2=35d450 # bright green
# bright3=e9e836 # bright yellow
# bright4=5dc5f8 # bright blue
# bright5=feabf2 # bright magenta
# bright6=24dfc4 # bright cyan
# bright7=ffffff # bright white
## dimmed colors (see foot.ini(5) man page)
# dim0=<not set>
# ...
# dim7=<not-set>
## The remaining 256-color palette
# 16 = <256-color palette #16>
# ...
# 255 = <256-color palette #255>
## Sixel colors
# sixel0 = 000000
# sixel1 = 3333cc
# sixel2 = cc2121
# sixel3 = 33cc33
# sixel4 = cc33cc
# sixel5 = 33cccc
# sixel6 = cccc33
# sixel7 = 878787
# sixel8 = 424242
# sixel9 = 545499
# sixel10 = 994242
# sixel11 = 549954
# sixel12 = 995499
# sixel13 = 549999
# sixel14 = 999954
# sixel15 = cccccc
## Misc colors
# selection-foreground=<inverse foreground/background>
# selection-background=<inverse foreground/background>
# jump-labels=<regular0> <regular3> # black-on-yellow
# scrollback-indicator=<regular0> <bright4> # black-on-bright-blue
# search-box-no-match=<regular0> <regular1> # black-on-red
# search-box-match=<regular0> <regular3> # black-on-yellow
# urls=<regular3>
[csd]
# preferred=server
# size=26
# font=<primary font>
# color=<foreground color>
# hide-when-maximized=no
# double-click-to-maximize=yes
# border-width=0
# border-color=<csd.color>
# button-width=26
# button-color=<background color>
# button-minimize-color=<regular4>
# button-maximize-color=<regular2>
# button-close-color=<regular1>
[key-bindings]
# scrollback-up-page=Shift+Page_Up
# scrollback-up-half-page=none
# scrollback-up-line=none
# scrollback-down-page=Shift+Page_Down
# scrollback-down-half-page=none
# scrollback-down-line=none
# scrollback-home=none
# scrollback-end=none
clipboard-copy=Control+c XF86Copy
clipboard-paste=Control+v XF86Paste
# primary-paste=Shift+Insert
# search-start=Control+Shift+r
# font-increase=Control+plus Control+equal Control+KP_Add
# font-decrease=Control+minus Control+KP_Subtract
# font-reset=Control+0 Control+KP_0
# spawn-terminal=Control+Shift+n
# minimize=none
# maximize=none
# fullscreen=none
# pipe-visible=[sh -c "xurls | fuzzel | xargs -r firefox"] none
# pipe-scrollback=[sh -c "xurls | fuzzel | xargs -r firefox"] none
# pipe-selected=[xargs -r firefox] none
# pipe-command-output=[wl-copy] none # Copy last command's output to the clipboard
# show-urls-launch=Control+Shift+o
# show-urls-copy=none
# show-urls-persistent=none
# prompt-prev=Control+Shift+z
# prompt-next=Control+Shift+x
# unicode-input=Control+Shift+u
# noop=none
[search-bindings]
# cancel=Control+g Control+c Escape
# commit=Return
# find-prev=Control+r
# find-next=Control+s
# cursor-left=Left Control+b
# cursor-left-word=Control+Left Mod1+b
# cursor-right=Right Control+f
# cursor-right-word=Control+Right Mod1+f
# cursor-home=Home Control+a
# cursor-end=End Control+e
# delete-prev=BackSpace
# delete-prev-word=Mod1+BackSpace Control+BackSpace
# delete-next=Delete
# delete-next-word=Mod1+d Control+Delete
# extend-char=Shift+Right
# extend-to-word-boundary=Control+w Control+Shift+Right
# extend-to-next-whitespace=Control+Shift+w
# extend-line-down=Shift+Down
# extend-backward-char=Shift+Left
# extend-backward-to-word-boundary=Control+Shift+Left
# extend-backward-to-next-whitespace=none
# extend-line-up=Shift+Up
clipboard-paste=Control+v Control+y XF86Paste
# primary-paste=Shift+Insert
# unicode-input=none
# quit=none
# scrollback-up-page=Shift+Page_Up
# scrollback-up-half-page=none
# scrollback-up-line=none
# scrollback-down-page=Shift+Page_Down
# scrollback-down-half-page=none
# scrollback-down-line=none
# scrollback-home=none
# scrollback-end=none
[url-bindings]
# cancel=Control+g Control+c Control+d Escape
# toggle-url-visible=t
[text-bindings]
# \x03=Mod4+c # Map Super+c -> Ctrl+c
[mouse-bindings]
# scrollback-up-mouse=BTN_WHEEL_BACK
# scrollback-down-mouse=BTN_WHEEL_FORWARD
# font-increase=Control+BTN_WHEEL_BACK
# font-decrease=Control+BTN_WHEEL_FORWARD
# selection-override-modifiers=Shift
# primary-paste=BTN_MIDDLE
# select-begin=BTN_LEFT
# select-begin-block=Control+BTN_LEFT
# select-extend=BTN_RIGHT
# select-extend-character-wise=Control+BTN_RIGHT
# select-word=BTN_LEFT-2
# select-word-whitespace=Control+BTN_LEFT-2
# select-quote = BTN_LEFT-3
# select-row=BTN_LEFT-4
# vim: ft=dosini

View File

@ -0,0 +1,7 @@
[user]
email = {{ .user.GIT_USER_EMAIL }}
name = {{ .user.GIT_USER_NAME }}
[init]
defaultBranch = main
[pull]
rebase = false

7
arch-user/config/gnupg/env.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null

View File

@ -0,0 +1 @@
pinentry-program ~/.local/bin/bemenu/pinentry.sh

View File

@ -0,0 +1,26 @@
separator_block_width=20
command=~/.local/bin/i3blocks/$BLOCK_NAME.sh
[weather]
label=⛅
interval=3600
{{ if file.Exists "/sys/class/power_supply/ACAD/" }}
[battery]
interval=10
{{ end }}
[volume]
interval=once
signal=2
[xkb_layout]
label=⌨
interval=once
signal=1
[time]
label=🕓
command=date +"%Y-%m-%dT%H:%M:%SZ"
interval=1

View File

@ -0,0 +1,9 @@
format=<b>%s - %a</b>\n%b
font=Roboto 10
background-color=#{{ .theme.color.bg_accent_dark }}{{ math.Mul .theme.opacity.high 255 | conv.ToInt64 | printf "%02X" }}
border-size=2
border-radius=4
border-color=#{{ .theme.color.fg_accent }}{{ math.Mul .theme.opacity.med 255 | conv.ToInt64 | printf "%02X" }}
padding=5,10
width=400
progress-color=#{{ .theme.color.fg_accent }}{{ math.Mul .theme.opacity.med 255 | conv.ToInt64 | printf "%02X" }}

4
arch-user/config/pass/env.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
export PASSWORD_STORE_DIR="$HOME/know/id"
export PASSWORD_STORE_GENERATED_LENGTH=16

16
arch-user/config/profile Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
export PATH=$PATH:~/.local/bin
export WLR_RENDERER=vulkan
for fpath in ~/.config/*/env.sh; do
. "$fpath"
done
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null

View File

@ -0,0 +1,66 @@
#import time
#start_ts=time.time()
import os
env=os.environ
################# general ############
config.load_autoconfig(False)
c.tabs.tabs_are_windows = True
c.tabs.show = 'never'
######################################
############### keybinds ##############
for mode in ['normal','insert','hint','passthrough','command','prompt','yesno','register']:
m = c.bindings.commands[mode]={}
d = c.bindings.default[mode]
m['<Cut>'] = 'fake-key -g <Ctrl-x>'
m['<Copy>'] = 'fake-key -g <Ctrl-c>'
m['<Paste>'] = 'fake-key -g <Ctrl-v>'
noremap=[
'n','h', 'N','H', '<Ctrl-N>','<Ctrl-H>',
'e','k', 'E','K', '<Ctrl-E>','<Ctrl-K>',
'i','j', 'I','J', '<Ctrl-I>','<Ctrl-J>',
'o','l', 'O','L', '<Ctrl-O>','<Ctrl-L>',
'k','n', 'K','N', '<Ctrl-K>','<Ctrl-N>',
'l','i', 'L','I', '<Ctrl-L>','<Ctrl-I>',
'h','o', 'H','O', '<Ctrl-H>','<Ctrl-O>',
'j','e' 'J','E', '<Ctrl-J>','<Ctrl-E>',
]
for i in range(0,len(noremap)-1,2):
cmd=d.get(noremap[i+1])
if(cmd):
m[noremap[i]]=cmd
#config.unbind('.')
#en_keys = "qwertyuiop[]asdfghjkl;'zxcvbnm,./"+'QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?'
#ru_keys = 'йцукенгшщзхъфывапролджэячсмитьбю.'+'ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,'
#c.bindings.key_mappings.update(dict(zip(ru_keys, en_keys)))
############################################
# styles
c.colors.webpage.preferred_color_scheme = 'dark'
c.colors.webpage.darkmode.enabled = True
c.colors.webpage.bg = '#'+env['QB_THEME_COLOR_BG']
c.fonts.default_family = 'Roboto'
##########################################
# search engines
c.url.searchengines = {
'DEFAULT': 'https://lite.duckduckgo.com/lite?&q={}',
'!d': 'https://lite.duckduckgo.com/lite?&q={}',
'!g': 'https://google.com/search?hl=en&q={}',
'!y': 'https://ya.ru/search/?text={}',
'!c': 'https://chat.openai.com/chat?q={}',
}
###########################################
# start page ############
c.url.default_page = 'file:///home/'+env['USER']+'/.local/share/qutebrowser/start.html'
c.url.start_pages = ['file:///home/'+env['USER']+'/.local/share/qutebrowser/start.html']
########################################
#print(f"Execution time {time.time() - start_ts}")

View File

@ -0,0 +1,3 @@
#!/bin/sh
export QB_THEME_COLOR_BG={{ .theme.color.bg }}

View File

@ -0,0 +1,3 @@
#!/bin/sh
export INPUTRC="$HOME/.config/readline/inputrc"

View File

@ -0,0 +1,36 @@
set editing-mode vi
########### prompt ##############
set show-mode-in-prompt on
set vi-ins-mode-string \1\e[1 q\2
set vi-cmd-mode-string \1\e[2 q\2
#################################
##### remap - colemak-dh #######
set keymap vi-command
# n -> h
"n":backward-char
"N":beginning-of-line
# e -> k
"e":previous-history
"\C-e":kill-line
# i -> j
"i":next-history
"\C-i":accept-line
# o -> l
"o":forward-char
"\C-o":clear-screen
# k -> n
"k":vi-search-again
"K":vi-search-again
# j -> e
"j":vi-end-word
"J":vi-end-word
# l -> i
"l":vi-insertion-mode
"L":vi-insert-beg
# h -> o
# noop
#################################

View File

@ -0,0 +1,147 @@
# vim: filetype=swayconfig
set $mod Mod4
set $altmod Mod4+Mod5
set $altmod2 Mod4+Shift
set $kbmod Alt_R
set $fwd m
set $left n
set $up e
set $down i
set $right o
set $bwd apostrophe
################ styles ####################
default_border pixel 1
smart_borders on
title_align center
font pango:{{ .theme.font.name_regular }} {{ math.Sub .theme.font.size_base_pt .theme.font.size_step_pt }}
output * bg #{{ .theme.color.bg }} solid_color
client.focused #{{ .theme.color.bg_accent_light }} #{{ .theme.color.bg_accent_light }} #{{ .theme.color.fg }} #{{ .theme.color.fg_accent }} #{{ .theme.color.bg_accent_light }}
client.focused_tab_title #{{ .theme.color.bg_accent_light }}{{ math.Mul .theme.opacity.med 255 | conv.ToInt64 | printf "%02X" }} #{{ .theme.color.bg_accent_light }}{{ math.Mul .theme.opacity.med 255 | conv.ToInt64 | printf "%02X" }} #{{ .theme.color.fg_dark }} #{{ .theme.color.fg_accent }} #{{ .theme.color.bg_accent_light }}{{ math.Mul .theme.opacity.low 255 | conv.ToInt64 | printf "%02X" }}
client.focused_inactive #{{ .theme.color.bg_accent_light }}{{ math.Mul .theme.opacity.med 255 | conv.ToInt64 | printf "%02X" }} #{{ .theme.color.bg_accent_light }}{{ math.Mul .theme.opacity.med 255 | conv.ToInt64 | printf "%02X" }} #{{ .theme.color.fg_dark }} #{{ .theme.color.fg_accent }} #{{ .theme.color.bg_accent_light }}{{ math.Mul .theme.opacity.low 255 | conv.ToInt64 | printf "%02X" }}
client.unfocused #{{ .theme.color.bg_accent_dark }} #{{ .theme.color.bg_accent_dark }} #{{ .theme.color.fg_dark }} #{{ .theme.color.fg_accent }} #{{ .theme.color.bg_accent_light }}{{ math.Mul .theme.opacity.low 255 | conv.ToInt64 | printf "%02X" }}
client.urgent #{{ .theme.color.fg_accent }} #{{ .theme.color.fg_accent }} #{{ .theme.color.fg }} #{{ .theme.color.fg_accent }} #{{ .theme.color.fg_accent }}
bar {
position top
font pango:{{ .theme.font.name_regular }} {{ .theme.font.size_base_pt }}
status_command i3blocks
strip_workspace_numbers yes
separator_symbol |
workspace_min_width 28
tray_output none
colors {
statusline #{{ .theme.color.fg }}
background #{{ .theme.color.bg }}
separator #{{ .theme.color.fg_dark }}
focused_workspace #{{ .theme.color.bg_accent_light }} #{{ .theme.color.bg_accent_light }} #{{ .theme.color.fg }}
inactive_workspace #{{ .theme.color.bg_accent_dark }} #{{ .theme.color.bg_accent_dark }} #{{ .theme.color.fg }}
urgent_workspace #{{ .theme.color.fg_accent }} #{{ .theme.color.fg_accent }} #{{ .theme.color.fg }}
binding_mode #{{ .theme.color.fg_accent }} #{{ .theme.color.fg_accent }} #{{ .theme.color.fg }}
}
}
###########################################
################ inputs ####################
input "type:keyboard" {
xkb_layout us(yz),ru(yz)
repeat_rate 50
}
bindsym --to-code $kbmod input "type:keyboard" xkb_switch_layout next; exec pkill -SIGRTMIN+1 i3blocks
input "type:touchpad" {
tap enabled
natural_scroll enabled
}
############################################
############### workspaces #################
bindsym --to-code {
$mod+a workspace 1:A
$mod+r workspace 2:R
$mod+s workspace 3:S
$mod+t workspace 4:T
$mod+g workspace 5:G
$altmod+a move container to workspace 1:A; workspace 1:A
$altmod+r move container to workspace 2:R; workspace 2:R
$altmod+s move container to workspace 3:S; workspace 3:S
$altmod+t move container to workspace 4:T; workspace 4:T
$altmod+g move container to workspace 5:G; workspace 5:G
}
bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next
############################################
############### containers #################
# top row - layouts
bindsym --to-code {
$mod+p layout splith
$altmod+p split h
$mod+l layout splitv
$altmod+l split v
$mod+f fullscreen
$mod+w layout tabbed
$altmod+w split v; layout tabbed
$mod+u split none
$mod+y layout stacking
$altmod+y split h; layout stacking
}
# mid row - focus, movement
bindsym --to-code {
$mod+$fwd focus child
$mod+$left focus left
$mod+$up focus up
$mod+$down focus down
$mod+$right focus right
$mod+$bwd focus parent
$altmod+$left move left 40px
$altmod+$up move up 40px
$altmod+$down move down 40px
$altmod+$right move right 40px
$altmod2+$left resize shrink width 2ppt or 40px
$altmod2+$up resize shrink height 4ppt or 40px
$altmod2+$down resize grow height 4ppt or 40px
$altmod2+$right resize grow width 2ppt or 40px
}
# bottom row - 3d
bindsym --to-code {
$mod+x scratchpad show
$altmod+x sticky enable; move scratchpad
$mod+v focus floating
$altmod+v floating enable; sticky enable
$mod+d focus tiling
$altmod+d focus floating; floating disable; sticky disable;
$mod+k focus prev sibling
$mod+Comma opacity minus 0.05
$mod+Period opacity plus 0.05
$mod+slash focus next sibling
}
floating_modifier $mod normal
############################################
################## actions ####################
bindsym --to-code {
# generic
$mod+Escape kill
# media
XF86MonBrightnessDown exec ~/.local/bin/sway/brightness-set-and-notify.sh 5%-
XF86MonBrightnessUp exec ~/.local/bin/sway/brightness-set-and-notify.sh 5%+
XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle && pkill -SIGRTMIN+2 i3blocks
XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5% && pkill -SIGRTMIN+2 i3blocks
XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5% && pkill -SIGRTMIN+2 i3blocks
XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle && pkill -SIGRTMIN+2 i3blocks
# basic scripts
$mod+Colon exec ~/.local/bin/sway/command-mode.sh
$mod+Return exec footclient
$mod+Space exec run.sh
}
##############################################
################# daemons ####################
exec foot -s
exec mako
exec swayidle
##############################################
############## app-specific ##################
for_window [app_id="_float"] floating enable, resize set 960 540
##############################################

View File

@ -0,0 +1,2 @@
timeout 280 'notify-send "Suspend in 20s" "Produce some acivity or run inhibit to cancel" -a "idle" -t 20000'
timeout 300 'systemctl suspend'

View File

@ -0,0 +1,21 @@
{
"color": {
"fg": "ffffff",
"fg_dark": "b8bcc1",
"fg_accent": "9988ff",
"bg": "0d1117",
"bg_accent_light":"510079",
"bg_accent_dark":"020030"
},
"opacity": {
"low": 0.2,
"med": 0.55,
"high": 0.85
},
"font": {
"name_regular": "Roboto",
"name_mono": "Roboto Mono",
"size_base_pt": 12,
"size_step_pt": 1.5
}
}

134
arch-user/config/vim/vimrc Normal file
View File

@ -0,0 +1,134 @@
"########## system ###########
set nocompatible
set ttyfast
set encoding=utf-8
set mouse=a
set autoread
au FocusGained,BufEnter * silent! checktime
"#############################
"######### generic ###########
" status line
set showmode
set showcmd
set ruler
" syntax hl
syntax enable
filetype on
filetype plugin on
" lines
set number
set relativenumber
set numberwidth=3
set wrap
set showmatch " brackets
" search
set hlsearch
set incsearch
set ignorecase
set smartcase
" tabs
set shiftwidth=4
set tabstop=4
set softtabstop=0
set noexpandtab
" scroll
set scrolloff=5
" commands
set wildmenu
set wildmode=list:longest,full
set gdefault
"###########################################
"############## file-specific ###############
autocmd FileType markdown setlocal spell
autocmd FileType gitcommit setlocal spell
autocmd FileType markdown setlocal complete+=kspell
autocmd FileType gitcommit setlocal complete+=kspell
"############################################
"####### remap - colemak-dh #######
" n -> h
noremap n h
noremap N H
noremap! <C-n> <C-h>
" e -> k
noremap e k
noremap E K
noremap! <C-e> <C-k>
" i -> j
noremap i j
noremap I J
noremap! <C-i> <C-j>
" o -> l
noremap o l
noremap O L
noremap! <C-o> <C-l>
" k -> n
noremap k n
noremap K N
noremap! <C-k> <C-n>
" j -> e
noremap j e
noremap J E
noremap! <C-j> <C-e>
" l -> i
noremap l i
noremap L I
noremap! <C-l> <C-i>
" h -> o
noremap h o
noremap H O
noremap! <C-h> <C-o>
"#################################
"####### custom commands #########
" W - Save file as superuser
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
"#################################
"######### localization ##########
set langmap=йЙцЦуУкКеЕнНгГшШщЩзЗхХъЪфФыЫвВаАпПрРоОлЛдДжЖэЭяЯчЧсСмМиИтТьЬбБюЮ.\\,;qQwWfFpPbBjJlLuUyY;:[{]}aArRsStTgGmMnNeEiIoO'\"xXcCdDvVzZkKhH\\,<.>/?
noremap о ь
noremap О Ь
noremap <C-о> <C-ь>
noremap л т
noremap Л Т
noremap <C-л> <C-т>
noremap д н
noremap Д Н
noremap <C-д> <C-н>
noremap ж г
noremap Ж Г
noremap <C-ж> <C-г>
noremap т о
noremap Т О
noremap <C-т> <C-о>
noremap г д
noremap Г Д
noremap <C-г> <C-д>
noremap ь ж
noremap Ь Ж
noremap <C-ь> <C-ж>
noremap н л
noremap Н Л
noremap <C-н> <C-л>
"#################################
"############# hacks #############
{{ if ne .Env.IS_COMPAT "1" }}
autocmd TextYankPost * if (v:event.operator == 'y' || v:event.operator == 'd') | silent! execute 'call system("wl-copy", @")' | endif
nnoremap p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
{{ end }}
"################################

View File

@ -0,0 +1,2 @@
GIT_USER_EMAIL=
GIT_USER_NAME=

View File

@ -0,0 +1,37 @@
xkb_symbols "yz" {
include "ru(common)"
name[Group1]= "RU-yz";
# functional
key.type = "ONE_LEVEL";
replace key <BKSL> { [ BackSpace ] };
replace key <TAB> { [ Escape ] };
replace key <RTSH> { [ Tab ] };
# modifiers
key.type = "ONE_LEVEL";
replace key <CAPS> { [ Control_L ] };
replace key <LCTL> { [ Super_L ] };
replace key <LWIN> { [ Alt_R ] };
replace key <LALT> { [ ISO_Level3_Shift ] };
replace key <RALT> { [ Alt_L ] };
# character remap
key.type = "FOUR_LEVEL";
key <BKSP> { [ backslash, bar, notsign, brokenbar ] };
#key <AD10> { [ colon, semicolon, odiaeresis, Odiaeresis ] };
# layer3
# TODO: migrate to type=ALPHANUMERIC
# This would fix caps lock which i dont use anyway
key.type = "FOUR_LEVEL";
# navigation
key <SPCE> { [ space, space, Tab, nobreakspace ] };
key <AC07> { [ Cyrillic_o, Cyrillic_O, Left, eacute] };
key <AC08> { [ Cyrillic_el, Cyrillic_EL, Up, eacute ] };
key <AC09> { [ Cyrillic_de, Cyrillic_DE, Down, iacute ] };
key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, Right, oacute ] };
# special
key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, asciitilde, dead_tilde ] };
};

View File

@ -0,0 +1,38 @@
xkb_symbols "yz" {
include "us(colemak_dh)"
name[Group1]= "EN-yz";
# functional
key.type = "ONE_LEVEL";
replace key <BKSL> { [ BackSpace ] };
replace key <TAB> { [ Escape ] };
replace key <RTSH> { [ Tab ] };
# modifiers
key.type = "ONE_LEVEL";
replace key <CAPS> { [ Control_L ] };
replace key <LCTL> { [ Super_L ] };
replace key <LWIN> { [ Alt_R ] };
replace key <LALT> { [ ISO_Level3_Shift ] };
replace key <RALT> { [ Alt_L ] };
# character remap
key.type = "FOUR_LEVEL";
key <BKSP> { [ backslash, bar, notsign, brokenbar ] };
key <AD10> { [ colon, semicolon, odiaeresis, Odiaeresis ] };
# layer3
# TODO: migrate to type=ALPHANUMERIC
# This would fix caps lock which i dont use anyway
key.type = "FOUR_LEVEL";
# navigation
key <SPCE> { [ space, space, Tab, nobreakspace ] };
key <AC07> { [ n, N, Left, eacute] };
key <AC08> { [ e, E, Up, eacute ] };
key <AC09> { [ i, I, Down, iacute ] };
key <AC10> { [ o, O, Right, oacute ] };
# special
key <AD01> { [ q, Q, asciitilde, dead_tilde ] };
};

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
html { background:#$THEME_COLOR_BG; color:#$THEME_COLOR_FG; }
body { margin: 8px; }
form { display: flex; column-gap: 8px; }
label, input { font-size: ${THEME_SIZE_FONT_LARGE_MULT}rem; }
input { flex:2; min-width:100px; background: none; }
</style>
</head>
<body>
<form onsubmit="location.href='https://lite.duckduckgo.com/lite/?q='+encodeURIComponent(document.getElementById('q').value); return false">
<label for="id">web :open</label>
<input type="text" name="q" id="q" autofocus>
</form>
</body>
</html>

9
arch-user/gen-linux-compat.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f -- "$0")")"
umask 002
export IS_COMPAT=1
gomplate --file config/vim/vimrc --out ../linux-compat/home/.vimrc
gomplate --file config/readline/inputrc --out ../linux-compat/home/.inputrc

93
arch-user/install.sh Executable file
View File

@ -0,0 +1,93 @@
#!/bin/bash
# config/ - configuration files (including shell and profile)
# data/ - resource files used by configured system
# bin/ - scripts used either by configured system or by user
set -e
cd "$(dirname "$(readlink -f -- "$0")")"
umask 002
[[ "$(id -u)" == "0" ]] && echo "ERROR: wrong user" >&1 && exit 1
########## init config #########
if [[ ! -f ~/.config/workspace.conf ]]; then
mkdir -p ~/.config
cp config/workspace.conf ~/.config
fi
while read -r line; do
param="${line::-1}"
if ! grep -qE "^$param=.+" ~/.config/workspace.conf; then
echo "ERROR: ~/.config/workspace.conf - missing $param"
CONFIG_INVALID=1
fi
done < config/workspace.conf
[[ $CONFIG_INVALID ]] && exit 1
################################
####### file structure #########
USER_DIRS=(
##### xdg #####
~/.config # bkp=weak
~/.local/bin # bkp=weak
~/.local/share # bkp=weak
~/.local/state
~/.cache
# app
~/.local/state/sway
################
##### user #####
# core knowledge base
~/know # bkp=true,roam=true
# large blobs for knowledge base
~/know-lfs # Large blobs for knowledge base. bkp=weak
# temp files with manual bulk cleanup
~/tmp
# downloads
~/dl # bkp=weak
# development - external vcs, tons of deps, etc.
~/dev # bkp=weak
################
)
mkdir -p "${USER_DIRS[@]}"
################################
########## scripts #############
cp -rf bin/* ~/.local/bin
LN_EXCLUDE_DIRS=(i3blocks bemenu)
ln_exclude_dirs_cmp=" ${LN_EXCLUDE_DIRS[*]} "
for sdir in bin/*; do
[ ! -d "$sdir" ] && continue
sdir="${sdir##*/}"
[[ $ln_exclude_dirs_cmp == *" $sdir "* ]] && continue
find ~/.local/bin -maxdepth 1 -type l -name "$sdir-*" \
-exec rm {} \;
#shellcheck disable=SC2016
find ~/.local/bin/"$sdir" -maxdepth 1 -type f -perm -u+rwx | \
xargs -0 -d \\n -n 1 sh -c 'ln -s "$1" "/$HOME/.local/bin/$(basename "$(dirname "$1")")-${1##*/}"' sh
done
################################
########### config #############
export IS_COMPAT=0
gomplate --input-dir config \
--output-map "$HOME/.config/{{ .in | strings.ReplaceAll \".tmpl\" \"\" }}" \
--exclude-processing "!*.tmpl" \
--plugin jq=/bin/jq \
-c theme=config/theme.json \
-c user="file:///$HOME/.config/workspace.conf?type=application/x-env" \
--exclude /workspace.conf
ln -sf ~/.config/bash/bashrc ~/.bashrc
ln -sf ~/.config/profile ~/.profile
mkdir -p ~/.gnupg && ln -sf ~/.config/gnupg/gpg-agent.conf ~/.gnupg
################################
############# data ############
cp -rf data/* ~/.local/share
###############################
swaymsg reload || true
echo ok

View File

@ -0,0 +1,36 @@
set editing-mode vi
########### prompt ##############
set show-mode-in-prompt on
set vi-ins-mode-string \1\e[1 q\2
set vi-cmd-mode-string \1\e[2 q\2
#################################
##### remap - colemak-dh #######
set keymap vi-command
# n -> h
"n":backward-char
"N":beginning-of-line
# e -> k
"e":previous-history
"\C-e":kill-line
# i -> j
"i":next-history
"\C-i":accept-line
# o -> l
"o":forward-char
"\C-o":clear-screen
# k -> n
"k":vi-search-again
"K":vi-search-again
# j -> e
"j":vi-end-word
"J":vi-end-word
# l -> i
"l":vi-insertion-mode
"L":vi-insert-beg
# h -> o
# noop
#################################

131
linux-compat/home/.vimrc Normal file
View File

@ -0,0 +1,131 @@
"########## system ###########
set nocompatible
set ttyfast
set encoding=utf-8
set mouse=a
set autoread
au FocusGained,BufEnter * silent! checktime
"#############################
"######### generic ###########
" status line
set showmode
set showcmd
set ruler
" syntax hl
syntax enable
filetype on
filetype plugin on
" lines
set number
set relativenumber
set numberwidth=3
set wrap
set showmatch " brackets
" search
set hlsearch
set incsearch
set ignorecase
set smartcase
" tabs
set shiftwidth=4
set tabstop=4
set softtabstop=0
set noexpandtab
" scroll
set scrolloff=5
" commands
set wildmenu
set wildmode=list:longest,full
set gdefault
"###########################################
"############## file-specific ###############
autocmd FileType markdown setlocal spell
autocmd FileType gitcommit setlocal spell
autocmd FileType markdown setlocal complete+=kspell
autocmd FileType gitcommit setlocal complete+=kspell
"############################################
"####### remap - colemak-dh #######
" n -> h
noremap n h
noremap N H
noremap! <C-n> <C-h>
" e -> k
noremap e k
noremap E K
noremap! <C-e> <C-k>
" i -> j
noremap i j
noremap I J
noremap! <C-i> <C-j>
" o -> l
noremap o l
noremap O L
noremap! <C-o> <C-l>
" k -> n
noremap k n
noremap K N
noremap! <C-k> <C-n>
" j -> e
noremap j e
noremap J E
noremap! <C-j> <C-e>
" l -> i
noremap l i
noremap L I
noremap! <C-l> <C-i>
" h -> o
noremap h o
noremap H O
noremap! <C-h> <C-o>
"#################################
"####### custom commands #########
" W - Save file as superuser
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
"#################################
"######### localization ##########
set langmap=йЙцЦуУкКеЕнНгГшШщЩзЗхХъЪфФыЫвВаАпПрРоОлЛдДжЖэЭяЯчЧсСмМиИтТьЬбБюЮ.\\,;qQwWfFpPbBjJlLuUyY;:[{]}aArRsStTgGmMnNeEiIoO'\"xXcCdDvVzZkKhH\\,<.>/?
noremap о ь
noremap О Ь
noremap <C-о> <C-ь>
noremap л т
noremap Л Т
noremap <C-л> <C-т>
noremap д н
noremap Д Н
noremap <C-д> <C-н>
noremap ж г
noremap Ж Г
noremap <C-ж> <C-г>
noremap т о
noremap Т О
noremap <C-т> <C-о>
noremap г д
noremap Г Д
noremap <C-г> <C-д>
noremap ь ж
noremap Ь Ж
noremap <C-ь> <C-ж>
noremap н л
noremap Н Л
noremap <C-н> <C-л>
"#################################
"############# hacks #############
"################################

View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f -- "$0")")"
[[ -z "$1" ]] && echo "ERROR: no destination" >&1 && exit 1
scp -r home/. "$1:/tmp/workspace"
ssh "$1" "cp -rfT /tmp/workspace ~/ && rm -rf /tmp/workspace"