diff --git a/.pnpm-debug.log b/.pnpm-debug.log new file mode 100644 index 0000000..3a7b839 --- /dev/null +++ b/.pnpm-debug.log @@ -0,0 +1,14 @@ +{ + "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\".", + "code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND", + "stack": "pnpm: No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles\".\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" + } + } +} \ No newline at end of file diff --git a/configs/alacritty/alacritty.yml b/configs/alacritty/alacritty.yml index 095c0bb..d8e7d94 100644 --- a/configs/alacritty/alacritty.yml +++ b/configs/alacritty/alacritty.yml @@ -23,7 +23,6 @@ # available, otherwise `xterm-256color` is used. #TERM: alacritty -window: # Window dimensions (changes require restart) # # Number of lines/columns (not pixels) in the terminal. The number of columns @@ -45,13 +44,12 @@ window: # # Blank space added around the window in pixels. This padding is scaled # by DPI and the specified value is always added at both opposing sides. +window: padding: x: 10 y: 10 - - # Spread additional padding evenly around the terminal content. - dynamic_padding: true - + dynamic_padding: false + # Window decorations # # Values for `decorations`: @@ -359,9 +357,6 @@ font: # The value `0.0` is completely transparent and `1.0` is opaque. #background_opacity: 1.0 -window: - opacity: 1.0 - #selection: # This string contains all characters that are used as separators for # "semantic words" in Alacritty. diff --git a/configs/lua/plugins.lua b/configs/lua/plugins.lua index f53e3ae..0ac77f4 100644 --- a/configs/lua/plugins.lua +++ b/configs/lua/plugins.lua @@ -28,7 +28,7 @@ return require("packer").startup(function() use "NTBBloodbath/rest.nvim" -- Obsidian / Roam like features - use "lervag/wiki.vim" + -- use "lervag/wiki.vim" -- Syntax / Autocomplete use "preservim/nerdcommenter" diff --git a/configs/rofi/config.rasi b/configs/rofi/config.rasi new file mode 100644 index 0000000..07de0e6 --- /dev/null +++ b/configs/rofi/config.rasi @@ -0,0 +1,145 @@ +configuration { + modi: "window,run,ssh"; +/* width: 50;*/ + lines: 4; +/* columns: 1;*/ +/* font: "mono 12";*/ +/* bw: 1;*/ +/* location: 0;*/ + padding: 5; +/* yoffset: 0;*/ +/* xoffset: 0;*/ +/* fixed-num-lines: true;*/ + show-icons: true; +/* terminal: "rofi-sensible-terminal";*/ +/* ssh-client: "ssh";*/ +/* ssh-command: "{terminal} -e {ssh-client} {host} [-p {port}]";*/ +/* run-command: "{cmd}";*/ +/* run-list-command: "";*/ +/* run-shell-command: "{terminal} -e {cmd}";*/ +/* window-command: "wmctrl -i -R {window}";*/ +/* window-match-fields: "all";*/ +/* icon-theme: ;*/ +/* drun-match-fields: "name,generic,exec,categories";*/ +/* drun-show-actions: false;*/ +/* drun-display-format: "{name} [({generic})]";*/ +/* disable-history: false;*/ +/* ignored-prefixes: "";*/ +/* sort: false;*/ +/* sorting-method: ;*/ +/* case-sensitive: false;*/ +/* cycle: true;*/ +/* sidebar-mode: false;*/ + eh: 1; +/* auto-select: false;*/ +/* parse-hosts: false;*/ +/* parse-known-hosts: true;*/ +/* combi-modi: "window,run";*/ +/* matching: "normal";*/ +/* tokenize: true;*/ +/* m: "-5";*/ +/* line-margin: 2;*/ +/* line-padding: 1;*/ +/* filter: ;*/ +/* separator-style: "dash";*/ +/* hide-scrollbar: false;*/ +/* fullscreen: false;*/ +/* fake-transparency: false;*/ +/* dpi: -1;*/ +/* threads: 0;*/ +/* scrollbar-width: 8;*/ +/* scroll-method: 0;*/ +/* fake-background: "screenshot";*/ +/* window-format: "{w} {c} {t}";*/ +/* click-to-exit: true;*/ +/* show-match: true;*/ + theme: "slate"; +/* color-normal: ;*/ +/* color-urgent: ;*/ +/* color-active: ;*/ +/* color-window: ;*/ +/* max-history-size: 25;*/ +/* combi-hide-mode-prefix: false;*/ +/* matching-negate-char: '-' /* unsupported */;*/ +/* cache-dir: ;*/ +/* pid: "/run/user/1000/rofi.pid";*/ +/* display-window: ;*/ +/* display-windowcd: ;*/ +/* display-run: ;*/ +/* display-ssh: ;*/ +/* display-drun: ;*/ +/* display-combi: ;*/ +/* display-keys: ;*/ +/* kb-primary-paste: "Control+V,Shift+Insert";*/ +/* kb-secondary-paste: "Control+v,Insert";*/ +/* kb-clear-line: "Control+w";*/ +/* kb-move-front: "Control+a";*/ +/* kb-move-end: "Control+e";*/ +/* kb-move-word-back: "Alt+b,Control+Left";*/ +/* kb-move-word-forward: "Alt+f,Control+Right";*/ +/* kb-move-char-back: "Left,Control+b";*/ +/* kb-move-char-forward: "Right,Control+f";*/ +/* kb-remove-word-back: "Control+Alt+h,Control+BackSpace";*/ +/* kb-remove-word-forward: "Control+Alt+d";*/ +/* kb-remove-char-forward: "Delete,Control+d";*/ +/* kb-remove-char-back: "BackSpace,Shift+BackSpace,Control+h";*/ +/* kb-remove-to-eol: "Control+k";*/ +/* kb-remove-to-sol: "Control+u";*/ +/* kb-accept-entry: "Control+j,Control+m,Return,KP_Enter";*/ +/* kb-accept-custom: "Control+Return";*/ +/* kb-accept-alt: "Shift+Return";*/ +/* kb-delete-entry: "Shift+Delete";*/ +/* kb-mode-next: "Shift+Right,Control+Tab";*/ +/* kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";*/ +/* kb-row-left: "Control+Page_Up";*/ +/* kb-row-right: "Control+Page_Down";*/ +/* kb-row-up: "Up,Control+p,ISO_Left_Tab";*/ +/* kb-row-down: "Down,Control+n";*/ +/* kb-row-tab: "Tab";*/ +/* kb-page-prev: "Page_Up";*/ +/* kb-page-next: "Page_Down";*/ +/* kb-row-first: "Home,KP_Home";*/ +/* kb-row-last: "End,KP_End";*/ +/* kb-row-select: "Control+space";*/ +/* kb-screenshot: "Alt+S";*/ +/* kb-ellipsize: "Alt+period";*/ +/* kb-toggle-case-sensitivity: "grave,dead_grave";*/ +/* kb-toggle-sort: "Alt+grave";*/ +/* kb-cancel: "Escape,Control+g,Control+bracketleft";*/ +/* kb-custom-1: "Alt+1";*/ +/* kb-custom-2: "Alt+2";*/ +/* kb-custom-3: "Alt+3";*/ +/* kb-custom-4: "Alt+4";*/ +/* kb-custom-5: "Alt+5";*/ +/* kb-custom-6: "Alt+6";*/ +/* kb-custom-7: "Alt+7";*/ +/* kb-custom-8: "Alt+8";*/ +/* kb-custom-9: "Alt+9";*/ +/* kb-custom-10: "Alt+0";*/ +/* kb-custom-11: "Alt+exclam";*/ +/* kb-custom-12: "Alt+at";*/ +/* kb-custom-13: "Alt+numbersign";*/ +/* kb-custom-14: "Alt+dollar";*/ +/* kb-custom-15: "Alt+percent";*/ +/* kb-custom-16: "Alt+dead_circumflex";*/ +/* kb-custom-17: "Alt+ampersand";*/ +/* kb-custom-18: "Alt+asterisk";*/ +/* kb-custom-19: "Alt+parenleft";*/ +/* kb-select-1: "Super+1";*/ +/* kb-select-2: "Super+2";*/ +/* kb-select-3: "Super+3";*/ +/* kb-select-4: "Super+4";*/ +/* kb-select-5: "Super+5";*/ +/* kb-select-6: "Super+6";*/ +/* kb-select-7: "Super+7";*/ +/* kb-select-8: "Super+8";*/ +/* kb-select-9: "Super+9";*/ +/* kb-select-10: "Super+0";*/ +/* ml-row-left: "ScrollLeft";*/ +/* ml-row-right: "ScrollRight";*/ +/* ml-row-up: "ScrollUp";*/ +/* ml-row-down: "ScrollDown";*/ +/* me-select-entry: "MousePrimary";*/ +/* me-accept-entry: "MouseDPrimary";*/ +/* me-accept-custom: "Control+MouseDPrimary";*/ +} diff --git a/configs/rofi/slate.rasi b/configs/rofi/slate.rasi new file mode 100644 index 0000000..68d8435 --- /dev/null +++ b/configs/rofi/slate.rasi @@ -0,0 +1,44 @@ +* { + background-color: #2b303b; + border-color: #2e343f; + text-color: #8ca0aa; + border-radius: 5px; + spacing: 0; + width: 512px; +} + +inputbar { + border: 0 0 1px 0; + children: [prompt,entry]; +} + +prompt { + padding: 16px; + border: 0 1px 0 0; +} + +textbox { + background-color: #2e343f; + border: 0 0 1px 0; + border-color: #282C33; + padding: 8px 16px; +} + +entry { + padding: 16px; +} + +listview { + cycle: false; + margin: 0 0 -1px 0; + scrollbar: false; +} + +element { + border: 0 0 1px 0; + padding: 16px; +} + +element selected { + background-color: #2e343f; +} diff --git a/configs/sway/config b/configs/sway/config index 23d29a0..8f69c67 100644 --- a/configs/sway/config +++ b/configs/sway/config @@ -18,17 +18,20 @@ set $term alacritty # Your preferred application launcher # Note: pass the final command to swaymsg so that the resulting window can be opened # on the original workspace that the command was run on. -set $menu dmenu_path | dmenu | xargs swaymsg exec -- -set $menu rofi -m $(expr $(swaymsg -t get_tree | jq '.nodes | map([recurse(.nodes[]?, .floating_nodes[]?) | .focused] | any) | index(true)') - 1) -show drun -run-command 'swaymsg exec -- {cmd}' -set $menu rofi -m $(swaymsg -t get_outputs | jq 'map(select(.active) | .focused) | index(true)') -show drun -run-command 'swaymsg exec -- {cmd}' +set $menu "rofi -combi-modi window,drun,ssh,run -show combi -show-icons" # Input configuration input * { xkb_layout de xkb_variant nodeadkeys - xkb_options caps:swapescape } +smart_gaps off +gaps inner 0 +gaps outer 10 + +default_border none + ### Output configuration # # Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) @@ -119,6 +122,7 @@ input * { # # Workspaces: # + # Switch to workspace bindsym $mod+1 workspace number 1 bindsym $mod+2 workspace number 2 diff --git a/configs/waybar/config b/configs/waybar/config index 063393b..e9575dd 100644 --- a/configs/waybar/config +++ b/configs/waybar/config @@ -1,29 +1,29 @@ { // "layer": "top", // Waybar at top layer // "position": "bottom", // Waybar position (top|bottom|left|right) - "height": 30, // Waybar height (to be removed for auto height) + "height": 20, // Waybar height (to be removed for auto height) // "width": 1280, // Waybar width "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules "modules-left": ["sway/workspaces", "sway/mode", "custom/media"], - "modules-center": ["sway/window"], - "modules-right": ["mpd", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "battery#bat2", "clock", "tray"], + "modules-center": ["custom/clock", "custom/spotify"], + "modules-right": ["pulseaudio", "network", "cpu", "memory", "battery", "battery#bat2"], // Modules configuration - // "sway/workspaces": { - // "disable-scroll": true, - // "all-outputs": true, - // "format": "{name}: {icon}", - // "format-icons": { - // "1": "", - // "2": "", - // "3": "", - // "4": "", - // "5": "", - // "urgent": "", - // "focused": "", - // "default": "" - // } - // }, + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": true, + "format": "{icon}", + "format-icons": { + "1": " Terminal", + "2": " Browser", + "3": "", + "4": "", + "5": "", + "urgent": "", + "focused": "", + "default": "" + } + }, "keyboard-state": { "numlock": true, "capslock": true, @@ -33,12 +33,20 @@ "unlocked": "" } }, + "custom/spotify": { + "exec": "/usr/bin/python3 /home/jim/.config/waybar/mediaplayer.py --player spotify", + "format": "{} ", + "return-type": "json", + "on-click": "playerctl play-pause", + "on-scroll-up": "playerctl next", + "on-scroll-down": "playerctl previous" + }, "sway/mode": { "format": "{}" }, "mpd": { "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", - "format-disconnected": "Disconnected ", + "format-disconnected": "", "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", "unknown-tag": "N/A", "interval": 2, @@ -73,11 +81,15 @@ // "icon-size": 21, "spacing": 10 }, - "clock": { - // "timezone": "America/New_York", - "tooltip-format": "{:%Y %B}\n{calendar}", - "format-alt": "{:%Y-%m-%d}" - }, + "clock": { + "interval": 60, + "format": "{:%H:%M}", + "max-length": 25 + }, + "custom/clock": { + "exec": "date +'%H:%M'", + "interval": 10 + }, "cpu": { "format": "{usage}% ", "tooltip": false diff --git a/configs/waybar/launch.sh b/configs/waybar/launch.sh new file mode 100755 index 0000000..066b0c4 --- /dev/null +++ b/configs/waybar/launch.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +CONFIG_FILES="$HOME/.config/waybar/config $HOME/.config/waybar/style.css" + +trap "killall waybar" EXIT + +while true; do + waybar & + inotifywait -e create,modify $CONFIG_FILES + killall waybar +done diff --git a/configs/waybar/mediaplayer.py b/configs/waybar/mediaplayer.py new file mode 100644 index 0000000..fa9aa58 --- /dev/null +++ b/configs/waybar/mediaplayer.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python3 +import argparse +import logging +import sys +import signal +import gi +import json +gi.require_version('Playerctl', '2.0') +from gi.repository import Playerctl, GLib + +logger = logging.getLogger(__name__) + + +def write_output(text, player): + logger.info('Writing output') + + output = {'text': text, + 'class': 'custom-' + player.props.player_name, + 'alt': player.props.player_name} + + sys.stdout.write(json.dumps(output) + '\n') + sys.stdout.flush() + + +def on_play(player, status, manager): + logger.info('Received new playback status') + on_metadata(player, player.props.metadata, manager) + + +def on_metadata(player, metadata, manager): + logger.info('Received new metadata') + track_info = '' + + if player.props.player_name == 'spotify' and \ + 'mpris:trackid' in metadata.keys() and \ + ':ad:' in player.props.metadata['mpris:trackid']: + track_info = 'AD PLAYING' + elif player.get_artist() != '' and player.get_title() != '': + track_info = '{artist} - {title}'.format(artist=player.get_artist(), + title=player.get_title()) + else: + track_info = player.get_title() + + if player.props.status != 'Playing' and track_info: + track_info = ' ' + track_info + write_output(track_info, player) + + +def on_player_appeared(manager, player, selected_player=None): + if player is not None and (selected_player is None or player.name == selected_player): + init_player(manager, player) + else: + logger.debug("New player appeared, but it's not the selected player, skipping") + + +def on_player_vanished(manager, player): + logger.info('Player has vanished') + sys.stdout.write('\n') + sys.stdout.flush() + + +def init_player(manager, name): + logger.debug('Initialize player: {player}'.format(player=name.name)) + player = Playerctl.Player.new_from_name(name) + player.connect('playback-status', on_play, manager) + player.connect('metadata', on_metadata, manager) + manager.manage_player(player) + on_metadata(player, player.props.metadata, manager) + + +def signal_handler(sig, frame): + logger.debug('Received signal to stop, exiting') + sys.stdout.write('\n') + sys.stdout.flush() + # loop.quit() + sys.exit(0) + + +def parse_arguments(): + parser = argparse.ArgumentParser() + + # Increase verbosity with every occurrence of -v + parser.add_argument('-v', '--verbose', action='count', default=0) + + # Define for which player we're listening + parser.add_argument('--player') + + return parser.parse_args() + + +def main(): + arguments = parse_arguments() + + # Initialize logging + logging.basicConfig(stream=sys.stderr, level=logging.DEBUG, + format='%(name)s %(levelname)s %(message)s') + + # Logging is set by default to WARN and higher. + # With every occurrence of -v it's lowered by one + logger.setLevel(max((3 - arguments.verbose) * 10, 0)) + + # Log the sent command line arguments + logger.debug('Arguments received {}'.format(vars(arguments))) + + manager = Playerctl.PlayerManager() + loop = GLib.MainLoop() + + manager.connect('name-appeared', lambda *args: on_player_appeared(*args, arguments.player)) + manager.connect('player-vanished', on_player_vanished) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + for player in manager.props.player_names: + if arguments.player is not None and arguments.player != player.name: + logger.debug('{player} is not the filtered player, skipping it' + .format(player=player.name) + ) + continue + + init_player(manager, player) + + loop.run() + + +if __name__ == '__main__': + main() diff --git a/configs/waybar/style.css b/configs/waybar/style.css index 64dc640..5460f56 100644 --- a/configs/waybar/style.css +++ b/configs/waybar/style.css @@ -1,33 +1,45 @@ * { border: none; - border-radius: 0; + border-radius: 5px; font-family: Font Awesome, Hack Nerd Font; font-size: 13px; - box-shadow: none; - text-shadow: none; transition-duration: 0s; - color: #d5c4a1; + /*color: #c0c5ce;*/ +} + +window#waybar { + background: transparent; +} + +window > box { + margin: 10px; + margin-bottom: 0px; + background: #2b303b; + padding: 3px; + /*border-bottom: 3px solid rgba(100, 114, 125, 0.5);*/ } window { - font-weight: bold; - color: #d5c4a1; - background: #504945; + background: #2b303b; + margin: 0px; } #workspaces { - margin: 0 5px; + margin: 0 0px; } #workspaces button { - padding: 0 4px; + padding: 0px 8px; + color: white; } -#workspaces button.visible { +#workspaces button:hover{ + opacity: 0.9; } #workspaces button.focused { - background-color: #458588; + background-color: white; + color: #2b303b; } #battery, #network, #pulseaudio, #clock, #custom-power, #custom-qbitstats { @@ -41,6 +53,12 @@ window { min-width: 10px; } +.custom-spotify { + padding: 0 10px; + margin: 0 4px; + opacity: 0.5; +} + #custom-power { color: #cc241d; }