From eecf6b9165d067e353242349f352dd408749818c Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Fri, 8 Oct 2021 15:13:39 +0200 Subject: [PATCH] Apply laptop stuff --- kmonad/.config/kmonad/kmonad.kbd | 72 ++++++++ scripts/scripts/battery_indicator.sh | 8 + sway/.config/sway/config | 247 +++++++++++++++++++++++++++ zsh/.config/zsh/.zshrc | 42 +++++ zsh/.config/zsh/fzf-tab.zsh | 20 +++ zsh/.config/zsh/prompt.zsh | 48 ++++++ 6 files changed, 437 insertions(+) create mode 100644 kmonad/.config/kmonad/kmonad.kbd create mode 100644 scripts/scripts/battery_indicator.sh create mode 100644 sway/.config/sway/config create mode 100644 zsh/.config/zsh/.zshrc create mode 100644 zsh/.config/zsh/fzf-tab.zsh create mode 100644 zsh/.config/zsh/prompt.zsh diff --git a/kmonad/.config/kmonad/kmonad.kbd b/kmonad/.config/kmonad/kmonad.kbd new file mode 100644 index 0000000..cbcea33 --- /dev/null +++ b/kmonad/.config/kmonad/kmonad.kbd @@ -0,0 +1,72 @@ +#| +(deflayer name + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ + ) + +-------------------------------------------------------------------------- |# + + +(defcfg + input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") + output (uinput-sink "KMonad") + fallthrough true + allow-cmd true + ) + +(defsrc + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 ssrq slck pause + grv 1 2 3 4 5 6 7 8 9 0 - = bspc ins home pgup + tab q w e r t y u i o p [ ] ret del end pgdn + caps a s d f g h j k l ; ' \ + lsft 102d z x c v b n m , . / rsft up + lctl lmet lalt spc ralt rctl cmp rctl left down rght + ) + +(deflayer base + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 ssrq slck pause + grv 1 2 3 4 5 6 7 8 9 0 - = bspc ins home pgup + @tab q w e r t y u i o p [ + ret del end pgdn + @cps a s d f g h j k l ; ' \ + lsft 102d z x c v b n m , . / rsft up + lctl lmet lalt spc ralt ralt cmp rctl left down rght + ) + +(defalias + cps (tap-hold-next-release 200 esc (layer-toggle symbols)) + tab (tap-hold-next-release 200 tab (layer-toggle umls)) + s-sft (tap-hold-next-release 150 s lsft) + l-sft (tap-hold-next-release 150 l lsft) + + uml-a #(ralt " a) + uml-o #(ralt " o) + uml-u #(ralt " u) + uml-s #(ralt s s) + excl (around lsft 1) +) + + + + + +(deflayer symbols +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +_ _ @excl " / \\ _ { [ ] } _ * _ _ _ _ +_ home $ \( \) end left down up right & % _ +_ _ | delete ? ~ _ = # bspc _ #(~ /) _ _ +_ _ _ _ _ _ _ _ _ _ _ +) + +(deflayer umls + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ @uml-u _ @uml-o _ _ _ _ _ _ _ + _ @uml-a @uml-s _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ + ) diff --git a/scripts/scripts/battery_indicator.sh b/scripts/scripts/battery_indicator.sh new file mode 100644 index 0000000..b5d79e8 --- /dev/null +++ b/scripts/scripts/battery_indicator.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +#output="$(upower -i /org/freedesktop/UPower/devices/battery_BAT1)" +percentage="$(cat /sys/class/power_supply/BAT1/capacity)" +status="$(cat /sys/class/power_supply/BAT1/status)" + + +echo "${percentage}%" diff --git a/sway/.config/sway/config b/sway/.config/sway/config new file mode 100644 index 0000000..eb0d81d --- /dev/null +++ b/sway/.config/sway/config @@ -0,0 +1,247 @@ + +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +set $term foot +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +set $menu dmenu_path | dmenu | xargs swaymsg exec -- + +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +output * bg /home/leon/Pictures/wallpapers/0126.jpg fill +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs + +# autostart +exec swayidle -w \ + timeout 300 'swaylock -f -c 000000' \ + timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ + before-sleep 'swaylock -f -c 000000' + +exec mako +exec libinput-gestures-setup start + + + + +# visuals +gaps inner 10 +default_border pixel 1 + + + +client.focused "#ebdbb2" "#ebdbb2" "#1d2021" +client.unfocused "#1d2021" "#1d2021" "#1d2021" + + + + + + + + + +### Input configuration +# +# Example configuration: +# +input "1267:12370:ELAN0651:00_04F3:3052_Touchpad" { + dwt enabled + tap enabled + natural_scroll enabled + middle_emulation enabled +} + +input "type:keyboard" { + xkb_options compose:ralt +} + + + +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $term + + # Kill focused window + bindsym $mod+Shift+q kill + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+c reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' + + bindsym $mod+Shift+p exec ~/.config/rofi/bin/launcher_ribbon +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent + + + +bindsym --locked XF86MonBrightnessUp exec brightnessctl -e set 50+ +bindsym --locked XF86MonBrightnessDown exec brightnessctl -e set 50- +bindsym --locked XF86AudioRaiseVolume exec pamixer -i 5 +bindsym --locked XF86AudioLowerVolume exec pamixer -d 5 + +bindsym $mod+Shift+S exec grimshot copy area +bindsym $mod+Shift+b exec google-chrome-stable + + +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + position bottom + + # When the status_command prints a new line to stdout, swaybar updates. + # The default just shows the current date and time. + status_command while echo "$(/home/leon/scripts/battery_indicator.sh) // $(date +'%Y-%m-%d %l:%M:%S %p')"; do sleep 1; done + font "cozette 8" + #font "Terminus (TTF)" + height 20 + + colors { + statusline #ebdbb2 + background #1d202100 + inactive_workspace #1d202100 #1d202100 #ebdbb2 + focused_workspace #282828 #83c07c #282828 + active_workspace #28282800 #83c07c #282828 + } +} + +include /etc/sway/config.d/* diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..895c198 --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,42 @@ +source ~/.zplug/init.zsh + +zplug 'zplug/zplug', hook-build:'zplug --self-manage' +zplug "plugins/git", from:oh-my-zsh +zplug "zsh-users/zsh-completions" +zplug "Aloxaf/fzf-tab", defer:2 +zplug "zsh-users/zsh-history-substring-search", defer:2 +zplug "zdharma/fast-syntax-highlighting", defer:2 + +if ! zplug check --verbose; then + printf "Install? [y/N]: " + if read -q; then + echo; zplug install + fi +fi +zplug load + +eval "$(zoxide init zsh)" + +source "$ZDOTDIR/fzf-tab.zsh" + + +setopt nobeep +setopt HIST_IGNORE_ALL_DUPS +autoload -Uz colors && colors +autoload -Uz promptinit && promptinit + +my-backward-delete-word() { + local WORDCHARS=${WORDCHARS/\//} + zle backward-delete-word +} +zle -N my-backward-delete-word +bindkey '^W' my-backward-delete-word +bindkey '^H' backward-delete-word +bindkey "^[[H" beginning-of-line +bindkey "^[[F" end-of-line + + +alias ls="exa --icons" + + +source "$ZDOTDIR/prompt.zsh" diff --git a/zsh/.config/zsh/fzf-tab.zsh b/zsh/.config/zsh/fzf-tab.zsh new file mode 100644 index 0000000..6d1fdf1 --- /dev/null +++ b/zsh/.config/zsh/fzf-tab.zsh @@ -0,0 +1,20 @@ +#!/usr/bin/env zsh + +FZF_TAB_COMMAND=( + fzf + --ansi + --expect='$continuous_trigger' # For continuous completion + '--color=hl:$(( $#headers == 0 ? 108 : 255 ))' + --nth=2,3 --delimiter='\x00' # Don't search prefix + --layout=reverse --height="''${FZF_TMUX_HEIGHT:=50%}" + --tiebreak=begin -m --bind=tab:down,btab:up,change:top,ctrl-space:toggle --cycle + '--query=$query' # $query will be expanded to query string at runtime. + '--header-lines=$#headers' # $#headers will be expanded to lines of headers at runtime + ) +zstyle ':fzf-tab:*' command $FZF_TAB_COMMAND +zstyle ':completion:complete:*:options' sort false +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +zstyle ':fzf-tab:complete:_zlua:*' query-string input +zstyle ':fzf-tab:complete:*:*' fzf-preview '/home/leon/scripts/preview.sh $realpath' + + diff --git a/zsh/.config/zsh/prompt.zsh b/zsh/.config/zsh/prompt.zsh new file mode 100644 index 0000000..56833a0 --- /dev/null +++ b/zsh/.config/zsh/prompt.zsh @@ -0,0 +1,48 @@ +#!/usr/bin/env zsh + +local __bright_cyan="#8ec07c" +local __bright_white="#ebdbb2" +local __bright_green="#b8bb26" + +dir() { + local CUTOFF=3 + local IFS=/ + local my_path=($(print -P '%~')) + local p + for p in $my_path; do + printf %s "${s}${p[0,$CUTOFF]}" + local s=/ + done + printf '%s\n' "${p:$CUTOFF}" +} + + +git_status() { + local BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\s*\(.*\)/\1/') + + if [ ! -z $BRANCH ]; then + echo -n "(%F{$__bright_cyan}$BRANCH%F{$__bright_white}" + [ ! -z "$(git status --short)" ] && echo -n "*" + echo -n ")%f" + fi +} + +function _my_prompt() { + local exit_code="$?" + echo -n "%F{$__bright_white}╭───" + echo -n "%F{$__bright_cyan}$USER" + echo -n "%F{$__bright_white} in" + echo -n "%F{$__bright_green} $(dir)" + echo -n "%F{$__bright_white} $(git_status)" + if [ ! "$exit_code" = 0 ]; then + echo -n "%F{red} REEEEEEEEEEE $exit_code" + fi + echo + # %3{stuff%} tell's zsh that the characters are printed as 3 chars wide + echo -n "%F{$__bright_white}%3{╰─λ%} " +} + + +setopt prompt_subst +autoload -U colors && colors +PS1='$(_my_prompt)'