Compare commits

..

4 Commits

Author SHA1 Message Date
df682cdebe modules/nvim: update config
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-04 07:37:56 +05:30
b09e4cf2ea home/natto: misc changes
update st config
update pkgs and stuff
misc updates to emacs and xmonad config

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-04 07:37:15 +05:30
78a51754a4 flakes: update channels
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-04 07:37:15 +05:30
4f49f4f0ec overlays: customscripts: misc changes, patches: moved to home
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-04 07:37:15 +05:30
22 changed files with 6172 additions and 839 deletions

112
flake.lock generated
View File

@@ -22,11 +22,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1668937370,
"narHash": "sha256-sxGxDs0YKR3bLzo989bERWgVlkVMirchMkSlP7qrWHQ=",
"lastModified": 1669924706,
"narHash": "sha256-5YdsL731ESOT8wZ6aBPG7V2AZxYglK/N8JJopp9R+Ow=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "a385a268c2bd4a411caff28adc785f6ba479d79f",
"rev": "7419dbeb120e44bfb8cbbb74f1b4e77b3f8401ab",
"type": "github"
},
"original": {
@@ -68,11 +68,11 @@
},
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
@@ -102,11 +102,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1668900402,
"narHash": "sha256-IhVlueHoQNoN0SOHZIceKU3LyEL00g2ei0aUlaNypbQ=",
"lastModified": 1669825171,
"narHash": "sha256-HxlZHSiRGXnWAFbIJMeujqBe2KgACYx5XDRY0EA9P+4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c0f9cbcf93ca22e4f0ca66843be61a4bdf6f0a44",
"rev": "478610aa37c8339eacabfa03f07dacf5574edd47",
"type": "github"
},
"original": {
@@ -142,11 +142,11 @@
"utils": "utils_2"
},
"locked": {
"lastModified": 1658267644,
"narHash": "sha256-NJRe1rnlF112eZwxNASlRL8/ghwD8g+lpHIYRkWQxC8=",
"lastModified": 1669807829,
"narHash": "sha256-rgQ8MYV1UD4Ynw0wzfl9hatgsV5GV7X6eM6ioSPKzls=",
"owner": "simple-nixos-mailserver",
"repo": "nixos-mailserver",
"rev": "004c229ca44c069d93c92abf67ff1619fb508c6a",
"rev": "694e7d34f60028f4877517e1c7c73c9527fad400",
"type": "gitlab"
},
"original": {
@@ -157,11 +157,11 @@
},
"master": {
"locked": {
"lastModified": 1668942923,
"narHash": "sha256-mKFHBr5drA1Dp3l3Oay60ULVVg4DqyT/oXeoO1KW/4Q=",
"lastModified": 1669939897,
"narHash": "sha256-DjVJK3t6HRxul4k6pNwfgGpjF5PirmZjgFjRvBTrlAk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "991053d8a0e1543475d09cb8272c42e8ebe66755",
"rev": "67f5368df158a7ef2f020ccca17f88ab20caa786",
"type": "github"
},
"original": {
@@ -200,11 +200,11 @@
},
"locked": {
"dir": "contrib",
"lastModified": 1668865307,
"narHash": "sha256-Fwoalxq8UzocDeK5LIlAOT/JglG8SeGtH6yvvzHh/uU=",
"lastModified": 1669866653,
"narHash": "sha256-Xtis0StzXynHe7gnqgcl4sm2JHva9Y+KlVjaOaf/S3w=",
"owner": "neovim",
"repo": "neovim",
"rev": "6e8ed5abaa9c33d1d78ab7ff5b07dd5bac623a1d",
"rev": "1390e97c200ee265f72a4e2d7ec1a47fd65462ee",
"type": "github"
},
"original": {
@@ -219,11 +219,11 @@
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1667666664,
"narHash": "sha256-MKtN2/8E22SGRf8wroj3qYvhQEBVcsZJjYeX9eu+bt0=",
"lastModified": 1669128192,
"narHash": "sha256-iBkK3E/S4XfQDi+2hr8WWitiIUZ5EWsmfTcR4jbIPNA=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "cc8ece45d1987d5187e2528b59f9136f6aa8f465",
"rev": "9f96bd578ee5c1511535adccd295383d79fb791d",
"type": "github"
},
"original": {
@@ -234,11 +234,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1668912770,
"narHash": "sha256-Nzt7ALUl5PrUAYIH8aRbj+njkJZVQ4VQBkWx+qQvqyM=",
"lastModified": 1669261230,
"narHash": "sha256-AjddxRPd5y5jge77281P3O8+Cnafj842Xg59rwV4x+0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "862277ac9d34273cd953f42061e23d488d6b7e8b",
"rev": "8e8b5f3b1e899bf5d250279578c0283705b8cdb4",
"type": "github"
},
"original": {
@@ -263,11 +263,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1667629849,
"narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=",
"lastModified": 1669542132,
"narHash": "sha256-DRlg++NJAwPh8io3ExBJdNW7Djs3plVI5jgYQ+iXAZQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3bacde6273b09a21a8ccfba15586fb165078fb62",
"rev": "a115bb9bd56831941be3776c8a94005867f316a7",
"type": "github"
},
"original": {
@@ -279,11 +279,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1668912770,
"narHash": "sha256-Nzt7ALUl5PrUAYIH8aRbj+njkJZVQ4VQBkWx+qQvqyM=",
"lastModified": 1669261230,
"narHash": "sha256-AjddxRPd5y5jge77281P3O8+Cnafj842Xg59rwV4x+0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "862277ac9d34273cd953f42061e23d488d6b7e8b",
"rev": "8e8b5f3b1e899bf5d250279578c0283705b8cdb4",
"type": "github"
},
"original": {
@@ -339,11 +339,11 @@
},
"nixpkgs_7": {
"locked": {
"lastModified": 1668912770,
"narHash": "sha256-Nzt7ALUl5PrUAYIH8aRbj+njkJZVQ4VQBkWx+qQvqyM=",
"lastModified": 1669900182,
"narHash": "sha256-EKxjHxRJnP1w+2nnm8pq4Uqkqa5McnfPXcO8cG8Mxzc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "862277ac9d34273cd953f42061e23d488d6b7e8b",
"rev": "bcb6dbbe30ce7631e5a0865dff1ab9b63d92977d",
"type": "github"
},
"original": {
@@ -355,11 +355,11 @@
},
"nixpkgs_8": {
"locked": {
"lastModified": 1668882784,
"narHash": "sha256-L1mHACWrG83j8U/jDtAdQHmVZu+JwVUxRPf5mhuzr2s=",
"lastModified": 1669809720,
"narHash": "sha256-RMT77f6CPOYtLLQ2esj+EJ1BPVWxf4RDidjrSvA5OhI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a1b4a562216eba8df3053bd869155dde4b5bca12",
"rev": "227de2b3bbec142f912c09d5e8a1b4e778aa54fb",
"type": "github"
},
"original": {
@@ -387,11 +387,11 @@
},
"nur": {
"locked": {
"lastModified": 1668941054,
"narHash": "sha256-XIbMIkHOkTR6v9yRLTBaYujHsRqLQiNC2Ib9WCMUNkM=",
"lastModified": 1669805596,
"narHash": "sha256-g1CPQZ+1jGhY4bsjppk+gH5jfzzqmPlqGHg0zSYS3Hw=",
"owner": "nix-community",
"repo": "NUR",
"rev": "dc40ffbd076ef04a1608b10987c2eb308a189ac6",
"rev": "c81b1e527f3a220abfa9bf8096153d52784c5007",
"type": "github"
},
"original": {
@@ -407,11 +407,11 @@
"nixpkgs": "nixpkgs_8"
},
"locked": {
"lastModified": 1668932129,
"narHash": "sha256-DcGSEgs+q+JRQwrxdasedbMkYZ9g5jxkekd+td+dXxs=",
"lastModified": 1669882574,
"narHash": "sha256-YvfuFvOHQeQEHPoQr8sp2wnryGOucldcleWNZjvH9uY=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "543d1ddb6231aef08e4ce063d72d0822b9b60598",
"rev": "58c5eeb11792c32f45e1d9e06017727f722a23eb",
"type": "github"
},
"original": {
@@ -422,16 +422,16 @@
},
"old": {
"locked": {
"lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
"lastModified": 1669764884,
"narHash": "sha256-1qWR/5+WtqxSedrFbUbM3zPMO7Ec2CGWaxtK4z4DdvY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
"rev": "0244e143dc943bcf661fdaf581f01eb0f5000fcf",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-21.11",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
@@ -461,11 +461,11 @@
"nixpkgs": "nixpkgs_9"
},
"locked": {
"lastModified": 1668912095,
"narHash": "sha256-3oGeJgeA4+8Wj2XZnbZKJYHoZziyJl36ZGU49I2VC8U=",
"lastModified": 1669862269,
"narHash": "sha256-/ar+cbAKAxd2Ng9b7EhrIMz9CP353RbmLecvyOidyUM=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "5200195aa2a0cef1becc2ba6ff61cba65e1f90fe",
"rev": "bfdf688742cf984c4837dbbe1c6cbca550365613",
"type": "github"
},
"original": {
@@ -476,27 +476,27 @@
},
"stable": {
"locked": {
"lastModified": 1668766498,
"narHash": "sha256-UjZlIrbHGlL3H3HZNPTxPSwJfr49jIfbPWCYxk0EQm4=",
"lastModified": 1669834992,
"narHash": "sha256-YnhZGHgb4C3Q7DSGisO/stc50jFb9F/MzHeKS4giotg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f42a45c015f28ac3beeb0df360e50cdbf495d44b",
"rev": "596a8e828c5dfa504f91918d0fa4152db3ab5502",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.05",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"stable-small": {
"locked": {
"lastModified": 1668908668,
"narHash": "sha256-oimCE4rY7Btuo/VYmA8khIyTHSMV7qUWTpz9w8yc9LQ=",
"lastModified": 1669861251,
"narHash": "sha256-QyBI5QNT/nQRkCsZHnN3ImKCaxrtMArVqNioA7diwU4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b68a6a27adb452879ab66c0eaac0c133e32823b2",
"rev": "af4d0d532f413ad2fbb3a13f47c98c9fca1948e1",
"type": "github"
},
"original": {

View File

@@ -1,8 +1,8 @@
{
inputs = {
stable.url = github:nixos/nixpkgs/nixos-22.05;
stable.url = github:nixos/nixpkgs/nixos-22.11;
stable-small.url = github:nixos/nixpkgs/nixos-22.05-small;
old.url = github:nixos/nixpkgs/nixos-21.11;
old.url = github:nixos/nixpkgs/nixos-22.05;
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
master.url = github:nixos/nixpkgs/master;
home-manager.url = github:nix-community/home-manager;
@@ -36,7 +36,6 @@
old = mkPkgs old prev.system;
};
overlays = [
(import ./overlays/overridesandshit.nix)
(import ./overlays/packages.nix)
];
in

View File

@@ -486,7 +486,7 @@ This returns the command to run in the terminal
("java" (concat "java" full))
("py" (concat "python" full))
("cpp" (concat "g++ " full " -o " file " && " file " && rm " file))
("hs" (concat "ghc -dynamic " full " && " file " && rm " file " " file ".o"))
("hs" (concat "runhaskell " full))
("sh" (concat "sh" full))
("js" (concat "node" full))
("ts" (concat "tsc" full " && node " file ".js && rm " file ".js" ))

View File

@@ -37,13 +37,13 @@ config =
Run $ Date "<fn=1>\xf073</fn> %-d/%-m/%-y/%w" "date" 10000,
Run $ Date "%H:%M:%S" "time" 10,
Run $ MPD ["-t", "<statei><title><fn=" ++ magenta ++ "> \xf001</fn>", "--", "-P", ">> ", "-Z", "|| ", "-S", "Stopped", "-h", "127.0.0.1", "-p", "6600"] 10,
Run $ Com "/home/natto/.xmonad/lib/padding-icon.sh" ["stalonetray"] "tray" 10,
Run $ Com "~/.xmonad/lib/padding-icon.sh" ["stalonetray"] "tray" 10,
Run $ Com "pamixer" ["--get-volume"] "" 100,
Run UnsafeStdinReader
],
sepChar = "*",
alignSep = "--",
template = "<action=`dmenu_run` button=1><icon=/home/natto/.xmonad/lib/nixos.xpm/></action> *UnsafeStdinReader* " ++ sep ++ " <fn=1></fn>*mpd* -- *multicpu* " ++ sep ++ " *memory* " ++ sep ++ " *dynnetwork* " ++ sep ++ " *battery* " ++ sep ++ " <fn=1>\xf028</fn> <fc=" ++ green ++ ">*pamixer*%</fc> " ++ sep ++ " *date* - *time* " ++ sep ++ "*tray*"
template = "<action=`dmenu_run` button=1><icon=~/.xmonad/lib/nixos.xpm/></action> *UnsafeStdinReader* " ++ sep ++ " <fn=1></fn>*mpd* -- *multicpu* " ++ sep ++ " *memory* " ++ sep ++ " *dynnetwork* " ++ sep ++ " *battery* " ++ sep ++ " <fn=1>\xf028</fn> <fc=" ++ green ++ ">*pamixer*%</fc> " ++ sep ++ " *date* - *time* " ++ sep ++ "*tray*"
}
main :: IO ()

View File

@@ -56,6 +56,12 @@ myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
, ((modMask, xK_d),
spawn "dmenu_run -l 20")
, ((shiftMask .|. mod1Mask, xK_v),
spawn "clipmenu")
, ((modMask, xK_s),
spawn "dmenu_websearch")
, ((shiftMask, xK_Print),
spawn "flameshot gui")

View File

@@ -1,6 +1,4 @@
{ config, pkgs, lib, ... }:
let
in
{
imports = [
./email.nix

5893
home/natto/patches/st.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -18,8 +18,11 @@
# Utils
rage
curl
dmenu
st
(dmenu.override { patches = [ ./patches/dmenu.patch ]; })
(st.override {
patches = [ ./patches/st.patch ];
extraLibs = [ harfbuzz ];
})
yt-dlp
xclip
xorg.xkbcomp
@@ -67,18 +70,8 @@
wineWowPackages.stable
master.winetricks
tlauncher
lutris
citra
(yuzu.overrideAttrs (_: rec {
version = "1245";
src = fetchFromGitHub {
owner = "yuzu-emu";
repo = "yuzu-mainline";
rev = "mainline-0-${version}";
sha256 = "sha256-lWXlY1KQC067MvCRUFhmr0c7KDrHDuwJOhIWMKw1f+A=";
fetchSubmodules = true;
};
}))
yuzu
ryujinx
# Dev shit
@@ -103,7 +96,6 @@
})
python3Packages.pygments
inform7
gnome-inform7
# Misc
teams
@@ -114,5 +106,6 @@
visualizerSupport = true;
clockSupport = true;
})
libsForQt5.qtstyleplugins
];
}

View File

@@ -81,6 +81,7 @@ in
};
};
};
};
systemd.user.services = {

View File

@@ -8,6 +8,7 @@
sessionVariables = {
LV2_PATH = lib.makeSearchPath "lib/lv2" (with pkgs; [ calf ]);
TERM = "st-24bits";
QT_QPA_PLATFORMTHEME = "gtk2";
};
file = with config; {
stalonetray = {
@@ -22,6 +23,14 @@
source = ./config/mpv/mpv.conf;
target = "${xdg.configHome}/mpv/mpv.conf";
};
packages = {
text = let
packages = builtins.map (p: "${p.name}") config.home.packages;
sortedUnique = builtins.sort builtins.lessThan (lib.unique packages);
formatted = builtins.concatStringsSep "\n" sortedUnique;
in formatted;
target = "${xdg.configHome}/${config.home.username}-packages";
};
};
};
}

