wm changes

This commit is contained in:
Bryan Ramos 2024-12-10 21:31:16 -05:00
parent 6bfd5d2047
commit f5bcebf6e7
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8
4 changed files with 137 additions and 107 deletions

View file

@ -204,13 +204,15 @@ in
platformTheme.name = "gtk";
};
xdg.portal = {
xdg = {
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-hyprland
];
config.common.default = "*";
};
};
programs = {
imv.enable = true;

View file

@ -0,0 +1,32 @@
{ pkgs, lib, config, ... }:
let
browser = config.programs;
fileTypes = [
"text/html" "application/pdf" "application/xml"
"image/png" "image/svg+xml" "image/jpg"
"image/jpeg" "image/gif" "image/webp"
"image/avif" "image/bmp" "image/tiff"
];
defaultBrowser = if browser.firefox.enable then
"firefox.desktop"
else if browser.brave.enable then
"brave-browser.desktop"
else if browser.chromium.enable then
"chromium.desktop"
else null;
in
{
xdg.mimeApps = lib.optionalAttrs (defaultBrowser != null && config.xdg.portal.enable) {
enable = true;
defaultApplications = builtins.listToAttrs (
map (type: {
name = type;
value = [ defaultBrowser ];
}) fileTypes
);
};
}

View file

@ -1,100 +0,0 @@
{ config, lib, pkgs, ... }:
let
modifier = config.wayland.windowManager.sway.config.modifier;
wallpaper = builtins.fetchurl {
url = "https://images6.alphacoders.com/117/1174033.png";
sha256 = "1ph5m9s57076jx6042iipqx2ifzadmd5z4lf5l49wgq4jb92mp16";
};
in
{ enable = true;
xwayland = true;
#wrapperFeatures.gtk = true;
extraSessionCommands = ''
export _JAVA_AWT_WM_NONREPARENTING=1
'';
config = {
fonts = {
names = [ "Terminus" ];
};
output = {
HDMI-A-1 = {
resolution = "1920x1080";
position = "0,0";
bg = "${wallpaper} fill";
};
DP-1 = {
resolution = "1920x1080";
position = "1920,0";
bg = "${wallpaper} fill";
};
};
modifier = "Mod1";
menu = "rofi -show drun -show-icons -drun-icon-theme Qogir -font 'Noto Sans 14'";
terminal = "${pkgs.alacritty}/bin/alacritty";
input = {
keyboard = {
xkb_numlock = "enabled";
xkb_layout = "us";
};
pointer = {
accel_profile = "flat";
pointer_accel = "0.65";
};
};
bars = [
{
position = "top";
statusCommand = ''while :; do echo "$(free -h | awk '/^Mem/ {print $3}') '|' $(date +'%I:%M:%S %p') '|' $(date +'%m-%d-%Y')"; sleep 1; done'';
fonts = {
names = [ "Terminus" ];
size = 10.0;
};
colors = {
background = "#0A0E14";
statusline = "#FFFFFF";
};
}
];
gaps = {
smartGaps = false;
inner = 10;
};
floating = {
titlebar = false;
border = 0;
criteria = [
{
title = "Android Emulator";
}
];
};
window = {
titlebar = false;
border= 0;
};
keybindings = lib.mkOptionDefault {
"${modifier}+q" = "kill";
"Print" = "exec grim ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png";
"Shift+Print" = "exec grim -g \"$(slurp)\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png";
"${modifier}+Print" = ''exec sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png' '';
"${modifier}+Shift+f" = "exec alacritty -e sh -c 'EDITOR=nvim ranger'";
"${modifier}+Shift+d" = "exec rofi -modi emoji -show emoji";
};
};
extraConfig = ''
exec_always ${pkgs.autotiling}/bin/autotiling
'';
}

View file

@ -3,11 +3,107 @@
with lib;
let
cfg = config.modules.user.gui.wm.sway;
modifier = config.wayland.windowManager.sway.config.modifier;
wallpaper = builtins.fetchurl {
url = "https://images6.alphacoders.com/117/1174033.png";
sha256 = "1ph5m9s57076jx6042iipqx2ifzadmd5z4lf5l49wgq4jb92mp16";
};
in
{ options.modules.user.gui.wm.sway = { enable = mkEnableOption "user.gui.wm.sway"; };
config = mkIf cfg.enable {
wayland.windowManager.sway = import ./config/sway.nix { inherit pkgs config lib; };
wayland.windowManager.sway = {
enable = true;
xwayland = true;
#wrapperFeatures.gtk = true;
extraSessionCommands = ''
export _JAVA_AWT_WM_NONREPARENTING=1
'';
config = {
fonts = {
names = [ "Terminus" ];
};
output = {
HDMI-A-1 = {
resolution = "1920x1080";
position = "0,0";
bg = "${wallpaper} fill";
};
DP-1 = {
resolution = "1920x1080";
position = "1920,0";
bg = "${wallpaper} fill";
};
};
modifier = "Mod1";
menu = "rofi -show drun -show-icons -drun-icon-theme Qogir -font 'Noto Sans 14'";
terminal = "${pkgs.alacritty}/bin/alacritty";
input = {
keyboard = {
xkb_numlock = "enabled";
xkb_layout = "us";
};
pointer = {
accel_profile = "flat";
pointer_accel = "0.65";
};
};
bars = [
{
position = "top";
statusCommand = ''while :; do echo "$(free -h | awk '/^Mem/ {print $3}') '|' $(date +'%I:%M:%S %p') '|' $(date +'%m-%d-%Y')"; sleep 1; done'';
fonts = {
names = [ "Terminus" ];
size = 10.0;
};
colors = {
background = "#0A0E14";
statusline = "#FFFFFF";
};
}
];
gaps = {
smartGaps = false;
inner = 10;
};
floating = {
titlebar = false;
border = 0;
criteria = [
{
title = "Android Emulator";
}
];
};
window = {
titlebar = false;
border= 0;
};
keybindings = lib.mkOptionDefault {
"${modifier}+q" = "kill";
"Print" = "exec grim ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png";
"Shift+Print" = "exec grim -g \"$(slurp)\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png";
"${modifier}+Print" = ''exec sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png' '';
"${modifier}+Shift+f" = "exec alacritty -e sh -c 'EDITOR=nvim ranger'";
"${modifier}+Shift+d" = "exec rofi -modi emoji -show emoji";
};
};
extraConfig = ''
exec_always ${pkgs.autotiling}/bin/autotiling
'';
};
programs.rofi = import ./config/rofi { inherit pkgs config lib; };
home.file.".config/rofi" = {