Compare commits

...

5 Commits

Author SHA1 Message Date
Karol Krzosa
5b5e28221e kakrc copy to system clipboard 2026-06-18 10:17:18 +02:00
Karol Krzosa
e4851ca9a8 Handle LibreWolf / Firefox in command-list 2026-06-18 09:07:45 +02:00
Karol Krzosa
c4a251ce09 Install kakoune, new bash_alias 2026-06-18 08:41:00 +02:00
Karol Krzosa
a67e7b0aa1 Start sway on startup, fix command-list launching apps 2026-06-17 22:33:39 +02:00
Karol Krzosa
bd9506a9be setup.sh and installing on new system 2026-06-17 22:13:50 +02:00
10 changed files with 216 additions and 69 deletions

View File

@@ -1,3 +1,4 @@
alias ls='ls -lahtr'
alias vi='vim'
alias vi='kak'
alias df='/usr/bin/git --git-dir=$HOME/.dotfilesrepo/ --work-tree=$HOME'
alias unpack='dtrx'

View File

@@ -1,53 +0,0 @@
# TODO:
# - [ ] Mount /krk-pc on startup
# - [ ] Add server SSH keys and PC ssh keys
# - [ ] Mount /proton on startup
# - [x] Hibernate if not using PC for 10 minutes
#
# - [ ] Combine apps + bin + bookmarks
# - [x] everything relevant wmenu browser (programs and scripts without arguments, bookmarks, files)
# - [x] plocate + wmenu > xdg-open
# - [x] applications + bin folder
# - [x] bookmarks
#
# - [x] fzf starship zoxide eza bat (only fzf seems descent)
#
# Solutions in search for problems:
# - [ ] tmux automation
#
# Setup sudo for user
su root
export PATH="$PATH:/usr/sbin"
apt install sudo
usermod -aG sudo kk
exit # exit root
exit # exit user to reload config
# Basic utilities
sudo apt install clang cmake build-essential make tcc vim ripgrep curl git man-db plocate tmux zip unzip fzf
sudo updatedb
# Standard enviroment setup
sudo apt install xdg-desktop-portal-wlr xdg-desktop-portal-gtk xdg-user-dirs
# DE setup
sudo apt install sway swayidle swaybg swaylock foot wmenu brightnessctl
# Clipboard and history
sudo apt install wl-clipboard cliphist
# Issue fix
# there were issues because user was not in render group (error messages on start of sway)
sudo usermod -aG render kk
# Setup audio
sudo apt install pipewire pipewire-pulse wireplumber pavucontrol
sudo apt install sshfs
# Setup internet
# sudo apt install w3m surfraw
sudo apt install chromium

14
.config/kak/kakrc Normal file
View File

@@ -0,0 +1,14 @@
colorscheme gruvbox-dark
# Use 4 spaces for indentation.
# indentwidth controls Kakoune's indentation commands; tabstop controls display width.
set-option global tabstop 4
set-option global indentwidth 4
# Kakoune does not have a Vim-style 'expandtab' option. Make a literal Tab key
# insert four spaces instead of a tab character while in insert mode.
map global insert <tab> '<space><space><space><space>'
hook global RegisterModified '"' %{ nop %sh{
printf %s "$kak_main_reg_dquote" | wl-copy > /dev/null 2>&1 &
}}

View File

