Compare commits

...

2 Commits

Author SHA1 Message Date
66079e3a59 feat: add rofi-based power menu and power mode menu scripts with custom styles;
feat: enhance screen recorder with merge functionality and duration tracking;
refactor: update swaync configuration with new power menu buttons and toggle actions;
fix: remove desktop cache option since it screwed up my app history;
refactor: update swaync styling with new button variables and border styles;
2025-11-13 19:28:49 +03:00
02d51bdb88 fix: reverted accidental changes to the rofi launcher 2025-11-13 09:11:32 +03:00
11 changed files with 591 additions and 238 deletions

View File

@@ -18,6 +18,7 @@ $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 $recorder = $HOME/.config/rofi/scripts/dmenu_recorder.sh
$powermenu = $HOME/.config/rofi/scripts/dmenu_powermenu.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"
@@ -569,8 +570,7 @@ bindr = $mainMod CTRL, bracketleft, pass, class:^(com.obsproject.Studio)$
bindr = $mainMod CTRL, bracketright, pass, class:^(com.obsproject.Studio)$ bindr = $mainMod CTRL, bracketright, pass, class:^(com.obsproject.Studio)$
bindr = $mainMod CTRL, apostrophe, pass, class:^(com.obsproject.Studio)$ bindr = $mainMod CTRL, apostrophe, pass, class:^(com.obsproject.Studio)$
bind = , XF86PowerOff, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 35% & ristretto -f ~/Templates/Images/theorist.jpg & play ~/Templates/Sounds/scream.mp3 bind = , XF86PowerOff, exec, $powermenu
bind = $mainMod SHIFT, p, exec, .config/hypr/scripts/random_wallpaper.sh random bind = $mainMod SHIFT, p, exec, .config/hypr/scripts/random_wallpaper.sh random
# Disable binds temporarily # Disable binds temporarily

View File

@@ -16,5 +16,4 @@ 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,8 +158,7 @@ element {
spacing: 15px; spacing: 15px;
padding: 8px; padding: 8px;
border-radius: 10px; border-radius: 10px;
background-color: @background-button; background-color: transparent;
border-color: @button-shape-top;
text-color: @foreground; text-color: @foreground;
cursor: pointer; cursor: pointer;
} }

24
rofi/scripts/dmenu_powermenu.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
mode=$(echo -e "󰤄\n⏻\n" | rofi \
-modes drun,run,calc \
-dmenu -p "Power menu" \
-theme "$HOME/.config/rofi/styles/style-powermenu.rasi" \
-markup-rows \
-drun-use-desktop-cache \
)
case "$mode" in
"󰤄")
systemctl suspend
;;
"⏻")
systemctl poweroff
;;
"")
systemctl reboot
;;
*)
exit 0
;;
esac

View File

@@ -0,0 +1,24 @@
#!/bin/sh
mode=$(echo -e "\n󰾅\n󰓅" | rofi \
-modes drun,run,calc \
-dmenu -p "Power menu" \
-theme "$HOME/.config/rofi/styles/style-powermodemenu.rasi" \
-markup-rows \
-drun-use-desktop-cache \
)
case "$mode" in
"")
powerprofilesctl set power-saver
;;
"󰾅")
powerprofilesctl set balanced
;;
"󰓅")
powerprofilesctl set performance
;;
*)
exit 0
;;
esac

View File

