From 0ac73870fd1ad9247ef34ff38b53eef04a09aa6a Mon Sep 17 00:00:00 2001 From: Himadri Bhattacharjee <107522312+lavafroth@users.noreply.github.com> Date: Mon, 6 Apr 2026 08:47:45 +0530 Subject: [PATCH] feat: whisper for transcription --- hosts/default/home/default.nix | 20 +++++++++++ hosts/default/home/sources/kglobalshortcutsrc | 36 ++++++++++++++----- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/hosts/default/home/default.nix b/hosts/default/home/default.nix index 7a7af9b..02d51da 100644 --- a/hosts/default/home/default.nix +++ b/hosts/default/home/default.nix @@ -72,10 +72,30 @@ kiwix-tools harper tesseract + whisper-cpp signal-desktop + (pkgs.writeShellScriptBin "lecture" '' mpv --speed=1.5 --start=00:00:14 --cache-pause-wait=14 --script-opts='skipsilence-enabled=yes,skipsilence-threshold_db=-18' --vf=sub,negate "$1" '') + (pkgs.writeShellScriptBin "transcribe" '' + MODEL=$1 + WAVFILE="/tmp/whisper.wav" + + if test ! -f "$WAVFILE"; then + ${pkgs.notify-desktop}/bin/notify-desktop "Recording audio" "Re-trigger the shortcut to transcribe" + nohup pw-record $WAVFILE & + disown -a + exit + fi + + ${pkgs.busybox}/bin/fuser -k -INT "$WAVFILE" + ${pkgs.notify-desktop}/bin/notify-desktop "Starting transcription" "using model $MODEL" + ${pkgs.whisper-cpp}/bin/whisper-cli -m "$MODEL" -f "$WAVFILE" --output-txt + cat /tmp/whisper.wav.txt | wl-copy + rm "$WAVFILE" + ${pkgs.notify-desktop}/bin/notify-desktop "Transcription finished" "You may paste from the clipboard" + '') ]; }; diff --git a/hosts/default/home/sources/kglobalshortcutsrc b/hosts/default/home/sources/kglobalshortcutsrc index 12dabca..e1d671c 100644 --- a/hosts/default/home/sources/kglobalshortcutsrc +++ b/hosts/default/home/sources/kglobalshortcutsrc @@ -39,13 +39,14 @@ Cycle Overview=none,none,Cycle through Overview and Grid View Cycle Overview Opposite=none,none,Cycle through Grid View and Overview Decrease Opacity=none,,Decrease Opacity of Active Window by 5% Edit Tiles=Meta+T,Meta+T,Toggle Tiles Editor -Expose=Ctrl+F9,Ctrl+F9,Toggle Present Windows (Current desktop) -ExposeAll=Ctrl+F10\tLaunch (C),Ctrl+F10\tLaunch (C),Toggle Present Windows (All desktops) -ExposeClass=Ctrl+F7,Ctrl+F7,Toggle Present Windows (Window class) +Expose=Ctrl+F9,Meta+F9\tCtrl+F9,Toggle Present Windows (Current desktop) +ExposeAll=Ctrl+F10\tLaunch (C),Meta+F10\tLaunch (C)\tCtrl+F10,Toggle Present Windows (All desktops) +ExposeClass=Ctrl+F7,Meta+F7\tCtrl+F7,Toggle Present Windows (Window class) ExposeClassCurrentDesktop=none,none,Toggle Present Windows (Window class on current desktop) Grid View=none,Meta+G,Toggle Grid View Increase Opacity=none,,Increase Opacity of Active Window by 5% Kill Window=Meta+Ctrl+Esc,Meta+Ctrl+Esc,Kill Window +Move Tablet to Next LogicalOutput=none,none,Move the tablet to the next output Move Tablet to Next Output=none,none,Move the tablet to the next output MoveMouseToCenter=Meta+F6,Meta+F6,Move Mouse to Center MoveMouseToFocus=Meta+F5,Meta+F5,Move Mouse to Focus @@ -64,7 +65,7 @@ Switch Window Down=Meta+Alt+Down,Meta+Alt+Down,Switch to Window Below Switch Window Left=Meta+Alt+Left,Meta+Alt+Left,Switch to Window to the Left Switch Window Right=Meta+Alt+Right,Meta+Alt+Right,Switch to Window to the Right Switch Window Up=Meta+Alt+Up,Meta+Alt+Up,Switch to Window Above -Switch to Desktop 1=Ctrl+F1,Ctrl+F1,Switch to Desktop 1 +Switch to Desktop 1=Ctrl+F1,Meta+F1\tCtrl+F1,Switch to Desktop 1 Switch to Desktop 10=none,,Switch to Desktop 10 Switch to Desktop 11=none,,Switch to Desktop 11 Switch to Desktop 12=none,,Switch to Desktop 12 @@ -75,10 +76,15 @@ Switch to Desktop 16=none,,Switch to Desktop 16 Switch to Desktop 17=none,,Switch to Desktop 17 Switch to Desktop 18=none,,Switch to Desktop 18 Switch to Desktop 19=none,,Switch to Desktop 19 -Switch to Desktop 2=Ctrl+F2,Ctrl+F2,Switch to Desktop 2 +Switch to Desktop 2=Ctrl+F2,Meta+F2\tCtrl+F2,Switch to Desktop 2 Switch to Desktop 20=none,,Switch to Desktop 20 -Switch to Desktop 3=Ctrl+F3,Ctrl+F3,Switch to Desktop 3 -Switch to Desktop 4=Ctrl+F4,Ctrl+F4,Switch to Desktop 4 +Switch to Desktop 21=,,Switch to Desktop 21 +Switch to Desktop 22=,,Switch to Desktop 22 +Switch to Desktop 23=,,Switch to Desktop 23 +Switch to Desktop 24=,,Switch to Desktop 24 +Switch to Desktop 25=,,Switch to Desktop 25 +Switch to Desktop 3=Ctrl+F3,Meta+F3\tCtrl+F3,Switch to Desktop 3 +Switch to Desktop 4=Ctrl+F4,Meta+F4\tCtrl+F4,Switch to Desktop 4 Switch to Desktop 5=none,,Switch to Desktop 5 Switch to Desktop 6=none,,Switch to Desktop 6 Switch to Desktop 7=none,,Switch to Desktop 7 @@ -106,7 +112,7 @@ Walk Through Windows=Meta+Tab\tAlt+Tab,Meta+Tab\tAlt+Tab,Walk Through Windows Walk Through Windows (Reverse)=Meta+Shift+Tab\tAlt+Shift+Tab,Meta+Shift+Tab\tAlt+Shift+Tab,Walk Through Windows (Reverse) Walk Through Windows Alternative=none,none,Walk Through Windows Alternative Walk Through Windows Alternative (Reverse)=none,none,Walk Through Windows Alternative (Reverse) -Walk Through Windows of Current Application=Meta+`\tAlt+`,Meta+`\tAlt+`,Walk Through Windows of Current Application +Walk Through Windows of Current Application=Alt+`,Meta+`\tAlt+`,Walk Through Windows of Current Application Walk Through Windows of Current Application (Reverse)=Meta+~\tAlt+~,Meta+~\tAlt+~,Walk Through Windows of Current Application (Reverse) Walk Through Windows of Current Application Alternative=none,none,Walk Through Windows of Current Application Alternative Walk Through Windows of Current Application Alternative (Reverse)=none,none,Walk Through Windows of Current Application Alternative (Reverse) @@ -168,6 +174,11 @@ Window to Desktop 18=none,,Window to Desktop 18 Window to Desktop 19=none,,Window to Desktop 19 Window to Desktop 2=none,,Window to Desktop 2 Window to Desktop 20=none,,Window to Desktop 20 +Window to Desktop 21=,,Window to Desktop 21 +Window to Desktop 22=,,Window to Desktop 22 +Window to Desktop 23=,,Window to Desktop 23 +Window to Desktop 24=,,Window to Desktop 24 +Window to Desktop 25=,,Window to Desktop 25 Window to Desktop 3=none,,Window to Desktop 3 Window to Desktop 4=none,,Window to Desktop 4 Window to Desktop 5=none,,Window to Desktop 5 @@ -302,6 +313,10 @@ pausemedia=Media Pause,Media Pause,Pause media playback playmedia=none,,Play media playback playpausemedia=Media Play,Media Play,Play/Pause media playback previousmedia=Media Previous,Media Previous,Media playback previous +seekbackwardmedia=Media Rewind,Media Rewind,Media playback seek backward 5s +seekbackwardmedialong=,,Media playback seek backward 30s +seekforwardmedia=Media Fast Forward,Media Fast Forward,Media playback seek forward 5s +seekforwardmedialong=,,Media playback seek forward 30s stopmedia=Media Stop,Media Stop,Stop media playback [org_kde_powerdevil] @@ -367,6 +382,9 @@ _launch=Meta+M [services][net.local.spectacle.desktop] _launch=Meta+Shift+H +[services][net.local.transcribe.desktop] +_launch=Meta+` + [services][org.kde.dolphin.desktop] _launch=Meta+3 @@ -377,6 +395,8 @@ _launch=none _launch=Alt+Space [services][org.kde.spectacle.desktop] +CurrentMonitorScreenShot= +OpenWithoutScreenshot= RecordRegion=none _launch=Print