Initial commit

This commit is contained in:
Simponic 2022-10-25 22:13:43 -06:00
commit e6bdde0bb4
44 changed files with 1622 additions and 0 deletions

View File

@ -0,0 +1,159 @@
font:
normal:
family: "CozetteVector"
bold:
family: "CozetteVector"
italic:
family: "CozetteVector"
size: 13.0
offset:
x: 0
y: 0
glyph_offset:
x: 0
y: 0
window:
padding:
x: 12
y: 12
dynamic_padding: true
# decorations: none
cursor:
style: Block
unfocused_hollow: false
# thickness: 0.33
mouse:
hide_when_typing: true
# Base16 Gruvbox light, medium 256 - alacritty color config
# Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)
colors:
# Default colors
primary:
background: '0xfbf1c7'
foreground: '0x504945'
# Colors the cursor will use if `custom_cursor_colors` is true
cursor:
text: '0xfbf1c7'
cursor: '0x504945'
# Normal colors
normal:
black: '0xfbf1c7'
red: '0x9d0006'
green: '0x79740e'
yellow: '0xb57614'
blue: '0x076678'
magenta: '0x8f3f71'
cyan: '0x427b58'
white: '0x504945'
# Bright colors
bright:
black: '0xbdae93'
red: '0x9d0006'
green: '0x79740e'
yellow: '0xb57614'
blue: '0x076678'
magenta: '0x8f3f71'
cyan: '0x427b58'
white: '0x282828'
indexed_colors:
- { index: 16, color: '0xaf3a03' }
- { index: 17, color: '0xd65d0e' }
- { index: 18, color: '0xebdbb2' }
- { index: 19, color: '0xd5c4a1' }
- { index: 20, color: '0x665c54' }
- { index: 21, color: '0x3c3836' }
key_bindings:
- { key: A, mods: Alt, chars: "\x1ba" }
- { key: B, mods: Alt, chars: "\x1bb" }
- { key: C, mods: Alt, chars: "\x1bc" }
- { key: D, mods: Alt, chars: "\x1bd" }
- { key: E, mods: Alt, chars: "\x1be" }
- { key: F, mods: Alt, chars: "\x1bf" }
- { key: G, mods: Alt, chars: "\x1bg" }
- { key: H, mods: Alt, chars: "\x1bh" }
- { key: I, mods: Alt, chars: "\x1bi" }
- { key: J, mods: Alt, chars: "\x1bj" }
- { key: K, mods: Alt, chars: "\x1bk" }
- { key: L, mods: Alt, chars: "\x1bl" }
- { key: M, mods: Alt, chars: "\x1bm" }
- { key: N, mods: Alt, chars: "\x1bn" }
- { key: O, mods: Alt, chars: "\x1bo" }
- { key: P, mods: Alt, chars: "\x1bp" }
- { key: Q, mods: Alt, chars: "\x1bq" }
- { key: R, mods: Alt, chars: "\x1br" }
- { key: S, mods: Alt, chars: "\x1bs" }
- { key: T, mods: Alt, chars: "\x1bt" }
- { key: U, mods: Alt, chars: "\x1bu" }
- { key: V, mods: Alt, chars: "\x1bv" }
- { key: W, mods: Alt, chars: "\x1bw" }
- { key: X, mods: Alt, chars: "\x1bx" }
- { key: Y, mods: Alt, chars: "\x1by" }
- { key: Z, mods: Alt, chars: "\x1bz" }
- { key: A, mods: Alt|Shift, chars: "\x1bA" }
- { key: B, mods: Alt|Shift, chars: "\x1bB" }
- { key: C, mods: Alt|Shift, chars: "\x1bC" }
- { key: D, mods: Alt|Shift, chars: "\x1bD" }
- { key: E, mods: Alt|Shift, chars: "\x1bE" }
- { key: F, mods: Alt|Shift, chars: "\x1bF" }
- { key: G, mods: Alt|Shift, chars: "\x1bG" }
- { key: H, mods: Alt|Shift, chars: "\x1bH" }
- { key: I, mods: Alt|Shift, chars: "\x1bI" }
- { key: J, mods: Alt|Shift, chars: "\x1bJ" }
- { key: K, mods: Alt|Shift, chars: "\x1bK" }
- { key: L, mods: Alt|Shift, chars: "\x1bL" }
- { key: M, mods: Alt|Shift, chars: "\x1bM" }
- { key: N, mods: Alt|Shift, chars: "\x1bN" }
- { key: O, mods: Alt|Shift, chars: "\x1bO" }
- { key: P, mods: Alt|Shift, chars: "\x1bP" }
- { key: Q, mods: Alt|Shift, chars: "\x1bQ" }
- { key: R, mods: Alt|Shift, chars: "\x1bR" }
- { key: S, mods: Alt|Shift, chars: "\x1bS" }
- { key: T, mods: Alt|Shift, chars: "\x1bT" }
- { key: U, mods: Alt|Shift, chars: "\x1bU" }
- { key: V, mods: Alt|Shift, chars: "\x1bV" }
- { key: W, mods: Alt|Shift, chars: "\x1bW" }
- { key: X, mods: Alt|Shift, chars: "\x1bX" }
- { key: Y, mods: Alt|Shift, chars: "\x1bY" }
- { key: Z, mods: Alt|Shift, chars: "\x1bZ" }
- { key: Key1, mods: Alt, chars: "\x1b1" }
- { key: Key2, mods: Alt, chars: "\x1b2" }
- { key: Key3, mods: Alt, chars: "\x1b3" }
- { key: Key4, mods: Alt, chars: "\x1b4" }
- { key: Key5, mods: Alt, chars: "\x1b5" }
- { key: Key6, mods: Alt, chars: "\x1b6" }
- { key: Key7, mods: Alt, chars: "\x1b7" }
- { key: Key8, mods: Alt, chars: "\x1b8" }
- { key: Key9, mods: Alt, chars: "\x1b9" }
- { key: Key0, mods: Alt, chars: "\x1b0" }
- { key: Space, mods: Control, chars: "\x00" } # Ctrl + Space
- { key: Grave, mods: Alt, chars: "\x1b`" } # Alt + `
- { key: Grave, mods: Alt|Shift, chars: "\x1b~" } # Alt + ~
- { key: Period, mods: Alt, chars: "\x1b." } # Alt + .
- { key: Key8, mods: Alt|Shift, chars: "\x1b*" } # Alt + *
- { key: Key3, mods: Alt|Shift, chars: "\x1b#" } # Alt + #
- { key: Period, mods: Alt|Shift, chars: "\x1b>" } # Alt + >
- { key: Comma, mods: Alt|Shift, chars: "\x1b<" } # Alt + <
- { key: Minus, mods: Alt|Shift, chars: "\x1b_" } # Alt + _
- { key: Key5, mods: Alt|Shift, chars: "\x1b%" } # Alt + %
- { key: Key6, mods: Alt|Shift, chars: "\x1b^" } # Alt + ^
- { key: Backslash, mods: Alt, chars: "\x1b\\" } # Alt + \
- { key: Backslash, mods: Alt|Shift, chars: "\x1b|" } # Alt + |
#colors: *gruvbox_material_medium_light

