diff options
author | Sisiutl <sisiutl@egregore.fun> | 2024-11-14 16:08:50 +0100 |
---|---|---|
committer | Sisiutl <sisiutl@egregore.fun> | 2024-11-14 16:08:50 +0100 |
commit | 06e744e1aa742f3af4591c16b1bccca5c1bb49df (patch) | |
tree | 8fe8cb5756410eb2443e838bf183eec3ee16096d | |
parent | 4616a3f8f4689e867890ca761cc3a1c9274eb667 (diff) |
change list syntax and now it's better
-rw-r--r-- | sigils/home/services/hyprland.scm | 115 |
1 files changed, 61 insertions, 54 deletions
diff --git a/sigils/home/services/hyprland.scm b/sigils/home/services/hyprland.scm index e628b59..5c2dc89 100644 --- a/sigils/home/services/hyprland.scm +++ b/sigils/home/services/hyprland.scm @@ -34,59 +34,66 @@ (define (serialize-term term) (match term - (#t "true") - (#f "false") - ((? symbol? e) (symbol->string e)) - ((? number? e) (number->string e)) - ((? string? e) e) - (() "") - (('rgba color) (format #f "rgba(~a)" (symbol->string color))) - (('rgb color) (format #f "rgb(~a)" (symbol->string color))) + (('rgba color) (list (format #f "rgba(~a)" (symbol->string color)))) + (('rgb color) (list (format #f "rgb(~a)" (symbol->string color)))) ;; I'd say it's not the most elegant way. - (('rgba r g b a) (format #f "rgba(~a, ~a, ~a, ~a)" r g b a)) - (('rgb r g b) (format #f "rgb(~a, ~a, ~a)" r g b)) - ;; Turn a list into a series of comma-separated terms + (('rgba r g b a) (list (format #f "rgba(~a, ~a, ~a, ~a)" r g b a))) + (('rgb r g b) (list (format #f "rgb(~a, ~a, ~a)" r g b))) + ((e lst ...) - `(,(serialize-term e) - ,@(append-map - (lambda (n) - `(", " ,(serialize-term n))) lst))) - (e e))) + (append + (serialize-term e) + (append-map (lambda (n) + `(" " ,@(serialize-term n))) + lst))) + (single + `(,(match single + (#t "true") + (#f "false") + ((? symbol? e) (symbol->string e)) + ((? number? e) (number->string e)) + ((? string? e) e) + (() "") + (e e)))))) (define* (serialize-config config #:optional (nestness 0)) (match config ((term ((expressions ...) ...)) - `(,(align nestness) ,(serialize-term term) " {\n" + `(,(align nestness) ,@(serialize-term term) " {\n" ,@(append-map (lambda (e) (serialize-config e (1+ nestness))) expressions) ,(align nestness) "}\n")) - ((term (expressions ...)) - `(,(align nestness) ,(serialize-term term) - " =" - ,@(append-map (lambda (n) - `(" " ,(serialize-term n))) - expressions) + ((term r . est) + `(,(align nestness) + ,@(serialize-term term) + " = " + ,@(serialize-term r) + ,@(append-map + (lambda (t) + `(", " ,@(serialize-term t))) + est) "\n")) - ((term . rest) + ((term . rterm) `(,(align nestness) - ,(serialize-term term) + ,@(serialize-term term) " = " - ,@(serialize-term rest) + ,@(serialize-term rterm) "\n")))) + (append-map serialize-config var)) ;;; Hyprland (define %default-hyprland-config '(($terminal kitty) - ($fileManager 'dolphin) - ($menu "wofi --show drun") - ($mainMod "SUPER") + ($fileManager dolphin) + ($menu (wofi --show drun)) + ($mainMod SUPER) ;; autogenerated (autogenerated 0) ;; monitors @@ -95,8 +102,8 @@ (general ((gaps_in 5) (gaps_out 20) (border_size 2) - (col.active_border "rgba(33ccffee) rgba(00ff99ee) 45deg") ;; TODO - (col.inactive_border (rgba 595959aa)) + (col.active_border ((rgba 33ccffee) (rgba 00ff99ee) 45deg)) + (col.inactive_border (rgba 595959aa)) ;; Ugly trick (resize_on_border #f) (allow_tearing #f) (layout dwindle))) @@ -116,7 +123,7 @@ (animations ((enabled #t) (bezier myBezier 0.05 0.9 0.1 1.05) (animation windows 1 7 myBezier) - (animation windowsOut 1 7 default "popin 80%") + (animation windowsOut 1 7 default (popin 80%)) (animation border 1 10 default) (animation borderangle 1 8 default) (animation fade 1 7 default) @@ -166,34 +173,34 @@ (bind $mainMod 8 workspace 8) (bind $mainMod 9 workspace 9) (bind $mainMod 0 workspace 10) - (bind "$mainMod SHIFT" 1 movetoworkspace 1) - (bind "$mainMod SHIFT" 2 movetoworkspace 2) - (bind "$mainMod SHIFT" 3 movetoworkspace 3) - (bind "$mainMod SHIFT" 4 movetoworkspace 4) - (bind "$mainMod SHIFT" 5 movetoworkspace 5) - (bind "$mainMod SHIFT" 6 movetoworkspace 6) - (bind "$mainMod SHIFT" 7 movetoworkspace 7) - (bind "$mainMod SHIFT" 8 movetoworkspace 8) - (bind "$mainMod SHIFT" 9 movetoworkspace 9) - (bind "$mainMod SHIFT" 0 movetoworkspace 10) + (bind ($mainMod SHIFT) 1 movetoworkspace 1) + (bind ($mainMod SHIFT) 2 movetoworkspace 2) + (bind ($mainMod SHIFT) 3 movetoworkspace 3) + (bind ($mainMod SHIFT) 4 movetoworkspace 4) + (bind ($mainMod SHIFT) 5 movetoworkspace 5) + (bind ($mainMod SHIFT) 6 movetoworkspace 6) + (bind ($mainMod SHIFT) 7 movetoworkspace 7) + (bind ($mainMod SHIFT) 8 movetoworkspace 8) + (bind ($mainMod SHIFT) 9 movetoworkspace 9) + (bind ($mainMod SHIFT) 0 movetoworkspace 10) (bind $mainMod S togglespecialworkspace magic) - (bind "$mainMod SHIFT" S movetoworkspace special:magic) + (bind ($mainMod SHIFT) S movetoworkspace special:magic) (bind $mainMod mouse_down workspace e+1) (bind $mainMod mouse_up workspace e-1) (bindm $mainMod mouse:272 movewindow) (bindm $mainMod mouse:273 resizewindow) - (bindel () XF86AudioRaiseVolume exec "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+") - (bindel () XF86AudioLowerVolume exec "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-") - (bindel () XF86AudioMute exec "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle") - (bindel () XF86AudioMicMute exec "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle") - (bindel () XF86MonBrightnessUp exec "brightnessctl s 10%+") - (bindel () XF86MonBrightnessDown exec "brightnessctl s 10%-") - (bindl () XF86AudioNext exec "playerctl next") - (bindl () XF86AudioPause exec "playerctl play-pause") - (bindl () XF86AudioPlay exec "playerctl play-pause") - (bindl () XF86AudioPrev exec "playerctl previous") + (bindel () XF86AudioRaiseVolume exec (wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+)) + (bindel () XF86AudioLowerVolume exec (wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-)) + (bindel () XF86AudioMute exec (wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle)) + (bindel () XF86AudioMicMute exec (wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle)) + (bindel () XF86MonBrightnessUp exec (brightnessctl s 10%+)) + (bindel () XF86MonBrightnessDown exec (brightnessctl s 10%-)) + (bindl () XF86AudioNext exec (playerctl next)) + (bindl () XF86AudioPause exec (playerctl play-pause)) + (bindl () XF86AudioPlay exec (playerctl play-pause)) + (bindl () XF86AudioPrev exec (playerctl previous)) ;; windowrules - (windowrulev2 "suppressevent maximize" class:.*) + (windowrulev2 (suppressevent maximize) class:.*) (windowrulev2 nofocus class:^$ title:^$ xwayland:1 floating:1 fullscreen:0 pinned:0))) (define-configuration/no-serialization home-hyprland-configuration |