add waybar and sway

This commit is contained in:
2025-01-17 20:54:59 +02:00
parent 7e5f42cd3e
commit d46b5bc1b2
6 changed files with 376 additions and 0 deletions

8
.config/sway/autostart.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# pidof mpd || mpd &
# pidof flameshot || flameshot &
# pidof lxpolkit || lxpolkit &
# pidof picom || picom &
# wal -R
pkill swaybg; swaybg -i ~/docs/bg/gruvbox-wallpapers/wallpapers/minimalistic/clouds.png -m fill

179
.config/sway/config Normal file
View File

@ -0,0 +1,179 @@
include "$HOME/.cache/wal/colors-sway"
set $mod Mod4
set $terminal kitty
set $browser firefox
set $calculator "rofi -show calc"
set $calendar "$terminal -e nvim +Agenda"
set $feed_reader "$terminal -e newsboat"
set $file_manager nemo
set $music_player "kitty -e ncmpcpp"
set $screen_locker "swaylock -c 000000"
font pango:mononoki 12
# Start XDG autostart .desktop files using dex. See also
# https://wiki.archlinux.org/index.php/XDG_Autostart
exec --no-startup-id dex --autostart --environment i3
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
# tiling_drag modifier titlebar
# basics
bindsym $mod+w kill
bindsym $mod+r reload
# focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# shift
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# frame splitting
bindsym $mod+o split h
bindsym $mod+u split v
# resize
bindsym $mod+Control+h resize grow left 2 px or 2 ppt
bindsym $mod+Control+j resize grow down 2 px or 2 ppt
bindsym $mod+Control+k resize grow up 2 px or 2 ppt
bindsym $mod+Control+l resize grow right 2 px or 2 ppt
# cycle layouts
bindsym $mod+Control+e layout stacking
bindsym $mod+Control+r layout tabbed
bindsym $mod+Control+t layout toggle split
# window attributes
bindsym $mod+Control+w fullscreen toggle
bindsym $mod+Control+q floating toggle
#
# launchers
#
bindsym $mod+Return exec $terminal
bindsym $mod+space exec --no-startup-id "rofi -show drun"
bindsym $mod+grave exec flameshot gui
bindsym $mod+1 exec $file_manager
bindsym $mod+2 exec $browser
bindsym $mod+3 exec $calculator
bindsym $mod+4 exec $music_player
bindsym $mod+5 exec $calendar
bindsym $mod+6 exec $virt-manager
bindsym $mod+0 exec $screen_locker
# change focus between tiling / floating windows
# bindsym $mod+space focus mode_toggle
# focus the parent container
# bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "a"
set $ws2 "s"
set $ws3 "d"
set $ws4 "f"
set $ws5 "g"
set $ws6 "z"
set $ws7 "x"
set $ws8 "c"
set $ws9 "v"
set $ws10 "b"
# switch to workspace
bindsym $mod+a workspace $ws1
bindsym $mod+s workspace $ws2
bindsym $mod+d workspace $ws3
bindsym $mod+f workspace $ws4
bindsym $mod+g workspace $ws5
bindsym $mod+z workspace $ws6
bindsym $mod+x workspace $ws7
bindsym $mod+c workspace $ws8
bindsym $mod+v workspace $ws9
bindsym $mod+b workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+a move container to workspace $ws1
bindsym $mod+Shift+s move container to workspace $ws2
bindsym $mod+Shift+d move container to workspace $ws3
bindsym $mod+Shift+f move container to workspace $ws4
bindsym $mod+Shift+g move container to workspace $ws5
bindsym $mod+Shift+z move container to workspace $ws6
bindsym $mod+Shift+x move container to workspace $ws7
bindsym $mod+Shift+c move container to workspace $ws8
bindsym $mod+Shift+v move container to workspace $ws9
bindsym $mod+Shift+b move container to workspace $ws10
bindsym $mod+p move workspace to output right
#
# theme
#
gaps inner 12
default_border pixel 2
# set_from_resource $color0 sway.color0 #000000
# set_from_resource $color1 sway.color1 #000000
# set_from_resource $color8 sway.color8 #000000
# class border backgr. text indicator child_border
client.focused $color8 $color0 $color6 $color0 $color8
client.focused_inactive $color8 $color0 $color6 $color0 $color0
client.unfocused $color0 $color0 $color6 $color0 $color0
client.urgent $color1 $color0 $color6 $color0 $color0
client.placeholder $color1 $color0 $color6 $color0 $color0
client.background $color0
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# bar {
# status_command i3status
# }
exec_always --no-startup-id $HOME/.config/sway/autostart.sh
exec_always --no-startup-id $HOME/.config/sway/panel.sh
input "type:keyboard" {
repeat_rate 45
repeat_delay 300
xkb_layout "eu,il"
xkb_options "grp:alt_shift_toggle"
}
for_window [class="REAPER" title="^(?!.*REAPER).*$"] floating enable
for_window [class="REAPER" title=".*REAPER - .*" instance="REAPER"] floating disable

