Sway : Add screen recording.
This commit is contained in:
parent
ff83c5a6a8
commit
5b709e1947
|
@ -1,9 +1,16 @@
|
||||||
{ ... }: {
|
{ config, ... }: let
|
||||||
|
color = config.style.color;
|
||||||
|
opacity = "26";
|
||||||
|
selection = "slurp -d -b ${color.bg.light}${opacity} -c ${color.fg.light} -w 0 -s 00000000";
|
||||||
|
in {
|
||||||
text = ''
|
text = ''
|
||||||
# Fullscreen screenshot.
|
# Fullscreen screenshot.
|
||||||
bindsym --to-code $mod+shift+v exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png
|
# bindsym --to-code $mod+shift+v exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png
|
||||||
|
|
||||||
# Select screenshot.
|
# Select screenshot.
|
||||||
bindsym --to-code $mod+v exec grim -g "$(slurp -d)" - | wl-copy
|
bindsym --to-code $mod+v exec grim -g "$(${selection})" - | wl-copy
|
||||||
|
|
||||||
|
# Select recording.
|
||||||
|
bindsym --to-code $mod+shift+v exec 'pkill -SIGINT wf-recorder || wf-recorder --geometry "$(${selection})" --codec libsvtav1 --file $HOME/media/video/"$(date +%Y-%m-%d_%H-%M-%S)".mkv --framerate 10'
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,19 @@
|
||||||
rm -d out/
|
rm -d out/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Rotate the video clock-wise.
|
||||||
|
# Usage: ffmpeg_rotate <ANGLE> <TARGET>
|
||||||
|
function ffmpeg_rotate() {
|
||||||
|
if [[ "''${2}" = "" ]]; then
|
||||||
|
help ffmpeg_rotate
|
||||||
|
fi
|
||||||
|
|
||||||
|
local angle="''${1}"
|
||||||
|
local target="''${2}"
|
||||||
|
|
||||||
|
ffmpeg -display_rotation ''${angle} -i ''${target} -c copy _''${target} && mv _''${target} ''${target} || rm _''${target}
|
||||||
|
}
|
||||||
|
|
||||||
# Get video FPS.
|
# Get video FPS.
|
||||||
function _ffprobe_fps() {
|
function _ffprobe_fps() {
|
||||||
local fps=$(ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate "''${1}")
|
local fps=$(ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate "''${1}")
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
desktop = with pkgs; [
|
desktop = with pkgs; [
|
||||||
foot # Terminal emulator.
|
foot # Terminal emulator.
|
||||||
fuzzel # Application launcher.
|
fuzzel # Application launcher.
|
||||||
grim slurp # Screenshot.
|
grim slurp wf-recorder # Screenshot.
|
||||||
mako # Notification system.
|
mako # Notification system.
|
||||||
networkmanagerapplet # Internet configuration.
|
networkmanagerapplet # Internet configuration.
|
||||||
pamixer pavucontrol pulseaudio # Audio.
|
pamixer pavucontrol pulseaudio # Audio.
|
||||||
|
|
|
@ -34,13 +34,14 @@
|
||||||
function monbar() {
|
function monbar() {
|
||||||
local __monstate=$(_monstate)
|
local __monstate=$(_monstate)
|
||||||
local __gamingstate=$(_gamingstate)
|
local __gamingstate=$(_gamingstate)
|
||||||
|
local __recording=$(_recording)
|
||||||
local class=""
|
local class=""
|
||||||
|
|
||||||
if [[ "''${__monstate}" = "off" ]] || [[ "''${__gamingstate}" = "on" ]]; then
|
if [[ "''${__monstate}" = "off" ]] || [[ "''${__gamingstate}" = "on" ]] || [[ "''${__recording}" = "on" ]]; then
|
||||||
class="modified"
|
class="modified"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "{\"text\": \"\", \"tooltip\": \"Monitor: ''${__monstate^} / Gaming: ''${__gamingstate^}\", \"class\": \"''${class}\"}\n"
|
printf "{\"text\": \"\", \"tooltip\": \"Monitor: ''${__monstate^} / Gaming: ''${__gamingstate^} / Recording: ''${__recording^}\", \"class\": \"''${class}\"}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _monstate() {
|
function _monstate() {
|
||||||
|
@ -50,5 +51,9 @@
|
||||||
echo "''${*}" > /tmp/.monstate
|
echo "''${*}" > /tmp/.monstate
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _recording() {
|
||||||
|
[[ "$(ps cax | rg wf-recorder)" = "" ]] && echo off || echo on
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue