diff --git a/.config/setup/01-install-packages.sh b/.config/setup/01-install-packages.sh index e0e3318..dc6dae1 100755 --- a/.config/setup/01-install-packages.sh +++ b/.config/setup/01-install-packages.sh @@ -44,6 +44,7 @@ syncthing \ tmux \ udisks2 \ wev \ +wf-recorder \ wl-clipboard \ xdg-desktop-portal-wlr \ xournalpp \ diff --git a/.config/sway/config b/.config/sway/config index 554d635..aeb9ec9 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -245,6 +245,7 @@ bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% bindsym Print exec take-screenshot everything bindsym Shift+Print exec take-screenshot +bindsym Pause exec kill -s INT $(pgrep wf-recorder) # # Start a password manager in the scratchpad diff --git a/.local/bin/print-status b/.local/bin/print-status index b843e6e..63a2f94 100755 --- a/.local/bin/print-status +++ b/.local/bin/print-status @@ -1,5 +1,12 @@ #! /usr/bin/sh +recordings=$(pgrep wf-recorder | wc -l) +if [ "${recordings}" = "0" ]; then + recs="" +else + recs="đŸ“Ŋ${recordings}" +fi + touchpad=$(swaymsg -t get_inputs | jq -r '[.[] | select(.type == "touchpad")][0] | .libinput.send_events') if [ "${touchpad}" = "enabled" ]; then touchpad_active="✅" @@ -77,4 +84,4 @@ case "${battery_state}" in ;; esac -echo đŸ•šī¸${touchpad_active} 📆${today} ${clock_face}${now} ${audio_symbol}${audio_volume}% ${battery_symbol}${battery}% +echo ${recs} đŸ•šī¸${touchpad_active} 📆${today} ${clock_face}${now} ${audio_symbol}${audio_volume}% ${battery_symbol}${battery}% diff --git a/.local/bin/take-screenshot b/.local/bin/take-screenshot index 43cbcf5..ca444c1 100755 --- a/.local/bin/take-screenshot +++ b/.local/bin/take-screenshot @@ -1,18 +1,30 @@ #! /usr/bin/sh listopts() { - echo "Focused monitor" - echo "Focused monitor → 📋" - echo "Select region" - echo "Select region → 📋" - echo "Focused window" - echo "Focused window → 📋" - echo "Select window" - echo "Select window → 📋" + echo "📷 Focused monitor" + echo "📷 Focused monitor → 📋" + echo "📷 Select region" + echo "📷 Select region → 📋" + echo "📷 Focused window" + echo "📷 Focused window → 📋" + echo "📷 Select window" + echo "📷 Select window → 📋" + echo "đŸ“Ŋ Record focused monitor" + echo "đŸ“Ŋ Record select region" + echo "đŸ“Ŋ Record focused window" + echo "đŸ“Ŋ Record select window" } -gen_filename() { - echo ~/Photos/screenshots/$(date +'screenshot-%Y%m%dT%H%M%S.png') +ts() { + date +'%Y%m%dT%H%M%S' +} + +screenshot_filename() { + echo ~/Photos/screenshots/screenshot-$(ts).png +} + +recording_filename() { + echo ~/Photos/screenshots/recording-$(ts).mp4 } if [ -z "$1" ]; then @@ -35,21 +47,29 @@ select_window() { case "${option}" in "everything") - grim "$(gen_filename)";; - "Focused monitor") - grim -o "$(get_focused_monitor)" "$(gen_filename)";; - "Focused monitor → 📋") + grim "$(screenshot_filename)";; + "📷 Focused monitor") + grim -o "$(get_focused_monitor)" "$(screenshot_filename)";; + "📷 Focused monitor → 📋") grim -o "$(get_focused_monitor)" - | wl-copy;; - "Select region") - grim -g "$(slurp)" "$(gen_filename)";; - "Select region → 📋") + "📷 Select region") + grim -g "$(slurp)" "$(screenshot_filename)";; + "📷 Select region → 📋") grim -g "$(slurp)" - | wl-copy;; - "Focused window") - grim -g "$(get_focused_window)" "$(gen_filename)";; - "Focused window → 📋") + "📷 Focused window") + grim -g "$(get_focused_window)" "$(screenshot_filename)";; + "📷 Focused window → 📋") grim -g "$(get_focused_window)" - | wl-copy;; - "Select window") - grim -g "$(select_window)" "$(gen_filename)";; - "Select window → 📋") + "📷 Select window") + grim -g "$(select_window)" "$(screenshot_filename)";; + "📷 Select window → 📋") grim -g "$(select_window)" - | wl-copy;; + "đŸ“Ŋ Record focused monitor") + wf-recorder -o "$(get_focused_monitor)" -f "$(recording_filename)";; + "đŸ“Ŋ Record select region") + wf-recorder -g "$(slurp)" -f "$(recording_filename)";; + "đŸ“Ŋ Record focused window") + wf-recorder -g "$(get_focused_window)" -f "$(recording_filename)";; + "đŸ“Ŋ Record select window") + wf-recorder -g "$(select_window)" -f "$(recording_filename)";; esac