@@ -48,8 +48,7 @@ include /etc/sway/config-vars.d/*
#
exec swayidle -w \
timeout 300 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
timeout 600 'systemctl hibernate' \
before-sleep 'swaylock -f -c 000000'
timeout 600 'systemctl hibernate'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when

View File

@@ -4,6 +4,10 @@
set -g extended-keys on
set -g extended-keys-format csi-u
# Index from 1
set -g base-index 1
setw -g pane-base-index 1
# Use 256-colour tmux terminfo and advertise truecolour support to apps.
set -g default-terminal "tmux-256color"
set -as terminal-features ",*:RGB"
@@ -20,12 +24,6 @@ bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Optional no-prefix pane navigation with Alt+hjkl
bind-key -n M-h select-pane -L
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-l select-pane -R
# Mouse support: scroll with the wheel, resize/select panes, and make mouse
# selections pane-aware instead of selecting across the whole terminal window.
set-option -g mouse on

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.config/librewolf/
.config/pulse/
bin/pi

View File

@@ -30,3 +30,9 @@ fi
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
if [ -z "$WAYLAND_DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
export WLR_NO_HARDWARE_CURSORS=1
exec sway --unsupported-gpu
fi

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python3
import os, subprocess, json
import os, subprocess, json, sqlite3, shutil, tempfile
from pathlib import Path
def readfile(path):
fd = open(path, "r")
@@ -8,6 +8,9 @@ def readfile(path):
fd.close()
return result
#
# GTK apps
#
vals = {}
home = os.environ["HOME"]
appsdir=["/usr/share/applications", f"{home}/.local/share/applications"]
@@ -34,7 +37,7 @@ for appdir in appsdir:
_exec = line[5:]
elif line.startswith("Type="):
_type = line[5:]
elif line.startswith("Name="):
elif line.startswith("Name=") and _name is None:
_name = line[5:]
elif line.startswith("NoDisplay="):
_nodisplay = line[10:]
@@ -49,9 +52,11 @@ for appdir in appsdir:
if _nodisplay == "true" or _hidden == "true":
continue
vals[_name] = {"kind": "app", "exec": _exec, "path": path}
vals[_name] = {"kind": "app", "exec": _exec, "path": path, "name": appfile[:-8]}
#
# Bin
#
bindir = f"{home}/bin"
for file in os.listdir(bindir):
path = f"{bindir}/{file}"
@@ -61,6 +66,9 @@ for file in os.listdir(bindir):
continue
vals[file] = {"kind": "bin", "path": path}
#
# Chromium bookmarks
#
def walk_bookmarks(node, folder=""):
if isinstance(node, dict):
if node.get("type") == "url" and node.get("url"):
@@ -82,6 +90,74 @@ if os.path.isfile(bookmarkfile):
for root in roots.values():
walk_bookmarks(root)
#
# Firefox bookmarks
#
SEARCH_DIRS = [
Path.home() / ".config" / "librewolf",
]
def find_places_databases():
seen = set()
for base in SEARCH_DIRS:
if not base.exists():
continue
for db in base.glob("**/places.sqlite"):
resolved = db.resolve()
if resolved not in seen:
seen.add(resolved)
yield db
def read_firefox_bookmarks(db_path):
# Copy the DB first so this also works while Firefox/LibreWolf is running.
with tempfile.TemporaryDirectory() as tmp:
tmp_db = Path(tmp) / "places.sqlite"
shutil.copy2(db_path, tmp_db)
for suffix in ("-wal", "-shm"):
sidecar = Path(str(db_path) + suffix)
if sidecar.exists():
shutil.copy2(sidecar, Path(str(tmp_db) + suffix))
con = sqlite3.connect(f"file:{tmp_db}?mode=ro", uri=True)
cur = con.cursor()
query = """
WITH RECURSIVE folders(id, path) AS (
SELECT id, COALESCE(title, '')
FROM moz_bookmarks
WHERE parent = 0
UNION ALL
SELECT b.id,
CASE
WHEN folders.path = '' THEN COALESCE(b.title, '')
WHEN COALESCE(b.title, '') = '' THEN folders.path
ELSE folders.path || '/' || b.title
END
FROM moz_bookmarks b
JOIN folders ON b.parent = folders.id
WHERE b.type = 2
)
SELECT COALESCE(folders.path, ''), COALESCE(b.title, ''), p.url
FROM moz_bookmarks b
JOIN moz_places p ON b.fk = p.id
LEFT JOIN folders ON b.parent = folders.id
WHERE b.type = 1
AND p.url IS NOT NULL
ORDER BY b.dateAdded
"""
for folder, title, url in cur.execute(query):
name = title or url
label = f"{folder}/{name}" if folder else name
vals[label] = {"kind": "url", "url": url}
con.close()
for it in find_places_databases():
read_firefox_bookmarks(it)
entries = []
for it in vals.items():
entries.append(it[0])
@@ -94,10 +170,9 @@ if result.returncode != 0:
choice = result.stdout.strip()
val = vals[choice]
if val["kind"] == "bin":
subprocess.run([val["path"]])
elif val["kind"] == "app":
subprocess.run(["gtk-launch", choice])
subprocess.run(["gtk-launch", val["name"]])
elif val["kind"] == "url":
subprocess.run(["xdg-open", val["url"]])

