feat: some more history

This commit is contained in:
max_richter 2021-11-08 01:29:28 +01:00
parent 3334866bcb
commit 2fe7f127e5
18 changed files with 685 additions and 387 deletions

View File

@ -1,14 +0,0 @@
{
"0 debug pnpm:scope": {
"selected": 1
},
"1 error pnpm": {
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
"err": {
"name": "pnpm",
"message": "No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles/configs\".",
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
"stack": "pnpm: No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles/configs\".\n at readProjectManifest (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40641:13)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40645:28)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40864:24)\n at async Object.handler (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:129763:24)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133951:20\n at async run (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133926:34)\n at async runPnpm (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134137:5)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134129:7"
}
}
}

View File

@ -10,7 +10,7 @@ set -g destroy-unattached
unbind C-b unbind C-b
set-option -g prefix C-a set-option -g prefix C-a
bind-key C-a send-prefix bind-key C-a send-prefix
bind b set-option status
# split panes using | and - # split panes using | and -
bind | split-window -h -c "#{pane_current_path}" bind | split-window -h -c "#{pane_current_path}"

View File

@ -25,11 +25,15 @@ if u.has_plugin("cmp") then
cmd [[set mouse=a]] -- enable mouse interaction cmd [[set mouse=a]] -- enable mouse interaction
cmd [[set undofile]] cmd [[set undofile]]
cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines
cmd [[command Format :lua vim.lsp.buf.formatting()]]
cmd [[set noshowmode]] --to get rid of thing like --INSERT-- cmd [[set noshowmode]] --to get rid of thing like --INSERT--
cmd [[set noshowcmd]] --to get rid of display of last command cmd [[set noshowcmd]] --to get rid of display of last command
cmd [[set shortmess+=F]] --to get rid of the file name displayed in the command line bar cmd [[set shortmess+=F]] --to get rid of the file name displayed in the command line bar
cmd [[set noruler]] cmd [[set noruler]]
g.ale_fixers = {"prettier", "eslint"}
-- Enable Theming / Syntax -- Enable Theming / Syntax
o.syntax = "enable" o.syntax = "enable"

View File

