From 046867e47bb0d94ba32dc4780019857155becf41 Mon Sep 17 00:00:00 2001 From: Hippolyte Chauvin Date: Thu, 13 Apr 2023 00:06:35 +0200 Subject: [PATCH] Configurations de Sway et de la Waybar de Sway --- config/sway/config | 28 +++++++ config/sway/config.d/10-startup.conf | 5 ++ config/sway/config.d/70-bindings.conf | 93 ++++++++++++++++++++++ config/sway/config.d/80-style.conf | 11 +++ config/sway/config.d/80-window-rules.conf | 4 + config/waybar-2/config | 84 ++++++++++++++++++++ config/waybar-2/mediaplayer.sh | 7 ++ config/waybar-2/style.css | 95 +++++++++++++++++++++++ 8 files changed, 327 insertions(+) create mode 100644 config/sway/config create mode 100644 config/sway/config.d/10-startup.conf create mode 100644 config/sway/config.d/70-bindings.conf create mode 100644 config/sway/config.d/80-style.conf create mode 100644 config/sway/config.d/80-window-rules.conf create mode 100644 config/waybar-2/config create mode 100755 config/waybar-2/mediaplayer.sh create mode 100644 config/waybar-2/style.css diff --git a/config/sway/config b/config/sway/config new file mode 100644 index 0000000..bd741c6 --- /dev/null +++ b/config/sway/config @@ -0,0 +1,28 @@ +set $mod Mod4 +set $left h +set $down j +set $up k +set $right l +set $term kitty +set $menu rofi -show drun +set $browser librewolf +set $discord webcord +set $joplin joplin-desktop + +input type:keyboard { + xkb_layout fr + xkb_numlock enabled +} + +input type:touchpad { + natural_scroll enabled + accel_profile flat + tap enabled + pointer_accel 0.7 +} + +floating_modifier $mod normal + +include /etc/sway/config.d/* +include config.d/* + diff --git a/config/sway/config.d/10-startup.conf b/config/sway/config.d/10-startup.conf new file mode 100644 index 0000000..7f2d202 --- /dev/null +++ b/config/sway/config.d/10-startup.conf @@ -0,0 +1,5 @@ +exec --no-startup-id swaybg -c '#000000' +exec --no-startup-id swaync +exec --no-startup-id swayosd +exec --no-startup-id xdg-session-start + diff --git a/config/sway/config.d/70-bindings.conf b/config/sway/config.d/70-bindings.conf new file mode 100644 index 0000000..60bbaf3 --- /dev/null +++ b/config/sway/config.d/70-bindings.conf @@ -0,0 +1,93 @@ +# Sway +bindsym $mod+Shift+q kill +bindsym $mod+Shift+r reload +bindsym $mod+Shift+e exec swaymsg exit +bindsym $mod+Mod1+l exec swaylock + +# Launchers +bindsym $mod+Return exec $term +bindsym $mod+d exec $menu +bindsym $mod+F1 exec $browser +bindsym $mod+F2 exec $joplin +bindsym $mod+F3 exec $discord + +# Windows +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right +bindsym $mod+Shift+$left move left +bindsym $mod+Shift+$down move down +bindsym $mod+Shift+$up move up +bindsym $mod+Shift+$right move right +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# Workspaces +bindsym $mod+ampersand workspace number 1 +bindsym $mod+eacute workspace number 2 +bindsym $mod+quotedbl workspace number 3 +bindsym $mod+apostrophe workspace number 4 +bindsym $mod+parenleft workspace number 5 +bindsym $mod+minus workspace number 6 +bindsym $mod+egrave workspace number 7 +bindsym $mod+underscore workspace number 8 +bindsym $mod+ccedilla workspace number 9 +bindsym $mod+agrave workspace number 10 +bindsym $mod+Shift+ampersand move container to workspace number 1 +bindsym $mod+Shift+eacute move container to workspace number 2 +bindsym $mod+Shift+quotedbl move container to workspace number 3 +bindsym $mod+Shift+apostrophe move container to workspace number 4 +bindsym $mod+Shift+parenleft move container to workspace number 5 +bindsym $mod+Shift+minus move container to workspace number 6 +bindsym $mod+Shift+egrave move container to workspace number 7 +bindsym $mod+Shift+underscore move container to workspace number 8 +bindsym $mod+Shift+ccedilla move container to workspace number 9 +bindsym $mod+Shift+agrave move container to workspace number 10 + +# Layouts +bindsym $mod+b splith +bindsym $mod+v splitv +bindsym $mod+s layout stacking +bindsym $mod+z layout tabbed +bindsym $mod+e layout toggle split +bindsym $mod+f fullscreen +bindsym $mod+Shift+space floating toggle +bindsym $mod+space focus mode_toggle +bindsym $mod+a focus parent + +# Control +bindsym XF86AudioLowerVolume exec swayosd --output-volume=lower +bindsym XF86AudioRaiseVolume exec swayosd --output-volume=raise +bindsym XF86AudioMute exec swayosd --output-volume=mute-toggle +bindsym XF86MonBrightnessUp exec swayosd --brightness=raise +bindsym XF86MonBrightnessDown exec swayosd --brightness=lower + +# Modes +# Resize +mode "resize" { + bindsym $left resize shrink width 40px + bindsym $down resize grow height 40px + bindsym $up resize shrink height 40px + bindsym $right resize grow width 40px + bindsym Left resize shrink width 40px + bindsym Down resize grow height 40px + bindsym Up resize shrink height 40px + bindsym Right resize grow width 40px + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +# Screenshots +bindsym Print exec glurp full clip +bindsym Shift+Print exec glurp area clip +bindsym Mod1+Print exec glurp full file +bindsym Mod1+Shift+Print exec glurp area file + diff --git a/config/sway/config.d/80-style.conf b/config/sway/config.d/80-style.conf new file mode 100644 index 0000000..682b78b --- /dev/null +++ b/config/sway/config.d/80-style.conf @@ -0,0 +1,11 @@ +# Colors +# +client.focused #00ff00 #000000 #00ff00 #00ff00 #00ff00 +client.focused_inactive #808080 #000000 #808080 #ffffff #808080 +client.unfocused #808080 #000000 #808080 #ffffff #808080 +client.urgent #ffff00 #000000 #ffff00 #ffffff #ffff00 + +# Borders +default_border pixel 1 +default_floating_border normal 1 + diff --git a/config/sway/config.d/80-window-rules.conf b/config/sway/config.d/80-window-rules.conf new file mode 100644 index 0000000..6645db8 --- /dev/null +++ b/config/sway/config.d/80-window-rules.conf @@ -0,0 +1,4 @@ +assign [app_id="^@joplin/app-desktop$"] 4 +assign [class="^WebCord$"] 4 +assign [class="^Deezer$"] 4 + diff --git a/config/waybar-2/config b/config/waybar-2/config new file mode 100644 index 0000000..1bc72c9 --- /dev/null +++ b/config/waybar-2/config @@ -0,0 +1,84 @@ +{ + "layer": "top", // Waybar at top layer + "position": "bottom", // Waybar at the bottom of your screen + "height": 24, // Waybar height + // "width": 1366, // Waybar width + // Choose the order of the modules + "modules-left": ["sway/workspaces", "sway/mode", "sway/window"], + "modules-center": ["tray", "clock"], + "modules-right": ["pulseaudio", "network", "cpu", "memory", "battery"], + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": false, + "format": "{icon} ", + "format-icons": { + "1:web": "", + "2:code": "", + "3:term": "", + "4:work": "", + "5:music": "", + "6:docs": "", + "urgent": "", + "focused": "", + "default": "" + } + }, + "sway/mode": { + "format": "{}" + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + "format": "{:%Y-%m-%d | %H:%M:%S}" + }, + "cpu": { + "format": "{usage}%  " + }, + "memory": { + "format": "{}%  " + }, + "battery": { + "bat": "BAT0", + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon} ", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + "network": { + // "interface": "wlp2s0", // (Optional) To force the use of this interface + "format-wifi": "{essid} ({signalStrength}%)  ", + "format-ethernet": "{ifname}: {ipaddr}/{cidr} ", + "format-disconnected": "Disconnected ⚠ " + }, + "pulseaudio": { + //"scroll-step": 1, + "format": "{volume}% {icon} ", + "format-bluetooth": "{volume}% {icon}  ", + "format-muted": "", + "format-icons": { + "headphones": "", + "handsfree": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", ""] + }, + "on-click": "pavucontrol" + }, + "custom/spotify": { + "format": " {}", + "max-length": 40, + "interval": 30, // Remove this if your script is endless and write in loop + "exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder + "exec-if": "pgrep spotify" + } +} + diff --git a/config/waybar-2/mediaplayer.sh b/config/waybar-2/mediaplayer.sh new file mode 100755 index 0000000..847de29 --- /dev/null +++ b/config/waybar-2/mediaplayer.sh @@ -0,0 +1,7 @@ +#!/bin/sh +player_status=$(playerctl status 2> /dev/null) +if [ "$player_status" = "Playing" ]; then + echo "$(playerctl metadata artist) - $(playerctl metadata title)" +elif [ "$player_status" = "Paused" ]; then + echo " $(playerctl metadata artist) - $(playerctl metadata title)" +fi diff --git a/config/waybar-2/style.css b/config/waybar-2/style.css new file mode 100644 index 0000000..e4becc4 --- /dev/null +++ b/config/waybar-2/style.css @@ -0,0 +1,95 @@ +* { + border: none; + border-radius: 0; + font-family: Hack Nerd Font; + font-size: 15px; + min-height: 0; +} + +window#waybar { + background: transparent; + color: white; +} + +#window { + font-weight: bold; +} + +#workspaces button { + padding: 0 5px 0 10px; + background: transparent; + color: white; + border-top: 2px solid transparent; +} + +#workspaces button.focused { + color: #00ff00; + border-top: 2px solid #00ff00; +} + +#mode { + background: #64727D; + border-bottom: 3px solid white; +} + +#clock, #battery, #cpu, #memory, #network, #pulseaudio, #custom-spotify, #tray, #mode { + padding: 0 3px; + margin: 0 2px; +} + +#clock { + font-weight: bold; +} + +#battery { +} + +#battery icon { + color: red; +} + +#battery.charging { +} + +@keyframes blink { + to { + background-color: #ffffff; + color: black; + } +} + +#battery.warning:not(.charging) { + color: white; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#cpu { +} + +#memory { +} + +#network { +} + +#network.disconnected { + background: #f53c3c; +} + +#pulseaudio { +} + +#pulseaudio.muted { +} + +#custom-spotify { + color: rgb(102, 220, 105); +} + +#tray { +} +