Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

desktop: Switch to sway #299

Merged
merged 3 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,13 @@ Then set up:

1. Basic networking. Typically a bond config, see ren/yui for
examples.
2. Hyprland will need some small tweaks, usually these settings need to be twiddled:
```nix
programs.hyprland = {
enableNvidiaPatches = false;
};
```
- If using nvidia, *lots* of things need to be twiddled, look at
the yui config.
3. Make sure to include one of the network modules so that wireless
2. Make sure to include one of the network modules so that wireless
networking is set up on first boot.
4. Generate and include a new `hardware-configuration.nix`:
3. Generate and include a new `hardware-configuration.nix`:
```console
nixos-generate-config --no-filesystems --show-hardware-config
```
5. Set up a new sops target.
4. Set up a new sops target.
1. Firstly, create a new gpg dir according to [these
instructions](https://github.com/Mic92/sops-nix#use-with-gpg-instead-of-ssh-keys).
2. Then, add the generated fingerprint to `.sops.yaml`, and
Expand Down
2 changes: 1 addition & 1 deletion home-config/config/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
./barrier.nix
./dunst.nix
./gtk.nix
./hyprland.nix
./mime.nix
./ncmpcpp.nix
./pipewire.nix
./rofi.nix
./stumpwm.nix
./sway.nix
];

config = lib.mkIf config.custom.desktop-environment {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
config,
lib,
nixos-config ? {},
pkgs,
flake-inputs,
lib,
...
}: let
hyprctl = "${flake-inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.hyprland}/bin/hyprctl";
loginctl = "${pkgs.systemd}/bin/loginctl";
swaymsg = "${nixos-config.programs.sway.package or pkgs.sway}/bin/swaymsg";
systemctl = "${pkgs.systemd}/bin/systemctl";

wpaperd-config = {
default = {
Expand All @@ -26,9 +27,8 @@
libsecret
wl-clipboard
];

text = ''
WINDOW_TITLE="$('${hyprctl}' -j activewindow | jq -r '.title')"
WINDOW_TITLE="$(${swaymsg} --type get_tree | jq -r 'recurse(.nodes[]) | select(.focused) | .app_id // .window_properties.title')"
secret-tool lookup KP2A_URL "title://$WINDOW_TITLE" | wl-copy
# Wait 45 seconds before clearing the clipboard
sleep 45
Expand All @@ -37,36 +37,15 @@
};
in {
config = lib.mkIf config.custom.desktop-environment {
home.packages = with pkgs; [
slurp
grim
home.packages = [
keepassxc-copy
flake-inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.grimblast
];

systemd.user.targets.hyprland-session = {
Unit = {
Description = "Hyprland compositor session";
Documentation = ["man:systemd.special(7)"];
BindsTo = ["graphical-session.target"];
Wants = ["graphical-session-pre.target"];
After = ["graphical-session-pre.target"];
};
};

xdg.configFile."hypr/hyprland.conf" = {
source = ../../dotfiles/hyprland.conf;
onChange = let
inherit (flake-inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}) hyprland;
in ''
( # execute in subshell so that `shopt` won't affect other scripts
shopt -s nullglob # so that nothing is done if /tmp/hypr/ does not exist or is empty
for instance in /tmp/hypr/*; do
HYPRLAND_INSTANCE_SIGNATURE=''${instance##*/} ${hyprland}/bin/hyprctl reload config-only \
|| true # ignore dead instance(s)
done
)
'';
wayland.windowManager.sway = {
enable = true;
package = null;
config = null;
extraConfig = lib.fileContents ../../dotfiles/sway.conf;
};

services.swayidle = {
Expand All @@ -76,14 +55,15 @@ in {
events = [
{
event = "lock";
command = "${config.programs.swaylock.package}/bin/swaylock";
command = "${systemctl} --user start swaylock";
}
];

timeouts = [
{
timeout = 5 * 60;
command = "${hyprctl} dispatch dpms off";
command = "${swaymsg} 'output * power off'";
resumeCommand = "${swaymsg} 'output * power on'";
}
{
timeout = 6 * 60;
Expand All @@ -105,6 +85,11 @@ in {
};
};

systemd.user.services.swaylock = {
Unit.Description = "Lock screen";
Service.ExecStart = "${config.programs.swaylock.package}/bin/swaylock";
};

systemd.user.services.wpaperd = {
Unit = {
Description = "Wallpaper daemon";
Expand Down
5 changes: 0 additions & 5 deletions home-config/config/graphical-applications/firefox.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ in {
userContent =
builtins.readFile "${firefox-ui-fix}/css/leptonContent.css";
settings = {
# Performance settings
"gfx.webrender.all" = true; # Force enable GPU acceleration
"media.ffmpeg.vaapi.enabled" = true;
"widget.dmabuf.force-enabled" = true; # Required in recent Firefoxes

# Re-bind ctrl to super (would interfere with tridactyl otherwise)
"ui.key.accelKey" = 91;

Expand Down
2 changes: 1 addition & 1 deletion home-config/dotfiles/emacs.d/config/features.el
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
"Alternate which-key based indicator.

Hide the which-key indicator immediately when using the
'completing-read' prompter. FN ARGS."
\\='completing-read\\=' prompter. FN ARGS."
(which-key--hide-popup-ignore-command)
(let ((embark-indicators
(remq #'embark-which-key-indicator embark-indicators)))
Expand Down
116 changes: 0 additions & 116 deletions home-config/dotfiles/hyprland.conf

This file was deleted.

70 changes: 70 additions & 0 deletions home-config/dotfiles/sway.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
set $mod Mod4

# Monitors

output "Dell Inc. DELL G2723HN 5B0C3H3" {
mode 1920x1080@164.997Hz
adaptive_sync on
max_render_time 3
}

# Window decorations

corner_radius 10
smart_corner_radius enable
default_border pixel
gaps {
outer 20
inner 5
}

# Keybindings

## Basic applications
bindsym {
$mod+Q exec alacritty
$mod+E exec emacsclient --create-frame --alternate-editor 'emacs'
$mod+R exec rofi -show drun
$mod+L exec keepassxc-copy
}

## Window/desktop management
floating_modifier $mod

bindsym {
$mod+Up focus up
$mod+Right focus right
$mod+Down focus down
$mod+Left focus left

$mod+V floating toggle
$mod+S sticky toggle

$mod+C kill
$mod+M exit
}

## Workspaces
bindsym {
$mod+1 workspace 1
$mod+2 workspace 2
$mod+3 workspace 3
$mod+4 workspace 4
$mod+5 workspace 5
$mod+6 workspace 6
$mod+7 workspace 7
$mod+8 workspace 8
$mod+9 workspace 9
$mod+0 workspace 10

$mod+Shift+1 move container to workspace 1; workspace 1
$mod+Shift+2 move container to workspace 2; workspace 2
$mod+Shift+3 move container to workspace 3; workspace 3
$mod+Shift+4 move container to workspace 4; workspace 4
$mod+Shift+5 move container to workspace 5; workspace 5
$mod+Shift+6 move container to workspace 6; workspace 6
$mod+Shift+7 move container to workspace 7; workspace 7
$mod+Shift+8 move container to workspace 8; workspace 8
$mod+Shift+9 move container to workspace 9; workspace 9
$mod+Shift+0 move container to workspace 10; workspace 10
}
Loading
Loading