diff --git a/bin/start-sway.sh b/bin/start-sway.sh index 52a01f0..8681b3a 100755 --- a/bin/start-sway.sh +++ b/bin/start-sway.sh @@ -10,9 +10,11 @@ export QT_QPA_PLATFORM=wayland export SDL_VIDEODRIVER=wayland export _JAVA_AWT_WM_NONREPARENTING=1 -# If using seatd instead of elogind uncomment the below line +# seat settings export LIBSEAT_BACKEND=seatd -# Launch Sway with a D-Bus server available, use: +# QT icons +export QT_QPA_PLATFORMTHEME=qt6ct +# Launch Sway with a D-Bus server available, use: dbus-run-session -- sway diff --git a/conf/doas-zzz.conf b/conf/doas-zzz.conf new file mode 100644 index 0000000..da35f04 --- /dev/null +++ b/conf/doas-zzz.conf @@ -0,0 +1 @@ +permit nopass :wheel cmd zzz diff --git a/conf/niri/config.kdl b/conf/niri/config.kdl new file mode 100644 index 0000000..9512f34 --- /dev/null +++ b/conf/niri/config.kdl @@ -0,0 +1,220 @@ +// Input device configuration. +input { + keyboard { + xkb { } + } + + // Omitting settings disables them, or leaves them at their default values. + touchpad { } + + mouse { + accel-profile "flat" + } + + trackpoint { } +} + +output "eDP-1" { + mode "1920x1200" + scale 2 + transform "normal" +} + +layout { + gaps 8 + center-focused-column "on-overflow" + + preset-column-widths { + proportion 0.33333 + proportion 0.5 + proportion 0.66667 + } + default-column-width { proportion 0.5; } + + // You can change how the focus ring looks. + focus-ring { + width 3 + active-color "#7fc8ff" + inactive-color "#505050" + } + + border { + off + } + + shadow { } + + struts { + // left 64 + // right 64 + // top 64 + // bottom 64 + } +} + +// prefer-no-csd + +screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" + +animations { + // off + // slowdown 3.0 +} + + +// wezterm as fullscreen +window-rule { + match app-id=r#"^org\.wezfurlong\.wezterm$"# + default-column-width {} +} + +// Firefox picture-in-picture player as floating by default. +window-rule { + match app-id=r#"firefox$"# title="^Picture-in-Picture$" + open-floating true +} + + +binds { + Mod+Shift+Slash { show-hotkey-overlay; } + + // Suggested binds for running programs: terminal, app launcher, screen locker. + Mod+T { spawn "foot"; } + Mod+D { spawn "fuzzel"; } + Super+Alt+L { spawn "swaylock"; } + + // Example volume keys mappings for PipeWire & WirePlumber. + XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; } + XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; } + XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; } + XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; } + + Mod+Q { close-window; } + + Mod+Left { focus-column-left; } + Mod+Down { focus-window-down; } + Mod+Up { focus-window-up; } + Mod+Right { focus-column-right; } + Mod+H { focus-column-left; } + Mod+J { focus-window-down; } + Mod+K { focus-window-up; } + Mod+L { focus-column-right; } + + Mod+Ctrl+Left { move-column-left; } + Mod+Ctrl+Down { move-window-down; } + Mod+Ctrl+Up { move-window-up; } + Mod+Ctrl+Right { move-column-right; } + Mod+Ctrl+H { move-column-left; } + Mod+Ctrl+J { move-window-down; } + Mod+Ctrl+K { move-window-up; } + Mod+Ctrl+L { move-column-right; } + + Mod+Home { focus-column-first; } + Mod+End { focus-column-last; } + Mod+Ctrl+Home { move-column-to-first; } + Mod+Ctrl+End { move-column-to-last; } + + Mod+Shift+Left { focus-monitor-left; } + Mod+Shift+Down { focus-monitor-down; } + Mod+Shift+Up { focus-monitor-up; } + Mod+Shift+Right { focus-monitor-right; } + Mod+Shift+H { focus-monitor-left; } + Mod+Shift+J { focus-monitor-down; } + Mod+Shift+K { focus-monitor-up; } + Mod+Shift+L { focus-monitor-right; } + + Mod+Shift+Ctrl+Left { move-column-to-monitor-left; } + Mod+Shift+Ctrl+Down { move-column-to-monitor-down; } + Mod+Shift+Ctrl+Up { move-column-to-monitor-up; } + Mod+Shift+Ctrl+Right { move-column-to-monitor-right; } + Mod+Shift+Ctrl+H { move-column-to-monitor-left; } + Mod+Shift+Ctrl+J { move-column-to-monitor-down; } + Mod+Shift+Ctrl+K { move-column-to-monitor-up; } + Mod+Shift+Ctrl+L { move-column-to-monitor-right; } + + Mod+Page_Down { focus-workspace-down; } + Mod+Page_Up { focus-workspace-up; } + Mod+U { focus-workspace-down; } + Mod+I { focus-workspace-up; } + Mod+Ctrl+Page_Down { move-column-to-workspace-down; } + Mod+Ctrl+Page_Up { move-column-to-workspace-up; } + Mod+Ctrl+U { move-column-to-workspace-down; } + Mod+Ctrl+I { move-column-to-workspace-up; } + + Mod+Shift+Page_Down { move-workspace-down; } + Mod+Shift+Page_Up { move-workspace-up; } + Mod+Shift+U { move-workspace-down; } + Mod+Shift+I { move-workspace-up; } + + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } + Mod+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; } + + Mod+WheelScrollRight { focus-column-right; } + Mod+WheelScrollLeft { focus-column-left; } + Mod+Ctrl+WheelScrollRight { move-column-right; } + Mod+Ctrl+WheelScrollLeft { move-column-left; } + + Mod+Shift+WheelScrollDown { focus-column-right; } + Mod+Shift+WheelScrollUp { focus-column-left; } + Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } + Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } + + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Mod+Ctrl+1 { move-column-to-workspace 1; } + Mod+Ctrl+2 { move-column-to-workspace 2; } + Mod+Ctrl+3 { move-column-to-workspace 3; } + Mod+Ctrl+4 { move-column-to-workspace 4; } + Mod+Ctrl+5 { move-column-to-workspace 5; } + Mod+Ctrl+6 { move-column-to-workspace 6; } + Mod+Ctrl+7 { move-column-to-workspace 7; } + Mod+Ctrl+8 { move-column-to-workspace 8; } + Mod+Ctrl+9 { move-column-to-workspace 9; } + + Mod+BracketLeft { consume-or-expel-window-left; } + Mod+BracketRight { consume-or-expel-window-right; } + + Mod+Comma { consume-window-into-column; } + Mod+Period { expel-window-from-column; } + + Mod+R { switch-preset-column-width; } + Mod+Shift+R { switch-preset-window-height; } + Mod+Ctrl+R { reset-window-height; } + Mod+F { maximize-column; } + Mod+Shift+F { fullscreen-window; } + + Mod+Ctrl+F { expand-column-to-available-width; } + + Mod+C { center-column; } + + Mod+Minus { set-column-width "-10%"; } + Mod+Equal { set-column-width "+10%"; } + + Mod+Shift+Minus { set-window-height "-10%"; } + Mod+Shift+Equal { set-window-height "+10%"; } + + Mod+V { toggle-window-floating; } + Mod+Shift+V { switch-focus-between-floating-and-tiling; } + + Mod+W { toggle-column-tabbed-display; } + + Print { screenshot; } + Ctrl+Print { screenshot-screen; } + Alt+Print { screenshot-window; } + + Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } + + Mod+Shift+E { quit; } + Ctrl+Alt+Delete { quit; } + + Mod+Shift+P { power-off-monitors; } +} diff --git a/conf/sway/config b/conf/sway/config new file mode 100644 index 0000000..0cc0ffd --- /dev/null +++ b/conf/sway/config @@ -0,0 +1,182 @@ +set $mod Mod4 + +set $term foot +set $menu fuzzel + +output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill + +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. +exec swayidle -w \ + timeout 300 'swaylock -f -c 000000' \ + timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ + timeout 800 'doas zzz' \ + before-sleep 'swaylock -f -c 000000' + +# Start a pipewire session +exec /usr/libexec/pipewire-launcher + +# Set env for screensharing +exec dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + +# Inhibit sleep when audio is playing +exec wayland-pipewire-idle-inhibit + +# Start the notificaion daemon +exec mako + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $term + + # Kill focused window + bindsym $mod+Shift+q kill + + # Start your launcher + bindsym $mod+d exec $menu + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+c reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' +# +# Moving around: +# + # Move your focus around + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + 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: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" +# +# Utilities: +# + # Special keys to adjust volume via PulseAudio + bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle + bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5% + bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5% + bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle + # Special keys to adjust brightness via brightnessctl + bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%- + bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+ + # Special key to take a screenshot with grim + bindsym Print exec grim + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + position top + + # When the status_command prints a new line to stdout, swaybar updates. + # The default just shows the current date and time. + status_command while date +'%Y-%m-%d %X'; do sleep 1; done + + colors { + statusline #ffffff + background #323232 + inactive_workspace #32323200 #32323200 #5c5c5c + } +} + +include /etc/sway/config.d/* diff --git a/install.sh b/install.sh index 2f8ce40..17559e2 100755 --- a/install.sh +++ b/install.sh @@ -7,11 +7,13 @@ if [ "$(id -u)" -ne "0" ]; then fi export user="${DOAS_USER:-$SUDO_USER}" + if [ -z "$user" ]; then echo "This script must be run as a regular user using sudo or doas" exit 1 -fi +fi +export homedir="$(getent passwd $user | cut -d ':' -f 6)" # # Install required packages @@ -28,7 +30,7 @@ apk update && apk upgrade echo "Installing packages" for f in pkglist/*; do - printf "\tInsalling %s\n" "$f" + printf "\tInsalling %s\n" "$f" apk add $(sed -e '/^#.*/d' -e '/^\s*$/d' "$f" | sed ':a;N;$!ba;s/\n/ /g') done diff --git a/pkglist/00-core b/pkglist/00-core index 132c5b7..265af52 100644 --- a/pkglist/00-core +++ b/pkglist/00-core @@ -9,6 +9,7 @@ gcompat doas-sudo-shim terminus-font shadow-login +zzz # stuff for mobile devices tlp diff --git a/pkglist/50-desktop b/pkglist/50-desktop index aee6acd..0ad2382 100644 --- a/pkglist/50-desktop +++ b/pkglist/50-desktop @@ -1,6 +1,9 @@ sway +# niri xwayland foot +fuzzel +mako wmenu swaylock swaylockd swaybg @@ -10,7 +13,14 @@ i3status swayidle xdg-desktop-portal xdg-desktop-portal-wlr +wayland-pipewire-idle-inhibit clipman greetd squeekboard lisgd +brightnessctl +qt6ct +adwaita-icon-theme +adwaita-qt +breeze-icons +ffmpegthumbnailer diff --git a/setup_config.sh b/setup_config.sh index 3f1e65d..ee5c844 100644 --- a/setup_config.sh +++ b/setup_config.sh @@ -5,5 +5,24 @@ cp conf/tlp.conf /etc/tlp.conf # install wrapper script for sway install -m 755 bin/start-sway.sh /usr/local/bin/start-sway +# install doas rule to allow wheel users to use zzz +install -m 644 conf/doas-zzz.conf /etc/doas.d/zzz.conf + +# Install greetd config mkdir -p /etc/greetd sed "s/DEF_USER/$user/" conf/greetd/config.toml > /etc/greetd/config.toml + +# Install sway and niri configs +mkdir -p $homedir/.config/sway +chown -R $user:$user $homedir/.config +install -m 664 -o $user -g $user conf/sway/config $homedir/.config/sway/config + +# mkdir -p $homedir/.config/niri +# chown $user:$user $homedir/.config/niri +# install -m 664 -o $user -g $user conf/niri/config.kdl $homedir/.config/niri/config.kdl + + +# setup environment variables +echo 'export LIBSEAT_BACKEND=seatd' >> "$homedir"/.profile +echo 'export XDG_CONFIG_HOME=$HOME/.config' >> "$homedir"/.profile +chown $user:$user "$homedir/.profile" diff --git a/setup_env.sh b/setup_env.sh index b19aa4e..b146d29 100644 --- a/setup_env.sh +++ b/setup_env.sh @@ -1,7 +1,5 @@ # environment for seatd to work -homedir="$(getent passwd $user | cut -d ':' -f 6)" - echo 'XDG_SESSION_TYPE=wayland' >> "$homedir"/.profile echo 'LIBSEAT_BACKEND=seatd' >> "$homedir"/.profile diff --git a/setup_system.sh b/setup_system.sh index 3ff49e2..52bdfae 100644 --- a/setup_system.sh +++ b/setup_system.sh @@ -18,5 +18,5 @@ options iwlmvm power_scheme=3 EOF # set console font -setfont /usr/share/consolefonts/ter-132n.psf.gz +setfont /usr/share/consolefonts/ter-132n.psf.gz || true sed -i 's/consolefont=.*/consolefont="ter-132n.psf.gz"/' /etc/conf.d/consolefont