diff --git a/config/sway/config b/config/sway/config new file mode 100644 index 0000000..7e94e30 --- /dev/null +++ b/config/sway/config @@ -0,0 +1,161 @@ +# Add these lines near the top of your config +exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway +exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP + +# Screen sharing +exec_always systemctl --user import-environment SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + +# Sway config file +set $mod Mod4 + +# Font for window titles +font pango:monospace 8 + +# Your preferred terminal emulator +set $term foot # or alacritty, kitty, etc. + +# Your preferred application launcher +set $menu rofi -show run + +### Key bindings +# Start a terminal +bindsym $mod+Return exec $term + +# Kill focused window +bindsym $mod+Shift+q kill + +# Start your launcher +bindsym $mod+d exec $menu +bindsym $mod+Shift+s exec rofi -show ssh + +# Volume controls (using pamixer for Pipewire) +bindsym XF86AudioRaiseVolume exec pamixer -i 5 +bindsym XF86AudioLowerVolume exec pamixer -d 5 +bindsym XF86AudioMute exec pamixer -t +bindsym XF86AudioMicMute exec pamixer --default-source -t + + +bindsym $mod+Shift+r restart +bindsym $mod+Shift+c reload + + + +# Screenshot with grim + slurp (Wayland equivalent of flameshot) +#bindsym Print exec grim -g "$(slurp)" - | wl-copy +bindsym Print exec grim -g "$(slurp)" - | swappy -f - +bindsym $mod+Print exec grim -g "$(slurp)" - | tesseract - - | wl-copy +bindsym $mod+Mod1+Print exec grim -g "$(slurp -p)" -t ppm - | magick - -format '#%[hex:p{0,0}]' info: | wl-copy + + +# Drag floating windows +floating_modifier $mod normal + +# Navigation +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# Move windows +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+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 + +# Layout stuff +bindsym $mod+b splith +bindsym $mod+v splitv +bindsym $mod+s layout stacking +bindsym $mod+w 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 + +# Scratchpad +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + +# Resizing containers +mode "resize" { + 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 "default" +} +bindsym $mod+r mode "resize" + +exec { + waybar + kanshi +} + +# Remove window borders +default_border none +default_floating_border none + +# For screen sharing +exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + +exec blueman-applet +exec wl-paste -t text --watch clipman store # Clipboard manager +exec mako # Notification daemon +#exec --no-startup-id kdeconnectd +exec nm-applet # Network Manager applet +exec kdeconnect-indicator + +## init workspaces +workspace 1 output DP-1 +workspace 9 output DP-2 +workspace 10 output eDP-1 +include ~/.config/sway/config.d/displays.conf + +## Launch Android +#bindsym $mod+a exec waydroid show-full-ui + + + +exec export $(dbus-launch) +exec ibus-daemon -dr + + +for_window [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0 +exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK + +exec hash dbus-update-activation-environment 2>/dev/null && \ + dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK +exec xfce4-power-manager +#exec /usr/bin/uxplay -avdec +bindsym $mod+l exec /home/shihaam/scripts/lock.sh + +exec_always export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 diff --git a/config/sway/config.d/displays.conf b/config/sway/config.d/displays.conf new file mode 100644 index 0000000..65dae25 --- /dev/null +++ b/config/sway/config.d/displays.conf @@ -0,0 +1,7 @@ +output eDP-1 resolution 1920x1200 position 0,1080 +output DP-1 resolution 3840x2160 position 1920,735 scale 1.4 +output DP-2 disable +output HDMI-1 disable + +# Set DP-1 as primary (for workspace assignments) +focus output DP-1 diff --git a/home/shihaam.nix b/home/shihaam.nix index 58b2268..143db3c 100644 --- a/home/shihaam.nix +++ b/home/shihaam.nix @@ -7,6 +7,7 @@ ./packages.nix ./fonts.nix ./nano.nix + ./sway.nix ]; home.username = "shihaam"; diff --git a/home/sway.nix b/home/sway.nix new file mode 100644 index 0000000..5c67082 --- /dev/null +++ b/home/sway.nix @@ -0,0 +1,19 @@ +# sway. The config stays in real sway syntax at config/sway/config and is +# symlinked into place, rather than being translated into +# wayland.windowManager.sway options. +# +# programs.sway.enable stays in hosts/la2410/configuration.nix -- that handles +# the session, polkit and dbus wiring, and pulls in the default extraPackages +# (swaylock, swayidle, foot, dmenu). This file only writes the config file. +# +# Iteration loop is now: edit config/sway/config -> git add if new -> +# nixos-rebuild switch -> swaymsg reload. +{ ... }: + +{ + xdg.configFile."sway/config".source = ../config/sway/config; + + # included from config line 141: include ~/.config/sway/config.d/displays.conf + xdg.configFile."sway/config.d/displays.conf".source = + ../config/sway/config.d/displays.conf; +}