View File

@@ -12,7 +12,6 @@
formatted;
sessionVariables = {
QT_X11_NO_MITSHM = "1";
QT_QPA_PLATFORMTHEME = "gtk3";
HM_CONF_DIR = "/etc/nixos";
};
localBinInPath = true;

View File

@@ -121,17 +121,37 @@ bind('n', "<F6>", ":call v:lua.Repl()<CR>", {silent=true})
--nvim-tree.lua
vim.g.nvim_tree_auto_ignore_ft = { "startify" }
vim.g.nvim_tree_git_hl = 1
vim.g.nvim_tree_highlight_opened_files = 1
vim.g.nvim_tree_width_allow_resize = 1
require'nvim-tree'.setup {
nvim_tree_auto_close = 1,
nvim_tree_follow = 1,
nvim_tree_lsp_diagnostics = 1
}
vim.g.nvim_tree_window_picker_exclude = {
['buftype'] = { 'terminal' }
diagnostics = {
enable = true,
},
update_focused_file = {
enable = true,
update_root = true,
},
ignore_ft_on_setup = { "startify" },
renderer = {
highlight_opened_files = "all",
highlight_git = true
},
git = {
enable = true,
ignore = true,
show_on_dirs = true,
},
actions = {
open_file = {
quit_on_open = true,
resize_window = true,
window_picker = {
enable = true,
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
}
bind('n', "<M-o>", ":NvimTreeToggle<CR>", {noremap=true, silent=true})
bind('n', "<Space>r", ":NvimTreeRefresh<CR>", {noremap=true, silent=true})
@@ -194,17 +214,16 @@ vim.g.livepreview_previewer = "zathura"
require'colorizer'.setup()
--lsp and cmp stuff i got from various places
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', {silent=true, noremap=true})
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', {silent=true, noremap=true})
buf_set_keymap('n', '<M-k>', '<Cmd>lua vim.lsp.buf.hover()<CR>', {silent=true, noremap=true})
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', {silent=true, noremap=true})
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', {silent=true, noremap=true})
buf_set_keymap('n', "<M-f>", "<cmd>lua vim.lsp.buf.formatting()<CR>", {silent=true, noremap=true})
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', '<M-k>', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', "<M-f>", function() vim.lsp.buf.format { async = true } end, bufopts)
end
local servers = { "clangd", "rust_analyzer", "tsserver", "hls", "pylsp", "texlab", "rnix", "terraform_lsp", "html", "cssls", "jsonls", "svelte", "gopls" }

View File

@@ -1,17 +1,12 @@
{lib, stdenv, fetchFromGitHub}:
stdenv.mkDerivation rec{
{lib, stdenvNoCC, fetchFromGitHub}:
stdenvNoCC.mkDerivation {
name = "customscripts";
src = ./src;
/* src = fetchFromGitHub {
owner = "idcretard";
repo = "custom-scripts";
rev = "a996a52831316cc2c282904352654bd20c82f7bd";
sha256 = "sha256-nw21YmcmQMF8NADnuHOc7eF2Yaj/r/1mYBn77fYK7s8=";
};*/
unpackPhase = ":";
installPhase = ''
mkdir -p $out/bin
cp -r $src/* $out/bin
for x in $out/bin/*; do chmod +x "$x"; done
chmod -R +x $out/bin/*
'';
}

View File

@@ -0,0 +1,108 @@
#!/bin/sh
# title: dmenu_websearch <http://efe.kim/dmenu_websearch.html>
# license: CC0
# author: Sunur Efe Vural <efe@efe.kim>
# version: Mar 22, 2019
# dependencies: dmenu, xdotool, hexdump, xprop, setxkbmap, coreutils.
# A browser-independent address bar with bookmark support. When the
# cursor is on a web browser it acts as the address bar of that browser.
browser='firefox --new-window'
engine='https://duckduckgo.com/?q=%s'
bookmarks="$HOME/.bookmarks"
gotourl() {
if [ "$nbrowser" = surf ]
then
xprop -id "$winid" -f _SURF_GO 8s -set _SURF_GO "$choice"
elif [ -n "$winid" ] && [ -z "$nbrowser" ]
then
#change layout to us cuz xdotool spasms with non-latin layouts
layout=$(setxkbmap -query | awk '/^layout:/{ print $2 }')
setxkbmap -layout us
xdotool key --clearmodifiers "$shortcut"\
type --clearmodifiers --delay 2 "$choice"
xdotool key --clearmodifiers Return
setxkbmap -layout "$layout"
elif [ -n "$nbrowser" ]
then
$nbrowser "$choice"
else $browser "$choice"
fi
}
searchweb() {
#convert search query to percent encoding and insert it into url
choice=$(echo "$choice" | hexdump -v -e '/1 " %02x"')
choice=$(echo "$engine" | sed "s/%s/${choice% 0a}/;s/[[:space:]]/%/g")
gotourl
}
xprop -root | grep '^_NET_ACTIVE_WINDOW' && {
winid=$(xprop -root _NET_ACTIVE_WINDOW | sed 's/.*[[:space:]]//')
class=$(xprop -id "$winid" WM_CLASS | awk -F'\"' '{ print $(NF - 1) }')
case "$class" in
Firefox) nbrowser='firefox' ;;
#Firefox) shortcut='ctrl+l' ;; # alternative method, uses xdotool
IceCat) nbrowser='icecat' ;;
Chromium) nbrowser='chromium' ;;
Chrome) nbrowser='chrome' ;;
Opera) nbrowser='opera' ;;
Vivaldi) nbrowser='vivaldi' ;; # not tested
Brave) nbrowser='brave' ;; # not tested
Conkeror) nbrowser='conkeror' ;; # not tested
Palemoon) nbrowser='palemoon' ;; # not tested
Iceweasel) nbrowser='iceweasel' ;; # not tested
qutebrowser) nbrowser='qutebrowser' ;;
Midori) nbrowser='midori' ;; # not that good
Luakit) nbrowser='luakit' ;; # uses the last window instance
Uzbl|Vimb) shortcut='o' ;;
Links) shortcut='g' ;;
Netsurf*|Epiphany|Dillo|Konqueror|Arora) shortcut='ctrl+l' ;;
Surf) nbrowser='surf' ; uricur=$(xprop -id "$winid" _SURF_URI |\
awk -F'\"' '{ print $( NF - 1 ) }') ;;
*) pid=$(xprop -id "$winid" _NET_WM_PID | awk '{ print $3 }')
while pgrep -oP "$pid" >/dev/null
do
pid=$(pgrep -oP "$pid")
done
pname=$(awk '/^Name\:/{ print $NF }' /proc/"$pid"/status) ||
winid="" ;;
esac
[ -n "$pname" ] && case "$pname" in
w3m) shortcut="U" ;;
lynx|elinks|links) shortcut="g" ;;
*) winid="" ;;
esac
}
tmpfile=$(mktemp /tmp/dmenu_websearch.XXXXXX)
trap 'rm "$tmpfile"' 0 1 15
printf '%s\n%s\n' "$uricur" "$1" > "$tmpfile"
cat "$bookmarks" >> "$tmpfile"
sed -i -E '/^(#|$)/d' "$tmpfile"
choice=$(dmenu -i -p "Go:" -w "$winid" < "$tmpfile") || exit 1
# Detect links without protocol (This is WIP)
protocol='^(https?|ftps?|mailto|about|file):///?'
checkurl() {
grep -Fx "$choice" "$tmpfile" &&
choice=$(echo "$choice" | awk '{ print $1 }') && return 0
[ ${#choice} -lt 4 ] && return 1
echo "$choice" | grep -Z ' ' && return 1
echo "$choice" | grep -EiZ "$protocol" && return 0
echo "$choice" | grep -FZ '..' && return 1
prepath=$(echo "$choice" | sed 's/(\/|#|\?).*//')
echo "$prepath" | grep -FvZ '.' && return 1
echo "$prepath" | grep -EZ '^([[:alnum:]~_:-]+\.?){1,3}' && return 0
}
if checkurl
then
echo "$choice" | grep -EivZ "$protocol" &&
choice="http://$choice"
gotourl
else searchweb
fi

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
for x in "$@"; do
curl -F "file=@\"$x\"" -F "key=$FILEHOST_KEY" https://f.weirdnatto.in
echo " "
curl -F "file=@\"$x\"" -F "key=$FILEHOST_KEY" $FILEHOST_URL
printf "\n"
done

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env sh
for x in "$@"; do
curl -F "file=@\"$x\"" -F "key=$FILEHOST_KEY" $FILEHOST_URL
echo " "
done

View File

@@ -1,32 +0,0 @@
final: prev: {
dmenu = prev.dmenu.overrideAttrs (oldAttrs: rec {
version = "5.2";
src = builtins.fetchTarball {
url = "https://dl.suckless.org/tools/dmenu-${version}.tar.gz";
sha256 = "1rxxc3qdb5qvwg284f0hximg9953fnvlymxwmi1zlqkqbs8qbizk";
};
patches = [ ./patches/dmenu.patch ];
});
dwm = prev.dwm.overrideAttrs (oldAttrs: rec {
src = builtins.fetchTarball {
url = "https://dl.suckless.org/dwm/dwm-6.2.tar.gz";
sha256 = "0qdh8amfkjpvbwffar0byybcqi5w7v1wdqb39h75521haa6mh8xg";
};
patches = [ ./patches/dwm.patch ];
});
st = prev.st.overrideAttrs (oldAttrs: rec {
version = "0.9";
src = builtins.fetchTarball {
url = "https://dl.suckless.org/st/st-${version}.tar.gz";
sha256 = "1bdhh5lnhiz7q4ihig1f5q0ay5glsqxhpxpnsfqxwffqqwmy1vlh";
};
patches = [ ./patches/st.patch ];
});
proxychains = prev.proxychains.overrideAttrs (_: {
postInstall = ":";
});
}

View File

@@ -6,5 +6,6 @@ let
customscripts = call ./customscripts { };
gruvbox-icons = call ./gruvbox-icons { };
mymacs = c: call ./emacs { conf = c; };
tlauncher = call ./tlauncher { };
tlauncher = call ./tlauncher { };
simp1e-cursors = call ./simp1e { };
}

View File

@@ -1,690 +0,0 @@
diff --color -ru st-0.9/config.def.h st-0.9-a/config.def.h
--- st-0.9/config.def.h 2022-10-04 23:11:26.000000000 +0530
+++ st-0.9-a/config.def.h 2022-11-25 02:12:19.384259019 +0530
@@ -3,9 +3,10 @@
/*
* appearance
*
- * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
-static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
+static char *font = "Fira Mono:style=Regular:pixelsize=18";
+static char *font2[] = { "Font Awesome 5 Free Solid:pixelsize=16",
+ "Font Awesome 5 Brands:pixelsize=16" };
static int borderpx = 2;
/*
@@ -16,7 +17,7 @@
* 4: value of shell in /etc/passwd
* 5: value of shell in config.h
*/
-static char *shell = "/bin/sh";
+static char *shell = "/usr/bin/env zsh";
char *utmp = NULL;
/* scroll program: to enable use a string like "scroll" */
char *scroll = NULL;
@@ -95,33 +96,44 @@
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
- /* 8 normal colors */
- "black",
- "red3",
- "green3",
- "yellow3",
- "blue2",
- "magenta3",
- "cyan3",
- "gray90",
-
- /* 8 bright colors */
- "gray50",
- "red",
- "green",
- "yellow",
- "#5c5cff",
- "magenta",
- "cyan",
- "white",
-
- [255] = 0,
-
- /* more colors can be added after 255 to use with DefaultXX */
- "#cccccc",
- "#555555",
- "gray90", /* default foreground colour */
- "black", /* default background colour */
+ /* solarized dark */
+ "#073642", /* 0: black */
+ "#dc322f", /* 1: red */
+ "#859900", /* 2: green */
+ "#b58900", /* 3: yellow */
+ "#268bd2", /* 4: blue */
+ "#d33682", /* 5: magenta */
+ "#2aa198", /* 6: cyan */
+ "#eee8d5", /* 7: white */
+ "#002b36", /* 8: brblack */
+ "#cb4b16", /* 9: brred */
+ "#586e75", /* 10: brgreen */
+ "#657b83", /* 11: bryellow */
+ "#839496", /* 12: brblue */
+ "#6c71c4", /* 13: brmagenta*/
+ "#93a1a1", /* 14: brcyan */
+ "#fdf6e3", /* 15: brwhite */
+};
+
+/* Terminal colors for alternate (light) palette */
+static const char *altcolorname[] = {
+ /* solarized light */
+ "#eee8d5", /* 0: black */
+ "#dc322f", /* 1: red */
+ "#859900", /* 2: green */
+ "#b58900", /* 3: yellow */
+ "#268bd2", /* 4: blue */
+ "#d33682", /* 5: magenta */
+ "#2aa198", /* 6: cyan */
+ "#073642", /* 7: white */
+ "#fdf6e3", /* 8: brblack */
+ "#cb4b16", /* 9: brred */
+ "#93a1a1", /* 10: brgreen */
+ "#839496", /* 11: bryellow */
+ "#657b83", /* 12: brblue */
+ "#6c71c4", /* 13: brmagenta*/
+ "#586e75", /* 14: brcyan */
+ "#002b36", /* 15: brwhite */
};
@@ -129,10 +141,10 @@
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
-unsigned int defaultfg = 258;
-unsigned int defaultbg = 259;
-unsigned int defaultcs = 256;
-static unsigned int defaultrcs = 257;
+unsigned int defaultfg = 12;
+unsigned int defaultbg = 8;
+unsigned int defaultcs = 14;
+static unsigned int defaultrcs = 15;
/*
* Default shape of cursor
@@ -156,7 +168,6 @@
static unsigned int mouseshape = XC_xterm;
static unsigned int mousefg = 7;
static unsigned int mousebg = 0;
-
/*
* Color used to display font attributes when fontconfig selected a font which
* doesn't match the ones requested.
@@ -176,6 +187,8 @@
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
+ { XK_ANY_MOD, Button4, kscrollup, {.i = 1}},
+ { XK_ANY_MOD, Button5, kscrolldown, {.i = 1}},
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
@@ -193,14 +206,17 @@
{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
- { TERMMOD, XK_Prior, zoom, {.f = +1} },
- { TERMMOD, XK_Next, zoom, {.f = -1} },
- { TERMMOD, XK_Home, zoomreset, {.f = 0} },
+ { ShiftMask, XK_Prior, zoom, {.f = +1} },
+ { ShiftMask, XK_Next, zoom, {.f = -1} },
+ { ShiftMask, XK_Home, zoomreset, {.f = 0} },
{ TERMMOD, XK_C, clipcopy, {.i = 0} },
{ TERMMOD, XK_V, clippaste, {.i = 0} },
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { XK_ANY_MOD, XK_Page_Up, kscrollup, {.i = -1} },
+ { XK_ANY_MOD, XK_Page_Down, kscrolldown, {.i = -1} },
+ { XK_ANY_MOD, XK_F6, swapcolors, {.i = 0} },
};
/*
diff --color -ru st-0.9/st.c st-0.9-a/st.c
--- st-0.9/st.c 2022-10-04 23:11:26.000000000 +0530
+++ st-0.9-a/st.c 2022-11-25 02:12:19.384259019 +0530
@@ -35,6 +35,7 @@
#define ESC_ARG_SIZ 16
#define STR_BUF_SIZ ESC_BUF_SIZ
#define STR_ARG_SIZ ESC_ARG_SIZ
+#define HISTSIZE 2000
/* macros */
#define IS_SET(flag) ((term.mode & (flag)) != 0)
@@ -42,6 +43,9 @@
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
#define ISDELIM(u) (u && wcschr(worddelimiters, u))
+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \
+ term.scr + HISTSIZE + 1) % HISTSIZE] : \
+ term.line[(y) - term.scr])
enum term_mode {
MODE_WRAP = 1 << 0,
@@ -115,6 +119,9 @@
int col; /* nb col */
Line *line; /* screen */
Line *alt; /* alternate screen */
+ Line hist[HISTSIZE]; /* history buffer */
+ int histi; /* history index */
+ int scr; /* scroll back */
int *dirty; /* dirtyness of lines */
TCursor c; /* cursor */
int ocx; /* old cursor col */
@@ -185,8 +192,8 @@
static void tputtab(int);
static void tputc(Rune);
static void treset(void);
-static void tscrollup(int, int);
-static void tscrolldown(int, int);
+static void tscrollup(int, int, int);
+static void tscrolldown(int, int, int);
static void tsetattr(const int *, int);
static void tsetchar(Rune, const Glyph *, int, int);
static void tsetdirt(int, int);
@@ -409,10 +416,10 @@
{
int i = term.col;
- if (term.line[y][i - 1].mode & ATTR_WRAP)
+ if (TLINE(y)[i - 1].mode & ATTR_WRAP)
return i;
- while (i > 0 && term.line[y][i - 1].u == ' ')
+ while (i > 0 && TLINE(y)[i - 1].u == ' ')
--i;
return i;
@@ -521,7 +528,7 @@
* Snap around if the word wraps around at the end or
* beginning of a line.
*/
- prevgp = &term.line[*y][*x];
+ prevgp = &TLINE(*y)[*x];
prevdelim = ISDELIM(prevgp->u);
for (;;) {
newx = *x + direction;
@@ -536,14 +543,14 @@
yt = *y, xt = *x;
else
yt = newy, xt = newx;
- if (!(term.line[yt][xt].mode & ATTR_WRAP))
+ if (!(TLINE(yt)[xt].mode & ATTR_WRAP))
break;
}
if (newx >= tlinelen(newy))
break;
- gp = &term.line[newy][newx];
+ gp = &TLINE(newy)[newx];
delim = ISDELIM(gp->u);
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|| (delim && gp->u != prevgp->u)))
@@ -564,14 +571,14 @@
*x = (direction < 0) ? 0 : term.col - 1;
if (direction < 0) {
for (; *y > 0; *y += direction) {
- if (!(term.line[*y-1][term.col-1].mode
+ if (!(TLINE(*y-1)[term.col-1].mode
& ATTR_WRAP)) {
break;
}
}
} else if (direction > 0) {
for (; *y < term.row-1; *y += direction) {
- if (!(term.line[*y][term.col-1].mode
+ if (!(TLINE(*y)[term.col-1].mode
& ATTR_WRAP)) {
break;
}
@@ -602,13 +609,13 @@
}
if (sel.type == SEL_RECTANGULAR) {
- gp = &term.line[y][sel.nb.x];
+ gp = &TLINE(y)[sel.nb.x];
lastx = sel.ne.x;
} else {
- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0];
+ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0];
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
}
- last = &term.line[y][MIN(lastx, linelen-1)];
+ last = &TLINE(y)[MIN(lastx, linelen-1)];
while (last >= gp && last->u == ' ')
--last;
@@ -844,6 +851,9 @@
ttywrite(const char *s, size_t n, int may_echo)
{
const char *next;
+ Arg arg = (Arg) { .i = term.scr };
+
+ kscrolldown(&arg);
if (may_echo && IS_SET(MODE_ECHO))
twrite(s, n, 1);
@@ -1055,13 +1065,53 @@
}
void
-tscrolldown(int orig, int n)
+kscrolldown(const Arg* a)
+{
+ int n = a->i;
+
+ if (n < 0)
+ n = term.row + n;
+
+ if (n > term.scr)
+ n = term.scr;
+
+ if (term.scr > 0) {
+ term.scr -= n;
+ selscroll(0, -n);
+ tfulldirt();
+ }
+}
+
+void
+kscrollup(const Arg* a)
+{
+ int n = a->i;
+
+ if (n < 0)
+ n = term.row + n;
+
+ if (term.scr <= HISTSIZE-n) {
+ term.scr += n;
+ selscroll(0, n);
+ tfulldirt();
+ }
+}
+
+void
+tscrolldown(int orig, int n, int copyhist)
{
int i;
Line temp;
LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) {
+ term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
+ temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[term.bot];
+ term.line[term.bot] = temp;
+ }
+
tsetdirt(orig, term.bot-n);
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
@@ -1071,17 +1121,28 @@
term.line[i-n] = temp;
}
- selscroll(orig, n);
+ if (term.scr == 0)
+ selscroll(orig, n);
}
void
-tscrollup(int orig, int n)
+tscrollup(int orig, int n, int copyhist)
{
int i;
Line temp;
LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) {
+ term.histi = (term.histi + 1) % HISTSIZE;
+ temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[orig];
+ term.line[orig] = temp;
+ }
+
+ if (term.scr > 0 && term.scr < HISTSIZE)
+ term.scr = MIN(term.scr + n, HISTSIZE-1);
+
tclearregion(0, orig, term.col-1, orig+n-1);
tsetdirt(orig+n, term.bot);
@@ -1091,7 +1152,8 @@
term.line[i+n] = temp;
}
- selscroll(orig, -n);
+ if (term.scr == 0)
+ selscroll(orig, -n);
}
void
@@ -1120,7 +1182,7 @@
int y = term.c.y;
if (y == term.bot) {
- tscrollup(term.top, 1);
+ tscrollup(term.top, 1, 1);
} else {
y++;
}
@@ -1285,14 +1347,14 @@
tinsertblankline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
- tscrolldown(term.c.y, n);
+ tscrolldown(term.c.y, n, 0);
}
void
tdeleteline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
- tscrollup(term.c.y, n);
+ tscrollup(term.c.y, n, 0);
}
int32_t
@@ -1729,11 +1791,11 @@
break;
case 'S': /* SU -- Scroll <n> line up */
DEFAULT(csiescseq.arg[0], 1);
- tscrollup(term.top, csiescseq.arg[0]);
+ tscrollup(term.top, csiescseq.arg[0], 0);
break;
case 'T': /* SD -- Scroll <n> line down */
DEFAULT(csiescseq.arg[0], 1);
- tscrolldown(term.top, csiescseq.arg[0]);
+ tscrolldown(term.top, csiescseq.arg[0], 0);
break;
case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1);
@@ -2296,7 +2358,7 @@
return 0;
case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) {
- tscrollup(term.top, 1);
+ tscrollup(term.top, 1, 1);
} else {
tmoveto(term.c.x, term.c.y+1);
}
@@ -2309,7 +2371,7 @@
break;
case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) {
- tscrolldown(term.top, 1);
+ tscrolldown(term.top, 1, 1);
} else {
tmoveto(term.c.x, term.c.y-1);
}
@@ -2523,7 +2585,7 @@
void
tresize(int col, int row)
{
- int i;
+ int i, j;
int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col);
int *bp;
@@ -2560,6 +2622,14 @@
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
+ for (i = 0; i < HISTSIZE; i++) {
+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph));
+ for (j = mincol; j < col; j++) {
+ term.hist[i][j] = term.c.attr;
+ term.hist[i][j].u = ' ';
+ }
+ }
+
/* resize each row to new width, zero-pad if needed */
for (i = 0; i < minrow; i++) {
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
@@ -2618,7 +2688,7 @@
continue;
term.dirty[y] = 0;
- xdrawline(term.line[y], x1, y, x2);
+ xdrawline(TLINE(y), x1, y, x2);
}
}
@@ -2639,8 +2709,9 @@
cx--;
drawregion(0, 0, term.col, term.row);
- xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
- term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
+ if (term.scr == 0)
+ xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
+ term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
term.ocx = cx;
term.ocy = term.c.y;
xfinishdraw();
diff --color -ru st-0.9/st.h st-0.9-a/st.h
--- st-0.9/st.h 2022-10-04 23:11:26.000000000 +0530
+++ st-0.9-a/st.h 2022-11-25 02:12:19.385259029 +0530
@@ -81,6 +81,8 @@
void redraw(void);
void draw(void);
+void kscrolldown(const Arg *);
+void kscrollup(const Arg *);
void printscreen(const Arg *);
void printsel(const Arg *);
void sendbreak(const Arg *);
@@ -120,6 +122,7 @@
extern int allowaltscreen;
extern int allowwindowops;
extern char *termname;
+extern int usealtcolors;
extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
diff --color -ru st-0.9/x.c st-0.9-a/x.c
--- st-0.9/x.c 2022-10-04 23:11:26.000000000 +0530
+++ st-0.9-a/x.c 2022-11-25 02:12:19.385259029 +0530
@@ -55,6 +55,7 @@
static void clippaste(const Arg *);
static void numlock(const Arg *);
static void selpaste(const Arg *);
+static void swapcolors(const Arg *);
static void zoom(const Arg *);
static void zoomabs(const Arg *);
static void zoomreset(const Arg *);
@@ -157,6 +158,7 @@
static int xloadcolor(int, const char *, Color *);
static int xloadfont(Font *, FcPattern *);
static void xloadfonts(const char *, double);
+static void xloadsparefont();
static void xunloadfont(Font *);
static void xunloadfonts(void);
static void xsetenv(void);
@@ -254,6 +256,8 @@
static uint buttons; /* bit field of pressed buttons */
+int usealtcolors = 0; /* 1 to use alternate palette */
+
void
clipcopy(const Arg *dummy)
{
@@ -293,6 +297,14 @@
}
void
+swapcolors(const Arg *dummy)
+{
+ usealtcolors = !usealtcolors;
+ xloadcols();
+ redraw();
+}
+
+void
zoom(const Arg *arg)
{
Arg larg;
@@ -306,6 +318,7 @@
{
xunloadfonts();
xloadfonts(usedfont, arg->f);
+ xloadsparefont();
cresize(0, 0);
redraw();
xhints();
@@ -766,6 +779,11 @@
return x == 0 ? 0 : 0x3737 + 0x2828 * x;
}
+const char* getcolorname(int i)
+{
+ return (usealtcolors) ? altcolorname[i] : colorname[i];
+}
+
int
xloadcolor(int i, const char *name, Color *ncolor)
{
@@ -784,7 +802,7 @@
return XftColorAllocValue(xw.dpy, xw.vis,
xw.cmap, &color, ncolor);
} else
- name = colorname[i];
+ name = getcolorname(i);
}
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
@@ -807,8 +825,8 @@
for (i = 0; i < dc.collen; i++)
if (!xloadcolor(i, NULL, &dc.col[i])) {
- if (colorname[i])
- die("could not allocate color '%s'\n", colorname[i]);
+ if (getcolorname(i))
+ die("could not allocate color '%s'\n", getcolorname(i));
else
die("could not allocate color %d\n", i);
}
@@ -1050,6 +1068,67 @@
FcPatternDestroy(pattern);
}
+ void
+xloadsparefont()
+{
+FcPattern *fontpattern, *match;
+FcResult result;
+
+/* add font2 to font cache as first 4 entries */
+if ( font2[0] == '-' )
+ fontpattern = XftXlfdParse(font2, False, False);
+else
+ fontpattern = FcNameParse((FcChar8 *)font2);
+if ( fontpattern ) {
+ /* Allocate memory for the new cache entries. */
+ frccap += 4;
+ frc = xrealloc(frc, frccap * sizeof(Fontcache));
+ /* add Normal */
+ match = FcFontMatch(NULL, fontpattern, &result);
+ if ( match )
+ frc[frclen].font = XftFontOpenPattern(xw.dpy, match);
+ if ( frc[frclen].font ) {
+ frc[frclen].flags = FRC_NORMAL;
+ frclen++;
+ } else
+ FcPatternDestroy(match);
+ /* add Italic */
+ FcPatternDel(fontpattern, FC_SLANT);
+ FcPatternAddInteger(fontpattern, FC_SLANT, FC_SLANT_ITALIC);
+ match = FcFontMatch(NULL, fontpattern, &result);
+ if ( match )
+ frc[frclen].font = XftFontOpenPattern(xw.dpy, match);
+ if ( frc[frclen].font ) {
+ frc[frclen].flags = FRC_ITALIC;
+ frclen++;
+ } else
+ FcPatternDestroy(match);
+ /* add Italic Bold */
+ FcPatternDel(fontpattern, FC_WEIGHT);
+ FcPatternAddInteger(fontpattern, FC_WEIGHT, FC_WEIGHT_BOLD);
+ match = FcFontMatch(NULL, fontpattern, &result);
+ if ( match )
+ frc[frclen].font = XftFontOpenPattern(xw.dpy, match);
+ if ( frc[frclen].font ) {
+ frc[frclen].flags = FRC_ITALICBOLD;
+ frclen++;
+ } else
+ FcPatternDestroy(match);
+ /* add Bold */
+ FcPatternDel(fontpattern, FC_SLANT);
+ FcPatternAddInteger(fontpattern, FC_SLANT, FC_SLANT_ROMAN);
+ match = FcFontMatch(NULL, fontpattern, &result);
+ if ( match )
+ frc[frclen].font = XftFontOpenPattern(xw.dpy, match);
+ if ( frc[frclen].font ) {
+ frc[frclen].flags = FRC_BOLD;
+ frclen++;
+ } else
+ FcPatternDestroy(match);
+ FcPatternDestroy(fontpattern);
+ }
+}
+
void
xunloadfont(Font *f)
{
@@ -1147,6 +1226,10 @@
usedfont = (opt_font == NULL)? font : opt_font;
xloadfonts(usedfont, 0);
+ /* spare font (font2) */
+ xloadsparefont();
+
+
/* colors */
xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
xloadcols();
@@ -1200,13 +1283,13 @@
cursor = XCreateFontCursor(xw.dpy, mouseshape);
XDefineCursor(xw.dpy, xw.win, cursor);
- if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
xmousefg.red = 0xffff;
xmousefg.green = 0xffff;
xmousefg.blue = 0xffff;
}
- if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
xmousebg.red = 0x0000;
xmousebg.green = 0x0000;
xmousebg.blue = 0x0000;
@@ -1414,7 +1497,7 @@
/* Change basic system colors [0-7] to bright system colors [8-15] */
if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7))
- fg = &dc.col[base.fg + 8];
+ fg = &dc.col[base.fg];
if (IS_SET(MODE_REVERSE)) {
if (fg == &dc.col[defaultfg]) {
@@ -1642,6 +1725,8 @@
int
xstartdraw(void)
{
+ if (IS_SET(MODE_VISIBLE))
+ XCopyArea(xw.dpy, xw.win, xw.buf, dc.gc, 0, 0, win.w, win.h, 0, 0);
return IS_SET(MODE_VISIBLE);
}

View File

@@ -0,0 +1,39 @@
{ lib, stdenvNoCC, fetchFromGitLab, python3, librsvg, xcursorgen }:
stdenvNoCC.mkDerivation rec {
pname = "simp1e-cursors";
version = "20221103.2";
src = fetchFromGitLab {
owner = "cursors";
repo = "simp1e";
rev = version;
sha256 = "sha256-3DCF6TwxWwYK5pF2Ykr3OwF76H7J03vLNZch/XoZZZk=";
fetchSubmodules = true;
};
nativeBuildInputs = [
(python3.withPackages (ps: with ps; [ pillow ]))
librsvg
xcursorgen
];
buildPhase = ''
patchShebangs .
HOME=$TMP ./build.sh
'';
installPhase = ''
install -dm 755 $out/share/icons
cp -dr --no-preserve='ownership' built_themes/* $out/share/icons/
'';
meta = with lib; {
description = "An aesthetic cursor theme for Linux desktops";
homepage = "https://gitlab.com/cursors/simp1e";
license = licenses.gpl3;
platforms = platforms.all;
maintainers = with maintainers; [ natto1784 ];
};
}