6
.config/sway/panel.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
pkill waybar
waybar
# polybar-msg cmd quit
# polybar main 2>&1 & disown

159
.config/waybar/config.jsonc Normal file
View File

@ -0,0 +1,159 @@
// -*- mode: jsonc -*-
{
// "layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right)
"height": 29, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
"spacing": 4, // Gaps between modules (4px)
// Choose the order of the modules
"modules-left": [
"sway/workspaces"
// "sway/mode",
// "sway/scratchpad",
// "custom/media"
],
"modules-center": [
// "sway/window"
"clock"
],
"modules-right": [
"mpd",
"custom/separator",
"custom/pipewire_buffer_size",
"custom/separator",
"pulseaudio",
"custom/separator",
"sway/language",
"custom/separator",
"memory",
"custom/separator",
"cpu",
"custom/separator",
"network",
"custom/separator",
"custom/power"
],
"custom/separator": {
"format": "|",
"interval": "once",
"tooltip": false
},
// Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "warp-on-scroll": false,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
// },
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"mpd": {
"format": "{artist} - {title}",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 5,
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "CPU {usage}%",
"tooltip": false
},
"memory": {
"format": "MEM {}%"
},
"custom/pipewire_buffer_size": {
"exec": "~/.config/waybar/pipewire_buffer_size.sh",
"interval": 10,
"on-click": "~/.config/waybar/pipewire_buffer_size.sh click"
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""]
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-full": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"battery#bat2": {
"bat": "BAT2"
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%)",
"format-ethernet": "{ipaddr}/{cidr}",
"tooltip-format": "{ifname} via {gwaddr}",
"format-linked": "{ifname} (No IP)",
"format-disconnected": "Disconnected",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "VOL {volume}%",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"on-click": "pavucontrol"
},
"custom/media": {
"format": "{icon} {text}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
},
"custom/power": {
"format": "⏻ ",
"tooltip": false,
"menu": "on-click",
"menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder
"menu-actions": {
"shutdown": "shutdown",
"reboot": "reboot",
"suspend": "systemctl suspend",
"hibernate": "systemctl hibernate"
}
}
}

View File

@ -0,0 +1,18 @@
#!/bin/bash
BUFFER_SIZES=("64" "128" "256" "512" "1024" "2048" "4096" "8192")
current_buffer_size=$(pw-metadata -n settings 0 clock.force-quantum | grep -oP "value:'\K[0-9]+")
if [[ $1 == "click" ]]; then
new_buffer_size=$(echo "${BUFFER_SIZES[@]}" | tr ' ' '\n' | wofi --show dmenu)
if [[ -n $new_buffer_size ]]; then
pw-metadata -n settings 0 clock.force-quantum "$new_buffer_size"
current_buffer_size=$new_buffer_size
fi
exit 0
fi
echo "$current_buffer_size"

6
.config/waybar/style.css Normal file
View File

@ -0,0 +1,6 @@
/* @import url("~/.cache/wal/colors.css"); */
* {
font-family: "mononoki";
font-size: 16;
}