diff --git a/modules/base/emacs/default.nix b/modules/base/emacs/default.nix index 24accac9..306857c4 100644 --- a/modules/base/emacs/default.nix +++ b/modules/base/emacs/default.nix @@ -16,7 +16,6 @@ readOnly = true; default = pkgs.emacsWithPackagesFromUsePackage { config = config.chvp.base.emacs.fullConfig; - package = pkgs.emacsPgtk; alwaysEnsure = true; # mu4e is included in the mu package and should be used from there extraEmacsPackages = epkgs: lib.optional config.chvp.graphical.mail.enable pkgs.mu; diff --git a/modules/graphical/sway/color-picker.nix b/modules/graphical/compositor/color-picker.nix similarity index 100% rename from modules/graphical/sway/color-picker.nix rename to modules/graphical/compositor/color-picker.nix diff --git a/modules/graphical/compositor/default.nix b/modules/graphical/compositor/default.nix new file mode 100644 index 00000000..dea3587e --- /dev/null +++ b/modules/graphical/compositor/default.nix @@ -0,0 +1,321 @@ +{ config, lib, pkgs, ... }: + +let + launcher = import ./launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; }; + color-picker = import ./color-picker.nix { inherit pkgs; }; + screenshot = import ./screenshot.nix { inherit pkgs; }; + mic-status = pkgs.writeShellScript "mic-status" '' + if [ "$(${pkgs.pulseaudio}/bin/pactl list sources | grep -o 'Mute: yes')" = "Mute: yes" ] + then + echo -e '\uf131' + else + echo -e '\uf130' + fi + ''; + mail-status = pkgs.writeShellScript "mail-status" '' + mails=$(${pkgs.mblaze}/bin/mlist -N ~/mail/*/INBOX | wc -l) + if [ "$mails" -gt 0 ] + then + echo "{ \"state\": \"Info\", \"text\": \"📬 $mails\" }" + else + echo "{ \"state\": \"Idle\", \"text\": \"📭\" }" + fi + ''; + river-init = pkgs.writeShellScript "river-init" '' + riverctl map normal Super Return spawn footclient + riverctl map normal Super D spawn 'footclient --app-id launcher -- ${launcher}/bin/launcher' + + riverctl map normal Super C spawn ${pkgs.swaylock}/bin/swaylock + + riverctl map normal Super+Shift C close + + riverctl map normal Super+Shift E exit + + riverctl map normal Super J focus-view next + riverctl map normal Super K focus-view previous + + riverctl map normal Super+Shift J swap next + riverctl map normal Super+Shift K swap previous + + riverctl map normal Super H focus-output next + riverctl map normal Super L focus-output previous + + riverctl map normal Super+Shift H send-to-output next + riverctl map normal Super+Shift L send-to-output previous + + riverctl map normal Super F zoom + riverctl map normal Super+Shift F toggle-fullscreen + + riverctl map normal Super+Control H send-layout-cmd rivertile "main-ratio -0.05" + riverctl map normal Super+Control L send-layout-cmd rivertile "main-ratio +0.05" + + riverctl map normal Super+Control+Shift H send-layout-cmd rivertile "main-count +1" + riverctl map normal Super+Control+Shift L send-layout-cmd rivertile "main-count -1" + + riverctl map normal Super+Alt H move left 100 + riverctl map normal Super+Alt J move down 100 + riverctl map normal Super+Alt K move up 100 + riverctl map normal Super+Alt L move right 100 + + riverctl map normal Super+Alt+Control H snap left + riverctl map normal Super+Alt+Control J snap down + riverctl map normal Super+Alt+Control K snap up + riverctl map normal Super+Alt+Control L snap right + + riverctl map normal Super+Alt+Shift H resize horizontal -100 + riverctl map normal Super+Alt+Shift J resize vertical 100 + riverctl map normal Super+Alt+Shift K resize vertical -100 + riverctl map normal Super+Alt+Shift L resize horizontal 100 + + riverctl map normal Super Space toggle-float + + riverctl map-pointer normal Super BTN_LEFT move-view + riverctl map-pointer normal Super BTN_RIGHT resize-view + + for i in $(seq 1 9) + do + tags=$((1 << ($i - 1))) + riverctl map normal Super $i set-focused-tags $tags + riverctl map normal Super+Shift $i set-view-tags $tags + riverctl map normal Super+Control $i toggle-focused-tags $tags + riverctl map normal Super+Shift+Control $i toggle-view-tags $tags + done + + all_tags=$(((1 << 32) - 1)) + riverctl map normal Super 0 set-focused-tags $all_tags + riverctl map normal Super+Shift 0 set-view-tags $all_tags + + riverctl map normal Super Up send-layout-cmd rivertile "main-location top" + riverctl map normal Super Right send-layout-cmd rivertile "main-location right" + riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom" + riverctl map normal Super Left send-layout-cmd rivertile "main-location left" + + riverctl map normal None XF86AudioRaiseVolume spawn '${pkgs.pamixer}/bin/pamixer -i 5' + riverctl map normal None XF86AudioLowerVolume spawn '${pkgs.pamixer}/bin/pamixer -d 5' + riverctl map normal None XF86AudioMute spawn '${pkgs.pamixer}/bin/pamixer --toggle-mute' + + riverctl float-filter-add app-id launcher + riverctl float-filter-add app-id be.ugent.dominion.Main + riverctl float-filter-add title "Quick Format Citation" + + riverctl default-layout rivertile + rivertile -view-padding 0 -outer-padding 0 & + + riverctl attach-mode bottom + riverctl background-color 0x000000 + riverctl border-color-focused 0x6aaeff + riverctl border-color-unfocused 0xf2eff3 + riverctl border-color-urgent 0xff8892 + riverctl border-width 2 + riverctl focus-follows-cursor normal + riverctl hide-cursor when-typing enabled + riverctl set-cursor-warp on-output-change + riverctl xcursor-theme Vanilla-DMZ + + riverctl keyboard-layout -variant altgr-intl -options compose:caps us + + configure_touchpads() { + riverctl list-inputs | grep 'type: pointer' -B 1 | grep -vE 'type: pointer|^--$' | xargs -I '{}' riverctl input '{}' $@ + } + + configure_touchpads drag enabled + configure_touchpads tap enabled + configure_touchpads scroll-method two-finger + + ${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE + systemctl --user start graphical-session.target + ''; +in +{ + options.chvp.graphical.compositor.enable = lib.mkOption { + default = false; + example = true; + }; + + config = lib.mkIf config.chvp.graphical.compositor.enable { + services = { + dbus.packages = with pkgs; [ dconf ]; + greetd = { + enable = true; + settings = + let + wrapped-command = pkgs.writeShellScript "river-run" '' + export XDG_SESSION_TYPE=wayland + export XDG_CURRENT_DESKTOP=river + export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 + export QT_AUTO_SCREEN_SCALE_FACTOR=0 + export QT_SCALE_FACTOR=1 + export GDK_SCALE=1 + export GDK_DPI_SCALE=1 + export MOZ_ENABLE_WAYLAND=1 + export _JAVA_AWT_WM_NONREPARENTING=1 + zsh -c "${pkgs.dbus}/bin/dbus-run-session river" + ''; + in + { + default_session = { + command = "${pkgs.greetd.greetd}/bin/agreety --cmd ${wrapped-command}"; + }; + initial_session = { + command = "${wrapped-command}"; + user = "charlotte"; + }; + }; + }; + }; + security.pam.services.swaylock = { }; + xdg.portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ]; + }; + home-manager.users.charlotte = { pkgs, ... }: { + home.packages = with pkgs; [ + river + color-picker + screenshot + wf-recorder + wl-clipboard + ]; + programs.waybar = { + enable = true; + settings = { + mainBar = { + spacing = 2; + modules-left = [ "river/tags" ]; + modules-center = [ "river/window" ]; + modules-right = [ "idle_inhibitor" "network" "pulseaudio" "mpris" "backlight" "battery" "clock" "tray" ]; + backlight = { + format = "{percent}%"; + }; + battery = { + states = { + good = 95; + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + format-icons = [ "" "" "" "" "" ]; + }; + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + }; + mpris.player = "firefox"; + network = { + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} "; + tooltip-format = "{ifname} via {gwaddr} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + pulseaudio = { + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ "" "" "" ]; + }; + on-click = "pavucontrol"; + }; + tray.spacing = 2; + }; + }; + style = '' + * { + font-family: Hack, monospace; + font-size: 11px; + } + window#waybar { + background-color: #ffffff; + color: #000000; + } + + #tags button { + border-radius: 0; + background-color: #ffffff; + color: #000000; + } + #tags button.occupied { + background-color: #f2eff3; + } + #tags button.focused { + background-color: #6aaeff; + } + #tags button.urgent { + background-color: #ff8892; + } + ''; + systemd.enable = true; + }; + services = { + kanshi = { + enable = true; + systemdTarget = "graphical-session.target"; + profiles = { + "home-undocked" = { + outputs = [ + { criteria = "AU Optronics 0x2036 Unknown"; position = "0,0"; mode = "2560x1440"; scale = 1.0; } + ]; + }; + "home-docked" = { + outputs = [ + { criteria = "AU Optronics 0x2036 Unknown"; position = "0,0"; mode = "2560x1440"; scale = 1.0; } + { criteria = "Dell Inc. DELL U2718Q FN84K01T095L"; position = "2560,0"; mode = "3840x2160"; scale = 1.0; } + ]; + }; + "work-undocked" = { + outputs = [ + { criteria = "LG Display 0x06D6 Unknown"; position = "0,0"; mode = "1920x1080"; scale = 1.0; } + ]; + }; + "work-docked" = { + outputs = [ + { criteria = "LG Display 0x06D6 Unknown"; position = "0,0"; mode = "1920x1080"; scale = 1.0; } + { criteria = "Dell Inc. DELL U2718Q FN84K83Q1KHL"; position = "1920,0"; mode = "3840x2160"; scale = 1.0; } + ]; + }; + }; + }; + mako = { + enable = true; + font = "Hack Regular 9"; + }; + swayidle = { + enable = true; + systemdTarget = "graphical-session.target"; + events = [{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; }]; + timeouts = [ + { timeout = 150; command = "${pkgs.wlopm}/bin/wlopm --off '*'"; resumeCommand = "${pkgs.wlopm}/bin/wlopm --on '*'"; } + { timeout = 300; command = "${pkgs.swaylock}/bin/swaylock -fF"; } + ]; + }; + }; + xdg.configFile."river/init" = { + source = river-init; + onChange = '' + WAYLAND_DISPLAY="$(${pkgs.findutils}/bin/find /run/user/$UID -mindepth 1 -maxdepth 1 -type s -name wayland-\*)" + if [ -S "WAYLAND_DISPLAY" ] + then + ${river-init} + fi + ''; + }; + }; + }; +} diff --git a/modules/graphical/sway/launcher.nix b/modules/graphical/compositor/launcher.nix similarity index 97% rename from modules/graphical/sway/launcher.nix rename to modules/graphical/compositor/launcher.nix index afc067c2..fa014b1e 100644 --- a/modules/graphical/sway/launcher.nix +++ b/modules/graphical/compositor/launcher.nix @@ -9,7 +9,6 @@ let nix pass slurp - sway uni zsh ; diff --git a/modules/graphical/compositor/launcher.zsh b/modules/graphical/compositor/launcher.zsh new file mode 100644 index 00000000..e8d8b944 --- /dev/null +++ b/modules/graphical/compositor/launcher.zsh @@ -0,0 +1,81 @@ +#!@zsh@/bin/zsh + +_sighandler() { + kill -INT "$child" 2>/dev/null +} + +calc_options() { + echo "calc " +} + +calc() { + if [ -n "$1" ] + then + @libqalculate@/bin/qalc "$1" + sleep 5 + else + @libqalculate@/bin/qalc + fi +} + +emoji_options() { + @uni@/bin/uni emoji all | sed "s/^/emoji /" +} + +emoji() { + char=$(echo -n "$1" | sed "s/^\([^ ]*\) .*/\1/") + riverctl spawn "echo -n $char | @wlClipboard@/bin/wl-copy --foreground" +} + +nrun_options() { + echo "nrun " +} + +nrun() { + riverctl spawn "@nix@/bin/nix run nixpkgs\#$1" +} + +pass_options(){ + prefix=${PASSWORD_STORE_DIR-~/.password-store} + password_files=( "$prefix"/**/*.gpg ) + printf 'password %s\n' ${${password_files%.gpg}#$prefix/} + printf 'username %s\n' ${${password_files%.gpg}#$prefix/} + printf 'otp %s\n' ${${password_files%.gpg}#$prefix/} +} + +username() { + riverctl spawn "@pass@/bin/pass show '$@' | sed -n 's/^Username: *//p' | tr -d '\n' | @wlClipboard@/bin/wl-copy --foreground" +} + +password() { + riverctl spawn "@pass@/bin/pass show -c0 '$@'" +} + +otp() { + riverctl spawn "@pass@/bin/pass otp -c '$@'" +} + +run_options() { + print -rl -- ''${(ko)commands} | grep -v "^\\." | sed "s/^/run /" +} + +run() { + riverctl spawn $1 +} + +systemctl_options() { + echo systemctl hibernate + echo systemctl poweroff + echo systemctl reboot + echo systemctl suspend +} + +CHOSEN=$(cat <(systemctl_options) <(pass_options) <(nrun_options) <(run_options) <(calc_options) <(emoji_options) | @fzy@/bin/fzy --lines 80 | tail -n1) + +if [ -n "$CHOSEN" ] +then + PREFIX=$(echo $CHOSEN | sed "s/^\([^ ]*\) .*/\1/g") + WORD=$(echo $CHOSEN | sed "s/^[^ ]* \(.*\)/\1/g") + + $PREFIX $WORD +fi diff --git a/modules/graphical/sway/screenshot.nix b/modules/graphical/compositor/screenshot.nix similarity index 100% rename from modules/graphical/sway/screenshot.nix rename to modules/graphical/compositor/screenshot.nix diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix index 55e9323b..38f9ef68 100644 --- a/modules/graphical/default.nix +++ b/modules/graphical/default.nix @@ -2,12 +2,12 @@ { imports = [ + ./compositor ./firefox ./gnupg ./mail ./pass ./sound - ./sway ./syncthing ./terminal ./theme @@ -26,6 +26,7 @@ nix.unfreePackages = [ "google-chrome" ]; }; graphical = { + compositor.enable = lib.mkDefault true; firefox.enable = lib.mkDefault true; gnupg = { enable = lib.mkDefault true; @@ -34,7 +35,6 @@ mail.enable = lib.mkDefault true; pass.enable = lib.mkDefault true; sound.enable = lib.mkDefault true; - sway.enable = lib.mkDefault true; syncthing.enable = lib.mkDefault true; terminal.enable = lib.mkDefault true; theme.enable = lib.mkDefault true; diff --git a/modules/graphical/sway/default.nix b/modules/graphical/sway/default.nix deleted file mode 100644 index 04aceb45..00000000 --- a/modules/graphical/sway/default.nix +++ /dev/null @@ -1,308 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - launcher = import ./launcher.nix { inherit pkgs; stdenv = pkgs.stdenv; }; - color-picker = import ./color-picker.nix { inherit pkgs; }; - screenshot = import ./screenshot.nix { inherit pkgs; }; - mic-status = pkgs.writeShellScript "mic-status" '' - if [ "$(${pkgs.pulseaudio}/bin/pactl list sources | grep -o 'Mute: yes')" = "Mute: yes" ] - then - echo -e '\uf131' - else - echo -e '\uf130' - fi - ''; - mail-status = pkgs.writeShellScript "mail-status" '' - mails=$(${pkgs.mblaze}/bin/mlist -N ~/mail/*/INBOX | wc -l) - if [ "$mails" -gt 0 ] - then - echo "{ \"state\": \"Info\", \"text\": \"📬 $mails\" }" - else - echo "{ \"state\": \"Idle\", \"text\": \"📭\" }" - fi - ''; -in -{ - options.chvp.graphical.sway.enable = lib.mkOption { - default = false; - example = true; - }; - - config = lib.mkIf config.chvp.graphical.sway.enable { - services = { - dbus.packages = with pkgs; [ dconf ]; - greetd = { - enable = true; - settings = - let - wrapped-command = pkgs.writeShellScript "sway-run" "zsh -c sway"; - in - { - default_session = { - command = "${pkgs.greetd.greetd}/bin/agreety --cmd ${wrapped-command}"; - }; - initial_session = { - command = "${wrapped-command}"; - user = "charlotte"; - }; - }; - }; - }; - security.pam.services.swaylock = { }; - xdg.portal = { - enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ]; - }; - home-manager.users.charlotte = { pkgs, ... }: { - home.packages = with pkgs; [ - color-picker - screenshot - wf-recorder - wl-clipboard - ]; - programs.i3status-rust = { - enable = true; - bars.default = { - settings = { - icons.icons = "awesome6"; - theme = { - theme = "gruvbox-light"; - overrides = { - idle_bg = "#ffffff"; - idle_fg = "#000000"; - info_bg = "#6aaeff"; - info_fg = "#000000"; - good_bg = "#5ada88"; - good_fg = "#000000"; - warning_bg = "#f5df23"; - warning_fg = "#000000"; - critical_bg = "#ff8892"; - critical_fg = "#000000"; - separator = ""; - }; - }; - }; - blocks = [ - { - block = "net"; - device = "wlp2s0"; - format = " $icon {$ssid|No SSID} "; - missing_format = ""; - } - { - block = "net"; - device = "wlp0s20f3"; - format = " $icon {$ssid|No SSID} "; - missing_format = ""; - } - { - block = "net"; - device = "enp0s31f6"; - format = " $icon {$ip|No IP} "; - missing_format = ""; - } - { - block = "net"; - device = "enp0s13f0u2u2"; - format = " $icon {$ip|No IP} "; - missing_format = ""; - } - { - block = "battery"; - } - { - block = "backlight"; - } - { - block = "music"; - player = "firefox"; - format = " $icon $combo.str(w:40) $play $next |"; - } - { - block = "sound"; - } - { - block = "custom"; - command = "${mic-status}"; - interval = 1; - click = [{ - button = "left"; - cmd = "${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"; - update = true; - }]; - } - { - block = "custom"; - json = true; - command = "${mail-status}"; - interval = 1; - click = [{ - button = "left"; - cmd = "mbsync -a && emacsclient --eval \"(mu4e-update-index)\""; - }]; - } - { - block = "time"; - interval = 1; - format = " $icon $timestamp.datetime(f:'%a %d/%m %H:%M') "; - } - ]; - }; - }; - services = { - kanshi = { - enable = true; - profiles = { - "home-undocked" = { - outputs = [ - { criteria = "AU Optronics 0x2036 Unknown"; position = "0,0"; mode = "2560x1440"; scale = 1.0; } - ]; - }; - "home-docked" = { - outputs = [ - { criteria = "AU Optronics 0x2036 Unknown"; position = "0,0"; mode = "2560x1440"; scale = 1.0; } - { criteria = "Dell Inc. DELL U2718Q FN84K01T095L"; position = "2560,0"; mode = "3840x2160"; scale = 1.0; } - ]; - }; - "work-undocked" = { - outputs = [ - { criteria = "LG Display 0x06D6 Unknown"; position = "0,0"; mode = "1920x1080"; scale = 1.0; } - ]; - }; - "work-docked" = { - outputs = [ - { criteria = "LG Display 0x06D6 Unknown"; position = "0,0"; mode = "1920x1080"; scale = 1.0; } - { criteria = "Dell Inc. DELL U2718Q FN84K83Q1KHL"; position = "1920,0"; mode = "3840x2160"; scale = 1.0; } - ]; - }; - }; - }; - mako = { - enable = true; - font = "Hack Regular 9"; - }; - }; - wayland.windowManager.sway = { - enable = true; - config = rec { - modifier = "Mod4"; - left = "h"; - down = "j"; - up = "k"; - right = "l"; - terminal = "${pkgs.foot}/bin/footclient"; - menu = "${terminal} --app-id launcher -- ${launcher}/bin/launcher"; - fonts = { names = [ "Hack" ]; size = 9.0; style = "Regular"; }; - bars = [ - { - colors = { - background = "#ffffff"; - statusline = "#000000"; - activeWorkspace = { border = "#f2eff3"; background = "#f2eff3"; text = "#000000"; }; - focusedWorkspace = { border = "#6aaeff"; background = "#6aaeff"; text = "#000000"; }; - inactiveWorkspace = { border = "#ffffff"; background = "#ffffff"; text = "#000000"; }; - urgentWorkspace = { border = "#ff8892"; background = "#ff8892"; text = "#000000"; }; - }; - fonts = { names = [ "Hack" ]; size = 9.0; style = "Regular"; }; - position = "top"; - statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs $XDG_CONFIG_HOME/i3status-rust/config-default.toml"; - extraConfig = '' - status_padding 0 - icon_theme Arc - ''; - } - ]; - output = { - "Unknown 0x2036 0x00000000" = { position = "0,0"; mode = "2560x1440"; scale = "1.0"; }; - "Dell Inc. DELL U2718Q FN84K01T095L" = { position = "2560,0"; mode = "3840x2160"; scale = "1.0"; }; - "Chimei Innolux Corporation 0x14D3 0x00000000" = { position = "0,0"; mode = "1920x1080"; scale = "1.0"; }; - "Dell Inc. DELL U2718Q FN84K83Q1KHL" = { position = "1920,0"; mode = "3840x2160"; scale = "1.0"; }; - }; - startup = [ - { - command = "${pkgs.swayidle}/bin/swayidle -w timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' timeout 150 '${pkgs.sway}/bin/swaymsg \"output * power off\"' resume '${pkgs.sway}/bin/swaymsg \"output * power on\"' before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000'"; - } - ]; - window.commands = [ - { command = "floating enable"; criteria = { app_id = "launcher"; }; } - { command = "floating enable"; criteria = { title = "Quick Format Citation"; class = "Zotero"; }; } - { command = "floating enable"; criteria = { class = "be.ugent.dominion.Main"; }; } - ]; - input = { - "type:keyboard" = { xkb_layout = "us"; xkb_variant = "altgr-intl"; xkb_numlock = "enabled"; xkb_options = "compose:caps"; }; - "type:touchpad" = { drag = "enabled"; dwt = "enabled"; scroll_method = "two_finger"; tap = "enabled"; }; - }; - modes = { }; # Unset default "resize" mode - keybindings = lib.mkOptionDefault { - "${modifier}+Shift+q" = "nop Unset default kill"; - "${modifier}+r" = "nop Unset default resize mode"; - "${modifier}+Shift+c" = "kill"; - "${modifier}+Shift+r" = "reload"; - "${modifier}+c" = "exec ${pkgs.swaylock}/bin/swaylock -f -c 000000"; - "${modifier}+i" = "inhibit_idle open; border normal; mark --add inhibiting_idle"; - "${modifier}+Shift+i" = "inhibit_idle none; border pixel; unmark inhibiting_idle"; - "Print" = "exec ${screenshot}/bin/screenshot"; - "Alt+Print" = "exec ${screenshot}/bin/screenshot -d"; - "Shift+Print" = "exec ${screenshot}/bin/screenshot -r"; - "Alt+Shift+Print" = "exec ${screenshot}/bin/screenshot -r -d"; - "XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%"; - "XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%"; - "XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; - "XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"; - "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; - "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%"; - "${modifier}+Alt+Left" = "move workspace to output left"; - "${modifier}+Alt+Right" = "move workspace to output right"; - # Invoke default action on top notification. - "${modifier}+n" = "exec ${pkgs.mako}/bin/makoctl invoke"; - "${modifier}+Ctrl+h" = "resize grow width 1 px"; - "${modifier}+Ctrl+j" = "resize shrink height 1 px"; - "${modifier}+Ctrl+k" = "resize grow height 1 px"; - "${modifier}+Ctrl+l" = "resize shrink width 1 px"; - "${modifier}+Ctrl+Shift+h" = "resize grow width 10 px"; - "${modifier}+Ctrl+Shift+j" = "resize shrink height 10 px"; - "${modifier}+Ctrl+Shift+k" = "resize grow height 10 px"; - "${modifier}+Ctrl+Shift+l" = "resize shrink width 10 px"; - }; - }; - extraConfig = '' - workspace 1 output eDP-1 - workspace 2 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 - workspace 3 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 - workspace 4 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 - workspace 5 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 - workspace 6 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 - workspace 7 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 - workspace 8 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 - workspace 9 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1 - - no_focus [title="Microsoft Teams Notification"] - - default_border pixel - - workspace 1 - exec ${config.chvp.graphical.firefox.package}/bin/firefox - '' + (lib.optionalString config.chvp.programs.element.enable '' - workspace 3 - exec ${pkgs.element-desktop}/bin/element-desktop - ''); - extraSessionCommands = '' - export XDG_SESSION_TYPE=wayland - export XDG_CURRENT_DESKTOP=sway - export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 - export QT_AUTO_SCREEN_SCALE_FACTOR=0 - export QT_SCALE_FACTOR=1 - export GDK_SCALE=1 - export GDK_DPI_SCALE=1 - export MOZ_ENABLE_WAYLAND=1 - export _JAVA_AWT_WM_NONREPARENTING=1 - ''; - wrapperFeatures = { - base = true; - gtk = true; - }; - xwayland = true; - }; - }; - }; -} diff --git a/modules/graphical/sway/launcher.zsh b/modules/graphical/sway/launcher.zsh deleted file mode 100644 index ffbd285f..00000000 --- a/modules/graphical/sway/launcher.zsh +++ /dev/null @@ -1,116 +0,0 @@ -#!@zsh@/bin/zsh - -_sighandler() { - kill -INT "$child" 2>/dev/null -} - -calc_options() { - echo "calc " -} - -calc() { - if [ -n "$1" ] - then - @libqalculate@/bin/qalc "$1" - sleep 5 - else - @libqalculate@/bin/qalc - fi -} - -emoji_options() { - @uni@/bin/uni emoji all | sed "s/^/emoji /" -} - -emoji() { - char=$(echo -n "$1" | sed "s/^\([^ ]*\) .*/\1/") - @sway@/bin/swaymsg exec -- "echo -n $char | @wlClipboard@/bin/wl-copy --foreground" -} - -nrun_options() { - echo "nrun " -} - -nrun() { - @sway@/bin/swaymsg exec -- @nix@/bin/nix run nixpkgs\#$1 -} - -pass_options(){ - prefix=${PASSWORD_STORE_DIR-~/.password-store} - password_files=( "$prefix"/**/*.gpg ) - printf 'password %s\n' ${${password_files%.gpg}#$prefix/} - printf 'username %s\n' ${${password_files%.gpg}#$prefix/} - printf 'otp %s\n' ${${password_files%.gpg}#$prefix/} -} - -username() { - swaymsg exec -- "@pass@/bin/pass show '$@' | sed -n 's/^Username: *//p' | tr -d '\n' | @wlClipboard@/bin/wl-copy --foreground" -} -password() { - swaymsg exec -- "@pass@/bin/pass show -c0 '$@'" -} -otp() { - swaymsg exec -- "@pass@/bin/pass otp -c '$@'" -} - -record_options() { - @sway@/bin/swaymsg -t get_outputs | @jq@/bin/jq -r '.[]["name"]' | sed "s/^/record /" - echo record select -} - -record() { - filename="$(@xdgUserDirs@/bin/xdg-user-dir VIDEOS)/$(date +'screenrecording_%y-%m-%d-%H%M%S.mp4')" - - trap _sighandler SIGINT - if [[ "$1" = "select" ]] - then - @wfRecorder@/bin/wf-recorder -g "$(@slurp@/bin/slurp)" -f "$filename" & - else - @wfRecorder@/bin/wf-recorder -o $! -f "$filename" & - fi - child=$! - wait "$child" - # We wait two times, because the first wait exits when the process receives a signal. The process might have finished though, so we ignore errors. - wait "$child" 2>/dev/null - if [ -f "$filename" ] - then - echo "Saved as $filename" - else - echo "Something went wrong while recording" - fi - sleep 5 -} - -run_options() { - print -rl -- ''${(ko)commands} | grep -v "^\\." | sed "s/^/run /" -} - -run() { - @sway@/bin/swaymsg exec $1 -} - -systemctl_options() { - echo systemctl hibernate - echo systemctl poweroff - echo systemctl reboot - echo systemctl suspend -} - -windows_options() { - @sway@/bin/swaymsg -t get_tree | @jq@/bin/jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.layout=="none")|select(.app_id!="launcher")|select(.type=="con"),select(.type=="floating_con")|(if .app_id then .app_id else .window_properties.class end)+": "+.name+" ("+(.id|tostring)+")"' | sed "s/^/windows /" -} - -windows() { - window=$(echo $@ | sed 's/.* (\([^)]*\))$/\1/') - @sway@/bin/swaymsg \[con_id="$window"\] focus -} - -CHOSEN=$(cat <(windows_options) <(systemctl_options) <(pass_options) <(nrun_options) <(run_options) <(record_options) <(calc_options) <(emoji_options) | @fzy@/bin/fzy --lines 80 | tail -n1) - -if [ -n "$CHOSEN" ] -then - PREFIX=$(echo $CHOSEN | sed "s/^\([^ ]*\) .*/\1/g") - WORD=$(echo $CHOSEN | sed "s/^[^ ]* \(.*\)/\1/g") - - $PREFIX $WORD -fi diff --git a/modules/graphical/theme/default.nix b/modules/graphical/theme/default.nix index ca18d407..abac702b 100644 --- a/modules/graphical/theme/default.nix +++ b/modules/graphical/theme/default.nix @@ -40,10 +40,13 @@ Inherits=Vanilla-DMZ ''; }; - dconf.settings."org/gnome/desktop/interface" = { - gtk-theme = "Breeze"; - icon-theme = "breeze"; - cursor-theme = "Vanilla-DMZ"; + dconf.settings = { + "org/gnome/desktop/interface" = { + gtk-theme = "Breeze"; + icon-theme = "breeze"; + cursor-theme = "Vanilla-DMZ"; + }; + "org/gnome/desktop/wm/preferences".button-layout = ""; }; gtk = { enable = true;