git scripts

This commit is contained in:
Miguel Palhas
2024-10-06 14:36:09 +01:00
parent 1585865544
commit a436a816b6
14 changed files with 181 additions and 456 deletions
-1
View File
@@ -10,7 +10,6 @@
programs = {
home-manager.enable = true;
fzf.enable = true;
};
home = {
+19 -19
View File
@@ -1,26 +1,26 @@
{ pkgs, ... }: {
home.packages = [
{ pkgs, ... }:
{
home.packages = with pkgs; [
# various
pkgs.google-chrome
pkgs.firefox-devedition
pkgs.spotify
pkgs.spicetify-cli
pkgs.xfce.thunar
pkgs.obsidian
pkgs.mpv
pkgs.obs-studio
pkgs.calibre
pkgs.gimp
pkgs.font-manager
google-chrome
firefox-devedition
spotify
spicetify-cli
xfce.thunar
obsidian
mpv
obs-studio
calibre
gimp
font-manager
# communication
pkgs.slack
pkgs.zoom-us
slack
zoom-us
# dev tools
pkgs.ferdium
pkgs.bruno
pkgs.bun
ferdium
bruno
bun
];
}
+27 -231
View File
@@ -1,248 +1,44 @@
//
// catppuccin-mocha
//
$rosewater: #f5e0dc;
$flamingo: #f2cdcd;
$pink: #ff3ac6;
$mauve: #cba6f7;
$red: #f38ba8;
$maroon: #eba0ac;
$peach: #f9e2af;
$yellow: #f9e2af;
$green: #a6e3a1;
$teal: #94e2d5;
$sky: #89dceb;
$sapphire: #74c7ec;
$blue: #89b4fa;
$lavender: #b4befe;
$text: #cdd6f4;
$subtext1: #bac2de;
$subtext0: #a6adc8;
$overlay2: #9399b2;
$overlay1: #7f849c;
$overlay0: #6c7086;
$surface2: #585b70;
$surface1: #45475a;
$surface0: #313244;
$base: #1e1e2e;
$mantle: #181825;
$crust: #11111b;
:not(menu):not(menuitem) {
all: unset;
font-family:
Material Design Icons,
FiraCode Nerd Font;
* {
all: unset; // Unsets everything so you can style everything from scratch
}
//
// color theming
//
tooltip.background,
.window,
menu,
menuitem,
// Global Styles
.bar {
background-color: $crust;
}
.memory * {
color: $mauve;
}
.cpu * {
color: $peach;
}
.cputemp * {
color: $red;
}
.battery * {
color: $red;
}
.clock {
color: $text;
}
//
// General
//
.bar {
// min-height: 30px;
font-size: 16;
transition: all 0.1s ease-out;
border-radius: 0px 0px 10 10;
}
.bar {
opacity: 1;
}
.space {
margin: 0px 10px;
}
//
// tooltip
//
tooltip.background {
border-radius: 10px;
}
tooltip label {
}
//
// clock
//
.clock-time {
font-weight: bold;
margin-right: 5px;
}
//
// circular bars
//
.circle {
border-radius: 10px;
margin: 0 5;
}
.circle .icon {
font-size: 16px;
background-color: #3a3a3a;
color: #b0b4bc;
padding: 10px;
}
//
// sliders
//
// Styles on classes (see eww.yuck for more information)
.slider,
.slider trough highlight {
.sidestuff slider {
all: unset;
color: #ffd5cd;
}
.metric scale trough highlight {
all: unset;
background-color: #D35D6E;
color: #000000;
border-radius: 10px;
}
//
// network
//
.network,
.volume {
margin: 0 5px;
& button {
margin-right: 10;
}
.connected {
color: $green;
}
.disconnected {
color: $peach;
}
.metric scale trough {
all: unset;
background-color: #4e4e4e;
border-radius: 50px;
min-height: 3px;
min-width: 50px;
margin-left: 10px;
margin-right: 20px;
}
//
// brightness
//
.bright_icon {
font-size: 12;
color: #e4c9af;
.label-ram {
font-size: large;
}
//
// sliders
//
.slider trough highlight {
background-image: linear-gradient(
to right,
$yellow 30%,
$peach 50%,
$red 100% * 50
);
.workspaces button:hover {
color: #D35D6E;
}
scale trough {
background-color: $surface1;
border-radius: 16px;
min-height: 10px;
min-width: 100px;
}
//
// systray
//
menu {
border-radius: 16px;
}
menuitem {
padding: 8px;
border-radius: 8px;
color: $text;
background-color: $surface2;
&:disabled {
color: $overlay2;
}
}
//
// workspaces
//
.w0,
.w01,
.w02,
.w03,
.w04,
.w05,
.w06,
.w011,
.w022,
.w033,
.w044,
.w055,
.w066 {
border-radius: 10px;
font-size: 16px;
padding: 5px 5;
min-height: 25px;
min-width: 60px;
}
// Unoccupied
.w0 {
color: $overlay0;
}
// Occupied
.w01,
.w02,
.w03,
.w04,
.w05,
.w06 {
color: $text;
}
// Focused
.w011,
.w022,
.w033,
.w044,
.w055,
.w066 {
font-size: 16px;
background-color: $sky;
color: $crust;
font-weight: bold;
}
+63 -151
View File
@@ -1,164 +1,76 @@
;; Variables
(defpoll clock_time :interval "5s" "date +\%I:%M")
(defpoll clock_date :interval "1m" "date '+%d/%m'")
(defpoll volume_percent :interval "3s" :initial 0 "pactl get-sink-volume @DEFAULT_SINK@ | head -n1 | cut -d'/' -f 2 | xargs | tr -d '%'")
;; (defpoll brightness_percent :interval "5s" "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")
(defpoll bwindowrulesattery :interval "15s" "./scripts/battery --bat")
(defpoll battery_status :interval "1m" "./scripts/battery --bat-st")
(defpoll memory :interval "5s" :initial 0 "scripts/memory")
(defpoll cpu :interval "5s" :initial 0 "scripts/cpu")
(defpoll cputemp :interval "5s" :initial 0 "scripts/cputemp")
(defpoll memory_used_mb :interval "2m" "scripts/mem-ad used")
(defpoll memory_total_mb :interval "2m" "scripts/mem-ad total")
(defpoll memory_free_mb :interval "2m" "scripts/mem-ad free")
(defvar bar_hover false)
(deflisten workspace "scripts/workspace")
(defwidget bar []
(centerbox :orientation "h"
(workspaces)
(music)
(sidestuff)))
(defvar eww "/home/naps62/.bin/eww -c $HOME/.config/eww")
(defvar exec_audio_control "hyprctl dispatch exec '[center]' pavucontrol")
(defvar exec_nmtui "hyprctl dispatch exec '[center]' 'kitty --class eww-nmtui -e nmtui'")
(defvar exec_workspace_scroll "echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace")
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
(metric :label "🔊"
:value volume
:onchange "amixer -D pulse sset Master {}%")
(metric :label ""
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label "💾"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
time))
(defpoll network_name :interval "1m" "~/.config/eww/scripts/network name")
(defpoll network_icon :interval "1m" "~/.config/eww/scripts/network icon")
(defpoll network_class :interval "1m" "~/.config/eww/scripts/network class")
(defwidget workspaces []
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
:spacing 10
(button :onclick "wmctrl -s 0" 1)
(button :onclick "wmctrl -s 1" 2)
(button :onclick "wmctrl -s 2" 3)
(button :onclick "wmctrl -s 3" 4)
(button :onclick "wmctrl -s 4" 5)
(button :onclick "wmctrl -s 5" 6)
(button :onclick "wmctrl -s 6" 7)
(button :onclick "wmctrl -s 7" 8)
(button :onclick "wmctrl -s 8" 9)))
;;
;; widgets
;;
(defwidget widget_network []
(box :class "network" :space-evenly "false"
(button :class "${network_class}" :onclick exec_nmtui "${network_icon} ${network_name}")))
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
{music != "" ? "🎵${music}" : ""}))
(defwidget widget_workspaces []
(eventbox :onscroll exec_workspace_scroll
(literal :content workspace))
)
;; (defwidget widget_battery []
;; (circular-progress :value battery
;; :class "circle battery"
;; :thickness 4
;; (button
;; :class "icon"
;; :tooltip "battery on ${battery}%"
;; "󰂁")))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 101
:active {onchange != ""}
:value value
:onchange onchange)))
(defwidget widget_cputemp []
(circular-progress :value cputemp
:class "circle cputemp"
:thickness 4
(button
:class "icon"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰔏")))
(defwidget widget_ram []
(circular-progress :value memory
:class "circle memory"
:thickness 4
(button
:class "icon"
:tooltip "using ${memory}% ram"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰍛")))
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
(defwidget widget_cpu []
(circular-progress :value cpu
:class "circle cpu"
:thickness 4
(button
:class "icon"
:tooltip "using ${memory}% CPU"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰻠")))
(defpoll volume :interval "1s"
"scripts/getvol")
(defwidget widget_space []
(box :class "space"))
(defpoll time :interval "10s"
"date '+%H:%M %b %d, %Y'")
(defwidget widget_clock []
(box :class "clock"
(label :text clock_time :class "clock-time")
(button :class "clock-date" clock_date)))
(defwidget widget_volume []
(box :class "volume" :space-evenly "false"
(button :onclick exec_audio_control "󰕾")
(scale :class "slider"
:value volume_percent
:tooltip "${volume_percent}%"
:max 100
:min 0
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%" )))
;; (defwidget widget_bright []
;; (eventbox :onhover "${eww} update br_reveal=true" :onhoverlost "${eww} update br_reveal=false"
;; (box :class "module-2" :space-evenly "false" :orientation "h" :spacing "3"
;; (label :text "" :class "bright_icon" :tooltip "brightness")
;; (revealer :transition "slideleft"
;; :reveal br_reveal
;; :duration "350ms"
;; (scale :class "slider brightness"
;; :value brightness_percent
;; :orientation "h"
;; :tooltip "${brightness_percent}%"
;; :max 100
;; :min 0
;; :onchange "brightnessctl set {}%" )))))
;;
;; bar layout
;;
(defwidget left []
(box :orientation "h"
:space-evenly false
:halign "start"
(widget_workspaces)))
(defwidget center []
(box :orientation "h"
:space-evenly false
:halign "center"
(box)))
(defwidget right []
(box :orientation "h"
:space-evenly false
:halign "end"
;; (widget_bright)
(widget_volume)
(widget_network)
(widget_space)
;; (widget_battery)
(widget_ram)
(widget_cpu)
(widget_cputemp)
(widget_space)
(systray)
(widget_space)
(widget_clock)
(widget_space)))
(defwidget bar_inner []
(box
:orientation "h"
(left)
(right)))
;;
;; main window
;;
(defwindow bar
:geometry (
geometry
:x "0%"
:y "0px"
:width "2080px"
:anchor "top center")
:windowtype "dock"
:monitor 0
:exclusive true
(bar_inner))
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "20px")
(bar))
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
if command -v pamixer &>/dev/null; then
if [ true == $(pamixer --get-mute) ]; then
echo 0
exit
else
pamixer --get-volume
fi
else
amixer -D pulse sget Master | awk -F '[^0-9]+' '/Left:/{print $3}'
fi
+29 -11
View File
@@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
xdg.configFile."git/commit-message.txt".source = ./commit-message.txt;
xdg.configFile."git/ignore".source = ./ignore;
@@ -7,10 +8,8 @@
userName = "Miguel Palhas";
userEmail = "mpalhas@gmail.com";
aliases = {
ls =
"log --color --graph --oneline --decorate --topo-order --pretty=format:'%C(yellow)%d%Creset %Cgreen(%cr)%Creset %C(bold blue)[%an]%Creset %s %Cred(%h)%Creset' --abbrev-commit";
ll = ''
log --reverse --pretty=format:"%C(yellow)%h%Cred%d\ %Creset%s%Cblue\ [%an]" --decorate --numstat'';
ls = "log --color --graph --oneline --decorate --topo-order --pretty=format:'%C(yellow)%d%Creset %Cgreen(%cr)%Creset %C(bold blue)[%an]%Creset %s %Cred(%h)%Creset' --abbrev-commit";
ll = ''log --reverse --pretty=format:"%C(yellow)%h%Cred%d\ %Creset%s%Cblue\ [%an]" --decorate --numstat'';
conf = "diff --name-only --diff-filter=U";
ba = "branch -a";
pb = "publish";
@@ -34,14 +33,33 @@
editor = "nvim";
pager = "delta";
};
commit = { template = "~/.config/git/commit-message.txt"; };
push = { default = "upstream"; };
delta = { navigate = true; };
"diff \"image\"" = { textconv = "mediainfo"; };
"diff \"text\"" = { textconv = "fold -s -w80"; };
commit = {
template = "~/.config/git/commit-message.txt";
};
push = {
default = "upstream";
};
delta = {
navigate = true;
};
"diff \"image\"" = {
textconv = "mediainfo";
};
"diff \"text\"" = {
textconv = "fold -s -w80";
};
};
};
home.packages = with pkgs; [ delta mediainfo ];
home.packages = with pkgs; [
delta
mediainfo
];
home.sessionPath = [
"$HOME/.config/git/scripts"
];
xdg.configFile = {
"git/scripts".source = ./scripts;
};
programs.gh.enable = true;
}
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# prune remote branches
git remote prune origin
git branch -r |\
awk '{print $1}' |\
grep -v -f /dev/fd/0 <(git branch -vv | grep origin) |\
awk '{print $1}' |\
xargs git branch -D
-1
View File
@@ -3,7 +3,6 @@
home.packages = with pkgs; [
rustup
bacon
libgcc
];
home.sessionPath = [ "\${CARGO_HOME:-~/.cargo}/bin" ];
}
+1
View File
@@ -2,5 +2,6 @@
{
services.syncthing = {
enable = true;
extraOptions = [ "--home=$HOME/sync" ];
};
}
+15
View File
@@ -10,6 +10,7 @@
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
completionInit = "autoload -U compinit && compinit -u";
shellAliases = {
c = "cargo";
@@ -59,6 +60,9 @@
initExtra = ''
# mise
eval "$(mise activate zsh)"
# asdf-vm
. "$HOME/.nix-profile/share/asdf-vm/asdf.sh"
'';
};
@@ -74,6 +78,17 @@
};
};
home.packages = with pkgs; [
btop
mise
ripgrep
pass
bat
procs
eza
asdf-vm
];
home.sessionPath = [
"./.git/safe/../../node_modules/.bin"
"./.git/safe/../../bin"