diff --git a/local-bin/.local/bin/record.sh b/local-bin/.local/bin/record.sh
new file mode 100755
index 0000000..e1731de
--- /dev/null
+++ b/local-bin/.local/bin/record.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+
+[[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs
+OUTPUT_DIR="${OMARCHY_SCREENRECORD_DIR:-${XDG_VIDEOS_DIR:-$HOME/Videos}}"
+
+if [[ ! -d "$OUTPUT_DIR" ]]; then
+ notify-send "Screen recording directory does not exist: $OUTPUT_DIR" -u critical -t 3000
+ exit 1
+fi
+
+# Selects region or output
+SCOPE="$1"
+
+# Selects audio inclusion or not
+AUDIO=$([[ $2 == "audio" ]] && echo "--audio")
+
+start_screenrecording() {
+ local filename="$OUTPUT_DIR/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
+
+ if lspci | grep -qi 'nvidia'; then
+ wf-recorder $AUDIO -f "$filename" -c libx264 -p crf=23 -p preset=medium -p movflags=+faststart "$@" &
+ else
+ wl-screenrec $AUDIO -f "$filename" --ffmpeg-encoder-options="-c:v libx264 -crf 23 -preset medium -movflags +faststart" "$@" &
+ fi
+
+ toggle_screenrecording_indicator
+}
+
+stop_screenrecording() {
+ pkill -x wl-screenrec
+ pkill -x wf-recorder
+
+ notify-send "Screen recording saved to $OUTPUT_DIR" -t 2000
+
+ sleep 0.2 # ensures the process is actually dead before we check
+ toggle_screenrecording_indicator
+}
+
+toggle_screenrecording_indicator() {
+ pkill -RTMIN+8 waybar
+}
+
+screenrecording_active() {
+ pgrep -x wl-screenrec >/dev/null || pgrep -x wf-recorder >/dev/null
+}
+
+if screenrecording_active; then
+ stop_screenrecording
+elif [[ "$SCOPE" == "output" ]]; then
+ output=$(slurp -o) || exit 1
+ start_screenrecording -g "$output"
+else
+ region=$(slurp) || exit 1
+ start_screenrecording -g "$region"
+fi
diff --git a/local-bin/.local/bin/waybar.sh b/local-bin/.local/bin/waybar.sh
index 9c5ff0f..ee787fa 100755
--- a/local-bin/.local/bin/waybar.sh
+++ b/local-bin/.local/bin/waybar.sh
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
-CONFIG_FILES="$HOME/.config/waybar/config.jsonc $HOME/.config/waybar/style.css"
+CONFIG_FILES="$HOME/.config/waybar/config.jsonc $HOME/.config/waybar/common.jsonc $HOME/.config/waybar/style.css"
-trap "killall waybar" EXIT
+trap "killall .waybar-wrapped" EXIT
while true; do
waybar &
inotifywait -e create,modify $CONFIG_FILES
- killall waybar
+ killall .waybar-wrapped
done
diff --git a/sway/.config/sway/config.d/appearance b/sway/.config/sway/config.d/appearance
index f204e58..a30473e 100644
--- a/sway/.config/sway/config.d/appearance
+++ b/sway/.config/sway/config.d/appearance
@@ -15,13 +15,13 @@ gaps outer 5
seat seat0 xcursor_theme Bibata-Original-Classic 24
# SwayFX Settings
-# smart_corner_radius on
-# corner_radius 10
-#
-# default_dim_inactive 0.05
-# blur enable
-# blur_passes 1
-# blur_radius 1
-# layer_effects "waybar" "blur enable"; shadows enable
-# shadows on
-# shadow_blur_radius 20
+smart_corner_radius on
+corner_radius 10
+
+default_dim_inactive 0.05
+blur enable
+blur_passes 1
+blur_radius 1
+layer_effects "waybar" "blur enable"; shadows enable
+shadows on
+shadow_blur_radius 20
diff --git a/sway/.config/sway/config.d/keybindings b/sway/.config/sway/config.d/keybindings
index 7f5a782..7b7a3ff 100644
--- a/sway/.config/sway/config.d/keybindings
+++ b/sway/.config/sway/config.d/keybindings
@@ -98,7 +98,7 @@ bindsym {
# Special Functions
bindsym {
F4 exec switch-windows
- $mod+r exec --no-startup-id ~/.local/bin/wlrecord.sh
+ $mod+r exec --no-startup-id ~/.local/bin/record.sh
$mod+p exec --no-startup-id grim -g "$(slurp -d)" - | swappy -f -
$mod+shift+p exec --no-startup-id ~/.local/bin/screenshot-upload
$mod+F5 exec --no-startup-id ~/.local/bin/pause-notifications
diff --git a/waybar/.config/waybar/common.jsonc b/waybar/.config/waybar/common.jsonc
index 4f6cbdb..54325c1 100644
--- a/waybar/.config/waybar/common.jsonc
+++ b/waybar/.config/waybar/common.jsonc
@@ -4,8 +4,9 @@
"mod": "dock",
"exclusive": true,
"passthrough": false,
+ "border-radius": 10,
"gtk-layer-shell": true,
- "height": 5,
+ "height": 36,
"margin": "5 10 0 10",
// Workspace and Window Management
"sway/workspaces": {
@@ -52,10 +53,9 @@
},
// Date and Time
"clock": {
- // DD-MM-YYYY
- "format": " {0:%H:%M:%S %Z} {0:%d/%m/%Y}",
+ "format": "{:%H:%M %Z}",
"interval": 60,
- "format-alt": "{:L%A, %B %d, %Y (%R)} ",
+ "format-alt": "{:%d/%m/%Y}",
"tooltip-format": "{calendar}",
"timezones": [
"America/Montevideo",
@@ -214,12 +214,11 @@
"Paused": " "
}
},
- // Notifications and Utilities
- "custom/wf-recorder": {
- "format": "",
- "tooltip": false,
- "on-click": "wf-recorder -f ~/Videos/$(date +%Y%m%d_%H%M%S).mp4",
- "on-click-right": "pkill -f wf-recorder"
+ "custom/screenrecording-indicator": {
+ "on-click": "~/.local/bin/record.sh",
+ "exec": "~/.config/waybar/indicators/screen-recording.sh",
+ "signal": 8,
+ "return-type": "json"
},
"custom/notification": {
"tooltip": false,
diff --git a/waybar/.config/waybar/config.jsonc b/waybar/.config/waybar/config.jsonc
index b9e1ae8..6e0f96a 100644
--- a/waybar/.config/waybar/config.jsonc
+++ b/waybar/.config/waybar/config.jsonc
@@ -27,6 +27,7 @@
"custom/playerlabel"
],
"modules-right": [
+ "custom/screenrecording-indicator",
"custom/randwall",
"clock",
"group/tray-expander"
@@ -47,6 +48,7 @@
"custom/playerlabel"
],
"modules-right": [
+ "custom/screenrecording-indicator",
"custom/randwall",
"pulseaudio",
"backlight",
@@ -57,4 +59,4 @@
"eDP-1"
]
}
-]
\ No newline at end of file
+]
diff --git a/waybar/.config/waybar/indicators/screen-recording.sh b/waybar/.config/waybar/indicators/screen-recording.sh
new file mode 100755
index 0000000..359820a
--- /dev/null
+++ b/waybar/.config/waybar/indicators/screen-recording.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+if pgrep -x wl-screenrec >/dev/null || pgrep -x wf-recorder >/dev/null; then
+ echo '{"text": "", "tooltip": "Stop recording", "class": "active"}'
+else
+ echo '{"text": "", "tooltip": "Start recording", "class": "inactive"}'
+fi
diff --git a/waybar/.config/waybar/style.css b/waybar/.config/waybar/style.css
index 4d51731..75fc833 100644
--- a/waybar/.config/waybar/style.css
+++ b/waybar/.config/waybar/style.css
@@ -1,3 +1,6 @@
+@define-color foreground #e0def4;
+@define-color background #191724;
+
* {
border: none;
border-radius: 0;
@@ -6,89 +9,60 @@
min-height: 0;
}
-/* Window Styles */
window#waybar {
- background: rgba(0, 0, 0, 0.8);
- border-bottom: 1px solid #282828;
+ background: rgba(25, 23, 36, 0.8);
+ border-bottom: 1px solid #26233a;
border-radius: 10px;
- color: #f4d9e1;
+ color: @foreground;
}
tooltip {
- background: #010409;
+ background: @background;
border-radius: 10px;
}
-/* Workspace Styles */
-
#workspaces button {
- color: #fff;
+ color: @foreground;
border-radius: 10px;
padding: 5px;
margin: 4px 4px;
}
#workspaces button.urgent {
- background: #010409;
- color: #FF7F7F;
+ background: @background;
+ color: #eb6f92;
}
#workspaces button:hover,
#workspaces button.focused {
- background: #f4d9e1;
- color: #282828;
+ background: #c4a7e7;
+ color: @background;
}
-/* Common Module Styles */
#cpu,
#memory,
-#window,
-#clock,
+#network,
+#bluetooth,
+#pulseaudio,
#battery,
-#pulseaudio,
-#network,
-#bluetooth,
-#temperature,
-#workspaces,
-#tray,
-#custom-vpn,
-#custom-notification,
-#backlight {
- padding: 0px 5;
-}
-
-#cpu {
- padding-right: 0;
-}
-
-/* Individual Module Styles */
-#window {
- margin: 0 60px;
-}
-
-#cpu,
-#memory,
#clock,
-#network,
-#bluetooth,
-#pulseaudio,
-#pulseaudio.microphone,
-#battery {
- color: #fff;
+#custom-playerctl,
+#custom-playerlabel,
+#custom-screenrecording-indicator,
+#custom-randwall {
+ color: @foreground;
+ padding: 0px 8px;
}
#temperature.critical {
- color: #eba0ac;
+ color: #eb6f92;
}
-/* Custom Module Styles */
#custom-playerctl,
#custom-playerlabel {
- background: #282828;
+ background: #26233a;
border-radius: 16px;
- font-style: normal;
- font-weight: normal;
- margin: 5px 0;
+ margin: 5px 8px;
}
#custom-playerctl {
@@ -101,68 +75,36 @@ tooltip {
padding: 0 15px 0 10px;
}
-#custom-notification {
- border-radius: 0;
- font-weight: bold;
-}
-
-#custom-randwall {
- margin-right: 10px;
-}
-
-#custom-vpn.connected {
- color: #a6e3a1;
-}
-
-#custom-vpn.disconnected {
- color: #f4d9e1;
-}
-
-#custom-wf-recorder {
- padding: 0 10px;
- margin: 0 4px;
+#custom-screenrecording-indicator {
border-radius: 4px;
transition: all 0.3s ease;
}
-#custom-wf-recorder.idle {
- background-color: #2c2c2c;
- color: #ccc;
+#custom-screenrecording-indicator.idle {
+ background-color: @background;
+ color: @foreground;
}
-#custom-wf-recorder.recording {
- background-color: #cc3436;
- color: white;
+#custom-screenrecording-indicator.active {
+ color: #cc3436;
animation: blink 1s infinite;
}
@keyframes blink {
- 0% {
- opacity: 1;
- }
-
- 50% {
- opacity: 0.7;
- }
-
- 100% {
- opacity: 1;
- }
+ 0% { opacity: 1; }
+ 50% { opacity: 0.7; }
+ 100% { opacity: 1; }
}
-#custom-microphone {
- padding: 0 10px;
- margin: 0 5px;
+#custom-notification {
+ margin-right: 12px;
}
-#custom-microphone.headset {
- color: #a6e3a1;
+#custom-randwall {
+ color: #f6c177;
}
-#custom-microphone.internal {
- color: #f9e2af;
+#custom-expand-icon {
+ color: #9ccfd8;
}
-#custom-microphone.unknown {
- color: #f38ba8;
-}