Compare commits

...

11 Commits

Author SHA1 Message Date
Antonin Ruan
354e44f713 mouse fix vimrc 2026-01-27 21:45:45 +01:00
Antonin Ruan
7856bd42bc minor changes 2026-01-27 21:45:39 +01:00
Antonin Ruan
77afc69650 add mosh aliases 2026-01-27 21:44:43 +01:00
Antonin Ruan
255c44ee92 more i3 config 2026-01-27 21:44:09 +01:00
Antonin Ruan
cb5df40b40 i3 config and updates 2025-09-27 15:57:35 +02:00
Antonin Ruan
ba845c0675 Switch to Melpa Stable 2025-08-19 16:04:07 +02:00
Antonin Ruan
6973d5e562 Remove unused grammar import for treesitter 2025-08-19 16:03:30 +02:00
Antonin Ruan
fb8f2726b9 Merge branch 'master' of github.com:AntoninRuan/dotfiles 2025-08-19 16:01:32 +02:00
Antonin Ruan
568b05f1e5 Add aliases, update rofi config and add rofi spotify mode launch script 2025-08-19 15:57:09 +02:00
Antonin Ruan
009dbc73ae Update rofi spotify script to use a better cache architecture 2025-08-19 15:48:30 +02:00
5005d3a4ad Add typescript setup for emacs 2025-06-23 18:45:49 +02:00
16 changed files with 474 additions and 75 deletions

View File

@@ -24,7 +24,14 @@ alias which-command=whence
alias copy="xclip -selection clipboard"
alias mkcdir='f() { md $1; cd $1 }; f'
alias sctl='systemctl'
alias userctl='systemctl --user'
alias uctl='userctl'
alias kdiff="kitten diff"
alias kssh="kitten ssh"
alias mssh="mosh --ssh='kitten ssh'"
alias mussh="mosh --ssh='kitten ssh -o StrictHostKeyChecking=no'"
alias gf2="/usr/bin/gf2 &> /dev/null &"
alias qemu-monitor="telnet 127.0.0.1 7777"
alias qemu-monitor="telnet 127.0.0.1 7777"
alias sudo="sudo "

120
.config/i3/config Normal file
View File

@@ -0,0 +1,120 @@
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
font pango:monospace 10
set $wallpaper ~/Pictures/backgrounds/clair-obscur-expedition-33-4k-p8.png
set $lockscreen ~/Pictures/backgrounds/co-lockscreen.png
exec --no-startup-id numlockx
exec --no-startup-id feh --bg-scale $wallpaper
# Start XDG autostart .desktop files using dex. See also
# https://wiki.archlinux.org/index.php/XDG_Autostart
exec --no-startup-id dex --autostart --environment i3
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
bindsym XF86AudioPlay exec --no-startup-id playerctl -p spotify play-pause && $refresh_i3status
# Workspace config
include ./workspace.conf
# Floating window correction
include ./floating.conf
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
tiling_drag modifier titlebar
# start kitty
bindsym $mod+Return exec kitty
# kill focused window
bindsym $mod+q kill
# start rofi
bindsym $mod+r exec --no-startup-id rofi -show drun
# rofi spotify
bindsym $mod+m exec --no-startup-id /home/womax/.config/scripts/rofi_spotify.sh
bindsym $mod+p exec --no-startup-id rofi -show window
# change focus
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+h focus left
bindsym $mod+l focus right
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Left focus left
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+h move left
bindsym $mod+Shift+l move right
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+g split h
# split in vertical orientation
bindsym $mod+v split v
# change container layout (stacked/tabbed/toggle split)
workspace_layout tabbed
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# hides border
hide_edge_borders smart
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# reload configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace
bindsym $mod+Shift+x restart
# lock screen
bindsym $mod+Control+l exec --no-startup-id "i3lock -kti $lockscreen && sleep 1"
# exit i3 (logout)
bindsym $mod+Shift+e exec --no-startup-id i3-msg exit
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command i3status
}
exec --no-startup-id /usr/bin/dunst
exec kitty
exec emacs
exec firefox
exec discord
exec spotify-launcher

2
.config/i3/floating.conf Normal file
View File

@@ -0,0 +1,2 @@
for_window [title="Steam Settings"] floating enable
for_window [title="Paradox Launcher"] floating enable

63
.config/i3/workspace.conf Normal file
View File

