From 650bf9b2a5cdc4fa9a755b54208824313d6de27c Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 7 Jun 2022 23:10:14 -0500 Subject: [PATCH] add sway commit. various changes --- .config/.sysconf/etc/nixos/configuration.nix | 2 +- .../etc/nixos/sway-configuration-new.nix | 112 ++++++++++++++++++ .../.sysconf/etc/nixos/sway-configuration.nix | 21 ++-- .config/alacritty/alacritty.yml | 46 +++---- .config/bemenu/bemenu-colorgen.sh | 40 ------- .config/bemenu/bemenu_opts.sh | 4 +- .config/git/config | 7 ++ .config/lf/lfrc | 2 +- .config/sway/config | 6 +- .local/scripts/bemenu-colorgen.sh | 69 +++++++++++ .local/scripts/bemenu-theme.sh | 30 ----- .profile | 2 +- 12 files changed, 234 insertions(+), 107 deletions(-) create mode 100644 .config/.sysconf/etc/nixos/sway-configuration-new.nix delete mode 100755 .config/bemenu/bemenu-colorgen.sh create mode 100644 .config/git/config create mode 100755 .local/scripts/bemenu-colorgen.sh delete mode 100644 .local/scripts/bemenu-theme.sh diff --git a/.config/.sysconf/etc/nixos/configuration.nix b/.config/.sysconf/etc/nixos/configuration.nix index f01c864..c3efdac 100644 --- a/.config/.sysconf/etc/nixos/configuration.nix +++ b/.config/.sysconf/etc/nixos/configuration.nix @@ -78,7 +78,7 @@ vim htop radeontop #GUI programs - firefox palemoon transmission-gtk mcomix + firefox transmission-gtk mcomix #Theming gnome3.adwaita-icon-theme gnome3.defaultIconTheme diff --git a/.config/.sysconf/etc/nixos/sway-configuration-new.nix b/.config/.sysconf/etc/nixos/sway-configuration-new.nix new file mode 100644 index 0000000..24f8c00 --- /dev/null +++ b/.config/.sysconf/etc/nixos/sway-configuration-new.nix @@ -0,0 +1,112 @@ +{ config, pkgs, lib, ... }: + +let + # bash script to let dbus know about important env variables and + # propogate them to relevent services run at the end of sway config + # see + # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist + # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts + # some user services to make sure they have the correct environment variables + dbus-sway-environment = pkgs.writeTextFile { + name = "dbus-sway-environment"; + destination = "/bin/dbus-sway-environment"; + executable = true; + + text = '' + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + ''; + }; + + # currently, there is some friction between sway and gtk: + # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland + # the suggested way to set gtk settings is with gsettings + # for gsettings to work, we need to tell it where the schemas are + # using the XDG_DATA_DIR environment variable + # run at the end of sway config + configure-gtk = pkgs.writeTextFile { + name = "configure-gtk"; + destination = "/bin/configure-gtk"; + executable = true; + text = let + schema = pkgs.gsettings-desktop-schemas; + datadir = "${schema}/share/gsettings-schemas/${schema.name}"; + in '' + export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS + gnome_schema=org.gnome.desktop.interface + gsettings set $gnome_schema gtk-theme 'Dracula' + ''; + }; + + +in +{ + environment.systemPackages = with pkgs; [ + alacritty # gpu accelerated terminal + sway + dbus-sway-environment + configure-gtk + wayland + glib # gsettings + dracula-theme # gtk theme + gnome3.adwaita-icon-theme # default gnome cursors + swaylock + swayidle + grim # screenshot functionality + slurp # screenshot functionality + wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout + bemenu # wayland clone of dmenu + mako # notification system developed by swaywm maintainer + swaybg + waybar + xwayland + gammastep + + #cli programs + viu + bat + yt-dlp + neovim + + + #programs I use + librewolf + zathura + imv + pavucontrol + ]; + + #add 32bit support for graphics + hardware.opengl.driSupport32Bit = true; + + + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + + services.pipewire.wireplumber.enable = true; + + + # xdg-desktop-portal works by exposing a series of D-Bus interfaces + # known as portals under a well-known name + # (org.freedesktop.portal.Desktop) and object path + # (/org/freedesktop/portal/desktop). + # The portal interfaces include APIs for file access, opening URIs, + # printing and others. + services.dbus.enable = true; + xdg.portal = { + enable = true; + wlr.enable = true; + # gtk portal needed to make gtk apps happy + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + gtkUsePortal = true; + }; + + # enable sway window manager + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; diff --git a/.config/.sysconf/etc/nixos/sway-configuration.nix b/.config/.sysconf/etc/nixos/sway-configuration.nix index a311dec..4876339 100644 --- a/.config/.sysconf/etc/nixos/sway-configuration.nix +++ b/.config/.sysconf/etc/nixos/sway-configuration.nix @@ -16,6 +16,15 @@ ]; }; + xdg.portal.wlr.enable = true; + + #enable pipewire + services.pipewire.enable = true; + services.pipewire.alsa.enable = true; + services.pipewire.pulse.enable = true; + services.pipewire.wireplumber.enable = true; + services.pipewire.audio.enable = true; + #environment = { @@ -31,12 +40,12 @@ environment.systemPackages = with pkgs; [ pango alacritty - bemenu + bemenu imv mpv cmus - zathura - pulsemixer + zathura + pulsemixer ffmpegthumbnailer ( pkgs.writeTextFile { @@ -84,12 +93,6 @@ }; -# services.redshift = { -# enable = true; - # Redshift with wayland support isn't present in nixos-19.09 atm. You have to cherry-pick the commit from https://github.com/NixOS/nixpkgs/pull/68285 to do that. -# package = pkgs.redshift; -# }; - programs.waybar.enable = true; systemd.user.services.kanshi = { diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index 14e910e..a472cff 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -184,42 +184,44 @@ font: # If `true`, bold text is drawn using the bright color variants. #draw_bold_text_with_bright_colors: true -# Base16 Atlas - alacritty color config -# Alex Lende (https://ajlende.com) + +# Base16 Gruvbox dark, hard - alacritty color config +# Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) colors: # Default colors primary: - background: '0x002635' - foreground: '0xa1a19a' + background: '0x1d2021' + foreground: '0xd5c4a1' # Colors the cursor will use if `custom_cursor_colors` is true cursor: - text: '0x002635' - cursor: '0xa1a19a' + text: '0x1d2021' + cursor: '0xd5c4a1' # Normal colors normal: - black: '0x002635' - red: '0xff5a67' - green: '0x7fc06e' - yellow: '0xffcc1b' - blue: '0x5dd7b9' - magenta: '0x9a70a4' - cyan: '0x14747e' - white: '0xa1a19a' + black: '0x1d2021' + red: '0xfb4934' + green: '0xb8bb26' + yellow: '0xfabd2f' + blue: '0x83a598' + magenta: '0xd3869b' + cyan: '0x8ec07c' + white: '0xd5c4a1' # Bright colors bright: - black: '0x6c8b91' - red: '0xf08e48' - green: '0x00384d' - yellow: '0x517f8d' - blue: '0x869696' - magenta: '0xe6e6dc' - cyan: '0xc43060' - white: '0xfafaf8' + black: '0x665c54' + red: '0xfe8019' + green: '0x3c3836' + yellow: '0x504945' + blue: '0xbdae93' + magenta: '0xebdbb2' + cyan: '0xd65d0e' + white: '0xfbf1c7' draw_bold_text_with_bright_colors: false + # Visual Bell # # Any time the BEL code is received, Alacritty "rings" the visual bell. Once diff --git a/.config/bemenu/bemenu-colorgen.sh b/.config/bemenu/bemenu-colorgen.sh deleted file mode 100755 index 06df23a..0000000 --- a/.config/bemenu/bemenu-colorgen.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -BEMENUOPTS_FILE="$HOME/.config/bemenu/bemenu_opts.sh" - -HEIGHT="22" #height in pixels to make the bemenu prompt - -! [ -f "$1" ] && echo "input base16 color file for first argument." && exit - -NB="" -NF="" -HB="" -HF="" -SB="" -SF="" -TB="" -TF="" -FB="" -FF="#ffffff" - -IFS=' -' - -COUNT=0 -for LINE in $(cat "$1") -do - case $COUNT in - 0) NB="$LINE" && HB="$LINE" && TB="$LINE" && FB="$LINE";; - 1) SB="$LINE";; - 6) HF="$LINE" && SF="$LINE";; - 10) NF="$LINE" && TF="$LINE";; - esac - - COUNT=$((COUNT + 1)) -done - -echo "bemenu colors updated." - -echo "#!/bin/sh" > "$BEMENUOPTS_FILE" -echo "#generated from: $1" >> "$BEMENUOPTS_FILE" -echo "export BEMENU_OPTS=\"-H $HEIGHT --nb $NB --nf $NF --hb $HB --hf $HF --sb $SB --sf $SF --tb $TB --tf $TF --fb $FB --ff $FF\"" >> "$BEMENUOPTS_FILE" diff --git a/.config/bemenu/bemenu_opts.sh b/.config/bemenu/bemenu_opts.sh index 8f06fd9..bb7abc8 100644 --- a/.config/bemenu/bemenu_opts.sh +++ b/.config/bemenu/bemenu_opts.sh @@ -1,3 +1,3 @@ #!/bin/sh -#generated from: colors/base16-atlas -export BEMENU_OPTS="-H 22 --nb #002635 --nf #ffcc1b --hb #002635 --hf #e6e6dc --sb #00384d --sf #e6e6dc --tb #002635 --tf #ffcc1b --fb #002635 --ff #ffffff" +#generated from: ./colors/base16-gruvbox-dark-hard +export BEMENU_OPTS="-H 22 --nb #1d2021 --nf #fabd2f --hb #1d2021 --hf #ebdbb2 --sb #3c3836 --sf #ebdbb2 --tb #1d2021 --tf #fabd2f --fb #1d2021 --ff #ffffff" diff --git a/.config/git/config b/.config/git/config new file mode 100644 index 0000000..d172d80 --- /dev/null +++ b/.config/git/config @@ -0,0 +1,7 @@ +[user] + email = "alex@ahubbard.xyz" + name = Alex +[pull] + rebase = false +[init] + defaultBranch = master diff --git a/.config/lf/lfrc b/.config/lf/lfrc index cc4f034..af0acd5 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -55,7 +55,7 @@ cmd open ${{ image/jpeg) setsid imv $f ;; image/png) setsid imv $f ;; image/*) setsid imv $f ;; - video/*) setsid mpv $f ;; + video/*) setsid mpv $f --loop=inf ;; application/json) $EDITOR $f;; *) for f in $fx; do setsid $OPENER $f > /dev/null 2> /dev/null & done;; esac diff --git a/.config/sway/config b/.config/sway/config index a1c16ad..adc8330 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -229,7 +229,8 @@ bindsym $mod+shift+s exec ss.sh -s #include ~/.config/sway/colors/base16-atlas #include ~/.local/src/base16-sway/themes/base16-gruvbox-dark-medium.config -include ~/.local/src/base16-sway/themes/base16-atlas.config +#include ~/.local/src/base16-sway/themes/base16-atlas.config +include ~/.local/src/base16-sway/themes/base16-gruvbox-dark-hard.config # # Status Bar: @@ -284,6 +285,9 @@ gaps outer 10 #border default_border pixel 2 +#set windows to float by default +for_window [class="Matplotlib"] floating enable + #input config input type:pointer accel_profile flat input type:pointer pointer_accel -0.5 diff --git a/.local/scripts/bemenu-colorgen.sh b/.local/scripts/bemenu-colorgen.sh new file mode 100755 index 0000000..c8f0639 --- /dev/null +++ b/.local/scripts/bemenu-colorgen.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +BEMENUOPTS_FILE="$HOME/.config/bemenu/bemenu_opts.sh" + +HEIGHT="22" #height in pixels to make the bemenu prompt + +help () { + echo " usage: sh bemenu-colorgen.sh FILE" + echo " where FILE contains hex values of a base16 color scheme in this format:" + echo " NOTE: the file must contain 16 color values" + echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + echo " #282936" + echo " #3a3c4e" + echo " #F7CA88" + echo " #626483" + echo " #62d6e8" + echo " #e9e9f4" + echo " #f1f2f8" + echo " #f7f7fb" + echo " #ea51b2" + echo " #b45bcf" + echo " #00f769" + echo " #ebff87" + echo " #a1efe4" + echo " #62d6e8" + echo " #b45bcf" + echo " #00f769" + echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +} + + + FILE="$1" + +! [ -f "$FILE" ] && help && exit +[ "$( wc -l "$FILE" | cut -d ' ' -f 1 )" != "16" ] && help && exit + + +NB="" +NF="" +HB="" +HF="" +SB="" +SF="" +TB="" +TF="" +FB="" +FF="#ffffff" + +IFS=' +' + +COUNT=0 +for LINE in $(cat "$FILE") +do + case $COUNT in + 0) NB="$LINE" && HB="$LINE" && TB="$LINE" && FB="$LINE";; + 1) SB="$LINE";; + 6) HF="$LINE" && SF="$LINE";; + 10) NF="$LINE" && TF="$LINE";; + esac + + COUNT=$((COUNT + 1)) +done + +echo "bemenu colors updated." + +echo "#!/bin/sh" > "$BEMENUOPTS_FILE" +echo "#generated from: $1" >> "$BEMENUOPTS_FILE" +echo "export BEMENU_OPTS=\"-H $HEIGHT --nb $NB --nf $NF --hb $HB --hf $HF --sb $SB --sf $SF --tb $TB --tf $TF --fb $FB --ff $FF\"" >> "$BEMENUOPTS_FILE" diff --git a/.local/scripts/bemenu-theme.sh b/.local/scripts/bemenu-theme.sh deleted file mode 100644 index 977d880..0000000 --- a/.local/scripts/bemenu-theme.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - - - COLOR0="#282936" - COLOR1="#3a3c4e" - COLOR2="#F7CA88" - COLOR3="#626483" - COLOR4="#62d6e8" - COLOR5="#e9e9f4" - COLOR6="#f1f2f8" - COLOR7="#f7f7fb" - COLOR8="#ea51b2" - COLOR9="#b45bcf" -COLOR10="#00f769" -COLOR11="#ebff87" -COLOR12="#a1efe4" -COLOR13="#62d6e8" -COLOR14="#b45bcf" -COLOR15="#00f769" - -WHITE="#ffffff" -BLACK="#000000" - - -BEMENU_OPTS="--nb $COLOR0 --nf $COLOR15 --hb $COLOR0 --hf $COLOR6 --sb $COLOR1 --sf $COLOR6 --tb $COLOR0 --tf $COLOR15 --fb $COLOR0 --ff $WHITE" - -mkdir .config/bemenu/ - -echo "#!/bin/sh" > ~/.config/bemenu/bemenu_opts.sh -echo "export BEMENU_OPTS=\"$BEMENU_OPTS\"" >> ~/.config/bemenu/bemenu_opts.sh diff --git a/.profile b/.profile index ac7106c..b5d847c 100644 --- a/.profile +++ b/.profile @@ -67,7 +67,7 @@ export AWT_TOOLKIT=MToolkit #mount samba share, needs entry in /etc/fstab for this line to work # //192.168.1.218/storage /media/nagato cifs username=alex,pass=PASSWORD,workgroup=WORKGROUP,user,noauto 0 0 -mount /media/nagato & +mount /media/nagato/ & [ "$(tty)" = /dev/tty1 ] && exec dbus-launch sway