49
.config/dunst/dunstrc Normal file
View File

@ -0,0 +1,49 @@
[global]
font = "CozetteVector"
allow_markup = yes
format = "<b>%s</b>\n%b"
sort = yes
indicate_hidden = yes
alignment = center
show_age_threshold = 60
word_wrap = yes
ignore_newline = no
geometry = "200x5-6+30"
idle_threshold = 120
monitor = 0
follow = mouse
sticky_history = yes
line_height = 0
separator_height = 2
padding = 8
horizontal_padding = 8
separator_color = "#689d6a"
startup_notification = false
# https://github.com/knopwob/dunst/issues/26#issuecomment-36159395
#icon_position = left
#icon_folders = /usr/share/icons/elementary/actions/16/
[frame]
width = 1
color = "#689d6a"
[shortcuts]
close = ctrl+space
close_all = ctrl+shift+space
history = ctrl+grave
context = ctrl+shift+period
[urgency_low]
background = "#fbf1c7"
foreground = "#3c3836"
timeout = 5
[urgency_normal]
background = "#fbf1c7"
foreground = "#3c3836"
timeout = 20
[urgency_critical]
background = "#9d0006"
foreground = "#fbf1c7"
timeout = 0

1
.config/spotifyd/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
spotifyd.conf

View File

@ -0,0 +1,15 @@
[global]
username = "laskdfjalskdjfaklsdjflakjd"
password = "asdfasdfasdfasdfasdf"
on_song_change_hook = "/home/ME/scripts/songnotification"
cache_path = "/home/ME/.cache/spotifyd"
device_name = "archbox"
backend = "pulseaudio"
bitrate = 160
volume_normalisation = true
normalisation_pregain = -10
device_type = "computer"
no_audio_cache = true

237
.config/sway/config Normal file
View File

@ -0,0 +1,237 @@
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term alacritty
set $browser firefox
# 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 wofi --show=drun --lines=5 --prompt=""
set $wallpapers_path $HOME/Wallpapers
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg `find $wallpapers_path -type f | shuf -n 1` fill
#
# Example configuration:
#
# output HDMI-A-1 resolution 1920x1080 position 1920,0
#
# You can get the names of your outputs by running: swaymsg -t get_outputs
### Idle configuration
#
# Example configuration:
#
exec swayidle -w \
timeout 600 'swaylock -f -c 000000' \
timeout 900 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f -c 000000'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
### Key bindings
#
# Basics:
#
# Start a terminal
bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+Shift+q kill
# Start your launcher
bindsym $mod+d exec $menu
# Browser
bindsym $mod+Shift+b exec $browser
# Emacs
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec emacs
# Brightness
bindsym $mod+Shift+w exec "brightnessctl set +5%"
bindsym $mod+Shift+s exec "brightnessctl set 5%-"
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 20px
bindsym $down resize grow height 20px
bindsym $up resize shrink height 20px
bindsym $right resize grow width 20px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
#
# Status Bar:
#
bar {
swaybar_command waybar
}
#
# Gaps
#
gaps inner 5
default_border pixel 3
client.focused "#000000" "#ffffff" "#000000"
include /etc/sway/config.d/*
#
# Cursor
#
set $my_cursor Bibata-Modern-Amber
set $my_cursor_size 16
exec_always {
gsettings set org.gnome.desktop.interface cursor-theme $my_cursor
gsettings set org.gnome.desktop.interface cursor-size $my_cursor_size
}

72
.config/waybar/config Normal file
View File

@ -0,0 +1,72 @@
{
"position": "top",
"spacing": 0,
"modules-left": ["network", "clock"],
"modules-center": ["sway/workspaces", "custom/spotify"],
"modules-right": ["pulseaudio", "memory", "cpu", "temperature#cpu", "backlight", "battery"],
"clock": {
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format": " {:%A, %d %B %Y, %H:%M}",
"interval": 60
},
"backlight": {
"format": " {}%"
},
"cpu": {
"format": " {usage}%"
},
"memory": {
"format": " {}%",
"tooltip": false,
},
"temperature#cpu": {
"critical-threshold": 70,
"format": " {temperatureC}°C "
},
"custom/spotify": {
"exec": "/home/logan/scripts/mediaplayer.py --player spotify --period 1 --width 18",
"format": "{} ",
"return-type": "json",
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous"
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"network": {
"format-wifi": " {ipaddr}",
"format-ethernet": " {ipaddr}/{cidr}",
"format-disconnected": "⚠ Disconnected",
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{icon} {volume}% {format_source}",
"format-bluetooth": "{icon}  {volume}% {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"
},
}

59
.config/waybar/style.css Normal file
View File

@ -0,0 +1,59 @@
* {
font-family: CozetteVector;
font-size: 16px;
color: #3C3836; /* Foreground "black" */
}
window > box {
margin: 4px 4px 4px 0px;
}
window#waybar {
background: rgba(251,241,199,0.7); /* Background "wheat"-ish */
}
#workspaces button {
background: #fbf1c7;
margin-right: 5px;
}
#workspaces button.focused {
background: #689d6a; /* Aqua */
}
/* Modules */
#clock, #battery, #cpu, #memory, #disk, #temperature, #backlight, #network, #pulseaudio, #custom-media, #custom-launcher, #custom-power, #tray, #mode, #idle_inhibitor , #mpd, .custom-spotify {
padding: 0 10px;
margin: 0px 5px;
background: #fbf1c7;
border-radius: 3px;
}
#battery {
background-color: #D79921;
}
#battery.charging, #battery.plugged {
background-color: #98971A;
}
#network {
background-color: #98971A;
}
#network.disconnected {
background-color: #cc241d;
}
#temperature {
background-color: #98971a;
}
#temperature.critical {
background-color: #cc241d;
}
#pulseaudio.muted {
background-color: #cc241d;
}

View File

@ -0,0 +1,5 @@
modmap:
- name: CapsLock Control
remap: # Required
KEY_CAPSLOCK: CONTROL_L
CONTROL_L: KEY_ESC

20
.emacs.d/init.el Normal file
View File

@ -0,0 +1,20 @@
(require 'org)
(org-babel-load-file
(expand-file-name "settings.org"
user-emacs-directory))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(magit counsel doom-modeline doom-themes use-package))
'(tab-width 2))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

262
.emacs.d/settings.org Normal file
View File