82
install_the_dotfiles.sh Normal file
View File

@@ -0,0 +1,82 @@
# TODO:
# - [x] Add server SSH keys and PC ssh keys
# - [ ] Mount /proton on startup
# - [x] Hibernate if not using PC for 10 minutes
#
# - [x] Mount /lenovo-laptop
# - [x] Mount server /server-vps
#
# - [x] Combine apps + bin + bookmarks
# - [x] Use .desktop file name instead of "Name" parameter
# - [ ] Firefox bookmarks
# - [x] everything relevant wmenu browser (programs and scripts without arguments, bookmarks, files)
# - [x] plocate + wmenu > xdg-open
# - [x] applications + bin folder
# - [x] bookmarks
#
# - [ ] Kakoune setup
# - [ ] Ideas for Chinese learning integration
#
# Solutions in search for problems:
# - [ ] tmux automation
#
## Setup sudo for user
# su root
# export PATH="$PATH:/usr/sbin"
# apt install sudo git
# usermod -aG sudo kk
# exit # exit root
# exit # exit user to reload config
## Basic utilities
# sudo apt install -y clang cmake build-essential make tcc vim ripgrep curl git man-db plocate tmux fzf dtrx
# sudo updatedb
## Update grub to not wait on bootloader screen @todo: automate
# sudo vi /etc/default/grub
# GRUB_TIMEOUT=0
# GRIM_TIMEOUT_STYLE=hidden
## Drivers
## Need to update /etc/apt/sources.list (add contrib non-free non-free-firmware) @todo: automate
# sudo apt update
# sudo apt install -y nvidia-driver firmware-misc-nonfree linux-headers-amd64
## Then do some nvidia configuration (set modeset=1, update ramfs, reboot)
# # Standard enviroment setup
# sudo apt install -y xdg-desktop-portal-wlr xdg-desktop-portal-gtk xdg-user-dirs
# # DE setup
# sudo apt install -y sway swayidle swaybg swaylock foot wmenu brightnessctl xwayland wl-clipboard
# # Issue fix
# # there were issues because user was not in render group (error messages on start of sway)
# sudo usermod -aG video,render kk
# # Setup audio
# sudo apt install -y pipewire pipewire-pulse wireplumber pavucontrol
## Copy over ssh keys to relevant machines @user_action
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""
## Setup ssh drives
# sudo apt install -y sshfs
## Mount the drives using /etc/fstab automatically
## Example:
##
## root@157.90.144.237:/ /server-vps fuse.sshfs noauto,x-systemd.automount,_netdev,x-systemd.idle-timeout=2min,x-systemd.mount-timeout=10s,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=/home/kk/.ssh/id_ed25519,UserKnownHostsFile=/home/kk/.ssh/known_hosts,StrictHostKeyChecking=accept-new,allow_other,default_permissions 0 0
#
# # Setup internet
# # sudo apt install w3m surfraw
# sudo apt install chromium
# Extra
## Clipboard history
# sudo apt install cliphist

22
setup.sh Normal file
View File

@@ -0,0 +1,22 @@
SRC=$HOME/.dotfilesrepo
rm $HOME/.bashrc
rm $HOME/.profile
ln -sf $SRC/.bashrc $HOME/.bashrc
ln -sf $SRC/.vimrc $HOME/.vimrc
ln -sf $SRC/.profile $HOME/.profile
ln -sf $SRC/.config $HOME/.config
ln -sf $SRC/bin $HOME/bin
mkdir -p $HOME/.local/share/fonts
cp $SRC/.local/share/fonts/* $HOME/.local/share/fonts/.
# Install kakoune
wget https://github.com/mawww/kakoune/releases/download/v2026.05.21/kakoune-v2026.05.21-linux.tar.bz2
unpack kakoune-v2026.05.21-linux.tar.bz2
cd kakoune-v2026.05.21-linux
sudo cp -r bin/* /usr/local/bin/
sudo cp -r libexec/* /usr/local/libexec/
sudo cp -r share/* /usr/local/share/
cd ..
rm kakoune-v2026.05.21-linux -rf
rm kakoune-v2026.05.21-linux.tar.bz2