From 66585f6d20eae5a89283dbeec676004ffec1e0fe Mon Sep 17 00:00:00 2001 From: Max Richter Date: Sun, 28 Nov 2021 16:19:50 +0100 Subject: [PATCH] feat: switch from rofi to wofi --- configs/nvim/lua/plugins.lua | 4 +- configs/rofi/rofi-audio-menu | 39 ++ configs/sway/config | 33 +- configs/sway/config_editor.sh | 2 + configs/waybar/config | 3 +- configs/waybar/media.log | 549 +++++++++++++++++++++++++++++ configs/wofi/config | 6 + configs/wofi/select-vpn.sh | 57 +++ configs/wofi/select-wifi.sh | 105 ++++++ configs/wofi/style.css | 41 +++ configs/wofi/sway-select-window.sh | 25 ++ configs/{sway => wofi}/swytcher.sh | 59 +--- configs/wofi/web-search.sh | 33 ++ configs/wofi/wofi-power-menu.sh | 16 + 14 files changed, 910 insertions(+), 62 deletions(-) create mode 100755 configs/rofi/rofi-audio-menu create mode 100755 configs/sway/config_editor.sh create mode 100644 configs/wofi/config create mode 100755 configs/wofi/select-vpn.sh create mode 100755 configs/wofi/select-wifi.sh create mode 100644 configs/wofi/style.css create mode 100755 configs/wofi/sway-select-window.sh rename configs/{sway => wofi}/swytcher.sh (68%) create mode 100755 configs/wofi/web-search.sh create mode 100755 configs/wofi/wofi-power-menu.sh diff --git a/configs/nvim/lua/plugins.lua b/configs/nvim/lua/plugins.lua index ef7dd68..e4103b6 100644 --- a/configs/nvim/lua/plugins.lua +++ b/configs/nvim/lua/plugins.lua @@ -25,6 +25,7 @@ return require("packer").startup(function() use "tpope/vim-fugitive" use "tpope/vim-surround" + use "lambdalisue/suda.vim" use "editorconfig/editorconfig-vim" -- Code Navigation @@ -55,7 +56,8 @@ return require("packer").startup(function() } -- Syntax / Autocomplete - use "neovim/nvim-lspconfig" + use "terminalnode/sway-vim-syntax" + use "neovim/nvim-lspconfig" use "github/copilot.vim" use "hrsh7th/nvim-cmp" use "hrsh7th/cmp-nvim-lsp" diff --git a/configs/rofi/rofi-audio-menu b/configs/rofi/rofi-audio-menu new file mode 100755 index 0000000..9d1b9fe --- /dev/null +++ b/configs/rofi/rofi-audio-menu @@ -0,0 +1,39 @@ +#!/bin/bash + +set -e + +# FEATURES +# - Doesn't show the sink that is already the default +# - Automatically switches all running input sinks when switching the default sink + +# Get the current default sink +SINK_DEFAULT=$(pactl info | ag "Default Sink" | ag -o "(?!.*:)[^\s].*") +# Get the audio sink names +SINK_NAMES=$(pactl list sinks | ag Name | cut --complement -c 1-7) + +# Get the index of the default sink +DEFAULT_INDEX=$(printf "%s" "$SINK_NAMES" | ag --number "$SINK_DEFAULT" | sed 's/:.*//' ) + +# Get the audio sink descriptions +SINK_DESCRIPTIONS=$(pactl list sinks | ag Description | cut --complement -c 1-13 | sed 's/^ \+//' | sed 's/ \+$//') +# Get all the programs that revieve the audio from the sinks +SINK_INPUTS=$(pactl list sink-inputs | ag "Sink Input #") + +# Get the descriptions from the sinks without the default sink to display to the user and have the user pick a sink +SINK_DESCRIPTION=$(printf "%s" "$SINK_DESCRIPTIONS" | sed "${DEFAULT_INDEX}d" | dmenu -i -fn "Roboto Mono for Powerline-11" -p "Select sink:") +SINK_DESCRIPTION=$(printf "%s" "$SINK_DESCRIPTION" | sed 's/(/\\(/' | sed 's/)/\\)/') + +# Get the index for the answer that the user wrote +DESCRIPTION_INDEX=$(printf "%s\n" "$SINK_DESCRIPTIONS" | ag --number "$SINK_DESCRIPTION" | sed 's/:.*//') +DESCRIPTION_INDEX=$((DESCRIPTION_INDEX - 1)) # Correct the index hihi + +# Set the default sink +pactl set-default-sink $DESCRIPTION_INDEX + +# Change all the ouputs for the programs that are using the default sink +printf "%s\n" "$SINK_INPUTS" | while read -r SINK_INPUT +do + # Get the index for the program + SINK_INPUT_INDEX=$(printf "%s" "$SINK_INPUT" | ag -o "(?!Sink Input#)[0-9]+") + pactl move-sink-input "$SINK_INPUT_INDEX" "$DESCRIPTION_INDEX" +done diff --git a/configs/sway/config b/configs/sway/config index 470b6df..06b0c2f 100644 --- a/configs/sway/config +++ b/configs/sway/config @@ -1,3 +1,5 @@ +# vi: ft=conf + # Default config for sway # # Copy this to ~/.config/sway/config and edit it to your liking. @@ -8,19 +10,27 @@ # # 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 alacritty -set $menu "rofi -combi-modi window,drun,ssh,run -show combi -show-icons" -set $powermenu "rofi -show p -modi p:~/.dotfiles/configs/rofi/rofi-power-menu -lines 6" +# Some menus +set $wofi_scripts ~/.config/wofi +set $quickmenu wofi --show drun + +# Screenshot section set $screenclip slurp | grim -g - ~/Pictures/Screenshots/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png set $screenshot grim ~/Pictures/screenshots/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png set $windowshot swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | $screenclip + +# Default Programs +set $term alacritty +set $explorer nautilus +set $config_editor ~/.config/sway/config_editor.sh set $settings gnome-control-center set $toggle_layout ~/.config/sway/toggle_layout.sh set $toggle_gaps ~/.config/sway/toggle_gaps.sh @@ -80,13 +90,15 @@ output * bg `find ~/.customization/background -type f | shuf -n 1` fill # # Basics: # - bindsym $mod+q exec $powermenu + bindsym $mod+d exec $quickmenu + bindsym $mod+q kill + bindsym $mod+Shift+q exec $wofi_scripts/wofi-power-menu.sh bindsym $mod+Return exec $term - bindsym $mod+Shift+q kill - bindsym $mod+d exec $menu - bindsym $mod+e exec nautilus - - # Drag and resize floating windows with mouse right/left drag + bindsym $mod+e exec $explorer + bindsym $mod+Comma exec $settings + bindsym $mod+Shift+Comma exec $config_editor + + # Drag and resize floating windows with mouse right/left drag floating_modifier $mod normal # Reload the configuration file @@ -181,7 +193,6 @@ output * bg `find ~/.customization/background -type f | shuf -n 1` fill # Switch the current container between different layout styles bindsym $mod+w exec $toggle_layout bindsym $mod+g exec $toggle_gaps - bindsym $mod+Comma exec $settings # Make the current focus fullscreen bindsym $mod+f fullscreen @@ -204,7 +215,7 @@ output * bg `find ~/.customization/background -type f | shuf -n 1` fill bindsym $mod+s exec $screenshot - bindsym Alt+Tab exec rofi -show window -modi window + bindsym $mod+Tab exec $wofi_scripts/sway-select-window.sh # # Scratchpad: # diff --git a/configs/sway/config_editor.sh b/configs/sway/config_editor.sh new file mode 100755 index 0000000..f1429fc --- /dev/null +++ b/configs/sway/config_editor.sh @@ -0,0 +1,2 @@ +#!/bin/zsh +alacritty -e zsh -c "/home/jim/.asdf/shims/nvim ~/.dotfiles" diff --git a/configs/waybar/config b/configs/waybar/config index 7c4673a..06eef37 100644 --- a/configs/waybar/config +++ b/configs/waybar/config @@ -77,7 +77,8 @@ }, "custom/clock": { "exec": "date +'%H:%M'", - "interval": 10 + "interval": 10, + "on-click": "nm-applet" }, "cpu": { "format": "{usage}% ", diff --git a/configs/waybar/media.log b/configs/waybar/media.log index 35247ae..b51703b 100644 --- a/configs/waybar/media.log +++ b/configs/waybar/media.log @@ -1133,3 +1133,552 @@ __main__ DEBUG Arguments received {'verbose': 0, 'player': None} __main__ DEBUG Received signal to stop, exiting __main__ DEBUG Received signal to stop, exiting __main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ INFO Received new metadata +__main__ DEBUG Initialize player: chromium +__main__ INFO Writing output +__main__ DEBUG Initialize player: chromium +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ DEBUG Initialize player: chromium +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Initialize player: chromium +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Initialize player: chromium +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Received new playback status +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new playback status +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ INFO Received new metadata +__main__ INFO Writing output +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ INFO Player has vanished +__main__ INFO Player has vanished +__main__ INFO Player has vanished +__main__ INFO Player has vanished +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Received signal to stop, exiting +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} +__main__ DEBUG Arguments received {'verbose': 0, 'player': None} diff --git a/configs/wofi/config b/configs/wofi/config new file mode 100644 index 0000000..c8f55da --- /dev/null +++ b/configs/wofi/config @@ -0,0 +1,6 @@ +allow_images=true +allow_markup=true +width=500 +dynamic_lines=true +term=allacritty +insensitive=true diff --git a/configs/wofi/select-vpn.sh b/configs/wofi/select-vpn.sh new file mode 100755 index 0000000..4e5cfb0 --- /dev/null +++ b/configs/wofi/select-vpn.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# Connect to VPN connections + +# Starts a scan of available broadcasting SSIDs +# nmcli dev wifi rescan +export LC_ALL="en_US.UTF-8" +export LANG="en_US.UTF-8" +export LANGUAGE="en_US:en" + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +FIELDS=NAME,TYPE,STATE +POSITION=0 +XOFF=-30 +LOC=3 +CACHE=~/.local/tmp/vpn-wofi +WWIDTH=340 + +LIST=$(nmcli --fields "$FIELDS" connection show | awk \ + -F "[ ]{2,}" \ + '$2 ~ /vpn/ { + sub(/activated/, ""); + sub(/activating/, ""); + sub(/--/, ""); + printf "%-30s\t%s\n", $1,$3 }') + +# Dynamically change the height of the rofi menu +LINENUM=$(echo "$LIST" | wc -l) + +WHEIGHT=$((30*$LINENUM)) + +CHENTRY=$(echo -e "$LIST" | uniq -u | \ + wofi -i \ + --dmenu \ + -p "Choose a VPN connection: " \ + --width "$WWIDTH" \ + --height $WHEIGHT \ + --cache-file ${CACHE} \ + --location $LOC \ + --xoffset $XOFF | \ + sed -e 's/<[^>]*>//g') + +rm ${CACHE} + +ACTIVE=$(echo $CHENTRY | awk -F "[ ]{2,}" '{print //}') + +VPNID=$(echo "$CHENTRY" | awk -F "[ ]{2,}" '{print $1}') + +# It is assumed that if the connection is in active, then +# the user wants to deactivate it +if [[ $ACTIVE =~ 1 ]]; then + nmcli connection down "$VPNID" +else + nmcli connection up "$VPNID" +fi + +pkill -SIGRTMIN+2 waybar diff --git a/configs/wofi/select-wifi.sh b/configs/wofi/select-wifi.sh new file mode 100755 index 0000000..6877d06 --- /dev/null +++ b/configs/wofi/select-wifi.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +# Connect to WIFI +# Modified from https://github.com/zbaylin/rofi-wifi-menu/blob/master/rofi-wifi-menu.sh + +# export LC_ALL="en_US.UTF-8" +export LANG="en_US.UTF-8" +export LANGUAGE="en_US:en" +# Starts a scan of available broadcasting SSIDs +# nmcli dev wifi rescan + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# FIELDS=SSID,SECURITY,BARS,ACTIVE +FIELDS=SSID,BARS,ACTIVE,SECURITY +POSITION=0 +XOFF=-30 +LOC=3 +CACHE=~/.local/tmp/wifi-wofi +WWIDTH=370 +MAXHEIGHT=1000 + +LIST=$(nmcli --fields "$FIELDS" device wifi list | sed '/^--/d' | \ + awk -F "[ ]{2,}" '/SSID/ {next} {; + sub(/yes/, "", $3); + sub(/no/, "", $3); + if ($4 == "--") $4=""; else $4=""; + printf "%-4s %-26s %s %s\n", $2,$1,$3,$4 }') + +# Bluetooth connections +LISTB=$(nmcli --fields NAME,TYPE,ACTIVE con show | \ + awk -F "[ ]{2,}" '/bluetooth/ {; + sub(/yes/, "", $3); + sub(/no/, "", $3); + printf " %-26s %s \n", $1,$3 }') + +# Gives a list of known connections so we can parse it later +KNOWNCON=$(nmcli connection show | awk -F '[[:space:]][[:space:]]+' '{printf "%s\n", $1}') + +# Really janky way of telling if there is currently a connection +CONSTATE=$(nmcli -fields WIFI g | awk '/enabled|disabled/ { print $0}') + +CURRSSID=$(LANGUAGE=C nmcli -t -f active,ssid dev wifi | awk -F: '$1 ~ /^yes/ {print $2}') + +if [[ ! -z $CURRSSID ]]; then + HIGHLINE=$(echo "$(echo "$LIST" | awk -F "[ ]{2,}" '{print $2}' | grep -Fxn -m 1 "$CURRSSID" | awk -F ":" '{print $1}') + 1" | bc ) +fi + +LINENUM=$(echo -e "toggle\nmanual\n${LISTB}\n${LIST}" | wc -l) + +# If there are more than 20 SSIDs, the menu will still only have 20 lines +if [ "$LINENUM" -gt 20 ] && [[ "$CONSTATE" =~ "enabled" ]]; then + LINENUM=20 +elif [[ "$CONSTATE" =~ "disabled" ]]; then + LINENUM=1 +fi + + +if [[ "$CONSTATE" =~ "enabled" ]]; then + TOGGLE="toggle off" +elif [[ "$CONSTATE" =~ "disabled" ]]; then + TOGGLE="toggle on" +fi + +CHENTRY=$(echo -e "$TOGGLE\nmanual\n$LISTB\n$LIST" | uniq -u | \ + wofi -i --dmenu -p "Wi-Fi SSID: " --width "$WWIDTH" --lines ${LINENUM} --cache-file /dev/null --location $LOC --xoffset $XOFF | awk -F "[ ]{2,}" '{gsub(/<[^>]*>/, ""); print $0}') + + +CHSSID=$(echo "$CHENTRY" | awk -F "[ ]{2,}" '{print $2}') + +# If the user inputs "manual" as their SSID in the start window, it will bring them to this screen +if [ "$CHENTRY" = "manual" ] ; then + # Manual entry of the SSID and password (if appplicable) + MSSID=$(echo "enter the SSID of the network (SSID,password)" | wofi --dmenu -p "Manual Entry: ") + # Separating the password from the entered string + MPASS=$(echo "$MSSID" | awk -F "," '{print $2}') + + # If the user entered a manual password, then use the password nmcli command + if [ "$MPASS" = "" ]; then + nmcli dev wifi con "$MSSID" + else + nmcli dev wifi con "$MSSID" password "$MPASS" + fi + +elif [ "$CHENTRY" = "toggle on" ]; then + nmcli radio wifi on + +elif [ "$CHENTRY" = "toggle off" ]; then + nmcli radio wifi off + +else + + # If the connection is already in use, then this will still be able to get the SSID + if [ "$CHSSID" = "*" ]; then + CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $3}') + fi + + # Parses the list of preconfigured connections to see if it already contains the chosen SSID. This speeds up the connection process + + if [[ $(echo "$KNOWNCON" | grep -w "$CHSSID") = "$CHSSID" ]]; then + nmcli con up "$CHSSID" + else + nmcli dev wifi con "$CHSSID" + fi + +fi diff --git a/configs/wofi/style.css b/configs/wofi/style.css new file mode 100644 index 0000000..6085022 --- /dev/null +++ b/configs/wofi/style.css @@ -0,0 +1,41 @@ +/* https://cloudninja.pw/docs/wofi.html */ +window { + /* border: solid 1px white; */ + background-color: black; +} + +#input { + border: none; + border-radius: 0px; + background-color: white; + color: black; + font-size: 18px; + margin-bottom: 10px; +} + +#img { + margin-right: 10px; +} + + +#outer-box { + margin: 10px; +} + +#scroll { + margin: 5px 0px; + font-size: 16px; + color: #ccc; +} + +#scroll label { + margin: 2px 0px; +} + +#entry:selected{ + background-color: white; +} + +#text:selected{ + color: black; +} diff --git a/configs/wofi/sway-select-window.sh b/configs/wofi/sway-select-window.sh new file mode 100755 index 0000000..fe299ad --- /dev/null +++ b/configs/wofi/sway-select-window.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +swaymsg -t get_tree | jq -r ' + # descend to workspace or scratchpad + .nodes[].nodes[] + # save workspace name as .w + | {"w": .name} + ( + if .nodes then # workspace + [recurse(.nodes[])] + else # scratchpad + [] + end + + .floating_nodes + | .[] + # select nodes with no children (windows) + | select(.nodes==[]) + ) + | ((.id | tostring) + "\t " + # remove markup and index from workspace name, replace scratch with "[S]" + + (.w | gsub("^[^:]*:|<[^>]*>"; "") | sub("__i3_scratch"; "[S]")) + + "\t " + .name) + ' | wofi --show dmenu -Ddynamic-lines=true --prompt=0 | { + read -r id name + swaymsg "[con_id=$id]" focus +} diff --git a/configs/sway/swytcher.sh b/configs/wofi/swytcher.sh similarity index 68% rename from configs/sway/swytcher.sh rename to configs/wofi/swytcher.sh index 3a53395..e573af2 100755 --- a/configs/sway/swytcher.sh +++ b/configs/wofi/swytcher.sh @@ -25,12 +25,11 @@ # obtain command to execute with swaymsg for selected window if [ -z "$1" ] then - command_=focus + command_=focus else command_=$1 fi - # Obtain the avaliable windows' workspaces, names and IDs as strings mapfile -t windows < <( swaymsg -t get_tree | jq -r '[ @@ -39,26 +38,12 @@ swaymsg -t get_tree | jq -r '[ |select(.type=="workspace") | . as $workspace | recurse(.nodes[]?) |select(.type=="con" and .name!=null) - |{workspace: $workspace.name, name: .name, id: .id, focused: .focused, app_id: .app_id, class: .window_properties.class}] + |{workspace: $workspace.name, name: .name, id: .id, focused: .focused, app_id: .app_id}] |sort_by(.workspace, .name)[] - |.workspace + if .focused then "* " else " " end + if .app_id then .app_id else .class end + " - " + .name + " " + (.id|tostring)' + |.workspace + if .focused then "* " else " " end + .app_id + " - " + .name + " " + (.id|tostring)' ) +rm $HOME/.cache/wofi-dmenu -# Obtain window list index of last active window -# todo -index_window_last_active=0 -for index_window in "${!windows[@]}" -do - window="${windows[$index_window]}" - # obtain index of the active window - if [ "${window:1:1}" == "*" ] - then - index_window_last_active=$(($index_window)) - break - fi -done - -# get window list to display windows_separators=() colors=(blue green orange red magenta) workspace_previous='' @@ -96,36 +81,11 @@ do workspace_previous=$workspace done -# TODO: this breaks when using i3. Comment out for now. Should only execute if running sway. +HEIGHT=$(( $(printf '%s\n' "${windows_separators[@]}" | wc -l) * 30 )) + +echo $HEIGHT # Select window with rofi, obtaining ID of selected window -#screen_pos=$(swaymsg -t get_outputs \ -# | jq -r \ -# '.[] | select(.focused).rect | "\(.width)x\(.height)\\+\(.x)\\+\(.y)"') - -# ripgrep -#xwayland_output=$(xrandr | rg -oP "[A-Z]+[0-9]+(?= [a-z]+ $screen_pos)") - -#monitor_id=$(rofi --help | rg $xwayland_output -B1 \ -# | sed -sr '/ID/!d;s/[^:]*:\s([0-9])/\1/') - - -# Select window with rofi, obtaining ID of selected window -# TODO: Use multiple columns while inserting appropriate empty lines -# and adjusting line number accordingly in order to visually -# separate the list by workspace - -if [ -z "$monitor_id" ] -then - idx_selected=$printf '%s\n' "${windows_separators[@]}" | rofi -dmenu -i -p "$command_" -a "$index_workspace_active" -format i -selected-row "$index_window_last_active" -no-custom -s -width 80 -lines 30 -markup-rows) -else - idx_selected=$(printf '%s\n' "${windows_separators[@]}" | rofi -monitor $monitor_id -dmenu -i -p "$command_" -a "$index_workspace_active" -format i -selected-row "$index_window_last_active" -no-custom -s -width 80 -lines 30 -markup-rows) -fi - -# if no entry selected (e.g. user exitted with escape), end -if [ -z "$idx_selected" ] -then - exit 1 -fi +idx_selected=$(printf '%s\n' "${windows_separators[@]}" | wofi -d -p "$command_" -m -H $HEIGHT ) selected=${windows[$idx_selected]} id_selected=$(echo $selected | awk '{print $NF}') workspace_selected=${selected:0:1} @@ -155,7 +115,8 @@ do done # Tell sway to focus said window +# todo: do not execute if selected is the separator if [ ! -z "$id_selected" ] then swaymsg "[con_id=$id_selected] $command_" -fi( +fi diff --git a/configs/wofi/web-search.sh b/configs/wofi/web-search.sh new file mode 100755 index 0000000..86ff13c --- /dev/null +++ b/configs/wofi/web-search.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# ----------------------------------------------------------------------------- +# Info: +# author: Miroslav Vidovic +# file: web-search.sh +# created: 24.02.2017.-08:59:54 +# revision: --- +# version: 1.0 +# ----------------------------------------------------------------------------- +# Requirements: +# rofi +# Description: +# Use rofi to search the web. +# Usage: +# web-search.sh +# ----------------------------------------------------------------------------- +# Script: + + +searx="https://searx.tiekoetter.com/search?language=en&time_range=None&safesearch=0&categories=general&q=" +startpage="https://www.startpage.com/sp/search?q=" + +query=$( wofi -d -p "Search: " -W 600 -H 100 -k ~/.cache/wofi-web) + +if [[ -n "$query" ]]; then + url="$startpage$query" + xdg-open "$url" +else + exit +fi + +exit 0 diff --git a/configs/wofi/wofi-power-menu.sh b/configs/wofi/wofi-power-menu.sh new file mode 100755 index 0000000..aaf367c --- /dev/null +++ b/configs/wofi/wofi-power-menu.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +entries="⏻ Shutdown\n⭮ Reboot\n⇠ Logout\n⏾ Suspend" + +selected=$(echo -e $entries|wofi --width 250 --height 210 --dmenu --cache-file /dev/null | awk '{print tolower($2)}') + +case $selected in + logout) + swaymsg exit;; + suspend) + exec systemctl suspend;; + reboot) + exec systemctl reboot;; + shutdown) + exec systemctl poweroff -i;; +esac