From 1f92ed5c0208945a85a2362a1d0799f83fc6ecc4 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Mon, 11 May 2020 20:49:40 +0200 Subject: [PATCH] sway bindsym spotify --- roles/sway/templates/by_host/osz/config.j2 | 2 +- roles/sway/templates/config.j2 | 13 +++++-------- roles/waybar/files/waybar/config | 5 ++--- roles/waybar/files/waybar/modules/spotify.sh | 16 +++------------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/roles/sway/templates/by_host/osz/config.j2 b/roles/sway/templates/by_host/osz/config.j2 index 26f3a3b..294130a 100644 --- a/roles/sway/templates/by_host/osz/config.j2 +++ b/roles/sway/templates/by_host/osz/config.j2 @@ -46,5 +46,5 @@ bindsym XF86MonBrightnessDown exec light -U 10 && \ # exec startup apps exec --no-startup-id swaymsg 'exec variety &' exec --no-startup-id swaymsg 'workspace $tag4; exec kitty -e "screen tiny"' -exec --no-startup-id swaymsg 'workspace $tag2; exec kitty -e "ssh-add" && alacritty' +exec --no-startup-id swaymsg 'workspace $tag2; exec kitty -e "ssh-add" && kitty' #INCLUDE#################################################### diff --git a/roles/sway/templates/config.j2 b/roles/sway/templates/config.j2 index 4aab23d..b742585 100644 --- a/roles/sway/templates/config.j2 +++ b/roles/sway/templates/config.j2 @@ -118,7 +118,7 @@ bindsym $mod+Shift+p exec grimshot save area bindsym $mod+p exec grimshot save output # variety -bindsym $mod+Control+w exec variety --next +bindsym $mod+less exec variety --next # apps bindsym $mod+Control+t exec thunar @@ -126,9 +126,9 @@ bindsym $mod+Control+n exec connman-gtk bindsym $mod+Control+p exec pavucontrol # bindsym spotify -bindsym $mod+less exec playerctl previous -bindsym $mod+Shift+less exec playerctl next -bindsym $mod+space exec playerctl play-pause +bindsym $mod+Control+left exec playerctl previous +bindsym $mod+Control+down exec playerctl next +bindsym $mod+Control+right exec playerctl play-pause # switch to workspace bindsym $mod+ampersand workspace $tag1 @@ -147,7 +147,7 @@ bindsym $mod+Shift+ampersand move container to workspace $tag1 bindsym $mod+Shift+eacute move container to workspace $tag2 bindsym $mod+Shift+quotedbl move container to workspace $tag3 bindsym $mod+Shift+apostrophe move container to workspace $tag4 -bindsym $mod+Shift+5 move container to workspace $tag5 +bindsym $mod+Shift+parenleft move container to workspace $tag5 bindsym $mod+Shift+minus move container to workspace $tag6 bindsym $mod+Shift+egrave move container to workspace $tag7 bindsym $mod+Shift+underscore move container to workspace $tag8 @@ -155,9 +155,6 @@ bindsym $mod+Shift+ccedilla move container to workspace $tag9 bindsym $mod+Shift+agrave move container to workspace $tag10 # floatings -for_window [class="XTerm"] floating enable, border normal -for_window [class="feh"] floating enable, border normal -for_window [class="Gpick"] floating enable, border pixel 1 for_window [title="Images de Variety"] floating enable, border pixel 1, move left 647px # assign and focus xwayland diff --git a/roles/waybar/files/waybar/config b/roles/waybar/files/waybar/config index 2bcc68b..7aae00d 100644 --- a/roles/waybar/files/waybar/config +++ b/roles/waybar/files/waybar/config @@ -75,11 +75,10 @@ "modules-center": ["network#speed"], "modules-right": ["temperature", "custom/storage", "cpu", "memory" ], "custom/spotify": { + "format": " {}", "interval": 1, - "return-type": "json", "exec": "~/.config/waybar/modules/spotify.sh", - "exec-if": "pgrep spotify", - "escape": true + "exec-if": "pgrep spotify" }, "network#speed": { "format-wifi": " {bandwidthDownOctets} {bandwidthUpOctets}", diff --git a/roles/waybar/files/waybar/modules/spotify.sh b/roles/waybar/files/waybar/modules/spotify.sh index c00622b..7f1d481 100755 --- a/roles/waybar/files/waybar/modules/spotify.sh +++ b/roles/waybar/files/waybar/modules/spotify.sh @@ -1,18 +1,8 @@ #!/bin/sh -class=$(playerctl metadata --player=spotify --format '{{lc(status)}}') -icon="" - -if [[ $class == "playing" ]]; then - info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}') - if [[ ${#info} > 40 ]]; then +info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}') +if [[ ${#info} > 40 ]]; then info=$(echo $info | cut -c1-40)"..." - fi - text=$info" "$icon -elif [[ $class == "paused" ]]; then - text=$icon -elif [[ $class == "stopped" ]]; then - text="" fi -echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}" +echo "$info"