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

feat: sway #32

Merged
merged 27 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2b6e087
feat: start adding sway config
datsfilipe Jan 12, 2025
f8bc757
feat: add sway configurations and replacements
datsfilipe Jan 15, 2025
2d3ce9e
docs: add caution note about current broken state of this config
datsfilipe Jan 15, 2025
5e74ac9
chore: add packages for wayland sway
datsfilipe Jan 18, 2025
7902817
feat: update keymaps for sway
datsfilipe Jan 18, 2025
4581b56
feat: add extra options for sway
datsfilipe Jan 18, 2025
abfac33
feat: add options for wayland to nvidia config
datsfilipe Jan 18, 2025
8bf67be
feat: add sway startup and start wallpaper service there
datsfilipe Jan 18, 2025
5872e58
fix: not starting xdg portal because it messes up with my dark mode
datsfilipe Jan 18, 2025
5f16926
refactor: restart wallpaper service on sway startup
datsfilipe Jan 18, 2025
972de82
refactor: remove udiskie tray since not working
datsfilipe Jan 18, 2025
c7b9a61
refactor: use bemenu on sway
datsfilipe Jan 18, 2025
1da6231
feat: remove window titles in sway
datsfilipe Jan 18, 2025
5ec3cfd
feat: export var for java applications
datsfilipe Jan 18, 2025
eeeccc5
refactor: use default wmenu
datsfilipe Jan 18, 2025
78e20ea
chore: add hardware acceleration option although chrome is still buggy
datsfilipe Jan 18, 2025
ef701b9
refactor: add titles back :3
datsfilipe Jan 18, 2025
f08b6ca
feat: add astal for sway bar integration
datsfilipe Jan 19, 2025
3f45f39
fix: flameshot for wayland
datsfilipe Jan 19, 2025
6cc7687
fix: correct sys tray
datsfilipe Jan 19, 2025
18fc2d4
fix: update styles for tray menus
datsfilipe Jan 19, 2025
cfe9f86
feat: add utils
datsfilipe Jan 19, 2025
e880c39
refactor: use config to decide about flameshot package
datsfilipe Jan 19, 2025
9d86807
feat: add udiskie tray back
datsfilipe Jan 19, 2025
1d3aa7c
refactor: update startup apps
datsfilipe Jan 19, 2025
a6dc553
docs: update README
datsfilipe Jan 19, 2025
f592dcd
fix: occupied workspaces
datsfilipe Jan 19, 2025
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
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@
- `nupkgs`: "nix user packages" - using that instead of a nur repo.
- `secrets`: secrets module, using sops for encryption.
- `wallpaper`: wallpaper definition.
- `outputs`: outputs of the dotfiles.
- `outputs`: Contains all the outputs of the dotfiles.
- `scripts`: Contains all the scripts used in the dotfiles.
- `vars`: Contains all the variables used in the dotfiles.
- `outputs`: outputs of the config.
- `scripts`: scripts used in the config.
- `vars`: variables used in the config.

### General slices

Expand Down
22 changes: 22 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
astal = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:aylur/astal/main";
};
datsnvim = {
inputs = {
home-manager.follows = "home-manager";
Expand Down
5 changes: 5 additions & 0 deletions home/linux/gui/base/gtk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@

gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
};

xdg.configFile."gtk-3.0/settings.ini".text = ''
[Settings]
gtk-application-prefer-dark-theme=1
'';
}
32 changes: 27 additions & 5 deletions home/linux/gui/base/misc.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
{
config,
pkgs,
pkgs-unstable,
...
}: {
home.packages = with pkgs; [
telegram-desktop
flameshot
pcmanfm
];
home.packages = with pkgs;
[
telegram-desktop
pcmanfm
(
if config.modules.desktop.sway.enable
then
(flameshot.overrideAttrs (oldAttrs: {
src = pkgs.fetchFromGitHub {
owner = "flameshot-org";
repo = "flameshot";
rev = "3d21e4967b68e9ce80fb2238857aa1bf12c7b905";
sha256 = "sha256-OLRtF/yjHDN+sIbgilBZ6sBZ3FO6K533kFC1L2peugc=";
};
cmakeFlags = [
"-DUSE_WAYLAND_CLIPBOARD=1"
"-DUSE_WAYLAND_GRIM=1"
];
buildInputs = oldAttrs.buildInputs ++ [pkgs.libsForQt5.kguiaddons];
}))
else flameshot
)
]
++ pkgs.lib.optionals config.modules.desktop.sway.enable [
grim
];

fonts.fontconfig.enable = false;
}
42 changes: 42 additions & 0 deletions home/linux/gui/sway/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
pkgs,
config,
lib,
anyrun,
...
} @ args:
with lib; let
cfg = config.modules.desktop.sway;
in {
options.modules.desktop.sway = {
enable = mkEnableOption "sway wm";
settings = lib.mkOption {
type = with lib.types; let
valueType =
nullOr (oneOf [
bool
int
float
str
path
(attrsOf valueType)
(listOf valueType)
])
// {
description = "sway configuration value";
};
in
valueType;
default = {};
};
};