@@ -0,0 +1,63 @@
# Define names for default workspaces for which we configure key bindings later on
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to worksapce
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# Make DP-0 primary monitor
exec --no-startup-id xrandr --output "DP-0" --primary
# bind workspace 1 and 3 to primary monitor (DP-0)
workspace $ws1 output DP-0
workspace $ws3 output DP-0
workspace $ws5 output DP-0
# bind worksapce 2 and 4 to secondary monitor (HDMI-0)
workspace $ws2 output HDMI-0
workspace $ws4 output HDMI-0
# assign kitty, emacs to ws1
assign [class="kitty"] $ws1
assign [class="Emacs"] $ws1
# assign firefox to ws2
assign [class="firefox"] $ws2
# assign spotify to ws3
assign [class="Spotify"] $ws3
# assign discord to ws4
assign [class="discord"] $ws4
assign [class="Qemu-system-*"] $ws5
assign [class="steam"] $ws5

53
.config/i3status/config Normal file
View File

@@ -0,0 +1,53 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 5
}
# order += "ipv6"
# order += "wireless _first_"
order += "ethernet _first_"
# order += "battery all"
order += "disk /"
# order += "load"
order += "memory"
order += "tztime local"
wireless _first_ {
format_up = "W: (%quality at %essid) %ip"
format_down = "W: down"
}
ethernet _first_ {
format_up = "E: %ip (%speed)"
format_down = "E: down"
}
battery all {
format = "%status %percentage %remaining"
}
disk "/" {
format = "%avail"
}
load {
format = "%1min"
}
memory {
format = "%used | %available"
threshold_degraded = "1G"
format_degraded = "MEMORY < %available"
}
tztime local {
format = "%Y-%m-%d %H:%M:%S"
}

View File

@@ -10,7 +10,7 @@ enable_audio_bell no
# BEGIN_KITTY_FONTS
font_family family="Iosevka"
font_size 18.0
font_size 14.0
bold_font auto
italic_font auto
bold_italic_font auto

View File

