diff --git a/.wallpaper.png b/.wallpaper.png index afff2a1..7283280 100644 Binary files a/.wallpaper.png and b/.wallpaper.png differ diff --git a/README.md b/README.md index 62f6368..ac9d1c1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ - **Terminal**: [Alacritty](https://github.com/alacritty/alacritty) - **Editor**: [nvim](https://neovim.io/) - **Compositor**: [picom](https://github.com/yshui/picom) - - **Bar**: [polybar](https://polybar.github.io/) + - **Bar**: [eww](https://github.com/elkowar/eww) - **Launcher**: [rofi](https://github.com/davatorium/rofi) ## Installing dotfiles diff --git a/doomemacs/.doom.d/init.el b/doomemacs/.doom.d/init.el index fba8db1..8279616 100644 --- a/doomemacs/.doom.d/init.el +++ b/doomemacs/.doom.d/init.el @@ -24,8 +24,8 @@ company ; the ultimate code completion backend ;;helm ; the *other* search engine for love and life ;;ido ; the other *other* search engine... - ;;ivy ; a search engine for love and life - vertico ; the search engine of the future + ivy ; a search engine for love and life + ;; vertico ; the search engine of the future :ui ;;deft ; notational velocity for Emacs @@ -37,8 +37,8 @@ ;;hydra ;;indent-guides ; highlighted indent columns ligatures ; ligatures and symbols to make your code pretty again - minimap ; show a map of the code on the side - modeline ; snazzy, Atom-inspired modeline, plus API + ;; minimap ; show a map of the code on the side + ;; modeline ; snazzy, Atom-inspired modeline, plus API ;;nav-flash ; blink cursor line after big motions neotree ; a project drawer, like NERDTree for vim ophints ; highlight the region an operation acts on diff --git a/emacs/.config/emacs/.gitignore b/emacs/.config/emacs/.gitignore new file mode 100644 index 0000000..c45bae1 --- /dev/null +++ b/emacs/.config/emacs/.gitignore @@ -0,0 +1,54 @@ +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + +# Cache etc +.cache/ +projectile-bookmarks.eld +.lsp-session-v1 +*.dat diff --git a/emacs/.config/emacs/config.el b/emacs/.config/emacs/config.el new file mode 100644 index 0000000..741465f --- /dev/null +++ b/emacs/.config/emacs/config.el @@ -0,0 +1,28 @@ +;; User +(setq user-full-name "E. Almqvist" + user-mail-address "elalmqvist@gmail.com") + +;; Theme +(load-theme 'doom-tomorrow-night t) + +;; Font size +(set-face-attribute 'default nil :height 140 :family "Fira Code") + +;; Enable line numbers +(global-display-line-numbers-mode 1) + +;; Indentation +(setq + indent-tabs-mode t + tab-width 4 +) +(define-key evil-insert-state-map (kbd "TAB") 'tab-to-tab-stop) + +;; TODO keywords etc +;; (setq hl-todo-keyword-faces +;; '(("TODO" . "#EB4034") +;; ("FIXME" . "#EB4034") +;; ("DEBUG" . "#3B5742") +;; ("NOTE" . "#32a852") +;; ("BUG" . "#FCBA03") +;; ("STUB" . "#4287F5"))) diff --git a/emacs/.config/emacs/init.el b/emacs/.config/emacs/init.el new file mode 100644 index 0000000..e3542da --- /dev/null +++ b/emacs/.config/emacs/init.el @@ -0,0 +1,133 @@ +;; Evil mode (vim binds) +(require 'evil) +(evil-mode t) + +;; Projectile (Project management) +(projectile-mode +1) +;; Recommended keymap prefix on macOS +;; (define-key projectile-mode-map (kbd "s-p") 'projectile-command-map) +;; Recommended keymap prefix on Windows/Linux +(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) + +;; Treemacs +(with-eval-after-load 'treemacs + (define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action)) +(global-set-key (kbd "M-d") 'treemacs) ;; Alt + d to open treemacs + + +;; Startup stuff +(setq inhibit-startup-message nil + visible-bell nil) ;; Don't the bell thing + +;; Remove ugly bars +(menu-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) + +;; Disable backup files etc. +(setq make-backup-files nil) + +;; Melpa +(require 'package) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) +(package-initialize) +(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. + '(custom-safe-themes + '("e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2" "7a424478cb77a96af2c0f50cfb4e2a88647b3ccca225f8c650ed45b7f50d9525" "02f57ef0a20b7f61adce51445b68b2a7e832648ce2e7efb19d217b6454c1b644" "a44e2d1636a0114c5e407a748841f6723ed442dc3a0ed086542dc71b92a87aee" "7e377879cbd60c66b88e51fad480b3ab18d60847f31c435f15f5df18bdb18184" default)) + '(package-selected-packages + '(format-all hl-todo elcord evil-tabs evil-commentary format-all auto-complete editorconfig haskell-mode counsel ivy go-mode rust-mode use-package treemacs-evil treemacs projectile doom-themes lsp-mode evil))) + +(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. + ) + +;; LSP +(require 'use-package) +(use-package lsp-mode + :hook ((c-mode ; clangd + c++-mode ; clangd + c-or-c++-mode ; clangd + java-mode ; eclipse-jdtls + js-mode ; ts-ls (tsserver wrapper) + js-jsx-mode ; ts-ls (tsserver wrapper) + typescript-mode ; ts-ls (tsserver wrapper) + python-mode ; pyright + web-mode ; ts-ls/HTML/CSS + haskell-mode ; haskell-language-server + lisp-mode ; + rust-mode ; + go-mode ; + ) . lsp-deferred) + :commands lsp + :config + (setq lsp-auto-guess-root t) + (setq lsp-log-io nil) + (setq lsp-restart 'auto-restart) + (setq lsp-enable-symbol-highlighting nil) + (setq lsp-enable-on-type-formatting nil) + (setq lsp-signature-auto-activate nil) + (setq lsp-signature-render-documentation nil) + (setq lsp-eldoc-hook nil) + (setq lsp-modeline-code-actions-enable nil) + (setq lsp-modeline-diagnostics-enable nil) + (setq lsp-headerline-breadcrumb-enable nil) + (setq lsp-semantic-tokens-enable nil) + (setq lsp-enable-folding nil) + (setq lsp-enable-imenu nil) + (setq lsp-enable-snippet nil) + (setq read-process-output-max (* 1024 1024)) ;; 1MB + (setq lsp-idle-delay 0.5)) + +;; Ivy +(ivy-mode) +(setq ivy-use-virtual-buffers t) +(setq ivy-use-selectable-prompt t) +(setq enable-recursive-minibuffers t) +;; enable this if you want `swiper' to use it +;; (setq search-default-mode #'char-fold-to-regexp) +(global-set-key "\C-s" 'swiper) +(global-set-key (kbd "C-c C-r") 'ivy-resume) +(global-set-key (kbd "") 'ivy-resume) +(global-set-key (kbd "M-x") 'counsel-M-x) +(global-set-key (kbd "M-f") 'counsel-find-file) +(global-set-key (kbd " f") 'counsel-describe-function) +(global-set-key (kbd " v") 'counsel-describe-variable) +(global-set-key (kbd " o") 'counsel-describe-symbol) +(global-set-key (kbd " l") 'counsel-find-library) +(global-set-key (kbd " i") 'counsel-info-lookup-symbol) +(global-set-key (kbd " u") 'counsel-unicode-char) +(global-set-key (kbd "C-c g") 'counsel-git) +(global-set-key (kbd "C-c j") 'counsel-git-grep) +(global-set-key (kbd "C-c k") 'counsel-ag) +(global-set-key (kbd "C-x l") 'counsel-locate) +(global-set-key (kbd "C-S-o") 'counsel-rhythmbox) +(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history) + +;; Editorconfig +(editorconfig-mode 1) + +;; Autocomplete +(ac-config-default) + +;; Evil Commentary (comment thing) +(evil-commentary-mode) + +;; HL TODO FIXME DEBUG STUB NOTE BUG +(hl-todo-mode) + +;; Formatter (format-all) +(global-set-key (kbd "M-g") 'format-all-buffer) +(add-hook 'prog-mode-hook #'format-all-ensure-formatter) + +;; Elcord +(elcord-mode) + +;; Loading config stuff +(load "$HOME/.config/emacs/config.el") diff --git a/emacs/.config/emacs/projects b/emacs/.config/emacs/projects new file mode 100644 index 0000000..5de0a20 --- /dev/null +++ b/emacs/.config/emacs/projects @@ -0,0 +1,2 @@ +;;; -*- lisp-data -*- +(("/home/elal/Projects/game/euclid/")) diff --git a/eww/.config/eww/eww.scss b/eww/.config/eww/eww.scss new file mode 100644 index 0000000..b1d5ead --- /dev/null +++ b/eww/.config/eww/eww.scss @@ -0,0 +1,182 @@ +// Font stuff +$font-size: 16px; +$icon-size: 18px; +$logo-size: 22px; + +// Basic colors +$black: #121212; +$red: #f7768c; +$green: #9ece6a; +$yellow: #e0af68; +$blue: #aabbff; +$magenta: #ad8ee6; +$cyan: #449dab; +$white: #787c99; + +// Colors +$bg-color: #181818; +$bg-alt-color: #242424; +$fg-color: #ebdbb2; +$fg-alt-color: #635c4b; +$fg-sel-color: $blue; +$border-color: #484848; + +$fg-accent: $blue; + +// Misc +$anim-transition: 150ms; + +* { + all: unset; //Unsets everything so you can style everything from scratch + font-family: "Fira Code"; + // color: $fg-color; +} + +tooltip { + color: $fg-alt-color; + background-color: $bg-alt-color; +} + +.bar-1, .bar-2 { + background-color: $bg-color; + color: $fg-color; + border-right: solid 1px $border-color; + padding: .3rem; +} + +.segment-end { +} + +// Styles on classes (see eww.yuck for more information) +button { + transition-property: opacity, color; + transition-duration: $anim-transition; +} + +// Workspaces +.workspaces { + // background-color: $bg-alt-color; + // padding: .3rem; + // border: solid 1px $black; + // border-radius: $font-size; +} + +.workspaces > button { + font-size: $font-size; + margin: 4px; +} + +.workspaces > button:hover { + color: $fg-accent; + opacity: 0.8; +} + +button.active { + font-weight: bold; + color: $blue; +} +button.inactive { opacity: 0.2; } + +// Generic stuff +scale trough { + all: unset; + background-color: $bg-alt-color; + border-radius: 5px; + min-height: 60px; + min-width: 4px; + margin: .3rem 0 .3rem 0; +} + +// Menu +.powermenu { + transition: color $anim-transition; + // border-right: solid 1px $border-color; + padding: .5rem .2rem .3rem .2rem; +} + +.quit, .lock, .reboot, .poweroff { + // padding: .5rem .2rem .3rem .2rem; +} + +// Colors for the buttons +.lock:hover { color: $white; } +.quit:hover { color: $green; } +.reboot:hover { color: $yellow; } +.poweroff:hover { color: $red; } + +.pm-active { + // background-color: $bg-alt-color; + // border-radius: 5px; +} + +.pm-inner { + padding: .2rem 0; +} + +// Control +.control { + margin-bottom: $logo-size; + padding: .5rem; + margin: 0 .5rem 0 .5rem; + font-family: Material Icons; + font-size: 1.6em; + border-radius: 5px; +} +.icon { + opacity: 0.4; + margin: 0 .2rem; + font-size: $icon-size; + font-family: Material Icons; + padding: 0 1px; +} + +.icon:hover { + opacity: 1.0; + // color: red; +} + +// Volume stuff +.volbar trough highlight { + background-color: $fg-accent; + border-radius: 5px; +} + +// Time +.time { + font-size: 11px; + font-weight: bold; + border-top: solid 2px $border-color; + color: $fg-alt-color; + padding: 1rem 0; + padding-bottom: 0rem; + margin: .5rem 0 .5rem 0; +} + +// Logo button +.logo { + margin: 0 .8rem; + margin-top: 6px; + font-size: $logo-size; + opacity: 0.5; +} + +.logo-seperator { + border-bottom: 2px solid $border-color; + padding-bottom: .4rem; +} + +// Color overrides +.red { + color: $red; + opacity: 0.8; +} + + +// Music widget +.musicmenu { + // background-color: $bg-alt-color; +} + +.mm-inner { + color: $blue; +} diff --git a/eww/.config/eww/eww.yuck b/eww/.config/eww/eww.yuck new file mode 100644 index 0000000..ebb23c4 --- /dev/null +++ b/eww/.config/eww/eww.yuck @@ -0,0 +1,296 @@ +(defwidget bar [screen] + (box :orientation "v" + :vexpand "false" + :hexpand "false" + (box :class "segment-start" + :valign "start" + :halign "center" + :space-evenly false + :orientation "v" + :space-evenly false + (power :screen screen) + ) + (box :class "segment-mid" + :valign "center" + :halign "center" + :orientation "v" + :space-evenly false + (workspaces :wsp workspaces-data :screen screen) + ) + (box :class "segment-end" + :valign "end" + :halign "center" + :orientation "v" + :space-evenly true + (control :screen screen) + ) + ) +) + +(defwidget bar-2 [screen] + (box :orientation "v" + :vexpand "false" + :hexpand "false" + (box :class "segment-start" + :valign "start" + :halign "center" + :space-evenly false + :orientation "v" + :space-evenly false + ;; (power :screen screen) + ) + (box :class "segment-mid" + :valign "center" + :halign "center" + :orientation "v" + :space-evenly false + (workspaces :wsp workspaces-data :screen screen) + ) + (box :class "segment-end" + :valign "end" + :halign "center" + :orientation "v" + :space-evenly true + (control-2 :screen screen) + ) + ) +) + +;; Powermenu widget +(defwidget power [] + (eventbox ;;:onhover "${EWW_CMD} update power=true" + :onhoverlost "${EWW_CMD} update power=false" + (box :orientation "v" + :space-evenly "false" + :vexpand "false" + :class "powermenu ${power ? 'pm-active' : ''}" + ;; Open menu button + (button :class "icon logo ${power ? 'logo-seperator' : ''}" + :tooltip "Open menu" + :onclick "${EWW_CMD} update power=true" "Λ") + (revealer :transition "slidedown" + :reveal power + :duration "450ms" + (box :orientation "v" + :class "pm-inner" + :space-evenly true + :halign "middle" + :spacing 6 + + ;; Lock screen + (button :class "icon lock" + :tooltip "Lock screen" + :onclick "betterlockscreen -l" "") + + ;; Quit WM (goto login manager) + (button :class "icon quit" + :tooltip "Logout" + :onclick "killall xmonad-x86_64-linux" "") + + ;; Reboot + (button :class "icon reboot" + :tooltip "Reboot" + :onclick "reboot" "") + + ;; Poweroff + (button :class "icon poweroff" + :tooltip "Poweroff" + :onclick "poweroff" "") + + )) + ))) +(defvar power false) + +;; Control widget (container) +(defwidget control [] + (box :class "control" :spacing 12 :space-evenly false :orientation "v" + ;; (wifi) + ;; (bat) + (music) + (volume) + (time) + ) + ) + +(defwidget control-2 [] + (box :class "control" :spacing 12 :space-evenly false :orientation "v" + ;; (wifi) + ;; (bat) + ;; (music) + ;; (volume) + (time) + ) + ) + +;; Clock Widget +(defwidget time [] + (box :orientation "v" + :class "time" + :valign "end" + (button :onclick "scripts/popup calendar" + :class "hour" hour) + (button :onclick "scripts/popup calendar" + :class "min" min) + (button :onclick "scripts/popup calendar" + :class "sec" sec) + )) +(defpoll hour :interval "1s" "date '+%H'") +(defpoll min :interval "1s" "date '+%M'") +(defpoll sec :interval "1s" "date '+%S'") + +;; Volume widget +(defwidget volume [] + (eventbox :onhover "${EWW_CMD} update volume=true" + :onhoverlost "${EWW_CMD} update volume=false" + (box :orientation "v" + :space-evenly "false" + :spacing 2 + (revealer :transition "slideup" + :reveal volume + :duration "450ms" + (scale :class "volbar" + :value current-volume + :orientation "v" + :flipped true + :tooltip "Volume: ${current-volume}%" + :max 101 + :min 0 + :onchange "amixer -D pulse sset Master {}%" + ) + ) + (button :onclick "amixer -D pulse set Master 1+ toggle" + :class "icon volume + ${muted-volume != 'on' ? 'red' : ''}" + :tooltip "Volume: ${current-volume}%" + {muted-volume != "on" ? "ﱝ" : "墳"} + ) + ))) +(defvar volume false) +(defpoll current-volume :interval "1ms" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defpoll muted-volume :interval "1ms" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $4 }' | tr -d '%'") + +;; Battery Widgets ;; +(defwidget bat [] + (box :orientation "v" + :space-evenly "false" + (label :class "icon bat" + :halign "middle" + :text battery + :tooltip "Battery: ${battery-cappacity}%"))) +(defpoll battery :interval "1s" "scripts/battery icon") +(defpoll battery-cappacity :interval "1s" "scripts/battery percent") + +;; Wifi Widgets ;; +(defwidget wifi [] + (box :orientation "v" + :halign "middle" + :tooltip "SSID: ${wifi-name}" + (button :class "icon wifi-icon" wifi-icon + ))) +(defpoll wifi-icon :interval "1s" "scripts/wifi icon") +(defpoll wifi-name :interval "1s" "scripts/wifi name") + +;; Workspaces container +(defwidget workspaces [wsp] + (box :space-evenly true :spacing 4 :orientation "v" :class "workspaces" + (for ws in wsp + (workspace :data ws) + ))) + +;; Workspace widget +(defwidget workspace [data] + (button :onclick "wmctrl -s ${data['index']}" + :class {data["iscurrent"] == true ? "active" : "inactive"} + "${data['name']}" + )) +(deflisten workspaces-data "scripts/workspace.py") + +;; Music widget +(defwidget music [] + (revealer :reveal {music-active == "true"} + (eventbox :onhover "${EWW_CMD} update music=true" + :onhoverlost "${EWW_CMD} update music=false" + ;; :onclick "wget ${artUrl} -O /tmp/cover.jpg; sleep 1; notify-send -i /tmp/cover.jpg '${title} - ${artist}' '${songtime}'" + (box :orientation "v" + :space-evenly "false" + :vexpand "false" + :class "musicmenu ${music ? 'mm-active' : ''}" + (revealer :transition "slideup" + :reveal music + :flipped true + :duration "450ms" + (box :orientation "v" + :class "mm-inner" + :space-evenly true + :halign "middle" + :spacing 4 + + ;; Next + (button :class "icon next" + :tooltip "Pause/play" + :onclick "playerctl next" "") + ;; Pause + (button :class "icon pause" + :tooltip "Pause/play" + :onclick "playerctl play-pause" {music-status == "Playing" ? "" : ""}) + + ;; Pause + (button :class "icon prev" + :tooltip "Pause/play" + :onclick "playerctl previous" "") + + )) + ;; Open menu button + (button :class "icon" + :tooltip "${title} - ${artist}" + :onclick "${EWW_CMD} update music=true" "") + + ) + ))) + +(defpoll music-active :interval "200ms" "scripts/musicstatus") +(defpoll music-status :interval "200ms" "playerctl status") +(defpoll artUrl :interval "200ms" "playerctl metadata artUrl") +(defpoll title :interval "200ms" "playerctl metadata title") +(defpoll artist :interval "200ms" "playerctl metadata artist") +(defpoll songtime :interval "500ms" "scripts/getSongDuration") + +(defvar music false) + +;; WINDOWS +(defwindow bar-1 + :monitor 0 + :windowtype "dock" + :geometry (geometry :x "0%" + :y "0%" + :width "42px" + :height "100%" + :anchor "left center") + :reserve (struts :side "left" :distance "42px") + :hexpand "false" + :vexpand "false" + (bar :screen 1)) + +(defwindow bar-2 + :monitor 1 + :windowtype "dock" + :geometry (geometry :x "0%" + :y "0%" + :width "42px" + :height "100%" + :anchor "left center") + :reserve (struts :side "left" :distance "42px") + :hexpand "false" + :vexpand "false" + (bar-2 :screen 2)) + +(defwindow time-thing + :monitor 0 + :geometry (geometry :x "0%" + :y "0%" + :width "182px" + :height "38px" + :anchor "right top" + ) + :reserve (struts :side "right" :distance "0px" :orientation "h") + (time)) + diff --git a/eww/.config/eww/scripts/__pycache__/workspace.cpython-310.pyc b/eww/.config/eww/scripts/__pycache__/workspace.cpython-310.pyc new file mode 100644 index 0000000..e376774 Binary files /dev/null and b/eww/.config/eww/scripts/__pycache__/workspace.cpython-310.pyc differ diff --git a/eww/.config/eww/scripts/battery b/eww/.config/eww/scripts/battery new file mode 100755 index 0000000..300c017 --- /dev/null +++ b/eww/.config/eww/scripts/battery @@ -0,0 +1,44 @@ +#!/bin/sh + +bat=/sys/class/power_supply/BAT0/ +per="$(cat "$bat/capacity")" + +icon() { + +[ $(cat "$bat/status") = Charging ] && echo "" && exit + +if [ "$per" -gt "90" ]; then + icon="" +elif [ "$per" -gt "80" ]; then + icon="" +elif [ "$per" -gt "70" ]; then + icon="" +elif [ "$per" -gt "60" ]; then + icon="" +elif [ "$per" -gt "50" ]; then + icon="" +elif [ "$per" -gt "40" ]; then + icon="" +elif [ "$per" -gt "30" ]; then + icon="" +elif [ "$per" -gt "20" ]; then + icon="" +elif [ "$per" -gt "10" ]; then + icon="" + notify-send -u critical "Battery Low" "Connect Charger" +elif [ "$per" -gt "0" ]; then + icon="" + notify-send -u critical "Battery Low" "Connect Charger" +else + echo  && exit +fi +echo "$icon" +} + +percent() { +echo $per +} + +[ "$1" = "icon" ] && icon && exit +[ "$1" = "percent" ] && percent && exit +exit diff --git a/eww/.config/eww/scripts/musicstatus b/eww/.config/eww/scripts/musicstatus new file mode 100755 index 0000000..ea23bcc --- /dev/null +++ b/eww/.config/eww/scripts/musicstatus @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +status=$(playerctl status &>/dev/stdout) + +if [[ "$status" == "No players found" ]] +then + echo "false" +else + echo "true" +fi + + diff --git a/eww/.config/eww/scripts/wifi b/eww/.config/eww/scripts/wifi new file mode 100755 index 0000000..f0c0033 --- /dev/null +++ b/eww/.config/eww/scripts/wifi @@ -0,0 +1,13 @@ +#!/bin/sh + +symbol() { +[ $(cat /sys/class/net/w*/operstate) = down ] && echo  && exit +echo  +} + +name() { +nmcli | grep "^wlp" | sed 's/\ connected\ to\ /Connected to /g' | cut -d ':' -f2 +} + +[ "$1" = "icon" ] && symbol && exit +[ "$1" = "name" ] && name && exit diff --git a/eww/.config/eww/scripts/workspace.py b/eww/.config/eww/scripts/workspace.py new file mode 100755 index 0000000..dc1838c --- /dev/null +++ b/eww/.config/eww/scripts/workspace.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python + +""" +Script to get current workspaces and related +data using wmctrl. +""" + +import re +import sys +import json +from subprocess import check_output, CalledProcessError + +# Config +HIDE_EMPTY_WS = True # Exclude empty workspaces +OVERIDE_ALL_NAMES = False # Override all the WS names and use the name below +OVERIDE_ALL_NAME = "" # Name to use when overriding names +NAME_MAPS: dict[int, str] = { # Replace the indexs name with the given string + # 0: "", + # 1: "" +} +LOG_FILE = "/tmp/eww_workspace.log" # Log file (in case of errors etc) + + +# ------------ NOTE: DO NOT TOUCH ------------ + +WMCTRL_SCRIPT = "wmctrl -d" +PARSE_REGEX = r"^(\d+)\s+(\*|\-).+\s+(\w+)$" + +NONEMPTY_REGEX = r"^\w+\s+(\w+|\d+).+$" +WMCTRL_NONEMPTY_SCRIPT = "wmctrl -l" + + +def parse_groups(grps: tuple) -> tuple: + """ + Parses the given regex groups + """ + return int(grps[0]), grps[2], grps[1] == "*" + + +class Workspace: + """ + Class for a workspace + """ + + def __init__(self, index: int, name: str, iscurrent: bool, isempty: bool): + self.index = index + if OVERIDE_ALL_NAMES: + self.name = OVERIDE_ALL_NAME + elif index in NAME_MAPS.keys(): + self.name = NAME_MAPS[index] + else: + self.name = name + self.iscurrent = iscurrent + self.isempty = isempty + + def to_json(self): + """ + Converts the given object to json + """ + return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True) + + +def parse_workspaces(): + """ + Function to get all the workspaces + """ + + try: + nonempty = check_output(WMCTRL_NONEMPTY_SCRIPT.split(" ")) + nonempty = nonempty.decode("utf-8") + + nonempty_workspaces = re.findall(NONEMPTY_REGEX, + nonempty, + flags=re.MULTILINE) + nonempty_workspaces = list(map(int, nonempty_workspaces)) + except CalledProcessError: + nonempty_workspaces = [] + + try: + inp = check_output(WMCTRL_SCRIPT.split(" ")) + inp = inp.decode("utf-8") + except CalledProcessError as err: + logfile = open(LOG_FILE, "a") + logfile.write("ERROR! COULD NOT PARSE WORKSPACES OR SOMETHING! YOU ARE ON YOUR OWN.") + logfile.write(f"{err}") + + inp = "" + + out = [] + + for line in inp.splitlines(): + matches = re.search(PARSE_REGEX, line) + grps = matches.groups() + data = parse_groups(grps) + workspace = Workspace(*data, data[0] not in nonempty_workspaces) + + out.append(workspace) + + return out + + +if __name__ == "__main__": + args = sys.argv + + # NOTE: use deflisten + LAST_STRING = "" + while True: + workspaces = parse_workspaces() + workspaces = list(filter(lambda ws: + (ws.iscurrent) + or (not ws.isempty) + or (not HIDE_EMPTY_WS), + workspaces)) + + json_str = json.dumps(workspaces, default=lambda ws: ws.to_json()) + + if json_str != LAST_STRING: + print(f"{json_str}", flush=True) # Output to eww + + LAST_STRING = json_str diff --git a/picom/.config/picom/picom.conf b/picom/.config/picom/picom.conf index aac47d7..29d856a 100644 --- a/picom/.config/picom/picom.conf +++ b/picom/.config/picom/picom.conf @@ -77,9 +77,9 @@ focus-exclude = [ "class_g = 'Cairo-clock'" ]; # Parameters for background blurring, see the *BLUR* section for more information. -blur-method = "dual_kawase"; -blur-strength = 8; -blur-size = 2; +# blur-method = "dual_kawase"; +# blur-strength = 8; +# blur-size = 2; # diff --git a/preview.png b/preview.png index 7fd77fe..4b9af6d 100644 Binary files a/preview.png and b/preview.png differ diff --git a/xmonad/.xmonad/bin/autostart.sh b/xmonad/.xmonad/bin/autostart.sh index e97353f..9d70247 100755 --- a/xmonad/.xmonad/bin/autostart.sh +++ b/xmonad/.xmonad/bin/autostart.sh @@ -22,7 +22,11 @@ xset -dpms & #eww open bar # Polybar -$HOME/.config/polybar/launch & +# $HOME/.config/polybar/launch & + +# EWW widgets +eww daemon & +eww open-many bar-1 bar-2 & # the bar # Keyring eval $(gnome-keyring-daemon --start) diff --git a/xmonad/.xmonad/xmonad.hs b/xmonad/.xmonad/xmonad.hs index 17c3d53..0305859 100644 --- a/xmonad/.xmonad/xmonad.hs +++ b/xmonad/.xmonad/xmonad.hs @@ -15,7 +15,7 @@ import qualified Data.Map as M import XMonad.Hooks.EwmhDesktops (ewmh) import XMonad.Hooks.InsertPosition import XMonad.Layout.Fullscreen (fullscreenSupport) -import XMonad.Layout.IndependentScreens (withScreens) +-- import XMonad.Layout.IndependentScreens (withScreens) import XMonad.Layout.ToggleLayouts (ToggleLayout(Toggle)) import qualified XMonad.StackSet as W import XMonad.Util.Run (spawnPipe) @@ -56,7 +56,8 @@ myModMask = mod4Mask -- -- > workspaces = ["web", "irc", "code" ] ++ map show [4..9] -- -myWorkspaces = map show [1 .. 9] +-- myWorkspaces = map show [1 .. 9] +myWorkspaces = map show [1..9] -- Border colors for unfocused and focused windows, respectively. -- @@ -80,7 +81,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = -- launch rofi shell , ((modm, xK_p), spawn "rofi -show run") -- pause cmus - , ((modm, xK_u), spawn "cmus-remote --pause") + , ((modm, xK_u), spawn "playerctl play-pause") -- spawn firefox , ((modm, xK_b), spawn "firefox") -- screenshot @@ -263,7 +264,7 @@ defaults = , clickJustFocuses = myClickJustFocuses , borderWidth = myBorderWidth , modMask = myModMask - , workspaces = withScreens 2 myWorkspaces + , workspaces = myWorkspaces , normalBorderColor = myNormalBorderColor , focusedBorderColor = myFocusedBorderColor -- key bindings diff --git a/zathura/.config/zathura/gruvbox-dark b/zathura/.config/zathura/gruvbox-dark index 8e91fe6..88ebdcc 100644 --- a/zathura/.config/zathura/gruvbox-dark +++ b/zathura/.config/zathura/gruvbox-dark @@ -1,8 +1,8 @@ -set notification-error-bg "#282828" # bg +set notification-error-bg "#181818" # bg set notification-error-fg "#fb4934" # bright:red -set notification-warning-bg "#282828" # bg +set notification-warning-bg "#181818" # bg set notification-warning-fg "#fabd2f" # bright:yellow -set notification-bg "#282828" # bg +set notification-bg "#181818" # bg set notification-fg "#b8bb26" # bright:green set completion-bg "#504945" # bg2 @@ -18,23 +18,23 @@ set index-fg "#ebdbb2" # fg set index-active-bg "#83a598" # bright:blue set index-active-fg "#504945" # bg2 -set inputbar-bg "#282828" # bg +set inputbar-bg "#181818" # bg set inputbar-fg "#ebdbb2" # fg -set statusbar-bg "#504945" # bg2 +set statusbar-bg "#181818" # bg2 set statusbar-fg "#ebdbb2" # fg set highlight-color "#fabd2f" # bright:yellow set highlight-active-color "#fe8019" # bright:orange -set default-bg "#282828" # bg +set default-bg "#181818" # bg set default-fg "#ebdbb2" # fg set render-loading true -set render-loading-bg "#282828" # bg +set render-loading-bg "#181818" # bg set render-loading-fg "#ebdbb2" # fg # Recolor book content's color -set recolor-lightcolor "#282828" # bg +set recolor-lightcolor "#181818" # bg set recolor-darkcolor "#ebdbb2" # fg set recolor "true" # set recolor-keephue true # keep original color