diff --git a/modules/home-manager/dav/davsync.nix b/modules/home-manager/dav/davsync.nix deleted file mode 100644 index 75bd3b5..0000000 --- a/modules/home-manager/dav/davsync.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, pkgs, contacts, addressbook, ... }: - -let - shell = "${pkgs.dash}/bin/dash"; - vdirsyncer = "${pkgs.vdirsyncer}/bin/vdirsyncer"; - mkdir = "${pkgs.coreutils}/bin/mkdir"; - cat = "${pkgs.coreutils}/bin/cat"; - abook = "${pkgs.abook}/bin/abook"; - dirname = "${pkgs.coreutils}/bin/dirname"; -in - pkgs.writeScriptBin "davsync" '' - #!${shell} - ${vdirsyncer} discover && \ - ${vdirsyncer} sync && \ - ${mkdir} -p "$(${dirname} ${addressbook})" && \ - ${cat} "${contacts}"/*/*/* | \ - ${abook} \ - --convert \ - --informat vcard \ - --outformat abook > \ - "${config.home.homeDirectory}/.abook/adressbook" - '' diff --git a/modules/home-manager/dav/default.nix b/modules/home-manager/dav/default.nix index dc85d15..87ca197 100644 --- a/modules/home-manager/dav/default.nix +++ b/modules/home-manager/dav/default.nix @@ -12,7 +12,7 @@ let in { - home.packages = [ davsync pkgs.vdirsyncer pkgs.khal pkgs.khard pkgs.abook ]; + home.packages = with pkgs; [ dav-sync vdirsyncer khal khard abook ]; home.file.".config/vdirsyncer/config".text = '' [general] diff --git a/modules/home-manager/desktop-xmonad/autorandr/capibara.nix b/modules/home-manager/desktop-xmonad/autorandr/capibara.nix deleted file mode 100644 index b4fac26..0000000 --- a/modules/home-manager/desktop-xmonad/autorandr/capibara.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, pkgs, ... }: - -let - ext_monitor_fingerprint = - "00ffffffffffff0009d1e67845540000261d0103803c22782e4825a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c450056502100001e000000ff004c394b30303333313031510a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323738300a200117020322f14f901f04130312021101140607151605230907078301000065030c001000023a801871382d40582c450056502100001f011d8018711c1620582c250056502100009f011d007251d01e206e28550056502100001e8c0ad08a20e02d10103e960056502100001800000000000000000000000000000000000000000047"; - lvds_fingerprint = - "00ffffffffffff0030e4d8020000000000160103801c1078ea8855995b558f261d505400000001010101010101010101010101010101601d56d85000183030404700159c1000001b000000000000000000000000000000000000000000fe004c4720446973706c61790a2020000000fe004c503132355748322d534c42330059"; - lvds_config = { - enable = true; - crtc = 0; - mode = "1366x768"; - position = "0x0"; - rate = "60.00"; - }; - hdmi_config = { - enable = true; - primary = true; - crtc = 0; - mode = "1920x1080"; - position = "0x0"; - rate = "60.00"; - }; -in { - imports = [ ./common.nix ]; - programs.autorandr.profiles = { - - default = { - fingerprint."LVDS-1" = lvds_fingerprint; - config."LVDS-1" = lvds_config; - }; - - docked = { - fingerprint = { - "HDMI-2" = ext_monitor_fingerprint; - "LVDS-1" = lvds_fingerprint; - }; - config = { - "LVDS-1" = lvds_config // { position = "1920x0"; }; - "HDMI-2" = hdmi_config; - }; - }; - docked_closed = { - fingerprint."HDMI-2" = ext_monitor_fingerprint; - config."HDMI-2" = hdmi_config; - }; - - }; -} diff --git a/modules/home-manager/desktop-xmonad/autorandr/common.nix b/modules/home-manager/desktop-xmonad/autorandr/common.nix deleted file mode 100644 index 70db164..0000000 --- a/modules/home-manager/desktop-xmonad/autorandr/common.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.autorandr = { - enable = true; - hooks.postswitch = { - "change-background" = - "/run/current-system/sw/bin/systemctl --user restart random-background.service"; - "restart-xmonad" = "${pkgs.xmonad-with-packages}/bin/xmonad --restart"; - }; - }; -} diff --git a/modules/home-manager/desktop-xmonad/autorandr/trantor.nix b/modules/home-manager/desktop-xmonad/autorandr/trantor.nix deleted file mode 100644 index 8ec3e1f..0000000 --- a/modules/home-manager/desktop-xmonad/autorandr/trantor.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ config, pkgs, ... }: - -let - ext_monitor_fingerprint = - "00ffffffffffff0009d1e67845540000261d0103803c22782e4825a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c450056502100001e000000ff004c394b30303333313031510a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323738300a200117020322f14f901f04130312021101140607151605230907078301000065030c001000023a801871382d40582c450056502100001f011d8018711c1620582c250056502100009f011d007251d01e206e28550056502100001e8c0ad08a20e02d10103e960056502100001800000000000000000000000000000000000000000047"; - edp_fingerprint = - "00ffffffffffff0030e46e040000000000180104a52615780a0bb5a35955a0270c5054000000010101010101010101010101010101012e3680a070381f40302035007ed71000001b1f2480a070381f40302035007ed71000001b00000000000000000000000000000000000000000002000a30ff0a3c96191d4896000000003f"; - edp_config = { - enable = true; - crtc = 0; - # mode = "1368x768"; - mode = "1920x1080"; - # position = "1920x0"; - position = "0x0"; - rate = "60.00"; - # rotate = "left"; - }; - hdmi_config = { - enable = true; - primary = true; - crtc = 0; - mode = "1920x1080"; - position = "0x0"; - rate = "60.00"; - }; -in { - imports = [ ./common.nix ]; - programs.autorandr.profiles = { - - default = { - fingerprint = { - "HDMI-1-1" = ext_monitor_fingerprint; - "eDP-1-1" = edp_fingerprint; - }; - config = { - "HDMI-1-1" = hdmi_config; - "eDP-1-1" = edp_config; - }; - }; - - default_intel = { - fingerprint = { - "HDMI-1" = ext_monitor_fingerprint; - "eDP-1" = edp_fingerprint; - }; - config = { - "HDMI-1" = hdmi_config; - "eDP-1" = edp_config; - }; - }; - - nomonitor_intel = { - fingerprint."eDP-1" = edp_fingerprint; - config."eDP-1" = edp_config // { position = "0x0"; }; - }; - onlymonitor_intel = { - fingerprint = { "HDMI-1" = ext_monitor_fingerprint; }; - config = { "HDMI-1" = hdmi_config; }; - }; - nomonitor_nvidia = { - fingerprint."eDP-1-1" = edp_fingerprint; - config."eDP-1-1" = edp_config // { position = "0x0"; }; - }; - onlymonitor_nvidia = { - fingerprint = { "HDMI-1-1" = ext_monitor_fingerprint; }; - config = { "HDMI-1-1" = hdmi_config; }; - }; - }; -} diff --git a/modules/home-manager/desktop-xmonad/capibara.nix b/modules/home-manager/desktop-xmonad/capibara.nix deleted file mode 100644 index e1a8d36..0000000 --- a/modules/home-manager/desktop-xmonad/capibara.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, pkgs, ... }: - -let - desktopConfig = import ./desktop_config.nix { - config = config; - pkgs = pkgs; - }; -in desktopConfig // { - imports = [ ./common.nix ./autorandr/capibara.nix ]; - home.file.".xinitrc".text = '' - exec ${config.home.homeDirectory}/.xsession - ''; - - services.picom = { - enable = true; - fade = false; - shadow = true; - shadowExclude = [ "name ~= 'stalonetray'" ]; - vSync = true; - }; -} diff --git a/modules/home-manager/desktop-xmonad/common.nix b/modules/home-manager/desktop-xmonad/common.nix deleted file mode 100644 index 4b0408c..0000000 --- a/modules/home-manager/desktop-xmonad/common.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ config, pkgs, ... }: - -let - obtoxmd = pkgs.callPackage ./obtoxmd.nix { inherit config pkgs; }; -in { - imports = [ ./rofi.nix ./misc.nix ]; - home = { - keyboard = { - layout = "us"; - options = [ "caps:escape" ]; - variant = "altgr-intl"; - }; - packages = [ obtoxmd pkgs.openbox pkgs.xsel ]; - file = { - ".xmonad/icons/3cols.xpm".source = ./icons/3cols.xpm; - ".xmonad/icons/float.xpm".source = ./icons/float.xpm; - ".xmonad/icons/full.xpm".source = ./icons/full.xpm; - ".xmonad/icons/grid.xpm".source = ./icons/grid.xpm; - ".xmonad/icons/mtall.xpm".source = ./icons/mtall.xpm; - ".xmonad/icons/tabs.xpm".source = ./icons/tabs.xpm; - ".xmonad/icons/tall.xpm".source = ./icons/tall.xpm; - }; - }; - - xsession = { - enable = true; - initExtra = '' - xset s off -dpms - ${pkgs.autorandr}/bin/autorandr --change --default default - export WINIT_X11_SCALE_FACTOR=1.33 - ''; - }; - - services.stalonetray = { - enable = true; - config = { - icon_size = 16; - background = "#282828"; # todo - sticky = true; - geometry = "3x1-350+0"; - icon_gravity = "E"; - grow_gravity = "E"; - }; - }; - - programs.zsh.loginExtra = '' - [[ -z "''${DISPLAY}" ]] && [[ "$(tty)" = "/dev/tty1" ]] && \ - exec "${pkgs.xorg.xinit}/bin/startx" 1> "${config.home.homeDirectory}/.xsession-errors" 2>&1 - ''; - -} diff --git a/modules/home-manager/desktop-xmonad/desktop_config.nix b/modules/home-manager/desktop-xmonad/desktop_config.nix deleted file mode 100644 index e93bf75..0000000 --- a/modules/home-manager/desktop-xmonad/desktop_config.nix +++ /dev/null @@ -1,249 +0,0 @@ -{ config, pkgs, fontSize ? "10", monoFontSize ? "9", ... }: - -let - gruvbox-dark = { - bg = "#282828"; - bg1 = "#3c3836"; - bg2 = "#504945"; - - fg = "#ebdbb2"; - fg0 = "#fbf1c7"; - fg3 = "#bdae93"; - - red = "#cc241d"; - green = "#98971a"; - yellow = "#d79921"; - blue = "#458588"; - purple = "#b16286"; - aqua = "#689d6a"; - gray = "#a89984"; - - gray2 = "#928374"; - red-light = "#fb4934"; - green-light = "#b8bb26"; - yellow-light = "#fabd2f"; - blue-light = "#83a598"; - purple-light = "#d3869b"; - aqua-light = "#8ec07c"; - - }; - colors = { - fg = gruvbox-dark.fg; - selFg = gruvbox-dark.fg0; - bg = gruvbox-dark.bg; - sel = gruvbox-dark.blue; - inactive = gruvbox-dark.gray; - inactiveBorder = gruvbox-dark.bg2; - urgent = gruvbox-dark.red; - }; - rofiTransparency = "96"; - font = { - name = "Inter"; - size = fontSize; - }; - monoFont = { - name = "Hack"; - size = monoFontSize; - }; - - hmonitors = pkgs.haskellPackages.callPackage ./hmonitors.nix { }; - - hmonitorsQuery = "${hmonitors}/bin/hmonitors-query"; - acpi = "${pkgs.acpi}/bin/acpi"; - nmcli = "${pkgs.networkmanager}/bin/nmcli"; - pamixer = "${pkgs.pamixer}/bin/pamixer"; - -in { - - xsession.windowManager.xmonad = { - enable = true; - enableContribAndExtras = true; - extraPackages = haskellPackages: [ - haskellPackages.monad-logger - haskellPackages.dbus - ]; - config = ./xmonad/xmonad.hs; - libFiles = { - "Bindings.hs" = ./xmonad/lib/Bindings.hs; - "DefaultConfig.hs" = ./xmonad/lib/DefaultConfig.hs; - "Layouts.hs" = ./xmonad/lib/Layouts.hs; - "ManageHook.hs" = ./xmonad/lib/ManageHook.hs; - "Prompts.hs" = ./xmonad/lib/Prompts.hs; - "Utils.hs" = ./xmonad/lib/Utils.hs; - "Xmobar.hs" = ./xmonad/lib/Xmobar.hs; - "HostConfig.hs" = pkgs.writeText "HostConfig.hs" '' - module HostConfig - ( fontConfig - , colorConfig - , FontConfig (FontConfig) - , fontSize - , fontName - , ColorConfig (ColorConfig) - , fgColor - , selFgColor - , bgColor - , selColor - , inactiveColor - , inactiveBorderColor - , urgentColor - ) where - - fontConfig :: FontConfig - fontConfig = FontConfig - { fontSize = ${font.size} - , fontName = "${font.name}" - } - - colorConfig :: ColorConfig - colorConfig = ColorConfig - { fgColor = "${colors.fg}" - , selFgColor = "${colors.selFg}" - , bgColor = "${colors.bg}" - , selColor = "${colors.sel}" - , inactiveColor = "${colors.inactive}" - , inactiveBorderColor = "${colors.inactiveBorder}" - , urgentColor = "${colors.urgent}" - } - - data FontConfig = FontConfig - { fontSize :: Int - , fontName :: String - } deriving Show - - data ColorConfig = ColorConfig - { fgColor :: String - , selFgColor :: String - , bgColor :: String - , selColor :: String - , inactiveColor :: String - , inactiveBorderColor :: String - , urgentColor :: String - } deriving Show - ''; - }; - }; - - programs.xmobar = { - enable = true; - extraConfig = '' - Config - { font = "${font.name} ${font.size}" - , additionalFonts = ["mplus Nerd Font 12"] - , bgColor = "${colors.bg}" - , fgColor = "${colors.fg}" - , alignSep = "}{" - , sepChar = "%" - , template = "%StdinReader% }{ %vol%%bat%%net%%date%" - , lowerOnStart = True - , hideOnStart = False - , persistent = True - , allDesktops = True - , position = TopW L 100 - , commands = - [ Run Com "${hmonitorsQuery}" ["date"] "date" 10 - , Run Com "${hmonitorsQuery}" ["bat"] "bat" 10 - -- , Run Com "${hmonitorsQuery}" ["net"] "net" 20 - , Run Com "${hmonitorsQuery}" ["vol"] "vol" 5 - , Run StdinReader - ] - } - , wmClass = "xmobar" - , wmName = "xmobar" - , border = NoBorder - , borderColor = "${colors.bg}" - , pickBroadest = False - , alpha = 255 - , iconRoot = "." - ''; - }; - - services.dunst = { - enable = true; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme; - }; - settings = { - global = { - font = "${font.name} ${font.size}"; - format = "%s\\n%b"; - sort = "yes"; - indicate_hidden = "yes"; - alignment = "left"; - bounce_freq = 0; - show_age_threshold = 60; - word_wrap = "yes"; - ignore_newline = "no"; - geometry = "300x5-30+20"; - shrink = "yes"; - transparency = 0; - idle_threshold = 10; - monitor = 0; - follow = "mouse"; - sticky_history = "yes"; - history_length = 20; - show_indicators = "yes"; - line_height = 0; - separator_height = 2; - padding = 8; - horizontal_padding = 8; - separator_color = "frame"; - startup_notification = false; - dmenu = "${pkgs.rofi}/bin/rofi -dmenu -p dunst:"; - browser = "${pkgs.firefox}/bin/firefox"; - icon_position = "left"; - frame_width = 0; - frame_color = colors.inactive; - }; - shortcuts = { - close = "ctrl+space"; - close_all = "ctrl+shift+space"; - context = "ctrl+shift+period"; - }; - urgency_low = { - background = "${colors.bg}${rofiTransparency}"; - foreground = colors.fg; - timeout = 10; - }; - urgency_normal = { - background = "${colors.sel}${rofiTransparency}"; - foreground = colors.selFg; - timeout = 10; - }; - urgency_critical = { - background = "${colors.urgent}${rofiTransparency}"; - foreground = colors.selFg; - timeout = 10; - }; - }; - }; - - programs.zathura = { - enable = true; - options = { - font = "${monoFont.name} ${monoFont.size}"; - default-bg = colors.bg; - default-fg = gruvbox-dark.bg1; - statusbar-fg = gruvbox-dark.fg3; - statusbar-bg = gruvbox-dark.bg2; - inputbar-bg = colors.bg; - inputbar-fg = colors.sel; - notification-bg = colors.bg; - notification-fg = colors.sel; - notification-error-bg = colors.bg; - notification-error-fg = gruvbox-dark.red-light; - notification-warning-bg = colors.bg; - notification-warning-fg = gruvbox-dark.red-light; - highlight-color = gruvbox-dark.yellow-light; - highlight-active-color = gruvbox-dark.blue-light; - completion-bg = gruvbox-dark.bg1; - completion-fg = gruvbox-dark.blue-light; - completion-highlight-fg = colors.selFg; - completion-highlight-bg = gruvbox-dark.blue-light; - recolor-lightcolor = colors.bg; - recolor-darkcolor = colors.fg; - recolor = false; - recolor-keephue = false; - }; - }; -} diff --git a/modules/home-manager/desktop-xmonad/hmonitors.nix b/modules/home-manager/desktop-xmonad/hmonitors.nix deleted file mode 100644 index eefe817..0000000 --- a/modules/home-manager/desktop-xmonad/hmonitors.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ mkDerivation, base, containers, lib, process, regex-compat, split, time }: -mkDerivation { - pname = "hmonitors"; - version = "0.1.0.0"; - src = builtins.fetchGit { - name = "hmonitors"; - url = "https://git.monotremata.xyz/rilla/hmonitors.git"; - ref = "main"; - rev = "a17f3f0e273b44c021d42c68f186fe1ae4149102"; - }; - isLibrary = true; - isExecutable = true; - libraryHaskellDepends = [ base containers process regex-compat split time ]; - executableHaskellDepends = [ base ]; - license = lib.licenses.bsd3; -} diff --git a/modules/home-manager/desktop-xmonad/icons/3cols.xpm b/modules/home-manager/desktop-xmonad/icons/3cols.xpm deleted file mode 100644 index 7b2b68a..0000000 --- a/modules/home-manager/desktop-xmonad/icons/3cols.xpm +++ /dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static char *_cols[] = { -/* columns rows colors chars-per-pixel */ -"16 16 2 1 ", -" c #EBDBB2", -". c None", -/* pixels */ -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. " -}; diff --git a/modules/home-manager/desktop-xmonad/icons/float.xpm b/modules/home-manager/desktop-xmonad/icons/float.xpm deleted file mode 100644 index fa47c61..0000000 --- a/modules/home-manager/desktop-xmonad/icons/float.xpm +++ /dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static char *float[] = { -/* columns rows colors chars-per-pixel */ -"16 16 2 1 ", -" c #EBDBB2", -". c None", -/* pixels */ -".. ", -".. ", -".. ", -".. ", -".. ", -".. ", -".. ", -"......... ", -"......... ", -" .. ", -" .. ", -" .. ", -" .. ", -" .. ", -" .........", -" ........." -}; diff --git a/modules/home-manager/desktop-xmonad/icons/full.xpm b/modules/home-manager/desktop-xmonad/icons/full.xpm deleted file mode 100644 index 1ec7edb..0000000 --- a/modules/home-manager/desktop-xmonad/icons/full.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char *full[] = { -/* columns rows colors chars-per-pixel */ -"16 16 1 1 ", -" c #EBDBB2", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/modules/home-manager/desktop-xmonad/icons/grid.xpm b/modules/home-manager/desktop-xmonad/icons/grid.xpm deleted file mode 100644 index b744afb..0000000 --- a/modules/home-manager/desktop-xmonad/icons/grid.xpm +++ /dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static char *grid[] = { -/* columns rows colors chars-per-pixel */ -"16 16 2 1 ", -" c #EBDBB2", -". c None", -/* pixels */ -" .. ", -" .. ", -" .. ", -" .. ", -" .. ", -" .. ", -" .. ", -"................", -"................", -" .. ", -" .. ", -" .. ", -" .. ", -" .. ", -" .. ", -" .. " -}; diff --git a/modules/home-manager/desktop-xmonad/icons/mtall.xpm b/modules/home-manager/desktop-xmonad/icons/mtall.xpm deleted file mode 100644 index 058fe7a..0000000 --- a/modules/home-manager/desktop-xmonad/icons/mtall.xpm +++ /dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static char *mtall[] = { -/* columns rows colors chars-per-pixel */ -"16 16 2 1 ", -" c #EBDBB2", -". c None", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -"................", -"................", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. ", -" .. .. " -}; diff --git a/modules/home-manager/desktop-xmonad/icons/tabs.xpm b/modules/home-manager/desktop-xmonad/icons/tabs.xpm deleted file mode 100644 index 88e1faf..0000000 --- a/modules/home-manager/desktop-xmonad/icons/tabs.xpm +++ /dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static char *tabs[] = { -/* columns rows colors chars-per-pixel */ -"16 16 2 1 ", -" c #EBDBB2", -". c None", -/* pixels */ -" ", -" .............. ", -" ", -"................", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/modules/home-manager/desktop-xmonad/icons/tall.xpm b/modules/home-manager/desktop-xmonad/icons/tall.xpm deleted file mode 100644 index 3c5cd01..0000000 --- a/modules/home-manager/desktop-xmonad/icons/tall.xpm +++ /dev/null @@ -1,24 +0,0 @@ -/* XPM */ -static char *tall[] = { -/* columns rows colors chars-per-pixel */ -"16 16 2 1 ", -" c #EBDBB2", -". c None", -/* pixels */ -" .. ", -" .. ", -" .. ", -" .. ", -" .........", -" .........", -" .. ", -" .. ", -" .. ", -" .. ", -" .........", -" .........", -" .. ", -" .. ", -" .. ", -" .. " -}; diff --git a/modules/home-manager/desktop-xmonad/misc.nix b/modules/home-manager/desktop-xmonad/misc.nix deleted file mode 100644 index b240f5e..0000000 --- a/modules/home-manager/desktop-xmonad/misc.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, pkgs, ... }: - -let wallpapers = "${config.home.homeDirectory}/Images/wallpapers/enabled"; -in { - services.random-background = { - enable = true; - enableXinerama = true; - display = "fill"; - imageDirectory = wallpapers; - }; - - systemd.user.services.xbanish = { - Unit = { - Description = "Xbanish"; - After = [ "graphical-session-pre.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - Service = { - Type = "simple"; - ExecStart = "${pkgs.xbanish}/bin/xbanish"; - }; - Install = { WantedBy = [ "graphical-session.target" ]; }; - }; -} diff --git a/modules/home-manager/desktop-xmonad/obtoxmd.nix b/modules/home-manager/desktop-xmonad/obtoxmd.nix deleted file mode 100644 index bb71639..0000000 --- a/modules/home-manager/desktop-xmonad/obtoxmd.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, pkgs, ...}: - -let - shell = "${pkgs.dash}/bin/dash"; - xmonad = "${pkgs.haskellPackages.xmonad}/bin/xmonad"; - openbox = "${pkgs.openbox}/bin/openbox"; -in - pkgs.writeScriptBin "obtoxmd" '' - #!${shell} - ${openbox} - ${xmonad} - '' diff --git a/modules/home-manager/desktop-xmonad/rofi.nix b/modules/home-manager/desktop-xmonad/rofi.nix deleted file mode 100644 index 6196fb1..0000000 --- a/modules/home-manager/desktop-xmonad/rofi.nix +++ /dev/null @@ -1,140 +0,0 @@ -{ config, pkgs, ... }: - -let - gruvbox-dark = { - bg = "#282828"; - bg1 = "#3c3836"; - bg2 = "#504945"; - - fg = "#ebdbb2"; - fg0 = "#fbf1c7"; - fg3 = "#bdae93"; - - red = "#cc241d"; - green = "#98971a"; - yellow = "#d79921"; - blue = "#458588"; - purple = "#b16286"; - aqua = "#689d6a"; - gray = "#a89984"; - - gray2 = "#928374"; - red-light = "#fb4934"; - green-light = "#b8bb26"; - yellow-light = "#fabd2f"; - blue-light = "#83a598"; - purple-light = "#d3869b"; - aqua-light = "#8ec07c"; - - }; - colors = { - fg = gruvbox-dark.fg; - selFg = gruvbox-dark.fg0; - bg = gruvbox-dark.bg; - sel = gruvbox-dark.blue; - inactive = gruvbox-dark.gray; - inactiveBorder = gruvbox-dark.bg2; - urgent = gruvbox-dark.red; - }; - rofiTransparency = "96"; - font = { - name = "Inter"; - size = "10"; - }; - monoFont = { - name = "Hack"; - size = "9"; - }; - -in { - programs.rofi = { - enable = true; - font = "${font.name} ${font.size}"; - extraConfig = { - display-run = " "; - # display-drun = " "; - display-window = " "; - drun-display-format = "{name}"; - modi = "window,run,drun,ssh"; - show-icons = false; - }; - theme = let inherit (config.lib.formats.rasi) mkLiteral; - in { - "*" = { - background-color = mkLiteral "transparent"; - border = 0; - margin = 0; - padding = 0; - spacing = 0; - }; - element = { - padding = 2; - orientation = "vertical"; - }; - "element-text" = { text-color = mkLiteral colors.fg; }; - - "element selected" = { - text-color = mkLiteral colors.selFg; - background-color = mkLiteral "${colors.sel}A0"; - }; - entry = { - padding = mkLiteral "0 0 6 3"; - text-color = mkLiteral colors.fg; - }; - inputbar = { - children = map mkLiteral [ "prompt" "entry" ]; - border = mkLiteral "0 0 1 0"; - border-color = mkLiteral gruvbox-dark.gray2; - margin = mkLiteral "0 0 5 0"; - }; - listview = { - columns = 1; - fixed-height = false; - }; - mainbox = { - children = map mkLiteral [ "inputbar" "listview" ]; - margin = 6; - }; - prompt = { - padding = mkLiteral "0 0 0 6"; - text-color = mkLiteral colors.fg; - background-color = mkLiteral "transparent"; - }; - window = { - transparency = "real"; - background-color = mkLiteral "${colors.bg}D0"; - y-offset = mkLiteral "-25%"; - border = 2; - border-color = mkLiteral colors.sel; - }; - }; - terminal = "${pkgs.alacritty}/bin/alacritty"; - pass = { - enable = true; - extraConfig = '' - URL_field='url' - USERNAME_field='user' - AUTOTYPE_field='autotype' - delay=2 - wait=0.2 - xdotool_delay=12 - EDITOR='gvim -f' - BROWSER='xdg-open' - default_do='typePass' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl - auto_enter='false' - notify='false' - default_autotype='user :tab pass' - help_color="${gruvbox-dark.blue-light}" - clip=primary - clip_clear=45 - edit_new_pass="true" - default_user=":filename" - autotype="Alt+1" - type_user="Alt+u" - type_pass="Alt+p" - copy_name="" - copy_pass="" - ''; - }; - }; -} diff --git a/modules/home-manager/desktop-xmonad/trantor.nix b/modules/home-manager/desktop-xmonad/trantor.nix deleted file mode 100644 index cec2cfd..0000000 --- a/modules/home-manager/desktop-xmonad/trantor.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, pkgs, ... }: - -let - desktopConfig = import ./desktop_config.nix { - config = config; - pkgs = pkgs; - fontSize = "11"; - monoFontSize = "13"; - }; -in desktopConfig // { - imports = [ ./common.nix ./autorandr/trantor.nix ]; - - services.picom = { - enable = true; - fade = false; - shadow = true; - backend = "glx"; - shadowExclude = [ "name ~= 'stalonetray'" ]; - settings.unredir-if-possible = false; - vSync = true; - }; - - home.file.".xinitrc".text = '' - ${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0 - ${pkgs.xorg.xrandr}/bin/xrandr --auto - ${pkgs.acpilight}/bin/xbacklight -set 100 - exec ${config.home.homeDirectory}/.xsession - ''; -} diff --git a/modules/home-manager/desktop-xmonad/xmonad/lib/Bindings.hs b/modules/home-manager/desktop-xmonad/xmonad/lib/Bindings.hs deleted file mode 100644 index f81db73..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/lib/Bindings.hs +++ /dev/null @@ -1,376 +0,0 @@ -module Bindings - ( keybinds - , mousebinds - ) where - --- --- q , w , e : screen naviagation --- h , j , k , l : vim-style 2D navitgation --- n , p : next/previous --- r : run --- t : tile --- g : toggle spacing (gaps) --- b " toggle bar --- x , y : reflect --- z : minimize --- [ , ] : tab navigation - -import System.Exit (exitSuccess) - -import Data.Monoid ( appEndo ) -import Data.Ratio ( (%) ) -import qualified Data.Map as M - -import XMonad ( (.|.) , gets ) -import XMonad.Util.Types ( Direction2D (U, D, L, R) ) -import XMonad.Hooks.ManageDocks ( ToggleStruts (ToggleStruts) ) -import XMonad.Util.Run ( safeSpawn ) -import XMonad.Util.Paste ( pasteSelection ) -import XMonad.Layout.ResizableTile ( MirrorResize (MirrorShrink, MirrorExpand) ) -import XMonad.Layout.Reflect ( REFLECTX (REFLECTX) , REFLECTY (REFLECTY) ) -import XMonad.Layout.MultiToggle ( Toggle (Toggle) ) -import XMonad.Layout.BoringWindows ( focusUp , focusDown ) -import XMonad.Layout.Maximize ( maximizeRestore ) -import XMonad.Actions.CopyWindow ( kill1 ) --- import XMonad.Actions.FloatKeys ( keysResizeWindow, keysMoveWindow, ChangeDim ) -import XMonad.Actions.FloatKeys -import XMonad.Actions.Navigation2D ( switchLayer , windowGo , windowSwap ) -import XMonad.Hooks.ManageHelpers ( doRectFloat ) - -import XMonad.Core - ( Layout - , X - , terminal - , modMask - , layoutHook - , XConfig (XConfig) - , whenJust - , runQuery - , windowset - , io - , ScreenId - , WindowSpace - ) - -import XMonad.Layout.IndependentScreens - ( workspaces' - , onCurrentScreen - , unmarshallS - ) - -import XMonad.Layout.SubLayouts - ( onGroup - , pushGroup - , GroupMsg (MergeAll, UnMerge) - ) - -import Graphics.X11.Types - ( Window , ButtonMask , KeyMask , KeySym , Button - , button1 , button2 , button3 - , shiftMask , controlMask - , xK_Return , xK_Escape , xK_Insert , xK_Right , xK_Left - , xK_space , xK_plus , xK_minus , xK_comma , xK_period - , xK_bracketleft , xK_bracketright - , xK_1 , xK_9 , xK_0 - , xK_b , xK_c , xK_e , xK_g , xK_h , xK_j , xK_k , xK_l , xK_m - , xK_n , xK_o , xK_p , xK_q , xK_r , xK_t , xK_u , xK_w , xK_x - , xK_y , xK_z - , xK_KP_End , xK_KP_Down , xK_KP_Next - , xK_KP_Add, xK_KP_Subtract, xK_KP_Insert, xK_KP_Enter - ) - -import Graphics.X11.ExtraTypes.XF86 - ( xF86XK_AudioMute - , xF86XK_AudioLowerVolume , xF86XK_AudioRaiseVolume - , xF86XK_AudioPlay , xF86XK_AudioStop - , xF86XK_AudioPrev , xF86XK_AudioNext - , xF86XK_RotateWindows - , xF86XK_MonBrightnessUp , xF86XK_MonBrightnessDown - ) - -import XMonad.Layout - ( IncMasterN (..) - , Resize (Shrink, Expand) - , ChangeLayout (NextLayout) - ) - -import XMonad.Operations - ( windows - , sendMessage - , setLayout - , withFocused - , screenWorkspace - , restart - , mouseResizeWindow - , mouseMoveWindow - , focus - , D - ) - -import XMonad.StackSet - ( StackSet (..) - , RationalRect (..) - , Workspace (..) - , shift - , view - , swapUp - , swapDown - , sink - , view - , floating - , screen - , shiftMaster - , focusDown' - , focusUp' - ) - -import XMonad.Layout.Spacing - ( toggleScreenSpacingEnabled - , toggleWindowSpacingEnabled - ) - -import XMonad.Actions.Minimize - ( minimizeWindow - , withLastMinimized - , maximizeWindowAndFocus - ) - -import XMonad.Actions.CycleWS - ( toggleWS' - , WSType (WSIs) - , shiftTo - , moveTo - , Direction1D (Next, Prev) - ) - -import ManageHook ( scratchpadKeybinds ) -import Prompts ( promptKeybinds ) -import Utils ( mkSubmap ) - -mousebinds :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ()) -mousebinds XConfig {modMask = modm} = M.fromList bindings - where - bindings = - [ ((modm, button1), move) - , ((modm, button2), toMaster) - , ((modm, button3), resize) - ] - move = mouseDo mouseMoveWindow - resize = mouseDo mouseResizeWindow - toMaster = mouseDo return - mouseDo f w = focus w >> f w >> windows shiftMaster - -keybinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ()) -keybinds = foldr1 keyComb - [ wmBinds - , spawnBinds - , promptKeybinds - , scratchpadKeybinds - , workspaceBinds - , screenBinds - ] - where - keyComb f g conf = M.union (f conf) (g conf) - -spawnBinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ()) -spawnBinds conf = M.fromList . map mkSpawn $ bindList - where - bindList = singles ++ playerctl ++ xbacklight ++ pamixer - singles = - [ ((modm, xK_Return), terminal conf, []) - , ((0, xF86XK_RotateWindows), "thinkpad-rotate", []) - , ((modm, xK_Escape), "slock", []) - ] - -- mpc = withCmd "mpc" - -- [ ((0, xK_KP_End), ["prev"]) - -- , ((0, xK_KP_Down), ["toggle"]) - -- , ((0, xK_KP_Next), ["next"]) - -- , ((0, xF86XK_AudioPlay), ["toggle"]) - -- , ((0, xF86XK_AudioStop), ["stop"]) - -- , ((0, xF86XK_AudioPrev), ["prev"]) - -- , ((0, xF86XK_AudioNext), ["next"]) - -- ] - playerctl = withCmd "playerctl" - [ ((0, xK_KP_End), ["previous"]) - , ((0, xK_KP_Down), ["play-pause"]) - , ((0, xK_KP_Next), ["next"]) - , ((0, xF86XK_AudioPlay), ["play-pause"]) - , ((0, xF86XK_AudioStop), ["stop"]) - , ((0, xF86XK_AudioPrev), ["previous"]) - , ((0, xF86XK_AudioNext), ["next"]) - ] - xbacklight = withCmd "xbacklight" - [ ((0, xF86XK_MonBrightnessUp), ["-inc", "10"]) - , ((0, xF86XK_MonBrightnessDown), ["-dec", "10"]) - ] - pamixer = withCmd "pamixer" - [ ((0, xK_KP_Subtract), ["--decrease", "5"]) - , ((0, xK_KP_Add), ["--increase", "5", "--allow-boost"]) - , ((0, xK_KP_Enter), ["--set-volume", "100"]) - , ((0, xK_KP_Insert), ["--togle-mute"]) - , ((0, xF86XK_AudioLowerVolume), ["--decrease", "5"]) - , ((0, xF86XK_AudioRaiseVolume), ["--increase", "5", "--allow-boost"]) - , ((0, xF86XK_AudioMute), ["--toggle-mute"]) - ] - mkSpawn (comb,cmd,args) = (comb, safeSpawn cmd args) - withCmd cmd = map (\(comb,args) -> (comb,cmd,args)) - modm = modMask conf - -wmBinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ()) -wmBinds conf@XConfig {modMask = modm} = M.fromList - [ ((0, xK_Insert), pasteSelection) - - , ((modm .|. shiftMask, xK_o), restart "obtoxmd" True) - , ((modm .|. shiftMask, xK_r), restart "xmonad" True) - , ((modm .|. shiftMask, xK_Escape), io exitSuccess) - - -- navigating windows - , ((modm, xK_j), windowGo D False) - , ((modm, xK_k), windowGo U False) - , ((modm, xK_h), windowGo L False) - , ((modm, xK_l), windowGo R False) - , ((modm, xK_n), focusDown) - , ((modm, xK_p), focusUp) - - -- sublayout things - , ((modm .|. controlMask, xK_m), withFocused (sendMessage . MergeAll)) - , ((modm .|. controlMask, xK_u), withFocused (sendMessage . UnMerge)) - , ((modm .|. controlMask, xK_h), sendMessage $ pushGroup L) - , ((modm .|. controlMask, xK_l), sendMessage $ pushGroup R) - , ((modm .|. controlMask, xK_k), sendMessage $ pushGroup U) - , ((modm .|. controlMask, xK_j), sendMessage $ pushGroup D) - , ((modm, xK_bracketleft), onGroup focusUp') - , ((modm, xK_bracketright), onGroup focusDown') - - -- moving windows - , ((modm .|. shiftMask, xK_j), move M.! "D") - , ((modm .|. shiftMask, xK_k), move M.! "U") - , ((modm .|. shiftMask, xK_h), move M.! "L") - , ((modm .|. shiftMask, xK_l), move M.! "R") - , ((modm .|. shiftMask, xK_n), windows swapDown) - , ((modm .|. shiftMask, xK_p), windows swapUp) - - -- resizing windows - , ((modm, xK_plus ), resize M.! "+") - , ((modm, xK_minus), resize M.! "-") - , ((modm .|. shiftMask .|. controlMask, xK_h), resize M.! "L") - , ((modm .|. shiftMask .|. controlMask, xK_l), resize M.! "R") - , ((modm .|. shiftMask .|. controlMask, xK_j), resize M.! "D") - , ((modm .|. shiftMask .|. controlMask, xK_k), resize M.! "U") - - , ((modm .|. controlMask, xK_space), switchLayer) - - , ((modm .|. shiftMask, xK_c ), kill1) - , ((modm, xK_space ), sendMessage NextLayout) - , ((modm .|. shiftMask, xK_space ), setLayout $ layoutHook conf) - , ((modm, xK_x ), sendMessage $ Toggle REFLECTX) - , ((modm, xK_y ), sendMessage $ Toggle REFLECTY) - , ((modm, xK_z ), withFocused minimizeWindow) - , ((modm .|. shiftMask, xK_z ), unminimize) - , ((modm, xK_m ), toggleMax) - - , ((modm, xK_t ), withFocused $ windows . sink) - , ((modm .|. shiftMask, xK_t ), untile) - - , ((modm, xK_comma ), sendMessage (IncMasterN 1)) - , ((modm, xK_period), sendMessage (IncMasterN (-1))) - , ((modm, xK_g ), toggleSpacing) - , ((modm, xK_b ), sendMessage ToggleStruts) - - , ((modm, xK_Right ), moveTo Next spacesOnCurrentScreen) - , ((modm, xK_Left ), moveTo Prev spacesOnCurrentScreen) - , ((modm .|. shiftMask, xK_Right ), shiftTo Next spacesOnCurrentScreen) - , ((modm .|. shiftMask, xK_Left ), shiftTo Prev spacesOnCurrentScreen) - - , ((modm, xK_0), toggleWS' ["NSP"]) - ] - - where - toggleSpacing = toggleWindowSpacingEnabled >> toggleScreenSpacingEnabled - toggleMax = withFocused (sendMessage . maximizeRestore) - unminimize = withLastMinimized maximizeWindowAndFocus - - untile = withFocused rectFloatFocused - where - rectFloatFocused focused = action focused >>= windows - action = fmap appEndo . doIt - doIt = runQuery $ doRectFloat rect - rect = RationalRect 0.05 0.05 0.9 0.9 - - resize :: M.Map [Char] (X()) - resize = M.intersectionWith onFloat flt tilling - where - - flt :: M.Map [Char] (Window -> X()) - flt = M.fromList - [ ("L", keysResizeWindow (-n, 0) (0, 0)) - , ("R", keysResizeWindow ( n, 0) (0, 0)) - , ("D", keysResizeWindow ( 0, n) (0, 0)) - , ("U", keysResizeWindow ( 0, -n) (0, 0)) - , ("+", keysResizeWindow ( n, n) (1%2, 1%2)) - , ("-", keysResizeWindow (-n, -n) (1%2, 1%2)) - ] - - tilling :: M.Map [Char] (X()) - tilling = M.fromList - [ ("L", sendMessage Shrink) - , ("R", sendMessage Expand) - , ("D", sendMessage MirrorShrink) - , ("U", sendMessage MirrorExpand) - , ("+", return ()) - , ("-", return ()) - ] - n = 10 - - move :: M.Map [Char] (X()) - move = M.intersectionWith onFloat flt tilling - where - - flt :: M.Map [Char] (Window -> X()) - flt = M.fromList - [ ("L", keysMoveWindow (-n, 0)) - , ("R", keysMoveWindow ( n, 0)) - , ("D", keysMoveWindow ( 0, n)) - , ("U", keysMoveWindow ( 0, -n)) - ] - - tilling :: M.Map [Char] (X()) - tilling = M.fromList - [ ("L", windowSwap L False) - , ("R", windowSwap R False) - , ("D", windowSwap D False) - , ("U", windowSwap U False) - ] - n = 10 - - onFloat a b = withFocused $ ifFloat a (const b) - where - ifFloat x y w = isFloat w >>= picker x y w - - picker x _ w True = x w - picker _ y w False = y w - - isFloat :: Window -> X Bool - isFloat w = M.member w . floating <$> gets windowset - -spacesOnCurrentScreen :: WSType -spacesOnCurrentScreen = WSIs $ isOnScreen <$> currentScreen - where - - isOnScreen :: ScreenId -> WindowSpace -> Bool - isOnScreen s = (s ==) . unmarshallS . tag - - currentScreen :: X ScreenId - currentScreen = gets $ screen . current . windowset - -workspaceBinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ()) -workspaceBinds conf@XConfig {modMask = modm} = M.fromList $ - [((m .|. modm, k), windows $ onCurrentScreen f i) - | (i, k) <- zip (workspaces' conf) [xK_1 .. xK_9] - , (f, m) <- [(view, 0), (shift, shiftMask)]] - -screenBinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ()) -screenBinds XConfig {modMask = modm} = M.fromList $ - [((m .|. modm, k), screenWorkspace i >>= flip whenJust (windows . f)) - | (i, k) <- zip [0,1] [xK_w, xK_e] - , (f, m) <- [(view, 0), (shift, shiftMask)]] diff --git a/modules/home-manager/desktop-xmonad/xmonad/lib/DefaultConfig.hs b/modules/home-manager/desktop-xmonad/xmonad/lib/DefaultConfig.hs deleted file mode 100644 index 37d98b6..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/lib/DefaultConfig.hs +++ /dev/null @@ -1,85 +0,0 @@ -module DefaultConfig - ( mkPP - , wsNamer - , defaultPP - ) where - -import MyConfig - ( workspaceLog - , layoutLog - , taskbar - ) - -import Theme - ( inactiveColor - , urgentColor - , selFg - , selectionColor - ) - -import GHC.IO.Handle.Types (Handle) - -import XMonad.Hooks.DynamicLog - ( ppCurrent - , ppOutput - , ppExtras - , ppVisible - , ppHidden - , ppHiddenNoWindows - , ppUrgent - , ppOrder - , ppTitle - , ppSep - , ppLayout - , PP - , xmobarColor - , wrap - , shorten - ) - -import XMonad.Config (def) - -import XMonad.Util.Run (hPutStrLn) - - -mkPP :: (String -> String) -> Bool -> Handle -> Int -> PP -mkPP workspaceNamer complete bar screen = common - { ppOutput = hPutStrLn bar - , ppExtras = extras complete - } - where - common = def - { ppCurrent = const "" - , ppVisible = const "" - , ppHidden = const "" - , ppHiddenNoWindows = const "" - , ppUrgent = xmobarColor urgentColor "" - , ppOrder = order complete - , ppTitle = title complete - , ppSep = xmobarColor inactiveColor "" "|" - , ppLayout = const "" - } - - extras True = - [ workspaceLog workspaceNamer screen - , layoutLog screen - , taskbar screen - ] - extras False = - [ workspaceLog workspaceNamer screen - , layoutLog screen - ] - - order True (_:_:_:xs) = xs - order False (_:_:t:ws:l:_) = [ws, l, t] - order _ _ = [] - - title True = const "" - title False = wrap " " "" . xmobarColor selFg selectionColor . wrap " " " " . shorten 80 - -wsNamer :: String -> String -wsNamer "NSP" = "" -wsNamer x = x - -defaultPP :: Handle -> Int -> PP -defaultPP = mkPP wsNamer True diff --git a/modules/home-manager/desktop-xmonad/xmonad/lib/Layouts.hs b/modules/home-manager/desktop-xmonad/xmonad/lib/Layouts.hs deleted file mode 100644 index 5aae708..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/lib/Layouts.hs +++ /dev/null @@ -1,124 +0,0 @@ -{-# LANGUAGE FlexibleContexts #-} -{-# OPTIONS_GHC -fno-warn-missing-signatures #-} - -module Layouts (myLayoutHook) where - -import Text.Printf (printf) - -import XMonad.Config (def) -import XMonad.Core ( LayoutClass ) -import XMonad.Hooks.ManageDocks (avoidStruts) - -import XMonad.Layout ( Mirror (Mirror) , (|||) ) -import XMonad.Layout.PerWorkspace ( onWorkspaces ) -import XMonad.Layout.LayoutModifier ( ModifiedLayout , LayoutModifier ) -import XMonad.Layout.BoringWindows ( boringWindows ) -import XMonad.Layout.Decoration ( Theme , DefaultShrinker , Decoration ) -import XMonad.Layout.Maximize ( maximizeWithPadding ) -import XMonad.Layout.Minimize ( minimize ) -import XMonad.Layout.MultiToggle ( mkToggle , single ) -import XMonad.Layout.Renamed ( renamed, Rename (Replace) ) -import XMonad.Layout.NoBorders ( smartBorders ) -import XMonad.Layout.ResizableTile ( ResizableTall (..) ) -import XMonad.Layout.Spacing ( Spacing , spacingRaw , Border (..) ) -import XMonad.Layout.WindowNavigation ( windowNavigation ) -import XMonad.Layout.SubLayouts ( subLayout , Sublayout ) -import XMonad.Layout.Simplest ( Simplest(Simplest) ) -import XMonad.Layout.Grid ( Grid(Grid) ) -import XMonad.Layout.Reflect - ( REFLECTX (REFLECTX) - , REFLECTY (REFLECTY) - ) -import XMonad.Layout.Tabbed - ( shrinkText - , addTabs - , TabbedDecoration - ) -import qualified XMonad.Layout.Tabbed as T - ( activeColor - , inactiveColor - , activeBorderColor - , inactiveBorderColor - , urgentColor - , activeTextColor - , inactiveTextColor - , urgentTextColor - , fontName - ) - -import XMonad.Layout.PositionStoreFloat (positionStoreFloat) -import XMonad.Layout.NoFrillsDecoration (noFrillsDeco) -import XMonad.Layout.BorderResize (borderResize) - -import HostConfig - ( FontConfig - , fontName - , fontSize - , ColorConfig - , fgColor - , selFgColor - , bgColor - , selColor - , inactiveColor - , inactiveBorderColor - , urgentColor - , colorConfig - , fontConfig - ) - -named :: String -> l a -> ModifiedLayout Rename l a -named x = renamed [Replace x] - -myLayoutHook = commonMods mainLayouts - where - tileMods = mkToggle (single REFLECTX) . mkToggle (single REFLECTY) - . smartBorders - . windowNavigation . mySubTabbed theme - . spaces - commonMods = avoidStruts - . maximizeWithPadding 0 - . minimize - . boringWindows - tLayouts = tileMods $ named "tall" tall ||| named "mtall" mtall - mainLayouts = tLayouts ||| floating theme - -floating theme = named "float" . floatingDeco . borderResize $ positionStoreFloat - where - floatingDeco = noFrillsDeco shrinkText theme - -mySubTabbed - :: (Eq a, LayoutModifier (Sublayout Simplest) a, LayoutClass l a) - => Theme - -> l a - -> ModifiedLayout - (Decoration TabbedDecoration DefaultShrinker) - (ModifiedLayout (Sublayout Simplest) l) - a -mySubTabbed theme x = addTabs shrinkText theme $ subLayout [] Simplest x - -spaces :: l a -> ModifiedLayout Spacing l a -spaces = spacingRaw False b False b False - where - b = Border defSpacing defSpacing defSpacing defSpacing - defSpacing = 5 - -tall :: ResizableTall a -tall = ResizableTall 1 (3/100) (1/2) [] - -mtall :: Mirror ResizableTall a -mtall = Mirror tall - -theme :: Theme -theme = def - { T.activeColor = selColor colorConfig - , T.activeBorderColor = inactiveColor colorConfig - , T.activeTextColor = selFgColor colorConfig - - , T.inactiveColor = bgColor colorConfig - , T.inactiveBorderColor = inactiveBorderColor colorConfig - , T.inactiveTextColor = fgColor colorConfig - - , T.urgentColor = urgentColor colorConfig - , T.urgentTextColor = urgentColor colorConfig - , T.fontName = printf "xft:%s:size=%d" (fontName fontConfig) (fontSize fontConfig) - } diff --git a/modules/home-manager/desktop-xmonad/xmonad/lib/ManageHook.hs b/modules/home-manager/desktop-xmonad/xmonad/lib/ManageHook.hs deleted file mode 100644 index a19aff2..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/lib/ManageHook.hs +++ /dev/null @@ -1,135 +0,0 @@ - module ManageHook - ( myManageHook - , scratchpadKeybinds - ) where - -import Text.Printf (printf) -import qualified Data.Map as M - -import XMonad.Core - ( ManageHook - , X - , XConfig(XConfig) - , modMask - , Layout - ) - -import XMonad.StackSet (RationalRect (RationalRect)) -import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat) - -import Graphics.X11.Types - ( KeySym , ButtonMask - , xK_s , xK_t , xK_m - , xK_Return - ) - -import XMonad.ManageHook - ( className - , (=?) - , resource - , composeAll - , (-->) - , doFloat - , doShift - , stringProperty - ) - -import XMonad.Util.NamedScratchpad - ( NamedScratchpad (NS) - , customFloating - , namedScratchpadManageHook - , namedScratchpadAction - ) - -import Utils ( mkSubmap ) - -scratchpadKeybinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ()) -scratchpadKeybinds XConfig {modMask = modm} = M.fromList - [ ((modm, xK_s), mkSubmap modm . map buildSubmap $ - [ (xK_Return, "scratchpad") - , (xK_m, "mixer") - -- , (xK_p, "player") - , (xK_t, "top") - -- , (xK_w, "whatsapp") - -- , (xK_g, "hangouts") - ]) - ] - where - buildSubmap (key,name) = ((0,key), namedScratchpadAction myScratchpads name) - -myScratchpads :: [NamedScratchpad] -myScratchpads = - [ termApp "scratchpad" "zsh" mngTopScratch - , termApp "top" "top" mngBigFloat - --, termApp "player" "ncmpcpp" mngBiggerFloat - - --, NS "mixer" "pavucontrol" (className =? "Pavucontrol") mngSmallerFloat - - -- , chromiumApp "whatsapp" "web.whatsapp.com" mngSmallFloat - -- , chromiumApp "hangouts" "hangouts.google.com" mngSmallFloat - ] - -myManageHook :: ManageHook -myManageHook = mkManageHook myScratchpads - -termApp :: String -> String -> ManageHook -> NamedScratchpad -termApp name app = NS name cmd findIt - where - cmd = printf fmt name name app - fmt = "alacritty --class %s --command tmux new -A -s %s %s" - findIt = resource =? name - ---chromiumApp :: String -> String -> ManageHook -> NamedScratchpad ---chromiumApp name url = NS name cmd findIt --- where --- cmd = printf "chromium --app=https://%s" url --- findIt = resource =? url - ---mngSmallerFloat :: ManageHook ---mngSmallerFloat = centeredFloat 0.6 - ---mngSmallFloat :: ManageHook ---mngSmallFloat = centeredFloat 0.7 - -mngBigFloat :: ManageHook -mngBigFloat = centeredFloat 0.8 - ---mngBiggerFloat :: ManageHook ---mngBiggerFloat = centeredFloat 0.9 - -centeredFloat :: Rational -> ManageHook -centeredFloat s = customFloating $ RationalRect p p s s - where - p = (1-s) / 2 - -mngTopScratch :: ManageHook -mngTopScratch = customFloating $ RationalRect l t w h - where - h = 0.3 -- height, 30% - w = 1 -- width, 100% - t = 0 -- distance from top edge, 0% - l = 1 - w -- distance from left edge, 0% - -mkManageHook :: [NamedScratchpad] -> ManageHook -mkManageHook scratchpads = composeAll - [ isFullscreen --> doFullFloat - , className =? "MPlayer" --> doFloat - , className =? "VirtualBox" --> doFloat - , className =? "Pinentry" --> doFloat - , className =? "qjackctl" --> doFloat - , className =? "Xmessage" --> doFloat - , className =? "SuperCollider" --> doFloat - , role =? "gimp-dock" --> doFloat - , role =? "GtkFileChooserDialog" --> doFloat - - --, className =? "Signal" --> doShift "msg" - --, className =? "Slack" --> doShift "msg" - --, className =? "Element" --> doShift "msg" - --, className =? "TelegramDesktop" --> doShift "msg" - --, resource =? "hangouts.google.com" --> doShift "msg" - --, resource =? "web.whatsapp.com" --> doShift "msg" - - , namedScratchpadManageHook scratchpads - ] - where - role = stringProperty "WM_WINDOW_ROLE" diff --git a/modules/home-manager/desktop-xmonad/xmonad/lib/Polybar.hs b/modules/home-manager/desktop-xmonad/xmonad/lib/Polybar.hs deleted file mode 100644 index 3b1e6ad..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/lib/Polybar.hs +++ /dev/null @@ -1,60 +0,0 @@ -module Polybar (polybarLogHook, mkDbusClient) where - -import XMonad.Hooks.DynamicLog - -import Text.Printf (printf) - -import XMonad.Layout.IndependentScreens (marshallPP) - -import qualified DBus as D -import qualified DBus.Client as D -import qualified Codec.Binary.UTF8.String as UTF8 - - -mkDbusClient :: IO D.Client -mkDbusClient = do - dbus <- D.connectSession - D.requestName dbus (D.busName_ "org.xmonad.log") opts - return dbus - where - opts = [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue] - -monitorMsg :: Int -> String -> String -monitorMsg = printf "{\"%d\": \"%s\"}" - --- Emit a DBus signal on log updates -dbusOutput :: D.Client -> String -> IO () -dbusOutput dbus str = - let opath = D.objectPath_ "/org/xmonad/Log" - iname = D.interfaceName_ "org.xmonad.Log" - mname = D.memberName_ "Update" - signal = D.signal opath iname mname - body = [D.toVariant $ UTF8.decodeString $ monitorMsg 0 str] - in D.emit dbus $ signal { D.signalBody = body } - -polybarFmt :: String -> String -> String -> String -polybarFmt var color elem = "%{" ++ var ++ color ++ "}" ++ elem ++ "%{" ++ var ++ "-}" - -polybarFg :: String -> String -> String -polybarFg = polybarFmt "F" - -polybarBg :: String -> String -> String -polybarBg = polybarFmt "B" - -polybarBgFg :: String -> String -> String -> String -polybarBgFg bg fg = polybarBg bg . polybarFg fg - -polybarHook :: D.Client -> PP -polybarHook dbus = def - { ppOutput = dbusOutput dbus - , ppCurrent = polybarBgFg "#458588" "#fbf1c7" - , ppVisible = polybarFg "#ebdbb2" - , ppUrgent = polybarBgFg "#cc241d" "#fbf1c7" - , ppHidden = polybarFg "#ebdbb2" - , ppLayout = const "" - , ppHiddenNoWindows = const "" - , ppTitle = shorten 100 . polybarFg "#fbf1c7" - , ppSep = polybarFg "#a89974" " | " - } - -polybarLogHook dbus = dynamicLogWithPP $ (marshallPP 0 . polybarHook) dbus diff --git a/modules/home-manager/desktop-xmonad/xmonad/lib/Prompts.hs b/modules/home-manager/desktop-xmonad/xmonad/lib/Prompts.hs deleted file mode 100644 index dcebaf4..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/lib/Prompts.hs +++ /dev/null @@ -1,92 +0,0 @@ -module Prompts ( promptKeybinds ) where - -import Text.Printf (printf) -import qualified Data.Map as M ( Map , fromList ) - -import Graphics.X11.Types - ( KeySym , ButtonMask - , xK_Tab - , xK_a , xK_b , xK_c , xK_p , xK_r , xK_s , xK_u , xK_t - ) -import Graphics.X11.ExtraTypes.XF86 ( xF86XK_Launch1 ) - -import XMonad.Core ( X , modMask , XConfig(XConfig) , Layout ) -import XMonad.Util.Run ( safeSpawn ) - -import qualified XMonad.Prompt as P - ( XPConfig - , def - , font - , bgColor - , fgColor - , bgHLight - , fgHLight - , bgColor - , borderColor - , promptBorderWidth - , alwaysHighlight - , defaultPrompter - ) - -import HostConfig - ( ColorConfig - , FontConfig - , fontConfig - , colorConfig - , fontName - , fontSize - , bgColor - , fgColor - , selColor - , selFgColor - ) - -import Utils ( mkSubmap ) - -promptKeybinds :: XConfig Layout -> M.Map (ButtonMask, KeySym) (X ()) -promptKeybinds XConfig {modMask = modm} = M.fromList - [ ((0, xF86XK_Launch1), run) - , ((modm, xK_r), run) - , ((modm, xK_a) , subMapMaker - [ ( xK_r , drun ) - , ( xK_p , pass ) - , ( xK_Tab , window ) - , ( xK_t , todo ) - , ( xK_c , clipmenu ) - , ( xK_b , buku ) - , ( xK_s , ssh ) - ]) - ] - where - run = safeSpawn "rofi" ["-show", "run"] - drun = safeSpawn "rofi" ["-show", "drun"] - pass = safeSpawn "rofi-pass" [] - buku = safeSpawn "rofi-buku" [] - ssh = safeSpawn "rofi" ["-show", "ssh"] - window = safeSpawn "rofi" ["-show", "window"] - clipmenu = safeSpawn "clipmenu" dmenuArgs - todo = safeSpawn "todo-rofi" [] - subMapMaker = mkSubmap modm . map (\(key,action) -> ((0,key),action)) - -dmenuArgs :: [String] -dmenuArgs = - [ "-b" -- bottom - , "-fn", printf "%s:size=%d" (fontName fontConfig) (fontSize fontConfig) - , "-nb", bgColor colorConfig -- normal background - , "-nf", fgColor colorConfig -- normal foreground - , "-sb", selColor colorConfig -- selected background - , "-sf", selFgColor colorConfig -- selected foreground - ] - -theme :: P.XPConfig -theme = P.def - { P.font = printf "xft:%s:size=%d" (fontName fontConfig) (fontSize fontConfig) - , P.bgColor = bgColor colorConfig - , P.fgColor = fgColor colorConfig - , P.bgHLight = selColor colorConfig - , P.fgHLight = selFgColor colorConfig - , P.borderColor = bgColor colorConfig - , P.promptBorderWidth = 0 - , P.alwaysHighlight = True - , P.defaultPrompter = const "" - } diff --git a/modules/home-manager/desktop-xmonad/xmonad/lib/Utils.hs b/modules/home-manager/desktop-xmonad/xmonad/lib/Utils.hs deleted file mode 100644 index 20c1376..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/lib/Utils.hs +++ /dev/null @@ -1,15 +0,0 @@ -module Utils ( mkSubmap ) where - -import qualified Data.Map as M ( fromList ) - -import XMonad ( (.|.) ) -import Graphics.X11.Types ( KeyMask , KeySym , ButtonMask ) - -import XMonad.Core ( X ) -import XMonad.Actions.Submap ( submap ) - -mkSubmap :: ButtonMask -> [((KeyMask, KeySym), X ())] -> X () -mkSubmap modm = submap . M.fromList . concatMap buildSubmaps - where - buildSubmaps x = map (buildSubmap x) [0,modm] - buildSubmap ((modKey,key),action) m = ((modKey .|. m,key),action) diff --git a/modules/home-manager/desktop-xmonad/xmonad/lib/Xmobar.hs b/modules/home-manager/desktop-xmonad/xmonad/lib/Xmobar.hs deleted file mode 100644 index 55856c1..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/lib/Xmobar.hs +++ /dev/null @@ -1,119 +0,0 @@ -module Xmobar (mkBars) where - -import XMonad.Layout.IndependentScreens (marshallPP) - -import GHC.IO.Handle.Types (Handle) -import Text.Printf (printf) - -import Data.List (intercalate, isPrefixOf) -import Graphics.X11.Types (Window) - -import XMonad.Core - ( Layout - , ScreenDetail - , ScreenId (S) - , withWindowSet - , WorkspaceId - , WindowSet - , description - , X - ) - -import XMonad (MonadIO) -import XMonad.Config (def) -import XMonad.Util.Run (hPutStrLn, spawnPipe) -import XMonad.Util.NamedWindows (getName) -import XMonad.Util.Loggers (Logger) - -import XMonad.StackSet ( Workspace (..) , screen , workspace , current ) -import qualified XMonad.StackSet as S - -import XMonad.Hooks.DynamicLog - ( PP - , ppCurrent - , ppExtras - , ppHidden - , ppHiddenNoWindows - , ppLayout - , ppOrder - , ppOutput - , ppSep - , ppTitle - , ppUrgent - , ppVisible - , shorten - , wrap - , xmobarAction - , xmobarColor - , dynamicLogWithPP - ) - -import HostConfig - ( colorConfig - , fontConfig - , FontConfig - , fontName - , fontSize - - , ColorConfig - , bgColor - , fgColor - , selFgColor - , selColor - , inactiveColor - , urgentColor - ) - -mkBars :: MonadIO m => [Int] -> m (X ()) -mkBars screens = do - xmprocs <- mkXmprocs screens - return $ mapM_ dynamicLogWithPP $ zipWith mkPP xmprocs screens - -mkXmprocs :: MonadIO m => [Int] -> m [Handle] -mkXmprocs = mapM (spawnPipe . printf "xmobar --screen='%d'") - -mkPP :: Handle -> Int -> PP -mkPP bar nscreen = marshallPP (S nscreen) $ def - { ppOutput = hPutStrLn bar - , ppCurrent = xmobarColor (selFgColor colorConfig) (selColor colorConfig) - , ppVisible = xmobarColor (fgColor colorConfig) "" - , ppHidden = xmobarColor (fgColor colorConfig) "" - , ppHiddenNoWindows = const "" - , ppUrgent = xmobarColor (urgentColor colorConfig) "" - , ppLayout = getLayoutIcon . layoutNameCleaner - , ppTitle = xmobarColor (selFgColor colorConfig) "" . shorten 100 - , ppSep = xmobarColor (inactiveColor colorConfig) "" " | " - } - -layoutNameCleaner = unwords . filter (not . (`elem` toClean)) . words - where - toClean = - [ "Simple" - , "Simplest" - , "Minimize" - , "Maximize" - , "ImageButtonDeco" - , "DefaultDecoration" - , "Spacing" - , "ReflectX" - , "ReflectY" - , "Tabbed" - , "0" - ] - -getLayoutIcon :: String -> String -getLayoutIcon "empty" = "" -getLayoutIcon x - | x `elem` icons = printf "" iconsDir x - | otherwise = x - where - iconsDir = "/home/rilla/.xmonad/icons" - icons = - [ "3cols" - , "float" - , "full" - , "grid" - , "mtall" - , "tabs" - , "tall" - ] diff --git a/modules/home-manager/desktop-xmonad/xmonad/xmonad.hs b/modules/home-manager/desktop-xmonad/xmonad/xmonad.hs deleted file mode 100644 index 9c7b93b..0000000 --- a/modules/home-manager/desktop-xmonad/xmonad/xmonad.hs +++ /dev/null @@ -1,92 +0,0 @@ -import XMonad ( xmonad ) -import XMonad.Core - ( ScreenId (S) - , terminal - , modMask - , borderWidth - , normalBorderColor - , focusedBorderColor - , workspaces - , keys - , mouseBindings - , layoutHook - , manageHook - , XConfig - ( logHook - , focusFollowsMouse - , startupHook - , handleEventHook - ) - ) -import XMonad.Config ( def ) - -import XMonad.Hooks.ServerMode ( serverModeEventHook ) -import XMonad.Hooks.EwmhDesktops ( ewmh ) -import XMonad.Hooks.ManageDocks ( docks ) -import XMonad.Hooks.SetWMName ( setWMName ) - -import XMonad.Layout.IndependentScreens ( countScreens , withScreens ) -import XMonad.Util.Replace ( replace ) - -import XMonad.Actions.UpdatePointer ( updatePointer ) -import XMonad.Actions.Navigation2D - ( withNavigation2DConfig - , Navigation2DConfig - , centerNavigation - , singleWindowRect - , defaultTiledNavigation - , layoutNavigation - , unmappedWindowRect - ) - -import Graphics.X11.Types ( mod4Mask ) - -import HostConfig - ( colorConfig - , selColor - , inactiveBorderColor - ) -import ManageHook ( myManageHook ) -import Xmobar ( mkBars ) -import Bindings ( keybinds, mousebinds ) -import Layouts ( myLayoutHook ) - -main :: IO () -main = do - replace - nscreens <- countScreens - let - myScreens = [0 .. nscreens-1] - wsLs = withScreens (S nscreens) myWorkspaces - bars <- mkBars myScreens - xmonad $ opts def - { terminal = "alacritty" - , modMask = mod4Mask - , borderWidth = 4 - , normalBorderColor = inactiveBorderColor colorConfig - , focusedBorderColor = selColor colorConfig - , workspaces = wsLs - , keys = keybinds - , mouseBindings = mousebinds - , layoutHook = myLayoutHook - , manageHook = myManageHook - , logHook = bars >> updatePtr - , focusFollowsMouse = True - , handleEventHook = serverModeEventHook - , startupHook = setWMName "LG3D" - } - where - opts = docks . ewmh . withNavigation2DConfig myNav2DConf - updatePtr = updatePointer (0.9, 0.9) (0, 0) - -myNav2DConf :: Navigation2DConfig -myNav2DConf = def - { defaultTiledNavigation = centerNavigation - , layoutNavigation = [("Full", centerNavigation)] - , unmappedWindowRect = [("Full", singleWindowRect)] - } - -myWorkspaces :: [String] -myWorkspaces = map show ids - where ids :: [Int] - ids = [1..9] diff --git a/modules/home-manager/git/default.nix b/modules/home-manager/git/default.nix index 21f05ae..69cb2cc 100644 --- a/modules/home-manager/git/default.nix +++ b/modules/home-manager/git/default.nix @@ -1,8 +1,7 @@ { config, pkgs, ... }: -let woodpecker-cli = pkgs.callPackage ./woodpecker-cli.nix { inherit pkgs; }; -in { - home.packages = [ pkgs.diff-so-fancy pkgs.tig pkgs.tea woodpecker-cli ]; +{ + home.packages = [ pkgs.diff-so-fancy pkgs.tig pkgs.tea ]; programs.git = { enable = true; diff --git a/modules/home-manager/git/woodpecker-cli.nix b/modules/home-manager/git/woodpecker-cli.nix deleted file mode 100644 index a7229e4..0000000 --- a/modules/home-manager/git/woodpecker-cli.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: - -let - hostname = "woodpecker.monotremata.xyz"; - shell = "${pkgs.dash}/bin/dash"; - pass = "${pkgs.pass}/bin/pass"; - woodpecker-cli = "${pkgs.woodpecker-cli}/bin/woodpecker-cli"; -in pkgs.writeScriptBin "woodpecker-cli" '' - #!${shell} - WOODPECKER_SERVER="https://${hostname}" - WOODPECKER_TOKEN=$(${pass} "${hostname}/token") - export WOODPECKER_SERVER - export WOODPECKER_TOKEN - ${woodpecker-cli} "$@" -'' diff --git a/modules/home-manager/lf/cleaner.nix b/modules/home-manager/lf/cleaner.nix deleted file mode 100644 index de9d83d..0000000 --- a/modules/home-manager/lf/cleaner.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, pkgs, ... }: - -let printf = "${pkgs.coreutils-full}/bin/printf"; -in -pkgs.writeShellScript "lf-cleaner.sh" '' - [ -n "$FIFO_UEBERZUG" ] && ${printf} '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG" -'' diff --git a/modules/home-manager/lf/default.nix b/modules/home-manager/lf/default.nix index b3751cc..3a73956 100644 --- a/modules/home-manager/lf/default.nix +++ b/modules/home-manager/lf/default.nix @@ -3,9 +3,9 @@ let pv = pkgs.callPackage ./pv.nix { inherit config pkgs; }; lf-wrapper = pkgs.callPackage ./lf-wrapper.nix { inherit config pkgs; }; - cleaner = pkgs.callPackage ./cleaner.nix { inherit config pkgs; }; -in { +in +{ home.packages = [ lf-wrapper ]; programs.lf = { enable = true; @@ -24,8 +24,5 @@ in { }} ''; }; - extraConfig = '' - set cleaner ${cleaner} - ''; }; } diff --git a/modules/home-manager/lf/lf-wrapper.nix b/modules/home-manager/lf/lf-wrapper.nix index 12a610c..64ccd86 100644 --- a/modules/home-manager/lf/lf-wrapper.nix +++ b/modules/home-manager/lf/lf-wrapper.nix @@ -5,7 +5,6 @@ let lf = "${pkgs.lf}/bin/lf"; rm = "${pkgs.coreutils-full}/bin/rm"; mkdir = "${pkgs.coreutils-full}/bin/mkdir"; - mkfifo = "${pkgs.coreutils-full}/bin/mkfifo"; lfcache = "${config.home.homeDirectory}/.cache/lf"; in pkgs.writeScriptBin "lf-wrapper" '' #!${shell} diff --git a/modules/home-manager/mail/default.nix b/modules/home-manager/mail/default.nix index 7d10866..b5f9bf3 100644 --- a/modules/home-manager/mail/default.nix +++ b/modules/home-manager/mail/default.nix @@ -1,7 +1,6 @@ { config, pkgs, ... }: let - mailsync = pkgs.callPackage ./mailsync.nix { inherit config pkgs; }; gpgKey = "B51D4548A4846E3C8D115C808333CFB0B9D3244D"; personalSignature = '' @@ -80,7 +79,7 @@ let in { - home.packages = [ mailsync pkgs.urlscan pkgs.abook ]; + home.packages = [ pkgs.mutt-wizard pkgs.urlscan pkgs.abook ]; accounts.email.accounts = { "rilla@monotremata.xyz" = diff --git a/modules/home-manager/mail/mailsync.nix b/modules/home-manager/mail/mailsync.nix deleted file mode 100644 index 6b6386b..0000000 --- a/modules/home-manager/mail/mailsync.nix +++ /dev/null @@ -1,132 +0,0 @@ -{ config, pkgs, ... }: - -let - shell = "${pkgs.dash}/bin/dash"; - pidof = "${pkgs.procps}/bin/pidof"; - pgrep = "${pkgs.procps}/bin/pgrep"; - grep = "${pkgs.gnugrep}/bin/grep"; - sed = "${pkgs.gnused}/bin/sed"; - awk = "${pkgs.gawk}/bin/awk"; - perl = "${pkgs.perl}/bin/perl"; - find = "${pkgs.findutils}/bin/find"; - - notifySend = "${pkgs.libnotify}/bin/notify-send"; - notmuch = "${pkgs.notmuch}/bin/notmuch"; - head = "${pkgs.coreutils}/bin/head"; - touch = "${pkgs.coreutils}/bin/touch"; - tr = "${pkgs.coreutils}/bin/tr"; - - mbsyncrc = "${config.home.homeDirectory}/.mbsyncrc"; - mbsync = "${pkgs.isync}/bin/mbsync -c ${mbsyncrc}"; - - maildir = "${config.home.homeDirectory}/Maildir"; - passwordStoreDir = "${config.home.homeDirectory}/.password-store"; - notmuchConfig = "${config.home.homeDirectory}/.config/notmuch/default/config"; - gnupghome = "${config.home.homeDirectory}/.gnupg"; - lastrun = "${config.home.homeDirectory}/.mailsynclastrun"; -in pkgs.writeScriptBin "mailsync" '' - #!${shell} - - # Run only if not already running in other instance - ${pidof} mbsync >/dev/null && { - echo "mbsync is already running." - exit - } - - export PASSWORD_STORE_DIR="${passwordStoreDir}" - export NOTMUCH_CONFIG="${notmuchConfig}" - export GNUPGHOME="${gnupghome}" - export GPG_TTY=$TTY - - notify() { - pgrepoutput="$(${pgrep} -a X\(org\|wayland\))" - displays="$(echo "$pgrepoutput" | ${grep} -wo "[0-9]*:[0-9]\+" | sort -u)" - [ -n "$pgrepoutput" ] && for x in ''${displays:-0:}; do - export DISPLAY=$x - ${notifySend} \ - --app-name="email" \ - "email" \ - "📬 $2 new mail(s) in \`$1\` account." - done - } - - messageinfo() { - from="$1" - subject="$2" - pgrepoutput="$(${pgrep} -a X\(org\|wayland\))" - displays="$(echo "$pgrepoutput" | ${grep} -wo "[0-9]*:[0-9]\+" | sort -u)" - [ -n "$pgrepoutput" ] && for x in ''${displays:-0:}; do - export DISPLAY=$x - ${notifySend} \ - --app-name="email" \ - "📧$from:" \ - "$subject" - done - } - - # Check account for new mail. Notify if there is new content. - syncandnotify() { - accounts="$1" - acc="$(echo "$account" | ${sed} "s/.*\///")" - if [ -z "$opts" ]; then - ${mbsync} "$acc" - else - ${mbsync} "$opts" "$acc" - fi - new=$( - ${find} \ - "${maildir}/$acc/INBOX/new/" \ - "${maildir}/$acc/Inbox/new/" \ - "${maildir}/mail/$acc/inbox/new/" \ - -type f \ - -newer "${lastrun}" \ - 2> /dev/null - ) - newcount=$(echo "$new" | ${sed} '/^\s*$/d' | wc -l) - if [ "$newcount" -gt 5 ]; then - notify "$acc" "$newcount" - elif [ "$newcount" -gt 0 ]; then - for file in $new; do - # Extract subject and sender from mail. - from=$( - ${awk} '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | \ - ${perl} -CS -MEncode -ne 'print decode("MIME-Header", $_)' | \ - ${awk} '{ $1=""; if (NF>=3)$NF=""; print $0 }' | \ - ${sed} 's/^[[:blank:]]*[\"'\'''\<]*//;s/[\"'\'''\>]*[[:blank:]]*$//' - ) - subject=$( - ${awk} '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | \ - ${head} -n 1 | ${perl} -CS -MEncode -ne 'print decode("MIME-Header", $_)' | \ - ${sed} 's/^Subject: //' | \ - ${sed} 's/^{[[:blank:]]*[\"'\'''\<]*//;s/[\"'\'''\>]*[[:blank:]]*$//' | \ - ${tr} -d '\n' - ) - messageinfo "$from" "$subject" & - done - fi - } - - # Sync accounts passed as argument or all. - if [ "$#" -eq "0" ]; then - accounts="$(${awk} '/^Channel/ {print $2}' "${mbsyncrc}")" - else - for arg in "$@"; do - [ "''${arg%''${arg#?}}" = '-' ] && \ - opts="''${opts:+''${opts} }''${arg}" && \ - shift 1 - done - accounts=$* - fi - - # Parallelize multiple accounts - for account in $accounts; do - syncandnotify "''${account}" & - done - - wait - - ${notmuch} new 2>/dev/null - - #Create a touch file that indicates the time of the last run of mailsync - ${touch} "${lastrun}" -'' diff --git a/modules/home-manager/rss/default.nix b/modules/home-manager/rss/default.nix index 543a216..eaf090a 100644 --- a/modules/home-manager/rss/default.nix +++ b/modules/home-manager/rss/default.nix @@ -4,14 +4,13 @@ let url = "nextcloud.monotremata.xyz"; dir = "${config.home.homeDirectory}/.newsboat"; user = "rilla"; - rsssync = pkgs.callPackage ./rsssync.nix { inherit config pkgs; }; in { - home.packages = [rsssync]; + home.packages = [ pkgs.rss-sync ]; programs.newsboat = { enable = true; autoReload = true; - browser = "firefox"; # todo: should be my open_link script + browser = "firefox"; # todo: should be my open_link script reloadThreads = 100; extraConfig = '' urls-source "ocnews" diff --git a/modules/home-manager/rss/rsssync.nix b/modules/home-manager/rss/rsssync.nix deleted file mode 100644 index d2211c5..0000000 --- a/modules/home-manager/rss/rsssync.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, pkgs, ... }: - -let - shell = "${pkgs.dash}/bin/dash"; - newsboat = "${pkgs.newsboat}/bin/newsboat"; -in - pkgs.writeScriptBin "rsssync" '' - #!${shell} - ${newsboat} --execute="reload" - '' diff --git a/modules/nixos/common/default.nix b/modules/nixos/common/default.nix index 7cfef54..7f77457 100644 --- a/modules/nixos/common/default.nix +++ b/modules/nixos/common/default.nix @@ -7,7 +7,7 @@ package = pkgs.nixFlakes; extraOptions = '' experimental-features = nix-command flakes - secret-key-files = "/etc/nix/cache-priv-key.pem" + secret-key-files = /etc/nix/cache-priv-key.pem ''; optimise.automatic = true; gc = { diff --git a/modules/nixos/desktop/default.nix b/modules/nixos/desktop/default.nix index 744a7f9..0d4f7ce 100644 --- a/modules/nixos/desktop/default.nix +++ b/modules/nixos/desktop/default.nix @@ -253,7 +253,7 @@ "/etc/ssh/ssh_host_ed25519_key" "/home/rilla/.lmmsrc.xml" - "/home/rilla/.mailsynclastrun" + "/home/rilla/.config/mutt/.mailsynclastrun" "/home/rilla/.ssh/known_hosts" ]; diff --git a/pkgs/dav-sync/default.nix b/pkgs/dav-sync/default.nix new file mode 100644 index 0000000..bbb3b0e --- /dev/null +++ b/pkgs/dav-sync/default.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: + +let + addressbook = "$HOME/.abook/addressbook"; + contacts = "$HOME/Contacts"; +in +pkgs.writeShellApplication { + name = "dav-sync"; + runtimeInputs = [ "vdirsyncer" "coreutils" "abook" ]; + text = '' + vdirsyncer discover && \ + vdirsyncer sync && \ + mkdir -p "$(dirname "${addressbook}")" && \ + cat "${contacts}"/*/*/* | \ + abook \ + --convert \ + --informat vcard \ + --outformat abook > \ + "${addressbook}" + ''; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index ee32b05..da6ed15 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,3 +1,5 @@ { pkgs ? import {}}: rec { offline-backups = pkgs.callPackage ./offline-backups {}; + rss-sync = pkgs.callPackage ./rss-sync {}; + dav-sync = pkgs.callPackage ./dav-sync {}; } diff --git a/pkgs/rss-sync/default.nix b/pkgs/rss-sync/default.nix new file mode 100644 index 0000000..32c4c73 --- /dev/null +++ b/pkgs/rss-sync/default.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +pkgs.writeShellApplication { + name = "rss-sync"; + runtimeInputs = [ "newsboat" ]; + text = '' + newsboat --execute="reload" + ''; +}