diff --git a/config/ghostty/.config/.alt/ghostty-niri/config b/config/ghostty/.config/.alt/ghostty-niri/config index 7eda804..6e06fdd 100644 --- a/config/ghostty/.config/.alt/ghostty-niri/config +++ b/config/ghostty/.config/.alt/ghostty-niri/config @@ -8,6 +8,9 @@ window-padding-y = 10 keybind = ctrl+shift+r=reload_config +keybind = ctrl+shift+h=write_screen_file:copy +keybind = ctrl+shift+j=text:ghostty-capture\n + command = exec fish confirm-close-surface = false diff --git a/config/niri/.config/niri/config.kdl b/config/niri/.config/niri/config.kdl index 5b25ecf..2b4daf0 100644 --- a/config/niri/.config/niri/config.kdl +++ b/config/niri/.config/niri/config.kdl @@ -162,6 +162,9 @@ spawn-at-startup "hypridle" // QuickShell spawn-at-startup "quickshell" +// According to (https://ghostty.org/docs/linux/systemd#starting-ghostty-at-login) +spawn-sh-at-startup "systemctl start --user app-com.mitchellh.ghostty.service" + /************************Envs************************/ environment { @@ -209,16 +212,16 @@ window-rule { // FLoating terminal window-rule { - match app-id="com.mitchellh.ghostty" + match app-id="kitty" open-floating true default-column-width { proportion 0.5; } } // Normal terminal -// window-rule { -// match app-id="kitty" -// default-column-width { proportion 0.3; } -// } +window-rule { + match app-id="com.mitchellh.ghostty" + default-column-width { proportion 0.3; } +} // Scrcpy window-rule { @@ -315,11 +318,11 @@ binds { Mod+E { spawn "dolphin" "--new-window"; } Mod+W { spawn-sh "zen || zen-browser"; } Mod+X { spawn "gnome-text-editor" "--new-window"; } - Mod+B { spawn-sh "pkill -x -n btop || ghostty -e btop"; } - Mod+T { spawn "kitty"; } - Mod+Return { spawn "kitty"; } - Mod+Shift+T { spawn "ghostty"; } - Mod+Shift+Return { spawn "ghostty"; } + Mod+B { spawn-sh "pkill -x -n btop || kitty -e btop"; } + Mod+T { spawn "ghostty" "+new-window"; } + Mod+Return { spawn "ghostty" "+new-window"; } + Mod+Shift+T { spawn "kitty"; } + Mod+Shift+Return { spawn "kitty"; } Mod+Shift+W { spawn "wallpaper-carousel"; } Mod+O { spawn-sh "pkill -x -n pwvucontrol || pwvucontrol"; } diff --git a/config/quickshell/.config/quickshell/Modules/Bar/Components/CpuTemp.qml b/config/quickshell/.config/quickshell/Modules/Bar/Components/CpuTemp.qml index ae075a3..cc13379 100644 --- a/config/quickshell/.config/quickshell/Modules/Bar/Components/CpuTemp.qml +++ b/config/quickshell/.config/quickshell/Modules/Bar/Components/CpuTemp.qml @@ -16,7 +16,7 @@ MonitorItem { action.signal(15); return ; } - action.exec(["ghostty", "-e", "btop"]); + action.exec(["kitty", "-e", "btop"]); } Process { diff --git a/config/quickshell/.config/quickshell/Modules/Bar/Components/CpuUsage.qml b/config/quickshell/.config/quickshell/Modules/Bar/Components/CpuUsage.qml index b14102c..a9be3fa 100644 --- a/config/quickshell/.config/quickshell/Modules/Bar/Components/CpuUsage.qml +++ b/config/quickshell/.config/quickshell/Modules/Bar/Components/CpuUsage.qml @@ -16,7 +16,7 @@ MonitorItem { action.signal(15); return ; } - action.exec(["ghostty", "-e", "btop"]); + action.exec(["kitty", "-e", "btop"]); } Process { diff --git a/config/quickshell/.config/quickshell/Modules/Bar/Components/MemUsage.qml b/config/quickshell/.config/quickshell/Modules/Bar/Components/MemUsage.qml index 568544c..e395b86 100644 --- a/config/quickshell/.config/quickshell/Modules/Bar/Components/MemUsage.qml +++ b/config/quickshell/.config/quickshell/Modules/Bar/Components/MemUsage.qml @@ -19,7 +19,7 @@ MonitorItem { action.signal(15); return ; } - action.exec(["ghostty", "-e", "btop"]); + action.exec(["kitty", "-e", "btop"]); } onRightClicked: { _showPercent = !_showPercent; diff --git a/config/quickshell/.config/quickshell/Services/LyricsService.qml b/config/quickshell/.config/quickshell/Services/LyricsService.qml index 8c98f96..5810b5c 100644 --- a/config/quickshell/.config/quickshell/Services/LyricsService.qml +++ b/config/quickshell/.config/quickshell/Services/LyricsService.qml @@ -67,7 +67,7 @@ Singleton { } function showLyricsText() { - action.command = ["sh", "-c", "ghostty -e sh -c 'spotify-lyrics fetch | less'"]; + action.command = ["sh", "-c", "ghostty -e sh -c 'spotify-lyrics fetch 2>/dev/null | less'"]; action.startDetached(); } diff --git a/config/scripts/.local/scripts/ghostty-capture b/config/scripts/.local/scripts/ghostty-capture new file mode 100755 index 0000000..45df8a9 --- /dev/null +++ b/config/scripts/.local/scripts/ghostty-capture @@ -0,0 +1,37 @@ +#!/bin/sh + +# Description: +# Use a sequence of keybinds to open the scrollback(or screen) buffer in editor (default to vim) +# without switching contexts. +# (It will be much easier if write__file:open is correctly implemented) +# +# Requirements: +# - ghostty (of course) +# - wl-clipboard +# +# Example configuration in ~/.config/ghostty/config: +# # ctrl+shift+h>j to open the screen buffer in editor +# keybind = ctrl+shift+h=write_screen_file:copy +# keybind = ctrl+shift+j=text:ghostty-capture\n +# Or without wl-paste: +# # ctrl+shift+h>j > Enter to open the screen buffer in editor +# keybind = ctrl+shift+j=text:ghostty-capture\x20 +# keybind = ctrl+shift+h=write_screen_file:paste + +file=${1:-$(wl-paste --no-newline)} + +[ -z "$file" ] && { + echo "No file provided or found in clipboard." >&2 + exit 1 +} + +[ -f "$file" ] || { + echo "File does not exist: $file" >&2 + exit 1 +} + +${EDITOR:-vim} "$file" + +rm -f "$file" + +rmdir "$(dirname "$file")" 2>/dev/null \ No newline at end of file