Skip to content

Commit 175e75e

Browse files
committed
feat(sway): add Emacs IME integration and window rules
- Introduced `emacs-ime.sh` script for launching Emacs as an IME with temporary file handling and clipboard integration. - Added keybinding `$mod+Shift+e` to launch the Emacs IME in Sway. - Created `window-rules.conf` for managing workspace assignments and floating window rules for specific applications. - Updated Sway configuration to include the new script and rules. - Enhanced Kitty configuration with a transparent background setting for Emacs IME sessions. - Commented out unused `sops` autoloads in Emacs configuration. - Removed `fontconfig.enable` from NixOS font configuration.
1 parent 70461be commit 175e75e

File tree

7 files changed

+80
-6
lines changed

7 files changed

+80
-6
lines changed

home-manager/programs/emacs/elisp/init.org

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3436,10 +3436,10 @@ https://github.com/blahgeek/emacs-lsp-booster?tab=readme-ov-file#configure-lsp-m
34363436
#+end_src
34373437
*** sops
34383438
#+begin_src emacs-lisp
3439-
(autoload-if-found '(sops-save-file
3440-
sops-cancel
3441-
sops-edit-file
3442-
global-sops-mode) "sops" nil t)
3439+
;; (autoload-if-found '(sops-save-file
3440+
;; sops-cancel
3441+
;; sops-edit-file
3442+
;; global-sops-mode) "sops" nil t)
34433443

34443444
;; (add-hook 'emacs-startup-hook #'global-sops-mode)
34453445
#+end_src

home-manager/programs/kitty/default.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,14 @@
6464
inactive_border_color = "#6272a4";
6565
};
6666
};
67+
68+
home.file.".config/kitty/emacsclient_transparent.conf" = {
69+
text = ''
70+
# メインのKitty設定を読み込む(キーバインドなど共通設定が必要な場合)
71+
include ~/.config/kitty/kitty.conf
72+
73+
# 背景の透過度を設定 (0.0: 完全透明, 1.0: 完全不透明)
74+
background_opacity 0.8
75+
'';
76+
};
6777
}

home-manager/programs/sway/config.d/bindkey.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
bindsym $mod+Shift+c reload
2323

2424
# Exit sway (logs you out of your Wayland session)
25-
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
25+
bindsym $mod+Shift+x exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
26+
27+
# Launch Emacs as an IME
28+
bindsym $mod+Shift+e exec ~/.config/sway/emacs-ime.sh
2629

2730
# Reload the configuration file
2831
bindsym $mod+Shift+p exec grim screenshot.png
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Google Chrome
2+
for_window [app_id="com.google.Chrome"] move to workspace 1, floating enable
3+
4+
# Terminals
5+
# com.apple.Terminal is macOS specific, so it's commented out.
6+
# for_window [app_id="com.apple.Terminal"] move to workspace 2
7+
for_window [app_id="com.raphaelamorim.rio"] move to workspace 2
8+
for_window [app_id="net.kovidgoyal.kitty"] move to workspace 2
9+
# Add rule for kitty with standard app_id
10+
for_window [app_id="kitty"] move to workspace 2
11+
12+
# Emacs
13+
for_window [app_id="org.gnu.Emacs"] move to workspace 3
14+
for_window [title="^Temporary Editor$"] floating enable
15+
16+
# Dev tools
17+
for_window [app_id="com.jgraph.drawio.desktop"] move to workspace 4
18+
for_window [app_id="io.flutterflow.prod.mac"] move to workspace 4
19+
for_window [app_id="com.sequel-ace.sequel-ace"] move to workspace 4
20+
21+
# VSCode
22+
for_window [app_id="com.microsoft.VSCode"] move to workspace 5
23+
24+
# Streaming
25+
for_window [app_id="com.obsproject.obs-studio"] move to workspace 7
26+
for_window [app_id="com.github.tattn.VCam"] move to workspace 7
27+
28+
# Communication
29+
for_window [app_id="com.hnc.Discord"] move to workspace 8
30+
for_window [app_id="com.anthropic.claudefordesktop"] move to workspace 9
31+
for_window [app_id="com.openai.chat"] move to workspace 9
32+
for_window [app_id="com.tinyspeck.slackmacgap"] move to workspace 10

home-manager/programs/sway/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
source = ./ime.sh;
77
executable = true;
88
};
9+
".config/sway/emacs-ime.sh" = {
10+
source = ./emacs-ime.sh;
11+
executable = true;
12+
};
913
".config/sway/config.d/" = {
1014
source = ./config.d;
1115
recursive = true;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
TEMP_FILE=$(mktemp)
4+
5+
# Kittyを起動し、専用の設定ファイルを適用し、タイトルを設定
6+
# -c は --config の短縮形
7+
kitty -c ~/.config/kitty/emacsclient_transparent.conf --title "Temporary Editor" sh -c "
8+
emacsclient -c --eval \
9+
\"(progn
10+
(setq initial-buffer-choice nil)
11+
(let ((file \"$TEMP_FILE\"))
12+
(find-file file)
13+
(add-hook 'after-save-hook
14+
(lambda ()
15+
(when (eq (buffer-file-name) file)
16+
(with-current-buffer (current-buffer)
17+
(shell-command-on-region (point-min) (point-max) \"wl-copy\"))))
18+
nil 'local)
19+
(add-hook 'kill-buffer-hook
20+
(lambda ()
21+
(when (eq (buffer-file-name) file)
22+
(delete-file file)
23+
(message \"Temporary file deleted: %s\" file)
24+
(delete-frame))))
25+
))
26+
\""

nixos/config/fonts.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
fonts = {
44
fontDir.enable = true;
5-
fontconfig.enable = true;
65
packages = with pkgs; [
76
noto-fonts
87
noto-fonts-lgc-plus

0 commit comments

Comments
 (0)