summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-12-16 16:25:27 -0500
committerBen Sima <ben@bsima.me>2022-12-16 16:25:27 -0500
commit0858e7a3a39ddd2deae128f513fbdedd9edff1b9 (patch)
treefcf2f65c5579e32c40a8b6f868128ab46bac2bbe /lib
parentd1cc16ccafa8e4230226efd20a5ae5d373bac305 (diff)
parent77d7f79048484266bddde2ce9405d10411a8a1d7 (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'lib')
-rw-r--r--lib/cfg.def.h2
-rw-r--r--lib/common.nix35
-rw-r--r--lib/const.nix5
-rw-r--r--lib/linux.nix23
-rw-r--r--lib/packages.nix8
-rw-r--r--lib/ssh.nix6
-rw-r--r--lib/userstyles.css9
-rw-r--r--lib/xmonad.hs53
8 files changed, 97 insertions, 44 deletions
diff --git a/lib/cfg.def.h b/lib/cfg.def.h
index d1e7119..57709fc 100644
--- a/lib/cfg.def.h
+++ b/lib/cfg.def.h
@@ -79,7 +79,7 @@ static struct command system_commands[] = {
DEFCMD("R", "reboot", "reboot")
DEFCMD("S", "suspend", "systemctl suspend")
DEFCMD("h", "h-m switch", "home-manager switch")
- DEFCMD("w", "fresh wall", "n wal")
+ DEFCMD("w", "fresh wall", "wal")
DEFCMD("x", "restart xbindkeys", "pkill xbindkeys && xbindkeys")
DEFCMD("l", "light theme", "xtheme light")
diff --git a/lib/common.nix b/lib/common.nix
index cdbbf6e..247a81e 100644
--- a/lib/common.nix
+++ b/lib/common.nix
@@ -1,11 +1,9 @@
{ pkgs, lib, ... }:
let
+ inherit (import ./const.nix) fontSize homedir gpgid;
locale = "en_US.UTF-8";
- gpgid = "66A6AD150399D970DCA4C4E6C8218B7D0BFDECCD";
- homedir = builtins.getEnv "HOME";
-in
-{
+in {
nixpkgs.overlays = [ (import ../overlay.nix) ];
home = {
stateVersion = "18.09";
@@ -17,7 +15,6 @@ in
LANGUAGE = locale;
PATH = "${homedir}/bin:${homedir}/.local/bin:$PATH";
PAGER = "less"; # "bat --theme=ansi";
- LEDGER_FILE = "${homedir}/.hledger.journal";
XTERM_LOCALE = locale;
PYTHONSTARTUP = "${homedir}/.pythonrc";
@@ -48,14 +45,6 @@ in
source = ./editorconfig;
target = ".editorconfig";
};
- hledger = {
- source = builtins.toFile "hledger.journal" ''
- !include ${homedir}/org/fund/accounts.journal
- !include ${homedir}/org/fund/ledger.journal
- !include ${homedir}/org/fund/prices.journal
- '';
- target = ".hledger.journal";
- };
pythonrc = {
source = ./pythonrc;
target = ".pythonrc";
@@ -119,13 +108,16 @@ in
glog = ''log --decorate --all --graph --pretty=format:"%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'';
};
extraConfig = {
- fetch.showForcedUpdate = "false";
- push.default = "simple";
- pull.rebase = "true";
commit.template = "${./git-commit-template}";
commit.verbose = "true";
- mergetool.fugitive.cmd = ''vim -f -c "Gvdiffsplit!" "$MERGED"'';
+ fetch.showForcedUpdate = "false";
+ init.defaultBranch = "main";
+ log.date = "local";
merge.tool = "fugitive";
+ mergetool.fugitive.cmd = ''vim -f -c "Gvdiffsplit!" "$MERGED"'';
+ pull.rebase = "true";
+ push.default = "current";
+ remote.pushDefault = "origin";
sendemail = {
#smtpuser = "ben@bsima.me";
#smtpserverport = 587;
@@ -135,9 +127,7 @@ in
annotate = "yes";
cccmd = "git-contacts";
};
- log = {
- date = "local";
- };
+
};
};
@@ -208,6 +198,7 @@ in
set -g status-left-length 30
set -g status-left '#S | #(whoami)@#(hostname) | '
set -g status-right '~%Y.%m.%d..%H.%M'
+ set -g renumber-windows on
# white-ish background with dark-grey text
set -g status-style bg=colour0,fg=colour13
# highlight current window
@@ -227,7 +218,9 @@ in
urxvt = let font = size: "xft:Fira Mono:size=${toString size}:ant"; in {
enable = true;
fonts = [
- (font 6)
+ # for some reason, urxvt font size is much larger than every other
+ # program's, so i gotta cut it in half
+ (font (fontSize / 2))
"xft:Noto Emoji"
];
keybindings = {
diff --git a/lib/const.nix b/lib/const.nix
new file mode 100644
index 0000000..0accd17
--- /dev/null
+++ b/lib/const.nix
@@ -0,0 +1,5 @@
+{
+ fontSize = 16;
+ homedir = builtins.getEnv "HOME";
+ gpgid = "66A6AD150399D970DCA4C4E6C8218B7D0BFDECCD";
+}
diff --git a/lib/linux.nix b/lib/linux.nix
index 15ea28a..a4af6c2 100644
--- a/lib/linux.nix
+++ b/lib/linux.nix
@@ -1,11 +1,10 @@
{ pkgs, lib, ... }:
let
- homedir = builtins.getEnv "HOME";
+ inherit (import ./const.nix) fontSize homedir gpgid;
getHostname = pkgs.runCommand "hostname" {}
"${pkgs.hostname}/bin/hostname > $out";
hostname = lib.strings.removeSuffix "\n" (builtins.readFile "${getHostname}");
- gpgid = "66A6AD150399D970DCA4C4E6C8218B7D0BFDECCD";
base16-scheme = "atelier-sulphurpool";
base16-scheme-filename = lib.strings.concatStrings (lib.strings.splitString "-" base16-scheme);
theme = lib.removeSuffix "\n" (builtins.readFile "${homedir}/.local/share/xtheme");
@@ -96,23 +95,29 @@ in
xdotool
xlayoutdisplay
xorg.xmodmap
+ xsel
xterm
yank
youtube-dl
yubioath-desktop
zathura
-
- # languages i regularly use
- (haskellPackages.ghcWithPackages (a: with a; [hledger rainbow])) # for hledger scripting
];
};
fonts.fontconfig.enable = true;
+ gtk.enable = false; # this fails because of some missing service file
+ gtk.font.name = "Fira Sans";
+ gtk.font.size = fontSize;
+ gtk.font.package = pkgs.fira;
+ gtk.theme.name = "Breeze";
+ gtk.iconTheme.name = "hicolor";
+ gtk.cursorTheme.name = "breeze_cursors";
+
xresources = {
properties = {
- "XTerm*font" = "-*-FiraMono-medium-r-normal--10-*-*-*-*-*-iso10646-1";
+ "XTerm*font" = "-*-FiraMono-medium-r-normal--${toString fontSize}-*-*-*-*-*-iso10646-1";
"XTerm*faceName" = "FireMono";
- "XTerm*faceSize" = "10";
+ "XTerm*faceSize" = toString fontSize;
"XTerm*termName" = "xterm-256color";
"XTerm*metaSendsEscape" = true;
"XTerm*utf8" = true;
@@ -145,7 +150,7 @@ in
config = {
"bar/top" = {
background = colors."${theme}".background;
- font-0 = "FiraSans:size=16";
+ font-0 = "FiraSans:size=${toString fontSize}";
font-1 = "Font Awesome 5:pixelsize=11;1";
font-2 = "MaterialIcons:size=10:antialias=false;2";
foreground = colors."${theme}".foreground;
@@ -303,7 +308,7 @@ in
};
redshift = {
- enable = true;
+ enable = false;
latitude = "40.80";
longitude = "-81.52";
temperature = {
diff --git a/lib/packages.nix b/lib/packages.nix
index dd87cb2..6761da3 100644
--- a/lib/packages.nix
+++ b/lib/packages.nix
@@ -47,6 +47,7 @@ in {
bat
barrier
bc
+ cava
cloc
cmatrix
direnv
@@ -62,6 +63,7 @@ in {
fossil
gcal
git-lfs
+ git-revise
github-cli
gotop
hashcash
@@ -71,6 +73,7 @@ in {
jq
lsof
mpc_cli
+ nb
ncdu
nmap
ncmpc
@@ -88,9 +91,14 @@ in {
pup
pv
pwgen
+ python3
qrencode
ranger
ripgrep
+ scc
+ sshfs
+ sysz
+ tailscale
tmux
tree
unrar
diff --git a/lib/ssh.nix b/lib/ssh.nix
index 48b79ad..29cb677 100644
--- a/lib/ssh.nix
+++ b/lib/ssh.nix
@@ -47,6 +47,12 @@ in {
identityFile = [ "${homedir}/.ssh/id_rsa" ];
identitiesOnly = true;
};
+ "gerrit.simatime.com" = {
+ hostname = "gerrit.simatime.com";
+ user = "bsima";
+ identityFile = [ "${homedir}/.ssh/gerrit.simatime.com" ];
+ identitiesOnly = true;
+ };
"lithium" = {
hostname = "192.168.1.9";
user = "ben";
diff --git a/lib/userstyles.css b/lib/userstyles.css
index 1b1449b..e610609 100644
--- a/lib/userstyles.css
+++ b/lib/userstyles.css
@@ -7,3 +7,12 @@ input, input#hoogle
/* gitolite.com */
body { background: transparent }
+
+/* huggingface */
+.lg\:.bg-gradient-to-r,
+.bg-gradient-to-l,
+.lg\:.bg-gradient-to-l,
+.bg-gradient-to-t,
+.overview-card-wrapper,
+.tag, .btn
+{ background: transparent }
diff --git a/lib/xmonad.hs b/lib/xmonad.hs
index 51ae0a8..b3cdffd 100644
--- a/lib/xmonad.hs
+++ b/lib/xmonad.hs
@@ -11,16 +11,21 @@ Docs:
- XMonad API: https://hackage.haskell.org/package/xmonad
- Contrib API: https://hackage.haskell.org/package/xmonad-contrib
+Inspirations:
+
+- https://reddit.simatime.com/wy695w
+
-}
-import Data.List (intercalate)
import Data.Functor ((<&>))
+import Data.List (intercalate, isPrefixOf)
import Graphics.X11.ExtraTypes.XF86
import XMonad
import XMonad.Actions.CopyWindow
import XMonad.Config
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.ManageDocks
+import XMonad.Hooks.ManageHelpers (doFullFloat, isFullscreen)
import XMonad.Layout.BinarySpacePartition
import XMonad.Layout.Dwindle as Dwindle
import XMonad.Layout.LayoutModifier
@@ -31,8 +36,10 @@ import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed
import XMonad.Layout.ThreeColumns
import XMonad.Layout.TwoPane
+import qualified XMonad.StackSet as W
import XMonad.Util.CustomKeys (customKeys)
import XMonad.Util.EZConfig (additionalKeys)
+import XMonad.Util.Scratchpad
-- Colors
data Colors = Colors
@@ -71,21 +78,39 @@ brighter = "brightnessctl s 5%+"
dimmer = "brightnessctl s 5%-"
+shouldntFloat :: String -> Bool
+shouldntFloat = isPrefixOf "qutebrowser"
+
+shouldFloat :: Query Bool
+shouldFloat = do
+ fs <- isFullscreen
+ name <- appName
+ return (fs && not (shouldntFloat name))
+
+-- RationalRect is x y w h
+scratchHook = scratchpadManageHook (W.RationalRect 0.125 0.125 0.75 0.75)
+
+myManageHook = manageDocks <+> scratchHook <+> (shouldFloat --> doFullFloat) <+> manageHook def
+
+-- todo: use urxvtc with daemon
+termName = "/home/ben/.nix-profile/bin/urxvt"
+transparentTerm = "urxvt -depth 32 -bg rgba:0000/0000/0000/4444 -fg '[80]white'"
+
insKeys :: XConfig l -> [((KeyMask, KeySym), X ())]
insKeys conf@(XConfig {modMask = modMask}) =
[ ((modMask, xK_y), spawn "passmenu"),
((modMask, xK_m), spawn "cmdtree"),
((modMask, xK_o), spawn "rofi -sidebar-mode -show run"),
((modMask, xK_n), spawn "rofi -sidebar-mode -show window"),
-
+ ((modMask, xK_u), spawn "rofi -show calc -modi calc -no-show-match -no-sort"),
+ ((modMask, xK_s), scratchpadSpawnActionTerminal transparentTerm),
+ ((modMask, xK_h), spawn transparentTerm),
-- refresh display via autorandr
( (modMask, xK_r),
spawn $ "autorandr --cycle"
),
-
-- lock it up
- ( (modMask .|. shiftMask, xK_l), spawn "xautolock -locknow"),
-
+ ((modMask .|. shiftMask, xK_l), spawn "xautolock -locknow"),
-- sticky windows
((modMask, xK_a), windows copyToAll), -- @@ Make focused window always visible
((modMask .|. shiftMask, xK_a), killAllOtherCopies), -- @@ Toggle window state back
@@ -134,14 +159,15 @@ myLayout theme =
||| (addSpace $ noBorders Full)
||| twopane
||| Mirror twopane
--- ||| ThreeCol 1 (3 / 100) (1 / 2)
--- ||| ThreeColMid 1 (3 / 100) (1 / 2)
+ -- ||| ThreeCol 1 (3 / 100) (1 / 2)
+ -- ||| ThreeColMid 1 (3 / 100) (1 / 2)
||| tiled
||| Mirror tiled
||| emptyBSP
--- ||| goldenSpiral
--- ||| Spiral R Dwindle.CW (3 / 2) (11 / 10) -- L/R is where to put non-main windows
where
+ -- ||| goldenSpiral
+ -- ||| Spiral R Dwindle.CW (3 / 2) (11 / 10) -- L/R is where to put non-main windows
+
-- The last parameter is fraction to multiply the slave window heights
-- with. Useless here.
tiled = addSpace $ ResizableTall nmaster delta ratio []
@@ -154,17 +180,18 @@ myLayout theme =
-- Percent of screen to increment by when resizing panes
delta = 3 / 100
-myConf theme = additionalKeys c (insKeys c)
+
+myConf theme = additionalKeys cfg (insKeys cfg)
where
- c =
+ cfg =
def
{ modMask = mod4Mask, -- super instead of alt
normalBorderColor = background theme,
focusedBorderColor = highlight theme,
borderWidth = 3,
- manageHook = manageDocks <+> manageHook def,
+ manageHook = myManageHook,
layoutHook = myLayout theme,
- terminal = "/home/ben/.nix-profile/bin/urxvt",
+ terminal = termName,
workspaces = myWorkspaces
}