Compare commits
No commits in common. "master" and "flakes_testing" have entirely different histories.
master
...
flakes_tes
|
@ -1,3 +0,0 @@
|
|||
[submodule "lappy/builds/dwm"]
|
||||
path = lappy/builds/dwm
|
||||
url = https://git.beepboop.systems/stupidcomputer/dwm
|
4
.mailmap
4
.mailmap
|
@ -1,4 +0,0 @@
|
|||
stupidcomputer <ryan@beepboop.systems> <randomuser@tilde.club>
|
||||
stupidcomputer <ryan@beepboop.systems>
|
||||
stupidcomputer <ryan@beepboop.systems> <rndusr@beepboop.systems>
|
||||
stupidcomputer <ryan@beepboop.systems> <Unixsys@github.com>
|
56
LICENSE
56
LICENSE
|
@ -617,3 +617,59 @@ reviewing courts shall apply local law that most closely approximates
|
|||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attac
100 35149 100 35149 0 0 145k 0 --:--:-- --:--:-- --:--:-- 145k
|
||||
h the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
|
49
README.md
49
README.md
|
@ -1,41 +1,26 @@
|
|||
randomuser's dotfiles
|
||||
=====================
|
||||
|
||||
![an image of the desktop while editing this repo's flake.nix](./demo.png)
|
||||
here's some dotfiles!
|
||||
|
||||
features
|
||||
--------
|
||||
some features
|
||||
|
||||
- `bspwm` + `sxhkd` + `st` + `firefox`
|
||||
- most everything on the desktop save for the browser, media viewers, and desktop background, is a terminal
|
||||
- on the server, runs gitea + simple-nixos-mailserver
|
||||
- built with NixOS flakes
|
||||
- ``bspwm`` + ``sxhkd``
|
||||
- ``tmenu``: terminal based ``dmenu`` replacement
|
||||
- uses ``pash``, the password manager
|
||||
- no flakes (can't figure it out, lol)
|
||||
|
||||
installation
|
||||
------------
|
||||
some future things to work on are
|
||||
|
||||
`sudo nixos-rebuild --flake .#your-flake-name-here switch`
|
||||
- remove ``polybar`` with a simpler, homegrown solution
|
||||
- integrate a dynamic color switching mechanism
|
||||
- make these more appealing, in general
|
||||
- without compromising speed and system load
|
||||
- compatibility with 'traditional' unix systems
|
||||
|
||||
if you're trying to install `netbox`, then use the `--impure` flag:
|
||||
license.
|
||||
|
||||
`sudo nixos-rebuild --flake .#netbox switch --impure`
|
||||
|
||||
for installation onto Termux, run `make`.
|
||||
|
||||
things to do
|
||||
------------
|
||||
|
||||
- integrate `disko` and `sops-nix` into the setup
|
||||
- establish backup infrastructure for `netbox`
|
||||
- move gmail-mail-bridge into mail-sync repo
|
||||
* (perhaps figure out how to produce a flake for it)
|
||||
|
||||
license
|
||||
-------
|
||||
|
||||
all materials in this repository, except for:
|
||||
|
||||
* `./home/wallpapers/pape.jpg`, which is of unknown license, and
|
||||
* `./builds/st`, which is licensed under MIT, persuant to `./builds/st/LICENSE`,
|
||||
|
||||
is (c) rndusr, randomuser, stupidcomputer, etc 2024 and licensed under the GPLv3 (see `./LICENSE`)
|
||||
- boring legal stuff for most items in this configuration are in the LICENSE file.
|
||||
- under the GPLv3
|
||||
- everything under ``config/*``, ``builds/*``, and ``modules/*``, in addition to all files that are ``*.nix``.
|
||||
- NOT in ``wallpapers/*``, those are unlicensed and their legal status is unknown
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
sudo nixos-rebuild --flake . switch --impure -I nixos-config=./
|
|
@ -1,143 +0,0 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./nvidia.nix
|
||||
./services
|
||||
../../config
|
||||
../../modules/hosts.nix
|
||||
../../modules/bootstrap.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wine
|
||||
xdotool
|
||||
|
||||
libreoffice
|
||||
texliveMedium
|
||||
kdePackages.kdenlive
|
||||
audacity
|
||||
bespokesynth
|
||||
musescore
|
||||
unzip
|
||||
ledger
|
||||
|
||||
unzip
|
||||
imagemagick
|
||||
pciutils
|
||||
usbutils
|
||||
|
||||
ffmpeg
|
||||
mdadm
|
||||
git-annex
|
||||
tigervnc
|
||||
|
||||
dmenu
|
||||
|
||||
(pkgs.callPackage ../../builds/archutils.nix {})
|
||||
(pkgs.callPackage ../../builds/sssg.nix {})
|
||||
];
|
||||
|
||||
services.hardware.bolt.enable = true; # thunderbolt support
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
settings = {
|
||||
General = {
|
||||
# AutoEnable = true;
|
||||
Enable = "Source,Sink,Media,Socket";
|
||||
# ControllerMode = "bredr";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
boot.loader = {
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
efiSysMountPoint = "/boot";
|
||||
};
|
||||
grub = {
|
||||
efiSupport = true;
|
||||
device = "nodev";
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
# enable printing
|
||||
printing.enable = true;
|
||||
avahi = {
|
||||
enable = true; # runs the Avahi daemon
|
||||
nssmdns4 = true; # enables the mDNS NSS plug-in
|
||||
openFirewall = true; # opens the firewall for UDP port 5353
|
||||
};
|
||||
|
||||
pipewire = {
|
||||
enable = true;
|
||||
extraConfig.pipewire = {
|
||||
"properties" = {
|
||||
default.clock.allowed-rates = [ 44100 48000 96000 ];
|
||||
"log.level" = 4;
|
||||
"default.clock.quantum" = 256;
|
||||
"default.clock.min-quantum" = 256;
|
||||
"default.clock.max-quantum" = 256;
|
||||
};
|
||||
};
|
||||
alsa = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
};
|
||||
pulse.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.adb.enable = true;
|
||||
|
||||
powerManagement.cpuFreqGovernor = "performance";
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
networking = {
|
||||
hostName = "copernicus";
|
||||
firewall = {
|
||||
enable = true;
|
||||
interfaces = {
|
||||
eno1 = {
|
||||
allowedTCPPorts = [ 6000 ];
|
||||
allowedTCPPortRanges = [
|
||||
{ from = 1714; to = 1764; } # KDE Connect
|
||||
{ from = 10000; to = 10100; } # temp stuff
|
||||
];
|
||||
allowedUDPPortRanges = [
|
||||
{ from = 1714; to = 1764; } # KDE Connect
|
||||
];
|
||||
};
|
||||
wg0 = {
|
||||
# allow everything bound to the wg0 interface
|
||||
allowedTCPPortRanges = [
|
||||
{ from = 1; to = 35565; }
|
||||
];
|
||||
allowedUDPPortRanges = [
|
||||
{ from = 1; to = 35565; }
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.getty.autologinUser = "usr";
|
||||
|
||||
time.timeZone = "America/Chicago";
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
keyMap = "us";
|
||||
};
|
||||
|
||||
users.users.usr = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "networkmanager" "adbusers" ];
|
||||
initialPassword = "usr";
|
||||
};
|
||||
|
||||
system.stateVersion = "24.05"; # don't change this, lol
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./wireguard.nix
|
||||
./nextcloud.nix
|
||||
];
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
|
||||
{
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
package = pkgs.nextcloud30;
|
||||
hostName = "nextcloud.beepboop.systems";
|
||||
config.adminpassFile = "/etc/nextcloud-admin";
|
||||
settings.overwriteprotocol = "https";
|
||||
extraApps = {
|
||||
inherit (config.services.nextcloud.package.packages.apps) calendar tasks mail;
|
||||
phonetrack = pkgs.fetchNextcloudApp {
|
||||
sha256 = "sha256-V92f+FiS5vZEkq15A51pHoDpUOBfUOEVIcsXdP/rSMQ=";
|
||||
license = "agpl3Only";
|
||||
url = "https://github.com/julien-nc/phonetrack/releases/download/v0.8.1/phonetrack-0.8.1.tar.gz";
|
||||
};
|
||||
};
|
||||
extraAppsEnable = true;
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."${config.services.nextcloud.hostName}".listen = [ {
|
||||
addr = "10.100.0.2";
|
||||
port = 5028;
|
||||
} ];
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
firewall.allowedUDPPorts = [ 50000 ];
|
||||
|
||||
wireguard.interfaces = {
|
||||
wg0 = {
|
||||
ips = [ "10.100.0.2/24" ];
|
||||
listenPort = 50000;
|
||||
|
||||
privateKeyFile = "/home/usr/wg-keys/private";
|
||||
peers = [
|
||||
{ # netbox
|
||||
publicKey = "0fOqAfsYO4HvshMPnlkKL7Z1RChq98hjDr0Q8o7OJFE=";
|
||||
allowedIPs = [ "10.100.0.0/24" ]; # only stuff in the wg-subnet (10.100.0.*)
|
||||
endpoint = "149.28.63.115:50000";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./server.nix
|
||||
../../modules/bootstrap.nix
|
||||
../../modules/common.nix
|
||||
../../modules/x11.nix
|
||||
../../modules/discord.nix
|
||||
];
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/sda";
|
||||
|
||||
networking.hostName = "mainsail";
|
||||
|
||||
services.getty.greetingLine = "
|
||||
welcome to mainsail |`-:_
|
||||
,----....____ | `+.
|
||||
( ````----....|___ |
|
||||
\\ _ ````----....____
|
||||
\\ _) ```---.._
|
||||
\\ \\
|
||||
)`.\\ )`. )`. )`. )`. )`. )`. )`. )`. )`. )`.
|
||||
-' `-' `-' `-' `-' `-' `-' `-' `-' `-' `-' `
|
||||
";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
vscodium-fhs
|
||||
libreoffice
|
||||
|
||||
anki-bin
|
||||
ytfzf
|
||||
kdenlive
|
||||
libreoffice
|
||||
i3
|
||||
gcc
|
||||
gnumake
|
||||
|
||||
scrcpy
|
||||
thunderbird
|
||||
mepo
|
||||
];
|
||||
|
||||
system.stateVersion = "23.11";
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/7b70ab88-296c-4737-90b2-267cb2432dc1";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{ lib, inputs, config, pkgs, home, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../home/x11.nix
|
||||
];
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
{
|
||||
services.paperless = {
|
||||
enable = true;
|
||||
passwordFile = "/etc/paperless-password";
|
||||
port = 3004;
|
||||
address = "localhost";
|
||||
extraConfig = {
|
||||
PAPERLESS_URL = "https://paperless.beepboop.systems";
|
||||
};
|
||||
};
|
||||
|
||||
services.calibre-web.enable = true;
|
||||
services.calibre-web.listen.port = 8080;
|
||||
|
||||
programs.adb.enable = true;
|
||||
users.users.usr.extraGroups = ["adbusers"];
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
ports = [2222];
|
||||
};
|
||||
|
||||
services.radicale = {
|
||||
enable = true;
|
||||
config = ''
|
||||
[auth]
|
||||
type = htpasswd
|
||||
htpasswd_filename = radicale-passwd
|
||||
htpasswd_encryption = plain
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.targets.sleep.enable = false;
|
||||
systemd.targets.suspend.enable = false;
|
||||
systemd.targets.hibernate.enable = false;
|
||||
systemd.targets.hybrid-sleep.enable = false;
|
||||
|
||||
systemd.services.paperless-web-bridge = {
|
||||
script = ''
|
||||
${pkgs.openssh}/bin/ssh -v -NR 3004:localhost:3004 -oExitOnForwardFailure=yes -p 55555 useracc@beepboop.systems
|
||||
'';
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" "ankisyncd.service" ];
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
StartLimitInterval = 0;
|
||||
StartLimitBurst = 10000;
|
||||
RestartSec = "0s";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.radicale-web-bridge = {
|
||||
script = ''
|
||||
${pkgs.openssh}/bin/ssh -v -NR 5232:localhost:5232 -oExitOnForwardFailure=yes -p 55555 useracc@beepboop.systems
|
||||
'';
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" "ankisyncd.service" ];
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
StartLimitInterval = 0;
|
||||
StartLimitBurst = 10000;
|
||||
RestartSec = "0s";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.internal-ssh-bridge = {
|
||||
script = ''
|
||||
${pkgs.openssh}/bin/ssh -v -NR 2222:localhost:2222 -oExitOnForwardFailure=yes -p 55555 useracc@beepboop.systems
|
||||
'';
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" "ankisyncd.service" ];
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
StartLimitInterval = 0;
|
||||
StartLimitBurst = 10000;
|
||||
RestartSec = "0s";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
# ./hardware-configuration.nix
|
||||
./nvidia.nix
|
||||
../../modules/bootstrap.nix
|
||||
../../modules/common.nix
|
||||
../../modules/x11.nix
|
||||
../../modules/discord.nix
|
||||
../../modules/gaming.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wine
|
||||
xdotool
|
||||
|
||||
qemu
|
||||
virt-manager
|
||||
gnome.cheese
|
||||
calyx-vpn
|
||||
android-studio
|
||||
emacs
|
||||
deepin.deepin-album
|
||||
libreoffice
|
||||
nomacs
|
||||
vscodium
|
||||
minetest
|
||||
];
|
||||
|
||||
boot.loader = {
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
efiSysMountPoint = "/boot";
|
||||
};
|
||||
grub = {
|
||||
efiSupport = true;
|
||||
device = "nodev";
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.libvirtd.enable = true;
|
||||
programs.dconf.enable = true;
|
||||
users.users.usr.extraGroups = [ "libvirtd" ];
|
||||
|
||||
services.printing.enable = true;
|
||||
services.avahi.enable = true; # runs the Avahi daemon
|
||||
services.avahi.nssmdns = true; # enables the mDNS NSS plug-in
|
||||
services.avahi.openFirewall = true; # opens the firewall for UDP port 5353
|
||||
|
||||
networking.hostName = "mlg";
|
||||
}
|
|
@ -30,7 +30,10 @@
|
|||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
|
||||
prime = {
|
||||
sync.enable = true;
|
||||
offload = {
|
||||
enable = true;
|
||||
enableOffloadCmd = true;
|
||||
};
|
||||
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
|
@ -1 +0,0 @@
|
|||
sudo nixos-rebuild --flake . switch --impure -I nixos-config=./
|
|
@ -1,35 +1,13 @@
|
|||
{ lib, config, pkgs, machines, ... }:
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./hardware-configuration.nix
|
||||
../../modules/bootstrap.nix
|
||||
|
||||
./radicale.nix
|
||||
./ssh.nix
|
||||
./gitea.nix
|
||||
./radicale.nix
|
||||
./vaultwarden.nix
|
||||
./sslh.nix
|
||||
./nginx.nix
|
||||
./franklincce.nix
|
||||
./wireguard.nix
|
||||
|
||||
./nextcloud-bridge.nix
|
||||
];
|
||||
|
||||
nix = {
|
||||
optimise = {
|
||||
automatic = true;
|
||||
dates = [ "02:30" ];
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "03:15";
|
||||
options = "-d";
|
||||
};
|
||||
};
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
time.timeZone = "America/Chicago";
|
||||
|
||||
|
@ -40,87 +18,251 @@
|
|||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
python3
|
||||
curl
|
||||
htop
|
||||
git
|
||||
tree
|
||||
dig
|
||||
htop
|
||||
neovim
|
||||
gnumake
|
||||
];
|
||||
|
||||
system = {
|
||||
copySystemConfiguration = true;
|
||||
stateVersion = "23.05"; # don't change this, lol
|
||||
};
|
||||
system.copySystemConfiguration = true;
|
||||
system.stateVersion = "23.05"; # don't change this, lol
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/vda";
|
||||
|
||||
services.journald.extraConfig = ''
|
||||
SystemMaxUse=1G
|
||||
# services.cgit = {
|
||||
# "beepboop.systems" = {
|
||||
# extraConfig = ''
|
||||
# root-desc="testing"
|
||||
#
|
||||
# section=main
|
||||
# repo.url=dot_testing
|
||||
# repo.path=/var/lib/git/dot_testing
|
||||
# repo.desc=configuration for NixOS/Linux systems
|
||||
# repo.owner=rndusr
|
||||
#
|
||||
# readme=:README.md
|
||||
# '';
|
||||
# enable = true;
|
||||
# };
|
||||
# };
|
||||
|
||||
networking.hostName = "netbox";
|
||||
|
||||
services.radicale = {
|
||||
enable = true;
|
||||
config = ''
|
||||
[auth]
|
||||
type = htpasswd
|
||||
htpasswd_filename = radicale-passwd
|
||||
htpasswd_encryption = plain
|
||||
'';
|
||||
};
|
||||
|
||||
system.userActivationScripts = {
|
||||
copyEssentialConfiguration = {
|
||||
# we don't want to bring in the entirety of home-manager for this, so just
|
||||
# write some files as a hack
|
||||
text = ''
|
||||
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/bash/bashrc /home/ryan/.bashrc
|
||||
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/bash/profile /home/ryan/.bash_profile
|
||||
${pkgs.coreutils}/bin/mkdir -p /home/ryan/.config/nvim
|
||||
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/nvim/init.min.lua /home/ryan/.config/nvim/init.lua
|
||||
'';
|
||||
deps = [];
|
||||
services.rss2email = {
|
||||
enable = true;
|
||||
to = "ryan@beepboop.systems";
|
||||
feeds = {
|
||||
"eff" = {
|
||||
url = "https://www.eff.org/rss/updates.xml";
|
||||
};
|
||||
"nixos" = {
|
||||
url = "https://nixos.org/blog/announcements-rss.xml";
|
||||
};
|
||||
"drewdevault" = {
|
||||
url = "https://drewdevault.com/blog/index.xml";
|
||||
};
|
||||
"nullprogram" = {
|
||||
url = "https://nullprogram.com/feed/";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
system.activationScripts = {
|
||||
copyEssentialConfiguration = {
|
||||
text = ''
|
||||
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/bash/bashrc /root/.bashrc
|
||||
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/bash/profile /root/.bash_profile
|
||||
${pkgs.coreutils}/bin/mkdir -p /root/.config/nvim
|
||||
${pkgs.coreutils}/bin/cp /home/ryan/dot_testing/.config/nvim/init.min.lua /root/.config/nvim/init.lua
|
||||
'';
|
||||
deps = [];
|
||||
};
|
||||
};
|
||||
|
||||
boot.loader = {
|
||||
grub.enable = true;
|
||||
grub.device = "/dev/vda";
|
||||
};
|
||||
|
||||
users.users.ryan = {
|
||||
openssh.authorizedKeys.keys = [
|
||||
machines.copernicus.pubkey
|
||||
machines.aristotle.pubkey
|
||||
machines.phone.pubkey
|
||||
services.fail2ban = {
|
||||
enable = true;
|
||||
ignoreIP = [
|
||||
"192.168.1.0/24"
|
||||
];
|
||||
extraPackages = [pkgs.ipset];
|
||||
banaction = "iptables-ipset-proto6-allports";
|
||||
|
||||
jails = {
|
||||
"nginx-bruteforce" = ''
|
||||
enabled = true
|
||||
filter = nginx-bruteforce
|
||||
logpath = /var/log/nginx/access.log
|
||||
backend = auto
|
||||
maxretry = 6
|
||||
findtime = 600
|
||||
'';
|
||||
|
||||
"postfix-bruteforce" = ''
|
||||
enabled = true
|
||||
filter = postfix-bruteforce
|
||||
maxretry = 6
|
||||
findtime = 600
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
environment.etc = {
|
||||
"fail2ban/filter.d/nginx-bruteforce.conf".text = ''
|
||||
[Definition]
|
||||
failregex = ^<HOST>.*GET.*(matrix/server|\.php|admin|wp\-).* HTTP/\d.\d\" 404.*$
|
||||
'';
|
||||
|
||||
"fail2ban/filter.d/postfix-bruteforce.conf".text = ''
|
||||
[Definition]
|
||||
failregex = warning: [\w\.\-]+\[<HOST>\]: SASL LOGIN authentication failed.*$
|
||||
journalmatch = _SYSTEMD_UNIT=postfix.service
|
||||
'';
|
||||
};
|
||||
|
||||
users.users.useracc = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "docker" ];
|
||||
};
|
||||
|
||||
networking = {
|
||||
usePredictableInterfaceNames = false;
|
||||
networkmanager.enable = true;
|
||||
hostName = "netbox";
|
||||
users.users.ryan = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "docker" ];
|
||||
};
|
||||
|
||||
firewall = {
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
interfaces = {
|
||||
eth0 = {
|
||||
allowedTCPPorts = [ 80 443 ];
|
||||
ports = [55555];
|
||||
};
|
||||
wg0 = {
|
||||
# allow everything bound to the wg0 interface
|
||||
allowedTCPPortRanges = [
|
||||
{ from = 1; to = 35565; }
|
||||
];
|
||||
allowedUDPPortRanges = [
|
||||
{ from = 1; to = 35565; }
|
||||
];
|
||||
|
||||
services.endlessh.enable = true;
|
||||
services.endlessh.port = 22;
|
||||
services.vaultwarden.enable = true;
|
||||
services.vaultwarden.config = {
|
||||
DOMAIN = "https://bitwarden.beepboop.systems";
|
||||
# SIGNUPS_ALLOWED = false;
|
||||
};
|
||||
|
||||
networking.usePredictableInterfaceNames = false;
|
||||
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
appName = "crappy code"; # Give the site a name
|
||||
database = {
|
||||
type = "postgres";
|
||||
passwordFile = "/etc/gittea-pass";
|
||||
};
|
||||
settings.server = {
|
||||
DOMAIN = "git.beepboop.systems";
|
||||
ROOT_URL = "https://git.beepboop.systems/";
|
||||
HTTP_PORT = 3001;
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
enable = true; # Ensure postgresql is enabled
|
||||
authentication = ''
|
||||
local gitea all ident map=gitea-users
|
||||
'';
|
||||
identMap = # Map the gitea user to postgresql
|
||||
''
|
||||
gitea-users gitea gitea
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx.enable = true;
|
||||
services.nginx.clientMaxBodySize = "100m";
|
||||
|
||||
services.nginx.virtualHosts."beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
root = "/var/www/beepboop.systems";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."git.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/".proxyPass = "http://localhost:3001";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."bit.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
globalRedirect = "bitwarden.beepboop.systems";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."bitwarden.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:8000";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."radicale.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:5232";
|
||||
extraConfig = ''
|
||||
proxy_set_header X-Script-Name /;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass_header Authorization;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."calendar.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
globalRedirect = "radicale.beepboop.systems";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."cal.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
globalRedirect = "radicale.beepboop.systems";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."skillissue.agency" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
root = "/var/www/skillissue.agency";
|
||||
};
|
||||
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
email = "nickforanick@protonmail.com";
|
||||
};
|
||||
|
||||
# services.roundcube = {
|
||||
# enable = true;
|
||||
# # this is the url of the vhost, not necessarily the same as the fqdn of
|
||||
# # the mailserver
|
||||
# hostName = "cube.beepboop.systems";
|
||||
# extraConfig = ''
|
||||
# # starttls needed for authentication, so the fqdn required to match
|
||||
# # the certificate
|
||||
# $config['smtp_server'] = "tls://${config.mailserver.fqdn}";
|
||||
# $config['smtp_user'] = "%u";
|
||||
# $config['smtp_pass'] = "%p";
|
||||
# '';
|
||||
# };
|
||||
|
||||
services.nginx.virtualHosts."roundcube.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
globalRedirect = "cube.beepboop.systems";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."mail.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
globalRedirect = "cube.beepboop.systems";
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 5232 55555 22 80 443 ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
services.nginx.virtualHosts."franklincce.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:1337";
|
||||
};
|
||||
};
|
||||
|
||||
# WARNING WARNING WARNING
|
||||
# the below is SUPER BAD and should not be copied ANYWHERE
|
||||
# the docker container should be initialized by a flake or other nix concept,
|
||||
# not this nonsense
|
||||
|
||||
systemd.services.franklincce = {
|
||||
description = "the docker container that runs the franklincce app";
|
||||
|
||||
environment = { # this is EVIL, NEVER DO THIS!!!111!
|
||||
NIX_PATH = "nixpkgs=flake:nixpkgs:/nix/var/nix/profiles/per-user/root/channels";
|
||||
};
|
||||
|
||||
script = ''
|
||||
cd /home/ryan
|
||||
|
||||
# don't fail if cloning the git repo fails
|
||||
${pkgs.git}/bin/git clone https://git.beepboop.systems/stupidcomputer/yig yig || true
|
||||
|
||||
cd /home/ryan/yig
|
||||
${pkgs.nix}/bin/nix-shell --command make
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
User = "ryan";
|
||||
};
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
appName = "beepboop.systems"; # Give the site a name
|
||||
database = {
|
||||
type = "postgres";
|
||||
passwordFile = "/etc/gittea-pass";
|
||||
};
|
||||
settings.security.INSTALL_LOCK = true;
|
||||
settings.service = {
|
||||
SHOW_REGISTRATION_BUTTON = false;
|
||||
DISABLE_REGISTRATION = true;
|
||||
};
|
||||
settings.ui.DEFAULT_THEME = "arc-green";
|
||||
settings.api.ENABLE_SWAGGER = false;
|
||||
settings.server = {
|
||||
DOMAIN = "git.beepboop.systems";
|
||||
ROOT_URL = "https://git.beepboop.systems/";
|
||||
LANDING_PAGE = "explore";
|
||||
HTTP_PORT = 3001;
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
enable = true; # Ensure postgresql is enabled
|
||||
authentication = ''
|
||||
local gitea all ident map=gitea-users
|
||||
'';
|
||||
identMap = # Map the gitea user to postgresql
|
||||
''
|
||||
gitea-users gitea gitea
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."git.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:3001";
|
||||
};
|
||||
locations."/bridge" = {
|
||||
proxyPass = "http://localhost:5000";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
services.nginx.virtualHosts."nextcloud.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://10.100.0.2:5028";
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_buffering off;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
services.nginx.enable = true;
|
||||
services.nginx.clientMaxBodySize = "100m";
|
||||
services.nginx.defaultSSLListenPort = 442;
|
||||
|
||||
services.nginx.virtualHosts."beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
root = "/var/www/beepboop.systems";
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
port_in_redirect off;
|
||||
absolute_redirect off;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."tfb.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
return 301 https://marching.beepboop.systems;
|
||||
'';
|
||||
};
|
||||
locations."/groupme" = {
|
||||
proxyPass = "http://10.100.0.2:7439";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."marching.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
root = "/var/www/tfb.beepboop.systems";
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
port_in_redirect off;
|
||||
absolute_redirect off;
|
||||
'';
|
||||
};
|
||||
locations."/groupme" = {
|
||||
proxyPass = "http://10.100.0.2:7439";
|
||||
};
|
||||
};
|
||||
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "nickforanick@protonmail.com";
|
||||
};
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
services.radicale = {
|
||||
enable = true;
|
||||
settings = {
|
||||
auth = {
|
||||
type = "htpasswd";
|
||||
htpasswd_filename = "radicale-passwd";
|
||||
htpasswd_encryption = "plain";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."radicale.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:5232";
|
||||
extraConfig = ''
|
||||
proxy_set_header X-Script-Name /;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass_header Authorization;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."calendar.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
globalRedirect = "radicale.beepboop.systems";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."cal.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
globalRedirect = "radicale.beepboop.systems";
|
||||
};
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
ports = [55555];
|
||||
settings = {
|
||||
X11Forwarding = false;
|
||||
PermitRootLogin = "no";
|
||||
PasswordAuthentication = false;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
services.sslh = {
|
||||
enable = true;
|
||||
settings.protocols = [
|
||||
{
|
||||
host = "localhost";
|
||||
name = "ssh";
|
||||
port = "55555";
|
||||
service = "ssh";
|
||||
}
|
||||
{
|
||||
host = "localhost";
|
||||
name = "tls";
|
||||
port = "442";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
services.vaultwarden.enable = true;
|
||||
services.vaultwarden.config = {
|
||||
DOMAIN = "https://bitwarden.beepboop.systems";
|
||||
SIGNUPS_ALLOWED = false;
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."bit.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
globalRedirect = "bitwarden.beepboop.systems";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."bitwarden.beepboop.systems" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:8000";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
nat = {
|
||||
enable = true;
|
||||
externalInterface = "eth0";
|
||||
internalInterfaces = [ "wg0" ];
|
||||
};
|
||||
firewall.allowedUDPPorts = [ 50000 ];
|
||||
|
||||
wireguard.interfaces = {
|
||||
wg0 = {
|
||||
ips = [ "10.100.0.1/24" ];
|
||||
|
||||
listenPort = 50000;
|
||||
|
||||
postSetup = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
|
||||
'';
|
||||
postShutdown = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
|
||||
'';
|
||||
|
||||
privateKeyFile = "/home/ryan/wg-keys/private";
|
||||
|
||||
peers = [
|
||||
{ # copernicus
|
||||
publicKey = "JlH1X4KRT+B8Uau+qTLtBqyapkbGClIj1db7znU77kc=";
|
||||
allowedIPs = [ "10.100.0.2/32" ];
|
||||
}
|
||||
{ # aristotle
|
||||
publicKey = "Sw2yyMhyS8GOCWm1VuGn3Y7cfx606dXOGK5mux8ckQU=";
|
||||
allowedIPs = [ "10.100.0.3/32" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
app_cache/
|
||||
gpapp_cache/
|
|
@ -1,18 +0,0 @@
|
|||
https://f-droid.org/repo/com.termux_1020.apk
|
||||
https://f-droid.org/repo/com.termux.api_51.apk
|
||||
https://f-droid.org/repo/com.termux.widget_13.apk
|
||||
https://f-droid.org/repo/com.coboltforge.dontmind.multivnc_101.apk
|
||||
https://f-droid.org/repo/com.kylecorry.trail_sense_124.apk
|
||||
https://f-droid.org/repo/org.ligi.survivalmanual_428.apk
|
||||
https://github.com/bitwarden/android/releases/download/v2024.4.0/com.x8bit.bitwarden.apk
|
||||
https://f-droid.org/repo/at.bitfire.icsdroid_81.apk
|
||||
https://f-droid.org/repo/ws.xsoh.etar_47.apk
|
||||
https://f-droid.org/repo/at.bitfire.davdroid_404030200.apk
|
||||
https://f-droid.org/repo/org.oxycblt.auxio_53.apk
|
||||
https://f-droid.org/repo/de.danoeh.antennapod_3050095.apk
|
||||
https://f-droid.org/repo/eu.faircode.email_2241.apk
|
||||
https://f-droid.org/repo/org.koreader.launcher.fdroid_105232.apk
|
||||
https://f-droid.org/repo/at.techbee.jtx_209010003.apk
|
||||
https://f-droid.org/repo/mn.tck.semitone_4.apk
|
||||
https://f-droid.org/repo/de.moekadu.tuner_38.apk
|
||||
https://f-droid.org/repo/io.github.domi04151309.home_1100.apk
|
|
@ -1,3 +0,0 @@
|
|||
com.ministrycentered.PlanningCenter
|
||||
com.groupme.android
|
||||
com.brivo.pass
|
|
@ -1,34 +0,0 @@
|
|||
mkdir -p app_cache
|
||||
for i in $(cat apps); do
|
||||
output_name=$(echo $i | awk -F'/' '{print $NF}')
|
||||
curl "$i" --max-redirs 999 -L -C - -o "app_cache/$output_name"
|
||||
adb install "app_cache/$output_name"
|
||||
done
|
||||
|
||||
mkdir -p gpapp_cache
|
||||
for i in $(cat gpapps); do
|
||||
apkeep -a "$i" ./gpapp_cache/
|
||||
done
|
||||
|
||||
for i in $(ls gpapp_cache/ | grep xapk); do
|
||||
# this is specific to planning center online
|
||||
xapk_playground=$(mktemp)
|
||||
rm $xapk_playground
|
||||
mkdir $xapk_playground
|
||||
|
||||
cp gpapp_cache/$i $xapk_playground
|
||||
cd $xapk_playground
|
||||
mkdir out
|
||||
unzip $i -d out
|
||||
cd -
|
||||
cd $xapk_playground/out
|
||||
rm icon.png
|
||||
rm manifest.json
|
||||
adb install-multiple *
|
||||
cd -
|
||||
done
|
||||
|
||||
cd gpapp_cache
|
||||
for i in $(ls | grep '\.apk'); do
|
||||
adb install $i
|
||||
done
|
|
@ -1,7 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.apkeep
|
||||
];
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
git-annex-install
|
||||
git-annex-install.*
|
||||
git-annex.linux
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
termux: termux-pkgs termux-dots utils-sh rebuild-sh st pip-pkgs git-annex.linux sssg statusbar-polyfill
|
||||
|
||||
list: options # alias
|
||||
options:
|
||||
@echo specific options
|
||||
@echo st - rebuild st
|
||||
@echo utils-sh - copy utilities
|
||||
@echo pip-pkgs - install pip packages
|
||||
@echo termux-pkgs - install termux pkgs
|
||||
@echo termux-dots - install termux dotfiles
|
||||
@echo git-annex.linux - install git-annex
|
||||
@echo sssg - install sssg
|
||||
|
||||
st:
|
||||
-cd ../../../builds/st/ && CFLAGS="-DIS_PHONE" CC=clang make && cp st ~/.local/bin/st
|
||||
|
||||
utils-sh:
|
||||
mkdir -p ~/.local/bin
|
||||
cp ../../../builds/utils/* ~/.local/bin
|
||||
|
||||
rebuild-sh:
|
||||
mkdir -p ~/.local/bin
|
||||
cp ../../../builds/rebuild/* ~/.local/bin
|
||||
pip-pkgs:
|
||||
pip3 install vdirsyncer
|
||||
pip3 install khal
|
||||
# pip3 install khard
|
||||
|
||||
termux-pkgs:
|
||||
pkg install -y \
|
||||
tur-repo \
|
||||
x11-repo
|
||||
|
||||
pkg install -y \
|
||||
neovim \
|
||||
python-pip \
|
||||
feh \
|
||||
xdotool \
|
||||
git \
|
||||
tig \
|
||||
tigervnc \
|
||||
sxhkd \
|
||||
clang \
|
||||
elinks \
|
||||
tmux \
|
||||
fontconfig \
|
||||
xorgproto \
|
||||
fzy \
|
||||
man \
|
||||
libxft \
|
||||
firefox \
|
||||
mupdf \
|
||||
texlive-bin \
|
||||
htop \
|
||||
rbw \
|
||||
pkg-config \
|
||||
xorg-xrandr \
|
||||
bspwm \
|
||||
termux-api \
|
||||
jq \
|
||||
xclip \
|
||||
isync \
|
||||
neomutt \
|
||||
pandoc \
|
||||
wget \
|
||||
which \
|
||||
rsync \
|
||||
openssl \
|
||||
chromium
|
||||
|
||||
termux-dots:
|
||||
mkdir -p ~/.local/bin
|
||||
ln -sf $(CURDIR)/../../../.config ~/.config
|
||||
ln -sf $(CURDIR)/../../../.config/ssh/config ~/.ssh/config
|
||||
ln -sf ~/.config/bash/bashrc ~/.bashrc
|
||||
ln -sf ~/.config/bash/profile ~/.bash_profile
|
||||
mkdir -p ~/.local/share
|
||||
cp $(CURDIR)/../../../home/wallpapers/pape.jpg ~/.local/share
|
||||
mkdir -p ~/.shortcuts
|
||||
cp $(CURDIR)/shortcuts/* ~/.shortcuts
|
||||
|
||||
git-annex.linux:
|
||||
bash install-git-annex.sh
|
||||
|
||||
sssg:
|
||||
-cp ~/git/sssg/sssg.sh ~/.local/bin/sssg
|
||||
-chmod +x ~/.local/bin/sssg
|
||||
|
||||
statusbar-polyfill:
|
||||
cp ~/dot_testing/builds/statusbar/termux-statusbar-polyfill ~/.local/bin
|
|
@ -1,7 +0,0 @@
|
|||
wget https://git-annex.branchable.com/install/Android/git-annex-install
|
||||
MY_WD=$(pwd)
|
||||
|
||||
source git-annex-install || printf "failed\n"
|
||||
|
||||
cd "$MY_WD"
|
||||
mv ~/git-annex.linux ./
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
today=$(date "+%m/%d/%Y")
|
||||
|
||||
printf "Inputting height and weight information for today\n\n"
|
||||
printf "Height?\n"
|
||||
|
||||
read -p "?>" height
|
||||
|
||||
printf "Weight?\n"
|
||||
|
||||
read -p "?>" weight
|
||||
|
||||
cd ~/pdbs
|
||||
printf "\n%s %i" "$today" "$weight" >> weight.timeseries
|
||||
printf "\n%s %i" "$today" "$height" >> height.timeseries
|
||||
|
||||
git add weight.timeseries height.timeseries
|
||||
git commit -m "added height, weight data for $today"
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
today=$(date "+%m/%d/%Y")
|
||||
ledgerdate=$(date "+%Y/%m/%d")
|
||||
|
||||
printf "Inputting an expense for today\n\n"
|
||||
printf "Payee name?\n"
|
||||
|
||||
read -p "?>" payee
|
||||
|
||||
printf "Amount?\n"
|
||||
|
||||
read -p "?>" amount
|
||||
|
||||
cd ~/pdbs
|
||||
printf '%s * %s\n\tExpenses:%s $%s\n\tAssets:Greencard 4154\n\n' "$ledgerdate" "$payee" "$payee" "$amount" >> phone.ledger
|
||||
|
||||
git add phone.ledger
|
||||
git commit -m "added an expense for $today"
|
|
@ -1,9 +0,0 @@
|
|||
register_habits=$(ls ~/pdbs/ |
|
||||
grep '\.habit$' |
|
||||
fzy)
|
||||
|
||||
if [ -z "$register_habits" ]; then
|
||||
echo "you didn't choose one!"
|
||||
else
|
||||
date "+%m/%d/%Y" >> ~/pdbs/$register_habits
|
||||
fi
|
|
@ -1,31 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
day5=$(date --date="5 days ago" "+%m/%d/%Y")
|
||||
day4=$(date --date="4 days ago" "+%m/%d/%Y")
|
||||
day3=$(date --date="3 days ago" "+%m/%d/%Y")
|
||||
day2=$(date --date="2 days ago" "+%m/%d/%Y")
|
||||
day1=$(date --date="1 days ago" "+%m/%d/%Y")
|
||||
today=$(date "+%m/%d/%Y")
|
||||
|
||||
# $1 -- habit filename
|
||||
show_past_habit () {
|
||||
printf "%25s =========\n" "$1"
|
||||
donein5days=$(grep -c "$day5" "$HOME/pdbs/$1")
|
||||
donein4days=$(grep -c "$day4" "$HOME/pdbs/$1")
|
||||
donein3days=$(grep -c "$day3" "$HOME/pdbs/$1")
|
||||
donein2days=$(grep -c "$day2" "$HOME/pdbs/$1")
|
||||
donein1days=$(grep -c "$day1" "$HOME/pdbs/$1")
|
||||
donetoday=$(grep -c "$today" "$HOME/pdbs/$1")
|
||||
|
||||
printf "%.5s %.5s %.5s %.5s %.5s %.5s\n%5s %5s %5s %5s %5s %5s\n\n" \
|
||||
"$day5" "$day4" "$day3" "$day2" "$day1" "$today" \
|
||||
"$donein5days" "$donein4days" "$donein3days" \
|
||||
"$donein2days" "$donein1days" "$donetoday"
|
||||
}
|
||||
|
||||
habits=$(ls ~/pdbs | grep '\.habit$')
|
||||
for i in $habits; do
|
||||
show_past_habit "$i"
|
||||
done
|
||||
|
||||
read THROWAWAY
|
|
@ -0,0 +1,18 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../modules/bootstrap.nix
|
||||
../../modules/common.nix
|
||||
../../modules/x11.nix
|
||||
../../modules/discord.nix
|
||||
];
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/vda";
|
||||
|
||||
networking.hostName = "virtbox";
|
||||
|
||||
system.stateVersion = "23.11";
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/7b70ab88-296c-4737-90b2-267cb2432dc1";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{ lib, inputs, config, pkgs, home, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../home/x11.nix
|
||||
];
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../modules/bootstrap.nix
|
||||
../../modules/common.nix
|
||||
../../modules/x11.nix
|
||||
../../modules/tlp.nix
|
||||
../../modules/media.nix
|
||||
../../modules/anki.nix
|
||||
../../modules/power-control.nix
|
||||
../../modules/adb.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
xscreensaver
|
||||
thunderbird
|
||||
];
|
||||
|
||||
services.udev.extraRules = ''
|
||||
ACTION=="add", SUBSYSTEM=="input", KERNEL=="event[0-20]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", MODE:="0666" GROUP="usr", SYMLINK+="input/touchscreen"
|
||||
'';
|
||||
|
||||
users.users.usr.extraGroups = [ "input" ];
|
||||
|
||||
services.getty.autologinUser = "usr";
|
||||
|
||||
boot.loader = {
|
||||
grub.timeoutStyle = "hidden";
|
||||
timeout = 0;
|
||||
grub.enable = true;
|
||||
grub.device = "/dev/sda";
|
||||
};
|
||||
|
||||
hardware.pulseaudio.enable = true;
|
||||
|
||||
|
||||
networking.hostName = "x230t";
|
||||
|
||||
system.stateVersion = "23.11";
|
||||
}
|
|
@ -8,32 +8,25 @@
|
|||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" "psmouse" "wacom" ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/8182bde6-7213-4108-9dbf-951f76870207";
|
||||
{ device = "/dev/disk/by-uuid/772f67d6-9434-42f1-aa3e-153e41affe4c";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/0D21-265A";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/fc5366cc-2cec-415e-85dd-7c01a4e4fb4f"; }
|
||||
];
|
||||
swapDevices = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp0s25.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
@ -0,0 +1,10 @@
|
|||
{ lib, inputs, config, pkgs, home, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../home/x11.nix
|
||||
../../home/chromium
|
||||
];
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, pkgs
|
||||
, makeWrapper
|
||||
, sxhkd
|
||||
, bash
|
||||
, feh
|
||||
, jq
|
||||
, fzy
|
||||
, curl
|
||||
, texliveFull
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "archutils";
|
||||
version = "1.01";
|
||||
|
||||
src = ./archutils;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [
|
||||
bash
|
||||
feh
|
||||
jq
|
||||
curl
|
||||
fzy
|
||||
texliveFull
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
for i in $(ls $src/); do
|
||||
cp $src/$i $out/bin
|
||||
ln -sf $out/bin/tmenu_run $out/bin/regenerate
|
||||
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ bash feh jq curl fzy texliveFull ]}
|
||||
done
|
||||
'';
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
working_directory=$(date +%Y-%m-%d)
|
||||
human_readable=$(date "+%d %b %Y")
|
||||
|
||||
cd ~/annex/briefs/
|
||||
mkdir "$working_directory"
|
||||
cd "$working_directory"
|
||||
|
||||
cat > main.tex <<EOF
|
||||
\documentclass[oneside]{article}
|
||||
|
||||
\usepackage{amssymb}
|
||||
\usepackage[left=1.5cm, right=1.5cm, top=1.5cm, bottom=1.5cm]{geometry}
|
||||
|
||||
\pagenumbering{gobble}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\noindent {\Large Ryan Marina} \hspace{\fill} {\Large Briefing for $human_readable}
|
||||
|
||||
\noindent \textsc{Internal Document System} \hspace{\fill} $ \square $ \textit{scanned?} $ \square $ \textit{not scanned?}
|
||||
|
||||
\noindent \textit{Digital Archive Supplement} \hspace{\fill} internal notes: \rule{3cm}{0.4pt}
|
||||
|
||||
\noindent \texttt{iref:annex/briefs/$working_directory}
|
||||
|
||||
\vspace{0.4cm}
|
||||
|
||||
\noindent \textsc{Schedule}
|
||||
|
||||
\vspace{-0.30cm}
|
||||
|
||||
\noindent \rule{\textwidth}{0.4pt}
|
||||
|
||||
EOF
|
||||
|
||||
schedule=$(
|
||||
khal list today today --format "{calendar}|{categories}|{start-time}|{end-time}|{title}" |
|
||||
grep -E '^home\|school\||band\|'
|
||||
)
|
||||
IFS='
|
||||
'
|
||||
|
||||
for class in $schedule; do
|
||||
echo "$class" |
|
||||
awk -F'|' '{
|
||||
print "\\noindent " $5 " \\hspace{\\fill} \\textit{(" $3 "-" $4 ")}\n\n"
|
||||
}' >> main.tex
|
||||
done
|
||||
|
||||
cat >> main.tex <<EOF
|
||||
\vspace{0.4cm}
|
||||
|
||||
\noindent \textsc{Unresolved Items}
|
||||
|
||||
\vspace{-0.30cm}
|
||||
|
||||
\noindent \rule{\textwidth}{0.4pt}
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
todo_items=$(
|
||||
todo --porcelain |
|
||||
jq -r '.[].summary'
|
||||
)
|
||||
IFS='
|
||||
'
|
||||
|
||||
for todo in $todo_items; do
|
||||
printf '\\noindent $ \\square $ %s\n\n' "$todo" >> main.tex
|
||||
done
|
||||
|
||||
cat >> main.tex <<EOF
|
||||
\vspace{0.4cm}
|
||||
|
||||
EOF
|
||||
|
||||
# generate notices
|
||||
ssh netbox df -h |
|
||||
grep /dev/vda3 |
|
||||
awk -F' ' '{print "\\item \\texttt{" $1 "} on \\texttt{netbox} is at " $5 " utilization."}' |
|
||||
sed 's/\%/\\%/g' > notices.tex
|
||||
|
||||
if [ -f notices.tex ]; then
|
||||
cat >> main.tex <<EOF
|
||||
\noindent \textsc{Procedural Notices}
|
||||
|
||||
\vspace{-0.30cm}
|
||||
|
||||
\noindent \rule{\textwidth}{0.4pt}
|
||||
|
||||
\begin{enumerate}
|
||||
|
||||
\input{notices}
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
\vspace{0.4cm}
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >> main.tex <<EOF
|
||||
\noindent \textsc{Items to be Appended to the Agenda}
|
||||
|
||||
\vspace{-0.30cm}
|
||||
|
||||
\noindent \rule{\textwidth}{0.4pt}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
pdflatex main.tex
|
||||
|
||||
printf "[!] briefing generated\n"
|
||||
|
||||
printf "file:///home/usr/annex/briefs/%s/main.pdf\n" "$working_directory"
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
temp=$(mktemp)
|
||||
|
||||
nvim $temp
|
||||
|
||||
IFS='
|
||||
'
|
||||
for i in $(cat $temp); do
|
||||
todo new "$i"
|
||||
done
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
generate_daily_brief | tail -1 | sed 's|file://||g' | xargs lp -d EPSONTHING
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1703467016,
|
||||
"narHash": "sha256-/5A/dNPhbQx/Oa2d+Get174eNI3LERQ7u6WTWOlR1eQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d02d818f22c777aa4e854efc3242ec451e5d462a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
|
||||
outputs =
|
||||
{ nixpkgs, ... }:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
withSystem =
|
||||
f:
|
||||
lib.fold lib.recursiveUpdate { } (
|
||||
map f [
|
||||
"x86_64-linux"
|
||||
]
|
||||
);
|
||||
mkPackages = pkgs: {
|
||||
st = pkgs.callPackage ./st.nix { };
|
||||
rebuild = pkgs.callPackage ./rebuild.nix { };
|
||||
utils = pkgs.callPackage ./utils.nix { };
|
||||
};
|
||||
in
|
||||
withSystem (
|
||||
system: {
|
||||
overlays.default = final: _: mkPackages final;
|
||||
|
||||
packages.${system} = mkPackages nixpkgs.legacyPackages.${system};
|
||||
}
|
||||
);
|
||||
}
|
|
@ -18,8 +18,6 @@ stdenv.mkDerivation rec {
|
|||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp $src/rebuild $out/bin
|
||||
cp $src/git-rebuild $out/bin
|
||||
cp $src/nix-sanitation $out/bin
|
||||
wrapProgram $out/bin/rebuild --prefix PATH : ${lib.makeBinPath [ bash ]}
|
||||
'';
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# make sure we're in dot_testing
|
||||
cd ~/dot_testing
|
||||
|
||||
git pull
|
||||
git stash
|
||||
git rebase
|
||||
|
||||
rebuild
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
printf "clearing out nix caches\n"
|
||||
|
||||
sudo nix-collect-garbage -d
|
||||
nix-collect-garbage -d
|
||||
sudo nix-store --optimize
|
|
@ -1,18 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd ~/dot_testing
|
||||
if [ "$(hostname)" = "localhost" ]; then
|
||||
# we're on a phone
|
||||
cd boxes/phone/out-of-tree
|
||||
make $@
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -f "boxes/$(hostname)/custom_command" ]; then
|
||||
eval "$(cat boxes/$(hostname)/custom_command)"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -f "flake.nix" ]; then
|
||||
sudo nixos-rebuild --flake . switch $@
|
||||
else
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, pkgs
|
||||
, fetchgit
|
||||
, makeWrapper
|
||||
, bash
|
||||
, pandoc
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "sssg";
|
||||
version = "1.00";
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.beepboop.systems/stupidcomputer/sssg";
|
||||
hash = "sha256-b0lbHsu628CKPNC6HDLApZQ4HsinTrXCoFqr1KdVIYE=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [ bash pandoc ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
cp $src/sssg.sh $out/bin/sssg
|
||||
wrapProgram $out/bin/sssg --prefix PATH : ${lib.makeBinPath [ bash pandoc ]}
|
||||
'';
|
||||
}
|
|
@ -7,8 +7,6 @@
|
|||
, fontconfig
|
||||
, freetype
|
||||
, ncurses
|
||||
, fantasque-sans-mono
|
||||
, lightMode ? false
|
||||
, extraLibs ? [ ]
|
||||
}:
|
||||
|
||||
|
@ -16,13 +14,15 @@ stdenv.mkDerivation rec {
|
|||
pname = "st";
|
||||
version = "1.02";
|
||||
|
||||
src = ./st;
|
||||
src = fetchgit {
|
||||
url = "https://git.beepboop.systems/rndusr/st";
|
||||
sha256 = "sha256-zdID1SUnTO/zl90EG8TguBNYYCnrnqFnSLz32kQZbng=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkg-config fontconfig freetype ncurses ];
|
||||
buildInputs = [ libX11 libXft ] ++ extraLibs;
|
||||
|
||||
buildPhase = lib.optionalString (lightMode == true) "cp lightmode.h colors.h;" +
|
||||
''
|
||||
buildPhase = ''
|
||||
make
|
||||
'';
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
st
|
||||
st.o
|
||||
tags
|
||||
x.o
|
250
builds/st/FAQ
250
builds/st/FAQ
|
@ -1,250 +0,0 @@
|
|||
## Why does st not handle utmp entries?
|
||||
|
||||
Use the excellent tool of [utmp](https://git.suckless.org/utmp/) for this task.
|
||||
|
||||
|
||||
## Some _random program_ complains that st is unknown/not recognised/unsupported/whatever!
|
||||
|
||||
It means that st doesn’t have any terminfo entry on your system. Chances are
|
||||
you did not `make install`. If you just want to test it without installing it,
|
||||
you can manually run `tic -sx st.info`.
|
||||
|
||||
|
||||
## Nothing works, and nothing is said about an unknown terminal!
|
||||
|
||||
* Some programs just assume they’re running in xterm i.e. they don’t rely on
|
||||
terminfo. What you see is the current state of the “xterm compliance”.
|
||||
* Some programs don’t complain about the lacking st description and default to
|
||||
another terminal. In that case see the question about terminfo.
|
||||
|
||||
|
||||
## How do I scroll back up?
|
||||
|
||||
* Using a terminal multiplexer.
|
||||
* `st -e tmux` using C-b [
|
||||
* `st -e screen` using C-a ESC
|
||||
* Using the excellent tool of [scroll](https://git.suckless.org/scroll/).
|
||||
* Using the scrollback [patch](https://st.suckless.org/patches/scrollback/).
|
||||
|
||||
|
||||
## I would like to have utmp and/or scroll functionality by default
|
||||
|
||||
You can add the absolute path of both programs in your config.h file. You only
|
||||
have to modify the value of utmp and scroll variables.
|
||||
|
||||
|
||||
## Why doesn't the Del key work in some programs?
|
||||
|
||||
Taken from the terminfo manpage:
|
||||
|
||||
If the terminal has a keypad that transmits codes when the keys
|
||||
are pressed, this information can be given. Note that it is not
|
||||
possible to handle terminals where the keypad only works in
|
||||
local (this applies, for example, to the unshifted HP 2621 keys).
|
||||
If the keypad can be set to transmit or not transmit, give these
|
||||
codes as smkx and rmkx. Otherwise the keypad is assumed to
|
||||
always transmit.
|
||||
|
||||
In the st case smkx=E[?1hE= and rmkx=E[?1lE>, so it is mandatory that
|
||||
applications which want to test against keypad keys send these
|
||||
sequences.
|
||||
|
||||
But buggy applications (like bash and irssi, for example) don't do this. A fast
|
||||
solution for them is to use the following command:
|
||||
|
||||
$ printf '\033[?1h\033=' >/dev/tty
|
||||
|
||||
or
|
||||
$ tput smkx
|
||||
|
||||
In the case of bash, readline is used. Readline has a different note in its
|
||||
manpage about this issue:
|
||||
|
||||
enable-keypad (Off)
|
||||
When set to On, readline will try to enable the
|
||||
application keypad when it is called. Some systems
|
||||
need this to enable arrow keys.
|
||||
|
||||
Adding this option to your .inputrc will fix the keypad problem for all
|
||||
applications using readline.
|
||||
|
||||
If you are using zsh, then read the zsh FAQ
|
||||
<http://zsh.sourceforge.net/FAQ/zshfaq03.html#l25>:
|
||||
|
||||
It should be noted that the O / [ confusion can occur with other keys
|
||||
such as Home and End. Some systems let you query the key sequences
|
||||
sent by these keys from the system's terminal database, terminfo.
|
||||
Unfortunately, the key sequences given there typically apply to the
|
||||
mode that is not the one zsh uses by default (it's the "application"
|
||||
mode rather than the "raw" mode). Explaining the use of terminfo is
|
||||
outside of the scope of this FAQ, but if you wish to use the key
|
||||
sequences given there you can tell the line editor to turn on
|
||||
"application" mode when it starts and turn it off when it stops:
|
||||
|
||||
function zle-line-init () { echoti smkx }
|
||||
function zle-line-finish () { echoti rmkx }
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
|
||||
Putting these lines into your .zshrc will fix the problems.
|
||||
|
||||
|
||||
## How can I use meta in 8bit mode?
|
||||
|
||||
St supports meta in 8bit mode, but the default terminfo entry doesn't
|
||||
use this capability. If you want it, you have to use the 'st-meta' value
|
||||
in TERM.
|
||||
|
||||
|
||||
## I cannot compile st in OpenBSD
|
||||
|
||||
OpenBSD lacks librt, despite it being mandatory in POSIX
|
||||
<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html#tag_20_11_13>.
|
||||
If you want to compile st for OpenBSD you have to remove -lrt from config.mk, and
|
||||
st will compile without any loss of functionality, because all the functions are
|
||||
included in libc on this platform.
|
||||
|
||||
|
||||
## The Backspace Case
|
||||
|
||||
St is emulating the Linux way of handling backspace being delete and delete being
|
||||
backspace.
|
||||
|
||||
This is an issue that was discussed in suckless mailing list
|
||||
<https://lists.suckless.org/dev/1404/20697.html>. Here is why some old grumpy
|
||||
terminal users wants its backspace to be how he feels it:
|
||||
|
||||
Well, I am going to comment why I want to change the behaviour
|
||||
of this key. When ASCII was defined in 1968, communication
|
||||
with computers was done using punched cards, or hardcopy
|
||||
terminals (basically a typewriter machine connected with the
|
||||
computer using a serial port). ASCII defines DELETE as 7F,
|
||||
because, in punched-card terms, it means all the holes of the
|
||||
card punched; it is thus a kind of 'physical delete'. In the
|
||||
same way, the BACKSPACE key was a non-destructive backspace,
|
||||
as on a typewriter. So, if you wanted to delete a character,
|
||||
you had to BACKSPACE and then DELETE. Another use of BACKSPACE
|
||||
was to type accented characters, for example 'a BACKSPACE `'.
|
||||
The VT100 had no BACKSPACE key; it was generated using the
|
||||
CONTROL key as another control character (CONTROL key sets to
|
||||
0 b7 b6 b5, so it converts H (code 0x48) into BACKSPACE (code
|
||||
0x08)), but it had a DELETE key in a similar position where
|
||||
the BACKSPACE key is located today on common PC keyboards.
|
||||
All the terminal emulators emulated the difference between
|
||||
these keys correctly: the backspace key generated a BACKSPACE
|
||||
(^H) and delete key generated a DELETE (^?).
|
||||
|
||||
But a problem arose when Linus Torvalds wrote Linux. Unlike
|
||||
earlier terminals, the Linux virtual terminal (the terminal
|
||||
emulator integrated in the kernel) returned a DELETE when
|
||||
backspace was pressed, due to the VT100 having a DELETE key in
|
||||
the same position. This created a lot of problems (see [1]
|
||||
and [2]). Since Linux has become the king, a lot of terminal
|
||||
emulators today generate a DELETE when the backspace key is
|
||||
pressed in order to avoid problems with Linux. The result is
|
||||
that the only way of generating a BACKSPACE on these systems
|
||||
is by using CONTROL + H. (I also think that emacs had an
|
||||
important point here because the CONTROL + H prefix is used
|
||||
in emacs in some commands (help commands).)
|
||||
|
||||
From point of view of the kernel, you can change the key
|
||||
for deleting a previous character with stty erase. When you
|
||||
connect a real terminal into a machine you describe the type
|
||||
of terminal, so getty configures the correct value of stty
|
||||
erase for this terminal. In the case of terminal emulators,
|
||||
however, you don't have any getty that can set the correct
|
||||
value of stty erase, so you always get the default value.
|
||||
For this reason, it is necessary to add 'stty erase ^H' to your
|
||||
profile if you have changed the value of the backspace key.
|
||||
Of course, another solution is for st itself to modify the
|
||||
value of stty erase. I usually have the inverse problem:
|
||||
when I connect to non-Unix machines, I have to press CONTROL +
|
||||
h to get a BACKSPACE. The inverse problem occurs when a user
|
||||
connects to my Unix machines from a different system with a
|
||||
correct backspace key.
|
||||
|
||||
[1] http://www.ibb.net/~anne/keyboard.html
|
||||
[2] http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html
|
||||
|
||||
|
||||
## But I really want the old grumpy behaviour of my terminal
|
||||
|
||||
Apply [1].
|
||||
|
||||
[1] https://st.suckless.org/patches/delkey
|
||||
|
||||
|
||||
## Why do images not work in st using the w3m image hack?
|
||||
|
||||
w3mimg uses a hack that draws an image on top of the terminal emulator Drawable
|
||||
window. The hack relies on the terminal to use a single buffer to draw its
|
||||
contents directly.
|
||||
|
||||
st uses double-buffered drawing so the image is quickly replaced and may show a
|
||||
short flicker effect.
|
||||
|
||||
Below is a patch example to change st double-buffering to a single Drawable
|
||||
buffer.
|
||||
|
||||
diff --git a/x.c b/x.c
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -732,10 +732,6 @@ xresize(int col, int row)
|
||||
win.tw = col * win.cw;
|
||||
win.th = row * win.ch;
|
||||
|
||||
- XFreePixmap(xw.dpy, xw.buf);
|
||||
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||
- DefaultDepth(xw.dpy, xw.scr));
|
||||
- XftDrawChange(xw.draw, xw.buf);
|
||||
xclear(0, 0, win.w, win.h);
|
||||
|
||||
/* resize to new width */
|
||||
@@ -1148,8 +1144,7 @@ xinit(int cols, int rows)
|
||||
gcvalues.graphics_exposures = False;
|
||||
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
|
||||
&gcvalues);
|
||||
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||
- DefaultDepth(xw.dpy, xw.scr));
|
||||
+ xw.buf = xw.win;
|
||||
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
||||
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
||||
|
||||
@@ -1632,8 +1627,6 @@ xdrawline(Line line, int x1, int y1, int x2)
|
||||
void
|
||||
xfinishdraw(void)
|
||||
{
|
||||
- XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w,
|
||||
- win.h, 0, 0);
|
||||
XSetForeground(xw.dpy, dc.gc,
|
||||
dc.col[IS_SET(MODE_REVERSE)?
|
||||
defaultfg : defaultbg].pixel);
|
||||
|
||||
|
||||
## BadLength X error in Xft when trying to render emoji
|
||||
|
||||
Xft makes st crash when rendering color emojis with the following error:
|
||||
|
||||
"X Error of failed request: BadLength (poly request too large or internal Xlib length error)"
|
||||
Major opcode of failed request: 139 (RENDER)
|
||||
Minor opcode of failed request: 20 (RenderAddGlyphs)
|
||||
Serial number of failed request: 1595
|
||||
Current serial number in output stream: 1818"
|
||||
|
||||
This is a known bug in Xft (not st) which happens on some platforms and
|
||||
combination of particular fonts and fontconfig settings.
|
||||
|
||||
See also:
|
||||
https://gitlab.freedesktop.org/xorg/lib/libxft/issues/6
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=107534
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
||||
|
||||
The solution is to remove color emoji fonts or disable this in the fontconfig
|
||||
XML configuration. As an ugly workaround (which may work only on newer
|
||||
fontconfig versions (FC_COLOR)), the following code can be used to mask color
|
||||
fonts:
|
||||
|
||||
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
||||
|
||||
Please don't bother reporting this bug to st, but notify the upstream Xft
|
||||
developers about fixing this bug.
|
|
@ -1,17 +0,0 @@
|
|||
A STATEMENT ON LEGACY SUPPORT
|
||||
|
||||
In the terminal world there is much cruft that comes from old and unsup‐
|
||||
ported terminals that inherit incompatible modes and escape sequences
|
||||
which noone is able to know, except when he/she comes from that time and
|
||||
developed a graphical vt100 emulator at that time.
|
||||
|
||||
One goal of st is to only support what is really needed. When you en‐
|
||||
counter a sequence which you really need, implement it. But while you
|
||||
are at it, do not add the other cruft you might encounter while sneek‐
|
||||
ing at other terminal emulators. History has bloated them and there is
|
||||
no real evidence that most of the sequences are used today.
|
||||
|
||||
|
||||
Christoph Lohmann <20h@r-36.net>
|
||||
2012-09-13T07:00:36.081271045+02:00
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
MIT/X Consortium License
|
||||
|
||||
© 2014-2022 Hiltjo Posthuma <hiltjo at codemadness dot org>
|
||||
© 2018 Devin J. Pohly <djpohly at gmail dot com>
|
||||
© 2014-2017 Quentin Rameau <quinq at fifth dot space>
|
||||
© 2009-2012 Aurélien APTEL <aurelien dot aptel at gmail dot com>
|
||||
© 2008-2017 Anselm R Garbe <garbeam at gmail dot com>
|
||||
© 2012-2017 Roberto E. Vargas Caballero <k0ga at shike2 dot com>
|
||||
© 2012-2016 Christoph Lohmann <20h at r-36 dot net>
|
||||
© 2013 Eon S. Jeon <esjeon at hyunmu dot am>
|
||||
© 2013 Alexander Sedov <alex0player at gmail dot com>
|
||||
© 2013 Mark Edgar <medgar123 at gmail dot com>
|
||||
© 2013-2014 Eric Pruitt <eric.pruitt at gmail dot com>
|
||||
© 2013 Michael Forney <mforney at mforney dot org>
|
||||
© 2013-2014 Markus Teich <markus dot teich at stusta dot mhn dot de>
|
||||
© 2014-2015 Laslo Hunhold <dev at frign dot de>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
|
@ -1,57 +0,0 @@
|
|||
# st - simple terminal
|
||||
# See LICENSE file for copyright and license details.
|
||||
.POSIX:
|
||||
|
||||
include config.mk
|
||||
|
||||
SRC = st.c x.c
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
all: options st
|
||||
|
||||
options:
|
||||
@echo st build options:
|
||||
@echo "CFLAGS = $(STCFLAGS)"
|
||||
@echo "LDFLAGS = $(STLDFLAGS)"
|
||||
@echo "CC = $(CC)"
|
||||
|
||||
config.h:
|
||||
cp config.def.h config.h
|
||||
|
||||
.c.o:
|
||||
$(CC) $(STCFLAGS) -c $<
|
||||
|
||||
st.o: config.h st.h win.h
|
||||
x.o: arg.h config.h st.h win.h
|
||||
|
||||
$(OBJ): config.h config.mk
|
||||
|
||||
st: $(OBJ)
|
||||
$(CC) -o $@ $(OBJ) $(STLDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f st $(OBJ) st-$(VERSION).tar.gz
|
||||
|
||||
dist: clean
|
||||
mkdir -p st-$(VERSION)
|
||||
cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
|
||||
config.def.h st.info st.1 arg.h st.h win.h $(SRC)\
|
||||
st-$(VERSION)
|
||||
tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
|
||||
rm -rf st-$(VERSION)
|
||||
|
||||
install: st
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f st $(DESTDIR)$(PREFIX)/bin
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
|
||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
tic -sx st.info
|
||||
@echo Please see the README file regarding the terminfo entry of st.
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/st
|
||||
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
|
||||
.PHONY: all options clean dist install uninstall
|
|
@ -1,34 +0,0 @@
|
|||
st - simple terminal
|
||||
--------------------
|
||||
st is a simple terminal emulator for X which sucks less.
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
In order to build st you need the Xlib header files.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
Edit config.mk to match your local setup (st is installed into
|
||||
the /usr/local namespace by default).
|
||||
|
||||
Afterwards enter the following command to build and install st (if
|
||||
necessary as root):
|
||||
|
||||
make clean install
|
||||
|
||||
|
||||
Running st
|
||||
----------
|
||||
If you did not install st with make clean install, you must compile
|
||||
the st terminfo entry with the following command:
|
||||
|
||||
tic -sx st.info
|
||||
|
||||
See the man page for additional details.
|
||||
|
||||
Credits
|
||||
-------
|
||||
Based on Aurélien APTEL <aurelien dot aptel at gmail dot com> bt source code.
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
vt emulation
|
||||
------------
|
||||
|
||||
* double-height support
|
||||
|
||||
code & interface
|
||||
----------------
|
||||
|
||||
* add a simple way to do multiplexing
|
||||
|
||||
drawing
|
||||
-------
|
||||
* add diacritics support to xdraws()
|
||||
* switch to a suckless font drawing library
|
||||
* make the font cache simpler
|
||||
* add better support for brightening of the upper colors
|
||||
|
||||
bugs
|
||||
----
|
||||
|
||||
* fix shift up/down (shift selection in emacs)
|
||||
* remove DEC test sequence when appropriate
|
||||
|
||||
misc
|
||||
----
|
||||
|
||||
$ grep -nE 'XXX|TODO' st.c
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Copy me if you can.
|
||||
* by 20h
|
||||
*/
|
||||
|
||||
#ifndef ARG_H__
|
||||
#define ARG_H__
|
||||
|
||||
extern char *argv0;
|
||||
|
||||
/* use main(int argc, char *argv[]) */
|
||||
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
|
||||
argv[0] && argv[0][0] == '-'\
|
||||
&& argv[0][1];\
|
||||
argc--, argv++) {\
|
||||
char argc_;\
|
||||
char **argv_;\
|
||||
int brk_;\
|
||||
if (argv[0][1] == '-' && argv[0][2] == '\0') {\
|
||||
argv++;\
|
||||
argc--;\
|
||||
break;\
|
||||
}\
|
||||
int i_;\
|
||||
for (i_ = 1, brk_ = 0, argv_ = argv;\
|
||||
argv[0][i_] && !brk_;\
|
||||
i_++) {\
|
||||
if (argv_ != argv)\
|
||||
break;\
|
||||
argc_ = argv[0][i_];\
|
||||
switch (argc_)
|
||||
|
||||
#define ARGEND }\
|
||||
}
|
||||
|
||||
#define ARGC() argc_
|
||||
|
||||
#define EARGF(x) ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
|
||||
((x), abort(), (char *)0) :\
|
||||
(brk_ = 1, (argv[0][i_+1] != '\0')?\
|
||||
(&argv[0][i_+1]) :\
|
||||
(argc--, argv++, argv[0])))
|
||||
|
||||
#define ARGF() ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
|
||||
(char *)0 :\
|
||||
(brk_ = 1, (argv[0][i_+1] != '\0')?\
|
||||
(&argv[0][i_+1]) :\
|
||||
(argc--, argv++, argv[0])))
|
||||
|
||||
#endif
|
|
@ -1,28 +0,0 @@
|
|||
/* Terminal colors (16 first used in escape sequence) */
|
||||
static const char *colorname[] = {
|
||||
/* 8 normal colors */
|
||||
"#161510",
|
||||
"#a32810",
|
||||
"#727a18",
|
||||
"#a37720",
|
||||
"#3d6266",
|
||||
"#7a4955",
|
||||
"#557a55",
|
||||
"#8e8463",
|
||||
|
||||
/* 8 bright colors */
|
||||
"#4c4635",
|
||||
"#cc3214",
|
||||
"#8e991e",
|
||||
"#cc9528",
|
||||
"#4c7b7f",
|
||||
"#995b6b",
|
||||
"#6b996b",
|
||||
"#ccbc8e",
|
||||
|
||||
[255] = 0,
|
||||
|
||||
/* more colors can be added after 255 to use with DefaultXX */
|
||||
"#cccccc",
|
||||
"#555555",
|
||||
};
|
|
@ -1,476 +0,0 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/*
|
||||
* appearance
|
||||
*
|
||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||
*/
|
||||
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
||||
static int borderpx = 2;
|
||||
|
||||
/*
|
||||
* What program is execed by st depends of these precedence rules:
|
||||
* 1: program passed with -e
|
||||
* 2: scroll and/or utmp
|
||||
* 3: SHELL environment variable
|
||||
* 4: value of shell in /etc/passwd
|
||||
* 5: value of shell in config.h
|
||||
*/
|
||||
static char *shell = "/bin/sh";
|
||||
char *utmp = NULL;
|
||||
/* scroll program: to enable use a string like "scroll" */
|
||||
char *scroll = NULL;
|
||||
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
|
||||
|
||||
/* identification sequence returned in DA and DECID */
|
||||
char *vtiden = "\033[?6c";
|
||||
|
||||
/* Kerning / character bounding-box multipliers */
|
||||
static float cwscale = 1.0;
|
||||
static float chscale = 1.0;
|
||||
|
||||
/*
|
||||
* word delimiter string
|
||||
*
|
||||
* More advanced example: L" `'\"()[]{}"
|
||||
*/
|
||||
wchar_t *worddelimiters = L" ";
|
||||
|
||||
/* selection timeouts (in milliseconds) */
|
||||
static unsigned int doubleclicktimeout = 300;
|
||||
static unsigned int tripleclicktimeout = 600;
|
||||
|
||||
/* alt screens */
|
||||
int allowaltscreen = 1;
|
||||
|
||||
/* allow certain non-interactive (insecure) window operations such as:
|
||||
setting the clipboard text */
|
||||
int allowwindowops = 0;
|
||||
|
||||
/*
|
||||
* draw latency range in ms - from new content/keypress/etc until drawing.
|
||||
* within this range, st draws when content stops arriving (idle). mostly it's
|
||||
* near minlatency, but it waits longer for slow updates to avoid partial draw.
|
||||
* low minlatency will tear/flicker more, as it can "detect" idle too early.
|
||||
*/
|
||||
static double minlatency = 8;
|
||||
static double maxlatency = 33;
|
||||
|
||||
/*
|
||||
* blinking timeout (set to 0 to disable blinking) for the terminal blinking
|
||||
* attribute.
|
||||
*/
|
||||
static unsigned int blinktimeout = 800;
|
||||
|
||||
/*
|
||||
* thickness of underline and bar cursors
|
||||
*/
|
||||
static unsigned int cursorthickness = 2;
|
||||
|
||||
/*
|
||||
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
|
||||
* it
|
||||
*/
|
||||
static int bellvolume = 0;
|
||||
|
||||
/* default TERM value */
|
||||
char *termname = "st-256color";
|
||||
|
||||
/*
|
||||
* spaces per tab
|
||||
*
|
||||
* When you are changing this value, don't forget to adapt the »it« value in
|
||||
* the st.info and appropriately install the st.info in the environment where
|
||||
* you use this st version.
|
||||
*
|
||||
* it#$tabspaces,
|
||||
*
|
||||
* Secondly make sure your kernel is not expanding tabs. When running `stty
|
||||
* -a` »tab0« should appear. You can tell the terminal to not expand tabs by
|
||||
* running following command:
|
||||
*
|
||||
* stty tabs
|
||||
*/
|
||||
unsigned int tabspaces = 8;
|
||||
|
||||
/* 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 */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* Default shape of cursor
|
||||
* 2: Block ("█")
|
||||
* 4: Underline ("_")
|
||||
* 6: Bar ("|")
|
||||
* 7: Snowman ("☃")
|
||||
*/
|
||||
static unsigned int cursorshape = 2;
|
||||
|
||||
/*
|
||||
* Default columns and rows numbers
|
||||
*/
|
||||
|
||||
static unsigned int cols = 80;
|
||||
static unsigned int rows = 24;
|
||||
|
||||
/*
|
||||
* Default colour and shape of the mouse cursor
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
static unsigned int defaultattr = 11;
|
||||
|
||||
/*
|
||||
* Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set).
|
||||
* Note that if you want to use ShiftMask with selmasks, set this to an other
|
||||
* modifier, set to 0 to not use it.
|
||||
*/
|
||||
static uint forcemousemod = ShiftMask;
|
||||
|
||||
/*
|
||||
* Internal mouse shortcuts.
|
||||
* Beware that overloading Button1 will disable the selection.
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
/* mask button function argument release */
|
||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||
};
|
||||
|
||||
/* Internal keyboard shortcuts. */
|
||||
#define MODKEY Mod1Mask
|
||||
#define TERMMOD (ControlMask|ShiftMask)
|
||||
|
||||
static Shortcut shortcuts[] = {
|
||||
/* mask keysym function argument */
|
||||
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
|
||||
{ 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} },
|
||||
{ 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} },
|
||||
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
|
||||
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
|
||||
};
|
||||
|
||||
/*
|
||||
* Special keys (change & recompile st.info accordingly)
|
||||
*
|
||||
* Mask value:
|
||||
* * Use XK_ANY_MOD to match the key no matter modifiers state
|
||||
* * Use XK_NO_MOD to match the key alone (no modifiers)
|
||||
* appkey value:
|
||||
* * 0: no value
|
||||
* * > 0: keypad application mode enabled
|
||||
* * = 2: term.numlock = 1
|
||||
* * < 0: keypad application mode disabled
|
||||
* appcursor value:
|
||||
* * 0: no value
|
||||
* * > 0: cursor application mode enabled
|
||||
* * < 0: cursor application mode disabled
|
||||
*
|
||||
* Be careful with the order of the definitions because st searches in
|
||||
* this table sequentially, so any XK_ANY_MOD must be in the last
|
||||
* position for a key.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
|
||||
* to be mapped below, add them to this array.
|
||||
*/
|
||||
static KeySym mappedkeys[] = { -1 };
|
||||
|
||||
/*
|
||||
* State bits to ignore when matching key or button events. By default,
|
||||
* numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored.
|
||||
*/
|
||||
static uint ignoremod = Mod2Mask|XK_SWITCH_MOD;
|
||||
|
||||
/*
|
||||
* This is the huge key array which defines all compatibility to the Linux
|
||||
* world. Please decide about changes wisely.
|
||||
*/
|
||||
static Key key[] = {
|
||||
/* keysym mask string appkey appcursor */
|
||||
{ XK_KP_Home, ShiftMask, "\033[2J", 0, -1},
|
||||
{ XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1},
|
||||
{ XK_KP_Home, XK_ANY_MOD, "\033[H", 0, -1},
|
||||
{ XK_KP_Home, XK_ANY_MOD, "\033[1~", 0, +1},
|
||||
{ XK_KP_Up, XK_ANY_MOD, "\033Ox", +1, 0},
|
||||
{ XK_KP_Up, XK_ANY_MOD, "\033[A", 0, -1},
|
||||
{ XK_KP_Up, XK_ANY_MOD, "\033OA", 0, +1},
|
||||
{ XK_KP_Down, XK_ANY_MOD, "\033Or", +1, 0},
|
||||
{ XK_KP_Down, XK_ANY_MOD, "\033[B", 0, -1},
|
||||
{ XK_KP_Down, XK_ANY_MOD, "\033OB", 0, +1},
|
||||
{ XK_KP_Left, XK_ANY_MOD, "\033Ot", +1, 0},
|
||||
{ XK_KP_Left, XK_ANY_MOD, "\033[D", 0, -1},
|
||||
{ XK_KP_Left, XK_ANY_MOD, "\033OD", 0, +1},
|
||||
{ XK_KP_Right, XK_ANY_MOD, "\033Ov", +1, 0},
|
||||
{ XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1},
|
||||
{ XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1},
|
||||
{ XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0},
|
||||
{ XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
|
||||
{ XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0},
|
||||
{ XK_KP_End, ControlMask, "\033[J", -1, 0},
|
||||
{ XK_KP_End, ControlMask, "\033[1;5F", +1, 0},
|
||||
{ XK_KP_End, ShiftMask, "\033[K", -1, 0},
|
||||
{ XK_KP_End, ShiftMask, "\033[1;2F", +1, 0},
|
||||
{ XK_KP_End, XK_ANY_MOD, "\033[4~", 0, 0},
|
||||
{ XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0},
|
||||
{ XK_KP_Next, XK_ANY_MOD, "\033[6~", 0, 0},
|
||||
{ XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0},
|
||||
{ XK_KP_Insert, ShiftMask, "\033[4l", -1, 0},
|
||||
{ XK_KP_Insert, ControlMask, "\033[L", -1, 0},
|
||||
{ XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0},
|
||||
{ XK_KP_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
|
||||
{ XK_KP_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
|
||||
{ XK_KP_Delete, ControlMask, "\033[M", -1, 0},
|
||||
{ XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0},
|
||||
{ XK_KP_Delete, ShiftMask, "\033[2K", -1, 0},
|
||||
{ XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0},
|
||||
{ XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0},
|
||||
{ XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
|
||||
{ XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0},
|
||||
{ XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0},
|
||||
{ XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0},
|
||||
{ XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0},
|
||||
{ XK_KP_Subtract, XK_ANY_MOD, "\033Om", +2, 0},
|
||||
{ XK_KP_Decimal, XK_ANY_MOD, "\033On", +2, 0},
|
||||
{ XK_KP_Divide, XK_ANY_MOD, "\033Oo", +2, 0},
|
||||
{ XK_KP_0, XK_ANY_MOD, "\033Op", +2, 0},
|
||||
{ XK_KP_1, XK_ANY_MOD, "\033Oq", +2, 0},
|
||||
{ XK_KP_2, XK_ANY_MOD, "\033Or", +2, 0},
|
||||
{ XK_KP_3, XK_ANY_MOD, "\033Os", +2, 0},
|
||||
{ XK_KP_4, XK_ANY_MOD, "\033Ot", +2, 0},
|
||||
{ XK_KP_5, XK_ANY_MOD, "\033Ou", +2, 0},
|
||||
{ XK_KP_6, XK_ANY_MOD, "\033Ov", +2, 0},
|
||||
{ XK_KP_7, XK_ANY_MOD, "\033Ow", +2, 0},
|
||||
{ XK_KP_8, XK_ANY_MOD, "\033Ox", +2, 0},
|
||||
{ XK_KP_9, XK_ANY_MOD, "\033Oy", +2, 0},
|
||||
{ XK_Up, ShiftMask, "\033[1;2A", 0, 0},
|
||||
{ XK_Up, Mod1Mask, "\033[1;3A", 0, 0},
|
||||
{ XK_Up, ShiftMask|Mod1Mask,"\033[1;4A", 0, 0},
|
||||
{ XK_Up, ControlMask, "\033[1;5A", 0, 0},
|
||||
{ XK_Up, ShiftMask|ControlMask,"\033[1;6A", 0, 0},
|
||||
{ XK_Up, ControlMask|Mod1Mask,"\033[1;7A", 0, 0},
|
||||
{ XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A", 0, 0},
|
||||
{ XK_Up, XK_ANY_MOD, "\033[A", 0, -1},
|
||||
{ XK_Up, XK_ANY_MOD, "\033OA", 0, +1},
|
||||
{ XK_Down, ShiftMask, "\033[1;2B", 0, 0},
|
||||
{ XK_Down, Mod1Mask, "\033[1;3B", 0, 0},
|
||||
{ XK_Down, ShiftMask|Mod1Mask,"\033[1;4B", 0, 0},
|
||||
{ XK_Down, ControlMask, "\033[1;5B", 0, 0},
|
||||
{ XK_Down, ShiftMask|ControlMask,"\033[1;6B", 0, 0},
|
||||
{ XK_Down, ControlMask|Mod1Mask,"\033[1;7B", 0, 0},
|
||||
{ XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0, 0},
|
||||
{ XK_Down, XK_ANY_MOD, "\033[B", 0, -1},
|
||||
{ XK_Down, XK_ANY_MOD, "\033OB", 0, +1},
|
||||
{ XK_Left, ShiftMask, "\033[1;2D", 0, 0},
|
||||
{ XK_Left, Mod1Mask, "\033[1;3D", 0, 0},
|
||||
{ XK_Left, ShiftMask|Mod1Mask,"\033[1;4D", 0, 0},
|
||||
{ XK_Left, ControlMask, "\033[1;5D", 0, 0},
|
||||
{ XK_Left, ShiftMask|ControlMask,"\033[1;6D", 0, 0},
|
||||
{ XK_Left, ControlMask|Mod1Mask,"\033[1;7D", 0, 0},
|
||||
{ XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0, 0},
|
||||
{ XK_Left, XK_ANY_MOD, "\033[D", 0, -1},
|
||||
{ XK_Left, XK_ANY_MOD, "\033OD", 0, +1},
|
||||
{ XK_Right, ShiftMask, "\033[1;2C", 0, 0},
|
||||
{ XK_Right, Mod1Mask, "\033[1;3C", 0, 0},
|
||||
{ XK_Right, ShiftMask|Mod1Mask,"\033[1;4C", 0, 0},
|
||||
{ XK_Right, ControlMask, "\033[1;5C", 0, 0},
|
||||
{ XK_Right, ShiftMask|ControlMask,"\033[1;6C", 0, 0},
|
||||
{ XK_Right, ControlMask|Mod1Mask,"\033[1;7C", 0, 0},
|
||||
{ XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0, 0},
|
||||
{ XK_Right, XK_ANY_MOD, "\033[C", 0, -1},
|
||||
{ XK_Right, XK_ANY_MOD, "\033OC", 0, +1},
|
||||
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
|
||||
{ XK_Return, Mod1Mask, "\033\r", 0, 0},
|
||||
{ XK_Return, XK_ANY_MOD, "\r", 0, 0},
|
||||
{ XK_Insert, ShiftMask, "\033[4l", -1, 0},
|
||||
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0},
|
||||
{ XK_Insert, ControlMask, "\033[L", -1, 0},
|
||||
{ XK_Insert, ControlMask, "\033[2;5~", +1, 0},
|
||||
{ XK_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
|
||||
{ XK_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
|
||||
{ XK_Delete, ControlMask, "\033[M", -1, 0},
|
||||
{ XK_Delete, ControlMask, "\033[3;5~", +1, 0},
|
||||
{ XK_Delete, ShiftMask, "\033[2K", -1, 0},
|
||||
{ XK_Delete, ShiftMask, "\033[3;2~", +1, 0},
|
||||
{ XK_Delete, XK_ANY_MOD, "\033[P", -1, 0},
|
||||
{ XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
|
||||
{ XK_BackSpace, XK_NO_MOD, "\177", 0, 0},
|
||||
{ XK_BackSpace, Mod1Mask, "\033\177", 0, 0},
|
||||
{ XK_Home, ShiftMask, "\033[2J", 0, -1},
|
||||
{ XK_Home, ShiftMask, "\033[1;2H", 0, +1},
|
||||
{ XK_Home, XK_ANY_MOD, "\033[H", 0, -1},
|
||||
{ XK_Home, XK_ANY_MOD, "\033[1~", 0, +1},
|
||||
{ XK_End, ControlMask, "\033[J", -1, 0},
|
||||
{ XK_End, ControlMask, "\033[1;5F", +1, 0},
|
||||
{ XK_End, ShiftMask, "\033[K", -1, 0},
|
||||
{ XK_End, ShiftMask, "\033[1;2F", +1, 0},
|
||||
{ XK_End, XK_ANY_MOD, "\033[4~", 0, 0},
|
||||
{ XK_Prior, ControlMask, "\033[5;5~", 0, 0},
|
||||
{ XK_Prior, ShiftMask, "\033[5;2~", 0, 0},
|
||||
{ XK_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
|
||||
{ XK_Next, ControlMask, "\033[6;5~", 0, 0},
|
||||
{ XK_Next, ShiftMask, "\033[6;2~", 0, 0},
|
||||
{ XK_Next, XK_ANY_MOD, "\033[6~", 0, 0},
|
||||
{ XK_F1, XK_NO_MOD, "\033OP" , 0, 0},
|
||||
{ XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0},
|
||||
{ XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0},
|
||||
{ XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0},
|
||||
{ XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0},
|
||||
{ XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0},
|
||||
{ XK_F2, XK_NO_MOD, "\033OQ" , 0, 0},
|
||||
{ XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0},
|
||||
{ XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0},
|
||||
{ XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0},
|
||||
{ XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0},
|
||||
{ XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0},
|
||||
{ XK_F3, XK_NO_MOD, "\033OR" , 0, 0},
|
||||
{ XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0},
|
||||
{ XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0},
|
||||
{ XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0},
|
||||
{ XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0},
|
||||
{ XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0},
|
||||
{ XK_F4, XK_NO_MOD, "\033OS" , 0, 0},
|
||||
{ XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0},
|
||||
{ XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0},
|
||||
{ XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0},
|
||||
{ XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0},
|
||||
{ XK_F5, XK_NO_MOD, "\033[15~", 0, 0},
|
||||
{ XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0},
|
||||
{ XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0},
|
||||
{ XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0},
|
||||
{ XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0},
|
||||
{ XK_F6, XK_NO_MOD, "\033[17~", 0, 0},
|
||||
{ XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0},
|
||||
{ XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0},
|
||||
{ XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0},
|
||||
{ XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0},
|
||||
{ XK_F7, XK_NO_MOD, "\033[18~", 0, 0},
|
||||
{ XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0},
|
||||
{ XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0},
|
||||
{ XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0},
|
||||
{ XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0},
|
||||
{ XK_F8, XK_NO_MOD, "\033[19~", 0, 0},
|
||||
{ XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0},
|
||||
{ XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0},
|
||||
{ XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0},
|
||||
{ XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0},
|
||||
{ XK_F9, XK_NO_MOD, "\033[20~", 0, 0},
|
||||
{ XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0},
|
||||
{ XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0},
|
||||
{ XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0},
|
||||
{ XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0},
|
||||
{ XK_F10, XK_NO_MOD, "\033[21~", 0, 0},
|
||||
{ XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0},
|
||||
{ XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0},
|
||||
{ XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0},
|
||||
{ XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0},
|
||||
{ XK_F11, XK_NO_MOD, "\033[23~", 0, 0},
|
||||
{ XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0},
|
||||
{ XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0},
|
||||
{ XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0},
|
||||
{ XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0},
|
||||
{ XK_F12, XK_NO_MOD, "\033[24~", 0, 0},
|
||||
{ XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0},
|
||||
{ XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0},
|
||||
{ XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0},
|
||||
{ XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0},
|
||||
{ XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0},
|
||||
{ XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0},
|
||||
{ XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0},
|
||||
{ XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0},
|
||||
{ XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0},
|
||||
{ XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0},
|
||||
{ XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0},
|
||||
{ XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0},
|
||||
{ XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0},
|
||||
{ XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0},
|
||||
{ XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0},
|
||||
{ XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0},
|
||||
{ XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0},
|
||||
{ XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0},
|
||||
{ XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0},
|
||||
{ XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0},
|
||||
{ XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0},
|
||||
{ XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0},
|
||||
{ XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0},
|
||||
{ XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0},
|
||||
{ XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0},
|
||||
{ XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0},
|
||||
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
|
||||
};
|
||||
|
||||
/*
|
||||
* Selection types' masks.
|
||||
* Use the same masks as usual.
|
||||
* Button1Mask is always unset, to make masks match between ButtonPress.
|
||||
* ButtonRelease and MotionNotify.
|
||||
* If no match is found, regular selection is used.
|
||||
*/
|
||||
static uint selmasks[] = {
|
||||
[SEL_RECTANGULAR] = Mod1Mask,
|
||||
};
|
||||
|
||||
/*
|
||||
* Printable characters in ASCII, used to estimate the advance width
|
||||
* of single wide characters.
|
||||
*/
|
||||
static char ascii_printable[] =
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?"
|
||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
||||
"`abcdefghijklmnopqrstuvwxyz{|}~";
|
|
@ -1,442 +0,0 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/*
|
||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||
*/
|
||||
#ifdef IS_PHONE
|
||||
static char *font = "Monospace:pixelsize=34:antialias=true:autohint=true";
|
||||
#else
|
||||
static char *font = "Fantasque Sans Mono:pixelsize=14:antialias=true:autohint=true";
|
||||
#endif
|
||||
|
||||
static int borderpx = 2;
|
||||
|
||||
/*
|
||||
* What program is execed by st depends of these precedence rules:
|
||||
* 1: program passed with -e
|
||||
* 2: scroll and/or utmp
|
||||
* 3: SHELL environment variable
|
||||
* 4: value of shell in /etc/passwd
|
||||
* 5: value of shell in config.h
|
||||
*/
|
||||
static char *shell = "/bin/sh";
|
||||
char *utmp = NULL;
|
||||
/* scroll program: to enable use a string like "scroll" */
|
||||
char *scroll = NULL;
|
||||
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
|
||||
|
||||
/* identification sequence returned in DA and DECID */
|
||||
char *vtiden = "\033[?6c";
|
||||
|
||||
/* Kerning / character bounding-box multipliers */
|
||||
static float cwscale = 1.0;
|
||||
static float chscale = 1.0;
|
||||
|
||||
/*
|
||||
* word delimiter string
|
||||
*
|
||||
* More advanced example: L" `'\"()[]{}"
|
||||
*/
|
||||
wchar_t *worddelimiters = L" ";
|
||||
|
||||
/* selection timeouts (in milliseconds) */
|
||||
static unsigned int doubleclicktimeout = 300;
|
||||
static unsigned int tripleclicktimeout = 600;
|
||||
|
||||
/* alt screens */
|
||||
int allowaltscreen = 1;
|
||||
|
||||
/* allow certain non-interactive (insecure) window operations such as:
|
||||
setting the clipboard text */
|
||||
int allowwindowops = 0;
|
||||
|
||||
/*
|
||||
* draw latency range in ms - from new content/keypress/etc until drawing.
|
||||
* within this range, st draws when content stops arriving (idle). mostly it's
|
||||
* near minlatency, but it waits longer for slow updates to avoid partial draw.
|
||||
* low minlatency will tear/flicker more, as it can "detect" idle too early.
|
||||
*/
|
||||
static double minlatency = 8;
|
||||
static double maxlatency = 33;
|
||||
|
||||
/*
|
||||
* blinking timeout (set to 0 to disable blinking) for the terminal blinking
|
||||
* attribute.
|
||||
*/
|
||||
static unsigned int blinktimeout = 800;
|
||||
|
||||
/*
|
||||
* thickness of underline and bar cursors
|
||||
*/
|
||||
static unsigned int cursorthickness = 2;
|
||||
|
||||
/*
|
||||
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
|
||||
* it
|
||||
*/
|
||||
static int bellvolume = 0;
|
||||
|
||||
/* default TERM value */
|
||||
char *termname = "st-256color";
|
||||
|
||||
/*
|
||||
* spaces per tab
|
||||
*
|
||||
* When you are changing this value, don't forget to adapt the »it« value in
|
||||
* the st.info and appropriately install the st.info in the environment where
|
||||
* you use this st version.
|
||||
*
|
||||
* it#$tabspaces,
|
||||
*
|
||||
* Secondly make sure your kernel is not expanding tabs. When running `stty
|
||||
* -a` »tab0« should appear. You can tell the terminal to not expand tabs by
|
||||
* running following command:
|
||||
*
|
||||
* stty tabs
|
||||
*/
|
||||
unsigned int tabspaces = 8;
|
||||
|
||||
#include "colors.h"
|
||||
|
||||
/*
|
||||
* Default colors (colorname index)
|
||||
* foreground, background, cursor, reverse cursor
|
||||
*/
|
||||
unsigned int defaultfg = 7;
|
||||
unsigned int defaultbg = 0;
|
||||
unsigned int defaultcs = 256;
|
||||
static unsigned int defaultrcs = 257;
|
||||
|
||||
/*
|
||||
* Default shape of cursor
|
||||
* 2: Block ("█")
|
||||
* 4: Underline ("_")
|
||||
* 6: Bar ("|")
|
||||
* 7: Snowman ("☃")
|
||||
*/
|
||||
static unsigned int cursorshape = 2;
|
||||
|
||||
/*
|
||||
* Default columns and rows numbers
|
||||
*/
|
||||
|
||||
static unsigned int cols = 80;
|
||||
static unsigned int rows = 24;
|
||||
|
||||
/*
|
||||
* Default colour and shape of the mouse cursor
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
static unsigned int defaultattr = 11;
|
||||
|
||||
/*
|
||||
* Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set).
|
||||
* Note that if you want to use ShiftMask with selmasks, set this to an other
|
||||
* modifier, set to 0 to not use it.
|
||||
*/
|
||||
static uint forcemousemod = ShiftMask;
|
||||
|
||||
/*
|
||||
* Internal mouse shortcuts.
|
||||
* Beware that overloading Button1 will disable the selection.
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
/* mask button function argument release */
|
||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||
};
|
||||
|
||||
/* Internal keyboard shortcuts. */
|
||||
#define MODKEY Mod1Mask
|
||||
#define TERMMOD (ControlMask|ShiftMask)
|
||||
|
||||
static Shortcut shortcuts[] = {
|
||||
/* mask keysym function argument */
|
||||
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
|
||||
{ MODKEY, XK_h, zoom, {.f = -1} },
|
||||
{ MODKEY, XK_l, zoom, {.f = +1} },
|
||||
{ MODKEY, XK_c, clipcopy, {.i = 0} },
|
||||
{ MODKEY, XK_v, clippaste, {.i = 0} },
|
||||
{ MODKEY, XK_k, kscrollup, {.i = -1} },
|
||||
{ MODKEY, XK_j, kscrolldown, {.i = -1} },
|
||||
};
|
||||
|
||||
/*
|
||||
* Special keys (change & recompile st.info accordingly)
|
||||
*
|
||||
* Mask value:
|
||||
* * Use XK_ANY_MOD to match the key no matter modifiers state
|
||||
* * Use XK_NO_MOD to match the key alone (no modifiers)
|
||||
* appkey value:
|
||||
* * 0: no value
|
||||
* * > 0: keypad application mode enabled
|
||||
* * = 2: term.numlock = 1
|
||||
* * < 0: keypad application mode disabled
|
||||
* appcursor value:
|
||||
* * 0: no value
|
||||
* * > 0: cursor application mode enabled
|
||||
* * < 0: cursor application mode disabled
|
||||
*
|
||||
* Be careful with the order of the definitions because st searches in
|
||||
* this table sequentially, so any XK_ANY_MOD must be in the last
|
||||
* position for a key.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
|
||||
* to be mapped below, add them to this array.
|
||||
*/
|
||||
static KeySym mappedkeys[] = { -1 };
|
||||
|
||||
/*
|
||||
* State bits to ignore when matching key or button events. By default,
|
||||
* numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored.
|
||||
*/
|
||||
static uint ignoremod = Mod2Mask|XK_SWITCH_MOD;
|
||||
|
||||
/*
|
||||
* This is the huge key array which defines all compatibility to the Linux
|
||||
* world. Please decide about changes wisely.
|
||||
*/
|
||||
static Key key[] = {
|
||||
/* keysym mask string appkey appcursor */
|
||||
{ XK_KP_Home, ShiftMask, "\033[2J", 0, -1},
|
||||
{ XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1},
|
||||
{ XK_KP_Home, XK_ANY_MOD, "\033[H", 0, -1},
|
||||
{ XK_KP_Home, XK_ANY_MOD, "\033[1~", 0, +1},
|
||||
{ XK_KP_Up, XK_ANY_MOD, "\033Ox", +1, 0},
|
||||
{ XK_KP_Up, XK_ANY_MOD, "\033[A", 0, -1},
|
||||
{ XK_KP_Up, XK_ANY_MOD, "\033OA", 0, +1},
|
||||
{ XK_KP_Down, XK_ANY_MOD, "\033Or", +1, 0},
|
||||
{ XK_KP_Down, XK_ANY_MOD, "\033[B", 0, -1},
|
||||
{ XK_KP_Down, XK_ANY_MOD, "\033OB", 0, +1},
|
||||
{ XK_KP_Left, XK_ANY_MOD, "\033Ot", +1, 0},
|
||||
{ XK_KP_Left, XK_ANY_MOD, "\033[D", 0, -1},
|
||||
{ XK_KP_Left, XK_ANY_MOD, "\033OD", 0, +1},
|
||||
{ XK_KP_Right, XK_ANY_MOD, "\033Ov", +1, 0},
|
||||
{ XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1},
|
||||
{ XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1},
|
||||
{ XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0},
|
||||
{ XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
|
||||
{ XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0},
|
||||
{ XK_KP_End, ControlMask, "\033[J", -1, 0},
|
||||
{ XK_KP_End, ControlMask, "\033[1;5F", +1, 0},
|
||||
{ XK_KP_End, ShiftMask, "\033[K", -1, 0},
|
||||
{ XK_KP_End, ShiftMask, "\033[1;2F", +1, 0},
|
||||
{ XK_KP_End, XK_ANY_MOD, "\033[4~", 0, 0},
|
||||
{ XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0},
|
||||
{ XK_KP_Next, XK_ANY_MOD, "\033[6~", 0, 0},
|
||||
{ XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0},
|
||||
{ XK_KP_Insert, ShiftMask, "\033[4l", -1, 0},
|
||||
{ XK_KP_Insert, ControlMask, "\033[L", -1, 0},
|
||||
{ XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0},
|
||||
{ XK_KP_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
|
||||
{ XK_KP_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
|
||||
{ XK_KP_Delete, ControlMask, "\033[M", -1, 0},
|
||||
{ XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0},
|
||||
{ XK_KP_Delete, ShiftMask, "\033[2K", -1, 0},
|
||||
{ XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0},
|
||||
{ XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0},
|
||||
{ XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
|
||||
{ XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0},
|
||||
{ XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0},
|
||||
{ XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0},
|
||||
{ XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0},
|
||||
{ XK_KP_Subtract, XK_ANY_MOD, "\033Om", +2, 0},
|
||||
{ XK_KP_Decimal, XK_ANY_MOD, "\033On", +2, 0},
|
||||
{ XK_KP_Divide, XK_ANY_MOD, "\033Oo", +2, 0},
|
||||
{ XK_KP_0, XK_ANY_MOD, "\033Op", +2, 0},
|
||||
{ XK_KP_1, XK_ANY_MOD, "\033Oq", +2, 0},
|
||||
{ XK_KP_2, XK_ANY_MOD, "\033Or", +2, 0},
|
||||
{ XK_KP_3, XK_ANY_MOD, "\033Os", +2, 0},
|
||||
{ XK_KP_4, XK_ANY_MOD, "\033Ot", +2, 0},
|
||||
{ XK_KP_5, XK_ANY_MOD, "\033Ou", +2, 0},
|
||||
{ XK_KP_6, XK_ANY_MOD, "\033Ov", +2, 0},
|
||||
{ XK_KP_7, XK_ANY_MOD, "\033Ow", +2, 0},
|
||||
{ XK_KP_8, XK_ANY_MOD, "\033Ox", +2, 0},
|
||||
{ XK_KP_9, XK_ANY_MOD, "\033Oy", +2, 0},
|
||||
{ XK_Up, ShiftMask, "\033[1;2A", 0, 0},
|
||||
{ XK_Up, Mod1Mask, "\033[1;3A", 0, 0},
|
||||
{ XK_Up, ShiftMask|Mod1Mask,"\033[1;4A", 0, 0},
|
||||
{ XK_Up, ControlMask, "\033[1;5A", 0, 0},
|
||||
{ XK_Up, ShiftMask|ControlMask,"\033[1;6A", 0, 0},
|
||||
{ XK_Up, ControlMask|Mod1Mask,"\033[1;7A", 0, 0},
|
||||
{ XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A", 0, 0},
|
||||
{ XK_Up, XK_ANY_MOD, "\033[A", 0, -1},
|
||||
{ XK_Up, XK_ANY_MOD, "\033OA", 0, +1},
|
||||
{ XK_Down, ShiftMask, "\033[1;2B", 0, 0},
|
||||
{ XK_Down, Mod1Mask, "\033[1;3B", 0, 0},
|
||||
{ XK_Down, ShiftMask|Mod1Mask,"\033[1;4B", 0, 0},
|
||||
{ XK_Down, ControlMask, "\033[1;5B", 0, 0},
|
||||
{ XK_Down, ShiftMask|ControlMask,"\033[1;6B", 0, 0},
|
||||
{ XK_Down, ControlMask|Mod1Mask,"\033[1;7B", 0, 0},
|
||||
{ XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0, 0},
|
||||
{ XK_Down, XK_ANY_MOD, "\033[B", 0, -1},
|
||||
{ XK_Down, XK_ANY_MOD, "\033OB", 0, +1},
|
||||
{ XK_Left, ShiftMask, "\033[1;2D", 0, 0},
|
||||
{ XK_Left, Mod1Mask, "\033[1;3D", 0, 0},
|
||||
{ XK_Left, ShiftMask|Mod1Mask,"\033[1;4D", 0, 0},
|
||||
{ XK_Left, ControlMask, "\033[1;5D", 0, 0},
|
||||
{ XK_Left, ShiftMask|ControlMask,"\033[1;6D", 0, 0},
|
||||
{ XK_Left, ControlMask|Mod1Mask,"\033[1;7D", 0, 0},
|
||||
{ XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0, 0},
|
||||
{ XK_Left, XK_ANY_MOD, "\033[D", 0, -1},
|
||||
{ XK_Left, XK_ANY_MOD, "\033OD", 0, +1},
|
||||
{ XK_Right, ShiftMask, "\033[1;2C", 0, 0},
|
||||
{ XK_Right, Mod1Mask, "\033[1;3C", 0, 0},
|
||||
{ XK_Right, ShiftMask|Mod1Mask,"\033[1;4C", 0, 0},
|
||||
{ XK_Right, ControlMask, "\033[1;5C", 0, 0},
|
||||
{ XK_Right, ShiftMask|ControlMask,"\033[1;6C", 0, 0},
|
||||
{ XK_Right, ControlMask|Mod1Mask,"\033[1;7C", 0, 0},
|
||||
{ XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0, 0},
|
||||
{ XK_Right, XK_ANY_MOD, "\033[C", 0, -1},
|
||||
{ XK_Right, XK_ANY_MOD, "\033OC", 0, +1},
|
||||
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
|
||||
{ XK_Return, Mod1Mask, "\033\r", 0, 0},
|
||||
{ XK_Return, XK_ANY_MOD, "\r", 0, 0},
|
||||
{ XK_Insert, ShiftMask, "\033[4l", -1, 0},
|
||||
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0},
|
||||
{ XK_Insert, ControlMask, "\033[L", -1, 0},
|
||||
{ XK_Insert, ControlMask, "\033[2;5~", +1, 0},
|
||||
{ XK_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
|
||||
{ XK_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
|
||||
{ XK_Delete, ControlMask, "\033[M", -1, 0},
|
||||
{ XK_Delete, ControlMask, "\033[3;5~", +1, 0},
|
||||
{ XK_Delete, ShiftMask, "\033[2K", -1, 0},
|
||||
{ XK_Delete, ShiftMask, "\033[3;2~", +1, 0},
|
||||
{ XK_Delete, XK_ANY_MOD, "\033[P", -1, 0},
|
||||
{ XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
|
||||
{ XK_BackSpace, XK_NO_MOD, "\177", 0, 0},
|
||||
{ XK_BackSpace, Mod1Mask, "\033\177", 0, 0},
|
||||
{ XK_Home, ShiftMask, "\033[2J", 0, -1},
|
||||
{ XK_Home, ShiftMask, "\033[1;2H", 0, +1},
|
||||
{ XK_Home, XK_ANY_MOD, "\033[H", 0, -1},
|
||||
{ XK_Home, XK_ANY_MOD, "\033[1~", 0, +1},
|
||||
{ XK_End, ControlMask, "\033[J", -1, 0},
|
||||
{ XK_End, ControlMask, "\033[1;5F", +1, 0},
|
||||
{ XK_End, ShiftMask, "\033[K", -1, 0},
|
||||
{ XK_End, ShiftMask, "\033[1;2F", +1, 0},
|
||||
{ XK_End, XK_ANY_MOD, "\033[4~", 0, 0},
|
||||
{ XK_Prior, ControlMask, "\033[5;5~", 0, 0},
|
||||
{ XK_Prior, ShiftMask, "\033[5;2~", 0, 0},
|
||||
{ XK_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
|
||||
{ XK_Next, ControlMask, "\033[6;5~", 0, 0},
|
||||
{ XK_Next, ShiftMask, "\033[6;2~", 0, 0},
|
||||
{ XK_Next, XK_ANY_MOD, "\033[6~", 0, 0},
|
||||
{ XK_F1, XK_NO_MOD, "\033OP" , 0, 0},
|
||||
{ XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0},
|
||||
{ XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0},
|
||||
{ XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0},
|
||||
{ XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0},
|
||||
{ XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0},
|
||||
{ XK_F2, XK_NO_MOD, "\033OQ" , 0, 0},
|
||||
{ XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0},
|
||||
{ XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0},
|
||||
{ XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0},
|
||||
{ XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0},
|
||||
{ XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0},
|
||||
{ XK_F3, XK_NO_MOD, "\033OR" , 0, 0},
|
||||
{ XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0},
|
||||
{ XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0},
|
||||
{ XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0},
|
||||
{ XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0},
|
||||
{ XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0},
|
||||
{ XK_F4, XK_NO_MOD, "\033OS" , 0, 0},
|
||||
{ XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0},
|
||||
{ XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0},
|
||||
{ XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0},
|
||||
{ XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0},
|
||||
{ XK_F5, XK_NO_MOD, "\033[15~", 0, 0},
|
||||
{ XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0},
|
||||
{ XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0},
|
||||
{ XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0},
|
||||
{ XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0},
|
||||
{ XK_F6, XK_NO_MOD, "\033[17~", 0, 0},
|
||||
{ XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0},
|
||||
{ XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0},
|
||||
{ XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0},
|
||||
{ XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0},
|
||||
{ XK_F7, XK_NO_MOD, "\033[18~", 0, 0},
|
||||
{ XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0},
|
||||
{ XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0},
|
||||
{ XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0},
|
||||
{ XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0},
|
||||
{ XK_F8, XK_NO_MOD, "\033[19~", 0, 0},
|
||||
{ XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0},
|
||||
{ XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0},
|
||||
{ XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0},
|
||||
{ XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0},
|
||||
{ XK_F9, XK_NO_MOD, "\033[20~", 0, 0},
|
||||
{ XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0},
|
||||
{ XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0},
|
||||
{ XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0},
|
||||
{ XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0},
|
||||
{ XK_F10, XK_NO_MOD, "\033[21~", 0, 0},
|
||||
{ XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0},
|
||||
{ XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0},
|
||||
{ XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0},
|
||||
{ XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0},
|
||||
{ XK_F11, XK_NO_MOD, "\033[23~", 0, 0},
|
||||
{ XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0},
|
||||
{ XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0},
|
||||
{ XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0},
|
||||
{ XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0},
|
||||
{ XK_F12, XK_NO_MOD, "\033[24~", 0, 0},
|
||||
{ XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0},
|
||||
{ XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0},
|
||||
{ XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0},
|
||||
{ XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0},
|
||||
{ XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0},
|
||||
{ XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0},
|
||||
{ XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0},
|
||||
{ XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0},
|
||||
{ XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0},
|
||||
{ XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0},
|
||||
{ XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0},
|
||||
{ XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0},
|
||||
{ XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0},
|
||||
{ XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0},
|
||||
{ XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0},
|
||||
{ XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0},
|
||||
{ XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0},
|
||||
{ XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0},
|
||||
{ XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0},
|
||||
{ XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0},
|
||||
{ XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0},
|
||||
{ XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0},
|
||||
{ XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0},
|
||||
{ XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0},
|
||||
{ XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0},
|
||||
{ XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0},
|
||||
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
|
||||
};
|
||||
|
||||
/*
|
||||
* Selection types' masks.
|
||||
* Use the same masks as usual.
|
||||
* Button1Mask is always unset, to make masks match between ButtonPress.
|
||||
* ButtonRelease and MotionNotify.
|
||||
* If no match is found, regular selection is used.
|
||||
*/
|
||||
static uint selmasks[] = {
|
||||
[SEL_RECTANGULAR] = Mod1Mask,
|
||||
};
|
||||
|
||||
/*
|
||||
* Printable characters in ASCII, used to estimate the advance width
|
||||
* of single wide characters.
|
||||
*/
|
||||
static char ascii_printable[] =
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?"
|
||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
||||
"`abcdefghijklmnopqrstuvwxyz{|}~";
|
|
@ -1,36 +0,0 @@
|
|||
# st version
|
||||
VERSION = 0.8.5
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
# paths
|
||||
PREFIX = $(HOME)/.local
|
||||
MANPREFIX = $(PREFIX)/share/man
|
||||
|
||||
X11INC = /usr/X11R6/include
|
||||
X11LIB = /usr/X11R6/lib
|
||||
|
||||
PKG_CONFIG = pkg-config
|
||||
|
||||
# includes and libs
|
||||
INCS = -I$(X11INC) \
|
||||
`$(PKG_CONFIG) --cflags fontconfig` \
|
||||
`$(PKG_CONFIG) --cflags freetype2`
|
||||
LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
|
||||
`$(PKG_CONFIG) --libs fontconfig` \
|
||||
`$(PKG_CONFIG) --libs freetype2`
|
||||
|
||||
# flags
|
||||
STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
|
||||
STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS)
|
||||
STLDFLAGS = $(LIBS) $(LDFLAGS)
|
||||
|
||||
# OpenBSD:
|
||||
#CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
|
||||
#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
|
||||
# `$(PKG_CONFIG) --libs fontconfig` \
|
||||
# `$(PKG_CONFIG) --libs freetype2`
|
||||
#MANPREFIX = ${PREFIX}/man
|
||||
|
||||
# compiler and linker
|
||||
# CC = c99
|
|
@ -1,20 +0,0 @@
|
|||
/* Terminal colors (16 first used in escape sequence) */
|
||||
static const char *colorname[] = {
|
||||
/* 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 */
|
||||
};
|
180
builds/st/st.1
180
builds/st/st.1
|
@ -1,180 +0,0 @@
|
|||
.TH ST 1 st\-VERSION
|
||||
.SH NAME
|
||||
st \- simple terminal
|
||||
.SH SYNOPSIS
|
||||
.B st
|
||||
.RB [ \-aivp ]
|
||||
.RB [ \-c
|
||||
.IR class ]
|
||||
.RB [ \-f
|
||||
.IR font ]
|
||||
.RB [ \-g
|
||||
.IR geometry ]
|
||||
.RB [ \-n
|
||||
.IR name ]
|
||||
.RB [ \-o
|
||||
.IR iofile ]
|
||||
.RB [ \-T
|
||||
.IR title ]
|
||||
.RB [ \-t
|
||||
.IR title ]
|
||||
.RB [ \-l
|
||||
.IR line ]
|
||||
.RB [ \-w
|
||||
.IR windowid ]
|
||||
.RB [[ \-e ]
|
||||
.IR command
|
||||
.RI [ arguments ...]]
|
||||
.PP
|
||||
.B st
|
||||
.RB [ \-aivp ]
|
||||
.RB [ \-c
|
||||
.IR class ]
|
||||
.RB [ \-f
|
||||
.IR font ]
|
||||
.RB [ \-g
|
||||
.IR geometry ]
|
||||
.RB [ \-n
|
||||
.IR name ]
|
||||
.RB [ \-o
|
||||
.IR iofile ]
|
||||
.RB [ \-T
|
||||
.IR title ]
|
||||
.RB [ \-t
|
||||
.IR title ]
|
||||
.RB [ \-w
|
||||
.IR windowid ]
|
||||
.RB \-l
|
||||
.IR line
|
||||
.RI [ stty_args ...]
|
||||
.SH DESCRIPTION
|
||||
.B st
|
||||
is a simple terminal emulator.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-a
|
||||
disable alternate screens in terminal
|
||||
.TP
|
||||
.BI \-c " class"
|
||||
defines the window class (default $TERM).
|
||||
.TP
|
||||
.BI \-f " font"
|
||||
defines the
|
||||
.I font
|
||||
to use when st is run.
|
||||
.TP
|
||||
.BI \-g " geometry"
|
||||
defines the X11 geometry string.
|
||||
The form is [=][<cols>{xX}<rows>][{+-}<xoffset>{+-}<yoffset>]. See
|
||||
.BR XParseGeometry (3)
|
||||
for further details.
|
||||
.TP
|
||||
.B \-i
|
||||
will fixate the position given with the -g option.
|
||||
.TP
|
||||
.BI \-n " name"
|
||||
defines the window instance name (default $TERM).
|
||||
.TP
|
||||
.BI \-o " iofile"
|
||||
writes all the I/O to
|
||||
.I iofile.
|
||||
This feature is useful when recording st sessions. A value of "-" means
|
||||
standard output.
|
||||
.TP
|
||||
.BI \-p
|
||||
enters pixel-perfect mode, where -g requests specific pixels instead of characters
|
||||
.TP
|
||||
.BI \-T " title"
|
||||
defines the window title (default 'st').
|
||||
.TP
|
||||
.BI \-t " title"
|
||||
defines the window title (default 'st').
|
||||
.TP
|
||||
.BI \-w " windowid"
|
||||
embeds st within the window identified by
|
||||
.I windowid
|
||||
.TP
|
||||
.BI \-l " line"
|
||||
use a tty
|
||||
.I line
|
||||
instead of a pseudo terminal.
|
||||
.I line
|
||||
should be a (pseudo-)serial device (e.g. /dev/ttyS0 on Linux for serial port
|
||||
0).
|
||||
When this flag is given
|
||||
remaining arguments are used as flags for
|
||||
.BR stty(1).
|
||||
By default st initializes the serial line to 8 bits, no parity, 1 stop bit
|
||||
and a 38400 baud rate. The speed is set by appending it as last argument
|
||||
(e.g. 'st -l /dev/ttyS0 115200'). Arguments before the last one are
|
||||
.BR stty(1)
|
||||
flags. If you want to set odd parity on 115200 baud use for example 'st -l
|
||||
/dev/ttyS0 parenb parodd 115200'. Set the number of bits by using for
|
||||
example 'st -l /dev/ttyS0 cs7 115200'. See
|
||||
.BR stty(1)
|
||||
for more arguments and cases.
|
||||
.TP
|
||||
.B \-v
|
||||
prints version information to stderr, then exits.
|
||||
.TP
|
||||
.BI \-e " command " [ " arguments " "... ]"
|
||||
st executes
|
||||
.I command
|
||||
instead of the shell. If this is used it
|
||||
.B must be the last option
|
||||
on the command line, as in xterm / rxvt.
|
||||
This option is only intended for compatibility,
|
||||
and all the remaining arguments are used as a command
|
||||
even without it.
|
||||
.SH SHORTCUTS
|
||||
.TP
|
||||
.B Break
|
||||
Send a break in the serial line.
|
||||
Break key is obtained in PC keyboards
|
||||
pressing at the same time control and pause.
|
||||
.TP
|
||||
.B Ctrl-Print Screen
|
||||
Toggle if st should print to the
|
||||
.I iofile.
|
||||
.TP
|
||||
.B Shift-Print Screen
|
||||
Print the full screen to the
|
||||
.I iofile.
|
||||
.TP
|
||||
.B Print Screen
|
||||
Print the selection to the
|
||||
.I iofile.
|
||||
.TP
|
||||
.B Ctrl-Shift-Page Up
|
||||
Increase font size.
|
||||
.TP
|
||||
.B Ctrl-Shift-Page Down
|
||||
Decrease font size.
|
||||
.TP
|
||||
.B Ctrl-Shift-Home
|
||||
Reset to default font size.
|
||||
.TP
|
||||
.B Ctrl-Shift-y
|
||||
Paste from primary selection (middle mouse button).
|
||||
.TP
|
||||
.B Ctrl-Shift-c
|
||||
Copy the selected text to the clipboard selection.
|
||||
.TP
|
||||
.B Ctrl-Shift-v
|
||||
Paste from the clipboard selection.
|
||||
.SH CUSTOMIZATION
|
||||
.B st
|
||||
can be customized by creating a custom config.h and (re)compiling the source
|
||||
code. This keeps it fast, secure and simple.
|
||||
.SH AUTHORS
|
||||
See the LICENSE file for the authors.
|
||||
.SH LICENSE
|
||||
See the LICENSE file for the terms of redistribution.
|
||||
.SH SEE ALSO
|
||||
.BR tabbed (1),
|
||||
.BR utmp (1),
|
||||
.BR stty (1),
|
||||
.BR scroll (1)
|
||||
.SH BUGS
|
||||
See the TODO file in the distribution.
|
||||
|
2825
builds/st/st.c
2825
builds/st/st.c
File diff suppressed because it is too large
Load Diff
130
builds/st/st.h
130
builds/st/st.h
|
@ -1,130 +0,0 @@
|
|||
/* See LICENSE for license details. */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* macros */
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a, b) ((a) < (b) ? (b) : (a))
|
||||
#define LEN(a) (sizeof(a) / sizeof(a)[0])
|
||||
#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
|
||||
#define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d))
|
||||
#define DEFAULT(a, b) (a) = (a) ? (a) : (b)
|
||||
#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
|
||||
#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \
|
||||
(a).bg != (b).bg)
|
||||
#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \
|
||||
(t1.tv_nsec-t2.tv_nsec)/1E6)
|
||||
#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
|
||||
|
||||
#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
|
||||
#define IS_TRUECOL(x) (1 << 24 & (x))
|
||||
|
||||
enum glyph_attribute {
|
||||
ATTR_NULL = 0,
|
||||
ATTR_BOLD = 1 << 0,
|
||||
ATTR_FAINT = 1 << 1,
|
||||
ATTR_ITALIC = 1 << 2,
|
||||
ATTR_UNDERLINE = 1 << 3,
|
||||
ATTR_BLINK = 1 << 4,
|
||||
ATTR_REVERSE = 1 << 5,
|
||||
ATTR_INVISIBLE = 1 << 6,
|
||||
ATTR_STRUCK = 1 << 7,
|
||||
ATTR_WRAP = 1 << 8,
|
||||
ATTR_WIDE = 1 << 9,
|
||||
ATTR_WDUMMY = 1 << 10,
|
||||
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
|
||||
};
|
||||
|
||||
enum selection_mode {
|
||||
SEL_IDLE = 0,
|
||||
SEL_EMPTY = 1,
|
||||
SEL_READY = 2
|
||||
};
|
||||
|
||||
enum selection_type {
|
||||
SEL_REGULAR = 1,
|
||||
SEL_RECTANGULAR = 2
|
||||
};
|
||||
|
||||
enum selection_snap {
|
||||
SNAP_WORD = 1,
|
||||
SNAP_LINE = 2
|
||||
};
|
||||
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned short ushort;
|
||||
|
||||
typedef uint_least32_t Rune;
|
||||
|
||||
#define Glyph Glyph_
|
||||
typedef struct {
|
||||
Rune u; /* character code */
|
||||
ushort mode; /* attribute flags */
|
||||
uint32_t fg; /* foreground */
|
||||
uint32_t bg; /* background */
|
||||
} Glyph;
|
||||
|
||||
typedef Glyph *Line;
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
uint ui;
|
||||
float f;
|
||||
const void *v;
|
||||
const char *s;
|
||||
} Arg;
|
||||
|
||||
void die(const char *, ...);
|
||||
void die_error(int err, const char *, ...);
|
||||
void redraw(void);
|
||||
void draw(void);
|
||||
|
||||
void externalpipe(const Arg *);
|
||||
void kscrolldown(const Arg *);
|
||||
void kscrollup(const Arg *);
|
||||
void printscreen(const Arg *);
|
||||
void printsel(const Arg *);
|
||||
void sendbreak(const Arg *);
|
||||
void toggleprinter(const Arg *);
|
||||
|
||||
int tattrset(int);
|
||||
void tnew(int, int);
|
||||
void tresize(int, int);
|
||||
void tsetdirtattr(int);
|
||||
void ttyhangup(void);
|
||||
int ttynew(const char *, char *, const char *, char **);
|
||||
size_t ttyread(void);
|
||||
void ttyresize(int, int);
|
||||
void ttywrite(const char *, size_t, int);
|
||||
|
||||
void resettitle(void);
|
||||
|
||||
void selclear(void);
|
||||
void selinit(void);
|
||||
void selstart(int, int, int);
|
||||
void selextend(int, int, int, int);
|
||||
int selected(int, int);
|
||||
char *getsel(void);
|
||||
|
||||
size_t utf8encode(Rune, char *);
|
||||
|
||||
void *xmalloc(size_t);
|
||||
void *xrealloc(void *, size_t);
|
||||
char *xstrdup(const char *);
|
||||
|
||||
/* config.h globals */
|
||||
extern char *utmp;
|
||||
extern char *scroll;
|
||||
extern char *stty_args;
|
||||
extern char *vtiden;
|
||||
extern wchar_t *worddelimiters;
|
||||
extern int allowaltscreen;
|
||||
extern int allowwindowops;
|
||||
extern char *termname;
|
||||
extern unsigned int tabspaces;
|
||||
extern unsigned int defaultfg;
|
||||
extern unsigned int defaultbg;
|
||||
extern unsigned int defaultcs;
|
|
@ -1,239 +0,0 @@
|
|||
st-mono| simpleterm monocolor,
|
||||
acsc=+C\,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
|
||||
am,
|
||||
bce,
|
||||
bel=^G,
|
||||
blink=\E[5m,
|
||||
bold=\E[1m,
|
||||
cbt=\E[Z,
|
||||
cvvis=\E[?25h,
|
||||
civis=\E[?25l,
|
||||
clear=\E[H\E[2J,
|
||||
cnorm=\E[?12l\E[?25h,
|
||||
colors#2,
|
||||
cols#80,
|
||||
cr=^M,
|
||||
csr=\E[%i%p1%d;%p2%dr,
|
||||
cub=\E[%p1%dD,
|
||||
cub1=^H,
|
||||
cud1=^J,
|
||||
cud=\E[%p1%dB,
|
||||
cuf1=\E[C,
|
||||
cuf=\E[%p1%dC,
|
||||
cup=\E[%i%p1%d;%p2%dH,
|
||||
cuu1=\E[A,
|
||||
cuu=\E[%p1%dA,
|
||||
dch=\E[%p1%dP,
|
||||
dch1=\E[P,
|
||||
dim=\E[2m,
|
||||
dl=\E[%p1%dM,
|
||||
dl1=\E[M,
|
||||
ech=\E[%p1%dX,
|
||||
ed=\E[J,
|
||||
el=\E[K,
|
||||
el1=\E[1K,
|
||||
enacs=\E)0,
|
||||
flash=\E[?5h$<80/>\E[?5l,
|
||||
fsl=^G,
|
||||
home=\E[H,
|
||||
hpa=\E[%i%p1%dG,
|
||||
hs,
|
||||
ht=^I,
|
||||
hts=\EH,
|
||||
ich=\E[%p1%d@,
|
||||
il1=\E[L,
|
||||
il=\E[%p1%dL,
|
||||
ind=^J,
|
||||
indn=\E[%p1%dS,
|
||||
invis=\E[8m,
|
||||
is2=\E[4l\E>\E[?1034l,
|
||||
it#8,
|
||||
kel=\E[1;2F,
|
||||
ked=\E[1;5F,
|
||||
ka1=\E[1~,
|
||||
ka3=\E[5~,
|
||||
kc1=\E[4~,
|
||||
kc3=\E[6~,
|
||||
kbs=\177,
|
||||
kcbt=\E[Z,
|
||||
kb2=\EOu,
|
||||
kcub1=\EOD,
|
||||
kcud1=\EOB,
|
||||
kcuf1=\EOC,
|
||||
kcuu1=\EOA,
|
||||
kDC=\E[3;2~,
|
||||
kent=\EOM,
|
||||
kEND=\E[1;2F,
|
||||
kIC=\E[2;2~,
|
||||
kNXT=\E[6;2~,
|
||||
kPRV=\E[5;2~,
|
||||
kHOM=\E[1;2H,
|
||||
kLFT=\E[1;2D,
|
||||
kRIT=\E[1;2C,
|
||||
kind=\E[1;2B,
|
||||
kri=\E[1;2A,
|
||||
kclr=\E[3;5~,
|
||||
kdl1=\E[3;2~,
|
||||
kdch1=\E[3~,
|
||||
kich1=\E[2~,
|
||||
kend=\E[4~,
|
||||
kf1=\EOP,
|
||||
kf2=\EOQ,
|
||||
kf3=\EOR,
|
||||
kf4=\EOS,
|
||||
kf5=\E[15~,
|
||||
kf6=\E[17~,
|
||||
kf7=\E[18~,
|
||||
kf8=\E[19~,
|
||||
kf9=\E[20~,
|
||||
kf10=\E[21~,
|
||||
kf11=\E[23~,
|
||||
kf12=\E[24~,
|
||||
kf13=\E[1;2P,
|
||||
kf14=\E[1;2Q,
|
||||
kf15=\E[1;2R,
|
||||
kf16=\E[1;2S,
|
||||
kf17=\E[15;2~,
|
||||
kf18=\E[17;2~,
|
||||
kf19=\E[18;2~,
|
||||
kf20=\E[19;2~,
|
||||
kf21=\E[20;2~,
|
||||
kf22=\E[21;2~,
|
||||
kf23=\E[23;2~,
|
||||
kf24=\E[24;2~,
|
||||
kf25=\E[1;5P,
|
||||
kf26=\E[1;5Q,
|
||||
kf27=\E[1;5R,
|
||||
kf28=\E[1;5S,
|
||||
kf29=\E[15;5~,
|
||||
kf30=\E[17;5~,
|
||||
kf31=\E[18;5~,
|
||||
kf32=\E[19;5~,
|
||||
kf33=\E[20;5~,
|
||||
kf34=\E[21;5~,
|
||||
kf35=\E[23;5~,
|
||||
kf36=\E[24;5~,
|
||||
kf37=\E[1;6P,
|
||||
kf38=\E[1;6Q,
|
||||
kf39=\E[1;6R,
|
||||
kf40=\E[1;6S,
|
||||
kf41=\E[15;6~,
|
||||
kf42=\E[17;6~,
|
||||
kf43=\E[18;6~,
|
||||
kf44=\E[19;6~,
|
||||
kf45=\E[20;6~,
|
||||
kf46=\E[21;6~,
|
||||
kf47=\E[23;6~,
|
||||
kf48=\E[24;6~,
|
||||
kf49=\E[1;3P,
|
||||
kf50=\E[1;3Q,
|
||||
kf51=\E[1;3R,
|
||||
kf52=\E[1;3S,
|
||||
kf53=\E[15;3~,
|
||||
kf54=\E[17;3~,
|
||||
kf55=\E[18;3~,
|
||||
kf56=\E[19;3~,
|
||||
kf57=\E[20;3~,
|
||||
kf58=\E[21;3~,
|
||||
kf59=\E[23;3~,
|
||||
kf60=\E[24;3~,
|
||||
kf61=\E[1;4P,
|
||||
kf62=\E[1;4Q,
|
||||
kf63=\E[1;4R,
|
||||
khome=\E[1~,
|
||||
kil1=\E[2;5~,
|
||||
krmir=\E[2;2~,
|
||||
knp=\E[6~,
|
||||
kmous=\E[M,
|
||||
kpp=\E[5~,
|
||||
lines#24,
|
||||
mir,
|
||||
msgr,
|
||||
npc,
|
||||
op=\E[39;49m,
|
||||
pairs#64,
|
||||
mc0=\E[i,
|
||||
mc4=\E[4i,
|
||||
mc5=\E[5i,
|
||||
rc=\E8,
|
||||
rev=\E[7m,
|
||||
ri=\EM,
|
||||
rin=\E[%p1%dT,
|
||||
ritm=\E[23m,
|
||||
rmacs=\E(B,
|
||||
rmcup=\E[?1049l\E[23;0;0t,
|
||||
rmir=\E[4l,
|
||||
rmkx=\E[?1l\E>,
|
||||
rmso=\E[27m,
|
||||
rmul=\E[24m,
|
||||
rs1=\Ec,
|
||||
rs2=\E[4l\E>\E[?1034l,
|
||||
sc=\E7,
|
||||
sitm=\E[3m,
|
||||
sgr0=\E[0m,
|
||||
smacs=\E(0,
|
||||
smcup=\E[?1049h\E[22;0;0t,
|
||||
smir=\E[4h,
|
||||
smkx=\E[?1h\E=,
|
||||
smso=\E[7m,
|
||||
smul=\E[4m,
|
||||
tbc=\E[3g,
|
||||
tsl=\E]0;,
|
||||
xenl,
|
||||
vpa=\E[%i%p1%dd,
|
||||
# XTerm extensions
|
||||
rmxx=\E[29m,
|
||||
smxx=\E[9m,
|
||||
# disabled rep for now: causes some issues with older ncurses versions.
|
||||
# rep=%p1%c\E[%p2%{1}%-%db,
|
||||
# tmux extensions, see TERMINFO EXTENSIONS in tmux(1)
|
||||
Tc,
|
||||
Ms=\E]52;%p1%s;%p2%s\007,
|
||||
Se=\E[2 q,
|
||||
Ss=\E[%p1%d q,
|
||||
|
||||
st| simpleterm,
|
||||
use=st-mono,
|
||||
colors#8,
|
||||
setab=\E[4%p1%dm,
|
||||
setaf=\E[3%p1%dm,
|
||||
setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
|
||||
setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
|
||||
sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
|
||||
|
||||
st-256color| simpleterm with 256 colors,
|
||||
use=st,
|
||||
ccc,
|
||||
colors#256,
|
||||
oc=\E]104\007,
|
||||
pairs#32767,
|
||||
# Nicked from xterm-256color
|
||||
initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
|
||||
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
|
||||
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
|
||||
|
||||
st-meta| simpleterm with meta key,
|
||||
use=st,
|
||||
km,
|
||||
rmm=\E[?1034l,
|
||||
smm=\E[?1034h,
|
||||
rs2=\E[4l\E>\E[?1034h,
|
||||
is2=\E[4l\E>\E[?1034h,
|
||||
|
||||
st-meta-256color| simpleterm with meta key and 256 colors,
|
||||
use=st-256color,
|
||||
km,
|
||||
rmm=\E[?1034l,
|
||||
smm=\E[?1034h,
|
||||
rs2=\E[4l\E>\E[?1034h,
|
||||
is2=\E[4l\E>\E[?1034h,
|
||||
|
||||
st-bs| simpleterm with backspace as backspace,
|
||||
use=st,
|
||||
kbs=\010,
|
||||
kdch1=\177,
|
||||
|
||||
st-bs-256color| simpleterm with backspace as backspace and 256colors,
|
||||
use=st-256color,
|
||||
kbs=\010,
|
||||
kdch1=\177,
|
|
@ -1,43 +0,0 @@
|
|||
/* See LICENSE for license details. */
|
||||
|
||||
enum win_mode {
|
||||
MODE_VISIBLE = 1 << 0,
|
||||
MODE_FOCUSED = 1 << 1,
|
||||
MODE_APPKEYPAD = 1 << 2,
|
||||
MODE_MOUSEBTN = 1 << 3,
|
||||
MODE_MOUSEMOTION = 1 << 4,
|
||||
MODE_REVERSE = 1 << 5,
|
||||
MODE_KBDLOCK = 1 << 6,
|
||||
MODE_HIDE = 1 << 7,
|
||||
MODE_APPCURSOR = 1 << 8,
|
||||
MODE_MOUSESGR = 1 << 9,
|
||||
MODE_8BIT = 1 << 10,
|
||||
MODE_BLINK = 1 << 11,
|
||||
MODE_FBLINK = 1 << 12,
|
||||
MODE_FOCUS = 1 << 13,
|
||||
MODE_MOUSEX10 = 1 << 14,
|
||||
MODE_MOUSEMANY = 1 << 15,
|
||||
MODE_BRCKTPASTE = 1 << 16,
|
||||
MODE_NUMLOCK = 1 << 17,
|
||||
MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\
|
||||
|MODE_MOUSEMANY,
|
||||
};
|
||||
|
||||
void xbell(void);
|
||||
void xclipcopy(void);
|
||||
void xdrawcursor(int, int, Glyph, int, int, Glyph);
|
||||
void xdrawline(Line, int, int, int);
|
||||
void xfinishdraw(void);
|
||||
void xloadcols(void);
|
||||
int xsetcolorname(int, const char *);
|
||||
int xgetcolor(int, unsigned char *, unsigned char *, unsigned char *);
|
||||
void xseticontitle(char *);
|
||||
void xfreetitlestack(void);
|
||||
void xsettitle(char *, int);
|
||||
void xpushtitle(void);
|
||||
int xsetcursor(int);
|
||||
void xsetmode(int, unsigned int);
|
||||
void xsetpointermotion(int);
|
||||
void xsetsel(char *);
|
||||
int xstartdraw(void);
|
||||
void xximspot(int, int);
|
2147
builds/st/x.c
2147
builds/st/x.c
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.callPackage ./derivation.nix {}
|
|
@ -1,10 +0,0 @@
|
|||
{ lib, python3Packages }:
|
||||
with python3Packages;
|
||||
buildPythonApplication {
|
||||
pname = "statusbar";
|
||||
version = "1.0";
|
||||
|
||||
propagatedBuildInputs = [ ];
|
||||
|
||||
src = ./.;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name = 'pystatus',
|
||||
version = '1.0.0',
|
||||
author = 'stupidcomputer',
|
||||
author_email = 'ryan@beepboop.systems',
|
||||
url = 'https://git.beepboop.systems/stupidcomputer/dot_testing',
|
||||
description = 'simple statusbar content program',
|
||||
license = 'GPLv3',
|
||||
entry_points = {
|
||||
'console_scripts': [
|
||||
'statusbar = statusbar.statusbar:main'
|
||||
]
|
||||
},
|
||||
classifiers = (
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Environment :: Console"
|
||||
),
|
||||
zip_safe = False
|
||||
)
|
|
@ -1 +0,0 @@
|
|||
__pycache__/
|
|
@ -1,215 +0,0 @@
|
|||
from multiprocessing import Process, Queue
|
||||
from collections import defaultdict
|
||||
from sys import argv, stdout
|
||||
from math import floor
|
||||
from socket import gethostname
|
||||
import datetime
|
||||
import signal
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
import os, socket, time
|
||||
|
||||
def find_all_belonging_to_monitor(splitted, monitor):
|
||||
splitted = [i[1:] if i[1:] == monitor else i for i in splitted]
|
||||
our_monitor = splitted.index(monitor)
|
||||
next_monitor = None
|
||||
for i in range(our_monitor, len(splitted)):
|
||||
if splitted[i][0].lower() == "m":
|
||||
next_monitor = i
|
||||
break
|
||||
|
||||
if not next_monitor:
|
||||
next_monitor = len(splitted) - 1
|
||||
|
||||
return splitted[our_monitor:next_monitor]
|
||||
|
||||
def generate_desktop_string(monitor_array):
|
||||
output = []
|
||||
for i in monitor_array:
|
||||
if i[0] == "O":
|
||||
output.append("*{}".format(i[1:]))
|
||||
|
||||
if i[0] == "o":
|
||||
output.append("{}".format(i[1:]))
|
||||
|
||||
if i[0] == "F":
|
||||
output.append("*{}".format(i[1:]))
|
||||
|
||||
return ' '.join(output)
|
||||
|
||||
def filemodfactory(filename: str, modname: str):
|
||||
def filemod(queue, _):
|
||||
orig = 0
|
||||
while True:
|
||||
new = os.path.getmtime(filename)
|
||||
if(new > orig):
|
||||
with open(filename, 'r') as f:
|
||||
queue.put({
|
||||
"module": modname,
|
||||
"data": f.read().rstrip()
|
||||
})
|
||||
orig = new
|
||||
time.sleep(0.1)
|
||||
|
||||
return filemod
|
||||
|
||||
def new_mail(queue, _):
|
||||
while True:
|
||||
try:
|
||||
dir_output = os.listdir("/home/usr/Mail/main/INBOX/new")
|
||||
except FileNotFoundError: # we're on the phone, no mail here
|
||||
return
|
||||
dir_output = len(dir_output)
|
||||
queue.put({
|
||||
"module": "newmail",
|
||||
"data": str(dir_output)
|
||||
})
|
||||
time.sleep(20)
|
||||
|
||||
def bspwm(queue, monitor):
|
||||
client = socket.socket(
|
||||
socket.AF_UNIX,
|
||||
socket.SOCK_STREAM
|
||||
)
|
||||
try:
|
||||
client.connect("/tmp/bspwm_1_0-socket")
|
||||
except: # perhaps we're on the phone?
|
||||
client.connect("/data/data/com.termux/files/usr/tmp/bspwm_1_0-socket")
|
||||
|
||||
message = "subscribe\0".encode()
|
||||
client.send(message)
|
||||
while True:
|
||||
resp = client.recv(1024).decode().rstrip()
|
||||
splitted = resp[1:].split(":")
|
||||
if not monitor == "all":
|
||||
monitor_array = find_all_belonging_to_monitor(splitted, monitor)
|
||||
else:
|
||||
monitor_array = splitted
|
||||
queue.put({
|
||||
"module": "bspwm",
|
||||
"data": generate_desktop_string(monitor_array)
|
||||
})
|
||||
|
||||
client.close()
|
||||
|
||||
def clock(queue, _):
|
||||
while True:
|
||||
queue.put({
|
||||
"module": "clock",
|
||||
"data": datetime.datetime.now().strftime("%d/%m | %H:%M")
|
||||
})
|
||||
|
||||
time.sleep(60)
|
||||
|
||||
def filecheckerfactory(filename: str, modname: str, timeout=60):
|
||||
def filechecker(queue, _):
|
||||
while True:
|
||||
try:
|
||||
file = open(filename)
|
||||
buf = file.read(128).rstrip()
|
||||
queue.put({
|
||||
"module": modname,
|
||||
"data": buf
|
||||
})
|
||||
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
time.sleep(timeout)
|
||||
|
||||
return filechecker
|
||||
|
||||
battery = filecheckerfactory("/sys/class/power_supply/BAT0/capacity", "bat")
|
||||
batterystatus = filecheckerfactory("/sys/class/power_supply/BAT0/status", "batstat")
|
||||
sxhkdmode = filemodfactory("/home/usr/.cache/statusbar/sxhkd_mode", "sxhkdmode")
|
||||
|
||||
def render(modules) -> str:
|
||||
columns, _ = os.get_terminal_size(0)
|
||||
|
||||
left = "{} | {}({})".format(modules["clock"], modules["bspwm"], modules["sxhkdmode"])
|
||||
right = "{} {}({})".format(modules["newmail"], modules["bat"], modules["batstat"])
|
||||
padding = " " * (columns - len(left) - len(right) - 0)
|
||||
|
||||
output = left + padding + right
|
||||
|
||||
# special battery trickery
|
||||
try:
|
||||
batt_percentage = int(modules["bat"]) / 100
|
||||
except ValueError:
|
||||
batt_percentage = 1
|
||||
|
||||
highlighted = floor(columns * batt_percentage)
|
||||
|
||||
output = "\033[?25l\033[2J\033[H\033[4m" + \
|
||||
output[:highlighted] + \
|
||||
"\033[24m" + \
|
||||
output[highlighted:]
|
||||
|
||||
print(output, end='')
|
||||
stdout.flush()
|
||||
|
||||
def start_statusbars():
|
||||
# is there an actually good xrandr library?
|
||||
xrandr = subprocess.Popen(['xrandr'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
output = list(xrandr.stdout)
|
||||
output = [i.decode("utf-8") for i in output if " connected" in i.decode("utf-8")]
|
||||
serialized = []
|
||||
for i in output:
|
||||
splitted = i.split(' ')
|
||||
print(splitted)
|
||||
displayname = splitted[0]
|
||||
geometry = splitted[2]
|
||||
if geometry == "primary":
|
||||
geometry = splitted[3]
|
||||
|
||||
try:
|
||||
geometry_splitted = [int(i) for i in geometry.replace('x', '+').split('+')]
|
||||
except ValueError:
|
||||
continue
|
||||
geometry_splitted[1] = 20
|
||||
print(displayname, geometry_splitted)
|
||||
os.system("st -c statusbar -p -g {}x{}+{}+{} -e statusbar {} & disown".format(
|
||||
*map(str, geometry_splitted),
|
||||
displayname
|
||||
))
|
||||
|
||||
def main():
|
||||
try:
|
||||
os.mkdir("/home/usr/.cache/statusbar")
|
||||
except FileExistsError:
|
||||
pass
|
||||
except FileNotFoundError:
|
||||
# we're on the phone
|
||||
try:
|
||||
os.mkdir("/data/data/com.termux/files/home/.cache/statusbar")
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
if argv[1] == "start_statusbars":
|
||||
hostname = gethostname()
|
||||
|
||||
if not hostname == "localhost": # if we're not the phone
|
||||
start_statusbars()
|
||||
else:
|
||||
# we are the phone
|
||||
os.system("/data/data/com.termux/files/usr/bin/bash -c 'st -c statusbar -p -g {}x{}+{}+{} -e termux-statusbar-polyfill {} & disown'".format(
|
||||
1920, 50, 0, 980,
|
||||
"VNC-0"
|
||||
))
|
||||
|
||||
return
|
||||
|
||||
queue = Queue()
|
||||
modules = [bspwm, clock, battery, batterystatus, sxhkdmode, new_mail]
|
||||
[Process(target=module, args=(queue, argv[1])).start() for module in modules]
|
||||
|
||||
module_outputs = defaultdict(lambda: "")
|
||||
|
||||
while True:
|
||||
result = queue.get()
|
||||
module_outputs[result["module"]] = result["data"]
|
||||
render(module_outputs)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
python3 ~/dot_testing/builds/statusbar/statusbar/statusbar.py $@
|
|
@ -1,10 +1,10 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, pkgs
|
||||
# for statusbar
|
||||
, pkg-config
|
||||
, libxcb
|
||||
# shell scripts stuff
|
||||
, makeWrapper
|
||||
, sshuttle
|
||||
, scrcpy
|
||||
, sxhkd
|
||||
, bash
|
||||
, feh
|
||||
|
@ -14,15 +14,6 @@
|
|||
, curl
|
||||
, ytfzf
|
||||
, xrandr
|
||||
, xrectsel
|
||||
, ffcast
|
||||
, svkbd
|
||||
, xkbset
|
||||
, rbw
|
||||
, xclip
|
||||
, x11vnc
|
||||
, xmessage
|
||||
, imagemagick
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -31,15 +22,23 @@ stdenv.mkDerivation rec {
|
|||
|
||||
src = ./utils;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [ bash feh xrandr jq curl fzy ytfzf sshuttle svkbd scrcpy rbw xclip ffcast xkbset xmessage imagemagick x11vnc ];
|
||||
nativeBuildInputs = [ makeWrapper pkg-config libxcb ];
|
||||
buildInputs = [ libxcb bash feh xrandr jq curl fzy ytfzf ];
|
||||
|
||||
buildPhase = ''
|
||||
ls
|
||||
make
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
for i in $(ls $src/); do
|
||||
cp $src/$i $out/bin
|
||||
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy xkbset ytfzf sshuttle svkbd scrcpy xrectsel ffcast xmessage imagemagick x11vnc ]}
|
||||
for i in $(ls $src/sh); do
|
||||
cp $src/sh/$i $out/bin
|
||||
ln -sf $out/bin/tmenu_run $out/bin/regenerate
|
||||
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy ytfzf ]}
|
||||
done
|
||||
|
||||
cp c/status/main $out/bin/statusbar
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.PHONY: main
|
||||
main:
|
||||
make -C c/status -f Makefile
|
|
@ -0,0 +1,5 @@
|
|||
TODO LIST
|
||||
---------
|
||||
|
||||
- fix paste
|
||||
- make the c programs less buggy and let them not suck as much
|
|
@ -0,0 +1,2 @@
|
|||
main
|
||||
*.o
|
|
@ -0,0 +1,9 @@
|
|||
LDFLAGS=`pkg-config --cflags --libs xcb`
|
||||
CFLAGS=-ggdb -fsanitize=address
|
||||
main: battery.o bspwm.o time.o battstatus.o
|
||||
|
||||
clean:
|
||||
rm *.o main
|
||||
|
||||
run:
|
||||
./main
|
|
@ -0,0 +1,4 @@
|
|||
status
|
||||
------
|
||||
|
||||
a simple statusbar script thing (tm)
|
|
@ -0,0 +1,38 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "battery.h"
|
||||
#include "common.h"
|
||||
|
||||
/* config contains a path to the battery */
|
||||
int mod_battery(char *config, char *name, char *pipename) {
|
||||
struct message msg;
|
||||
strcpy(msg.name, name);
|
||||
|
||||
int fd = open(pipename, O_WRONLY);
|
||||
int battery;
|
||||
int recvd;
|
||||
|
||||
chdir("/sys/class/power_supply");
|
||||
chdir(config);
|
||||
|
||||
for(;;) {
|
||||
battery = open("capacity", O_RDONLY);
|
||||
recvd = read(battery, msg.content, 3);
|
||||
msg.content[3] = '\0';
|
||||
if (msg.content[2] == '\n') {
|
||||
msg.content[2] = '\0';
|
||||
}
|
||||
close(battery);
|
||||
write(fd, &msg, sizeof(msg));
|
||||
|
||||
sleep(30);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef STATUS_BATTERY_H
|
||||
#define STATUS_BATTERY_H
|
||||
|
||||
int mod_battery(char *config, char *name, char *pipename);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,48 @@
|
|||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "battstatus.h"
|
||||
#include "common.h"
|
||||
|
||||
int mod_battstatus(char *config, char *name, char *pipename) {
|
||||
char status;
|
||||
int battery;
|
||||
struct message msg;
|
||||
strcpy(msg.name, name);
|
||||
|
||||
int fd = open(pipename, O_WRONLY);
|
||||
|
||||
chdir("/sys/class/power_supply");
|
||||
chdir(config);
|
||||
|
||||
for(;;) {
|
||||
battery = open("status", O_RDONLY);
|
||||
read(battery, msg.content, 1);
|
||||
switch(msg.content[0]) {
|
||||
case 'N': /* not charging */
|
||||
msg.content[0] = '-';
|
||||
break;
|
||||
case 'C': /* charging */
|
||||
msg.content[0] = '^';
|
||||
break;
|
||||
case 'D': /* discharging */
|
||||
msg.content[0] = 'U';
|
||||
break;
|
||||
case 'U': /* unknown */
|
||||
msg.content[0] = '?';
|
||||
break;
|
||||
default: /* what's going on? */
|
||||
msg.content[0] = '!';
|
||||
break;
|
||||
}
|
||||
msg.content[1] = '\0';
|
||||
close(battery);
|
||||
write(fd, &msg, sizeof(msg));
|
||||
|
||||
sleep(30);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef STATUS_BATTSTAT_H
|
||||
#define STATUS_BATTSTAT_H
|
||||
|
||||
int mod_battstatus(char *config, char *name, char *pipename);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,142 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "bspwm.h"
|
||||
#include "common.h"
|
||||
|
||||
const char subscribe[] = "subscribe";
|
||||
|
||||
int get_socket(void) {
|
||||
struct sockaddr_un sock;
|
||||
char *host;
|
||||
int displaynumber, screennumber;
|
||||
int fd;
|
||||
|
||||
xcb_parse_display(NULL, &host, &displaynumber, &screennumber);
|
||||
|
||||
sock.sun_family = AF_UNIX;
|
||||
snprintf(
|
||||
sock.sun_path,
|
||||
sizeof(sock.sun_path), "/tmp/bspwm%s_%i_%i-socket",
|
||||
host, displaynumber, screennumber
|
||||
);
|
||||
|
||||
free(host);
|
||||
|
||||
fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (connect(
|
||||
fd,
|
||||
(struct sockaddr *) &sock,
|
||||
sizeof(sock)
|
||||
) == -1) {
|
||||
return -1;
|
||||
} else {
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
|
||||
int should_be_shown(char c) {
|
||||
return c == 'O' || c == 'o' || c == 'F' || c == 'U' || c == 'u';
|
||||
}
|
||||
|
||||
int is_a_desktop(char c) {
|
||||
return c == 'O' || c == 'o' || c == 'F' || c == 'f' || c == 'U' || c == 'u';
|
||||
}
|
||||
|
||||
/* XXX: this function has the potential to buffer overflow by ONE BYTE.
|
||||
* probably fix this? */
|
||||
void print_desktop_status(char *in, char *out, int outlen) {
|
||||
int written;
|
||||
int i;
|
||||
char c;
|
||||
|
||||
/* flags */
|
||||
int read_colon;
|
||||
int skip_to_next_colon;
|
||||
int read_until_colon;
|
||||
int is_first_desktop;
|
||||
int last_was_desktop;
|
||||
|
||||
i = 0;
|
||||
written = 0;
|
||||
read_colon = 1;
|
||||
skip_to_next_colon = 0;
|
||||
read_until_colon = 0;
|
||||
is_first_desktop = 1;
|
||||
last_was_desktop = 0;
|
||||
|
||||
for(;;) {
|
||||
c = in[i];
|
||||
|
||||
if(!c) break;
|
||||
if(written == outlen) break;
|
||||
|
||||
if (skip_to_next_colon) {
|
||||
if (c == ':') {
|
||||
skip_to_next_colon = 0;
|
||||
read_until_colon = 0;
|
||||
read_colon = 1;
|
||||
} else if (read_until_colon) {
|
||||
out[written] = c;
|
||||
written++;
|
||||
}
|
||||
} else if (read_colon && should_be_shown(c)) {
|
||||
if (!is_first_desktop) {
|
||||
out[written] = ' ';
|
||||
written++;
|
||||
}
|
||||
|
||||
switch(c) {
|
||||
case 'O':
|
||||
case 'F': /* fallthrough */
|
||||
out[written] = '*';
|
||||
written++;
|
||||
break;
|
||||
}
|
||||
|
||||
skip_to_next_colon = 1;
|
||||
read_until_colon = 1;
|
||||
read_colon = 0;
|
||||
is_first_desktop = 0;
|
||||
last_was_desktop = 1;
|
||||
} else if (read_colon && is_a_desktop(c)) {
|
||||
last_was_desktop = 1;
|
||||
} else {
|
||||
if(last_was_desktop) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
out[written] = '\0';
|
||||
}
|
||||
|
||||
int mod_bspwm(char *config, char *name, char *pipename) {
|
||||
struct message msg;
|
||||
int fd, bspcfd;
|
||||
char in[BUFFER_SIZE];
|
||||
|
||||
strcpy(msg.name, name);
|
||||
msg.flags = 0;
|
||||
|
||||
fd = open(pipename, O_WRONLY);
|
||||
bspcfd = get_socket();
|
||||
|
||||
send(bspcfd, subscribe, sizeof(subscribe), 0);
|
||||
|
||||
for(;;) {
|
||||
int recvd = recv(bspcfd, in, BUFFER_SIZE, 0);
|
||||
print_desktop_status(in, msg.content, 512);
|
||||
write(fd, &msg, sizeof(msg));
|
||||
memset(msg.content, 0, 512);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef STATUS_BSPWM_H
|
||||
#define STATUS_BSPWM_H
|
||||
|
||||
int mod_bspwm(char *config, char *name, char *pipename);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef STATUS_COMMON_H
|
||||
#define STATUS_COMMON_H
|
||||
|
||||
#define LENGTH(x) sizeof(x) / sizeof(x[0])
|
||||
#define BUFFER_SIZE 512
|
||||
|
||||
struct module {
|
||||
int (*fork_callback)(char *config, char *name, char *pipename);
|
||||
char name[16];
|
||||
char config[512];
|
||||
char buffer[512];
|
||||
int buflen;
|
||||
};
|
||||
|
||||
struct message {
|
||||
int flags;
|
||||
char name[16];
|
||||
char content[512];
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,91 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/un.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "battery.h"
|
||||
#include "battstatus.h"
|
||||
#include "bspwm.h"
|
||||
#include "time.h"
|
||||
|
||||
struct module mods[] = {
|
||||
{mod_battery, "battery", "BAT0", { '\0' }},
|
||||
{mod_battstatus, "battstatus", "BAT0", { '\0' }},
|
||||
{mod_time, "time", "", { '\0' }},
|
||||
/* {mod_bspwm, "bspwm", "", { '\0' }}, not working at the moment */
|
||||
};
|
||||
|
||||
void create_module_proc(int index, char *pipename) {
|
||||
pid_t pid = fork();
|
||||
|
||||
if (pid == 0) { /* we're the child */
|
||||
mods[index].fork_callback(
|
||||
mods[index].config,
|
||||
mods[index].name,
|
||||
pipename
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void create_module_procs(char *pipename) {
|
||||
for(int i = 0; i < LENGTH(mods); i++) {
|
||||
create_module_proc(i, pipename);
|
||||
}
|
||||
}
|
||||
|
||||
void redraw() {
|
||||
/* get the progress' module's value, convert it to int, and then
|
||||
* figure out how much of the screen should be shaded in */
|
||||
|
||||
printf("\033[H\033[2J");
|
||||
for(int i = 0; i < LENGTH(mods); i++) {
|
||||
if (i == 0) printf("%s ", mods[i].buffer);
|
||||
else printf("| %s ", mods[i].buffer);
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static char NAMED_PIPE[] = "/home/usr/.cache/statusbar_pipe";
|
||||
|
||||
int main(void) {
|
||||
char pipename[BUFFER_SIZE];
|
||||
srand(time(NULL));
|
||||
strcpy(pipename, &NAMED_PIPE);
|
||||
pipename[sizeof(NAMED_PIPE) - 1] = 'A' + (rand() % 26);
|
||||
pipename[sizeof(NAMED_PIPE)] = 'A' + (rand() % 26);
|
||||
pipename[sizeof(NAMED_PIPE) + 1] = '\0';
|
||||
mkfifo(pipename, 0666);
|
||||
int fd = open(pipename, O_RDWR);
|
||||
struct message msg;
|
||||
|
||||
create_module_procs(pipename);
|
||||
|
||||
for (;;) {
|
||||
int ret = read(fd, &msg, sizeof(msg));
|
||||
if(ret < 0) {
|
||||
printf("error while reading message from child\n");
|
||||
}
|
||||
|
||||
for(int i = 0; i < LENGTH(mods); i++) {
|
||||
if(strcmp(mods[i].name, msg.name) == 0) {
|
||||
mods[i].buflen = strlen(msg.content);
|
||||
strcpy(mods[i].buffer, msg.content);
|
||||
redraw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
with import <nixpkgs> {};
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
gdb
|
||||
gnumake
|
||||
pkg-config
|
||||
xorg.libxcb
|
||||
];
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "time.h"
|
||||
|
||||
int mod_time(char *config, char *name, char *pipename) {
|
||||
struct message msg;
|
||||
time_t now;
|
||||
struct tm *tm;
|
||||
int fd;
|
||||
|
||||
strcpy(msg.name, name);
|
||||
msg.flags = 0;
|
||||
fd = open(pipename, O_WRONLY);
|
||||
|
||||
for(;;) {
|
||||
time(&now);
|
||||
tm = localtime(&now);
|
||||
strftime(msg.content, 512, "%H:%M", tm);
|
||||
write(fd, &msg, sizeof(msg));
|
||||
|
||||
sleep(60);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef STATUS_TIME_H
|
||||
#define STATUS_TIME_H
|
||||
|
||||
int mod_time(char *config, char *name, char *pipename);
|
||||
|
||||
#endif
|
|
@ -1,39 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
display=$(xrandr \
|
||||
| grep ' connected' \
|
||||
| awk -F ' ' '{print $1}' \
|
||||
| sed '1i select rectangle' \
|
||||
| fzy)
|
||||
|
||||
case "$display" in
|
||||
"select"*)
|
||||
geom=$(xrectsel)
|
||||
;;
|
||||
*)
|
||||
geom=$(xrandr \
|
||||
| grep "$display" \
|
||||
| awk -F ' ' '{print $3 " " $4}' \
|
||||
| sed 's/primary //g' \
|
||||
| awk -F ' ' '{print $1}' \
|
||||
| grep '[[:digit:]]'
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
printf "[] selected geometry is %s\n" "$geom"
|
||||
|
||||
medium=$(
|
||||
printf ".mp4\n.png\n" | fzy
|
||||
)
|
||||
|
||||
printf "[] capturing in medium %s\n" "$medium"
|
||||
|
||||
case "$medium" in
|
||||
*"mp4"*)
|
||||
ffcast -g $geom rec $HOME/output.mp4
|
||||
;;
|
||||
*"png"*)
|
||||
ffcast -g $geom png
|
||||
;;
|
||||
esac
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue