From 66079e3a59e9ebb8150d839b08430a2eae31f42a Mon Sep 17 00:00:00 2001 From: Nikolai Papin Date: Thu, 13 Nov 2025 19:28:49 +0300 Subject: [PATCH] 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; --- hypr/hyprland.conf | 4 +- rofi/launchers/type-1/launcher.sh | 3 +- rofi/scripts/dmenu_powermenu.sh | 24 ++ rofi/scripts/dmenu_powermodemenu.sh | 24 ++ rofi/scripts/dmenu_recorder.sh | 134 ++++++++- rofi/styles/style-powermenu.rasi | 100 +++++++ rofi/styles/style-powermodemenu.rasi | 101 +++++++ rofi/styles/style-recorder.rasi | 9 +- swaync/config.json | 420 +++++++++++++-------------- swaync/style.css | 7 +- 10 files changed, 590 insertions(+), 236 deletions(-) create mode 100755 rofi/scripts/dmenu_powermenu.sh create mode 100755 rofi/scripts/dmenu_powermodemenu.sh create mode 100644 rofi/styles/style-powermenu.rasi create mode 100644 rofi/styles/style-powermodemenu.rasi diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 90ff018..e51031c 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -18,6 +18,7 @@ $fastTerminal = kitty --single-instance $fileManager = thunar $menu = $HOME/.config/rofi/launchers/type-1/launcher.sh & swaync-client -cp $recorder = $HOME/.config/rofi/scripts/dmenu_recorder.sh +$powermenu = $HOME/.config/rofi/scripts/dmenu_powermenu.sh $browser = env GTK_THEME=Adwaita:light zen-browser $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" @@ -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, 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 # Disable binds temporarily diff --git a/rofi/launchers/type-1/launcher.sh b/rofi/launchers/type-1/launcher.sh index 886cdc3..f193aa4 100755 --- a/rofi/launchers/type-1/launcher.sh +++ b/rofi/launchers/type-1/launcher.sh @@ -16,5 +16,4 @@ ln -s $image /tmp/rofi-img.png rofi \ -modes drun,run,calc \ -show drun \ - -theme /tmp/rofi-theme.rasi \ - -drun-use-desktop-cache + -theme /tmp/rofi-theme.rasi diff --git a/rofi/scripts/dmenu_powermenu.sh b/rofi/scripts/dmenu_powermenu.sh new file mode 100755 index 0000000..c830e1c --- /dev/null +++ b/rofi/scripts/dmenu_powermenu.sh @@ -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 diff --git a/rofi/scripts/dmenu_powermodemenu.sh b/rofi/scripts/dmenu_powermodemenu.sh new file mode 100755 index 0000000..a168472 --- /dev/null +++ b/rofi/scripts/dmenu_powermodemenu.sh @@ -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 diff --git a/rofi/scripts/dmenu_recorder.sh b/rofi/scripts/dmenu_recorder.sh index 1011dcf..7e286b5 100755 --- a/rofi/scripts/dmenu_recorder.sh +++ b/rofi/scripts/dmenu_recorder.sh @@ -1,9 +1,96 @@ #!/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 if pgrep -x "wf-recorder" > /dev/null; then 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 sleep 1 # Force kill if still running @@ -11,13 +98,15 @@ if pgrep -x "wf-recorder" > /dev/null; then exit 0 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 \ - -dmenu -p "ビデオ録画モードを選択 " \ + -dmenu -p "Clips duration: $clips_total_duration / Merges duration: $merges_total_duration" \ -theme "$HOME/.config/rofi/styles/style-recorder.rasi" \ - -markup-rows \ + -markup-rows \ -drun-use-desktop-cache \ ) @@ -26,5 +115,38 @@ if [[ -z "$mode" ]]; then 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" +case "$mode" in + "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 diff --git a/rofi/styles/style-powermenu.rasi b/rofi/styles/style-powermenu.rasi new file mode 100644 index 0000000..01fe44b --- /dev/null +++ b/rofi/styles/style-powermenu.rasi @@ -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; +} diff --git a/rofi/styles/style-powermodemenu.rasi b/rofi/styles/style-powermodemenu.rasi new file mode 100644 index 0000000..7028e7e --- /dev/null +++ b/rofi/styles/style-powermodemenu.rasi @@ -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; +} diff --git a/rofi/styles/style-recorder.rasi b/rofi/styles/style-recorder.rasi index dc547a8..cd20490 100644 --- a/rofi/styles/style-recorder.rasi +++ b/rofi/styles/style-recorder.rasi @@ -48,13 +48,14 @@ imagebox { border-radius: 100px; margin: 5px; background-color: @active; - + border-color: @selected-shine; + border: 1px 0 0 0; } contentbox { orientation: horizontal; expand: true; - children: [prompt, entry]; + children: [prompt]; } mode-switcher{ @@ -67,7 +68,7 @@ mode-switcher{ listview { enabled: true; columns: 1; - lines: 4; + lines: 3; cycle: true; dynamic: true; scrollbar: false; @@ -87,7 +88,7 @@ listview { element { enabled: true; spacing: 15px; - width: 22.5%; + width: 31%; padding: 8px; border-radius: 10px; text-color: @foreground; diff --git a/swaync/config.json b/swaync/config.json index 2578820..dc0d73a 100644 --- a/swaync/config.json +++ b/swaync/config.json @@ -1,227 +1,205 @@ { - "$schema": "/etc/xdg/swaync/configSchema.json", - "ignore-gtk-theme": true, - "positionX": "right", - "positionY": "top", - "layer": "top", - "control-center-layer": "top", - "layer-shell": true, - "layer-shell-cover-screen": false, - "cssPriority": "highest", - "control-center-margin-top": 10, - "control-center-margin-bottom": 5, - "control-center-margin-right": -10, - "control-center-margin-left": 0, - "notification-2fa-action": false, - "notification-inline-replies": false, - "notification-body-image-height": 100, - "notification-body-image-width": 200, - "timeout": 10, - "timeout-low": 5, - "timeout-critical": 0, - "fit-to-screen": true, - "relative-timestamps": true, - "control-center-width": 470, - "control-center-height": 800, - "notification-window-width": 400, - "keyboard-shortcuts": true, - "notification-grouping": false, - "image-visibility": "when-available", - "transition-time": 100, - "hide-on-clear": false, - "hide-on-action": true, - "text-empty": "No nothing", - "script-fail-notify": true, - "scripts": { - "example-script": { - "exec": "echo 'Do something...'", - "urgency": "Normal" - }, - "example-action-script": { - "exec": "echo 'Do something actionable!'", - "urgency": "Normal", - "run-on": "action" - } - }, - "notification-visibility": { - "example-name": { - "state": "muted", - "urgency": "Low", - "app-name": "Spotify" - } - }, - "widgets": [ - "menubar", - "buttons-grid", - "volume", - "slider#brightness", - "slider#cpu", - "inhibitors", - "title", - "notifications", - "dnd" - ], - "widget-config": { - "inhibitors": { - "text": "Inhibitors", - "button-text": "Purge", - "clear-all-button": true - }, - "title": { - "text": "Notifications", - "clear-all-button": true, - "button-text": "Purge" - }, - "volume": { - "label": "󰕾 ", - "show-per-app": true, - "show-per-app-icon": true, - "show-per-app-label": true - }, - "slider#brightness": { - "label": " ", - "cmd_setter": "brightnessctl s $value", - "cmd_getter": "brightnessctl g", - "min": 5000, - "min_limit": 5000, - "max": 120000, - "max_limit": 120000 - }, - "slider#cpu": { - "label": " ", - "cmd_setter": "exec ~/.config/hypr/scripts/cpufreq.sh $value", - "cmd_getter": "exec ~/.config/hypr/scripts/cpufreq.sh g", - "min": 1, - "min_limit": 1, - "max": 6, - "max_limit": 6 - }, - "dnd": { - "text": "Don't bother" - }, - "label": { - "max-lines": 1, - "text": "Kolinux 1.0" - }, - "mpris": { - "blacklist": [], - "autohide": false, - "show-album-art": "always", - "loop-carousel": false - }, - "buttons-grid": { - "buttons-per-row": 4, - "actions": [ - { - "label": "󰑫", - "type": "toggle", - "active": true, - "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && nmcli radio wifi on || nmcli radio wifi off'", - "update-command": "sh -c '[[ $(nmcli radio wifi) == \"enabled\" ]] && echo true || echo false'" + "$schema": "/etc/xdg/swaync/configSchema.json", + "ignore-gtk-theme": true, + "positionX": "right", + "positionY": "top", + "layer": "top", + "control-center-layer": "top", + "layer-shell": true, + "layer-shell-cover-screen": false, + "cssPriority": "highest", + "control-center-margin-top": 10, + "control-center-margin-bottom": 5, + "control-center-margin-right": -10, + "control-center-margin-left": 0, + "notification-2fa-action": false, + "notification-inline-replies": false, + "notification-body-image-height": 100, + "notification-body-image-width": 200, + "timeout": 10, + "timeout-low": 5, + "timeout-critical": 0, + "fit-to-screen": true, + "relative-timestamps": true, + "control-center-width": 470, + "control-center-height": 800, + "notification-window-width": 400, + "keyboard-shortcuts": true, + "notification-grouping": false, + "image-visibility": "when-available", + "transition-time": 100, + "hide-on-clear": false, + "hide-on-action": true, + "text-empty": "No nothing", + "script-fail-notify": true, + "scripts": { + "example-script": { + "exec": "echo 'Do something...'", + "urgency": "Normal" }, - { - "label": "", - "type": "toggle", - "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && bluetoothctl power on || bluetoothctl power off'", - "update-command": "sh -c \'bluetoothctl show | awk \\\"/Powered/ {print \\$2}\\\" | grep -q yes && echo true || echo false\'" - }, - { - "label": "󰦝", - "type": "toggle", - "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && mullvad connect || mullvad disconnect'", - "update-command": "sh -c '[[ $(mullvad status | grep -e Connected ) == \"Connected\" ]] && echo true || echo false'" - }, - { - "label": "", - "type": "toggle", - "command": "sh -c 'nohup ~/.config/bspwm/proxy.sh > /dev/null 2>&1 & disown'", - "update-command": "sh -c 'pgrep sslocal > /dev/null && echo true || echo false'" - }, - { - "label": "󰍰", - "type": "toggle", - "command": "sh -c 'pactl set-source-mute alsa_input.pci-0000_00_1f.3.analog-stereo toggle'", - "update-command": "sh -c '[[ $(pactl get-source-mute alsa_input.pci-0000_00_1f.3.analog-stereo) == \\\"Mute: no\\\" ]] && echo true || echo false'" - }, - { - "label": "", - "type": "toggle", - "command": "[[ $SWAYNC_TOGGLE_STATE == true ]] && ( systemd-inhibit --why='User request via swaync' --what=sleep:handle-lid-switch:idle sh -c 'echo \"$$\" > \"$XDG_RUNTIME_DIR/swaync-idle.pid\"; while true; do sleep 3600; done' ) || kill $(<\"$XDG_RUNTIME_DIR/swaync-idle.pid\")", - "update-command": "kill -0 $(<\"$XDG_RUNTIME_DIR/swaync-idle.pid\") && echo true || echo false" - }, - { - "label": "󰍺", - "type": "toggle", - "command": "sh -c 'exec ~/.config/hypr/scripts/toggle_mirror_display.sh'", - "update-command": "sh -c 'exec ~/.config/hypr/scripts/toggle_mirror_display.sh g'" - }, - { - "label": "", - "type": "toggle", - "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && (echo 1 > $HOME/.config/hypr/conditions/autofreeze_swww) || (echo 0 > $HOME/.config/hypr/conditions/autofreeze_swww)'", - "update-command": "sh -c '[ \$(cat $HOME/.config/hypr/conditions/autofreeze_swww) -eq 1 ] && echo true || echo false'" - }, - { - "label": "󰗹", - "type": "toggle", - "command": "sh -c 'exec ~/.config/hypr/scripts/toggle_privacy.sh'", - "update-command": "sh -c 'exec ~/.config/hypr/scripts/toggle_privacy.sh g'" - }, - { - "label": "󰖔", - "type": "toggle", - "command": "sh -c 'exec ~/.config/hypr/scripts/grayscale-toggle.sh'", - "update-command": "sh -c 'exec ~/.config/hypr/scripts/grayscale-toggle.sh g'" - }, - { - "label": "󱌼", - "type": "toggle", - "command": "sh -c 'exec ~/.config/hypr/scripts/toggle_distractions.sh'", - "update-command": "sh -c 'exec ~/.config/hypr/scripts/toggle_distractions.sh g'" + "example-action-script": { + "exec": "echo 'Do something actionable!'", + "urgency": "Normal", + "run-on": "action" } - ] }, - "menubar": { - "menu#power-buttons": { - "label": "", - "position": "left", - "actions": [ - { - "label": " Reboot", - "command": "systemctl reboot" - }, - { - "label": " Lock", - "command": "swaylock.sh" - }, - { - "label": " Logout", - "command": "loginctl terminate-session ${XDG_SESSION_ID-}" - }, - { - "label": " Shut down", - "command": "systemctl poweroff" - } - ] - }, - "menu#powermode-buttons": { - "label": "󰓅", - "position": "right", - "actions": [ - { - "label": "Razgonnnn", - "command": "sh -c 'notify-send --hint int:transient:1 Power-Profile Performance && powerprofilesctl set performance'" - }, - { - "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'" - } - ] - } + "notification-visibility": { + "example-name": { + "state": "muted", + "urgency": "Low", + "app-name": "Spotify" + } + }, + "widgets": [ + "menubar", + "buttons-grid", + "volume", + "slider#brightness", + "slider#cpu", + "inhibitors", + "title", + "notifications", + "dnd" + ], + "widget-config": { + "inhibitors": { + "text": "Inhibitors", + "button-text": "Purge", + "clear-all-button": true + }, + "title": { + "text": "Notifications", + "clear-all-button": true, + "button-text": "Purge" + }, + "volume": { + "label": "󰕾 ", + "show-per-app": true, + "show-per-app-icon": true, + "show-per-app-label": true + }, + "slider#brightness": { + "label": " ", + "cmd_setter": "brightnessctl s $value", + "cmd_getter": "brightnessctl g", + "min": 5000, + "min_limit": 5000, + "max": 120000, + "max_limit": 120000 + }, + "slider#cpu": { + "label": " ", + "cmd_setter": "exec ~/.config/hypr/scripts/cpufreq.sh $value", + "cmd_getter": "exec ~/.config/hypr/scripts/cpufreq.sh g", + "min": 1, + "min_limit": 1, + "max": 6, + "max_limit": 6 + }, + "dnd": { + "text": "Don't bother" + }, + "label": { + "max-lines": 1, + "text": "Kolinux 1.0" + }, + "mpris": { + "blacklist": [], + "autohide": false, + "show-album-art": "always", + "loop-carousel": false + }, + "buttons-grid": { + "buttons-per-row": 4, + "actions": [ + { + "label": "󰑫", + "type": "toggle", + "active": true, + "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && nmcli radio wifi on || nmcli radio wifi off'", + "update-command": "sh -c '[[ $(nmcli radio wifi) == \"enabled\" ]] && echo true || echo false'" + }, + { + "label": "", + "type": "toggle", + "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && bluetoothctl power on || bluetoothctl power off'", + "update-command": "sh -c \'bluetoothctl show | awk \\\"/Powered/ {print \\$2}\\\" | grep -q yes && echo true || echo false\'" + }, + { + "label": "󰦝", + "type": "toggle", + "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && mullvad connect || mullvad disconnect'", + "update-command": "sh -c '[[ $(mullvad status | grep -e Connected ) == \"Connected\" ]] && echo true || echo false'" + }, + { + "label": "", + "type": "toggle", + "command": "sh -c 'nohup ~/.config/bspwm/proxy.sh > /dev/null 2>&1 & disown'", + "update-command": "sh -c 'pgrep sslocal > /dev/null && echo true || echo false'" + }, + { + "label": "󰍰", + "type": "toggle", + "command": "sh -c 'pactl set-source-mute alsa_input.pci-0000_00_1f.3.analog-stereo toggle'", + "update-command": "sh -c '[[ $(pactl get-source-mute alsa_input.pci-0000_00_1f.3.analog-stereo) == \\\"Mute: no\\\" ]] && echo true || echo false'" + }, + { + "label": "", + "type": "toggle", + "command": "[[ $SWAYNC_TOGGLE_STATE == true ]] && ( systemd-inhibit --why='User request via swaync' --what=sleep:handle-lid-switch:idle sh -c 'echo \"$$\" > \"$XDG_RUNTIME_DIR/swaync-idle.pid\"; while true; do sleep 3600; done' ) || kill $(<\"$XDG_RUNTIME_DIR/swaync-idle.pid\")", + "update-command": "kill -0 $(<\"$XDG_RUNTIME_DIR/swaync-idle.pid\") && echo true || echo false" + }, + { + "label": "󰍺", + "type": "toggle", + "command": "sh -c 'exec ~/.config/hypr/scripts/toggle_mirror_display.sh'", + "update-command": "sh -c 'exec ~/.config/hypr/scripts/toggle_mirror_display.sh g'" + }, + { + "label": "", + "type": "toggle", + "command": "sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && (echo 1 > $HOME/.config/hypr/conditions/autofreeze_swww) || (echo 0 > $HOME/.config/hypr/conditions/autofreeze_swww)'", + "update-command": "sh -c '[ \$(cat $HOME/.config/hypr/conditions/autofreeze_swww) -eq 1 ] && echo true || echo false'" + }, + { + "label": "󰗹", + "type": "toggle", + "command": "sh -c 'exec ~/.config/hypr/scripts/toggle_privacy.sh'", + "update-command": "sh -c 'exec ~/.config/hypr/scripts/toggle_privacy.sh g'" + }, + { + "label": "󰖔", + "type": "toggle", + "command": "sh -c 'exec ~/.config/hypr/scripts/grayscale-toggle.sh'", + "update-command": "sh -c 'exec ~/.config/hypr/scripts/grayscale-toggle.sh g'" + }, + { + "label": "󱌼", + "type": "toggle", + "command": "sh -c 'exec ~/.config/hypr/scripts/toggle_distractions.sh'", + "update-command": "sh -c 'exec ~/.config/hypr/scripts/toggle_distractions.sh g'" + } + ] + }, + "menubar": { + "buttons#powermenu": { + "position": "left", + "actions": [ + { + "label": "⏻", + "command": "sh -c 'swaync-client -cp & ~/.config/rofi/scripts/dmenu_powermenu.sh'" + } + ] + }, + "buttons#powermodemenu": { + "position": "right", + "actions": [ + { + "label": "󰓅", + "command": "sh -c 'swaync-client -cp & ~/.config/rofi/scripts/dmenu_powermodemenu.sh'" + } + ] + } + } } - } } diff --git a/swaync/style.css b/swaync/style.css index c6f4109..862d7ad 100644 --- a/swaync/style.css +++ b/swaync/style.css @@ -16,6 +16,9 @@ --notification-icon-size: 64px; --notification-app-icon-size: calc(var(--notification-icon-size) / 3); --notification-group-icon-size: 32px; + --button: #303030; + --button-top: #505050; + --button-on-top: #CE5268dd; --button-off: #2e2d31; } @@ -26,7 +29,7 @@ button { background-color: var(--button-off); - border: 1px solid #303030; + border-top: 1px solid var(--button-top); } button:hover { @@ -475,6 +478,7 @@ button:hover { .widget-buttons-grid flowboxchild > button.toggle:checked { /* style given to the active toggle button */ background-color: var(--noti-bg-selection); + border-top: 1px solid var(--button-on-top); } .widget-buttons-grid flowboxchild > button.toggle:hover { @@ -520,6 +524,7 @@ button:hover { border-radius: 12px; margin: 0 4px; background-color: var(--noti-bg-selection); + border-top: 1px solid var(--button-on-top); } .widget-menubar > .menu-button-bar > .widget-menubar-container button:hover {