config = mkIf cfg.enable (
mkMerge ([
{
wayland.windowManager.sway.config = cfg.settings;
}
]
++ (import ./values args))
);
}
4 changes: 4 additions & 0 deletions home/linux/gui/sway/values/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{mylib, ...} @ args:
map
(path: import path args)
(mylib.file.scanPaths ./.)
9 changes: 9 additions & 0 deletions home/linux/gui/sway/values/packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{pkgs, ...}: {
home.packages = with pkgs; [
dunst
wl-clipboard
libappindicator-gtk3
networkmanagerapplet
wmenu
];
}
16 changes: 16 additions & 0 deletions home/linux/gui/sway/values/sway.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
lib,
pkgs-unstable,
...
}:
with lib; let
pkg = pkgs-unstable.sway;
in {
wayland.windowManager.sway = {
enable = true;
package = pkg;
extraSessionCommands = ''
export _JAVA_AWT_WM_NONREPARENTING=1
'';
};
}
23 changes: 16 additions & 7 deletions hosts/dtsf-pc/home/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
pkgs,
mypkgs,
lib,
...
}: {
Expand All @@ -8,14 +9,13 @@
modules.desktop.colorscheme.theme = "gruvbox";

modules.desktop = {
i3 = let
sway = let
mod = "Mod4";
alt = "Mod1";
keymaps = import ./keymaps.nix {inherit mod alt pkgs lib;};
command = str: always: {
command = str;
always = always;
notification = false;
};
in {
settings = {
Expand All @@ -24,12 +24,10 @@
keybindings = keymaps.allBindings;

startup = [
(command "dex --autostart --environment i3" true)
(command "xss-lock --transfer-sleep-lock -- i3lock-theme" true)
(command "autorandr --load desktop" true)
(command "udiskie --tray --notify" false)
(command "i3-msg 'workspace 1'" false)
(command "swaymsg 'workspace 1'" false)
(command "dunst -config $HOME/.config/dunstrc" false)
(command "systemctl --user restart wallpaper.service" true)
];

modes = {
Expand All @@ -50,19 +48,26 @@
};
};

window.titlebar = true;
fonts = {
names = ["JetBrainsMono Nerd Font"];
style = "Regular";
size = 8.0;
};

window.titlebar = true;
window.commands = [
{
command = "floating enable, sticky enable";
criteria = {title = "^win";};
}
];

input = {
"1133:16500:Logitech_G305" = {
accel_profile = "flat";
pointer_accel = "0";
};
};
};
};
};
Expand All @@ -76,4 +81,8 @@
AddKeysToAgent yes
'';
};

modules.desktop.nupkgs.packages = with mypkgs; [
astal
];
}
13 changes: 8 additions & 5 deletions hosts/dtsf-pc/home/keymaps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
mod = "Mod4";
alt = "Mod1";
print = "Print";

exit = "-B 'leave' 'exec swaymsg exit && exec loginctl terminate-user $USER'";
turnoff = "-B 'shutdown' 'exec systemctl poweroff'";
reboot = "-B 'reboot' 'exec systemctl reboot'";

