feat: add screen recorder functionality with Rofi menu integration;

feat: add OTP client to privacy window rules;
refactor: improve Rofi element styling with background and border colors;
refactor: enable desktop cache in Rofi launcher for faster startup;
chore: add new recorder script and theme files to Rofi configuration
This commit is contained in:
2025-11-13 00:47:46 +03:00
parent f5d8b1e163
commit 1b3113f379
6 changed files with 164 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ $terminal = kitty
$fastTerminal = kitty --single-instance $fastTerminal = kitty --single-instance
$fileManager = thunar $fileManager = thunar
$menu = $HOME/.config/rofi/launchers/type-1/launcher.sh & swaync-client -cp $menu = $HOME/.config/rofi/launchers/type-1/launcher.sh & swaync-client -cp
$recorder = $HOME/.config/rofi/scripts/dmenu_recorder.sh
$browser = env GTK_THEME=Adwaita:light zen-browser $browser = env GTK_THEME=Adwaita:light zen-browser
$privateBrowser = env GTK_THEME=Adwaita:light zen-browser --private-window $privateBrowser = env GTK_THEME=Adwaita:light zen-browser --private-window
$notificationCenter = pkill rofi & swaync-client -t -sw || notify-send --hint int:transient:1 "Error SwayNC is down" $notificationCenter = pkill rofi & swaync-client -t -sw || notify-send --hint int:transient:1 "Error SwayNC is down"
@@ -328,6 +329,7 @@ bind = $mainMod, Q, exec, $browser
bind = $mainMod SHIFT, Q, exec, $privateBrowser bind = $mainMod SHIFT, Q, exec, $privateBrowser
bind = $mainMod, Backslash, exec, $fastTerminal bind = $mainMod, Backslash, exec, $fastTerminal
bind = $mainMod, Space, exec, pkill rofi || $menu bind = $mainMod, Space, exec, pkill rofi || $menu
bind = $mainMod, G, exec, pkill rofi || $recorder
bind = $mainMod, N, exec, $notificationCenter bind = $mainMod, N, exec, $notificationCenter
# Open floating terminal # Open floating terminal

View File

@@ -3,6 +3,7 @@ windowrule = tag +privacy,class:^(Element)$
windowrule = tag +privacy,class:^(vesktop)$ windowrule = tag +privacy,class:^(vesktop)$
windowrule = tag +privacy,class:^(com.github.hluk.copyq)$ windowrule = tag +privacy,class:^(com.github.hluk.copyq)$
windowrule = tag +privacy,class:^(org.keepassxc.KeePassXC)$ windowrule = tag +privacy,class:^(org.keepassxc.KeePassXC)$
windowrule = tag +privacy,class:^(otpclient)$
windowrule = tag +privacy,class:^(com.nextcloud.desktopclient.nextcloud)$ windowrule = tag +privacy,class:^(com.nextcloud.desktopclient.nextcloud)$
windowrule = tag +privacy,title:^(diary)$ windowrule = tag +privacy,title:^(diary)$
windowrule = tag +privacy,class:thunar,title:.*(Downloads|Telegram Desktop).* windowrule = tag +privacy,class:thunar,title:.*(Downloads|Telegram Desktop).*

View File

@@ -16,4 +16,5 @@ ln -s $image /tmp/rofi-img.png
rofi \ rofi \
-modes drun,run,calc \ -modes drun,run,calc \
-show drun \ -show drun \
-theme /tmp/rofi-theme.rasi -theme /tmp/rofi-theme.rasi \
-drun-use-desktop-cache

View File

@@ -158,7 +158,8 @@ element {
spacing: 15px; spacing: 15px;
padding: 8px; padding: 8px;
border-radius: 10px; border-radius: 10px;
background-color: transparent; background-color: @background-button;
border-color: @button-shape-top;
text-color: @foreground; text-color: @foreground;
cursor: pointer; cursor: pointer;
} }

30
rofi/scripts/dmenu_recorder.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
# Check if wf-recorder is already running
if pgrep -x "wf-recorder" > /dev/null; then
current_file=$(ps -o args= -C wf-recorder | head -n1 | grep -oE '[^ ]+\.mp4' | tail -n1)
pkill -2 wf-recorder
sleep 1
# Force kill if still running
pkill wf-recorder 2>/dev/null
exit 0
fi
datetime=$(date +"%d.%m.%Y %H:%M:%S")
mode=$(echo -e "動画のみ\nマイク\nシステムの音\n全面的" | rofi \
-modes drun,run,calc \
-dmenu -p "ビデオ録画モードを選択 " \
-theme "$HOME/.config/rofi/styles/style-recorder.rasi" \
-markup-rows \
-drun-use-desktop-cache \
)
if [[ -z "$mode" ]]; then
notify-send --hint int:transient:1 -t 1000 "Recorder" "Aborting"
exit 1
fi
wf-recorder -c libx264rgb -r 30 -a --audio-backend=pipewire -f "$HOME/Videos/$datetime.mkv"
notify-send --hint int:transient:1 -t 1000 "Recorder" "Video saved as $datetime.mkv"

View File

@@ -0,0 +1,127 @@
* {
background: #1c1c1cc0;
background-alt: #303030ff;
button-shape-top: #505050ff;
button-shape-bottom: #303030ff;
background-button: #2e2d31ff;
background-input: #1c1c1cc0;
border: #48535Ccf;
foreground: #FFe8EE;
selected: #9E2238dd;
selected-shine: #CE5268dd;
active: #9E2238;
urgent: #D14781;
background-color: @background;
border-color: White;
text-color: @foreground;
font: "JetBrains Mono Nerd Font 10";
}
window {
anchor: north;
location: north;
y-offset: 15px;
width: 480px;
height: 100px;
padding: 6px;
children: [ mainbox ];
border: 1px;
border-radius: 15px;
border-color: @border;
}
mainbox {
orientation: vertical;
spacing: 10px;
children: [ inputbox, listview ];
}
inputbox {
orientation: horizontal;
children: [ imagebox, contentbox ];
}
imagebox {
orientation: vertical;
expand: false;
width: 38px;
vertical-align: 0.5;
border-radius: 100px;
margin: 5px;
background-color: @active;
}
contentbox {
orientation: horizontal;
expand: true;
children: [prompt, entry];
}
mode-switcher{
enabled: true;
spacing: 20px;
background-color: transparent;
text-color: @foreground;
}
listview {
enabled: true;
columns: 1;
lines: 4;
cycle: true;
dynamic: true;
scrollbar: false;
layout: horizontal;
reverse: false;
fixed-height: false;
fixed-columns: true;
spacing: 10px;
background-color: transparent;
text-color: @foreground;
cursor: "default";
font: "JetBrains Mono Nerd Font 10";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 15px;
width: 22.5%;
padding: 8px;
border-radius: 10px;
text-color: @foreground;
cursor: pointer;
background-color: @background-button;
border-color: @button-shape-top;
border: 1px 0 0 0;
}
element selected.normal {
background-color: @active;
text-color: @foreground;
border-color: @selected-shine;
border: 1px 0 0 0;
}
element-text {
vertical-align: 0.5;
horizontal-align: 0.5;
}
prompt {
vertical-align: 0.5;
}
entry {
vertical-align: 0.5;
}
element selected {
background-color: @selected;
}
element-text, element-icon {
background-color: transparent;
text-color: inherit;
}