diff --git a/arch/stow/sway/.config/sway/autostart.sh b/arch/stow/sway/.config/sway/autostart.sh deleted file mode 100755 index dfea59b..0000000 --- a/arch/stow/sway/.config/sway/autostart.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -# -# ~/.config/sway/autostart.sh -# List of applications to autostart -# - -function execute () { - setsid --fork $SHELL -c "${1}" &> /dev/null -} - -# Idle script -execute "~/.scripts/idle.sh" - -# Gamma and brightness -execute "clight" - -# Notification manager -execute "dunst -verbosity crit" - -# Fix [Slow launch for some GTK apps](https://github.com/swaywm/sway/issues/5732) -dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK - -# Fix JetBrain IDE's showing properly -wmname LG3 - - -sleep 3 -# --- Everything that requires tray to be active --- - -# Nextcloud client -execute "nextcloud --background" - -# Activity watch server & client -execute "aw-qt" - diff --git a/arch/stow/sway/.config/sway/commands b/arch/stow/sway/.config/sway/commands deleted file mode 100644 index 4c3c621..0000000 --- a/arch/stow/sway/.config/sway/commands +++ /dev/null @@ -1,178 +0,0 @@ -# -# ~/.config/sway/commands -# Keybinds for sway -# - -# Variables -set { - $alt Mod1 - $flag Mod4 - $term alacritty - $notify ~/.scripts/notify.sh -} - -# Focus -bindsym { - $flag+h focus left - $flag+j focus down - $flag+k focus up - $flag+l focus right - - $flag+Left focus left - $flag+Down focus down - $flag+Up focus up - $flag+Right focus right - - $flag+semicolon focus mode_toggle - $flag+p focus parent -} - -# Move windows -bindsym { - $flag+Shift+h move left - $flag+Shift+j move down - $flag+Shift+k move up - $flag+Shift+l move right - - $flag+Shift+Left move left - $flag+Shift+Down move down - $flag+Shift+Up move up - $flag+Shift+Right move right - - $flag+Next move scratchpad - $flag+KP_Next move scratchpad - $flag+Prior scratchpad show - $flag+KP_Prior scratchpad show -} - -# Layouts -bindsym { - $flag+w layout toggle split - $flag+x layout tabbed - $flag+c split h - $flag+v split v - - $flag+f floating enable, border normal 1 - $flag+Shift+f floating disable, border pixel 1 - - $alt+Next border pixel 1 # Show window title - $alt+KP_Next border pixel 1 - $alt+Prior border normal 1 # Hide window title - $alt+KP_Prior border normal 1 - - $flag+s sticky toggle -} - -# Workspaces -set { - $ws1 "1:1" - $ws2 "2:2" - $ws3 "3:3" - $ws4 "4:4" - $ws5 "5:5" - $ws6 "6:6" - $ws7 "7:7" - $ws8 "8:8" - $ws9 "9:9" - $ws10 "10:10" - $ws11 "11:Soc" - $ws12 "12:Ent" -} - -bindsym { - $flag+1 workspace $ws1 - $flag+2 workspace $ws2 - $flag+3 workspace $ws3 - $flag+4 workspace $ws4 - $flag+5 workspace $ws5 - $flag+6 workspace $ws6 - $flag+7 workspace $ws7 - $flag+8 workspace $ws8 - $flag+9 workspace $ws9 - $flag+0 workspace $ws10 - $flag+minus workspace $ws11 - $flag+equal workspace $ws12 - - $flag+Shift+1 move container to workspace $ws1, workspace $ws1 - $flag+Shift+2 move container to workspace $ws2, workspace $ws2 - $flag+Shift+3 move container to workspace $ws3, workspace $ws3 - $flag+Shift+4 move container to workspace $ws4, workspace $ws4 - $flag+Shift+5 move container to workspace $ws5, workspace $ws5 - $flag+Shift+6 move container to workspace $ws6, workspace $ws6 - $flag+Shift+7 move container to workspace $ws7, workspace $ws7 - $flag+Shift+8 move container to workspace $ws8, workspace $ws8 - $flag+Shift+9 move container to workspace $ws9, workspace $ws9 - $flag+Shift+0 move container to workspace $ws10, workspace $ws10 - $flag+Shift+minus move container to workspace $ws11, workspace $ws11 - $flag+Shift+equal move container to workspace $ws12, workspace $ws12 - - $flag+Control+j focus output 'eDP-1' - $flag+Control+h workspace prev_on_output - $flag+Control+l workspace next_on_output - $flag+Control+k focus output 'HDMI-A-1' - - $flag+Control+Down focus output 'eDP-1' - $flag+Control+Left workspace prev_on_output - $flag+Control+Right workspace next_on_output - $flag+Control+Up focus output 'HDMI-A-1' - - $flag+Control+Shift+j \ - move container to output 'eDP-1', focus output 'eDP-1' - $flag+Control+Shift+h \ - move container to workspace prev_on_output, workspace prev_on_output - $flag+Control+Shift+l \ - move container to workspace next_on_output, workspace next_on_output - $flag+Control+Shift+k \ - move container to output 'HDMI-A-1', focus output 'HDMI-A-1' - - $flag+Control+Shift+Down \ - move container to output 'eDP-1', focus output 'eDP-1' - $flag+Control+Shift+Left \ - move container to workspace prev_on_output, workspace prev_on_output - $flag+Control+Shift+Right \ - move container to workspace next_on_output, workspace next_on_output - $flag+Control+Shift+Up \ - move container to output 'HDMI-A-1', focus output 'HDMI-A-1' -} - -# System -bindsym --locked { -# Brightness - XF86MonBrightnessDown exec brightnessctl -e s 5%- && $notify -b - XF86MonBrightnessUp exec brightnessctl -e s +5% && $notify -b - -# Volume control (Pulsemixer is slow!) - XF86AudioRaiseVolume exec pamixer -i 2 --set-limit 100 && $notify -v - XF86AudioLowerVolume exec pamixer -d 2 && $notify -v - XF86AudioMute exec pamixer -t && $notify -v - XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle - -# Media control - F7 exec playerctl play-pause - Shift+XF86AudioLowerVolume exec playerctl previous - Shift+XF86AudioRaiseVolume exec playerctl next -} - -# Special commands -set $fzf ~/.scripts/fzf-jump -bindsym { - # Reload sway - $alt+Shift+r reload - # Dialog to exit sway - $alt+Shift+e exec swaynag -t warning -m 'Do you really want to exit sway?' \ - -B 'Yes, exit sway' 'swaymsg exit' - - $flag+q kill # Kill focused window - $flag+Return exec $term -e bash -c "zellij attach || zellij" # Start a terminal - $flag+Delete exec swaylock # Lockscreen - - # Start application launcher - $alt+space exec $term --title 'FZF-Jump' -e $fzf/launcher.sh - # Window switcher - $alt+Tab exec $term --title 'FZF-Jump' -e $fzf/standalone.sh $fzf/modules/windows.sh $fzf/modules/workspaces.sh - - # File explorer - $flag+e exec $term -e vifm - # Internet explorer - $flag+i exec firefox -} diff --git a/arch/stow/sway/.config/sway/config b/arch/stow/sway/.config/sway/config deleted file mode 100644 index 14915b2..0000000 --- a/arch/stow/sway/.config/sway/config +++ /dev/null @@ -1,54 +0,0 @@ -# -# .config/sway/config -# Personal config for sway -# Requires noto-fonts-cjk -# - -# Import other config files -include { - commands - modes - style -} - -input type:touchpad { - natural_scroll enabled - scroll_factor 0.6 - middle_emulation enabled - tap enabled -} - -seat seat0 hide_cursor when-typing enable - -# Output -output * { - bg "~/Pictures/wallpapers/bg.*" fill -} - -output 'Dell Inc. DELL P2214H 29C2937M4YTL' { - # Vertical monitor - transform 270 -} - -output 'Samsung Electric Company SAMSUNG 0x00000001' { - # Zoom in because long distance - scale 2 -} - -# Focus -focus_follows_mouse no -floating_modifier Mod4 normal - -# Window rules -for_window [window_role="pop-up"] floating enable -for_window [window_role="task_dialog"] floating enable -for_window [window_role="splash"] floating enable - -for_window [class="Qalculate"] floating enable -for_window [class="Caprine"] floating enable, border normal 2 -for_window [title="^FZF-Jump$"] floating enable, border pixel 0, resize set 600 350 - -for_window [class="^Betterbird$"] move container to workspace "11:Soc" - -exec "~/.config/sway/autostart.sh" - diff --git a/arch/stow/sway/.config/sway/modes b/arch/stow/sway/.config/sway/modes deleted file mode 100644 index 237932b..0000000 --- a/arch/stow/sway/.config/sway/modes +++ /dev/null @@ -1,93 +0,0 @@ -# -# ~/.config/sway/modes -# Modes for sway -# - -set { - $alt Mod1 - $flag Mod4 -} - -# Resizing -bindsym $flag+r mode "resize" -mode "resize" bindsym { - l resize grow width 10 px or 10 ppt - k resize grow height 10 px or 10 ppt - h resize shrink width 10 px or 10 ppt - j resize shrink height 10 px or 10 ppt - - Shift+l resize grow width 50 px or 50 ppt - Shift+k resize grow height 50 px or 50 ppt - Shift+h resize shrink width 50 px or 50 ppt - Shift+j resize shrink height 50 px or 50 ppt - - Right resize grow width 10 px or 10 ppt - Up resize grow height 10 px or 10 ppt - Left resize shrink width 10 px or 10 ppt - Down resize shrink height 10 px or 10 ppt - - Shift+Right resize grow width 50 px or 50 ppt - Shift+Up resize grow height 50 px or 50 ppt - Shift+Left resize shrink width 50 px or 50 ppt - Shift+Down resize shrink height 50 px or 50 ppt - - $flag+h move left - $flag+j move down - $flag+k move up - $flag+l move right - - $flag+Left move left - $flag+Down move down - $flag+Up move up - $flag+Right move right - - Return mode "default" - Escape mode "default" - $flag+r mode "default" -} - -# System actions -set $mode_system System (l)ock, (s)leep, (h)ibernate, (r)eboot, (Shift+s)hutdown -bindsym Control+$alt+Delete mode "$mode_system" -mode "$mode_system" bindsym { - l exec swaylock, mode "default" - s exec systemctl suspend, mode "default" - h exec systemctl hibernate, mode "default" - r exec systemctl reboot, mode "default" - Shift+s exec systemctl poweroff -i, mode "default" - - Return mode "default" - Escape mode "default" - Control+$alt+Delete mode "default" -} - -# Screenshots -set $mode_screenshot Screenshot of (a)rea, current (w)indow, (s)creen - Shift to save -set $save_format ~/Pictures/Screenshots/$(date +%F-%H-%M-%S).png -bindsym Print mode "$mode_screenshot" -mode "$mode_screenshot" bindsym { - a exec grimshot copy area, mode "default" - w exec grimshot --notify copy active, mode "default" - s exec grimshot --notify copy screen, mode "default" - - Print exec grimshot --notify save screen $save_format mode "default" # Super fast screens! - Shift+a exec grimshot --notify save area $save_format, mode "default" - Shift+w exec grimshot --notify save active $save_format, mode "default" - Shift+s exec grimshot --notify save screen $save_format, mode "default" - - Return mode "default" - Escape mode "default" -} - -# Some preferences -set $mode_preferences Toggle (s)unset, (n)otifications, (f)ocus -bindsym $alt+end mode "$mode_preferences" -mode "$mode_preferences" bindsym { - s exec "~/.scripts/wlsunset.sh", mode "default" - n exec "~/.scripts/dnd.sh", mode "default" - f exec "~/.scripts/focus.sh", mode "default" - - Return mode "default" - Escape mode "default" - $alt+end mode "default" -} diff --git a/arch/stow/sway/.config/sway/style b/arch/stow/sway/.config/sway/style deleted file mode 100644 index d1668ac..0000000 --- a/arch/stow/sway/.config/sway/style +++ /dev/null @@ -1,27 +0,0 @@ -# -# ~/.config/sway/style -# Styling for sway -# - -# Decrease the height of the window bar thing. -font pango:monospace 1 - -bar { - swaybar_command /usr/bin/waybar - mode hide -} - -default_border pixel 1 -default_floating_border normal 1 -hide_edge_borders both -smart_borders on - -# Mimic no titles -# border backgr. text indic. child_border -client.focused #000000 #00897b #00897b #00897b #000000 -client.focused_inactive #000000 #222222 #222222 #222222 #000000 -client.unfocused #000000 #222222 #222222 #222222 #000000 -client.urgent #ff0000 #ff0000 #ff0000 #ff0000 #ff0000 - -exec gsettings set org.gnome.desktop.interface icon-theme 'IcoSystem' -exec gsettings set org.gnome.desktop.interface gtk-theme 'Nordic' diff --git a/nixos/modules-old/des/sway/default.nix b/nixos/modules-old/des/sway/default.nix deleted file mode 100644 index c485a60..0000000 --- a/nixos/modules-old/des/sway/default.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ config, pkgs, lib, ... }: - -let - # bash script to let dbus know about important env variables and - # propagate them to relevent services run at the end of sway config - # see - # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist - # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts - # some user services to make sure they have the correct environment variables - dbus-sway-environment = pkgs.writeTextFile { - name = "dbus-sway-environment"; - destination = "/bin/dbus-sway-environment"; - executable = true; - - text = '' - dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway - systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr - systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr - ''; - }; - - # currently, there is some friction between sway and gtk: - # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland - # the suggested way to set gtk settings is with gsettings - # for gsettings to work, we need to tell it where the schemas are - # using the XDG_DATA_DIR environment variable - # run at the end of sway config - configure-gtk = pkgs.writeTextFile { - name = "configure-gtk"; - destination = "/bin/configure-gtk"; - executable = true; - text = let - schema = pkgs.gsettings-desktop-schemas; - datadir = "${schema}/share/gsettings-schemas/${schema.name}"; - in '' - export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS - gnome_schema=org.gnome.desktop.interface - gsettings set $gnome_schema gtk-theme 'Dracula' - ''; - }; -in -{ - services.xserver = { - enable = true; - - displayManager.lightdm.enable = true; - - excludePackages = with pkgs; [ - xterm - ]; - }; - - security.polkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - pulse.enable = true; - }; - - services.dbus.enable = true; - xdg.portal = { - enable = true; - wlr.enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - }; - - programs.sway = { - enable = true; - wrapperFeatures.gtk = true; - }; - - home-manager.users.tdpeuter = { pkgs, ... }: { - home = { - username = "tdpeuter"; - homeDirectory = "/home/tdpeuter"; - - file = { - ".config/sway".source = ../../../../stow/sway/.config/sway; - ".config/waybar".source = ../../../../stow/waybar/.config/waybar; - ".config/dunst".source = ../../../../stow/dunst/.config/dunst; - # TODO Fix scripts, I don't like it this way - ".scripts".source = ../../../../stow/_scripts/.scripts; - }; - - packages = with pkgs; [ - brightnessctl - dunst - font-awesome - pamixer - pavucontrol - playerctl - swayidle - swaylock-effects - waybar - wmname - ]; -# }; -# -# wayland.windowManager.sway = { -# enable = true; -# package = pkgs.sway-unwrapped; -# config = rec { -# terminal = "alacritty"; -# startup = [ -# {command = "alacritty";} -# ]; -# }; - }; - }; -} diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index 7227806..4a466b2 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -3,6 +3,7 @@ ./desktop ./hardware ./networking + ./nix ./programs ./services ./virtualisation diff --git a/nixos/modules/desktop/default.nix b/nixos/modules/desktop/default.nix index 7c1002b..f67e134 100644 --- a/nixos/modules/desktop/default.nix +++ b/nixos/modules/desktop/default.nix @@ -1,5 +1,7 @@ { imports = [ ./gnome + ./plasma + ./sway ]; } diff --git a/nixos/modules/desktop/sway/default.nix b/nixos/modules/desktop/sway/default.nix new file mode 100644 index 0000000..b5de914 --- /dev/null +++ b/nixos/modules/desktop/sway/default.nix @@ -0,0 +1,128 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.sisyphus.desktop.sway; + + # bash script to let dbus know about important env variables and + # propagate them to relevent services run at the end of sway config + # see + # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist + # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts + # some user services to make sure they have the correct environment variables + dbus-sway-environment = pkgs.writeTextFile { + name = "dbus-sway-environment"; + destination = "/bin/dbus-sway-environment"; + executable = true; + + text = '' + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + ''; + }; + + # currently, there is some friction between sway and gtk: + # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland + # the suggested way to set gtk settings is with gsettings + # for gsettings to work, we need to tell it where the schemas are + # using the XDG_DATA_DIR environment variable + # run at the end of sway config + configure-gtk = pkgs.writeTextFile { + name = "configure-gtk"; + destination = "/bin/configure-gtk"; + executable = true; + text = let + schema = pkgs.gsettings-desktop-schemas; + datadir = "${schema}/share/gsettings-schemas/${schema.name}"; + in '' + export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS + gnome_schema=org.gnome.desktop.interface + # gsettings set $gnome_schema gtk-theme 'Dracula' + ''; + }; +in { + options.sisyphus.desktop.sway.enable = lib.mkEnableOption "Sway"; + + config = lib.mkIf cfg.enable { + environment.systemPackages = (with pkgs; [ + dbus-sway-environment + configure-gtk + wayland + xdg-utils # Open with default program + glib # gsettings + wl-clipboard + wdisplays # Tool to configure displays + + brightnessctl + dunst + libnotify + playerctl + swaybg + swaylock-effects + waybar + wlsunset + + # TODO Turn into own module/package? + jq + j4-dmenu-desktop + rofi + ]) ++ (with pkgs.sway-contrib; [ + grimshot + ]); + + environment.sessionVariables = { + SCRIPT_DIR = ../../../../scripts; + }; + + fonts.fonts = with pkgs; [ + dejavu_fonts + font-awesome + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + source-han-sans + source-han-sans-japanese + source-han-serif-japanese + ]; + + security.polkit.enable = true; + + services = { + atd.enable = true; # Required by sunset.sh + dbus.enable = true; + gnome.gnome-keyring.enable = true; + + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + + power-profiles-daemon.enable = true; + + xserver.displayManager.session = [{ + manage = "window"; + name = "Sway"; + start = '' + ${pkgs.sway}/bin/sway --unsupported-gpu & + waitPID=$! + ''; + }]; + }; + + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; + + sisyphus.users.wantedGroups = [ + config.users.groups.video.name # Brightnessctl + ]; + }; +} diff --git a/nixos/users/tdpeuter/default.nix b/nixos/users/tdpeuter/default.nix index db2e261..d8dc3e4 100644 --- a/nixos/users/tdpeuter/default.nix +++ b/nixos/users/tdpeuter/default.nix @@ -45,7 +45,7 @@ in { ]; sisyphus = { - desktop.gnome.enable = true; + desktop.sway.enable = true; programs.spotify-adblock.enable = true; }; diff --git a/nixos/users/tdpeuter/dotfiles.nix b/nixos/users/tdpeuter/dotfiles.nix index 0603830..b526564 100644 --- a/nixos/users/tdpeuter/dotfiles.nix +++ b/nixos/users/tdpeuter/dotfiles.nix @@ -44,6 +44,18 @@ in { source = ../../../stow/openrgb/.config/OpenRGB; recursive = true; }; + ".config/sway" = { + enable = config.sisyphus.desktop.sway.enable; + source = ../../../stow/sway/.config/sway; + }; + ".config/swayidle" = { + enable = (builtins.elem pkgs.swayidle installedPkgs); + source = ../../../stow/swayidle/.config/swayidle; + }; + ".config/swaylock" = { + enable = config.sisyphus.desktop.sway.enable; + source = ../../../stow/swaylock/.config/swaylock; + }; ".config/vifm" = { enable = (builtins.elem pkgs.vifm installedPkgs); source = ../../../stow/vifm/.config/vifm; diff --git a/stow/sway/.config/sway/config b/stow/sway/.config/sway/config new file mode 100644 index 0000000..55ef837 --- /dev/null +++ b/stow/sway/.config/sway/config @@ -0,0 +1,61 @@ +# +# ~/.config/sway/config +# + +# Variables +set { + $alt Mod1 + $flag Mod4 + + $left h + $down j + $up k + $right l + + $scrollUp button4 + $scrollDown button5 + + $term kitty || alacritty || foot + $menu j4-dmenu-desktop --dmenu "rofi -dmenu -i" + $window_switcher /home/tdpeuter/projects/fzf-jump/new.sh + $lock swaylock -f +} + +include { + input-output + keybinds + modes + style +} + +# Focus +focus_follows_mouse no +floating_modifier $flag normal + +# Window rules +for_window { + [window_role="About"] floating enable + [window_role="bubble"] floating enable + [window_role="Organizer"] floating enable + [window_role="page-info"] floating enable + [window_role="pop-up"] floating enable + [window_role="Preferences"] floating enable + [window_role="splash"] floating enable + [window_role="task_dialog"] floating enable + [window_role="task_dialog"] floating enable + [window_role="toolbox"] floating enable + [window_role="webconsole"] floating enable + [window_type="dialog"] floating enable + [window_type="menu"] floating enable +} + +exec dbus-sway-environment +exec configure-gtk +exec dbus-update-activation-environment --systemd DISPLAY XAUTHORITY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP=sway + +exec wlsunset -l 50.50 -L 4.00 -t 3000 -T 6500 +exec gnome-keyring-daemon --start --components=secrets # Secrets +exec dunst --verbosity crit # Notification manager +exec swayidle -w + +exec nextcloud --background diff --git a/stow/sway/.config/sway/input-output b/stow/sway/.config/sway/input-output new file mode 100644 index 0000000..b7df7fc --- /dev/null +++ b/stow/sway/.config/sway/input-output @@ -0,0 +1,11 @@ +input type:touchpad { + natural_scroll enabled + scroll_factor 0.8 + middle_emulation enabled + tap enabled +} + +output * { + bg "~/Nextcloud/Afbeeldingen/wallpapers/bg" fill +} + diff --git a/stow/sway/.config/sway/keybinds b/stow/sway/.config/sway/keybinds new file mode 100644 index 0000000..1a81a76 --- /dev/null +++ b/stow/sway/.config/sway/keybinds @@ -0,0 +1,195 @@ +set $notify ~/projects/sisyphus/scripts/notify.sh + +# Focus +bindsym { + $flag+$up focus up + $flag+$right focus right + $flag+$down focus down + $flag+$left focus left + + $flag+Up focus up + $flag+Right focus right + $flag+Down focus down + $flag+Left focus left + + $flag+p focus parent + $flag+space focus mode_toggle +} + +# Move windows +bindsym { + $flag+Shift+$up move up + $flag+Shift+$right move right + $flag+Shift+$down move down + $flag+Shift+$left move left + + $flag+Shift+Up move up + $flag+Shift+Right move right + $flag+Shift+Down move down + $flag+Shift+Left move left + + $flag+Next move scratchpad + $flag+KP_Next move scratchpad + $flag+Prior scratchpad show + $flag+KP_Prior scratchpad show +} + +# Layouts +bindsym { + $flag+z layout toggle split + $flag+x layout tabbed + $flag+c split h + $flag+v split v + + $flag+f floating enable, border normal 1 + $flag+Shift+f floating disable, border pixel 1 + + $flag+s sticky toggle + $flag+F11 fullscreen + + $alt+Next border pixel 1 # Show window title + $alt+KP_Next border pixel 1 + $alt+Prior border normal 1 # Hide window title + $alt+KP_Prior border normal 1 +} + +# Workspaces +set { + $ws1 "1:1" + $ws2 "2:2" + $ws3 "3:3" + $ws4 "4:4" + $ws5 "5:5" + $ws6 "6:6" + $ws7 "7:7" + $ws8 "8:8" + $ws9 "9:9" + $ws10 "10:10" + $ws11 "11:Soc" + $ws12 "12:Ent" +} + +bindsym { + $flag+1 workspace $ws1 + $flag+2 workspace $ws2 + $flag+3 workspace $ws3 + $flag+4 workspace $ws4 + $flag+5 workspace $ws5 + $flag+6 workspace $ws6 + $flag+7 workspace $ws7 + $flag+8 workspace $ws8 + $flag+9 workspace $ws9 + $flag+0 workspace $ws10 + $flag+minus workspace $ws11 + $flag+equal workspace $ws12 + + $flag+Shift+1 move container to workspace $ws1, workspace $ws1 + $flag+Shift+2 move container to workspace $ws2, workspace $ws2 + $flag+Shift+3 move container to workspace $ws3, workspace $ws3 + $flag+Shift+4 move container to workspace $ws4, workspace $ws4 + $flag+Shift+5 move container to workspace $ws5, workspace $ws5 + $flag+Shift+6 move container to workspace $ws6, workspace $ws6 + $flag+Shift+7 move container to workspace $ws7, workspace $ws7 + $flag+Shift+8 move container to workspace $ws8, workspace $ws8 + $flag+Shift+9 move container to workspace $ws9, workspace $ws9 + $flag+Shift+0 move container to workspace $ws10, workspace $ws10 + $flag+Shift+minus move container to workspace $ws11, workspace $ws11 + $flag+Shift+equal move container to workspace $ws12, workspace $ws12 + + $flag+Control+$left workspace prev_on_output + $flag+Control+$right workspace next_on_output + + $flag+Control+Left workspace prev_on_output + $flag+Control+Right workspace next_on_output + + --whole-window $flag+$scrollUp workspace prev_on_output + --whole-window $flag+$scrollDown workspace next_on_output + + $flag+Control+Shift+$left move container to workspace prev_on_output, workspace prev_on_output + $flag+Control+Shift+$right move container to workspace next_on_output, workspace next_on_output + + $flag+Control+Shift+Left move container to workspace prev_on_output, workspace prev_on_output + $flag+Control+Shift+Right move container to workspace next_on_output, workspace next_on_output +} + +bindgesture { + swipe:3:right workspace prev_on_output + swipe:3:left workspace next_on_output +} + +# Outputs +bindsym { + $flag+Control+$up focus output up + $flag+Control+$down focus output down + + $flag+Control+Up focus output up + $flag+Control+Down focus output down + + $flag+Control+Shift+$up move container to output up, focus output up + $flag+Control+Shift+$down move container to output down, focus output down + + $flag+Control+Shift+Up move container to output up, focus output up + $flag+Control+Shift+Down move container to output down, focus output down +} + +# System +bindsym --locked { + # Brightness + XF86MonBrightnessDown exec brightnessctl -e s 5%- && $notify -b + XF86MonBrightnessUp exec brightnessctl -e s +5% && $notify -b + + # Audio + XF86AudioRaiseVolume exec wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 2%+ && $notify -v + XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- && $notify -v + XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && $notify -v + XF86AudioMicMute exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle + + # Media + XF86AudioPlay exec playerctl play-pause + XF86AudioPrev exec playerctl previous + XF86AudioNext exec playerctl next + + Shift+XF86AudioMute exec playerctl play-pause + Shift+XF86AudioLowerVolume exec playerctl previous + Shift+XF86AudioRaiseVolume exec playerctl next + + # Other special keys + XF86Calculator exec qalculate-gtk +} + +bindgesture hold:3 exec playerctl play-pause + + +# Shortcuts +bindsym { + # Reload sway + $alt+Shift+r reload + # Dialog to exit sway + $alt+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' + + # Kill focused window + $flag+q kill + # Start a terminal + $flag+Return exec $term + $alt+space exec $menu + $alt+Tab focus prev + $flag+Tab exec $window_switcher + + # Lock the screen + $flag+Delete exec $lock + + # File explorer + $flag+e exec $term -e vifm + # Internet browser + $flag+i exec firefox +} + +bindgesture { + swipe:3:up exec $window_switcher + swipe:4:up exec $menu + + # Cancel + swipe:down exec pkill rofi +} diff --git a/stow/sway/.config/sway/modes b/stow/sway/.config/sway/modes new file mode 100644 index 0000000..545d1a4 --- /dev/null +++ b/stow/sway/.config/sway/modes @@ -0,0 +1,88 @@ +# +# ~/.config/sway/modes +# + +set $default "default" + +# Resizing +set $resize "Resize" +bindsym $flag+r mode $resize +mode $resize bindsym { + $right resize grow width 10 px or 10 ppt + $up resize grow height 10 px or 10 ppt + $left resize shrink width 10 px or 10 ppt + $down resize shrink height 10 px or 10 ppt + + Right resize grow width 10 px or 10 ppt + Up resize grow height 10 px or 10 ppt + Left resize shrink width 10 px or 10 ppt + Down resize shrink height 10 px or 10 ppt + + Shift+$right resize grow width 50 px or 50 ppt + Shift+$up resize grow height 50 px or 50 ppt + Shift+$left resize shrink width 50 px or 50 ppt + Shift+$down resize shrink height 50 px or 50 ppt + + Shift+Right resize grow width 50 px or 50 ppt + Shift+Up resize grow height 50 px or 50 ppt + Shift+Left resize shrink width 50 px or 50 ppt + Shift+Down resize shrink height 50 px or 50 ppt + + $flag+$right move right + $flag+$up move up + $flag+$left move left + $flag+$down move down + + $flag+Right move right + $flag+Up move up + $flag+Left move left + $flag+Down move down + + Return mode $default + Escape mode $default + $flag+r mode $default +} + +# System actions +set $mode_system "System (l)ock, (s)leep, (h)ibernate, (r)eboot, (Shift+s)hutdown" +bindsym Control+$alt+Delete mode $mode_system +mode $mode_system bindsym { + l mode $default, exec $lock + s mode $default, exec $lock, exec systemctl suspend + h mode $default, exec $lock, exec systemctl hibernate + r mode $default, exec systemctl reboot + Shift+s mode $default, exec systemctl poweroff -i + + Return mode $default + Escape mode $default + Control+$alt+Delete mode $default +} + +# Screenshots +set $mode_screenshot "Screenshot of (a)rea, current (w)indow, (s)creen - Shift to save" +set $save_format ~/Nextcloud/Afbeeldingen/Screenshots/$(date +%F-%H-%M-%S).png +bindsym Print mode $mode_screenshot +mode $mode_screenshot bindsym { + a exec grimshot copy area, mode $default + w exec grimshot --notify copy active, mode $default + s exec grimshot --notify copy screen, mode $default + + Shift+a exec grimshot --notify save area $save_format, mode $default + Shift+w exec grimshot --notify save active $save_format, mode $default + Shift+s exec grimshot --notify save screen $save_format, mode $default + Print exec grimshot --notify save screen $save_format, mode $default + + Return mode $default + Escape mode $default +} + +set $mode_preferences "Toggle (d)ark mode, (s)unset, (n)otification" +bindsym $alt+end mode $mode_preferences { + d exec "${SCRIPT_DIR}/toggle-light-dark.sh", mode $default + s exec "${SCRIPT_DIR}/sunset.sh", mode $default + n exec "${SCRIPT_DIR}/do-not-disturb.sh", mode $default + + Return mode $default + Escape mode $default + $alt+end mode $default +} diff --git a/stow/sway/.config/sway/style b/stow/sway/.config/sway/style new file mode 100644 index 0000000..7377b3b --- /dev/null +++ b/stow/sway/.config/sway/style @@ -0,0 +1,31 @@ +# +# ~/.config/sway/style +# Styling for sway +# + +# Decrease the height of the window title bar. +font pango:monospace 0.1 + +bar { + swaybar_command waybar + mode hide +} + +default_border pixel 1 +default_floating_border normal 1 +hide_edge_borders smart +smart_borders on + +# Mimic no titles by setting the text color to background color +# border backgr. text indic. child_border +client.focused #00897b #00897b #00897b #00897b #00897b +client.focused_inactive #a6a6a6 #a6a6a6 #a6a6a6 #a6a6a6 #a6a6a6 +client.unfocused #a6a6a6 #a6a6a6 #a6a6a6 #a6a6a6 #a6a6a6 +client.urgent #ff0000 #ff0000 #ff0000 #ff0000 #ff0000 + +# Configure GTK +exec gsettings set org.gnome.desktop.interface icon-theme 'IcoSystem' +exec gsettings set org.gnome.desktop.interface cursor-theme 'phinger-cursor' +exec gsettings set org.gnome.desktop.interface gtk-theme 'Nordic' + +seat seat0 xcursor_theme phinger-cursors 24