"One of the nice things about getting older is that you come to understand that you can integrate multiple aspects of your life together. When you're young, you think everything has to be binary, as that's exactly how you feel at that age".
- Min Jin Lee

i3 키바인딩을 rofi으로 확인하고 실행하기


i3wm 써서 매일 리눅스 사용.

키보드만 써서 사용하는건 좋은데, 키바인딩이 늘어나서 맨날 i3 키바인딩 까먹음.

그래서 만들어봤다:

  1. 현재 i3 config에 등록된 키바인딩 자동으로 표시 🖥️
  2. rofi에서 선택하면, 그걸 또 실행까지 해줌 🚀

/2025-04apr/i3-bindsyms-rofi-dmenu.png

gist: https://gist.github.com/ageldama/377d00159cfe0cb387f20297ca6a5e6b

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
  #!/usr/bin/env perl

  use strict;
  use warnings;
  use Carp;
  use IPC::Open2;


  sub escape_html {
    $_ = shift;
    s/&/&/g;
    s/</&lt;/g;
    s/>/&gt;/g;
    s/'"'/&quot;/g;
    return $_;
  }

  my @bindsyms = 
    grep(/^bindsym/, # only `bindsym`-s.
         grep(!/(^#)|(^\s*$)/, # omit comment or empty lines.
              qx<i3-msg -t get_config>));

  chomp @bindsyms;

  map { s/^bindsym //g } @bindsyms;

  my @key_to_cmd = map {
    my @m = $_ =~ /^(?<key>\S+)\s+(?<cmd>.+)$/;
    \@m;
  } @bindsyms;

  my @dmenu_items = map {
    my ($key, $cmd) = ($_->[0], $_->[1]);

    $key = escape_html($key);
    $key = "<span size='large' weight='heavy'>$key</span>";

    $cmd = escape_html($cmd);
    $cmd = "\t\t$cmd";

    my $result = join "\n", $key, $cmd;
    $result .= "\0";
    $result;
  } @key_to_cmd;

  # p @dmenu_items;

  my $pid = open2(
    my $stdout, my $stdin,
    "rofi -dmenu -p 'i3 keybindings' -sep '\\0' -eh 2 -markup-rows -format i"
   ) or confess;

  foreach (@dmenu_items) {
    print $stdin $_;
    # print $_;
  }
  close($stdin);

  my $stdout_ = do { local($/); <$stdout> };
  close($stdout);

  waitpid($pid, 0);
  my $exit_code = $? >> 8;
  # print STDERR "exit_code: $exit_code\n";

  if ($exit_code == 0) {
    chomp $stdout_;
    my $cmd = $key_to_cmd[$stdout_]->[1];
    print STDERR "STDOUT: [$stdout_] => [$cmd]\n";
    `i3-msg '$cmd'`;
  } else {
    print STDERR "EXIT: $exit_code\n";
  }

요걸 저장하고, $HOME/.config/i3/config 에 다음을 추가하여 ⌨️ Super+F1 으로 등록:

가볍고 빠른 antiX Linux + runit, koreader 그리고 bloatware


antiX linux

오래된 랩탑으로 fedora 그냥 아무 생각없이 대충 쓰는데 좀 버벅. 어차피 메인드라이버도 아니고 그냥 그러려니 하고 살다가, 좀 답답해서 lightweight linux distro을 골라봤다.

https://antixlinux.com/

거기에 이전에 시도했던 void linux에서 마음에 들었었던 runit을 init으로 쓰는 spin으로 선택해서 설치했다.

결과는… 놀라울 정도로 가벼웠다.

luks disk encryption + btrfs을 기존에는 적용했다가(btrfs이 기본옵션이어서 귀찮아서), 이번에는 그냥 ext4만으로 설치해서 더 가벼운걸까 싶기도 하고.

systemd은 익숙해질수로 편안해지기는 했었는데, 그럼에도 확실히 전통적인 linux/unix의 그것과는 조금 달라서 처음에 당혹스럽긴 했었었다.

darkmode.js으로 변경


직접 짠 css/js에서 darkmode.js으로 변경했다. css에서 보색관계를 고려하는 것도 좀 귀찮고 해서.

변경도 예쁘게 애니메이션 나오고, system preference 지정도 자동으로 되고.

(미래의 나를 위해) css/html에서 class

1
2
3
.darkmode--activated .logo {
  mix-blend-mode: difference;
}
1
<span class="darkmode-ignore">😬<span>

xrandr 🖥️모니터 연결 자동전환 스크립트🐫


요즘 메인으로 사용하는 💻랩탑을 i3wm으로 세팅해서 쓰고 있다. 다 편한데, 🪟윈도나 icewm처럼 Windows+P 누르면, 다음 모니터연결 조합으로 전환되는게 부러웠다.

매번 터미널 열고 xrandr 치거나, arandr 열어서 세팅하기 귀찮으니까. (물론 시스템 시작하면, 내가 좋아하는 설정이 적용되도록 해놓았지만)

그래서 그냥 윈도의 Win+P 키처럼 동작하도록 스크립트를 짜봤다.

🐫 https://github.com/ageldama/configs/blob/master/dotfiles/local_scripts/xrandr/combs.pl

Perl으로 왠만하면 외부라이브러리 의존 않고 짜려고 노력.

그리고 예전이랑 코딩스타일이 점점 변해가고 있다고 생각이 들었는데, 예전에는 기계공감에 더 비중을 뒀었다면, 이제는 내가 쓸때 더 편하고 별 생각없이 되는쪽에 더 비중을 두게 되는거 같다. 좋게 말하자면… 🤤

Hugo + pagefind 붙여서 검색기능 추가했다


https://pagefind.app/

페이지 생성시에 인덱싱하고 그걸로 웹브라우저내에서 js으로 검색하는 pagefind을 붙여봤다.

처음엔 좀 어색했는데, 커스터마이징을 별로 제공하지 않기는 했지만, 그래도 이것저것 뜯어서 CSS도 마음에 들게 좀 수정하고, JS/DOM 이벤트도 적당히 잡아서 마음에 들게 동작하게 고쳤다.

별로라고 생각하던 부분들도 다 뜯어 고치고 하면서 더 블로그가 마음에 들어진다. 🤠