~tardypad/dotfiles

cebf66a1291ce3228260784405cc57dfc1bdbfa0 — Damien Tardy-Panis 14 days ago 336dd18
Integrate screencast in sway and i3blocks
M files/configs/i3blocks/config => files/configs/i3blocks/config +3 -0
@@ 31,6 31,9 @@ signal=7

[webcam]

[screencast]
signal=7

[volume]
signal=2


M files/configs/sway/config.d/bindings => files/configs/sway/config.d/bindings +3 -0
@@ 33,6 33,9 @@ bindsym $mod+Ctrl+{key/escape/Escape} exec task drop
# select region and grab screenshot
bindsym $mod+{key/g} exec screenshot

# toggle screencast
bindsym $mod+Shift+{key/g} exec screencast toggle

# toggle bar status mode
bindsym $mod+{key/tabulation/Tab} exec i3blocks-mode toggle


M files/scripts/i3blocks/Makefile => files/scripts/i3blocks/Makefile +2 -0
@@ 14,6 14,7 @@ i3blocks-scripts:
	$(setup_file)/scripts/i3blocks/i3blocks-pomodoro          > $(DESTDIR)$(BIN_DIR)/i3blocks-pomodoro
	$(setup_file)/scripts/i3blocks/i3blocks-power             > $(DESTDIR)$(BIN_DIR)/i3blocks-power
	$(setup_file)/scripts/i3blocks/i3blocks-presentation-mode > $(DESTDIR)$(BIN_DIR)/i3blocks-presentation-mode
	$(setup_file)/scripts/i3blocks/i3blocks-screencast        > $(DESTDIR)$(BIN_DIR)/i3blocks-screencast
	$(setup_file)/scripts/i3blocks/i3blocks-task              > $(DESTDIR)$(BIN_DIR)/i3blocks-task
	$(setup_file)/scripts/i3blocks/i3blocks-volume            > $(DESTDIR)$(BIN_DIR)/i3blocks-volume
	$(setup_file)/scripts/i3blocks/i3blocks-vpn               > $(DESTDIR)$(BIN_DIR)/i3blocks-vpn


@@ 30,6 31,7 @@ i3blocks-scripts:
	chmod +x $(DESTDIR)$(BIN_DIR)/i3blocks-pomodoro
	chmod +x $(DESTDIR)$(BIN_DIR)/i3blocks-power
	chmod +x $(DESTDIR)$(BIN_DIR)/i3blocks-presentation-mode
	chmod +x $(DESTDIR)$(BIN_DIR)/i3blocks-screencast
	chmod +x $(DESTDIR)$(BIN_DIR)/i3blocks-task
	chmod +x $(DESTDIR)$(BIN_DIR)/i3blocks-volume
	chmod +x $(DESTDIR)$(BIN_DIR)/i3blocks-vpn

A files/scripts/i3blocks/i3blocks-screencast => files/scripts/i3blocks/i3blocks-screencast +10 -0
@@ 0,0 1,10 @@
#!/bin/sh
# commands used:
# - screencast

[ "$( screencast status )" = 'not recording' ] && exit 0

COLOR='#{color/notice/hex}'
TEXT=''

printf '%s\n\n%s\n' "${TEXT}" "${COLOR}"

M files/scripts/shell/screencast => files/scripts/shell/screencast +8 -2
@@ 35,7 35,8 @@ record_start() {

  wf-recorder -g "${REGION}" -f "${RECORD_FILE_PATH}" &

  echo $! > "${PID_FILE_PATH}"
  echo $! > "${PID_FILE_PATH}" \
    && update_i3blocks
}

record_status() {


@@ 53,7 54,8 @@ record_stop() {
  fi

  pkill -INT -F "${PID_FILE_PATH}" \
    && rm -f "${PID_FILE_PATH}"
    && rm -f "${PID_FILE_PATH}" \
    && update_i3blocks
}

record_toggle() {


@@ 64,6 66,10 @@ record_toggle() {
  fi
}

update_i3blocks() {
  pkill -x -RTMIN+7 i3blocks
}

is_record_started() {
  [ -f "${PID_FILE_PATH}" ]
}