From 4540327cb8a2702ba759db1d5346ea7439f6993d Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 7 May 2022 09:24:17 -0400 Subject: [PATCH] basic rofi and more macos cleanup --- flake.nix | 3 +- {modules => hosts}/common.nix | 0 hosts/desktop/hardware-configuration.nix | 4 +- {bin => macos/bin}/biggest | 0 {bin => macos/bin}/biggest-files | 0 {bin => macos/bin}/connect_aws/Dockerfile | 0 .../bin}/connect_aws/connect_cloud.py | 0 .../bin}/connect_aws/connect_cloud.sh | 0 .../bin}/connect_aws/requirements.txt | 0 {bin => macos/bin}/docker_cleanup | 0 {bin => macos/bin}/gh-repos | 0 {bin => macos/bin}/jira-checkout | 0 {bin => macos/bin}/jira-details | 0 {bin => macos/bin}/kube-dashboard | 0 {bin => macos/bin}/newest | 0 {bin => macos/bin}/ocr | 0 {bin => macos/bin}/oldest | 0 {bin => macos/bin}/pod | 0 {bin => macos/bin}/quick-edit | 0 {bin => macos/bin}/symlinks | 0 {bin => macos/bin}/uplink-delete-bucket | 0 {bin => macos/bin}/url-decode | 0 {bin => macos/bin}/weather_cached | 0 modules/desktop/fonts.nix | 17 ++- modules/desktop/i3.nix | 7 +- modules/desktop/picom.nix | 24 ++-- modules/desktop/rofi.nix | 123 ++++++++++++++++++ 27 files changed, 155 insertions(+), 23 deletions(-) rename {modules => hosts}/common.nix (100%) rename {bin => macos/bin}/biggest (100%) rename {bin => macos/bin}/biggest-files (100%) rename {bin => macos/bin}/connect_aws/Dockerfile (100%) rename {bin => macos/bin}/connect_aws/connect_cloud.py (100%) rename {bin => macos/bin}/connect_aws/connect_cloud.sh (100%) rename {bin => macos/bin}/connect_aws/requirements.txt (100%) rename {bin => macos/bin}/docker_cleanup (100%) rename {bin => macos/bin}/gh-repos (100%) rename {bin => macos/bin}/jira-checkout (100%) rename {bin => macos/bin}/jira-details (100%) rename {bin => macos/bin}/kube-dashboard (100%) rename {bin => macos/bin}/newest (100%) rename {bin => macos/bin}/ocr (100%) rename {bin => macos/bin}/oldest (100%) rename {bin => macos/bin}/pod (100%) rename {bin => macos/bin}/quick-edit (100%) rename {bin => macos/bin}/symlinks (100%) rename {bin => macos/bin}/uplink-delete-bucket (100%) rename {bin => macos/bin}/url-decode (100%) rename {bin => macos/bin}/weather_cached (100%) diff --git a/flake.nix b/flake.nix index 32c5a62..99a700d 100644 --- a/flake.nix +++ b/flake.nix @@ -34,10 +34,11 @@ { networking.hostName = "desktop"; gui.enable = true; + gui.compositor.enable = true; } home-manager.nixosModules.home-manager ./hosts/desktop/hardware-configuration.nix - ./modules/common.nix + ./hosts/common.nix ./modules/hardware ./modules/system ./modules/desktop diff --git a/modules/common.nix b/hosts/common.nix similarity index 100% rename from modules/common.nix rename to hosts/common.nix diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix index 11dde11..af59134 100644 --- a/hosts/desktop/hardware-configuration.nix +++ b/hosts/desktop/hardware-configuration.nix @@ -13,12 +13,12 @@ boot.extraModulePackages = [ ]; fileSystems."/" = { - device = "/dev/disk/by-uuid/f0313f58-971a-46e3-9191-909fe5eb7f7e"; + device = "/dev/disk/by-label/nixos"; fsType = "ext4"; }; fileSystems."/boot" = { - device = "/dev/disk/by-uuid/FB26-799C"; + device = "/dev/disk/by-label/boot"; fsType = "vfat"; }; diff --git a/bin/biggest b/macos/bin/biggest similarity index 100% rename from bin/biggest rename to macos/bin/biggest diff --git a/bin/biggest-files b/macos/bin/biggest-files similarity index 100% rename from bin/biggest-files rename to macos/bin/biggest-files diff --git a/bin/connect_aws/Dockerfile b/macos/bin/connect_aws/Dockerfile similarity index 100% rename from bin/connect_aws/Dockerfile rename to macos/bin/connect_aws/Dockerfile diff --git a/bin/connect_aws/connect_cloud.py b/macos/bin/connect_aws/connect_cloud.py similarity index 100% rename from bin/connect_aws/connect_cloud.py rename to macos/bin/connect_aws/connect_cloud.py diff --git a/bin/connect_aws/connect_cloud.sh b/macos/bin/connect_aws/connect_cloud.sh similarity index 100% rename from bin/connect_aws/connect_cloud.sh rename to macos/bin/connect_aws/connect_cloud.sh diff --git a/bin/connect_aws/requirements.txt b/macos/bin/connect_aws/requirements.txt similarity index 100% rename from bin/connect_aws/requirements.txt rename to macos/bin/connect_aws/requirements.txt diff --git a/bin/docker_cleanup b/macos/bin/docker_cleanup similarity index 100% rename from bin/docker_cleanup rename to macos/bin/docker_cleanup diff --git a/bin/gh-repos b/macos/bin/gh-repos similarity index 100% rename from bin/gh-repos rename to macos/bin/gh-repos diff --git a/bin/jira-checkout b/macos/bin/jira-checkout similarity index 100% rename from bin/jira-checkout rename to macos/bin/jira-checkout diff --git a/bin/jira-details b/macos/bin/jira-details similarity index 100% rename from bin/jira-details rename to macos/bin/jira-details diff --git a/bin/kube-dashboard b/macos/bin/kube-dashboard similarity index 100% rename from bin/kube-dashboard rename to macos/bin/kube-dashboard diff --git a/bin/newest b/macos/bin/newest similarity index 100% rename from bin/newest rename to macos/bin/newest diff --git a/bin/ocr b/macos/bin/ocr similarity index 100% rename from bin/ocr rename to macos/bin/ocr diff --git a/bin/oldest b/macos/bin/oldest similarity index 100% rename from bin/oldest rename to macos/bin/oldest diff --git a/bin/pod b/macos/bin/pod similarity index 100% rename from bin/pod rename to macos/bin/pod diff --git a/bin/quick-edit b/macos/bin/quick-edit similarity index 100% rename from bin/quick-edit rename to macos/bin/quick-edit diff --git a/bin/symlinks b/macos/bin/symlinks similarity index 100% rename from bin/symlinks rename to macos/bin/symlinks diff --git a/bin/uplink-delete-bucket b/macos/bin/uplink-delete-bucket similarity index 100% rename from bin/uplink-delete-bucket rename to macos/bin/uplink-delete-bucket diff --git a/bin/url-decode b/macos/bin/url-decode similarity index 100% rename from bin/url-decode rename to macos/bin/url-decode diff --git a/bin/weather_cached b/macos/bin/weather_cached similarity index 100% rename from bin/weather_cached rename to macos/bin/weather_cached diff --git a/modules/desktop/fonts.nix b/modules/desktop/fonts.nix index f0848f4..5e91740 100644 --- a/modules/desktop/fonts.nix +++ b/modules/desktop/fonts.nix @@ -1,4 +1,8 @@ -{ config, pkgs, lib, ... }: { +{ config, pkgs, lib, ... }: + +let fontName = "Victor Mono"; + +in { config = lib.mkIf config.gui.enable { @@ -6,7 +10,16 @@ [ pkgs.victor-mono # Used for Vim and Terminal ]; - fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ]; + fonts.fontconfig.defaultFonts.monospace = [ fontName ]; + + home-manager.users.${config.user} = { + xsession.windowManager.i3.config.fonts = { + names = [ "pango:${fontName}" ]; + # style = "Regular"; + # size = 11.0; + }; + programs.rofi.font = "${fontName} 14"; + }; }; diff --git a/modules/desktop/i3.nix b/modules/desktop/i3.nix index f9c59ff..ecf0cb8 100644 --- a/modules/desktop/i3.nix +++ b/modules/desktop/i3.nix @@ -78,15 +78,10 @@ }; floating.modifier = modifier; focus = { - mouseWarping = false; + mouseWarping = true; newWindow = "urgent"; followMouse = false; }; - fonts = { - names = [ "pango:Victor Mono" "FontAwesome 12" ]; - # style = "Regular"; - # size = 11.0; - }; keybindings = { # PulseAudio adjust volume diff --git a/modules/desktop/picom.nix b/modules/desktop/picom.nix index 4cea3d4..d3bc782 100644 --- a/modules/desktop/picom.nix +++ b/modules/desktop/picom.nix @@ -6,20 +6,20 @@ services.picom = { enable = true; - blur = true; + blur = false; blurExclude = [ ]; # extraOptions = '' # shadow-radius = 20 # ''; - extraOptions = '' - shadow-radius = 20 - corner-radius = 10 - blur-size = 20 - rounded-corners-exclude = [ - "window_type = 'dock'", - "class_g = 'i3-frame'" - ] - ''; + # extraOptions = '' + # shadow-radius = 20 + # corner-radius = 10 + # blur-size = 20 + # rounded-corners-exclude = [ + # "window_type = 'dock'", + # "class_g = 'i3-frame'" + # ] + # ''; fade = false; experimentalBackends = true; inactiveDim = "0.05"; @@ -30,11 +30,11 @@ opacityRule = [ "0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows ]; - shadow = true; + shadow = false; shadowExclude = [ ]; shadowOffsets = [ (-10) (-10) ]; shadowOpacity = "0.5"; - vSync = false; + vSync = true; }; xsession.windowManager.i3.config.startup = [{ diff --git a/modules/desktop/rofi.nix b/modules/desktop/rofi.nix index d7cf388..48c6386 100644 --- a/modules/desktop/rofi.nix +++ b/modules/desktop/rofi.nix @@ -8,7 +8,130 @@ enable = true; cycle = true; location = "center"; + pass = { }; plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ]; + terminal = "${pkgs.alacritty}/bin/alacritty"; + theme = let + inherit (config.home-manager.users.${config.user}.lib.formats.rasi) + mkLiteral; + in { + + # Inspired by https://github.com/sherubthakur/dotfiles/blob/master/users/modules/desktop-environment/rofi/launcher.rasi + + "*" = { + background-color = mkLiteral config.gui.colorscheme.base00; + foreground-color = mkLiteral config.gui.colorscheme.base07; + text-color = mkLiteral config.gui.colorscheme.base07; + border-color = mkLiteral config.gui.colorscheme.base04; + width = 512; + }; + + # Holds the entire window + "#window" = { + transparency = "real"; + background-color = mkLiteral config.gui.colorscheme.base00; + text-color = mkLiteral config.gui.colorscheme.base07; + border = mkLiteral "4px"; + border-color = mkLiteral config.gui.colorscheme.base04; + border-radius = mkLiteral "4px"; + width = mkLiteral "600px"; + x-offset = 10; + y-offset = 40; + padding = mkLiteral "15px"; + }; + + # Wrapper around bar and results + "#mainbox" = { + background-color = mkLiteral config.gui.colorscheme.base00; + border = mkLiteral "0px"; + border-radius = mkLiteral "0px"; + border-color = mkLiteral config.gui.colorscheme.base04; + children = map mkLiteral [ "inputbar" "listview" ]; + spacing = mkLiteral "10px"; + padding = mkLiteral "10px"; + }; + + # Unknown + "#textbox-prompt-colon" = { + expand = false; + str = ":"; + margin = mkLiteral "0px 0.3em 0em 0em"; + text-color = mkLiteral config.gui.colorscheme.base07; + }; + + # Command prompt left of the input + "#prompt" = { enabled = false; }; + + # Actual text box + "#entry" = { + placeholder-color = mkLiteral config.gui.colorscheme.base03; + expand = true; + horizontal-align = "0"; + placeholder = "Search Applications"; + padding = mkLiteral "0px 0px 0px 5px"; + blink = true; + }; + + # Top bar + "#inputbar" = { + children = map mkLiteral [ "prompt" "entry" ]; + border = mkLiteral "1px"; + border-radius = mkLiteral "4px"; + padding = mkLiteral "6px"; + }; + + # Results + "#listview" = { + background-color = mkLiteral config.gui.colorscheme.base00; + padding = mkLiteral "0px"; + columns = 1; + lines = 8; + spacing = "5px"; + cycle = true; + dynamic = true; + layout = "vertical"; + }; + + # Each result + "#element" = { + orientation = "vertical"; + border-radius = mkLiteral "0px"; + padding = mkLiteral "5px 0px 5px 5px"; + }; + "#element.selected" = { + border = mkLiteral "1px"; + border-radius = mkLiteral "4px"; + border-color = mkLiteral config.gui.colorscheme.base07; + background-color = mkLiteral config.gui.colorscheme.base04; + text-color = mkLiteral config.gui.colorscheme.base00; + }; + + "#element-text" = { + expand = true; + # horizontal-align = mkLiteral "0.5"; + vertical-align = mkLiteral "0.5"; + margin = mkLiteral "0px 2.5px 0px 2.5px"; + }; + "#element-text.selected" = { + background-color = mkLiteral config.gui.colorscheme.base04; + text-color = mkLiteral config.gui.colorscheme.base00; + }; + + # Not sure how to get icons + "#element-icon" = { + size = mkLiteral "64px"; + border = mkLiteral "0px"; + background-color = mkLiteral config.gui.colorscheme.base00; + }; + "#element-icon.selected" = { + background-color = mkLiteral config.gui.colorscheme.base04; + text-color = mkLiteral config.gui.colorscheme.base00; + }; + + }; + xoffset = 0; + yoffset = 0; + extraConfig = { kb-cancel = "Escape,Super+space"; }; }; gui.launcherCommand = "${pkgs.rofi}/bin/rofi -show run";