diff --git a/configs/default.nix b/configs/default.nix index b298b36..4fbe8ef 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -99,8 +99,8 @@ in { o = "${pkgs.xdg-utils}/bin/xdg-open"; ns = "nix-shell --run zsh"; - pbcopy = "${pkgs.xclip}/bin/xclip -selection clipboard -in"; - pbpaste = "${pkgs.xclip}/bin/xclip -selection clipboard -out"; + pbcopy = "${pkgs.wl-clipboard}/bin/wl-copy"; + pbpaste = "${pkgs.wl-clipboard}/bin/wl-paste"; tmux = "${pkgs.tmux}/bin/tmux -2"; sxiv = swallow "${pkgs.nsxiv}/bin/nsxiv"; zathura = swallow "${pkgs.zathura}/bin/zathura"; diff --git a/configs/keyboard.nix b/configs/keyboard.nix index 05be284..850f546 100644 --- a/configs/keyboard.nix +++ b/configs/keyboard.nix @@ -7,19 +7,19 @@ commaSep = builtins.concatStringsSep ","; xkbOptions = ["compose:caps" "terminate:ctrl_alt_bksp" "grp:ctrls_toggle"]; languages = { - deutsch = { code = "de"; variant = "T3"; }; - greek = { code = "gr"; variant = "polytonic"; }; - russian = { code = "ru"; variant = "phonetic"; }; arabic = { code = "ara"; variant = "buckwalter"; }; # ../lib/keyboards/arabic; - coptic = ../lib/keyboards/coptic; avestan = ../lib/keyboards/avestan; - gothic = ../lib/keyboards/gothic; + coptic = ../lib/keyboards/coptic; + deutsch = { code = "de"; variant = "T3"; }; farsi = { code = "ir"; variant = "qwerty"; }; - syriac = { code = "sy"; variant = "syc_phonetic"; }; - sanskrit = { code = "in"; variant = "san-kagapa"; }; + gothic = ../lib/keyboards/gothic; + greek = { code = "gr"; variant = "polytonic"; }; gujarati = {code = "in"; variant = "guj-kagapa"; }; - urdu = {code = "in"; variant = "urd-phonetic"; }; hebrew = {code = "il"; variant = "phonetic";}; + russian = { code = "ru"; variant = "phonetic"; }; + sanskrit = { code = "in"; variant = "san-kagapa"; }; + syriac = { code = "sy"; variant = "syc_phonetic"; }; + urdu = {code = "in"; variant = "urd-phonetic"; }; }; defaultLanguage = languages.deutsch; in { @@ -27,28 +27,33 @@ in { # man 7 xkeyboard-config services.xserver = { - exportConfiguration = true; # link /usr/share/X11 properly + # exportConfiguration = true; # link /usr/share/X11 properly xkb.layout = defaultLanguage.code; # T3: https://upload.wikimedia.org/wikipedia/commons/a/a9/German-Keyboard-Layout-T3-Version1-large.png # buckwalter: http://www.qamus.org/transliteration.htm xkb.variant = defaultLanguage.variant; xkb.options = commaSep xkbOptions; - xkb.dir = pkgs.symlinkJoin { - name = "x-keyboard-directory"; - paths = [ - "${pkgs.xkeyboard_config}/etc/X11/xkb" - (pkgs.linkFarm "custom-x-keyboards" ( - lib.mapAttrsToList (name: value: { - name = "symbols/${name}"; - path = value; - }) (lib.filterAttrs (_: value: !(value ? "code")) languages) ++ [ - { - name = "symbols/ir"; - path = ../lib/keyboards/farsi; - } - ] - )) - ]; + xkb.extraLayouts = { + "coptic" = { + languages = ["cop"]; + description = "Coptic"; + symbolsFile = ../lib/keyboards/coptic; + }; + "gothic" = { + languages = ["got"]; + description = "Gothic"; + symbolsFile = ../lib/keyboards/gothic; + }; + "avestan" = { + languages = ["ave"]; + description = "Avestan"; + symbolsFile = ../lib/keyboards/avestan; + }; + "farsi-good" = { + languages = ["fas"]; + description = "Farsi, but good"; + symbolsFile = ../lib/keyboards/farsi; + }; }; }; diff --git a/configs/niri.nix b/configs/niri.nix new file mode 100644 index 0000000..e30810c --- /dev/null +++ b/configs/niri.nix @@ -0,0 +1,322 @@ +{ pkgs, config, niveumPackages, lib, ... }: +let + niriConfig = + let + klem = niveumPackages.klem.override { + config.dmenu = "${pkgs.dmenu}/bin/dmenu -i -p klem"; + config.scripts = { + "p.r paste" = pkgs.writers.writeDash "p.r" '' + ${pkgs.curl}/bin/curl -fSs http://p.r --data-binary @- \ + | ${pkgs.coreutils}/bin/tail --lines=1 \ + | ${pkgs.gnused}/bin/sed 's/\\/krebsco.de/' + ''; + "envs.sh paste" = pkgs.writers.writeDash "envs-host" '' + ${pkgs.curl}/bin/curl -F "file=@-" https://envs.sh + ''; + "envs.sh shorten" = pkgs.writers.writeDash "envs-shorten" '' + ${pkgs.curl}/bin/curl -F "shorten=$(${pkgs.coreutils}/bin/cat)" https://envs.sh + ''; + "go.r shorten" = pkgs.writers.writeDash "go.r" '' + ${pkgs.curl}/bin/curl -fSs http://go.r -F "uri=$(${pkgs.coreutils}/bin/cat)" + ''; + "4d2.org paste" = pkgs.writers.writeDash "4d2-paste" '' + ${pkgs.curl}/bin/curl -F "file=@-" https://depot.4d2.org/ + ''; + "0x0.st shorten" = pkgs.writers.writeDash "0x0.st" '' + ${pkgs.curl}/bin/curl -fSs https://0x0.st -F "shorten=$(${pkgs.coreutils}/bin/cat)" + ''; + "rot13" = pkgs.writers.writeDash "rot13" '' + ${pkgs.coreutils}/bin/tr '[A-Za-z]' '[N-ZA-Mn-za-m]' + ''; + "ipa" = pkgs.writers.writeDash "ipa" '' + ${niveumPackages.ipa}/bin/ipa + ''; + "betacode" = pkgs.writers.writeDash "betacode" '' + ${niveumPackages.betacode}/bin/betacode + ''; + "curl" = pkgs.writers.writeDash "curl" '' + ${pkgs.curl}/bin/curl -fSs "$(${pkgs.coreutils}/bin/cat)" + ''; + ocr = pkgs.writers.writeDash "ocr" '' + ${pkgs.tesseract4}/bin/tesseract -l eng+deu - stdout + ''; + emojai = pkgs.writers.writeDash "emojai" '' + ${pkgs.curl}/bin/curl https://www.emojai.app/api/generate -X POST -H 'Content-Type: application/json' --data-raw "$(${pkgs.jq}/bin/jq -sR '{emoji:.}')" | ${pkgs.jq}/bin/jq -r .result + ''; + "gpt-3.5" = pkgs.writers.writeDash "gpt" '' + ${niveumPackages.gpt35}/bin/gpt + ''; + gpt-4 = pkgs.writers.writeDash "gpt" '' + ${niveumPackages.gpt4}/bin/gpt + ''; + }; + }; + in + '' + spawn-at-startup "waybar" + spawn-at-startup "${pkgs.xwayland-satellite}/bin/xwayland-satellite" + + environment { + DISPLAY ":0" + } + + input { + warp-mouse-to-focus + focus-follows-mouse max-scroll-amount="0%" + + keyboard { + repeat-rate 35 + repeat-delay 350 + track-layout "global" + + xkb { + layout "de" + variant "T3" + options "ctrl:nocaps,compose:caps,grp:ctrls_toggle" + } + } + touchpad { + click-method "clickfinger" + tap + dwt + dwtp + } + } + + prefer-no-csd + + hotkey-overlay { + skip-at-startup + } + + layout { + gaps 5 + + default-column-width { + proportion 0.5 + } + + preset-column-widths { + proportion 0.33333 + proportion 0.5 + proportion 0.66667 + } + + focus-ring { + width 2 + } + + shadow { + // on + softness 30 + spread 5 + offset x=0 y=5 + draw-behind-window true + color "#00000070" + // inactive-color "#00000054" + } + + tab-indicator { + // off + hide-when-single-tab + place-within-column + gap 5 + width 4 + length total-proportion=1.0 + position "right" + gaps-between-tabs 2 + corner-radius 8 + active-color "red" + inactive-color "gray" + urgent-color "blue" + // active-gradient from="#80c8ff" to="#bbddff" angle=45 + // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" + // urgent-gradient from="#800" to="#a33" angle=45 + } + + border { + off + } + } + + animations { + // off + workspace-switch { + spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001 + } + + window-open { + duration-ms 150 + curve "ease-out-expo" + } + + window-close { + duration-ms 150 + curve "ease-out-quad" + } + + horizontal-view-movement { + spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 + } + + window-movement { + spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 + } + + window-resize { + spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 + } + + config-notification-open-close { + spring damping-ratio=0.6 stiffness=1000 epsilon=0.001 + } + + screenshot-ui-open { + duration-ms 200 + curve "ease-out-quad" + } + + overview-open-close { + spring damping-ratio=1.0 stiffness=800 epsilon=0.0001 + } + } + + window-rule { + geometry-corner-radius 0 + clip-to-geometry true + } + + window-rule { + match is-window-cast-target=true + + border { + on + width 3 + active-color "#f38ba8" + inactive-color "#7d0d2d" + } + } + + binds { + Mod+Shift+Slash { show-hotkey-overlay; } + Mod+Return { spawn "${(defaultApplications pkgs).terminal}"; } + Mod+D { spawn "${pkgs.wofi}/bin/wofi" "--show" "run"; } + Mod+Shift+D { spawn "${niveumPackages.notemenu}/bin/notemenu"; } + Mod+T { spawn "${(defaultApplications pkgs).fileManager}"; } + Mod+Y { spawn "${(defaultApplications pkgs).browser}"; } + Mod+P { spawn "rofi-pass"; } + Mod+U { spawn "${niveumPackages.unicodmenu}/bin/unicodmenu"; } + + Mod+B { spawn "pkill" "-SIGUSR1" "waybar"; } + Mod+F12 { spawn "${klem}/bin/klem"; } + + Mod+Shift+Q { close-window; } + + XF86AudioRaiseVolume allow-when-locked=true { spawn "${pkgs.pamixer}/bin/pamixer -i 5"; } + XF86AudioLowerVolume allow-when-locked=true { spawn "${pkgs.pamixer}/bin/pamixer -d 5"; } + XF86AudioMute allow-when-locked=true { spawn "${pkgs.pamixer}/bin/pamixer -t"; } + + XF86AudioPause allow-when-locked=true { spawn "${pkgs.playerctl}/bin/playerctl play-pause"; } + XF86AudioPlay allow-when-locked=true { spawn "${pkgs.playerctl}/bin/playerctl play-pause"; } + XF86AudioNext allow-when-locked=true { spawn "${pkgs.playerctl}/bin/playerctl next"; } + XF86AudioPrev allow-when-locked=true { spawn "${pkgs.playerctl}/bin/playerctl previous"; } + XF86AudioStop allow-when-locked=true { spawn "${pkgs.playerctl}/bin/playerctl stop"; } + Print { spawn "flameshot gui"; } + Mod+Shift+W { spawn "swaylock"; } + + Mod+Comma { consume-or-expel-window-left; } + Mod+Period { consume-or-expel-window-right; } + Mod+W { toggle-column-tabbed-display; } + Mod+A repeat=false { toggle-overview; } + Mod+F { maximize-column; } + Mod+C { center-column; } + Mod+Minus { set-column-width "-25%"; } + Mod+Plus { set-column-width "+25%"; } + + Mod+Ctrl+0 { spawn "niri" "msg" "action" "switch-layout" "0"; } + Mod+Ctrl+1 { spawn "niri" "msg" "action" "switch-layout" "1"; } + Mod+Ctrl+2 { spawn "niri" "msg" "action" "switch-layout" "2"; } + Mod+Ctrl+3 { spawn "niri" "msg" "action" "switch-layout" "3"; } + Mod+Ctrl+4 { spawn "niri" "msg" "action" "switch-layout" "4"; } + Mod+Ctrl+5 { spawn "niri" "msg" "action" "switch-layout" "5"; } + Mod+Ctrl+6 { spawn "niri" "msg" "action" "switch-layout" "6"; } + Mod+Ctrl+7 { spawn "niri" "msg" "action" "switch-layout" "7"; } + Mod+Ctrl+8 { spawn "niri" "msg" "action" "switch-layout" "8"; } + Mod+Ctrl+9 { spawn "niri" "msg" "action" "switch-layout" "9"; } + + Mod+H { focus-column-or-monitor-left; } + Mod+J { focus-window-or-workspace-down; } + Mod+K { focus-window-or-workspace-up; } + Mod+L { focus-column-or-monitor-right; } + + Mod+Shift+H { move-column-left-or-to-monitor-left; } + Mod+Shift+J { move-window-down-or-to-workspace-down; } + Mod+Shift+K { move-window-up-or-to-workspace-up; } + Mod+Shift+L { move-column-right-or-to-monitor-right; } + + Mod+Ctrl+H { focus-monitor-left; } + Mod+Ctrl+J { focus-monitor-down; } + Mod+Ctrl+K { focus-monitor-up; } + Mod+Ctrl+L { focus-monitor-right; } + + Mod+Shift+Ctrl+H { move-column-to-monitor-left; } + Mod+Shift+Ctrl+J { move-column-to-workspace-down; } + Mod+Shift+Ctrl+K { move-column-to-workspace-up; } + Mod+Shift+Ctrl+L { move-column-to-monitor-right; } + + Mod+Shift+Alt+Ctrl+H { move-workspace-to-monitor-left; } + Mod+Shift+Alt+Ctrl+J { move-workspace-down; } + Mod+Shift+Alt+Ctrl+K { move-workspace-up; } + Mod+Shift+Alt+Ctrl+L { move-workspace-to-monitor-right; } + + Mod+1 { focus-workspace 1; } + Mod+2 { focus-workspace 2; } + Mod+3 { focus-workspace 3; } + Mod+4 { focus-workspace 4; } + Mod+5 { focus-workspace 5; } + Mod+6 { focus-workspace 6; } + Mod+7 { focus-workspace 7; } + Mod+8 { focus-workspace 8; } + Mod+9 { focus-workspace 9; } + Mod+0 { focus-workspace 10; } + + Mod+Shift+1 { move-window-to-workspace "1"; } + Mod+Shift+2 { move-window-to-workspace "2"; } + Mod+Shift+3 { move-window-to-workspace "3"; } + Mod+Shift+4 { move-window-to-workspace "4"; } + Mod+Shift+5 { move-window-to-workspace "5"; } + Mod+Shift+6 { move-window-to-workspace "6"; } + Mod+Shift+7 { move-window-to-workspace "7"; } + Mod+Shift+8 { move-window-to-workspace "8"; } + Mod+Shift+9 { move-window-to-workspace "9"; } + Mod+Shift+0 { move-window-to-workspace "0"; } + } + ''; +in { + system.activationScripts.niriConfig = { + text = '' + cp ${pkgs.writeText "config.kdl" niriConfig} ${config.users.users.me.home}/.config/niri/config.kdl + chown ${config.users.users.me.name}:${config.users.users.me.group} ${config.users.users.me.home}/.config/niri/config.kdl + ''; + }; + + programs.niri.enable = true; + services.displayManager.defaultSession = lib.mkForce "niri"; + home-manager.users.me = { + programs.alacritty.enable = true; # Super+T in the default setting (terminal) + programs.swaylock.enable = true; # Super+Alt+L in the default setting (screen locker) + programs.waybar = { + enable = true; # launch on startup in the default setting (bar) + settings = { + }; + }; + services.mako.enable = true; # notification daemon + services.swayidle.enable = true; # idle management daemon + home.packages = with pkgs; [ + xdg-desktop-portal-gnome + swaybg + ]; + }; + services.gnome.gnome-keyring.enable = true; # secret service + security.pam.services.swaylock = { }; +} diff --git a/configs/packages.nix b/configs/packages.nix index 2fe8ed3..fde518a 100644 --- a/configs/packages.nix +++ b/configs/packages.nix @@ -95,7 +95,7 @@ in { gnome-disk-utility arandr # xrandr for noobs libnotify # for notify-send - xclip # clipboard CLI + wl-clipboard # clipboard CLI xdragon # drag and drop xorg.xkill # kill by clicking portfolio # personal finance overview diff --git a/lib/style.css b/lib/style.css new file mode 100644 index 0000000..b33aa7a --- /dev/null +++ b/lib/style.css @@ -0,0 +1,175 @@ +* { + font-size: 14px; + border-radius: 5px; +} + +window#waybar { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, monospace; + background-color: transparent; + border-bottom: 0px; + color: #ebdbb2; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +window#waybar.empty #window { + background-color: transparent; +} + +/* +window#waybar.empty { + background-color: transparent; +} +window#waybar.solo { + background-color: #FFFFFF; +} +*/ + +.modules-right { + margin: 10px 10px 0 0; +} +.modules-center { + margin: 10px 0 0 0; +} +.modules-left { + margin: 10px 0 0 10px; +} + +button { + /* Use box-shadow instead of border so the text isn't offset */ + /* box-shadow: inset 0 -3px transparent; */ + border: none; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +/* +button:hover { + background: inherit; + box-shadow: inset 0 -3px #ebdbb2; +} */ + +#workspaces { + background-color: #282828; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ebdbb2; + border-radius: 0; +} + +#workspaces button:first-child { + border-radius: 5px 0 0 5px; +} + +#workspaces button:last-child { + border-radius: 0 5px 5px 0; +} + +#workspaces button:hover { + color: #d79921; +} + +#workspaces button.focused { + background-color: #665c54; + /* box-shadow: inset 0 -3px #ffffff; */ +} + +#workspaces button.urgent { + background-color: #b16286; +} + +#idle_inhibitor, +#cava, +#scratchpad, +#mode, +#window, +#clock, +#battery, +#backlight, +#wireplumber, +#tray, +#mpris, +#load { + padding: 0 10px; + background-color: #282828; + color: #ebdbb2; +} + +#mode { + background-color: #689d6a; + color: #282828; + /* box-shadow: inset 0 -3px #ffffff; */ +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} + +#cava { + padding: 0 5px; +} + +#battery.charging, #battery.plugged { + background-color: #98971a; + color: #282828; +} + +@keyframes blink { + to { + background-color: #282828; + color: #ebdbb2; + } +} + +/* Using steps() instead of linear as a timing function to limit cpu usage */ +#battery.critical:not(.charging) { + background-color: #cc241d; + color: #ebdbb2; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: steps(12); + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#wireplumber.muted { + background-color: #458588; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; +} + +#mpris.playing { + background-color: #d79921; + color: #282828; +} + +#tray menu { + font-family: sans-serif; +} + +#scratchpad.empty { + background: transparent; +} diff --git a/packages/klem.nix b/packages/klem.nix index 1ec63ca..7db02ee 100644 --- a/packages/klem.nix +++ b/packages/klem.nix @@ -42,14 +42,14 @@ in pkgs.writers.writeDashBin "klem" '' set -efu - ${pkgs.xclip}/bin/xclip -selection ${cfg.selection} -out \ + ${pkgs.wl-clipboard}/bin/wl-paste \ | case $(echo "${ lib.concatStringsSep "\n" (lib.attrNames cfg.scripts) }" | ${cfg.dmenu}) in ${lib.concatStringsSep "\n" (lib.mapAttrsToList scriptCase cfg.scripts)} *) ${pkgs.coreutils}/bin/cat ;; esac \ - | ${pkgs.xclip}/bin/xclip -selection ${cfg.selection} -in + | ${pkgs.wl-clipboard}/bin/wl-copy ${pkgs.libnotify}/bin/notify-send --app-name="klem" "Result copied to clipboard." '' diff --git a/packages/qrpaste.nix b/packages/qrpaste.nix index d059b4e..1c945a3 100644 --- a/packages/qrpaste.nix +++ b/packages/qrpaste.nix @@ -2,7 +2,7 @@ writers, mktemp, qrencode, - xclip, + wl-clipboard, nsxiv, }: writers.writeDashBin "qrpaste" '' @@ -11,6 +11,6 @@ writers.writeDashBin "qrpaste" '' clean() { rm "$file" } - ${qrencode}/bin/qrencode "$(${xclip}/bin/xclip -selection clipboard -out)" -o "$file" + ${qrencode}/bin/qrencode "$(${wl-clipboard}/bin/wl-paste)" -o "$file" ${nsxiv}/bin/nsxiv "$file" '' diff --git a/packages/ttspaste.nix b/packages/ttspaste.nix index 2e6f28d..134e876 100644 --- a/packages/ttspaste.nix +++ b/packages/ttspaste.nix @@ -1,10 +1,10 @@ { writers, - xclip, + wl-clipboard, espeak, }: writers.writeDashBin "ttspaste" '' - ${xclip}/bin/xclip -selection clipboard -out | ${espeak}/bin/espeak + ${wl-clipboard}/bin/paste | ${espeak}/bin/espeak '' # curl, mpv, # ${curl}/bin/curl -G http://tts.r/api/tts --data-urlencode 'text@-' | ${mpv}/bin/mpv -