forked from fabian/nix
		
	add sway and xdg config
This commit is contained in:
		
							parent
							
								
									9687235d30
								
							
						
					
					
						commit
						ef8939612e
					
				
					 5 changed files with 144 additions and 0 deletions
				
			
		|  | @ -84,6 +84,7 @@ in { | ||||||
|     ./startx.nix |     ./startx.nix | ||||||
|     ./picom.nix |     ./picom.nix | ||||||
|     ./theme.nix |     ./theme.nix | ||||||
|  |     ./sway.nix | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   config = let |   config = let | ||||||
|  |  | ||||||
							
								
								
									
										109
									
								
								home/modules/gui/sway.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								home/modules/gui/sway.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,109 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | with lib; let | ||||||
|  |   cfg = config.local.gui; | ||||||
|  | in { | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     home.packages = [ | ||||||
|  |       pkgs.wlr-randr | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  |     programs = { | ||||||
|  |       waybar.enable = true; | ||||||
|  | 
 | ||||||
|  |       wofi.enable = true; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     services = { | ||||||
|  |       swayidle = { | ||||||
|  |         enable = true; | ||||||
|  | 
 | ||||||
|  |         timeouts = [ | ||||||
|  |           { | ||||||
|  |             timeout = 600; | ||||||
|  |             command = "${getExe pkgs.gtklock} -d"; | ||||||
|  |           } | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     systemd.user.services.wl-gammarelay-rs = { | ||||||
|  |       Unit.After = ["sway-session.target"]; | ||||||
|  |       Install.WantedBy = ["sway-session.target"]; | ||||||
|  | 
 | ||||||
|  |       Service.ExecStart = getExe pkgs.wl-gammarelay-rs; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     wayland.windowManager.sway = { | ||||||
|  |       enable = true; | ||||||
|  | 
 | ||||||
|  |       config = { | ||||||
|  |         modifier = "Mod4"; | ||||||
|  |         focus.followMouse = true; | ||||||
|  | 
 | ||||||
|  |         fonts = { | ||||||
|  |           size = 11.0; | ||||||
|  |           names = ["DejaVu Sans Mono"]; | ||||||
|  |           style = "Bold Semi-Condensed"; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         bars = singleton { | ||||||
|  |           command = "waybar"; | ||||||
|  |           position = "top"; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         keybindings = let | ||||||
|  |           mod = config.wayland.windowManager.sway.config.modifier; | ||||||
|  |           wofi = config.programs.wofi.package; | ||||||
|  | 
 | ||||||
|  |           grimshot = getExe pkgs.sway-contrib.grimshot; | ||||||
|  |         in | ||||||
|  |           mkOptionDefault { | ||||||
|  |             "${mod}+a" = "focus parent"; | ||||||
|  |             "${mod}+c" = "focus child"; | ||||||
|  |             "${mod}+d" = "exec --no-startup-id ${getExe wofi} -S run"; | ||||||
|  |             "${mod}+i" = "exec busctl --user call rs.wl-gammarelay / rs.wl.gammarelay ToggleInverted"; | ||||||
|  |             "${mod}+o" = "exec ${getExe pkgs.gtklock} -d"; | ||||||
|  |             "${mod}+Return" = "exec ${lib.getExe pkgs.kitty} ${lib.getExe pkgs.tmux}"; | ||||||
|  |             "${mod}+Shift+e" = "input * xkb_layout latam"; | ||||||
|  |             "${mod}+Shift+u" = "input * xkb_layout us"; | ||||||
|  |             "${mod}+p" = "exec ${grimshot} copy active"; | ||||||
|  |             "${mod}+Shift+p" = "exec ${grimshot} copy area"; | ||||||
|  |             "${mod}+Ctrl+p" = "exec ${grimshot} copy window"; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |         window.commands = [ | ||||||
|  |           # (No) Title Bars | ||||||
|  |           { | ||||||
|  |             command = "border pixel 5"; | ||||||
|  |             criteria.class = "^.*"; | ||||||
|  |           } | ||||||
|  | 
 | ||||||
|  |           { | ||||||
|  |             command = "floating enabled"; | ||||||
|  |             criteria.class = "floating"; | ||||||
|  |           } | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       extraSessionCommands = '' | ||||||
|  |         export SDL_VIDEODRIVER=wayland | ||||||
|  |         # needs qt5.qtwayland in systemPackages | ||||||
|  |         export QT_QPA_PLATFORM=wayland | ||||||
|  |         export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" | ||||||
|  |         # Fix for some Java AWT applications (e.g. Android Studio), | ||||||
|  |         # use this if they aren't displayed properly: | ||||||
|  |         export _JAVA_AWT_WM_NONREPARENTING=1 | ||||||
|  |       ''; | ||||||
|  | 
 | ||||||
|  |       swaynag.enable = true; | ||||||
|  |       systemd.enable = true; | ||||||
|  | 
 | ||||||
|  |       xwayland = true; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  | @ -15,5 +15,6 @@ | ||||||
|     ./bluetooth.nix |     ./bluetooth.nix | ||||||
|     ./net.nix |     ./net.nix | ||||||
|     ./steam.nix |     ./steam.nix | ||||||
|  |     ./xdg.nix | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										32
									
								
								sys/modules/xdg.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								sys/modules/xdg.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | with lib; let | ||||||
|  |   cfg = config.local.sys.xdg; | ||||||
|  | in { | ||||||
|  |   options.local.sys.xdg = { | ||||||
|  |     enable = mkEnableOption "xdg settings"; | ||||||
|  |   }; | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     xdg.portal = { | ||||||
|  |       enable = true; | ||||||
|  |       wlr.enable = true; | ||||||
|  |       extraPortals = [pkgs.xdg-desktop-portal-gtk]; | ||||||
|  |       xdgOpenUsePortal = true; | ||||||
|  |       # warning: xdg-desktop-portal 1.17 reworked how portal implementations are loaded, you | ||||||
|  |       # should either set `xdg.portal.config` or `xdg.portal.configPackages` | ||||||
|  |       # to specify which portal backend to use for the requested interface. | ||||||
|  |       # | ||||||
|  |       # https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in | ||||||
|  |       # | ||||||
|  |       # If you simply want to keep the behaviour in < 1.17, which uses the first | ||||||
|  |       # portal implementation found in lexicographical order, use the following: | ||||||
|  |       # | ||||||
|  |       # xdg.portal.config.common.default = "*"; | ||||||
|  |       config.common.default = "*"; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  | @ -20,6 +20,7 @@ | ||||||
|     virtualisation.enable = true; |     virtualisation.enable = true; | ||||||
|     androidSupport.enable = true; |     androidSupport.enable = true; | ||||||
|     steam.enable = true; |     steam.enable = true; | ||||||
|  |     xdg.enable = true; | ||||||
| 
 | 
 | ||||||
|     users = { |     users = { | ||||||
|       fabian = { |       fabian = { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue