diff --git a/editions/gnome b/editions/gnome index 98aaf3d917aa0cbcfb190cc5ab531a4cf56d637c..11f73c48e5be32bdbb3cc6b1e5e1d1ab7c0f0260 100644 --- a/editions/gnome +++ b/editions/gnome @@ -150,6 +150,7 @@ file-roller gcolor3 gedit gedit-plugins +gnome-epub-thumbnailer gparted manjaro-settings-manager mntray diff --git a/editions/sway b/editions/sway index 5a3cb954253acc794e869ddccf91cd5186ee3296..383e221585d4edae34dc92d2733c905fe2230eea 100644 --- a/editions/sway +++ b/editions/sway @@ -76,6 +76,9 @@ firefox-ublock-origin # Email thunderbird +# Office suite +libreoffice-fresh + # Package Manager pamac-gtk polkit-gnome @@ -109,6 +112,7 @@ htop httpie hyperfine jq +khal light mediainfo mlocate @@ -120,9 +124,10 @@ ranger ripgrep rsync silver -wget tldr tlp +wget +vdirsyncer yad yay @@ -133,6 +138,7 @@ file-roller gcolor3 gedit gedit-plugins +gnome-epub-thumbnailer gparted manjaro-settings-manager mntray diff --git a/overlays/sway/etc/skel/.bashrc b/overlays/sway/etc/skel/.bashrc index 0033ad7ecc242cfba9b8e4d7c160cd1cb2f622c8..70fae1c88b50a274575a239118c97ba5ce4892db 100644 --- a/overlays/sway/etc/skel/.bashrc +++ b/overlays/sway/etc/skel/.bashrc @@ -17,4 +17,5 @@ export SILVER_ICONS=nerd export SILVER_SHELL=${0#-} # bash, zsh, or fish eval "$(silver init)" +source ~/.local/share/fzf-marks/fzf-marks.plugin.bash source ~/.bash_aliases diff --git a/overlays/sway/etc/skel/.config/sway/config b/overlays/sway/etc/skel/.config/sway/config index 0882c9a21823d091a725992acd7256d9931ac01b..6c6846782d30394ff293edb5d8898d2e92ce488a 100644 --- a/overlays/sway/etc/skel/.config/sway/config +++ b/overlays/sway/etc/skel/.config/sway/config @@ -7,8 +7,8 @@ # global variables include /etc/sway/definitions -# user config -include $HOME/.config/sway/config.d/* +# user definitions +include $HOME/.config/sway/user-definitions include /etc/sway/inputs/* include /etc/sway/outputs/* @@ -21,3 +21,6 @@ include /etc/sway/modes/* # include additional configs e.g. to autostart applications include /etc/sway/config.d/* + +# user config +include $HOME/.config/sway/config.d/* diff --git a/overlays/sway/etc/skel/.config/sway/config.d/00-user.conf b/overlays/sway/etc/skel/.config/sway/config.d/00-user.conf index 9d0ea58baf08d9dbd85344d3c5bad9e0b903573d..7c4a008adf6bae75f4ec2c641116a5e6e223ca78 100644 --- a/overlays/sway/etc/skel/.config/sway/config.d/00-user.conf +++ b/overlays/sway/etc/skel/.config/sway/config.d/00-user.conf @@ -2,9 +2,6 @@ # e.g.: # * change modifier key from Win/Pine-Key to Alt: set $mod Mod1 # * change the background image: set $background /usr/share/wallpapers/manjaro-nudes.png -# * change the theme: set $theme /etc/sway/themes/matcha-blue -# * get your current screen name: swaymsg -t get_outputs -# * set the resolution and position for your screens: output HDMI1 pos 0 0 res 1920x1080 -# * set the scaling for your screens: output HDMI1 scale 2 -# * more display settings: https://github.com/swaywm/sway/wiki#display-configuration +# * change the theme: set $theme /usr/share/sway/themes/matcha-blue +# * change waybar position: set $waybar_position bottom # diff --git a/overlays/sway/etc/skel/.config/sway/user-definitions b/overlays/sway/etc/skel/.config/sway/user-definitions new file mode 100644 index 0000000000000000000000000000000000000000..3d61e71a03b5175a7e72682540bc39b5fea3d041 --- /dev/null +++ b/overlays/sway/etc/skel/.config/sway/user-definitions @@ -0,0 +1,2 @@ +# add your custom definitions here + diff --git a/overlays/sway/etc/skel/.config/waybar/config b/overlays/sway/etc/skel/.config/waybar/config index 18edd6bafb0a15cd49c49a47955a223dacef6a34..95b70f66e38f9c0026395bfeb3fd97a76f451531 100644 --- a/overlays/sway/etc/skel/.config/waybar/config +++ b/overlays/sway/etc/skel/.config/waybar/config @@ -13,13 +13,13 @@ "layer": "top", - "position": "top", - // If height property would be not present, it'd be calculated dynamically "height": 30, "modules-left": [ + "custom/menu", "sway/workspaces", + "custom/scratchpad", "sway/mode" ], "modules-center": [ @@ -36,10 +36,10 @@ "pulseaudio", "custom/pacman", "tray", + "custom/help", "clock" ], - // ------------------------------------------------------------------------- // Modules // ------------------------------------------------------------------------- @@ -59,14 +59,15 @@ "ï‰", // Icon: battery-three-quarters "" // Icon: battery-full ], - "tooltip": true + "tooltip": false }, "clock": { "interval": 60, "format": "ï³ {:%e %b %Y %H:%M}", // Icon: calendar-alt "tooltip": true, - "tooltip-format": "<big>{:%B %Y}</big>\n<tt>{calendar}</tt>" + "tooltip-format": "<big>{:%B %Y}</big>\n<tt>{calendar}</tt>", + "on-click": "swaymsg exec \\$calendar" }, "cpu": { @@ -143,7 +144,7 @@ "car": "", "default": ["", ""] }, - "on-click": "pavucontrol" + "on-click": "swaymsg exec \\$pulseaudio" }, "temperature": { @@ -173,6 +174,18 @@ "on-click": "pamac-manager --updates", }, + "custom/menu": { + "format": "", + "on-click": "swaymsg exec \\$menu", + "tooltip": false + }, + + "custom/help": { + "format": "ﲉ", + "on-click": "swaymsg exec \\$help", + "tooltip": false + }, + "bluetooth": { "format": "{icon}", "interval": 30, @@ -182,5 +195,16 @@ }, "on-click": "blueman-manager", "tooltip-format": "{status}" + }, + "custom/scratchpad": { + "interval": 1, + "return-type": "json", + "format" : "{icon}", + "format-icons": { + "one": "ï–¹", + "many": "ï–º" + }, + "exec": "scratchpad.sh", + "on-click": "swaymsg 'scratchpad show'" } } diff --git a/overlays/sway/etc/skel/.config/waybar/style.css b/overlays/sway/etc/skel/.config/waybar/style.css index ef6e2fa22eab13aca547315e8eda36e288b26503..61bdcc5b1915894d2cdf97274c358856466aaadf 100644 --- a/overlays/sway/etc/skel/.config/waybar/style.css +++ b/overlays/sway/etc/skel/.config/waybar/style.css @@ -53,13 +53,15 @@ /* The whole bar */ #waybar { background: @background_color; - color: @dim_text_color; - font-family: "TerminessTTF Nerd Font", sans-serif; + color: @text_color; font-size: 14px; } /* Each module */ #custom-pacman, +#custom-menu, +#custom-help, +#custom-scratchpad, #bluetooth, #battery, #clock, @@ -81,6 +83,10 @@ * Module styles * -------------------------------------------------------------------------- */ +#custom-scratchpad { + background-color: @accent_color; +} + #battery { animation-timing-function: linear; animation-iteration-count: infinite; @@ -107,6 +113,7 @@ #clock { font-weight: bold; + background-color: @accent_color; } #cpu { @@ -121,6 +128,10 @@ color: @error_color; } +#custom-menu { + background-color: @accent_color; +} + #memory { animation-timing-function: linear; animation-iteration-count: infinite; @@ -146,7 +157,6 @@ } #network.disconnected { - margin-top: 3px; color: @warning_color; } @@ -174,6 +184,7 @@ #window { font-weight: bold; margin-right: 25px; + color: @accent_color; } #workspaces button { @@ -183,14 +194,12 @@ padding-left: 10px; padding-right: 10px; color: @accent_color; - font-weight: bold; } #workspaces button.focused { border-color: @accent_color; color: @text_color; background-color: @accent_color; - font-weight: bold; } #workspaces button.urgent { @@ -205,3 +214,7 @@ #bluetooth.disabled { color: @warning_color; } + +#custom-help { + padding-bottom: 2px; +} diff --git a/overlays/sway/etc/skel/.config/wofi/swhelp b/overlays/sway/etc/skel/.config/wofi/swhelp deleted file mode 100644 index 08319137d1bc4616757f578e1111fcf79297dcdc..0000000000000000000000000000000000000000 --- a/overlays/sway/etc/skel/.config/wofi/swhelp +++ /dev/null @@ -1,10 +0,0 @@ -# fixed overlay config for the wofi launcher - -allow_markup=true -no_actions=true -hide_scroll=true -hide_search=true -print_line_num=true -lines=12 -term=termite -width=300 diff --git a/overlays/sway/etc/skel/.config/wofi/swhelp.css b/overlays/sway/etc/skel/.config/wofi/swhelp.css deleted file mode 100644 index e3600a0960a4203c74deddd938891ac6fada98b7..0000000000000000000000000000000000000000 --- a/overlays/sway/etc/skel/.config/wofi/swhelp.css +++ /dev/null @@ -1,22 +0,0 @@ -/* import css definitions for current theme */ -@import url("./theme.css"); - -#outer-box { - border: 1px solid @accent_color; -} - -#input { - border: none; - border-radius: 0px; - visibility: hidden; -} - -#text { - margin-left: 1em; -} - -window { - border: 2px solid @accent_color; - color: @text_color; - border-radius: 5px; -} diff --git a/overlays/sway/etc/skel/.firstrun b/overlays/sway/etc/skel/.firstrun deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/overlays/sway/etc/skel/.local/bin/scratchpad.sh b/overlays/sway/etc/skel/.local/bin/scratchpad.sh new file mode 100755 index 0000000000000000000000000000000000000000..8b2ca24ee06cca9e8cded29bb8573148091ed9ae --- /dev/null +++ b/overlays/sway/etc/skel/.local/bin/scratchpad.sh @@ -0,0 +1,15 @@ +#!/bin/sh +tooltip=$(swaymsg -r -t get_tree | jq -r 'recurse(.nodes[]) | first(select(.name=="__i3_scratch")) | .floating_nodes | .[] | "\(.app_id) | \(.name)"') +count=$(echo -n "$tooltip" | grep -c '^') + +if [[ "$count" -eq 0 ]]; then + exit 1 +elif [[ "$count" -eq 1 ]]; then + class="one" +elif [[ "$count" -gt 1 ]]; then + class="many" +else + class="unknown" +fi + +printf '{"text":"%s", "class":"%s", "alt":"%s", "tooltip":"%s"}\n' "$count" "$class" "$class" "${tooltip//$'\n'/'\n'}" diff --git a/overlays/sway/etc/skel/.local/bin/swhelp.sh b/overlays/sway/etc/skel/.local/bin/swhelp.sh deleted file mode 100755 index 10a04eba6f77379b8b02b842d4b09b458883c007..0000000000000000000000000000000000000000 --- a/overlays/sway/etc/skel/.local/bin/swhelp.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Quick and hacky implementation of an help overlay using wofi -# -# Author: Appelgriebsch -# License: MIT - -PIDFILE=$HOME/.swhelp_visible -FIRST_RUN=$HOME/.firstrun - -if [ -f $PIDFILE ]; then exit 1; fi - -spawn_help_overlay() { -cat <<EOF | wofi --show dmenu --style $HOME/.config/wofi/swhelp.css "$@" - <b>Manjaro ARM Sway Edition</b> - Default Modifier: <b>Alt</b> - New Terminal: <b>\$mod</b> + <b>Enter</b> - Application Launcher: <b>\$mod</b> + <b>d</b> - Command Runner: <b>\$mod</b> + <b>Shift</b> + <b>d</b> - Window Switcher: <b>\$mod</b> + <b>Ctrl</b> + <b>d</b> - Resize Mode: <b>\$mod</b> + <b>r</b> - Screenshot Mode: <b>\$mod</b> + <b>Shift</b> + <b>s</b> - Recording Mode: <b>\$mod</b> + <b>Shift</b> + <b>r</b> - Open Help Overlay: <b>\$mod</b> + <b>?</b> - Close Help Overlay: <b>Escape</b> -EOF -if [ -f $PIDFILE ]; then rm $PIDFILE; fi -if [ -f $FIRST_RUN ]; then rm $FIRST_RUN; fi -} - -for i in "$@" -do -case $i in - --autostart) - AUTOSTART=YES - ;; - *) - # unknown option - ;; -esac -done - -if [ "$AUTOSTART" == "YES" ]; then - if [ ! -f $FIRST_RUN ]; then exit 1; fi -fi - -touch $PIDFILE -spawn_help_overlay "$@" & diff --git a/overlays/sway/etc/skel/.local/share/fzf-marks/LICENSE b/overlays/sway/etc/skel/.local/share/fzf-marks/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..669b712d30cb2b186533df0fcb6fee7332b9b4ac --- /dev/null +++ b/overlays/sway/etc/skel/.local/share/fzf-marks/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Urbain Vaes + +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. diff --git a/overlays/sway/etc/skel/.local/share/fzf-marks/README.md b/overlays/sway/etc/skel/.local/share/fzf-marks/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1837fb0707d927f4b69c3556f3ade87e705de989 --- /dev/null +++ b/overlays/sway/etc/skel/.local/share/fzf-marks/README.md @@ -0,0 +1,97 @@ +# fzf-marks +This plugin can be used to create, delete, and navigate marks in *bash* and *zsh*. +It depends on Junegunn Choi's fuzzy-finder [fzf](https://github.com/junegunn/fzf). + + +(This video was generated with `screenkey -g $(slop -n -f '%g')` and `simplescreenrecorder`.) + +# Installation + +### Zsh + +If you use *zsh*, I recommend installing with a plugin manager. +In the case of [zgen](https://github.com/tarjoilija/zgen), for example, +simply add the following line to your plugin list: +```zsh +zgen load urbainvaes/fzf-marks +``` +### Fish + +If you use *fish*, then you can use [fisher](https://github.com/jorgebucaran/fisher): +```fish +fisher install urbainvaes/fzf-marks +``` + +### Bash + +If you use *bash*, +or if you use *zsh* without a plugin manager, +source the file `fzf-marks.plugin.bash` or `fzf-marks.plugin.zsh` from your shell startup file +to enable the plugin. + + +**Bash installation example**: +```bash +# Clone the git repository in the current directory +git clone https://github.com/urbainvaes/fzf-marks.git + +# Add a line to ~/.bashrc to load the plugin whenever bash starts in interactive mode +echo "source $PWD/fzf-marks/fzf-marks.plugin.bash" >> ~/.bashrc + +# Source the plugin now so we don't have to restart bash to start using it +source fzf-marks/fzf-marks.plugin.bash +``` + +**Enabling completion**: + +In `bash`, completion should be available automatically. +In `zsh`, completion needs to be enabled explicitly before sourcing the plugin. +This is usually done automatically by plugin managers, +but it can also be achieved manually with the following command in your `.zshrc`. +```zsh +autoload -Uz compinit && compinit +``` + +# Usage +The script exposes two functions: + +- **mark \<mark\>**, to register a new mark to the current directory; +- **fzm [\<optional-initial-query\>]**, to jump to or delete a mark using `fzf`. + +Most of the keybindings in the search window are the default fzf ones. +The only additions are + +- **ctrl-y**, to jump to a match; +- **ctrl-t**, to toggle a match for deletion; +- **ctrl-d**, to delete selected matches. + +By default, the plugin binds the key `ctrl-g` to `fzm`. + +# Customization + +| Config | Default | Description | +| ------ | ------- | ----------- | +| `FZF_MARKS_FILE` | `${HOME}/.fzf-marks` | File containing the marks data | +| `FZF_MARKS_COMMAND` | `fzf --height 40% --reverse` | Command used to call `fzf` | +| `FZF_MARKS_JUMP` | `\C-g` (*bash*) or `^g` (*zsh*) | Keybinding to `fzm` | +| `FZF_MARKS_COLOR_LHS` | 39 (default) | ANSI color code of left-hand side | +| `FZF_MARKS_COLOR_RHS` | 36 (cyan) | ANSI color code of right-hand side | +| `FZF_MARKS_COLOR_COLON` | 33 (yellow) | ANSI color code of separator | +| `FZF_MARKS_NO_COLORS` | 0 | Set this to 1 to disable colors | +| `FZF_MARKS_KEEP_ORDER` | 0 | Set this to 1 to keep order of marks | + +See e.g. [here](http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html) for a description of ANSI color codes. + +# FAQ + +**Question**: *Is it possible to limit the fzf search to the mark label, i.e. to exclude the path from the search?* + +Yes, this is possible by passing the options `-n` (for the field number to use for the search) and `-d` (for the delimiter) to `fzf`. +For example, +``` +FZF_MARKS_COMMAND="fzf --height 40% --reverse -n 1 -d ' : '" +``` + +# License + +MIT diff --git a/overlays/sway/etc/skel/.local/share/fzf-marks/conf.d/fzf-marks.plugin.fish b/overlays/sway/etc/skel/.local/share/fzf-marks/conf.d/fzf-marks.plugin.fish new file mode 100644 index 0000000000000000000000000000000000000000..5b07ebccf8c17f6be37f5b5beeaf670db13d0fdb --- /dev/null +++ b/overlays/sway/etc/skel/.local/share/fzf-marks/conf.d/fzf-marks.plugin.fish @@ -0,0 +1,165 @@ +# MIT License + +# Copyright (c) 2019 Marcel Patzwahl, Urbain Vaes + +# 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. + +command -v fzf > /dev/null 2>&1 or return + +if test -z "$FZF_MARKS_FILE" + set -g FZF_MARKS_FILE "$HOME/.fzf-marks" +end + +if test ! -f "$FZF_MARKS_FILE" + touch "$FZF_MARKS_FILE" +end + +if test -z "$FZF_MARKS_COMMAND" + set -l fzf_version (fzf --version | awk -F. '{ print $1 * 1e6 + $2 * 1e3 + $3 }') + set -l minimum_version 16001 + + if test $fzf_version -gt $minimum_version + set -g FZF_MARKS_COMMAND fzf --height 40% --reverse --header=\'ctrl-y:jump, ctrl-t:toggle, ctrl-d:delete\' + else if test $FZF_TMUX -eq 1 + set -l tmux_height $FZF_TMUX_HEIGHT + set -lq tmux_height[1]; or set tmux_height[1] 40 + set -g FZF_MARKS_COMMAND "fzf-tmux -d$tmux_height" + else + set -g FZF_MARKS_COMMAND "fzf" + end +end + +function mark + set -l mark_to_add "$argv : "(pwd) + + if grep -qxFe "$mark_to_add" "$FZF_MARKS_FILE" + echo "** The following mark already exists **" + else + echo "$mark_to_add" >> "$FZF_MARKS_FILE" + echo "** The following mark has been added **" + end + echo "$mark_to_add" | _color_marks +end + +function _handle_symlinks + if test -L $FZF_MARKS_FILE + set -l link (readlink "$FZF_MARKS_FILE") + switch $link + case '/*' + echo $link + case '*' + echo (dirname $FZF_MARKS_FILE)/$link + end + else + echo $FZF_MARKS_FILE + end +end + +function _color_marks + if test "$FZF_MARKS_NO_COLORS" = "1" + cat + else + set -l esc (printf '\033') + set -l c_lhs $FZF_MARKS_COLOR_LHS + set -lq c_lhs[1]; or set c_lhs[1] 39 + set -l c_rhs $FZF_MARKS_COLOR_RHS + set -lq c_rhs[1]; or set c_rhs[1] 36 + set -l c_colon $FZF_MARKS_COLOR_COLON + set -lq c_colon[1]; or set c_colon[1] 33 + sed "s/^\\(.*\\) : \\(.*\\)\$/"$esc"["$c_lhs"m\\1"$esc"[0m "$esc"["$c_colon"m:"$esc"[0m "$esc"["$c_rhs"m\\2"$esc"[0m/" + end +end + +function fzm + set -l marks_del $FZF_MARKS_DELETE + set -lq marks_del[1]; or set marks_del[1] "ctrl-d" + + set lines (_color_marks < $FZF_MARKS_FILE | eval $FZF_MARKS_COMMAND \ + --ansi \ + --expect="$marks_del" \ + --multi \ + --bind=ctrl-y:accept,ctrl-t:toggle \ + --query=$argv \ + --select-1 \ + --tac) + if test -z "$lines" + commandline -f repaint + return 1 + end + set -l key (echo "$lines" | head -1 | string split " ") + if test $marks_del = $key[1] + dmark "-->-->-->" (echo "$key[2..-1]") + else + jump "-->-->-->" (echo "$lines" | tail -1) + end +end + +function jump + if test $argv[1] = "-->-->-->" + set jumpline $argv[2] + else + set jumpline (_color_marks < $FZF_MARKS_FILE | $FZF_MARKS_COMMAND \ + --ansi \ + --bind=ctrl-y:accept \ + --query="$argv" \ + --select-1 \ + --tac) + end + if test -n $jumpline + set -l jumpdir (echo "$jumpline" | sed 's/.*: \(.*\)$/\1/' | sed "s#^~#$HOME#") + set -l bookmarks (_handle_symlinks) + cd $jumpdir + commandline -f repaint + end +end + +function dmark + if test $argv[1] = "-->-->-->" + set marks_to_delete $argv[2] + else + set marks_to_delete (_color_marks < $FZF_MARKS_FILE | $FZF_MARKS_COMMAND \ + -m \ + --ansi \ + --bind=ctrl-y:accept,ctrl-t:toggle \ + --query="$argv" \ + --tac) + end + set -l bookmarks (_handle_symlinks) + for line in $marks_to_delete + set -l line (string replace -a "/" "\/" $line) + perl -n -i -e "print unless /^\Q$line\E\$/" "$bookmarks" + end + if test (echo $marks_to_delete | wc -l) = 1 + echo "** The following mark has been deleted **" + echo "$marks_to_delete" | _color_marks + else + echo "** The following marks have been deleted **" + echo "$marks_to_delete" | _color_marks + end + commandline -f repaint +end + +set -q FZF_MARKS_JUMP; or set FZF_MARKS_JUMP \cg +bind -M insert $FZF_MARKS_JUMP fzm +bind $FZF_MARKS_JUMP fzm + +if test -n "$FZF_MARKS_DMARK" + bind -M insert "$FZF_MARKS_DMARK" dmark + bind "$FZF_MARKS_DMARK" dmark +end diff --git a/overlays/sway/etc/skel/.local/share/fzf-marks/fzf-marks.plugin.bash b/overlays/sway/etc/skel/.local/share/fzf-marks/fzf-marks.plugin.bash new file mode 100644 index 0000000000000000000000000000000000000000..622239184228af43920b18a94ae43c121caf2d4f --- /dev/null +++ b/overlays/sway/etc/skel/.local/share/fzf-marks/fzf-marks.plugin.bash @@ -0,0 +1,351 @@ +# MIT License + +# Copyright (c) 2018 Urbain Vaes + +# 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. + +command -v fzf >/dev/null 2>&1 || return + +if [[ -z ${FZF_MARKS_FILE-} ]] ; then + FZF_MARKS_FILE=${HOME}/.fzf-marks +fi + +if [[ ! -f ${FZF_MARKS_FILE} ]]; then + touch "${FZF_MARKS_FILE}" +fi + +if [[ -z ${FZF_MARKS_COMMAND-} ]] ; then + + _fzm_FZF_VERSION=$(fzf --version | awk -F. '{ print $1 * 1e6 + $2 * 1e3 + $3 }') + _fzm_MINIMUM_VERSION=16001 + + if [[ $_fzm_FZF_VERSION -gt $_fzm_MINIMUM_VERSION ]]; then + FZF_MARKS_COMMAND="fzf --height 40% --reverse" + elif [[ ${FZF_TMUX:-1} -eq 1 ]]; then + FZF_MARKS_COMMAND="fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" + else + FZF_MARKS_COMMAND="fzf" + fi +fi + +function _fzm_setup_completion { + complete -W "$(sed 's/\(.*\) : .*$/"\1"/' < "$FZF_MARKS_FILE")" fzm +} + +function mark { + local mark_to_add + mark_to_add="$* : $(pwd)" + + if grep -qxFe "${mark_to_add}" "${FZF_MARKS_FILE}"; then + echo "** The following mark already exists **" + else + printf '%s\n' "${mark_to_add}" >> "${FZF_MARKS_FILE}" + echo "** The following mark has been added **" + fi + _fzm_color_marks <<< $mark_to_add + _fzm_setup_completion +} + +function _fzm_handle_symlinks { + local fname link + if [ -L "${FZF_MARKS_FILE}" ]; then + link=$(readlink "${FZF_MARKS_FILE}") + case "$link" in + /*) fname="$link";; + *) fname="$(dirname "$FZF_MARKS_FILE")/$link";; + esac + else + fname=${FZF_MARKS_FILE} + fi + printf '%s\n' "${fname}" +} + +function _fzm_color_marks { + if [[ "${FZF_MARKS_NO_COLORS-}" == "1" ]]; then + cat + else + local esc c_lhs c_rhs c_colon + esc=$(printf '\033') + c_lhs=${FZF_MARKS_COLOR_LHS:-39} + c_rhs=${FZF_MARKS_COLOR_RHS:-36} + c_colon=${FZF_MARKS_COLOR_COLON:-33} + sed "s/^\\(.*\\) : \\(.*\\)$/${esc}[${c_lhs}m\\1${esc}[0m ${esc}[${c_colon}m:${esc}[0m ${esc}[${c_rhs}m\\2${esc}[0m/" + fi +} + +function fzm { + local delete_key=${FZF_MARKS_DELETE:-ctrl-d} paste_key=${FZF_MARKS_PASTE:-ctrl-v} + local lines=$(_fzm_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ + --ansi \ + --expect='"$delete_key,$paste_key"' \ + --multi \ + --bind=ctrl-y:accept,ctrl-t:toggle \ + --header='"ctrl-y:jump, ctrl-t:toggle, $delete_key:delete, $paste_key:paste"' \ + --query='"$*"' \ + --select-1 \ + --tac) + if [[ -z "$lines" ]]; then + return 1 + fi + + local key=$(head -1 <<< "$lines") + + if [[ $key == "$delete_key" ]]; then + dmark "-->-->-->" "$(sed 1d <<< "$lines")" + elif [[ $key == "$paste_key" || ! -t 1 ]]; then + pmark "-->-->-->" "$(tail -1 <<< "$lines")" + else + jump "-->-->-->" "$(tail -1 <<< "${lines}")" + fi +} + +function jump { + local jumpline jumpdir bookmarks + if [[ $1 == "-->-->-->" ]]; then + jumpline=$2 + else + jumpline=$(_fzm_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ + --ansi \ + --bind=ctrl-y:accept --header='"ctrl-y:jump"' \ + --query='"$*"' --select-1 --tac) + fi + if [[ -n ${jumpline} ]]; then + jumpdir=$(sed 's/.*: \(.*\)$/\1/;'"s#^~#${HOME}#" <<< $jumpline) + bookmarks=$(_fzm_handle_symlinks) + cd "${jumpdir}" || return + if ! [[ "${FZF_MARKS_KEEP_ORDER}" == 1 ]]; then + perl -n -i -e "print unless /^\\Q${jumpline//\//\\/}\\E\$/" "${bookmarks}" + printf '%s\n' "${jumpline}" >> "${FZF_MARKS_FILE}" + fi + fi +} + +function pmark { + local selected + if [[ $1 == "-->-->-->" ]]; then + selected=$2 + else + selected=$(_fzm_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ + --ansi \ + --bind=ctrl-y:accept --header='"ctrl-y:paste"' \ + --query='"$*"' --select-1 --tac) + fi + if [[ $selected ]]; then + selected=$(sed 's/.*: \(.*\)$/\1/;'"s#^~#${HOME}#" <<< $selected) + local paste_command=${FZF_MARKS_PASTE_COMMAND:-"printf '%s\n'"} + eval -- "$paste_command \"\$selected\"" + fi +} + +function dmark { + local marks_to_delete line bookmarks + if [[ $1 == "-->-->-->" ]]; then + marks_to_delete=$2 + else + marks_to_delete=$(_fzm_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ + -m --ansi \ + --bind=ctrl-y:accept,ctrl-t:toggle --header='"ctrl-y:delete, ctrl-t:toggle"' \ + --query='"$*"' --tac) + fi + bookmarks=$(_fzm_handle_symlinks) + + if [[ -n ${marks_to_delete} ]]; then + while IFS='' read -r line; do + perl -n -i -e "print unless /^\\Q${line//\//\\/}\\E\$/" "${bookmarks}" + done <<< "$marks_to_delete" + + [[ $(wc -l <<< "${marks_to_delete}") == 1 ]] \ + && echo "** The following mark has been deleted **" \ + || echo "** The following marks have been deleted **" + _fzm_color_marks <<< $marks_to_delete + fi + _fzm_setup_completion +} + +if ((BASH_VERSINFO[0] >= 4)); then + # Widget for Bash 4.0+ + + # bashbug https://lists.gnu.org/archive/html/bug-bash/2018-04/msg00040.html + function _fzm_widget_has_readline_point_bug { + [[ BASH_VERSINFO[0] -lt 5 && ! $_ble_attached ]] + } + function _fzm_widget_has_readline_mark { + [[ BASH_VERSINFO[0] -ge 5 || $_ble_attached ]] + } + function _fzm_widget_insert { + local insert=$1 + + # Work around bashbug + if _fzm_widget_has_readline_point_bug; then + # Convert READLINE_POINT from bytes to characters + local old_lc_all=$LC_ALL old_lc_ctype=$LC_CTYPE + local LC_ALL= LC_CTYPE=C + local head=${READLINE_LINE::READLINE_POINT} + LC_ALL=$old_lc_all LC_CTYPE=$old_lc_ctype + READLINE_POINT=${#head} + fi + + READLINE_LINE=${READLINE_LINE::READLINE_POINT}$insert${READLINE_LINE:READLINE_POINT} + if _fzm_widget_has_readline_mark && ((READLINE_MARK > READLINE_POINT)); then + # Bash 5.0 has new variable READLINE_MARK + ((READLINE_MARK += ${#insert})) + fi + ((READLINE_POINT += ${#insert})) + + # Work around bashbug + if _fzm_widget_has_readline_point_bug; then + # Convert READLINE_POINT from characters to bytes + local head=${READLINE_LINE::READLINE_POINT} + local LC_ALL= LC_CTYPE=C + READLINE_POINT=${#head} + LC_ALL=$old_lc_all LC_CTYPE=$old_lc_ctype + fi + } 2>/dev/null # Suppress locale error messages + function _fzm_widget_stash_line { + _fzm_line=$READLINE_LINE + _fzm_point=$READLINE_POINT + READLINE_LINE= + READLINE_POINT=0 + if _fzm_widget_has_readline_mark; then + _fzm_mark=$READLINE_MARK + READLINE_MARK=0 + fi + } + function _fzm_widget_pop_line { + READLINE_LINE=$_fzm_line + READLINE_POINT=$_fzm_point + if _fzm_widget_has_readline_mark; then + READLINE_MARK=$_fzm_mark + fi + } + function _fzm-widget { + local pwd=$PWD + local FZF_MARKS_PASTE_COMMAND=_fzm_widget_insert + fzm + + if [[ $PWD != "$pwd" ]]; then + # Force the prompt update + _fzm_widget_stash_line + bind "\"$_fzm_key2\": \"\C-m$_fzm_key3\"" + bind -x "\"$_fzm_key3\": _fzm_widget_pop_line" + else + bind "\"$_fzm_key2\": \"\"" + fi + } + +else + # Widget for Bash 3.0-3.2 + function _fzm_widget_untranslate_keyseq { + local value=$1 + if [[ $value == *[\'\"$'\001'-$'\037']* ]]; then + local a b + a='\' b='\\' value=${value//$a/$b} + a='"' b='\"' value=${value//$a/$b} + a=$'\001' b='\C-q\001' value=${value//$a/$b} + a=$'\002' b='\C-q\002' value=${value//$a/$b} + a=$'\003' b='\C-q\003' value=${value//$a/$b} + a=$'\004' b='\C-q\004' value=${value//$a/$b} + a=$'\005' b='\C-q\005' value=${value//$a/$b} + a=$'\006' b='\C-q\006' value=${value//$a/$b} + a=$'\007' b='\C-q\007' value=${value//$a/$b} + a=$'\010' b='\C-q\010' value=${value//$a/$b} + a=$'\011' b='\C-q\011' value=${value//$a/$b} + a=$'\012' b='\C-q\012' value=${value//$a/$b} + a=$'\013' b='\C-q\013' value=${value//$a/$b} + a=$'\014' b='\C-q\014' value=${value//$a/$b} + a=$'\015' b='\C-q\015' value=${value//$a/$b} + a=$'\016' b='\C-q\016' value=${value//$a/$b} + a=$'\017' b='\C-q\017' value=${value//$a/$b} + a=$'\020' b='\C-q\020' value=${value//$a/$b} + a=$'\021' b='\C-q\021' value=${value//$a/$b} + a=$'\022' b='\C-q\022' value=${value//$a/$b} + a=$'\023' b='\C-q\023' value=${value//$a/$b} + a=$'\024' b='\C-q\024' value=${value//$a/$b} + a=$'\025' b='\C-q\025' value=${value//$a/$b} + a=$'\026' b='\C-q\026' value=${value//$a/$b} + a=$'\027' b='\C-q\027' value=${value//$a/$b} + a=$'\030' b='\C-q\030' value=${value//$a/$b} + a=$'\031' b='\C-q\031' value=${value//$a/$b} + a=$'\032' b='\C-q\032' value=${value//$a/$b} + a=$'\033' b='\C-q\033' value=${value//$a/$b} + a=$'\034' b='\C-q\034' value=${value//$a/$b} + a=$'\035' b='\C-q\035' value=${value//$a/$b} + a=$'\036' b='\C-q\036' value=${value//$a/$b} + a=$'\037' b='\C-q\037' value=${value//$a/$b} + fi + _fzm_keyseq=$value + } + function _fzm-widget { + local pwd=$PWD + local FZF_MARKS_PASTE_COMMAND=_fzm_widget_untranslate_keyseq _fzm_keyseq= + fzm + + if [[ $PWD != "$pwd" ]]; then + # Force the prompt update + _fzm_keyseq=' \C-b\C-k \C-u\C-m\C-y\C-?\e \C-y\ey\C-x\C-x\C-d'$_fzm_keyseq + fi + bind "\"$_fzm_key2\": \"$_fzm_keyseq\"" + } +fi + +# Widget for ble.sh +function ble/widget/fzm { + ble/widget/.hide-current-line + ble/util/buffer.flush >&2 + + local pwd=$PWD + local FZF_MARKS_PASTE_COMMAND=ble/widget/insert-string + fzm + + # Force the prompt update + [[ $PWD != "$pwd" ]] && ble/prompt/clear +} + +function _fzm_setup_bindings { + local jump_key=${FZF_MARKS_JUMP:-'\C-g'} + if ((${_ble_version:-0} >= 400)); then + ble-bind -f keyseq:"$jump_key" 'fzm' + else + # Intiialize special keys used for key bindings + _fzm_key1='\200' + _fzm_key2='\201' + _fzm_key3='\202' + local locale=${LC_ALL:-${LC_CTYPE:-$LANG}} + local rex_utf8='\.([uU][tT][fF]-?8)$' + if [[ $locale =~ $rex_utf8 ]]; then + # Change keys for UTF-8 encodings: + # Two-byte sequence does not work for Bash 3 and 4. + # \xC0-\xC1 and \xF5-\xFF are unused bytes in UTF-8. + # Bash 4 unintendedly exits with \xFE-\xFF. + _fzm_key1='\xC0' + _fzm_key2='\xC1' + _fzm_key3='\xFD' + fi + + bind -x "\"$_fzm_key1\": _fzm-widget" + bind "\"$jump_key\":\"$_fzm_key1$_fzm_key2\"" + fi + + if [[ ${FZF_MARKS_DMARK-} ]]; then + bind -x "\"${FZF_MARKS_DMARK}\": dmark" + fi +} + +_fzm_setup_bindings +_fzm_setup_completion diff --git a/overlays/sway/etc/skel/.local/share/fzf-marks/fzf-marks.plugin.zsh b/overlays/sway/etc/skel/.local/share/fzf-marks/fzf-marks.plugin.zsh new file mode 100644 index 0000000000000000000000000000000000000000..778e99653baa2e828b587b205826de51ea0833ff --- /dev/null +++ b/overlays/sway/etc/skel/.local/share/fzf-marks/fzf-marks.plugin.zsh @@ -0,0 +1,210 @@ +# Copyright (c) 2018 Urbain Vaes + +# 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. + +command -v fzf >/dev/null 2>&1 || return + +if [[ -z "${FZF_MARKS_FILE-}" ]] ; then + FZF_MARKS_FILE="${HOME}/.fzf-marks" +fi + +if [[ ! -f "${FZF_MARKS_FILE}" ]]; then + touch "${FZF_MARKS_FILE}" +fi + +if [[ -z "${FZF_MARKS_COMMAND-}" ]] ; then + + _fzm_FZF_VERSION=$(fzf --version | awk -F. '{ print $1 * 1e6 + $2 * 1e3 + $3 }') + _fzm_MINIMUM_VERSION=16001 + + if [[ $_fzm_FZF_VERSION -gt $_fzm_MINIMUM_VERSION ]]; then + FZF_MARKS_COMMAND="fzf --height 40% --reverse" + elif [[ ${FZF_TMUX:-1} -eq 1 ]]; then + FZF_MARKS_COMMAND="fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" + else + FZF_MARKS_COMMAND="fzf" + fi +fi + +function mark { + local mark_to_add + mark_to_add="$* : $(pwd)" + + if grep -qxFe "${mark_to_add}" "${FZF_MARKS_FILE}"; then + echo "** The following mark already exists **" + else + printf '%s\n' "${mark_to_add}" >> "${FZF_MARKS_FILE}" + echo "** The following mark has been added **" + fi + _fzm_color_marks <<< "${mark_to_add}" +} + +function _fzm_handle_symlinks { + local fname link + if [ -L "${FZF_MARKS_FILE}" ]; then + link=$(readlink "${FZF_MARKS_FILE}") + case "$link" in + /*) fname="$link";; + *) fname="$(dirname "$FZF_MARKS_FILE")/$link";; + esac + else + fname=${FZF_MARKS_FILE} + fi + printf '%s\n' "${fname}" +} + +# Ensure precmds are run after cd +function redraw-prompt { + local precmd + for precmd in $precmd_functions; do + $precmd + done + zle reset-prompt +} +zle -N redraw-prompt + +function _fzm_color_marks { + if [[ "${FZF_MARKS_NO_COLORS-}" == "1" ]]; then + cat + else + local esc c_lhs c_rhs c_colon + esc=$(printf '\033') + c_lhs=${FZF_MARKS_COLOR_LHS:-39} + c_rhs=${FZF_MARKS_COLOR_RHS:-36} + c_colon=${FZF_MARKS_COLOR_COLON:-33} + sed "s/^\\(.*\\) : \\(.*\\)$/${esc}[${c_lhs}m\\1${esc}[0m ${esc}[${c_colon}m:${esc}[0m ${esc}[${c_rhs}m\\2${esc}[0m/" + fi +} + +function _fzm_paste_command { + local directory="$1" + LBUFFER="${LBUFFER}$directory" + zle reset-prompt > /dev/null 2>&1 +} + +function fzm { + local delete_key=${FZF_MARKS_DELETE:-ctrl-d} paste_key=${FZF_MARKS_PASTE:-ctrl-v} + local lines=$(_fzm_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ + --ansi \ + --expect='"$delete_key,$paste_key"' \ + --multi \ + --bind=ctrl-y:accept,ctrl-t:toggle \ + --header='"ctrl-y:jump, ctrl-t:toggle, ${delete_key}:delete, ${paste_key}:paste"' \ + --query='"$*"' \ + --select-1 \ + --tac) + if [[ -z "$lines" ]]; then + zle && zle redraw-prompt + return 1 + fi + + local key=$(head -1 <<< "$lines") + + if [[ $key == "$delete_key" ]]; then + dmark "-->-->-->" "$(sed 1d <<< "$lines")" + elif [[ $key == "$paste_key" || ! -t 1 ]]; then + zle && local FZF_MARKS_PASTE_COMMAND=_fzm_paste_command + pmark "-->-->-->" "$(tail -1 <<< "$lines")" + else + jump "-->-->-->" "$(tail -1 <<< "${lines}")" + fi +} + +function jump { + local jumpline jumpdir bookmarks + if [[ $1 == "-->-->-->" ]]; then + jumpline=$2 + else + jumpline=$(_fzm_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ + --ansi \ + --bind=ctrl-y:accept --header='"ctrl-y:jump"' \ + --query='"$*"' --select-1 --tac) + fi + if [[ -n ${jumpline} ]]; then + jumpdir=$(sed 's/.*: \(.*\)$/\1/;'"s#^~#${HOME}#" <<< "$jumpline") + bookmarks=$(_fzm_handle_symlinks) + cd "${jumpdir}" || return + if ! [[ "${FZF_MARKS_KEEP_ORDER}" == 1 ]]; then + perl -n -i -e "print unless /^\\Q${jumpline//\//\\/}\\E\$/" "${bookmarks}" + printf '%s\n' "${jumpline}" >> "${FZF_MARKS_FILE}" + fi + fi + zle && zle redraw-prompt +} + +function pmark { + local selected + if [[ $1 == "-->-->-->" ]]; then + selected=$2 + else + selected=$(_fzm_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ + --ansi \ + --bind=ctrl-y:accept --header='"ctrl-y:paste"' \ + --query='"$*"' --select-1 --tac) + fi + if [[ $selected ]]; then + selected=$(sed 's/.*: \(.*\)$/\1/;'"s#^~#${HOME}#" <<< "$selected") + local paste_command=${FZF_MARKS_PASTE_COMMAND:-"printf '%s\n'"} + eval -- "$paste_command \"\$selected\"" + fi +} + +function dmark { + local marks_to_delete line bookmarks + if [[ $1 == "-->-->-->" ]]; then + marks_to_delete=$2 + else + marks_to_delete=$(_fzm_color_marks < "${FZF_MARKS_FILE}" | eval ${FZF_MARKS_COMMAND} \ + -m --ansi \ + --bind=ctrl-y:accept,ctrl-t:toggle --header='"ctrl-y:delete, ctrl-t:toggle"' \ + --query='"$*"' --tac) + fi + bookmarks=$(_fzm_handle_symlinks) + + if [[ -n ${marks_to_delete} ]]; then + while IFS='' read -r line; do + perl -n -i -e "print unless /^\\Q${line//\//\\/}\\E\$/" "${bookmarks}" + done <<< "$marks_to_delete" + + [[ $(wc -l <<< "${marks_to_delete}") == 1 ]] \ + && echo "** The following mark has been deleted **" \ + || echo "** The following marks have been deleted **" + _fzm_color_marks <<< "${marks_to_delete}" + fi + zle && zle reset-prompt +} + +zle -N dmark +zle -N fzm + +bindkey ${FZF_MARKS_JUMP:-'^g'} fzm +if [ "${FZF_MARKS_DMARK-}" ]; then + bindkey ${FZF_MARKS_DMARK} dmark +fi + +command -v compdef >/dev/null 2>&1 || return +# Completion: for documentation, see e.g. +# https://mads-hartmann.com/2017/08/06/writing-zsh-completion-scripts.html +# https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#user-content-actions +function _fzm { + _arguments -C \ + "1: :(($(sed "s/\\(.*\\) : \\(.*\\)/'\1'\\\\:'\2'/" < ~/.fzf-marks)))" \ +} + +compdef _fzm fzm diff --git a/overlays/sway/etc/skel/.local/share/fzf-marks/init.zsh b/overlays/sway/etc/skel/.local/share/fzf-marks/init.zsh new file mode 120000 index 0000000000000000000000000000000000000000..923fa653589743d1e13b4db3c712be0227cb81b6 --- /dev/null +++ b/overlays/sway/etc/skel/.local/share/fzf-marks/init.zsh @@ -0,0 +1 @@ +fzf-marks.plugin.zsh \ No newline at end of file diff --git a/overlays/sway/etc/skel/README.md b/overlays/sway/etc/skel/README.md index 3479e760f235f2994a5f4acfc184934792daac88..577d21b7339637a33c716daa1500aad273a032ca 100644 --- a/overlays/sway/etc/skel/README.md +++ b/overlays/sway/etc/skel/README.md @@ -28,7 +28,6 @@ Sway has up to ten different workspaces that can be freely arranged on the avail - open a new terminal window: **$mod** + **Enter** - open the application launcher: **$mod** + **d** -- open the run command: **$mod** + **Shift** + **d** - kill the application (forcefully): **$mod** + **Shift** + **q** ## Using Workspaces diff --git a/overlays/sway/etc/sway/config.d/98-application-defaults b/overlays/sway/etc/sway/config.d/98-application-defaults index 8243b8563b2220187b3926a910601a75c6c28c40..8007ad4a1cf0a911ee7926c7c4a8aac67dd3aa2b 100644 --- a/overlays/sway/etc/sway/config.d/98-application-defaults +++ b/overlays/sway/etc/sway/config.d/98-application-defaults @@ -4,8 +4,5 @@ for_window [app_id="floating_shell_landscape"] floating enable, border pixel 1, for_window [app_id="pavucontrol"] floating enable, border pixel 1, sticky enable, resize set width 60 ppt height 80 ppt for_window [app_id="pamac-manager"] floating enable, border pixel 1, sticky enable, resize set width 80 ppt height 60 ppt for_window [app_id="blueman-manager"] floating enable, border pixel 1, sticky enable, resize set width 60 ppt height 80 ppt -for_window [app_id="powersupply"] floating enable, border pixel 1, sticky enable, resize set width 60 ppt height 80 ppt -for_window [instance="lxappearance"] floating enable, border pixel 1, sticky enable, resize set width 80 ppt height 60 ppt -for_window [title="File Operation Progress"] floating enable, border pixel 1, sticky enable, resize set width 80 ppt height 60 ppt for_window [app_id="firefox" title="Library"] floating enable, border pixel 1, sticky enable, resize set width 60 ppt height 80 ppt for_window [app_id="thunderbird" title=".*Reminder"] floating enable, border pixel 1, sticky enable, resize set width 60 ppt height 80 ppt diff --git a/overlays/sway/etc/sway/config.d/99-autostart-applications b/overlays/sway/etc/sway/config.d/99-autostart-applications index 7ae244c6f8f9566925c71f6b5966fe9cbfeb26a8..09bfd85b413d542c0d1e0b8a92d346e8b5e411ab 100644 --- a/overlays/sway/etc/sway/config.d/99-autostart-applications +++ b/overlays/sway/etc/sway/config.d/99-autostart-applications @@ -8,5 +8,4 @@ exec { exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec --no-startup-id mako exec --no-startup-id mntray -exec --no-startup-id $help --autostart diff --git a/overlays/sway/etc/sway/definitions b/overlays/sway/etc/sway/definitions index 39b0d8c77b4f880bb5408cfc8ed3c604d7caf62e..ccdcd964c57d260f3cef3217841a591530c17ed7 100644 --- a/overlays/sway/etc/sway/definitions +++ b/overlays/sway/etc/sway/definitions @@ -20,9 +20,8 @@ set $term_float_landscape $term --name=floating_shell_landscape --exec # 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 $appmenu wofi --show "drun,run" --prompt "Application Launcher" --term $term | xargs swaymsg exec -- +set $menu wofi --show "drun,run" -I --exec-search --prompt "Application Launcher" --term $term | xargs swaymsg exec -- set $selwin sws.sh --dmenu-cmd "wofi --show dmenu" --format "%W | %A - %T" -set $help swhelp.sh --conf $HOME/.config/wofi/swhelp --location 7 --xoffset 15 --yoffset -30 ### Lockscreen configuration # @@ -46,6 +45,15 @@ set $statusbar waybar # shutdown command set $shutdown wlogout --buttons-per-row 3 +# pulseaudio command +set $pulseaudio pavucontrol + +# help command +set $help $term_float_portrait "bat $HOME/README.md" + +# calendar application +set $calendar $term_float_portrait "khal interactive" + # cpu / mem monitors set $cpu_mon htop --sort-key=PERCENT_CPU set $mem_mon htop --sort-key=PERCENT_MEM diff --git a/overlays/sway/etc/sway/modes/default b/overlays/sway/etc/sway/modes/default index 4684944311e775068d5a8f95e8272d352a4ff932..406386702a7439d2de6ba8538a52be5b0bb647b5 100644 --- a/overlays/sway/etc/sway/modes/default +++ b/overlays/sway/etc/sway/modes/default @@ -9,7 +9,7 @@ bindsym $mod+Return exec $term bindsym $mod+Shift+q kill ## Launch // Application Launcher ## -bindsym $mod+d exec $appmenu +bindsym $mod+d exec $menu ## Launch // Window Switcher ## bindsym $mod+Ctrl+d exec $selwin