@@ -1,9 +1,96 @@
#!/bin/sh #!/bin/sh
mic_device="alsa_input.pci-0000_00_1f.3.analog-stereo"
system_device="alsa_output.pci-0000_00_1f.3.analog-stereo.monitor"
save_path="$HOME/Videos/rofi-recorder"
datetime=$(date +"%d.%m.%Y %H:%M:%S")
lockfile="/tmp/.rofi-recorder"
if [[ -z $lockfile ]]; then
notify-send --hint int:transient:1 -t 1000 "Recorder" "Lockfile is present!"
exit 1
fi
check_total_time() {
target_prefix=$1
mkdir -p $save_path
( cd $save_path &&
for f in $target_prefix*.mkv; do
ffmpeg -i "$f" 2>&1 | grep "Duration" | awk '{print $2}' | tr -d ,;
done | awk -F: '{ total += $1 * 3600 + $2 * 60 + $3 } END { print int(total/3600)":"int((total%3600)/60)":"int(total%60) }'
)
}
merge_videos() {
target_prefix=$1
result_prefix=$2
touch $lockfile
mkdir -p $save_path
local files=("$save_path"/$target_prefix*.mkv)
if [[ ${#files[@]} -eq 0 ]] || [[ ! -f "${files[0]}" ]]; then
notify-send "Error" "No MKV files found in $save_path"
rm $lockfile
return 1
fi
# Create output filename with timestamp
local output_file="$save_path/$result_prefix-$datetime.mkv"
local file_list="$save_path/$target_prefix_list.txt"
# Create file list in creation order (oldest first)
find "$save_path" -maxdepth 1 -name "*$target_prefix*.mkv" -not -name "$result_prefix*.mkv" -type f -printf "%T@ %p\n" | \
sort -n | \
cut -d' ' -f2- > "$file_list"
# Convert file paths to ffmpeg concat format
sed -i 's/^/file /' "$file_list"
# Escape single quotes and wrap paths in single quotes for ffmpeg
sed -i "s|file \(.*\)|file '\1'|" "$file_list"
# Show ongoing notification
notify-send -u low -i video-x-generic "Merging Videos" "Merging $(wc -l < "$file_list") video files..." &
local notify_pid=$!
# Merge videos using ffmpeg concat demuxer
if ffmpeg -f concat -safe 0 -i "$file_list" -c copy "$output_file" -y 2>/dev/null; then
# Kill the ongoing notification
kill $notify_pid 2>/dev/null
# Clean up temporary file
rm -f "$file_list"
# Remove lockfile
rm $lockfile
action=$(notify-send -A "Nice" -A "Delete clips" "Merge Complete" \
"Videos merged successfully into $(basename "$output_file")")
if [[ "$action" == "1" ]]; then
# Delete all original MKV files except the merged one
find "$save_path" -maxdepth 1 -name "$target_prefix*.mkv" -not -name "$result_prefix*.mkv" -type f -exec gio trash {} +
notify-send --hint int:transient:1 -t 1000 "Recorder" "Stopping"
fi
else
# Kill the ongoing notification
kill $notify_pid 2>/dev/null
# Clean up on failure
rm -f "$file_list"
rm -f "$output_file"
notify-send -u critical "Merge Failed" "Failed to merge video files"
return 1
fi
}
# Check if wf-recorder is already running # Check if wf-recorder is already running
if pgrep -x "wf-recorder" > /dev/null; then if pgrep -x "wf-recorder" > /dev/null; then
current_file=$(ps -o args= -C wf-recorder | head -n1 | grep -oE '[^ ]+\.mp4' | tail -n1) current_file=$(ps -o args= -C wf-recorder | head -n1 | grep -oE '[^ ]+\.mp4' | tail -n1)
notify-send --hint int:transient:1 -t 1000 "Recorder" "Stopping"
pkill -2 wf-recorder pkill -2 wf-recorder
sleep 1 sleep 1
# Force kill if still running # Force kill if still running
@@ -11,11 +98,13 @@ if pgrep -x "wf-recorder" > /dev/null; then
exit 0 exit 0
fi fi
datetime=$(date +"%d.%m.%Y %H:%M:%S") clips_total_duration=$(check_total_time clip)
merges_total_duration=$(check_total_time merged)
mode=$(echo -e "動画のみ\nマイク\nシステムの音\n全面的" | rofi \ # The modes are video only, +mic, +system audio, full.
mode=$(echo -e "Video only\nMicrophone\nMerge clips" | rofi \
-modes drun,run,calc \ -modes drun,run,calc \
-dmenu -p "ビデオ録画モードを選択 " \ -dmenu -p "Clips duration: $clips_total_duration / Merges duration: $merges_total_duration" \
-theme "$HOME/.config/rofi/styles/style-recorder.rasi" \ -theme "$HOME/.config/rofi/styles/style-recorder.rasi" \
-markup-rows \ -markup-rows \
-drun-use-desktop-cache \ -drun-use-desktop-cache \
@@ -26,5 +115,38 @@ if [[ -z "$mode" ]]; then
exit 1 exit 1
fi fi
wf-recorder -c libx264rgb -r 30 -a --audio-backend=pipewire -f "$HOME/Videos/$datetime.mkv" case "$mode" in
notify-send --hint int:transient:1 -t 1000 "Recorder" "Video saved as $datetime.mkv" "Video only")
# Video only - no audio
wf-recorder -c libx264rgb -r 30 -f "$save_path/clip_$datetime.mkv" &
;;
"Microphone")
# With mic only
wf-recorder -c libx264rgb -r 30 -a "$mic_device" --audio-backend=pulse -f "$save_path/clip_$datetime.mkv" &
;;
"Merge clips")
merge_videos clip merged
;;
*)
notify-send --hint int:transient:1 -t 1000 "Recorder" "Invalid mode selected"
exit 1
;;
esac
recorder_pid=$!
sleep 1
if ps -p $recorder_pid > /dev/null; then
else
notify-send --hint int:transient:1 -t 3000 "Recorder" "Failed to start recording"
exit 1
fi
# Wait for the recording process to finish
wait $recorder_pid
if [ $? -eq 0 ]; then
notify-send --hint int:transient:1 -t 3000 "Recorder" "Video saved $save_path/clip_$datetime.mkv"
else
notify-send --hint int:transient:1 -t 3000 "Recorder" "Recording failed or was interrupted"
fi

View File

@@ -0,0 +1,100 @@
* {
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 32";
}
window {
anchor: center;
location: center;
width: 1000px;
height: 250px;
padding: 6px;
children: [ mainbox ];
border: 1px;
border-radius: 15px;
border-color: @border;
background-color: @background;
}
mainbox {
orientation: vertical;
spacing: 10px;
children: [ listview ];
background-color: transparent;
}
listview {
enabled: true;
columns: 1;
lines: 3;
cycle: true;
dynamic: true;
scrollbar: false;
layout: horizontal;
reverse: false;
fixed-height: true;
fixed-columns: true;
height: 100px;
spacing: 10px;
background-color: transparent;
text-color: @foreground;
cursor: "default";
font: "JetBrains Mono Nerd Font 10";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 15px;
width: calc(100% / 3 - 12);
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;
padding: 80;
}
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;
}