@ -14,7 +14,7 @@ cmp.setup {
end end
}, },
mapping = { mapping = {
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(), ["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { ["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,

View File

@ -139,6 +139,7 @@ nvim_lsp.diagnosticls.setup {
"sh", "sh",
"markdown", "markdown",
"json", "json",
"jsonc",
"yaml", "yaml",
"toml" "toml"
}, },

View File

@ -17,7 +17,8 @@ return require("packer").startup(function()
use "kyazdani42/nvim-tree.lua" use "kyazdani42/nvim-tree.lua"
use "nvim-lua/popup.nvim" use "nvim-lua/popup.nvim"
use "mhinz/vim-startify" use "mhinz/vim-startify"
use "lukas-reineke/indent-blankline.nvim"
-- Code Navigation -- Code Navigation
use "dense-analysis/ale" use "dense-analysis/ale"
use "nathanmsmith/nvim-ale-diagnostic" use "nathanmsmith/nvim-ale-diagnostic"
@ -40,13 +41,14 @@ return require("packer").startup(function()
use "weilbith/nvim-code-action-menu" -- Need to find better alternative use "weilbith/nvim-code-action-menu" -- Need to find better alternative
use "L3MON4D3/LuaSnip" use "L3MON4D3/LuaSnip"
use "windwp/nvim-autopairs" use "windwp/nvim-autopairs"
use "neoclide/jsonc.vim"
use { use {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate' run = ':TSUpdate'
} }
-- Formatting
use "mhartington/formatter.nvim" use "sbdchd/neoformat"
-- General Popup Window -- General Popup Window
use "akinsho/nvim-toggleterm.lua" use "akinsho/nvim-toggleterm.lua"

View File

@ -38,4 +38,4 @@ function M.has_plugin(pluginName)
return status return status
end end
return M return M

View File

@ -1,13 +0,0 @@
#!/bin/bash
# Terminate already running bar instances
killall -q i3bar
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch Polybar, using default config location ~/.conig/polybar/config
polybar base &
echo "Polybar launched..."

View File

@ -1,120 +0,0 @@
;--------------------------------------------
; settings ;
;--------------------------------------------
[settings]
screenchange-reload = true
;--------------------------------------------
; colors ;
;--------------------------------------------
[colors]
bar_bg = ${xrdb:color0}
bar_fg = ${xrdb:color7}
border_col = ${xrdb:color0}
modules_bg = ${xrdb:color7}
modules_fg = ${xrdb:color0}
mod_bg = ${xrdb:color7}
modules_prefix_bg = ${xrdb:color7}
modules_prefix_fg = ${xrdb:color0}
urgent_bg = ${xrdb:color1}
focused_bg = ${xrdb:color10}
essid_p_bg = ${xrdb:color6}
down_p_bg = #5e606c
cpu_p_bg = ${xrdb:color5}
ram_p_bg = ${xrdb:color11}
vol_p_bg = #637b81
bright_p_bg = #c29f6f
battery_p_bg = ${xrdb:color9}
time_p_bg = ${xrdb:color10}
;--------------------------------------------
; bars ;
;--------------------------------------------
[bar/base]
dpi = 192
width = 100%
height = 32
offset-x = 0
offset-y = 0
bottom = false
background = ${xrdb:background}
foreground = ${xrdb:color7}
border-bottom-size = 0
border-top-size = ${xrdb:gap}
border-left-size = ${xrdb:gap}
border-right-size = ${xrdb:gap}
border-bottom-color = #000f0f0f
border-top-color = #000f0f0f
border-left-color = #000f0f0f
border-right-color = #000f0f0f
spacing = 0
padding-left = 0
padding-right = 2
module-margin-left = 0
font-N = <fontconfig pattern>;<vertical offset>
font-0 = FiraMono Nerd:size=4;2
font-1 = Font Awesome 5 Free Regular:pixelsize=14;-1
font-2 = Font Awesome 5 Brands:pixelsize=4;2
fixed-center = true
modules-left = i3
modules-center = date
modules-right = cpu ram
;--------------------------------------------
; modules ;
;--------------------------------------------
[module/date]
type = internal/date
interval = 1.0
time = "%I:%M %p"
label = "%time%"
format = <label>
format-padding = 0
label-padding = 4
[module/i3]
type = internal/i3
; Only show workspaces defined on the same output as the bar
pin-workspaces = true
; This will split the workspace name on ':'
strip-wsnumbers = true
index-sort = true
enable-scroll = false
label-separator = |
label-separator-padding = 2
[module/ram]
type = internal/memory
format = <label>
label = " MEM: %mb_free% | %percentage_free%%"
[module/cpu]
type = internal/cpu
format = <label>
label = CPU %percentage%%

View File

@ -1,15 +1,15 @@
configuration { configuration {
modi: "window,run,ssh"; modi: "window,run,ssh";
/* width: 50;*/ width: 10;
lines: 4; lines: 4;
/* columns: 1;*/ /*columns: 1;*/
/* font: "mono 12";*/ /* font: "mono 12";*/
/* bw: 1;*/ /* bw: 1;*/
/* location: 0;*/ /* location: 0;*/
padding: 5; padding: 5;
/* yoffset: 0;*/ /* yoffset: 0;*/
/* xoffset: 0;*/ /* xoffset: 0;*/
/* fixed-num-lines: true;*/ /*fixed-num-lines: true;*/
show-icons: true; show-icons: true;
/* terminal: "rofi-sensible-terminal";*/ /* terminal: "rofi-sensible-terminal";*/
/* ssh-client: "ssh";*/ /* ssh-client: "ssh";*/
@ -29,7 +29,7 @@ configuration {
/* sorting-method: ;*/ /* sorting-method: ;*/
/* case-sensitive: false;*/ /* case-sensitive: false;*/
/* cycle: true;*/ /* cycle: true;*/
/* sidebar-mode: false;*/ /*sidebar-mode: true;*/
eh: 1; eh: 1;
/* auto-select: false;*/ /* auto-select: false;*/
/* parse-hosts: false;*/ /* parse-hosts: false;*/
@ -38,7 +38,7 @@ configuration {
/* matching: "normal";*/ /* matching: "normal";*/
/* tokenize: true;*/ /* tokenize: true;*/
/* m: "-5";*/ /* m: "-5";*/
/* line-margin: 2;*/ line-margin: 0;
/* line-padding: 1;*/ /* line-padding: 1;*/
/* filter: ;*/ /* filter: ;*/
/* separator-style: "dash";*/ /* separator-style: "dash";*/
@ -49,7 +49,7 @@ configuration {
/* threads: 0;*/ /* threads: 0;*/
/* scrollbar-width: 8;*/ /* scrollbar-width: 8;*/
/* scroll-method: 0;*/ /* scroll-method: 0;*/
/* fake-background: "screenshot";*/ /*fake-background: "screenshot";*/
/* window-format: "{w} {c} {t}";*/ /* window-format: "{w} {c} {t}";*/
/* click-to-exit: true;*/ /* click-to-exit: true;*/
/* show-match: true;*/ /* show-match: true;*/

246
configs/rofi/rofi-power-menu Executable file
View File

@ -0,0 +1,246 @@
#!/usr/bin/env bash
# This script defines just a mode for rofi instead of being a self-contained
# executable that launches rofi by itself. This makes it more flexible than
# running rofi inside this script as now the user can call rofi as one pleases.
# For instance:
#
# rofi -show powermenu -modi powermenu:./rofi-power-menu
#
# See README.md for more information.
set -e
set -u
# All supported choices
all=(shutdown reboot suspend hibernate logout lockscreen)
# By default, show all (i.e., just copy the array)
show=("${all[@]}")
declare -A texts
texts[lockscreen]="lock screen"
texts[switchuser]="switch user"
texts[logout]="log out"
texts[suspend]="suspend"
texts[hibernate]="hibernate"
texts[reboot]="reboot"
texts[shutdown]="shut down"
declare -A icons
icons[lockscreen]="\uf023"
icons[switchuser]="\uf518"
icons[logout]="\uf842"
icons[suspend]="\uf9b1"
icons[hibernate]="\uf7c9"
icons[reboot]="\ufc07"
icons[shutdown]="\uf011"
icons[cancel]="\u00d7"
declare -A actions
actions[lockscreen]="loginctl lock-session ${XDG_SESSION_ID-}"
#actions[switchuser]="???"
actions[logout]="loginctl terminate-session ${XDG_SESSION_ID-}"
actions[suspend]="systemctl suspend"
actions[hibernate]="systemctl hibernate"
actions[reboot]="systemctl reboot"
actions[shutdown]="systemctl poweroff"
# By default, ask for confirmation for actions that are irreversible
confirmations=(reboot shutdown logout)
# By default, no dry run
dryrun=false
showsymbols=true
function check_valid {
option="$1"
shift 1
for entry in "${@}"
do
if [ -z "${actions[$entry]+x}" ]
then
echo "Invalid choice in $1: $entry" >&2
exit 1
fi
done
}
# Parse command-line options
parsed=$(getopt --options=h --longoptions=help,dry-run,confirm:,choices:,choose:,symbols,no-symbols --name "$0" -- "$@")
if [ $? -ne 0 ]; then
echo 'Terminating...' >&2
exit 1
fi
eval set -- "$parsed"
unset parsed
while true; do
case "$1" in
"-h"|"--help")
echo "rofi-power-menu - a power menu mode for Rofi"
echo
echo "Usage: rofi-power-menu [--choices CHOICES] [--confirm CHOICES]"
echo " [--choose CHOICE] [--dry-run] [--symbols|--no-symbols]"
echo
echo "Use with Rofi in script mode. For instance, to ask for shutdown or reboot:"
echo
echo " rofi -show menu -modi \"menu:rofi-power-menu --choices=shutdown/reboot\""
echo
echo "Available options:"
echo " --dry-run Don't perform the selected action but print it to stderr."
echo " --choices CHOICES Show only the selected choices in the given order. Use / "
echo " as the separator. Available choices are lockscreen, logout,"
echo " suspend, hibernate, reboot and shutdown. By default, all"
echo " available choices are shown."
echo " --confirm CHOICES Require confirmation for the gives choices only. Use / as"
echo " the separator. Available choices are lockscreen, logout,"
echo " suspend, hibernate, reboot and shutdown. By default, only"
echo " irreversible actions logout, reboot and shutdown require"
echo " confirmation."
echo " --choose CHOICE Preselect the given choice and only ask for a confirmation"
echo " (if confirmation is set to be requested). It is strongly"
echo " recommended to combine this option with --confirm=CHOICE"
echo " if the choice wouldn't require confirmation by default."
echo " Available choices are lockscreen, logout, suspend,"
echo " hibernate, reboot and shutdown."
echo " --[no-]symbols Show Unicode symbols or not. Requires a font with support"
echo " for the symbols. Use, for instance, fonts from the"
echo " Nerdfonts collection. By default, they are shown"
echo " -h,--help Show this help text."
exit 0
;;
"--dry-run")
dryrun=true
shift 1
;;
"--confirm")
IFS='/' read -ra confirmations <<< "$2"
check_valid "$1" "${confirmations[@]}"
shift 2
;;
"--choices")
IFS='/' read -ra show <<< "$2"
check_valid "$1" "${show[@]}"
shift 2
;;
"--choose")
# Check that the choice is valid
check_valid "$1" "$2"
selectionID="$2"
shift 2
;;
"--symbols")
showsymbols=true
shift 1
;;
"--no-symbols")
showsymbols=false
shift 1
;;
"--")
shift
break
;;
*)
echo "Internal error" >&2
exit 1
;;
esac
done
# Define the messages after parsing the CLI options so that it is possible to
# configure them in the future.
function write_message {
icon="<span font_size=\"medium\">$1</span>"
text="<span font_size=\"medium\">$2</span>"
if [ "$showsymbols" = "true" ]
then
echo -n "\u200e$icon \u2068$text\u2069"
else
echo -n "$text"
fi
}
function print_selection {
echo -e "$1" | $(read -r -d '' entry; echo "echo $entry")
}
declare -A messages
declare -A confirmationMessages
for entry in "${all[@]}"
do
messages[$entry]=$(write_message "${icons[$entry]}" "${texts[$entry]^}")
done
for entry in "${all[@]}"
do
confirmationMessages[$entry]=$(write_message "${icons[$entry]}" "Yes, ${texts[$entry]}")
done
confirmationMessages[cancel]=$(write_message "${icons[cancel]}" "No, cancel")
if [ $# -gt 0 ]
then
# If arguments given, use those as the selection
selection="${@}"
else
# Otherwise, use the CLI passed choice if given
if [ -n "${selectionID+x}" ]
then
selection="${messages[$selectionID]}"
fi
fi
# Don't allow custom entries
echo -e "\0no-custom\x1ftrue"
# Use markup
echo -e "\0markup-rows\x1ftrue"
if [ -z "${selection+x}" ]
then
echo -e "\0prompt\x1fPower menu"
for entry in "${show[@]}"
do
echo -e "${messages[$entry]}\0icon\x1f${icons[$entry]}"
done
else
for entry in "${show[@]}"
do
if [ "$selection" = "$(print_selection "${messages[$entry]}")" ]
then
# Check if the selected entry is listed in confirmation requirements
for confirmation in "${confirmations[@]}"
do
if [ "$entry" = "$confirmation" ]
then
# Ask for confirmation
echo -e "\0prompt\x1fAre you sure"
echo -e "${confirmationMessages[$entry]}\0icon\x1f${icons[$entry]}"
echo -e "${confirmationMessages[cancel]}\0icon\x1f${icons[cancel]}"
exit 0
fi
done
# If not, then no confirmation is required, so mark confirmed
selection=$(print_selection "${confirmationMessages[$entry]}")
fi
if [ "$selection" = "$(print_selection "${confirmationMessages[$entry]}")" ]
then
if [ $dryrun = true ]
then
# Tell what would have been done
echo "Selected: $entry" >&2
else
# Perform the action
${actions[$entry]}
fi
exit 0
fi
if [ "$selection" = "$(print_selection "${confirmationMessages[cancel]}")" ]
then
# Do nothing
exit 0
fi
done
# The selection didn't match anything, so raise an error
echo "Invalid selection: $selection" >&2
exit 1
fi

View File

@ -1,15 +1,17 @@
* { * {
background-color: #2b303b; background-color: #2b303b;
background-color: black;
border-color: #2e343f; border-color: #2e343f;
text-color: #8ca0aa; text-color: #8ca0aa;
border-radius: 5px; border-radius: 5px;
spacing: 0; border-radius: 0px;
width: 512px; spacing: 0px;
width: 20%;
} }
inputbar { inputbar {
border: 0 0 1px 0; border: 0 0 1px 0;
children: [prompt,entry]; children: [entry];
} }
prompt { prompt {
@ -17,15 +19,8 @@ prompt {
border: 0 1px 0 0; border: 0 1px 0 0;
} }
textbox {
background-color: #2e343f;
border: 0 0 1px 0;
border-color: #282C33;
padding: 8px 16px;
}
entry { entry {
padding: 16px; padding: 8px;
} }
listview { listview {
@ -37,6 +32,8 @@ listview {
element { element {
border: 0 0 1px 0; border: 0 0 1px 0;
padding: 16px; padding: 16px;
padding-left: 0px;
margin-left: 0px;
} }
element selected { element selected {

View File

@ -19,6 +19,12 @@ set $term alacritty
# Note: pass the final command to swaymsg so that the resulting window can be opened # 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. # on the original workspace that the command was run on.
set $menu "rofi -combi-modi window,drun,ssh,run -show combi -show-icons" 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"
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
set $toggle_layout ~/.config/sway/toggle_layout.sh
# Input configuration # Input configuration
input * { input * {
@ -35,7 +41,7 @@ default_border none
### Output configuration ### Output configuration
# #
# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) # Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/)
#output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill output * bg `find ~/.customization/background -type f | shuf -n 1` fill
# #
# Example configuration: # Example configuration:
# #
@ -74,27 +80,29 @@ default_border none
# #
# Basics: # Basics:
# #
# Start a terminal bindsym $mod+q exec $powermenu
bindsym $mod+Return exec $term bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# Start your launcher
bindsym $mod+d exec $menu bindsym $mod+d exec $menu
bindsym $mod+e exec nautilus
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod. # Drag and resize floating windows with mouse right/left drag
# Despite the name, also works for non-floating windows. floating_modifier $mod normal
# 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 # Reload the configuration file
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
# Exit sway (logs you out of your Wayland session) # Multimedia Audio Keys
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 XF86AudioMute exec "pactl list sinks | grep -q Mute:.no && pactl set-sink-mute 0 1 || pactl set-sink-mute 0 0"
bindsym XF86AudioLowerVolume exec "pactl -- set-sink-volume 0 -10%"
bindsym XF86AudioRaiseVolume exec "pactl -- set-sink-volume 0 +10%"
#Increase brightness
bindsym XF86MonBrightnessUp exec brightnessctl -d intel_backlight set +10
bindsym XF86MonBrightnessDown exec brightnessctl -d intel_backlight set 10-
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'Do you really want to exit your Wayland session?' -B 'Yes, exit sway' 'swaymsg exit'
# #
# Moving around: # Moving around:
# #
@ -123,11 +131,16 @@ default_border none
# Workspaces: # Workspaces:
# #
set $ws1 " Code"
set $ws2 " Browser"
set $ws3 " Music"
set $ws4 " Chat"
# Switch to workspace # Switch to workspace
bindsym $mod+1 workspace number 1 bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace number 2 bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace number 3 bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace number 4 bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace number 5 bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6 bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7 bindsym $mod+7 workspace number 7
@ -147,6 +160,11 @@ default_border none
bindsym $mod+Shift+0 move container to workspace number 10 bindsym $mod+Shift+0 move container to workspace number 10
# Note: workspaces can have any name you want, not just numbers. # Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default. # We just use 1-10 as the default.
assign [class="Firefox"] $ws2
assign [class="Chromium"] $ws2
assign [class="Google-chrome-beta"] $ws2
assign [class="google-chrome"] ""
# #
# Layout stuff: # Layout stuff:
# #
@ -157,9 +175,7 @@ default_border none
bindsym $mod+v splitv bindsym $mod+v splitv
# Switch the current container between different layout styles # Switch the current container between different layout styles
bindsym $mod+s layout stacking bindsym $mod+w exec $toggle_layout
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen # Make the current focus fullscreen
bindsym $mod+f fullscreen bindsym $mod+f fullscreen
@ -172,6 +188,17 @@ default_border none
# Move focus to the parent container # Move focus to the parent container
bindsym $mod+a focus parent bindsym $mod+a focus parent
# Screenshots
# -- Area Screenshot
bindsym $mod+Shift+s exec $screenclip
# -- Select Window
bindsym $mod+Control+s exec $windowshot
# -- Entire Screen
bindsym $mod+s exec $screenshot
bindsym Alt+Tab exec rofi -show window -modi window
# #
# Scratchpad: # Scratchpad:
# #

161
configs/sway/swytcher.sh Executable file
View File

@ -0,0 +1,161 @@
#!/bin/bash
# Swytch is a script providing a window switcher for sway using rofi, awk and jq.
# The script is based on:
# https://www.reddit.com/r/swaywm/comments/aolf3u/quick_script_for_rofi_alttabbing_window_switcher/
# Copyright (C) 2019 Björn Sonnenschein
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# todo: first, query all existing workspaces from sway and build color dict, so that
# all workspaces always get the same color, even if no windows at some workspace in between exists.
# obtain command to execute with swaymsg for selected window
if [ -z "$1" ]
then
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 '[
recurse(.nodes[]?)
|recurse(.floating_nodes[]?)
|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}]
|sort_by(.workspace, .name)[]
|.workspace + if .focused then "* " else " " end + if .app_id then .app_id else .class end + " - " + .name + " " + (.id|tostring)'
)
# 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=''
index_workspace_active=0
num_separators=0
index_color=0
bold=-1
for index_window in "${!windows[@]}"
do
window="${windows[$index_window]}"
# todo: consider arbitraty workspace name length by separating by space instead of simply taking first argument.
workspace=${window:0:1}
# obtain index of the active window
if [ "${window:1:1}" == "*" ]
then
index_workspace_active=$(($index_window))
fi
# if window has different workspace than previous, use next color. Cycle through colors
if [ "$workspace" != "$workspace_previous" ] && [ ! -z "$workspace_previous" ]
then
index_color=$index_color+1
fi
if (($index_color == ${#colors[@]}))
then
index_color=0
fi
if (( $bold == 1))
then
windows_separators+=("<b><span foreground=\"${colors[$index_color]}\">[${workspace}]</span>${window:1}</b>")
else
windows_separators+=("<span foreground=\"${colors[$index_color]}\">[${workspace}]</span>${window:1}")
fi
workspace_previous=$workspace
done
# TODO: this breaks when using i3. Comment out for now. Should only execute if running sway.
# 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
selected=${windows[$idx_selected]}
id_selected=$(echo $selected | awk '{print $NF}')
workspace_selected=${selected:0:1}
### unmaximize all maximized windows on the workspace of the selected window
# Obtain the avaliable windows' workspaces, names and IDs as strings
mapfile -t ids_windows_maximized < <(
swaymsg -t get_tree | jq -r '[
recurse(.nodes[]?)
|recurse(.floating_nodes[]?)
|select(.type=="workspace")
| . as $workspace | recurse(.nodes[]?)
|select(.type=="con" and .name!=null and .fullscreen_mode==1 and $workspace.name=="'"$workspace_selected"'")
|{workspace: $workspace.name, name: .name, id: .id, focused: .focused, app_id: .app_id}]
|sort_by(.workspace, .name)[]
|(.id|tostring)'
)
# unmaximize the maximized windows that are not the selected one
for id_window_maximized in "${ids_windows_maximized[@]}"
do
if [ "$id_window_maximized" != "$id_selected" ]
then
swaymsg "[con_id=$id_window_maximized] fullscreen disable"
fi
done
# Tell sway to focus said window
if [ ! -z "$id_selected" ]
then
swaymsg "[con_id=$id_selected] $command_"
fi(

26
configs/sway/toggle_layout.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
WORKSPACE=$(swaymsg -t get_workspaces --raw | jq '.[] | select(.focused == true)')
WORKSPACE_ID=$(echo $WORKSPACE | jq ".name")
WORKSPACE_MODE=$(echo $WORKSPACE | jq ".layout");
MODE_SPLITH='"splith"'
MODE_SPLITV='"splitv"'
MODE_TABBED='"tabbed"'
MODE_STACKED='"stacked"'
echo $WORKSPACE_MODE
if [ $WORKSPACE_MODE = $MODE_SPLITH ]; then
swaymsg "workspace $WORKSPACE_ID; layout splitv"
elif [ $WORKSPACE_MODE = $MODE_SPLITV ]; then
swaymsg "workspace $WORKSPACE_ID; layout tabbed"
elif [ $WORKSPACE_MODE = $MODE_TABBED ]; then
swaymsg "workspace $WORKSPACE_ID; layout stacking"
elif [ $WORKSPACE_MODE = $MODE_STACKED ]; then
swaymsg "workspace $WORKSPACE_ID; layout splith"
fi
echo $WORKSPACE_ID;

View File

@ -1,171 +1,160 @@
{ {
// "layer": "top", // Waybar at top layer "height": 20,
// "position": "bottom", // Waybar position (top|bottom|left|right) "spacing": 4,
"height": 20, // Waybar height (to be removed for auto height) "modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
// "width": 1280, // Waybar width "modules-center": ["custom/spotify"],
"spacing": 4, // Gaps between modules (4px) "modules-right": ["pulseaudio", "network", "cpu", "memory", "battery", "custom/clock" ],
// Choose the order of the modules "sway/workspaces": {
"modules-left": ["sway/workspaces", "sway/mode", "custom/media"], "disable-scroll": true,
"modules-center": ["custom/clock", "custom/spotify"], "all-outputs": true,
"modules-right": ["pulseaudio", "network", "cpu", "memory", "battery", "battery#bat2"], "format": "{name}",
// Modules configuration "format-icons": {
"sway/workspaces": { "urgent": "",
"disable-scroll": true, "focused": "",
"all-outputs": true, "default": ""
"format": "{icon}", }
"format-icons": { },
"1": " Terminal", "keyboard-state": {
"2": " Browser", "numlock": true,
"3": "", "capslock": true,
"4": "", "format": "{name} {icon}",
"5": "", "format-icons": {
"urgent": "", "locked": "",
"focused": "", "unlocked": ""
"default": "" }
} },
}, "custom/spotify": {
"keyboard-state": { "exec": "/usr/bin/python3 /home/jim/.config/waybar/mediaplayer.py --player spotify",
"numlock": true, "format": "{} ",
"capslock": true, "return-type": "json",
"format": "{name} {icon}", "on-click": "playerctl play-pause",
"format-icons": { "on-scroll-up": "playerctl next",
"locked": "", "on-scroll-down": "playerctl previous"
"unlocked": "" },
} "sway/mode": {
}, "format": "<span style=\"italic\">{}</span>"
"custom/spotify": { },
"exec": "/usr/bin/python3 /home/jim/.config/waybar/mediaplayer.py --player spotify", "mpd": {
"format": "{} ", "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
"return-type": "json", "format-disconnected": "",
"on-click": "playerctl play-pause", "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"on-scroll-up": "playerctl next", "unknown-tag": "N/A",
"on-scroll-down": "playerctl previous" "interval": 2,
"consume-icons": {
"on": " "
}, },
"sway/mode": { "random-icons": {
"format": "<span style=\"italic\">{}</span>" "off": "<span color=\"#f53c3c\"></span> ",
}, "on": " "
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
"format-disconnected": "",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 2,
"consume-icons": {
"on": " "
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
"clock": {
"interval": 60,
"format": "{:%H:%M}",
"max-length": 25
}, },
"custom/clock": { "repeat-icons": {
"exec": "date +'%H:%M'", "on": " "
"interval": 10
}, },
"cpu": { "single-icons": {
"format": "{usage}% ", "on": "1 "
"tooltip": false },
}, "state-icons": {
"memory": { "paused": "",
"format": "{}% " "playing": ""
}, },
"temperature": { "tooltip-format": "MPD (connected)",
// "thermal-zone": 2, "tooltip-format-disconnected": "MPD (disconnected)"
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", },
"critical-threshold": 80, "idle_inhibitor": {
// "format-critical": "{temperatureC}°C {icon}", "format": "{icon}",
"format": "{temperatureC}°C {icon}", "format-icons": {
"format-icons": ["", "", ""] "activated": "",
}, "deactivated": ""
"backlight": { }
// "device": "acpi_video1", },
"format": "{percent}% {icon}", "tray": {
"format-icons": ["", ""] "spacing": 10
}, },
"battery": { "clock": {
"states": { "interval": 60,
// "good": 95, "format": "{:%H:%M}",
"warning": 30, "max-length": 25
"critical": 15 },
}, "custom/clock": {
"format": "{capacity}% {icon}", "exec": "date +'%H:%M'",
"format-charging": "{capacity}% ", "interval": 10
"format-plugged": "{capacity}% ", },
"format-alt": "{time} {icon}", "cpu": {
// "format-good": "", // An empty format will hide the module "format": "{usage}% ",
// "format-full": "", "tooltip": false
"format-icons": ["", "", "", "", ""] },
}, "memory": {
"battery#bat2": { "format": "{}% "
"bat": "BAT2" },
}, "temperature": {
"network": { // "thermal-zone": 2,
// "interface": "wlp2*", // (Optional) To force the use of this interface // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"format-wifi": "{essid} ({signalStrength}%) ", "critical-threshold": 80,
"format-ethernet": "{ipaddr}/{cidr} ", // "format-critical": "{temperatureC}°C {icon}",
"tooltip-format": "{ifname} via {gwaddr} ", "format": "{temperatureC}°C {icon}",
"format-linked": "{ifname} (No IP) ", "format-icons": ["", "", ""]
"format-disconnected": "Disconnected ⚠", },
"format-alt": "{ifname}: {ipaddr}/{cidr}" "backlight": {
}, // "device": "acpi_video1",
"pulseaudio": { "format": "{percent}% {icon}",
// "scroll-step": 1, // %, can be a float "format-icons": ["", ""]
"format": "{volume}% {icon} {format_source}", },
"format-bluetooth": "{volume}% {icon} {format_source}", "battery": {
"format-bluetooth-muted": " {icon} {format_source}", "states": {
"format-muted": " {format_source}", // "good": 95,
"format-source": "{volume}% ", "warning": 30,
"format-source-muted": "", "critical": 15
"format-icons": { },
"headphone": "", "format": "{capacity}% {icon}",
"hands-free": "", "format-charging": "{capacity}% ",
"headset": "", "format-plugged": "{capacity}% ",
"phone": "", "format-alt": "{time} {icon}",
"portable": "", // "format-good": "", // An empty format will hide the module
"car": "", // "format-full": "",
"default": ["", "", ""] "format-icons": ["", "", "", "", ""]
}, },
"on-click": "pavucontrol" "battery#bat2": {
}, "bat": "BAT2"
"custom/media": { },
"format": "{icon} {}", "network": {
"return-type": "json", // "interface": "wlp2*", // (Optional) To force the use of this interface
"max-length": 40, "format-wifi": "{essid} ({signalStrength}%) ",
"format-icons": { "format-ethernet": "{ipaddr}/{cidr} ",
"spotify": "", "tooltip-format": "{ifname} via {gwaddr} ",
"default": "🎜" "format-linked": "{ifname} (No IP) ",
}, "format-disconnected": "Disconnected ⚠",
"escape": true, "format-alt": "{ifname}: {ipaddr}/{cidr}"
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder },
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name "pulseaudio": {
} // "scroll-step": 1, // %, can be a float
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-source": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
}
} }

View File

@ -2,6 +2,8 @@
CONFIG_FILES="$HOME/.config/waybar/config $HOME/.config/waybar/style.css" CONFIG_FILES="$HOME/.config/waybar/config $HOME/.config/waybar/style.css"
killall waybar;
trap "killall waybar" EXIT trap "killall waybar" EXIT
while true; do while true; do

View File

@ -1,51 +1,41 @@
* { * {
border: none; border: none;
border-radius: 5px; font-family: Font Awesome, Hack Nerd Font;
font-family: Font Awesome, Hack Nerd Font; font-size: 13px;
font-size: 13px; opacity: 0.95;
transition-duration: 0s;
/*color: #c0c5ce;*/
} }
window#waybar { window#waybar {
background: transparent; background: transparent;
} }
window > box { window > box {
margin: 10px; margin: 10px;
margin-bottom: 0px; margin-bottom: 0px;
background: #2b303b; background: #2b303b;
padding: 3px; background: black;
padding: 5px;
/*border-bottom: 3px solid rgba(100, 114, 125, 0.5);*/ /*border-bottom: 3px solid rgba(100, 114, 125, 0.5);*/
} }
window {
background: #2b303b;
margin: 0px;
}
#workspaces {
margin: 0 0px;
}
#workspaces button { #workspaces button {
padding: 0px 8px; padding: 0px 9px;
color: white; color: white;
background: transparent;
border-radius: 0px;
} }
#workspaces button:hover{ #workspaces button:hover{
opacity: 0.9; background: rgba(255, 255, 255, 0.1);
} }
#workspaces button.focused { #workspaces button.focused {
background-color: white; background-color: white;
color: #2b303b; color: #2b303b;
} }
#battery, #network, #pulseaudio, #clock, #custom-power, #custom-qbitstats { #battery, #network, #pulseaudio, #clock, #custom-power, #custom-qbitstats {
margin: 0px 3px 0px 1px; /*margin: 0px 3px 0px 1px;*/
min-width: 10px;
} }
#clock { #clock {
@ -54,8 +44,8 @@ window {
} }
.custom-spotify { .custom-spotify {
padding: 0 10px; /*padding: 0 10px;*/
margin: 0 4px; /*margin: 0 4px;*/
opacity: 0.5; opacity: 0.5;
} }
@ -67,7 +57,7 @@ window {
} }
#battery { #battery {
color: #689d6a; color: #689d6a;
} }
#battery.critical { #battery.critical {
@ -91,6 +81,6 @@ window {
} }
#waybar > box:nth-child(2) > box:nth-child(3) > * > label { #waybar > box:nth-child(2) > box:nth-child(3) > * > label {
padding: 0 3px; padding: 0 3px;
} }