diff --git a/config/alacritty/alacritty.yml b/config/alacritty/alacritty.yml index d3ac779..cd045ea 100644 --- a/config/alacritty/alacritty.yml +++ b/config/alacritty/alacritty.yml @@ -1,7 +1,7 @@ window: opacity: 0.85 font: - size: 8 + size: 12 normal: family: Iosevka Nerd Font style: Regular diff --git a/config/eww/bars/top-bar.scss b/config/eww/bars/top-bar.scss new file mode 100644 index 0000000..65878b8 --- /dev/null +++ b/config/eww/bars/top-bar.scss @@ -0,0 +1,134 @@ +@import './colour-scheme.scss' + +*{ + all: unset; + font-family: Iosevka; + font-size: 16px; +} + +/** Top bar **/ +.top-bar { + padding-left: 16px; + padding-right: 24px; +} + +tooltip.background { + background-color: $base00; + border-radius: 10px; + color: $base07; +} + +tooltip label { + margin: 6px; +} + +.module { + margin: 0px 0px 0px 0px; + border-radius: 0px 0px 0px 0px; + padding-left: 8px; + padding-right: 8px; +} + +.icon { + font-size: 24px; + padding-right: 8px; +} + +.separator { + padding-left: 4px; + padding-right: 4px; + color: $base02; +} + +/** Wifi **/ +.wifi { + color: $base0C; +} + +.wifi-text { + padding-left: 8px; +} + +/** Volume **/ +.volume { + color: $base0A; +} + +.volume-mute { + color: $base04; +} + +.volume-bar { + padding-left: 8px; + highlight { + background-color: $base0A; + border-radius: 10px; + } + trough { + background-color: $base04; + min-height: 10px; + border-radius: 10px; + } +} + +/** Battery **/ +.battery.charging { + color: $base0B; +} + +.battery.discharging { + padding-right: 0px; + color: $base04; +} + +.battery-bar { + padding-left: 8px; + progress { + background-color: $base0B; + border-radius: 10px; + min-height: 10px; + } + trough { + background-color: $base04; + border-radius: 10px; + min-height: 10px; + min-width: 60px; + } +} + +/** Clock **/ +.clock { + color: $base05; +} + +.clock-time { + padding-left: 4px; + padding-right: 4px; +} + +.clock-date { + padding-left: 4px; +} + +.clock-year { + padding-bottom: 8px; + font-size: 75%; +} + +/** Workspaces **/ + +.workspace-entry { + padding-left: 8px; + padding-right: 8px; +} +.workspace-entry.occupied { + color: $base06; +} + +.workspace-entry.empty { + color: $base02; +} + +.workspace-entry.current { + color: $base0C; +} diff --git a/config/eww/bars/top-bar.yuck b/config/eww/bars/top-bar.yuck new file mode 100644 index 0000000..bc31f86 --- /dev/null +++ b/config/eww/bars/top-bar.yuck @@ -0,0 +1,44 @@ +(include "./widgets/common.yuck") + +(include "./widgets/battery.yuck") +(include "./widgets/clock.yuck") +(include "./widgets/volume.yuck") +(include "./widgets/workspaces.yuck") +(include "./widgets/wifi.yuck") + +(defwindow top-bar + :monitor 0 + :geometry (geometry :x "0%" + :y "8px" + :width "100%" + :height "40px" + :anchor "top center") + :stacking "fg" + :exclusive "true" + (box :class "top-bar" + :orientation "h" + :space-evenly "true" + (bar-left) + (bar-center) + (bar-right))) + + +(defwidget bar-left [] + (box :halign "start" + :orientation "h" + (workspaces-module))) + +(defwidget bar-center [] + (box :halign "center" + :orientation "h")) + + +(defwidget bar-right [] + (box :halign "end" + :orientation "h" + :space-evenly "false" + (wifi-module) + (battery-module) + (volume-module) + (sep) + (clock-module))) diff --git a/config/eww/colour-scheme.scss b/config/eww/colour-scheme.scss new file mode 100644 index 0000000..3901c17 --- /dev/null +++ b/config/eww/colour-scheme.scss @@ -0,0 +1,16 @@ +$base00: #1c2735; +$base01: #3e4856; +$base02: #616a76; +$base03: #838c97; +$base04: #a5adb7; +$base05: #c7cfd7; +$base06: #cfd6dd; +$base07: #d8dde3; +$base08: #ec5b5c; +$base09: #667b87; +$base0A: #547f87; +$base0B: #7c7399; +$base0C: #b25b8e; +$base0D: #b75a80; +$base0E: #d4445b; +$base0F: #5d7aa2; diff --git a/config/eww/eww.scss b/config/eww/eww.scss new file mode 100644 index 0000000..88a902c --- /dev/null +++ b/config/eww/eww.scss @@ -0,0 +1 @@ +@import './bars/top-bar.scss' diff --git a/config/eww/eww.yuck b/config/eww/eww.yuck new file mode 100644 index 0000000..440de8e --- /dev/null +++ b/config/eww/eww.yuck @@ -0,0 +1 @@ +(include "./bars/top-bar.yuck") diff --git a/config/eww/scripts/get-active-workspace.sh b/config/eww/scripts/get-active-workspace.sh new file mode 100644 index 0000000..7bb8fe3 --- /dev/null +++ b/config/eww/scripts/get-active-workspace.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' + +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | + stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}' diff --git a/config/eww/scripts/get-volume-info.sh b/config/eww/scripts/get-volume-info.sh new file mode 100644 index 0000000..10bdb00 --- /dev/null +++ b/config/eww/scripts/get-volume-info.sh @@ -0,0 +1,7 @@ +#!/bin/env bash + +amixer sget Master | \ + grep 'Left:' | \ + sed -e 's/[^[]*\[\([0-9]*\)%\][^[]\[\(\w*\)\]/{"volume": \1, "muted": \2}/' \ + -e 's/on/false/' \ + -e 's/off/true/' diff --git a/config/eww/scripts/get-wifi-info.sh b/config/eww/scripts/get-wifi-info.sh new file mode 100644 index 0000000..1a8bd76 --- /dev/null +++ b/config/eww/scripts/get-wifi-info.sh @@ -0,0 +1,8 @@ +#!/bin/env bash + +CONN_INFO=$(nmcli -g in-use,ssid,signal dev wifi list | \ + grep "^*" | \ + sed -e 's/\*:\([^:]*\):\([0-9]*\)/ ,"ssid": "\1", "signal": \2/') +CONNECTED=$([[ -z $CONN_INFO ]] && echo "false" || echo "true") + +echo "{\"connected\": \"$CONNECTED\"$CONN_INFO}" diff --git a/config/eww/scripts/get-workspaces.sh b/config/eww/scripts/get-workspaces.sh new file mode 100644 index 0000000..7ca4a05 --- /dev/null +++ b/config/eww/scripts/get-workspaces.sh @@ -0,0 +1,11 @@ +#!/bin/env bash + +spaces (){ + WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') + seq 1 6 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})' +} + +spaces +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do + spaces +done diff --git a/config/eww/widgets/battery.yuck b/config/eww/widgets/battery.yuck new file mode 100644 index 0000000..8dd825e --- /dev/null +++ b/config/eww/widgets/battery.yuck @@ -0,0 +1,21 @@ +(defvar battery-reveal false) + +(defwidget battery-module [] + (eventbox :onhover "${EWW_CMD} update battery-reveal=true" + :onhoverlost "${EWW_CMD} update battery-reveal=false" + (box :class "module battery ${EWW_BATTERY.BAT0.status == "Discharging" ? "discharging" : "charging"}" + :orientation "h" + :space-evenly "false" + :tooltip "Battery: ${EWW_BATTERY.BAT0.capacity}%" + (label :text {EWW_BATTERY.BAT0.status == "Discharging" ? + EWW_BATTERY.BAT0.capacity < 10 ? "󰂎" : EWW_BATTERY.BAT0.capacity < 30 ? "󱊡" : EWW_BATTERY.BAT0.capacity < 70 ? "󱊢" : "󱊣" : + EWW_BATTERY.BAT0.capacity < 10 ? "󰢟" : EWW_BATTERY.BAT0.capacity < 30 ? "󱊤" : EWW_BATTERY.BAT0.capacity < 70 ? "󱊥" : "󱊦"} + :class "battery icon") + (revealer :transition "slideleft" + :duration "750ms" + :reveal {battery-reveal} + (progress :class "battery-bar" + :orientation "h" + :valign "center" + :width 60 + :value {EWW_BATTERY.BAT0.capacity}))))) diff --git a/config/eww/widgets/clock.yuck b/config/eww/widgets/clock.yuck new file mode 100644 index 0000000..cbc43bc --- /dev/null +++ b/config/eww/widgets/clock.yuck @@ -0,0 +1,26 @@ +(defpoll clock-time :interval "1s" "date +\"%H:%M:%S\"") +(defpoll clock-date :interval "1m" "date +\"%d/%m\"") +(defpoll clock-year :interval "1h" "date +\"%Y\"") +(defvar date-reveal false) + +(defwidget clock-module [] + (eventbox + :onhover "${EWW_CMD} update date-reveal=true" + :onhoverlost "${EWW_CMD} update date-reveal=false" + (box + :class "module clock" + :orientation "h" + :space-evenly "false" + (label + :text clock-time + :class "clock-time") + (revealer + :transition "slideleft" + :duration "750ms" + :reveal {date-reveal} + (box + :orientation "h" + (label :text clock-date + :class "clock-date") + (label :text clock-year + :class "clock-year")))))) diff --git a/config/eww/widgets/common.yuck b/config/eww/widgets/common.yuck new file mode 100644 index 0000000..cf6b842 --- /dev/null +++ b/config/eww/widgets/common.yuck @@ -0,0 +1,3 @@ +(defwidget sep [] + (label :text "|" + :class "separator")) diff --git a/config/eww/widgets/volume.yuck b/config/eww/widgets/volume.yuck new file mode 100644 index 0000000..8d53c9e --- /dev/null +++ b/config/eww/widgets/volume.yuck @@ -0,0 +1,26 @@ +(defpoll vinfo + :initial "{\"volume\": 0, \"muted\": false}" + :interval "1s" + "bash ~/.config/eww/scripts/get-volume-info.sh") +(defvar volume-reveal false) + +(defwidget volume-module [] + (eventbox :onhover "${EWW_CMD} update volume-reveal=true" + :onhoverlost "${EWW_CMD} update volume-reveal=false" + (box :class "module volume" + :orientation "h" + :space-evenly false + :tooltip {vinfo.muted? "muted" : "Volume: ${vinfo.volume}%"} + (label :text {vinfo.muted ? "󰝟" : vinfo.volume < 10 ? "󰕿" : vinfo.volume < 70 ? "󰖀" : "󰕾"} + :class "volume icon ${vinfo.muted ? "volume-mute" : ""}") + (revealer :transition "slideleft" + :duration "750ms" + :reveal {volume-reveal && !vinfo.muted} + (scale :class "volume-bar" + :orientation "h" + :valign "center" + :width 60 + :min 0 + :max 101 + :value {vinfo.volume} + :onchange "amixer sset Master {}% > /dev/null"))))) diff --git a/config/eww/widgets/wifi.yuck b/config/eww/widgets/wifi.yuck new file mode 100644 index 0000000..05ee699 --- /dev/null +++ b/config/eww/widgets/wifi.yuck @@ -0,0 +1,25 @@ +(defvar wifi-reveal false) +(defpoll winfo + :initial "{\"connected\": \"false\"}" + :interval "10s" + "bash ~/.config/eww/scripts/get-wifi-info.sh") + + +(defwidget wifi-module [] + (eventbox :onhover "${EWW_CMD} update wifi-reveal=true" + :onhoverlost "${EWW_CMD} update wifi-reveal=false" + :onclick "$HOME/.config/rofi/menus/wifi/wifi.sh" + (box :class "module wifi" + :orientation "h" + :space-evenly "false" + :tooltip {winfo.connected ? "Signal: ${winfo.signal}%" : "Disconnected"} + (label :text { !winfo.connected ? "󰤭" : + winfo.signal < 25 ? "󰤟" : + winfo.signal < 50 ? "󰤢" : + winfo.signal < 75 ? "󰤥" : "󰤨"} + :class "wifi icon") + (revealer :transition "slideleft" + :duration "750ms" + :reveal {wifi-reveal && winfo.connected} + (label :class "wifi-text" + :text {winfo.connected ? winfo.ssid : "Disconnected"}))))) diff --git a/config/eww/widgets/workspaces.yuck b/config/eww/widgets/workspaces.yuck new file mode 100644 index 0000000..5a9ccd0 --- /dev/null +++ b/config/eww/widgets/workspaces.yuck @@ -0,0 +1,10 @@ +(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces.sh") +(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace.sh") +(defwidget workspaces-module [] + (box :space-evenly true + (label :text "${workspaces}${current_workspace}" + :visible false) + (for workspace in workspaces + (eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" + (box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" + (label :text "${workspace.id == current_workspace ? "" : ""}")))))) diff --git a/data/wallpapers/wallhaven/01.jpg b/data/wallpapers/wallhaven/01.jpg new file mode 100644 index 0000000..26f4308 Binary files /dev/null and b/data/wallpapers/wallhaven/01.jpg differ diff --git a/hosts/reykjavik/default.nix b/hosts/reykjavik/default.nix index d806763..bb253ce 100644 --- a/hosts/reykjavik/default.nix +++ b/hosts/reykjavik/default.nix @@ -3,7 +3,7 @@ with lib; let nix-colors-lib = inputs.nix-colors.lib-contrib { inherit pkgs; }; - wallpaper = ../../data/wallpapers/simple/tarmac.png; + wallpaper = ../../data/wallpapers/globus.jpg; in { imports = [ @@ -70,6 +70,7 @@ in inherit wallpaper; enable = true; laptop = true; + hyprland.enable = true; }; # - Editors and development ------------------ diff --git a/modules/app/alacritty.nix b/modules/app/alacritty.nix index d1fa511..be14779 100644 --- a/modules/app/alacritty.nix +++ b/modules/app/alacritty.nix @@ -3,6 +3,7 @@ let cfg = config.samfelag.modules.app.alacritty; i3Cfg = config.samfelag.modules.desktop.i3; + hyprCfg = config.samfelag.modules.desktop.hyprland; in { options.samfelag.modules.app.alacritty = { @@ -56,5 +57,11 @@ in "${i3Cfg.mod}+Return" = "exec ${pkgs.alacritty}/bin/alacritty"; "${i3Cfg.mod}+Shift+Return" = "exec ${pkgs.alacritty}/bin/alacritty -t floating-term"; }; + + samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [ + "${hyprCfg.mod}, Return, exec, ${pkgs.alacritty}/bin/alacritty" + "${hyprCfg.mod} SHIFT, Return, exec, [float] ${pkgs.alacritty}/bin/alacritty" + ]; + }; } diff --git a/modules/app/firefox.nix b/modules/app/firefox.nix index 4c54f90..fbd812a 100644 --- a/modules/app/firefox.nix +++ b/modules/app/firefox.nix @@ -3,6 +3,7 @@ let cfg = config.samfelag.modules.app.firefox; i3Cfg = config.samfelag.modules.desktop.i3; + hyprCfg = config.samfelag.modules.desktop.hyprland; in { options.samfelag.modules.app.firefox = { @@ -13,10 +14,6 @@ in firefox ]; - samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable { - "${i3Cfg.mod}+Shift+i" = "exec ${pkgs.firefox}/bin/firefox"; - }; - hm.programs.firefox = { enable = true; # extensions = with pkgs.nur.repos.rycee.firefox-addons; [ @@ -30,5 +27,12 @@ in }; }; + samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable { + "${i3Cfg.mod}+Shift+i" = "exec ${pkgs.firefox}/bin/firefox"; + }; + + samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [ + "${hyprCfg.mod} SHIFT, i, exec, ${pkgs.firefox}/bin/firefox" + ]; }; } diff --git a/modules/app/spotify.nix b/modules/app/spotify.nix index 13c78af..320883a 100644 --- a/modules/app/spotify.nix +++ b/modules/app/spotify.nix @@ -3,6 +3,7 @@ let cfg = config.samfelag.modules.app.spotify; i3Cfg = config.samfelag.modules.desktop.i3; + hyprCfg = config.samfelag.modules.desktop.hyprland; in { options.samfelag.modules.app.spotify = { @@ -16,5 +17,9 @@ in samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable { "${i3Cfg.mod}+Shift+m" = "exec ${pkgs.spotify}/bin/spotify"; }; + + samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [ + "${hyprCfg.mod} SHIFT, m, exec, ${pkgs.spotify}/bin/spotify" + ]; }; } diff --git a/modules/desktop/desktop.nix b/modules/desktop/desktop.nix index c336a09..823e07d 100644 --- a/modules/desktop/desktop.nix +++ b/modules/desktop/desktop.nix @@ -53,12 +53,12 @@ in samfelag.modules = { app.alacritty.enable = true; - desktop.rofi.enable = true; - desktop.polybar.enable = true; app.firefox.enable = true; + desktop.rofi.enable = true; + desktop.polybar.enable = true; + desktop.i3 = { - enable = true; laptop = cfg.laptop; extraStartup = [ @@ -71,7 +71,7 @@ in "${cfg.i3.mod}+End" = "exec $HOME/.config/rofi/menus/powermenu/powermenu.sh"; }; }; - }; + }; }; } diff --git a/modules/desktop/eww.nix b/modules/desktop/eww.nix new file mode 100644 index 0000000..d9ab0ea --- /dev/null +++ b/modules/desktop/eww.nix @@ -0,0 +1,56 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.samfelag.modules.desktop.eww; + hyprCfg = config.samfelag.modules.desktop.hyprland; + # Paths + paths = { + }; +in { + + options.samfelag.modules.desktop.eww = { + enable = lib.mkEnableOption "eww"; + }; + + config = lib.mkIf cfg.enable { + + # - Configuration ---------------------------- + + environment.systemPackages = with pkgs; [ + eww-wayland + # Scripts' dependencies + jq + socat + ]; + + hm.xdg.configFile."eww/eww.yuck".source = ../../config/eww/eww.yuck; + hm.xdg.configFile."eww/eww.scss".source = ../../config/eww/eww.scss; + hm.xdg.configFile."eww/bars".source = ../../config/eww/bars; + hm.xdg.configFile."eww/widgets".source = ../../config/eww/widgets; + hm.xdg.configFile."eww/scripts".source = ../../config/eww/scripts; + + # - Themeing --------------------------------- + hm.xdg.configFile."eww/colour-scheme.scss".text = '' + $base00: #${config.colorScheme.palette.base00}; + $base01: #${config.colorScheme.palette.base01}; + $base02: #${config.colorScheme.palette.base02}; + $base03: #${config.colorScheme.palette.base03}; + $base04: #${config.colorScheme.palette.base04}; + $base05: #${config.colorScheme.palette.base05}; + $base06: #${config.colorScheme.palette.base06}; + $base07: #${config.colorScheme.palette.base07}; + $base08: #${config.colorScheme.palette.base08}; + $base09: #${config.colorScheme.palette.base09}; + $base0A: #${config.colorScheme.palette.base0A}; + $base0B: #${config.colorScheme.palette.base0B}; + $base0C: #${config.colorScheme.palette.base0C}; + $base0D: #${config.colorScheme.palette.base0D}; + $base0E: #${config.colorScheme.palette.base0E}; + $base0F: #${config.colorScheme.palette.base0F}; + ''; + + # - Dependencies ----------------------------- + samfelag.modules.desktop.rofi.enable = true; + + }; +} diff --git a/modules/desktop/hyprland.nix b/modules/desktop/hyprland.nix new file mode 100644 index 0000000..f5efe89 --- /dev/null +++ b/modules/desktop/hyprland.nix @@ -0,0 +1,148 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.samfelag.modules.desktop.hyprland; + mod = "Mod4"; +in { + + options.samfelag.modules.desktop.hyprland = with lib; { + enable = mkEnableOption "hyprland window manager"; + + mod = my.mkOpt' types.str "Mod4" "Main modifier key for hyprland"; + + laptop = mkEnableOption "Enable features for a laptop (trackpad, battery, etc...)"; + + extraKeybindings = my.mkOpt (types.listOf types.str) [ ]; + extraStartup = my.mkOpt (types.listOf types.attrs) [ ]; + }; + + config = lib.mkIf cfg.enable { + + environment.systemPackages = with pkgs; [ + # Wallpaper + hyprpaper + ]; + + # - Dependencies ----------------------------- + samfelag.modules.desktop.rofi.enable = true; + samfelag.modules.desktop.eww.enable = true; + + # - Configuration ----------------------------- + + # Hyprpaper + hm.xdg.configFile."hypr/hyprpaper.conf".text = '' + preload = ${config.samfelag.modules.desktop.wallpaper} + wallpaper = ,${config.samfelag.modules.desktop.wallpaper} + ''; + + programs.hyprland = { + enable = true; + xwayland.enable = true; + enableNvidiaPatches = true; + }; + + hm.wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; + enableNvidiaPatches = true; + + package = pkgs.hyprland; + # Optional + # Whether to enable hyprland-session.target on hyprland startup + systemd.enable = true; + + settings = { + input = { + kb_layout = "es"; + }; + + monitor = ",highres,auto,1"; + + exec-once = [ + "hyprpaper" + "eww open top-bar" + ]; + + decoration = { + rounding = 10; + }; + + gestures = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = false; + }; + + bind = [ + + "${cfg.mod}, Q, killactive," + + "${cfg.mod}, F, fullscreen, 1" + "${cfg.mod} SHIFT, F, fullscreen, 0" + + "${cfg.mod} SHIFT, SPACE, togglefloating" + + # Move focus + "${cfg.mod}, left, movefocus, l" + "${cfg.mod}, right, movefocus, r" + "${cfg.mod}, up, movefocus, u" + "${cfg.mod}, down, movefocus, d" + + "${cfg.mod}, h, movefocus, l" + "${cfg.mod}, l, movefocus, r" + "${cfg.mod}, k, movefocus, u" + "${cfg.mod}, j, movefocus, d" + + # Move focus + "${cfg.mod} SHIFT, left, movewindow, l" + "${cfg.mod} SHIFT, right, movewindow, r" + "${cfg.mod} SHIFT, up, movewindow, u" + "${cfg.mod} SHIFT, down, movewindow, d" + + "${cfg.mod} SHIFT, h, movewindow, l" + "${cfg.mod} SHIFT, l, movewindow, r" + "${cfg.mod} SHIFT, k, movewindow, u" + "${cfg.mod} SHIFT, j, movewindow, d" + + # Switch workspace + "${cfg.mod}, 1, workspace, 1" + "${cfg.mod}, 2, workspace, 2" + "${cfg.mod}, 3, workspace, 3" + "${cfg.mod}, 4, workspace, 4" + "${cfg.mod}, 5, workspace, 5" + "${cfg.mod}, 0, workspace, 6" + + # Move to workspace + "${cfg.mod} SHIFT, 1, movetoworkspace, 1" + "${cfg.mod} SHIFT, 2, movetoworkspace, 2" + "${cfg.mod} SHIFT, 3, movetoworkspace, 3" + "${cfg.mod} SHIFT, 4, movetoworkspace, 4" + "${cfg.mod} SHIFT, 5, movetoworkspace, 5" + "${cfg.mod} SHIFT, 0, movetoworkspace, 6" + + # - Media ------------------------------ + + # Pulse Audio controls (mute) + ", XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle" + + # Media player controls + ", XF86AudioPlay, exec, playerctl play-pause" + ", XF86AudioPause, exec, playerctl play-pause" + ", XF86AudioNext, exec, playerctl next" + ", XF86AudioPrev, exec, playerctl previous" + ", XF86AudioStop, exec, playerctl stop" + + ] ++ cfg.extraKeybindings; + + binde = [ + # Pulse Audio controls (volume) + ", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%" + ", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%" + ]; + + bindm = [ + "${cfg.mod}, mouse:272, movewindow" + ]; + }; + }; + }; +} diff --git a/modules/desktop/rofi.nix b/modules/desktop/rofi.nix index 285bcc0..ab047ee 100644 --- a/modules/desktop/rofi.nix +++ b/modules/desktop/rofi.nix @@ -2,6 +2,7 @@ let cfg = config.samfelag.modules.desktop.rofi; + hyprCfg = config.samfelag.modules.desktop.hyprland; nix-colors-lib = inputs.nix-colors.lib-contrib { inherit pkgs; }; in { @@ -34,5 +35,11 @@ in } ''; + samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [ + "${hyprCfg.mod}, SPACE, exec, $HOME/.config/rofi/menus/launcher/launcher.sh" + "${hyprCfg.mod}, END, exec, $HOME/.config/rofi/menus/powermenu/powermenu.sh" + "${hyprCfg.mod} SHIFT, W, exec, $HOME/.config/rofi/menus/wifi/wifi.sh" + ]; + }; } diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 110f4ae..8bcb4e0 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -4,6 +4,7 @@ with lib; let cfg = config.samfelag.modules.editors.emacs; i3Cfg = config.samfelag.modules.desktop.i3; + hyprCfg = config.samfelag.modules.desktop.hyprland; emacsPackages = epkgs: [ epkgs.vterm ]; @@ -106,5 +107,9 @@ in { "${i3Cfg.mod}+Shift+e" = "exec ${emacsWithPackages}/bin/emacs"; }; + samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [ + "${hyprCfg.mod} SHIFT, e, exec, ${emacsWithPackages}/bin/emacs" + ]; + }; } diff --git a/modules/system/pass.nix b/modules/system/pass.nix index 27a5185..75a27a6 100644 --- a/modules/system/pass.nix +++ b/modules/system/pass.nix @@ -2,7 +2,8 @@ let cfg = config.samfelag.modules.system.pass; - desktopCfg = config.samfelag.modules.desktop; + i3Cfg = config.samfelag.modules.desktop.i3; + hyprCfg = config.samfelag.modules.desktop.hyprland; in { options.samfelag.modules.system.pass = { @@ -16,6 +17,7 @@ in hm.programs.rofi.pass = { enable = true; + package = if hyprCfg.enable then pkgs.rofi-pass-wayland else pkgs.rofi-pass; extraConfig = '' default_user="sastrey@gmail.com" default_user2="marc" @@ -34,8 +36,12 @@ in ''; }; - samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf desktopCfg.enable { - "${desktopCfg.i3.mod}+p" = "exec rofi-pass"; + samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable { + "${i3Cfg.mod}+p" = "exec rofi-pass"; }; + + samfelag.modules.desktop.hyprland.extraKeybindings = lib.mkIf hyprCfg.enable [ + "${hyprCfg.mod}, P, exec, rofi-pass" + ]; }; }