From d779b76be01d705a7d8d58c49a2035a4a140a848 Mon Sep 17 00:00:00 2001 From: Florian Schmitt Date: Mon, 13 Jan 2025 20:11:38 +0300 Subject: [PATCH] feat(niri): ricing never ends --- dotfiles/kitty/kitty.conf | 2 +- dotfiles/niri/config.kdl | 16 ++++++----- dotfiles/waybar/config.jsonc | 52 ++++++++++++++++++++++++++++++++---- dotfiles/waybar/style.css | 10 +++++++ modules/desktop.nix | 3 +++ scripts/cliphist.sh | 21 +++++++++++++++ scripts/restart-waybar.sh | 6 +++++ scripts/swww.sh | 13 ++++----- 8 files changed, 105 insertions(+), 18 deletions(-) create mode 100755 scripts/cliphist.sh create mode 100755 scripts/restart-waybar.sh diff --git a/dotfiles/kitty/kitty.conf b/dotfiles/kitty/kitty.conf index 10648ea..68ee0d5 100644 --- a/dotfiles/kitty/kitty.conf +++ b/dotfiles/kitty/kitty.conf @@ -87,7 +87,7 @@ window_padding_width 8 font_size 14.0 background_opacity 1 paste_actions filter -hide_window_decorations yes +#hide_window_decorations yes #background_opacity 0.98 #background_image ~/Nextcloud/Images/Wallpapers/kitty-bg.png #background_image_layout cscaled diff --git a/dotfiles/niri/config.kdl b/dotfiles/niri/config.kdl index 66185fb..25e7cea 100644 --- a/dotfiles/niri/config.kdl +++ b/dotfiles/niri/config.kdl @@ -42,7 +42,7 @@ input { // Focus windows and outputs automatically when moving the mouse into them. // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. - // focus-follows-mouse max-scroll-amount="0%" + focus-follows-mouse max-scroll-amount="0%" } environment { @@ -207,7 +207,9 @@ spawn-at-startup "xwayland-satellite" spawn-at-startup "xrandr --output eDP-1 --primary" spawn-at-startup "waybar" spawn-at-startup "swww-daemon" -spawn-at-startup "~/Code/nixos-config/scripts/swww.sh ~/Nextcloud/Images/Wallpapers" +spawn-at-startup "wl-paste --type text --watch cliphist store # Stores only text data" +spawn-at-startup "wl-paste --type image --watch cliphist store # Stores only image data" +spawn-at-startup "~/Code/nixos-config/scripts/swww.sh ~/Code/wallpaper" spawn-at-startup "firefox" spawn-at-startup "kitty" @@ -389,8 +391,8 @@ binds { // To avoid scrolling through workspaces really fast, you can use // the cooldown-ms property. The bind will be rate-limited to this value. // You can set a cooldown on any bind, but it's most useful for the wheel. - Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } - Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } + Mod+Shift+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+Shift+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } @@ -401,8 +403,8 @@ binds { // Usually scrolling up and down with Shift in applications results in // horizontal scrolling; these binds replicate that. - Mod+Shift+WheelScrollDown { focus-column-right; } - Mod+Shift+WheelScrollUp { focus-column-left; } + Mod+WheelScrollDown { focus-column-right; } + Mod+WheelScrollUp { focus-column-left; } Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } @@ -464,6 +466,8 @@ binds { Mod+Shift+F { fullscreen-window; } Mod+C { center-column; } + Mod+Ctrl+B { spawn "~/Code/nixos-config/scripts/swww.sh ~/Code/wallpaper"; } + Mod+Ctrl+W { spawn "~/Code/nixos-config/scripts/restart-waybar.sh"; } // Finer width adjustments. // This command can also: // * set width in pixels: "1000" diff --git a/dotfiles/waybar/config.jsonc b/dotfiles/waybar/config.jsonc index be23f1b..1329dca 100644 --- a/dotfiles/waybar/config.jsonc +++ b/dotfiles/waybar/config.jsonc @@ -8,7 +8,10 @@ "margin-left": 3, "position": "top", "modules-left": [ - "niri/workspaces" + "custom/appmenu", + "wlr/taskbar", + "niri/workspaces", + "custom/wallpaper" ], "modules-center": [ "niri/window" @@ -19,8 +22,10 @@ "memory", "battery", "pulseaudio", + "custom/cliphist", "tray", - "clock" + "clock", + "custom/exit" ], "disable-scroll": true, "tray": { @@ -85,8 +90,45 @@ "icon": true, "icon-size": 16, "rewrite": { - //"(.*) Mozilla Firefox": "🌎 $1", - //"(.*) - zsh": "> [$1]" + // Truncate any format over 64 characters. + "^(.{64}).+$": "$1…" } - } + }, + "custom/wallpaper": { + "format": "", + "on-click": "bash ~/Code/nixos-config/scripts/swww.sh ~/Code/wallpaper &", + //"on-click-right": "~/.config/hypr/scripts/wallpaper-effects.sh", + "tooltip-format": "Changer de fond d'écran" + }, + // Rofi Application Launcher + "custom/appmenu": { + "format": "Apps", + "on-click": "rofi -show drun -replace", + //"on-click-right": "~/.config/hypr/scripts/keybindings.sh", + "tooltip": false + }, + // Power Menu + "custom/exit": { + "format": "", + "on-click": "wlogout", + "on-click-right": "swaylock", + "tooltip": false + }, + "wlr/taskbar": { + "format": "{icon}", + "icon-size": 16, + "tooltip-format": "{title}", + "on-click": "activate", + "on-click-right": "close", + "ignore-list": [], + "app_ids-mapping": {}, + "rewrite": {} + }, + "custom/cliphist": { + "format": "", + "on-click": "sleep 0.1 && ~/Code/nixos-config/scripts/cliphist.sh", + "on-click-right": "sleep 0.1 && ~/Code/nixos-config/scripts/cliphist.sh d", + "on-click-middle": "sleep 0.1 && ~/Code/nixos-config/scripts/cliphist.sh w", + "tooltip": false + }, } diff --git a/dotfiles/waybar/style.css b/dotfiles/waybar/style.css index 4f5aa22..63c4aba 100644 --- a/dotfiles/waybar/style.css +++ b/dotfiles/waybar/style.css @@ -32,10 +32,17 @@ window#waybar { margin: 0; padding: 0; } +.modules-left { + margin-left: 9px; +} +.modules-right { + margin-right: 9px; +} tooltip { background: @base; color: @text; } +#custom-wallpaper, #clock, #bluetooth, #network, @@ -44,6 +51,7 @@ tooltip { #memory, #temperature, #tray, +#taskbar, #pulseaudio, #window, #workspaces { @@ -54,6 +62,7 @@ tooltip { padding: 2px 8px; margin: 3px; } +#custom-wallpaper:hover, #clock:hover, #bluetooth:hover, #network:hover, @@ -62,6 +71,7 @@ tooltip { #memory:hover, #temperature:hover, #pulseaudio:hover, +#taskbar:hover, #tray:hover, #window:hover, #workspaces:hover { diff --git a/modules/desktop.nix b/modules/desktop.nix index b9b58e3..98b35a9 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -162,6 +162,9 @@ themechanger pavucontrol xwayland-satellite + cliphist + rofi + wlogout ]; # Do not restart the display manager automatically diff --git a/scripts/cliphist.sh b/scripts/cliphist.sh new file mode 100755 index 0000000..52a3366 --- /dev/null +++ b/scripts/cliphist.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# ____ _ _ _ _ _ +# / ___| (_)_ __ | |__ (_)___| |_ +# | | | | | '_ \| '_ \| / __| __| +# | |___| | | |_) | | | | \__ \ |_ +# \____|_|_| .__/|_| |_|_|___/\__| +# |_| +# + +case $1 in + d) cliphist list | rofi -dmenu -replace | cliphist delete + ;; + + w) if [ `echo -e "Clear\nCancel" | rofi -dmenu` == "Clear" ] ; then + cliphist wipe + fi + ;; + + *) cliphist list | rofi -dmenu -replace | cliphist decode | wl-copy + ;; +esac diff --git a/scripts/restart-waybar.sh b/scripts/restart-waybar.sh new file mode 100755 index 0000000..cc5045d --- /dev/null +++ b/scripts/restart-waybar.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +killall waybar +pkill waybar +sleep 0.5 +waybar diff --git a/scripts/swww.sh b/scripts/swww.sh index b728bee..81e2fbd 100755 --- a/scripts/swww.sh +++ b/scripts/swww.sh @@ -18,17 +18,18 @@ export SWWW_TRANSITION_DURATION=1 export SWWW_TRANSITION_STEP=2 # This controls (in seconds) when to switch to the next image -INTERVAL=300 +#INTERVAL=30 -while true; do - find "$1" -type f \ +#while true; do + find "$1" -type f \( -iname \*.jpg -o -iname \*.jpeg -o -iname \*.png -o -iname \*.webp \) \ | while read -r img; do echo "$((RANDOM % 1000)):$img" done \ | sort -n | cut -d':' -f2- \ | while read -r img; do swww img "$img" - sleep $INTERVAL + #sleep $INTERVAL + break done -done -one +#done +