@@ -1,5 +1,5 @@
configuration {
modes: "drun,filebrowser,ssh";
modes: "drun,filebrowser,ssh,window";
show-icons: true;
display-drun: " ";
display-run: " ";
@@ -11,6 +11,7 @@ configuration {
window-format: "{w}{t}";
font: "JetBrainsMono 15";
icon-theme: "Colloid";
ssh-client: "kitten ssh";
filebrowser {
directory: "~/";
@@ -18,6 +19,10 @@ configuration {
directories-first: true;
show-hidden: false;
}
kb-accept-alt: "";
kb-custom-1: "Shift+Return";
}
@theme "~/.config/rofi/themes/breeze-dracula.rasi"
//@theme "~/.config/rofi/themes/breeze-dracula.rasi"
@theme "~/.config/rofi/themes/dmenu.rasi"

View File

@@ -1,2 +1,2 @@
joblib==1.5.1
diskcache==5.6.3
spotipy==2.25.1

View File

@@ -1,9 +1,7 @@
#!/home/womax/.config/rofi/scripts/.env/bin/python
import joblib
from joblib import expires_after
from diskcache import Cache
import os
import os.path as path
import shutil
import spotipy
from spotipy.oauth2 import SpotifyPKCE
import sys
@@ -20,13 +18,9 @@ cache_dir = path.join(
path.join(os.getenv("HOME"), ".cache")),
"rofi-spotify")
if path.exists(cache_dir) and not path.isdir(cache_dir):
shutil.rmtree(cache_dir)
if not path.exists(cache_dir):
os.makedirs(cache_dir, mode=0o755)
memory = joblib.Memory(cache_dir, verbose=0)
track_cache = Cache(path.join(cache_dir, "track_cache"),
eviction_policy="least-recently-stored",
size_limit=int(10e6))
scopes = ["user-top-read", "user-modify-playback-state"]
@@ -39,67 +33,111 @@ sp = spotipy.Spotify(
cache_path=path.join(cache_dir, "credentials"))
))
@memory.cache(cache_validation_callback=expires_after(days=30))
def get_top_tracks(limit=200):
offset = 0
tracks = []
while offset < limit:
reading = min(50, limit-offset)
tracks += sp.current_user_top_tracks(
new_tracks = sp.current_user_top_tracks(
limit=reading,
offset=offset)["items"]
if len(new_tracks) == 0:
return tracks
tracks += new_tracks
offset += reading
return tracks
def simplify_track_info(track):
result = {}
result["id"] = track["id"]
result["fullname"] = f'{track["name"]} - {track["artists"][0]["name"]}'
return result
def get_cached_tracks():
if len(track_cache) == 0:
tt = get_top_tracks(500)
for track in tt:
track_cache[track["id"]] = simplify_track_info(track)
return [track_cache[k] for k in track_cache]
def search_track(query: str):
search_rs = sp.search(query, limit=10, type='track')["tracks"]["items"]
return [simplify_track_info(t) for t in search_rs]
def play_track(track_id: str, track_fullname: str, now=True):
if track_id == "":
return
try:
to_play = {
"id": track_id,
"fullname": track_fullname
}
sp.add_to_queue(f"spotify:track:{to_play['id']}")
track_cache[to_play['id']] = to_play
except spotipy.SpotifyException as err:
print(f"{err.msg}", file=sys.stderr)
return
if now:
time.sleep(0.1)
sp.next_track()
def format_track(track):
track_format = "{title} - {artist}\0info\x1f{track_id}\n"
track_format = "{fullname}\0info\x1f{track_id}\n"
return track_format.format(
title=track["name"],
artist=track["artists"][0]["name"],
fullname=track["fullname"],
track_id=track["id"]
)
def display_default():
liked_tracks = get_top_tracks()
for item in liked_tracks:
def display_track_list(track_list=None):
if track_list is None:
track_list = get_cached_tracks()
for item in track_list:
print(format_track(item), end="")
def play_track(track_id: str):
try:
sp.add_to_queue(f"spotify:track:{track_id}")
except spotipy.SpotifyException as err:
print(f"\0message\x1f{err.msg}")
return
time.sleep(0.1)
sp.next_track()
@memory.cache(cache_validation_callback=expires_after(seconds=180))
def search_track(query: str):
try:
query_res = sp.search(query, limit=30, type='track')["tracks"]["items"]
if len(query_res) == 0:
print("\0message\x1fNo result in search")
return
for result in query_res:
print(format_track(result), end="")
except spotipy.SpotifyException as err:
print(f"\0message\x1f{err.msg}")
return
controls = {
"Next": sp.next_track,
"Play": sp.start_playback,
"Pause": sp.pause_playback,
"Previous": sp.previous_track,
}
def display_controls():
for k, _ in controls.items():
print(k)
def main():
match int(os.getenv("ROFI_RETV", default=-1)):
rofi_retv = int(os.getenv("ROFI_RETV", default=-1));
print(rofi_retv, file=sys.stderr)
match rofi_retv:
case 0:
# Initial call
display_default()
# enable custom hot key
print("\0use-hot-keys\x1ftrue")
display_controls()
display_track_list()
case 1:
# Selected entry
play_track(os.getenv("ROFI_INFO", ""))
exit(0)
# Default behavior to play the track immediatly
if sys.argv[1] in controls.keys():
controls[sys.argv[1]]()
return
play_track(os.getenv("ROFI_INFO", ""), sys.argv[1])
case 2:
# Custom entry
track = sys.argv[1]
search_track(track)
memory.reduce_size(bytes_limit="10M")
display_track_list(search_track(track))
case 10:
# Custom hot key 1
# Add entry to the queue
if sys.argv[1] in controls.keys():
return
play_track(os.getenv("ROFI_INFO", ""),
sys.argv[1],
now=False)
case _:
exit(1)

View File

@@ -0,0 +1,43 @@
/**
* ROFI Color theme
* User: Qball
* Copyright: Dave Davenport
*/
* {
background-color: Black;
border-color: White;
text-color: White;
font: "Iosevka 16";
}
window {
anchor: south;
location: south;
width: 100%;
padding: 4px;
children: [ horibox ];
}
horibox {
orientation: horizontal;
children: [ prompt, entry, listview ];
}
listview {
layout: horizontal;
spacing: 5px;
lines: 100;
}
entry {
expand: false;
width: 10em;
}
element {
padding: 0px 2px;
}
element selected {
background-color: SteelBlue;
}
element-text, element-icon {
background-color: inherit;
text-color: inherit;
}

View File

@@ -1,11 +0,0 @@
* {
main-bg: #11111be6;
main-fg: #cdd6f4ff;
main-br: #cba6f7ff;
main-ex: #f5e0dcff;
select-bg: #b4befeff;
select-fg: #11111bff;
separatorcolor: transparent;
border-color: transparent;
}

View File

@@ -0,0 +1,3 @@
#!/bin/sh
rofi -modes "spotify" -show spotify -matching "glob" -normalize-match

88
.emacs
View File

@@ -9,7 +9,7 @@
;;; Appearance
(add-to-list 'default-frame-alist `(font . "Iosevka-16"))
(add-to-list 'default-frame-alist `(font . "Iosevka-12"))
(tool-bar-mode 0)
(menu-bar-mode 0)
@@ -193,9 +193,9 @@
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C-S-n") 'mc/mark-next-like-this)
(global-set-key (kbd "C-S-p") 'mc/mark-previous-like-this)
;(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;(global-set-key (kbd "C-\"") 'mc/skip-to-next-like-this)
;(global-set-key (kbd "C-:") 'mc/skip-to-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(global-set-key (kbd "C-!") 'mc/skip-to-next-like-this)
(global-set-key (kbd "C-:") 'mc/skip-to-previous-like-this)
;;; markdown
(rc/require 'markdown-mode 'impatient-mode 'simple-httpd)
@@ -293,7 +293,67 @@
;;; Typescript
(rc/require 'typescript-mode)
(add-to-list 'auto-mode-alist '("\\.mts\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
(use-package treesit
:mode (("\\.tsx\\'" . tsx-ts-mode)
("\\.js\\'" . typescript-ts-mode)
("\\.mjs\\'" . typescript-ts-mode)
("\\.mts\\'" . typescript-ts-mode)
("\\.cjs\\'" . typescript-ts-mode)
("\\.ts\\'" . typescript-ts-mode)
("\\.jsx\\'" . tsx-ts-mode)
("\\.json\\'" . json-ts-mode)
("\\.Dockerfile\\'" . dockerfile-ts-mode)
("\\.prisma\\'" . prisma-ts-mode)
;; More modes defined here...
)
:preface
(defun os/setup-install-grammars ()
"Install Tree-sitter grammars if they are absent."
(interactive)
(dolist (grammar
'((css . ("https://github.com/tree-sitter/tree-sitter-css" "v0.20.0"))
(bash "https://github.com/tree-sitter/tree-sitter-bash")
(html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.20.1"))
(javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.21.2" "src"))
(json . ("https://github.com/tree-sitter/tree-sitter-json" "v0.20.2"))
(python . ("https://github.com/tree-sitter/tree-sitter-python" "v0.20.4"))
(go "https://github.com/tree-sitter/tree-sitter-go" "v0.20.0")
(markdown "https://github.com/ikatyang/tree-sitter-markdown")
(make "https://github.com/alemuller/tree-sitter-make")
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
(cmake "https://github.com/uyha/tree-sitter-cmake")
(toml "https://github.com/tree-sitter/tree-sitter-toml")
(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.20.3" "tsx/src"))
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.20.3" "typescript/src"))
(yaml . ("https://github.com/ikatyang/tree-sitter-yaml" "v0.5.0"))
(prisma "https://github.com/victorhqc/tree-sitter-prisma")))
(add-to-list 'treesit-language-source-alist grammar)
;; Only install `grammar' if we don't already have it
;; installed. However, if you want to *update* a grammar then
;; this obviously prevents that from happening.
(unless (treesit-language-available-p (car grammar))
(treesit-install-language-grammar (car grammar)))))
;; Optional, but recommended. Tree-sitter enabled major modes are
;; distinct from their ordinary counterparts.
;;
;; You can remap major modes with `major-mode-remap-alist'. Note
;; that this does *not* extend to hooks! Make sure you migrate them
;; also
(dolist (mapping
'((css-mode . css-ts-mode)
(typescript-mode . typescript-ts-mode)
(js-mode . typescript-ts-mode)
(js2-mode . typescript-ts-mode)
(css-mode . css-ts-mode)
(json-mode . json-ts-mode)
(js-json-mode . json-ts-mode)))
(add-to-list 'major-mode-remap-alist mapping))
:config
(os/setup-install-grammars))
;;; Tide
(rc/require 'tide)
@@ -364,10 +424,20 @@
'helm-xref)
(which-key-mode)
(setq lsp-keymap-prefix "s-i")
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)
(add-hook 'python-mode 'lsp)
(use-package lsp-mode
:ensure t
:hook ((c-mode
c++-mode
python-mode
tsx-ts-mode
typescript-ts-mode
))
:custom
(lsp-keymap-prefix "s-i")
(lsp-keep-workspace-alive nil)
(lsp-enable-xref t)
(lsp-enable-on-type-formatting nil)
)
;;; zoxide
(rc/require 'zoxide)

View File

@@ -1,7 +1,7 @@
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
;; (add-to-list 'package-archives
;; '("melpa-stable" . "https://stable.melpa.org/packages/") t)
;; '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(defvar rc/package-contents-refreshed nil)

2
.vimrc Normal file
View File

@@ -0,0 +1,2 @@
set mouse=
set ttymouse=

View File

@@ -2,10 +2,14 @@
.emacs.local|symlink|
.emacs.rc|symlink|
.config/kitty|symlink|
.config/i3|symlink|
.config/i3status|symlink|
.config/rofi|symlink|
.config/kanata|symlink|
.config/kanata-tray|symlink|
.config/scripts|symlink|
.zshrc|symlink|
.p10k.omp.yml|symlink|
.zsh|symlink|
.aliases|symlink|
.vimrc|symlink|