View File

@@ -0,0 +1,101 @@
* {
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 32";
}
window {
anchor: center;
location: center;
width: 1000px;
height: 250px;
padding: 6px;
children: [ mainbox ];
border: 1px;
border-radius: 15px;
border-color: @border;
background-color: @background;
}
mainbox {
orientation: vertical;
spacing: 10px;
children: [ listview ];
background-color: transparent;
}
listview {
enabled: true;
columns: 1;
lines: 3;
cycle: true;
dynamic: true;
scrollbar: false;
layout: horizontal;
reverse: false;
fixed-height: true;
fixed-columns: true;
height: 100px;
spacing: 10px;
background-color: transparent;
text-color: @foreground;
cursor: "default";
font: "JetBrains Mono Nerd Font 10";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 15px;
width: calc(100% / 3 - 12);
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;
padding: 80;
}
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;
}

View File

@@ -48,13 +48,14 @@ imagebox {
border-radius: 100px; border-radius: 100px;
margin: 5px; margin: 5px;
background-color: @active; background-color: @active;
border-color: @selected-shine;
border: 1px 0 0 0;
} }
contentbox { contentbox {
orientation: horizontal; orientation: horizontal;
expand: true; expand: true;
children: [prompt, entry]; children: [prompt];
} }
mode-switcher{ mode-switcher{
@@ -67,7 +68,7 @@ mode-switcher{
listview { listview {
enabled: true; enabled: true;
columns: 1; columns: 1;
lines: 4; lines: 3;
cycle: true; cycle: true;
dynamic: true; dynamic: true;
scrollbar: false; scrollbar: false;
@@ -87,7 +88,7 @@ listview {
element { element {
enabled: true; enabled: true;
spacing: 15px; spacing: 15px;
width: 22.5%; width: 31%;
padding: 8px; padding: 8px;
border-radius: 10px; border-radius: 10px;
text-color: @foreground; text-color: @foreground;

View File

@@ -182,43 +182,21 @@
] ]
}, },
"menubar": { "menubar": {
"menu#power-buttons": { "buttons#powermenu": {
"label": "",
"position": "left", "position": "left",
"actions": [ "actions": [
{ {
"label": " Reboot", "label": "",
"command": "systemctl reboot" "command": "sh -c 'swaync-client -cp & ~/.config/rofi/scripts/dmenu_powermenu.sh'"
},
{
"label": " Lock",
"command": "swaylock.sh"
},
{
"label": " Logout",
"command": "loginctl terminate-session ${XDG_SESSION_ID-}"
},
{
"label": " Shut down",
"command": "systemctl poweroff"
} }
] ]
}, },
"menu#powermode-buttons": { "buttons#powermodemenu": {
"label": "󰓅",
"position": "right", "position": "right",
"actions": [ "actions": [
{ {
"label": "Razgonnnn", "label": "󰓅",
"command": "sh -c 'notify-send --hint int:transient:1 Power-Profile Performance && powerprofilesctl set performance'" "command": "sh -c 'swaync-client -cp & ~/.config/rofi/scripts/dmenu_powermodemenu.sh'"
},
{
"label": "Balanced",
"command": "sh -c 'notify-send --hint int:transient:1 Power-Profile Balanced && powerprofilesctl set balanced'"
},
{
"label": "Survival",
"command": "sh -c 'notify-send --hint int:transient:1 Power-Profile Power-saver && powerprofilesctl set power-saver'"
} }
] ]
} }

View File

@@ -16,6 +16,9 @@
--notification-icon-size: 64px; --notification-icon-size: 64px;
--notification-app-icon-size: calc(var(--notification-icon-size) / 3); --notification-app-icon-size: calc(var(--notification-icon-size) / 3);
--notification-group-icon-size: 32px; --notification-group-icon-size: 32px;
--button: #303030;
--button-top: #505050;
--button-on-top: #CE5268dd;
--button-off: #2e2d31; --button-off: #2e2d31;
} }
@@ -26,7 +29,7 @@
button { button {
background-color: var(--button-off); background-color: var(--button-off);
border: 1px solid #303030; border-top: 1px solid var(--button-top);
} }
button:hover { button:hover {
@@ -475,6 +478,7 @@ button:hover {
.widget-buttons-grid flowboxchild > button.toggle:checked { .widget-buttons-grid flowboxchild > button.toggle:checked {
/* style given to the active toggle button */ /* style given to the active toggle button */
background-color: var(--noti-bg-selection); background-color: var(--noti-bg-selection);
border-top: 1px solid var(--button-on-top);
} }
.widget-buttons-grid flowboxchild > button.toggle:hover { .widget-buttons-grid flowboxchild > button.toggle:hover {
@@ -520,6 +524,7 @@ button:hover {
border-radius: 12px; border-radius: 12px;
margin: 0 4px; margin: 0 4px;
background-color: var(--noti-bg-selection); background-color: var(--noti-bg-selection);
border-top: 1px solid var(--button-on-top);
} }
.widget-menubar > .menu-button-bar > .widget-menubar-container button:hover { .widget-menubar > .menu-button-bar > .widget-menubar-container button:hover {