@ -0,0 +1,262 @@
#+TITLE: Simponic's Settings
#+AUTHOR: Simponic
#+STARTUP: fold
* Packages
** Melpa
#+BEGIN_SRC emacs-lisp
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
#+END_SRC
** use-package
#+BEGIN_SRC emacs-lisp
(dolist (package '(use-package))
(unless (package-installed-p package)
(package-install package)))
#+END_SRC
* General emacs
** Tab bar mode
#+BEGIN_SRC emacs-lisp
(defun my-tabbar-buffer-groups () ;; customize to show all normal files in one group
(list (cond ((string-equal "*" (substring (buffer-name) 0 1)) "emacs")
((eq major-mode 'dired-mode) "emacs")
(t "user"))))
(setq tabbar-buffer-groups-function 'my-tabbar-buffer-groups)
(tab-bar-mode)
#+END_SRC
** Indentation
#+BEGIN_SRC emacs-lisp
(setq default-tab-width 2)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
#+END_SRC
** Line numbers
#+BEGIN_SRC emacs-lisp
(setq display-line-numbers-type 'relative)
(global-display-line-numbers-mode)
#+END_SRC
** Filesystem stuff
#+BEGIN_SRC emacs-lisp
(setq auto-save-default nil)
(setq make-backup-files nil)
(setq create-lockfiles nil)
(global-auto-revert-mode t) ;; Change files on disk as they are updated
#+END_SRC
** GUI stuff
#+BEGIN_SRC emacs-lisp
(menu-bar-mode -1)
(setq inhibit-startup-screen t) ;; Startup screen
(if (display-graphic-p)
(funcall (lambda ()
(tool-bar-mode -1) ;; System bar
(set-fringe-mode '(1 . 1)) ;; Minimize arrows before and after wrapped lines by setting fringe to 1px
(toggle-scroll-bar -1)))) ;; Scroll bar
(setq frame-resize-pixelwise t) ;; Use 100% of window space
#+END_SRC
** System path (macos)
#+BEGIN_SRC emacs-lisp
;; Use system path on macos - needed for node
(use-package exec-path-from-shell
:ensure t
:init
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize)))
#+END_SRC
* Theming
** Highlight current line
#+BEGIN_SRC emacs-lisp
(global-hl-line-mode)
#+END_SRC
** Font
#+BEGIN_SRC emacs-lisp
(let ((font "CozetteVector-14"))
(set-face-attribute 'default nil :font font)
(set-frame-font font nil t))
#+END_SRC
** Doom-themes
#+BEGIN_SRC emacs-lisp
(use-package doom-themes
:ensure t
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme 'doom-gruvbox-light t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
#+END_SRC
** Doom-modeline
#+BEGIN_SRC emacs-lisp
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1))
#+END_SRC
** All the icons
#+BEGIN_SRC emacs-lisp
(use-package all-the-icons
:ensure t)
#+END_SRC
* Projectile
#+BEGIN_SRC emacs-lisp
(use-package projectile
:bind ("C-c p" . 'projectile-command-map)
:init (projectile-mode +1) (setq projectile-enable-caching t)
:ensure t)
#+END_SRC
* Swiper, Ivy
#+BEGIN_SRC emacs-lisp
(use-package counsel
:ensure t
:bind
("C-s" . 'swiper-isearch)
("M-x" . 'counsel-M-x)
:init
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(ivy-mode 1))
#+END_SRC
* Neotree
#+BEGIN_SRC emacs-lisp
(use-package neotree
:ensure t
:bind ("C-c j" . 'neotree-toggle)
:init
;; slow rendering
(setq inhibit-compacting-font-caches t)
;; set icons theme
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
;; Every time when the neotree window is opened, let it find current file and jump to node
(setq neo-smart-open t)
;; When running projectile-switch-project (C-c p p), neotree will change root automatically
(setq projectile-switch-project-action 'neotree-projectile-action)
(setq neo-window-width 35)
;; show hidden files
(setq-default neo-show-hidden-files t))
#+END_SRC
* Org mode
** General
#+BEGIN_SRC emacs-lisp
(setq org-startup-indented t)
#+END_SRC
** Babel
#+BEGIN_SRC emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((lisp . t)
(python . t)))
#+END_SRC
** org-bullets
#+BEGIN_SRC emacs-lisp
(use-package org-bullets
:ensure t
:init
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
#+END_SRC
** org-appear
#+BEGIN_SRC emacs-lisp
(use-package org-appear
:ensure t
:init
(add-hook 'org-mode-hook 'org-appear-mode))
#+END_SRC
* Development
** Git
#+BEGIN_SRC emacs-lisp
(use-package magit :ensure t)
#+END_SRC
** Company mode
#+BEGIN_SRC emacs-lisp
(use-package company
:ensure t
:init
(global-company-mode t)
:bind (:map company-active-map
("C-n" . company-select-next)
("C-p" . company-select-previous))
:config
(setq company-idle-delay 0.3))
#+END_SRC
** LSP Mode
#+BEGIN_SRC emacs-lisp
(use-package lsp-mode
:ensure t
:init
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
(setq lsp-keymap-prefix "C-c l")
:hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
(elixir-mode . lsp)
(rust-mode . lsp)
(typescript-mode . lsp)
;; if you want which-key integration
(lsp-mode . lsp-enable-which-key-integration))
:commands lsp)
#+END_SRC
** Languages
*** Common Lisp
**** Slime
#+BEGIN_SRC emacs-lisp
(use-package slime
:ensure t
:init
(setq inferior-lisp-program "sbcl"))
#+END_SRC
*** Elixir
#+BEGIN_SRC emacs-lisp
(use-package elixir-mode
:ensure t)
#+END_SRC
*** Rust
After installing the ~rust-analyzer~ program, the following can be used:
#+BEGIN_SRC emacs-lisp
(use-package rust-mode
:ensure t)
(setq lsp-rust-server 'rust-analyzer)
#+END_SRC
*** Web Stuff
**** Web Mode
#+BEGIN_SRC emacs-lisp
;; web-mode
(setq web-mode-markup-indent-offset 2)
(setq web-mode-code-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(use-package web-mode
:ensure t
:mode (("\\.js\\'" . web-mode)
("\\.jsx\\'" . web-mode)
("\\.ts\\'" . web-mode)
("\\.tsx\\'" . web-mode)
("\\.html\\'" . web-mode))
:commands web-mode)
#+END_SRC
**** Prettier
#+BEGIN_SRC emacs-lisp
(use-package prettier-js
:ensure t)
(add-hook 'web-mode-hook #'(lambda ()
(enable-minor-mode
'("\\.jsx?\\'" . prettier-js-mode))
(enable-minor-mode
'("\\.tsx?\\'" . prettier-js-mode))))
#+END_SRC

45
.gitignore vendored Normal file
View File

@ -0,0 +1,45 @@
*
!.gitignore
!.gitmodules
!scripts
!scripts/*
!.vimrc
!.zshrc
!.spaceshiprc.zsh
!ascii-arts
!ascii-arts/*
!zsh-stuff
!.config
!.config/picom
!.config/picom/*
!.config/alacritty
!.config/alacritty/*
!.config/dunst
!.config/dunst/*
!.config/waybar
!.config/waybar/*
!.config/sway
!.config/sway/*
!.config/xremap
!.config/xremap/*
!.config/systemd
!.config/systemd/*
!.config/spotifyd
!.config/spotifyd/*
!.emacs.d
!.emacs.d/*
!.stumpwm.d
!.stumpwm.d/*

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[submodule "zsh-stuff/zsh-syntax-highlighting"]
path = zsh-stuff/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
[submodule "zsh-stuff/spaceship-prompt"]
path = zsh-stuff/spaceship-prompt
url = https://github.com/spaceship-prompt/spaceship-prompt.git
[submodule ".stumpwm.d/modules"]
path = .stumpwm.d/modules
url = https://github.com/stumpwm/stumpwm-contrib

11
.spaceshiprc.zsh Normal file
View File

@ -0,0 +1,11 @@
# Display time
SPACESHIP_TIME_SHOW=true
# Display username always
SPACESHIP_USER_SHOW=always
# Do not truncate path in repos
SPACESHIP_DIR_TRUNC_REPO=false
SPACESHIP_HOST_SHOW="always"
SPACESHIP_GIT_SHOW=always

3
.stumpwm.d/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*~
*.log.1
*.log

53
.stumpwm.d/README.md Normal file
View File

@ -0,0 +1,53 @@
## Dependencies
### SBCL
`sudo pacman -S sbcl`
### Quicklisp:
In a shell:
```bash
cd ~
curl -O https://beta.quicklisp.org/quicklisp.lisp
sbcl --load quicklisp.lisp
```
Then in the REPL:
```common-lisp
(quicklisp-quickstart:install)
(ql:add-to-init-file)
```
And install some packages from quicklisp:
```common-lisp
(ql:quickload '(:clx :cl-ppcre :alexandria))
```
### Other
You'll probably want some stuff on your modeline. My modeline setup is hacky AF so you'll want the following:
- `ifconfig` (in `net-tools` in Arch)
- `acpi`
- `lm_sensors`
- `pamixer`
## Building and Installing
```bash
mkdir ~/src
git clone git@github.com:stumpwm/stumpwm.git ~/src/stumpwm
cd ~/src/stumpwm
./autogen.sh
./configure
make -j6
sudo make install
```
## Configuration
- If the environment variable LAPTOP exists, then the battery will show in the modeling. You can edit `/etc/environment` if you want it in other programs too.

9
.stumpwm.d/gaps.lisp Normal file
View File

@ -0,0 +1,9 @@
(add-to-load-path "~/.stumpwm.d/modules/util/swm-gaps")
(load-module "swm-gaps")
(setf swm-gaps:*head-gaps-size* 0
swm-gaps:*inner-gaps-size* 5
swm-gaps:*outer-gaps-size* 5)
(swm-gaps:toggle-gaps)

5
.stumpwm.d/groups.lisp Normal file
View File

@ -0,0 +1,5 @@
(grename "misc")
(gnew "www")
(gnew "txt")
(gnew "sh")
(gnew "chat")

21
.stumpwm.d/init.lisp Normal file
View File

@ -0,0 +1,21 @@
(in-package :stumpwm)
;; Utils and helpers
(load "~/.stumpwm.d/utils.lisp")
;; Swank
(load "~/.stumpwm.d/swank.lisp")
;; Keybindings and whatnot
(load "~/.stumpwm.d/keyboard.lisp")
;; Groups
(load "~/.stumpwm.d/groups.lisp")
;; The actual rice
(load "~/.stumpwm.d/theme.lisp")
(load "~/.stumpwm.d/gaps.lisp")
(load "~/.stumpwm.d/modeline.lisp")
;; Follow focus on mouse hover
(setq *mouse-focus-policy* :sloppy)

22
.stumpwm.d/keyboard.lisp Normal file
View File

@ -0,0 +1,22 @@
;; C-; as prefix key
(stumpwm:set-prefix-key (stumpwm:kbd "C-;"))
(define-key *top-map* (kbd "s-n") "pull-hidden-next")
(define-key *top-map* (kbd "s-p") "pull-hidden-previous")
(define-key *top-map* (kbd "s-h") "resize 40 0")
(define-key *top-map* (kbd "s-l") "resize -40 0")
(define-key *top-map* (kbd "s-j") "resize 0 40")
(define-key *top-map* (kbd "s-k") "resize 0 -40")
(define-key *top-map* (kbd "s-u") "exec pamixer -i 5")
(define-key *top-map* (kbd "s-d") "exec pamixer -d 5")
(define-key *top-map* (kbd "s-w") "exec xbacklight -inc 5")
(define-key *top-map* (kbd "s-s") "exec xbacklight -dec 5")
(define-key *top-map* (kbd "s-TAB") "fnext")
(define-key *top-map* (kbd "s-ISO_Left_Tab") "fprev")
(define-key *root-map* (kbd "C-t") "exec alacritty")
(define-key *root-map* (kbd "b") "exec firefox")

44
.stumpwm.d/modeline.lisp Normal file
View File

@ -0,0 +1,44 @@
(defun make-bar (label percentage-function &optional (format-string "(~a\%)"))
(let
((percentage (funcall percentage-function)))
(concat label ": \[" (bar percentage 5 #\X #\=) "\]" (format nil format-string percentage))))
(defun get-volume ()
;; Return the volume as a percentage
(parse-integer (run-shell-command "pamixer --get-volume" t)))
(defun get-battery ()
;; Return the current battery level as a percentage
(parse-integer (run-shell-command "acpi | awk -F ',' '{print $2}' | grep -Po '\\d+'" t)))
(defun get-ip ()
;; Return the current ip of the default network interface
(run-shell-command "printf $(ifconfig $(route | grep '^default' | grep -o '[^ ]*$') | grep -Po '\\d+\\.\\d+\\.\\d+\\.\\d+' | head -n1)" t))
(defun get-cpu-temp ()
;; Return current temperature of the first cpu package (core)
(parse-integer (run-shell-command "sensors -A | grep 'Package' | awk '{print $4+0}'" t)))
(setf *status-seperator* " ^3|^] ")
(setf *mode-line* '(
"[^B%n^b]"
"%g"
"%W"
"^>"
"%d"
(:eval (make-bar "VOL" #'get-volume))
(:eval (make-bar "TEMP" #'get-cpu-temp "(~a°C)"))
(:eval (get-ip))))
(if (is-laptop)
(push '(:eval (make-bar "BAT" #'get-battery)) (cdr (last *mode-line*))))
(setf *screen-mode-line-format* (insert-seperators *mode-line* *status-seperator*))
(setf *window-format* "%n%s%c")
(setf *time-modeline-string* "%a %b %e %k:%M:%S")
(setf *mode-line-timeout* 1)
;; Show on each screen
(mapcar
(lambda (x)
(stumpwm:enable-mode-line (stumpwm:current-screen) x t))
(stumpwm:screen-heads (stumpwm:current-screen)))

7
.stumpwm.d/swank.lisp Normal file
View File

@ -0,0 +1,7 @@
;; Connect in emacs with slime-connect on port 4004
(require :swank)
(swank-loader:init)
(swank:create-server :port 4004
:style swank:*communication-style*
:dont-close t)

11
.stumpwm.d/theme.lisp Normal file
View File

@ -0,0 +1,11 @@
(setq *message-window-gravity* :center)
(setq *input-window-gravity* :center)
(setq *mode-line-background-color* "AntiqueWhite")
(setq *mode-line-foreground-color* "Gray20")
(setf *bar-med-color* "^b^1") ;; Red
(setf *bar-crit-color* "^b^2") ;; Green
(setf *bar-hi-color* "^b^3") ;; Yellow
(setf *mode-line-highlight-template* "(^R~A^r)")

18
.stumpwm.d/utils.lisp Normal file
View File

@ -0,0 +1,18 @@
(defun string-include (string1 string2)
(let* ((string1 (string string1)) (length1 (length string1)))
(if (zerop length1)
nil
(labels ((sub (s)
(cond
((> length1 (length s)) nil)
((string= string1 s :end2 (length string1)) string1)
(t (sub (subseq s 1))))))
(sub (string string2))))))
(defun is-laptop ()
(loop for item in (sb-ext:posix-environ) thereis (string-include "LAPTOP" item)))
(defun insert-seperators (l &optional (seperator " | ") (seperated-list (list seperator)))
(if (car l)
(insert-seperators (cdr l) seperator (nconc (list seperator (car l)) seperated-list))
(reverse seperated-list)))

30
.vimrc Normal file
View File

@ -0,0 +1,30 @@
syntax on
set autoindent
set nowrap
set backspace=indent,eol,start
set tabstop=2
set shiftwidth=2
set expandtab
set cursorline
set number relativenumber
set laststatus=2
set statusline=
set statusline+=\ %f
set statusline+=%=
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\[%{&fileformat}\]
set statusline+=\ %p%%
set statusline+=\ %l:%c
highlight Normal ctermbg=NONE
highlight nonText ctermbg=NONE
highlight CursorLine ctermbg=255 ctermfg=NONE
highlight StatusLine ctermbg=255
highlight StatusLineTerm ctermbg=238 ctermfg=255
highlight StatusLineTermNC ctermbg=232 ctermfg=238
set encoding=utf-8

52
.zshrc Normal file
View File

@ -0,0 +1,52 @@
PATH=$PATH:$HOME/scripts:/usr/local/i386elfgcc/bin/:$HOME/.local/bin:/usr/local/opt/binutils/bin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:$HOME/.elixir-ls/release:$HOME/.rowswell/bin
# Print a random ascii arts from ~/ascii-arts
if [ -d "$HOME/ascii-arts" ]
then
echo
echo "======="
logo="$(find $HOME/ascii-arts/* | shuf -n1)"
printf "$(echo $logo | grep -o "[0-9a-zA-Z+\-\.]*$")\n"
echo "======="
printf "$(cat $logo)\n\n"
fi
alias ..="cd .."
alias gc="git checkout"
alias gcm="git commit -S -m"
alias gb="git branch"
alias gbm="git branch -m"
alias ga="git add"
alias gaa="git add ."
alias gpl="git pull"
alias gps="git push"
alias gm="git merge"
alias gss="git status"
alias gsh="git stash"
alias gl="git log"
alias sbcl="rlwrap sbcl"
# Muscle memory is killing me man
alias vim="nvim"
alias startx="sway"
export TERM=xterm-256color
# Alt+b stops at forwardslashes
backward-kill-dir () {
local WORDCHARS=${WORDCHARS/\/}
zle backward-kill-word
zle -f kill
}
zle -N backward-kill-dir
bindkey '^[^?' backward-kill-dir
# ZSH programs
source ~/zsh-stuff/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ~/zsh-stuff/spaceship-prompt/spaceship.zsh
# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory

7
ascii-arts/bat.txt Normal file
View File

@ -0,0 +1,7 @@
=/\ /\=
/ \'._ (\_/) _.'/ \
/ .''._'--(o.o)--'_.''. \
/.' _/ |`'=/ " \='`| \_ `.\
/` .' `\;-,'\___/',-;/` '. '\
/.-' `\(-V-)/` `-.\
` " " `

12
ascii-arts/bear.txt Normal file
View File

@ -0,0 +1,12 @@
(()__(()
/ \
( / \ \
\ o o /
(_()_)__/ \
/ _,==.____ \
( |--| )
/\_.|__|'-.__/\_
/ ( / \
\ \ ( /
) '._____) /
(((____.--(((____/

19
ascii-arts/bsd.txt Normal file
View File

@ -0,0 +1,19 @@
, ,
/( )`
\ \___ / |
/- _ `-/ '
(/\/ \ \ /\
/ / | ` \
O O ) / |
`-^--'`< '
TM (_.) _ ) /
| | |\ | ~|~ \ / `.___/` /
| | | \ | | X `-----' /
`__| | \| _|_ / \ <----. __ / __ \
<----|====O)))==) \) /====
<----' `--' `.__,' \
| |
\ /
______( (_ / \______
,' ,-----' | \
`--{__________) \/

23
ascii-arts/c++.txt Normal file
View File

@ -0,0 +1,23 @@
.-.`
`.://////:.`
.-//////////////-.
`-:////////////////////:-`
`.-///////+oyhdmmmmdhyo+///////-.`
`-:///////+ymMMMMMMMMMMMMMMmy+///////:-`
////////+hMMMMMMMMMMMMMMMMMMMMh+///////:
///////sNMMMMMMMMMNNNNMMMMMMMMMNo///////
//////sMMMMMMMMds+////+sdMMMNdy+////////
/////+NMMMMMMm+//////////+ys+//////++///
/////yMMMMMMN+/////////////dMy////yMd///
/////hMMMMMMm////////////mMMMMMyhMMMMMm/
/////yMMMMMMN+//:::::::////dMy////yMd///
/////+NMMMMMMm/::::::::::/hs+//////++///
//////sMMMMMMMMho/::::/ohMMMMmho////////
/////::+NMMMMMMMMMNNNNMMMMMMMMMN+://////
:/:::::::yMMMMMMMMMMMMMMMMMMMMy:::::::/:
.-::::::::sdMMMMMMMMMMMMMMds::::::::-.
`.-:::::::+shddmmddhs+:::::::-.`
`.-::::::::::::::::::::-.`
`.-::::::::::::-.`
`.-::::::-.`
`..`

View File

@ -0,0 +1,14 @@
__:.__
(_:..'"=
::/ o o\ AHAH!
;'-' (_) Spaceman Spiff .
'-._ ;-' wins again ! _'._|\/:
.:; ; . '- ' /_
:.. ; ;, \ _/, "_<
:.|..| ;: \__ '._____ _)
:.|.'| || _/ /
:.|..| :' `;--:
'.|..|:': _ _ _ :|_\:
.. _:|__| '.\.''..' ) ___________ ( )_):|_|:
:....::''::/ | : :|''| "/ /_=_=_=_=_=/ :_[__'_\3_)
'''' '-''-'-'.__)-'

9
ascii-arts/city.txt Normal file
View File

@ -0,0 +1,9 @@
.|
| |
|'| ._____
___ | | |. |' .---"|
_ .-' '-. | | .--'| || | _| |
.-'| _.| | || '-__ | | | || |
|' | |. | || | | | | || |
___| '-' ' "" '-' '-.' '` |____
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

23
ascii-arts/emacs.txt Normal file
View File

@ -0,0 +1,23 @@
mddhysssssssssyyhdm
mhyso++++++++++oooooossydm
mhyo++++++++++++oooooooooooosydm
mhso++++++++++++/::-.`` `.:ooooosydm
dyo++++++++++oo+++++++/: `ooooooshd
mhs+++++++++//::::---..`` `ooooooooyd
mho++++++++. ``....---/ooooooooooyd
ho++++++oo+- ./+oooooooooooooooooooossyd
dy+++++oooooo/. `:+ooooooooooooooooosssssshm
ho+oooooooooooo+/-` `.:+ooooooooooossssssssyd
mhooooooooooooooooo+/-.` .:+ooooosssssssssssd
dyooooooooooo/:-.` `.-:/ossssssssssssssd
mhoooooooo/- `-:/+ooossssssssssssssssssd
hooooooo- `:ooooooosssssssssssssssssssyd
dyoooooo `oooooosssssssssssssssssssssshm
hsooooo+. .:+oossssssssssssssssssssssyd
mhsoooooo+:-` `````......-:+ssssssyd
mhsoooooooooo+/:----------. `:sssssyd
dysoooosssssssssso+/:-.``.-:/osssssshm
mhyssssssso++/::://++ossssssssssshd
mdysssssssssssssssssssssssssyhd
mdhyssssssssssssssssssyhdm
mmdhhyyyyyyyyyhhdmm

10
ascii-arts/floppy.txt Normal file
View File

@ -0,0 +1,10 @@
.-.-----------.-.
| |-----------|#|
| |-----------| |
| |-----------| |
| |-----------| |
| "-----------' |
| .-----.-.. |
| | | || |||
| | | || \/|
"--^-----^-^^---'

15
ascii-arts/gameboy.txt Normal file
View File

@ -0,0 +1,15 @@
_____________
| _"_________ |
||.---------.||
||| |||
||| |||
||| |||
||'---------'/|
| """"""""""` |
| || ^^^ () |
|[ ] () |
| || |
| _ _ |
| :::|
| .::'/
'""""""""""""`

10
ascii-arts/piglet.txt Normal file
View File

@ -0,0 +1,10 @@
_
_<_/_
__/ _>
'\ ' |
\___/
/+++\
o=|..|..|
| o/..|
0==|+++++|
0======/

14
ascii-arts/pooh-bear.txt Normal file
View File

@ -0,0 +1,14 @@
_
__( )_
( (o____
| |
| (__/
\ / ___
/ \ \___/
/ ^ / \
| | |__|_HUNNY |
| \______)____/
\ /
\ /_
| ( __)
(____)

26
ascii-arts/python.txt Normal file
View File

@ -0,0 +1,26 @@
.-://++++++++++/:-.`
-/+++++++++++++++++++/:.
+++:` .++++++++++++++++/`
+++: .++++++++++++++///-
+++++++++++++++++++/////-
::::::::::-:+++++///////-
`--------------------+++/////////-.yyssss+-
./+++++++++++++++++++++////////////--ddddddddy`
:++++++++++++++++++++++/////////////--dddddddddh`
-+++++++++++++++++++++///////////////.:dddddddddds
/+++++++++++++++++++////////////////:`yddddddddddd
+++++++++++++++++/////////////////:..sdddddddddddd
+++++++++++++/:-.-:////////////::-/sdddddddddddddd
++++++++++++:`:sdmdddddddddddddddddddddddddddddddd
/++++++++++/ ommmddddddddddddddddddddddddddddddddd
-++++++++//:`mmdddddddddddddddddddddddddddddddddd+
:++++++///:`dddddddddddddddddddddddddddddddddddy`
-/++/////:`dddddddddddddddddddddddddddddddddy:
`.::::::-`dddddddddddds++++++++++++++++++/.
`ddddddddddddhyyyyyyyyyyy/
`dddddddddddddddddddddddd/
`ddddddddddddddddd: `+ddd/
`hdddddddddddddddd/``+ddd/
`oddddddddddddddddddddh+
`:+syhdddddddddyy++-`

7
ascii-arts/rubiks.txt Normal file
View File

@ -0,0 +1,7 @@
_ _ _
/_/_/_/\
/_/_/_/\/\
/_/_/_/\/\/\
\_\_\_\/\/\/
\_\_\_\/\/
\_\_\_\/

16
ascii-arts/tux.txt Normal file
View File

@ -0,0 +1,16 @@
_nnnn_
dGGGGMMb ,"""""""""""""".
@p~qp~~qMb | Linux Rules! |
M|@||@) M| _;..............'
@,----.JM| -'
JS^\__/ qKL
dZP qKRb
dZP qKKb
fZP SMMb
HZM MMMM
FqM MMMM
__| ". |\dS"qML
| `. | `' \Zq
_) \.___.,| .'
\____ )MMMMMM| .'
`-' `--'

23
ascii-arts/vim.txt Normal file
View File

@ -0,0 +1,23 @@
-o/-
sdddddddddddddddo :///+- yhhhhhhhhhhhhhhh:
hhhhdddddddddhhh+ -/////- dhhhddddddddddds/
``.dddddddddho:.`.://///:.`-yhdddddddddy+-
`dddddddddho- ////////-.omdddddddddy+-
`dddddddddho- /////:-.omdddddddddy+-
`dddddddddho- ///:-.smdddddddddyo-
`dddddddddho- /:-.smdddddddddyo-`-
`dddddddddho- ..smdddddddddho:`-:++-
--`dddddddddho-`smdddddddddho:`-:////++-
-so.`dddddddddhosmdddddddddho:`.:////////++-
:+:/.`dddddddddhodddddddddho:`.:///////////:/:
`-:.`dddddddddddddddddhs+:`.:////////////:.`
```ddddddddddddddddy/hh::////////////:.`
`ddddddddddddddhs./++-///////////:.`
`dddddddddddddo::-::-:-///-:::/:.` .--`
`ddddddddddds/`.odd+-:.hddhssdddhsydddo
`ddddddddds/`.:-ddy./-+dd--..ddo```ydd.
`dddddddy/.`:/.ydd.::-dd/-.`sdh` :dd+
`dddddy/. `-:-odd/-/.ydy`` :dd: `hdy
+/++/. ``ooo/.:-o+/ /++. -++/`
`-::/-.`
`-.`

1
scripts/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__/*

5
scripts/ascii-table.py Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/python3
rows = (128-32) // 4
for i in range(rows):
print("".join(list(map(lambda x: str(x*rows+i+32).ljust(5) + str(chr(x*rows + i + 32)).strip().ljust(2) + "|", range(4)))))

165
scripts/mediaplayer.py Executable file
View File

@ -0,0 +1,165 @@
#!/usr/bin/env python3
import argparse
import logging
import sys
import signal
import gi
import json
import threading
gi.require_version('Playerctl', '2.0')
from gi.repository import Playerctl, GLib
logger = logging.getLogger(__name__)
cache = {"i": 0, "stopped": True, "text": "Initializing"}
print_thread = None
def wrap_text(text, width, update):
if len(text) <= width:
return text
t = text + " | "
n = update % len(t)
return "".join((t[n:] + t[:n])[0:width])
def print_from_cache():
if cache["stopped"]:
cache["text"] = "" + cache["text"]
sys.stdout.write(json.dumps(cache) + '\n')
sys.stdout.flush()
def print_every_second(width, period=1):
global print_thread
print_thread = threading.Timer(period, print_every_second, [width, period])
print_thread.start()
cache["i"] += 1
cache["text"] = wrap_text(cache["formattedText"], width, cache["i"])
print_from_cache()
def save_in_cache(formattedText, player):
logger.info('Writing output')
cache["formattedText"] = formattedText
cache["class"] = f"custom-{player.props.player_name}"
cache["alt"] = player.props.player_name
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')
cache["stopped"] = False
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:
cache["stopped"] = True
save_in_cache(track_info, player)
print_from_cache()
def on_player_appeared(manager, player, selected_player=None):
if player is not None and (selected_player is None or player.name == selected_player):
cache["stopped"] = False
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')
cache["stopped"] = True
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')
cache["stopped"] = True
print_thread.cancel()
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')
parser.add_argument('--width', default=20)
parser.add_argument('--period', default=1)
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)
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
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)
print_every_second(int(arguments.width), float(arguments.period))
loop.run()
if __name__ == '__main__':
main()

4
scripts/songnotification Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
song=$(playerctl metadata --format "{{ title }}\n{{ artist }}\n{{ album }}")
notify-send "Spotify" "$song" #--icon=~/.config/spotifyd/penguin.jpg