workspaceBindings = builtins.listToAttrs (
(map (i: {
name = "${mod}+${toString i}";
Expand All @@ -32,8 +37,8 @@
"${mod}+q" = "kill";
"${mod}+t" = "exec ${pkgs.alacritty}/bin/alacritty";
"${mod}+Return" = "exec ${pkgs.alacritty}/bin/alacritty -e ${pkgs.zellij}/bin/zellij attach dtsf -c";
"${mod}+a" = "exec chromium --wv --force-dark-mode --enable-features=WebUIDarkMode";
"${mod}+d" = "exec $HOME/.local/bin/dmenu-theme";
"${mod}+a" = "exec chromium --wv --force-dark-mode --enable-features=WebUIDarkMode --disable-gpu";
"${mod}+d" = "exec $HOME/.local/bin/launcher";
"${mod}+Shift+m" = "exec shimeji";

"${alt}+k" = "exec $HOME/.local/bin/switch-kb-variant";
Expand Down Expand Up @@ -64,9 +69,7 @@
"${mod}+r" = "mode resize";

"${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "exec i3-msg restart";
"${mod}+Shift+e" = "exec \"i3-nagbar -t warning -m 'leave i3' -B 'exit i3' 'exec i3-msg exit; pkill -15 Xorg'\"";
"${mod}+Shift+o" = "exec \"i3-nagbar -t error -m 'turn off the computer' -B 'turn off' 'systemctl poweroff'\"";
"${mod}+Shift+e" = "exec \"swaynag -t warning -m 'leave, shutdown or reboot?' ${turnoff} ${reboot} ${exit}\"";

"XF86MonBrightnessUp" = "exec --no-startup-id brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec --no-startup-id brightnessctl set 5%-";
Expand Down
25 changes: 25 additions & 0 deletions modules/colorscheme/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
to the user ".local/bin" folder, which should be used instead of i3lock.
'';
};
enableSwayIntegration = lib.mkOption {
type = lib.types.bool;
default = false;
};
enableFishIntegration = lib.mkOption {
type = lib.types.bool;
default = false;
Expand All @@ -66,6 +70,10 @@
type = lib.types.bool;
default = false;
};
enableAstalIntegration = lib.mkOption {
type = lib.types.bool;
default = false;
};
};

config = let
Expand Down Expand Up @@ -104,6 +112,16 @@
})
)

(
lib.mkIf config.modules.desktop.colorscheme.enableSwayIntegration
(import ./integrations/sway.nix {
inherit lib pkgs;
colorscheme = colorscheme;
enableI3StatusIntegration = config.modules.desktop.colorscheme.enableI3StatusIntegration;
enableAstalIntegration = config.modules.desktop.colorscheme.enableAstalIntegration;
})
)

(
lib.mkIf config.modules.desktop.colorscheme.enableDunstIntegration
(import ./integrations/dunst.nix {
Expand Down Expand Up @@ -149,6 +167,13 @@
colorscheme = colorscheme;
})
)

(
lib.mkIf config.modules.desktop.colorscheme.enableAstalIntegration
(import ./integrations/astal.nix {
colorscheme = colorscheme;
})
)
]))
];
}
16 changes: 16 additions & 0 deletions modules/colorscheme/integrations/astal.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{colorscheme, ...}: {
home.file.".local/share/astal/variables.scss".source = builtins.toFile "variables.scss" ''
$primary: ${colorscheme.colors.primary};
$bg: ${colorscheme.colors.bg};
$altbg: ${colorscheme.colors.altbg};
$fg: ${colorscheme.colors.fg};
$black: ${colorscheme.colors.black};
$red: ${colorscheme.colors.red};
$green: ${colorscheme.colors.green};
$yellow: ${colorscheme.colors.yellow};
$blue: ${colorscheme.colors.blue};
$magenta: ${colorscheme.colors.magenta};
$cyan: ${colorscheme.colors.cyan};
$white: ${colorscheme.colors.white};
'';
}
Loading
Loading